source: trunk/src/wsock32/initterm.cpp

Last change on this file was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 1.7 KB
RevLine 
[21865]1/* $Id: initterm.cpp,v 1.17 2001-09-05 10:26:30 bird Exp $
[6639]2 *
[21865]3 * WSOCK32 DLL entry point
[6375]4 *
5 * Copyright 1998 Sander van Leeuwen
6 * Copyright 1998 Peter Fitzsimmons
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 */
10
11#define INCL_DOSMODULEMGR
12#define INCL_DOSPROCESS
13#include <os2wrap.h> //Odin32 OS/2 api wrappers
14#include <stdlib.h>
15#include <stdio.h>
16#include <string.h>
17#include <odin.h>
18#include <win32type.h>
19#include <winconst.h>
20#include <odinlx.h>
21#include <misc.h> /*PLF Wed 98-03-18 23:18:15*/
22#include <initdll.h>
23
[6639]24#define DBG_LOCALLOG DBG_initterm
[6375]25#include "dbglocal.h"
26
[21865]27// Win32 resource table (produced by wrc)
28extern DWORD wsock32_PEResTab;
29
[6375]30static HMODULE dllHandle = 0;
31
[7041]32INT WIN32API WSACleanup();
[21865]33
[7041]34BOOL WINAPI WinsockLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
35{
[21865]36 switch (fdwReason)
37 {
38 case DLL_PROCESS_ATTACH:
39 return TRUE;
[7041]40
[21865]41 case DLL_THREAD_ATTACH:
42 case DLL_THREAD_DETACH:
43 return TRUE;
[7041]44
[21865]45 case DLL_PROCESS_DETACH:
46 WSACleanup();
47 return TRUE;
48 }
49 return FALSE;
[7041]50}
[21865]51
52ULONG SYSTEM DLL_InitWSock32(ULONG hModule)
[6375]53{
[21865]54 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
[6375]55
[21865]56 ParseLogStatusWSOCK32();
[6375]57
[21865]58 dllHandle = RegisterLxDll(hModule, WinsockLibMain, (PVOID)&wsock32_PEResTab);
59 if (dllHandle == 0)
60 return -1;
[6375]61
[21865]62 return 0;
63}
[6375]64
[21865]65void SYSTEM DLL_TermWSock32(ULONG hModule)
66{
67 if (dllHandle)
68 UnregisterLxDll(dllHandle);
69}
[6375]70
[21865]71ULONG SYSTEM DLL_Init(ULONG hModule)
72{
73 if (DLL_InitDefault(hModule) == -1)
74 return -1;
75 return DLL_InitWSock32(hModule);
[6375]76}
[21865]77
78void SYSTEM DLL_Term(ULONG hModule)
79{
80 DLL_TermWSock32(hModule);
81 DLL_TermDefault(hModule);
82}
Note: See TracBrowser for help on using the repository browser.