| 1 | /* $Id: initterm.cpp,v 1.8 2003-10-24 13:10:03 sandervl Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * WININET DLL entry point
|
|---|
| 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 |
|
|---|
| 24 | // Win32 resource table (produced by wrc)
|
|---|
| 25 | extern DWORD wininet_PEResTab;
|
|---|
| 26 |
|
|---|
| 27 | static HMODULE dllHandle = 0;
|
|---|
| 28 |
|
|---|
| 29 | BOOL WINAPI WININET_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
|---|
| 30 |
|
|---|
| 31 | BOOL WINAPI WininetLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
|---|
| 32 | {
|
|---|
| 33 | BOOL ret;
|
|---|
| 34 |
|
|---|
| 35 | switch (fdwReason)
|
|---|
| 36 | {
|
|---|
| 37 | case DLL_PROCESS_ATTACH:
|
|---|
| 38 | case DLL_THREAD_ATTACH:
|
|---|
| 39 | case DLL_THREAD_DETACH:
|
|---|
| 40 | return WININET_LibMain(hinstDLL, fdwReason, fImpLoad);
|
|---|
| 41 |
|
|---|
| 42 | case DLL_PROCESS_DETACH:
|
|---|
| 43 | ret = WININET_LibMain(hinstDLL, fdwReason, fImpLoad);
|
|---|
| 44 | return ret;
|
|---|
| 45 | }
|
|---|
| 46 | return FALSE;
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | ULONG SYSTEM DLL_InitWinInet(ULONG hModule)
|
|---|
| 50 | {
|
|---|
| 51 | CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed 98-03-18 05:28:48*/
|
|---|
| 52 |
|
|---|
| 53 | dllHandle = RegisterLxDll(hModule, WininetLibMain, (PVOID)&wininet_PEResTab);
|
|---|
| 54 | if (dllHandle == 0)
|
|---|
| 55 | return -1;
|
|---|
| 56 |
|
|---|
| 57 | return 0;
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | void SYSTEM DLL_TermWinInet(ULONG hModule)
|
|---|
| 61 | {
|
|---|
| 62 | if (dllHandle)
|
|---|
| 63 | UnregisterLxDll(dllHandle);
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
|---|
| 67 | {
|
|---|
| 68 | if (DLL_InitDefault(hModule) == -1)
|
|---|
| 69 | return -1;
|
|---|
| 70 | return DLL_InitWinInet(hModule);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | void SYSTEM DLL_Term(ULONG hModule)
|
|---|
| 74 | {
|
|---|
| 75 | DLL_TermWinInet(hModule);
|
|---|
| 76 | DLL_TermDefault(hModule);
|
|---|
| 77 | }
|
|---|