Changeset 21871 for branches/gcc-kmk/src/comdlg32/initterm.cpp
- Timestamp:
- Dec 9, 2011, 12:22:52 PM (14 years ago)
- File:
-
- 1 moved
-
branches/gcc-kmk/src/comdlg32/initterm.cpp (moved) (moved from branches/gcc-kmk/src/comdlg32/initcomdlg32.cpp ) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/gcc-kmk/src/comdlg32/initterm.cpp
r21842 r21871 1 /* $Id: init comdlg32.cpp,v 1.5 2003-04-08 12:43:29 sandervlExp $ */1 /* $Id: initterm.cpp,v 1.14 2001-09-05 12:12:02 bird Exp $ */ 2 2 /* 3 * DLL entry point3 * COMDLG32 DLL entry point 4 4 * 5 5 * Copyright 1998 Sander van Leeuwen 6 6 * Copyright 1998 Peter Fitzsimmons 7 7 * 8 *9 8 * Project Odin Software License can be found in LICENSE.TXT 10 *11 9 */ 12 10 13 /*-------------------------------------------------------------*/14 /* INITERM.C -- Source for a custom dynamic link library */15 /* initialization and termination (_DLL_InitTerm) */16 /* function. */17 /* */18 /* When called to perform initialization, this sample function */19 /* gets storage for an array of integers, and initializes its */20 /* elements with random integers. At termination time, it */21 /* frees the array. Substitute your own special processing. */22 /*-------------------------------------------------------------*/23 24 25 /* Include files */26 11 #define INCL_DOSMODULEMGR 27 12 #define INCL_DOSPROCESS … … 39 24 #include <initdll.h> 40 25 41 extern "C" { 42 //Win32 resource table (produced by wrc) 43 extern DWORD comdlg32_PEResTab; 44 45 BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved); 46 } 26 // Win32 resource table (produced by wrc) 27 extern DWORD comdlg32_PEResTab; 47 28 48 29 static HMODULE dllHandle = 0; 49 30 50 //****************************************************************************** 51 //****************************************************************************** 31 BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved); 32 52 33 BOOL WINAPI LibMainComdlg32(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) 53 34 { 54 switch (fdwReason)55 {56 case DLL_PROCESS_ATTACH:57 return COMDLG32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);35 switch (fdwReason) 36 { 37 case DLL_PROCESS_ATTACH: 38 return COMDLG32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad); 58 39 59 case DLL_THREAD_ATTACH:60 case DLL_THREAD_DETACH:61 case DLL_PROCESS_DETACH:62 COMDLG32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);63 return TRUE;64 }65 return FALSE;40 case DLL_THREAD_ATTACH: 41 case DLL_THREAD_DETACH: 42 case DLL_PROCESS_DETACH: 43 COMDLG32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad); 44 return TRUE; 45 } 46 return FALSE; 66 47 } 67 /****************************************************************************/ 68 /* _DLL_InitTerm is the function that gets called by the operating system */ 69 /* loader when it loads and frees this DLL for each process that accesses */ 70 /* this DLL. However, it only gets called the first time the DLL is loaded */ 71 /* and the last time it is freed for a particular process. The system */ 72 /* linkage convention MUST be used because the operating system loader is */ 73 /* calling this function. */ 74 /****************************************************************************/ 75 ULONG APIENTRY inittermComdlg32(ULONG hModule, ULONG ulFlag) 48 49 ULONG SYSTEM DLL_InitComdlg32(ULONG hModule) 76 50 { 77 size_t i; 78 APIRET rc; 51 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 79 52 80 /*-------------------------------------------------------------------------*/81 /* If ulFlag is zero then the DLL is being loaded so initialization should */82 /* be performed. If ulFlag is 1 then the DLL is being freed so */83 /* termination should be performed. */84 /*-------------------------------------------------------------------------*/53 dllHandle = RegisterLxDll(hModule, LibMainComdlg32, (PVOID)&comdlg32_PEResTab, 54 COMDLG32_MAJORIMAGE_VERSION, COMDLG32_MINORIMAGE_VERSION, 55 IMAGE_SUBSYSTEM_WINDOWS_GUI); 56 if (dllHandle == 0) 57 return -1; 85 58 86 switch (ulFlag) { 87 case 0 : 88 dllHandle = RegisterLxDll(hModule, LibMainComdlg32, (PVOID)&comdlg32_PEResTab, 89 COMDLG32_MAJORIMAGE_VERSION, COMDLG32_MINORIMAGE_VERSION, 90 IMAGE_SUBSYSTEM_WINDOWS_GUI); 91 if(dllHandle == 0) 92 return 0UL; 59 return 0; 60 } 93 61 94 break; 95 case 1 : 96 if(dllHandle) { 97 UnregisterLxDll(dllHandle); 98 } 99 break; 100 default : 101 return 0UL; 102 } 62 void SYSTEM DLL_TermComdlg32(ULONG hModule) 63 { 64 if (dllHandle) 65 UnregisterLxDll(dllHandle); 66 } 103 67 104 /***********************************************************/ 105 /* A non-zero value must be returned to indicate success. */ 106 /***********************************************************/ 107 return 1UL; 68 ULONG SYSTEM DLL_Init(ULONG hModule) 69 { 70 if (DLL_InitDefault(hModule) == -1) 71 return -1; 72 return DLL_InitComdlg32(hModule); 108 73 } 74 75 void SYSTEM DLL_Term(ULONG hModule) 76 { 77 DLL_TermComdlg32(hModule); 78 DLL_TermDefault(hModule); 79 }
Note:
See TracChangeset
for help on using the changeset viewer.
