[21840] | 1 | /* $Id: initterm.cpp,v 1.16 2001-09-05 12:04:59 bird Exp $ */
|
---|
[6375] | 2 | /*
|
---|
| 3 | * COMCTL32 DLL entry point
|
---|
| 4 | *
|
---|
| 5 | * Copyright 1998 Sander van Leeuwen
|
---|
| 6 | * Copyright 1998 Peter Fitzsimmons
|
---|
| 7 | * Copyright 1999 Achim Hasenmueller
|
---|
| 8 | *
|
---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | #define INCL_DOSMODULEMGR
|
---|
| 13 | #define INCL_DOSPROCESS
|
---|
[6644] | 14 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
[6375] | 15 | #include <stdlib.h>
|
---|
| 16 | #include <stdio.h>
|
---|
| 17 | #include <string.h>
|
---|
| 18 | #include <misc.h> /*PLF Wed 98-03-18 23:18:29*/
|
---|
| 19 | #include <win32type.h>
|
---|
| 20 | #include <winconst.h>
|
---|
| 21 | #include <odinlx.h>
|
---|
| 22 | #include <initdll.h>
|
---|
| 23 |
|
---|
[21840] | 24 | // Win32 resource table (produced by wrc)
|
---|
| 25 | extern DWORD comctl32_PEResTab;
|
---|
[6375] | 26 |
|
---|
| 27 | static HMODULE dllHandle = 0;
|
---|
| 28 |
|
---|
[10097] | 29 | BOOL WINAPI COMCTL32_DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
---|
[6375] | 30 |
|
---|
| 31 | BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
| 32 | {
|
---|
[21840] | 33 | switch (fdwReason)
|
---|
| 34 | {
|
---|
| 35 | case DLL_PROCESS_ATTACH:
|
---|
| 36 | case DLL_THREAD_ATTACH:
|
---|
| 37 | case DLL_THREAD_DETACH:
|
---|
[10097] | 38 | return COMCTL32_DllMain(hinstDLL, fdwReason, fImpLoad);
|
---|
[6375] | 39 |
|
---|
[21840] | 40 | case DLL_PROCESS_DETACH:
|
---|
[10097] | 41 | return COMCTL32_DllMain(hinstDLL, fdwReason, fImpLoad);
|
---|
[21840] | 42 | }
|
---|
| 43 | return FALSE;
|
---|
[6375] | 44 | }
|
---|
[21840] | 45 |
|
---|
| 46 | ULONG SYSTEM DLL_InitComCtl32(ULONG hModule)
|
---|
[6375] | 47 | {
|
---|
[21840] | 48 | CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
|
---|
[6375] | 49 |
|
---|
[21840] | 50 | dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&comctl32_PEResTab,
|
---|
| 51 | COMCTL32_MAJORIMAGE_VERSION, COMCTL32_MINORIMAGE_VERSION,
|
---|
| 52 | IMAGE_SUBSYSTEM_WINDOWS_GUI);
|
---|
| 53 | if (dllHandle == 0)
|
---|
| 54 | return -1;
|
---|
[6375] | 55 |
|
---|
[21840] | 56 | return 0;
|
---|
| 57 | }
|
---|
[6375] | 58 |
|
---|
[21840] | 59 | void SYSTEM DLL_TermComCtl32(ULONG hModule)
|
---|
| 60 | {
|
---|
| 61 | if (dllHandle)
|
---|
[6644] | 62 | UnregisterLxDll(dllHandle);
|
---|
[21840] | 63 | }
|
---|
[6375] | 64 |
|
---|
[21840] | 65 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
| 66 | {
|
---|
| 67 | if (DLL_InitDefault(hModule) == -1)
|
---|
| 68 | return -1;
|
---|
| 69 | return DLL_InitComCtl32(hModule);
|
---|
[6375] | 70 | }
|
---|
[21840] | 71 |
|
---|
| 72 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
| 73 | {
|
---|
| 74 | DLL_TermComCtl32(hModule);
|
---|
| 75 | DLL_TermDefault(hModule);
|
---|
| 76 | }
|
---|