source: trunk/src/comctl32/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.9 KB
Line 
1/* $Id: initterm.cpp,v 1.16 2001-09-05 12:04:59 bird Exp $ */
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
14#include <os2wrap.h> //Odin32 OS/2 api wrappers
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
24// Win32 resource table (produced by wrc)
25extern DWORD comctl32_PEResTab;
26
27static HMODULE dllHandle = 0;
28
29BOOL WINAPI COMCTL32_DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
30
31BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
32{
33 switch (fdwReason)
34 {
35 case DLL_PROCESS_ATTACH:
36 case DLL_THREAD_ATTACH:
37 case DLL_THREAD_DETACH:
38 return COMCTL32_DllMain(hinstDLL, fdwReason, fImpLoad);
39
40 case DLL_PROCESS_DETACH:
41 return COMCTL32_DllMain(hinstDLL, fdwReason, fImpLoad);
42 }
43 return FALSE;
44}
45
46ULONG SYSTEM DLL_InitComCtl32(ULONG hModule)
47{
48 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
49
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;
55
56 return 0;
57}
58
59void SYSTEM DLL_TermComCtl32(ULONG hModule)
60{
61 if (dllHandle)
62 UnregisterLxDll(dllHandle);
63}
64
65ULONG SYSTEM DLL_Init(ULONG hModule)
66{
67 if (DLL_InitDefault(hModule) == -1)
68 return -1;
69 return DLL_InitComCtl32(hModule);
70}
71
72void SYSTEM DLL_Term(ULONG hModule)
73{
74 DLL_TermComCtl32(hModule);
75 DLL_TermDefault(hModule);
76}
Note: See TracBrowser for help on using the repository browser.