- Timestamp:
- Oct 24, 2011, 7:58:02 PM (14 years ago)
- Location:
- branches/gcc-kmk
- Files:
-
- 4 added
- 5 edited
-
Config.kmk (modified) (2 diffs)
-
include/custombuild.h (modified) (1 diff)
-
include/initdll.h (modified) (3 diffs)
-
src/Makefile.kmk (modified) (1 diff)
-
src/custombuild/initterm.cpp (modified) (7 diffs)
-
src/initdll (added)
-
src/initdll/Makefile.kmk (added)
-
src/initdll/initdll.cpp (added)
-
src/initdll/initdll_default.cpp (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/gcc-kmk/Config.kmk
r21695 r21733 15 15 #------------------------------------------------------------------------------ 16 16 17 TEMPLATE_OdinCxx = Odin C ++ sources17 TEMPLATE_OdinCxx = Odin C/C++ sources 18 18 TEMPLATE_OdinCxx_TOOL = GXX3OMF 19 19 TEMPLATE_OdinCxx_INCS = $(PATH_ROOT)/include/win $(PATH_ROOT)/include … … 29 29 TEMPLATE_OdinCRT_EXTENDS_BY = overriding 30 30 TEMPLATE_OdinCRT_DEFS = __WIN32OS2__ __i386__ 31 32 TEMPLATE_OdinCxxDLL = Odin C/C++ DLL 33 TEMPLATE_OdinCxxDLL_EXTENDS = OdinCxx 34 TEMPLATE_OdinCxxDLL_EXTENDS_BY = overriding 35 TEMPLATE_OdinCxxDLL_LIBS = $(TEMPLATE_OdinCxx_LIBS) $(INSTTARGET_initdll) 31 36 32 37 #------------------------------------------------------------------------------ -
branches/gcc-kmk/include/custombuild.h
r21720 r21733 34 34 typedef BOOL (WIN32API *PFN_ENDCUSTOMIZE)(); 35 35 typedef BOOL (WIN32API *PFN_ISPESTUBLOADER)(char *pszProgram); 36 37 typedef ULONG (APIENTRY *PFN_INITDLL)(ULONG hModule, ULONG ulFlag); 38 typedef void (APIENTRY *PFN_CLEANUPDLL)(ULONG ulReason); 36 39 37 40 typedef struct { -
branches/gcc-kmk/include/initdll.h
r21728 r21733 1 /** @file 2 * 3 * INITDLL library interface. 4 * 5 * Project Odin Software License can be found in LICENSE.TXT 6 */ 7 1 8 #ifndef __INITDLL_H__ 2 9 #define __INITDLL_H__ 3 10 4 #if (defined(__IBMCPP__) || defined(__IBMC__) || defined(__INNOTEK_LIBC__)) 11 #include <odin.h> 12 13 /** 14 * Called to initialize resources of the DLL module when it is loaded. 15 * 16 * This callback function is implemented by modules that link to initldll.lib 17 * and want to override the default DLL initialization procedure called when the 18 * DLL is loaded by the system (according to the INIT/TERM policy specified in 19 * the LIBRARY statement in the .DEF file). See DLL_InitDefault() for more 20 * information about the default initialization procedure. 21 * 22 * On success, the returned value must be the DosExitList() order code (high 23 * byte of the low word) that defines the order in which DLL_Term() will be 24 * called WRT other uninitialization routines and exit list handlers. Returning 25 * 0 will cause DLL_Term() to be called first. Note that if several handlers 26 * use the same order code they are called in LIFO order. For DLLs, this means 27 * that DLL_Term() will be called in the order opposite to DLL_Init(). 28 * 29 * @param hModule DLL module handle. 30 * @return Exit list order on success or -1 to indicate a failure. 31 */ 32 ULONG SYSTEM DLL_Init(ULONG hModule); 33 34 /** 35 * Called to free resources of the DLL module when it is unloaded. 36 * 37 * This callback function is implemented by modules that link to initldll.lib 38 * and want to override the default DLL uninitialization procedure called when 39 * the DLL is unloaded by the system (according to the INIT/TERM policy 40 * specified in the LIBRARY statement in the .DEF file). See DLL_TermDefault() 41 * for more information about the default uninitialization procedure. 42 * 43 * @param hModule DLL module handle. 44 */ 45 void SYSTEM DLL_Term(ULONG hModule); 46 47 /** 48 * Default DLL initialization procedure. 49 * 50 * This procedure is called if your module does not implement the DLL_Init() 51 * callback function. It performs steps necessary to initializes the C/C++ 52 * runtime. 53 * 54 * You may call this procedure from your DLL_Init() implementation to perform 55 * the standard initialization steps described above. 56 * 57 * @param hModule DLL module handle. 58 * @return 0 on success or -1 to indicate a failure. 59 */ 60 ULONG SYSTEM DLL_InitDefault(ULONG hModule); 61 62 /** 63 * Default DLL uninitialization procedure. 64 * 65 * This procedure is called if your module does not implement the DLL_Term() 66 * callback function. It performs steps necessary to terminate the C/C++ 67 * runtime. 68 * 69 * You may call this procedure from your DLL_Uniit() implementation to perform 70 * the standard initialization steps described above. 71 * 72 * @param hModule DLL module handle. 73 */ 74 void SYSTEM DLL_TermDefault(ULONG hModule); 5 75 6 76 #ifdef __cplusplus … … 8 78 #endif 9 79 80 #if defined(__IBMCPP__) || defined(__IBMC__) 81 82 /** 83 * C run-time environment initialization function. 84 * Returns 0 to indicate success and -1 to indicate failure. 85 */ 86 int _Optlink _CRT_init(void); 87 88 /** 89 * C run-time environment termination function. 90 * It only needs to be called when the C run-time functions are statically 91 * linked. 92 */ 93 void _Optlink _CRT_term(void); 94 10 95 #if (__IBMCPP__ == 300) || (__IBMC__ == 300) 11 void _Optlink __ctordtorInit( void );12 #define ctordtorInit() __ctordtorInit()13 96 14 void _Optlink __ctordtor Term( void);15 #define ctordtorTerm() __ctordtorTerm() 97 void _Optlink __ctordtorInit(void); 98 void _Optlink __ctordtorTerm(void); 16 99 17 100 #elif (__IBMCPP__ == 360) || (__IBMC__ == 360) || (__IBMC__ == 430) 18 void _Optlink __ctordtorInit( int flag );19 #define ctordtorInit() __ctordtorInit(0)20 101 21 void _Optlink __ctordtor Term( int flag);22 #define ctordtorTerm() __ctordtorTerm(0)102 void _Optlink __ctordtorInit(int flag); 103 #define __ctordtorInit() __ctordtorInit(0) 23 104 24 #elif defined(__INNOTEK_LIBC__) 105 void _Optlink __ctordtorTerm(int flag); 106 #define __ctordtorTerm() __ctordtorTerm(0) 25 107 26 extern void __ctordtorInit(void); 27 extern void __ctordtorTerm(void); 108 #else 109 #error "Unknown VAC compiler version!" 110 #endif 28 111 29 #define ctordtorInit() __ctordtorInit() 30 #define ctordtorTerm() __ctordtorTerm() 112 #elif defined(__EMX__) 113 114 int _CRT_init(void); 115 void _CRT_term(void); 116 117 void __ctordtorInit(void); 118 void __ctordtorTerm(void); 119 120 #elif defined(__WATCOMC__) 121 122 #define _DLL_InitTerm LibMain 123 124 int _Optlink _CRT_init(void); 125 void _Optlink _CRT_term(void); 126 127 #define __ctordtorInit() 128 #define __ctordtorTerm() 129 130 //prevent Watcom from mucking with this name 131 extern DWORD _Resource_PEResTab; 132 #pragma aux _Resource_PEResTab "*"; 31 133 32 134 #else … … 34 136 #endif 35 137 36 #ifndef __INNOTEK_LIBC__ 37 38 /*-------------------------------------------------------------------*/ 39 /* _CRT_init is the C run-time environment initialization function. */ 40 /* It will return 0 to indicate success and -1 to indicate failure. */ 41 /*-------------------------------------------------------------------*/ 42 int _Optlink _CRT_init(void); 43 44 /*-------------------------------------------------------------------*/ 45 /* _CRT_term is the C run-time environment termination function. */ 46 /* It only needs to be called when the C run-time functions are */ 47 /* statically linked. */ 48 /*-------------------------------------------------------------------*/ 49 void _Optlink _CRT_term(void); 50 #endif // __INNOTEK_LIBC__ 51 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57 #elif defined(__WATCOMC__) 58 59 #define _DLL_InitTerm LibMain 60 61 #define ctordtorInit() 62 #define ctordtorTerm() 63 64 #ifdef __cplusplus 65 extern "C" { 66 //prevent Watcom from mucking with this name 67 extern DWORD _Resource_PEResTab; 68 #pragma aux _Resource_PEResTab "*"; 69 } 70 #endif 71 72 #endif /* IBM CPP Compiler */ 73 74 #ifdef __cplusplus 75 extern "C" { 76 #endif 77 78 typedef ULONG (APIENTRY *PFN_INITDLL)(ULONG hModule, ULONG ulFlag); 79 typedef void (APIENTRY *PFN_CLEANUPDLL)(ULONG ulReason); 80 81 ULONG APIENTRY inittermKernel32(ULONG hModule, ULONG ulFlag); 82 void APIENTRY cleanupKernel32(ULONG ulReason); 83 84 ULONG APIENTRY inittermUser32(ULONG hModule, ULONG ulFlag); 85 void APIENTRY cleanupUser32(ULONG ulReason); 86 ULONG APIENTRY inittermOdinCtrl(ULONG hModule, ULONG ulFlag); 87 88 //NOTE!!!!!!!!!!!!!!!!! 89 //if this list is extended, then update our custombuild code!!!! 90 //NOTE!!!!!!!!!!!!!!!!! 91 ULONG APIENTRY inittermWinmm(ULONG hModule, ULONG ulFlag); 92 ULONG APIENTRY inittermShell32(ULONG hModule, ULONG ulFlag); 93 ULONG APIENTRY inittermOle32(ULONG hModule, ULONG ulFlag); 94 ULONG APIENTRY inittermComdlg32(ULONG hModule, ULONG ulFlag); 95 ULONG APIENTRY inittermComctl32(ULONG hModule, ULONG ulFlag); 96 ULONG APIENTRY inittermGdi32(ULONG hModule, ULONG ulFlag); 97 ULONG APIENTRY inittermNTDLL(ULONG hModule, ULONG ulFlag); 98 ULONG APIENTRY inittermWsock32(ULONG hModule, ULONG ulFlag); 99 ULONG APIENTRY inittermWininet(ULONG hModule, ULONG ulFlag); 100 ULONG APIENTRY inittermRpcrt4(ULONG hModule, ULONG ulFlag); 101 ULONG APIENTRY inittermAvifil32(ULONG hModule, ULONG ulFlag); 102 ULONG APIENTRY inittermQuartz(ULONG hModule, ULONG ulFlag); 103 ULONG APIENTRY inittermRiched32(ULONG hModule, ULONG ulFlag); 104 ULONG APIENTRY inittermWnaspi32(ULONG hModule, ULONG ulFlag); 105 ULONG APIENTRY inittermUxTheme(ULONG hModule, ULONG ulFlag); 106 ULONG APIENTRY inittermDInput(ULONG hModule, ULONG ulFlag); 107 ULONG APIENTRY inittermDSound(ULONG hModule, ULONG ulFlag); 108 ULONG APIENTRY inittermWinSpool(ULONG hModule, ULONG ulFlag); 109 ULONG APIENTRY inittermDDraw(ULONG hModule, ULONG ulFlag); 110 ULONG APIENTRY inittermNTDLL(ULONG hModule, ULONG ulFlag); 111 ULONG APIENTRY inittermMSVCRT(ULONG hModule, ULONG ulFlag); 112 ULONG APIENTRY inittermImm32(ULONG hModule, ULONG ulFlag); 113 ULONG APIENTRY inittermCrypt32(ULONG hModule, ULONG ulFlag); 114 ULONG APIENTRY inittermOleacc(ULONG hModule, ULONG ulFlag); 115 ULONG APIENTRY inittermmscms(ULONG hModule, ULONG ulFlag); 116 ULONG APIENTRY inittermRsaenh(ULONG hModule, ULONG ulFlag); 117 ULONG APIENTRY inittermSecur32(ULONG hModule, ULONG ulFlag); 118 119 ULONG APIENTRY InitializeKernel32(); 120 138 BOOL APIENTRY InitializeKernel32(); 121 139 VOID APIENTRY ReportFatalDllInitError(PCSZ pszModName); 122 140 123 141 #ifdef __cplusplus 124 } 142 } // extern "C" 125 143 #endif 126 144 -
branches/gcc-kmk/src/Makefile.kmk
r21697 r21733 9 9 # Include sub-makefiles. 10 10 # 11 include $(PATH_SUB_CURRENT)/initdll/Makefile.kmk 11 12 include $(PATH_SUB_CURRENT)/guidlib/Makefile.kmk 12 13 include $(PATH_SUB_CURRENT)/kernel32/Makefile.kmk -
branches/gcc-kmk/src/custombuild/initterm.cpp
r21727 r21733 7 7 * 8 8 * Project Odin Software License can be found in LICENSE.TXT 9 *10 9 */ 11 10 12 /*-------------------------------------------------------------*/ 13 /* INITERM.C -- Source for a custom dynamic link library */ 14 /* initialization and termination (_DLL_InitTerm) */ 15 /* function. */ 16 /* */ 17 /* When called to perform initialization, this sample function */ 18 /* gets storage for an array of integers, and initializes its */ 19 /* elements with random integers. At termination time, it */ 20 /* frees the array. Substitute your own special processing. */ 21 /*-------------------------------------------------------------*/ 22 23 24 /* Include files */ 11 // 12 // @todo Custom Build is broken ATM: 13 // 14 // 1. inittermXXX()/cleanupXXX() are now DLL_InitXXX/DLL_TermXXX 15 // (see the respective initterm.cpp files for more info). 16 // 2. There is no inittermXXX.cpp files any longer (all initialization functions 17 // are in XXX/initterm.cpp) so a define (e.g. CUSTOMBUILD) is necessary to 18 // disable compilation multiple versions of DLL_Init()/DLL_Term(). 19 // N. ... 20 // 21 25 22 #define INCL_DOSMODULEMGR 26 23 #define INCL_DOSMISC … … 53 50 extern "C" { 54 51 52 ULONG APIENTRY inittermKernel32(ULONG hModule); 53 void APIENTRY cleanupKernel32(ULONG hModule); 54 55 ULONG APIENTRY inittermUser32(ULONG hModule, ULONG ulFlag); 56 void APIENTRY cleanupUser32(ULONG ulReason); 57 ULONG APIENTRY inittermOdinCtrl(ULONG hModule, ULONG ulFlag); 58 59 ULONG APIENTRY inittermWinmm(ULONG hModule, ULONG ulFlag); 60 ULONG APIENTRY inittermShell32(ULONG hModule, ULONG ulFlag); 61 ULONG APIENTRY inittermOle32(ULONG hModule, ULONG ulFlag); 62 ULONG APIENTRY inittermComdlg32(ULONG hModule, ULONG ulFlag); 63 ULONG APIENTRY inittermComctl32(ULONG hModule, ULONG ulFlag); 64 ULONG APIENTRY inittermGdi32(ULONG hModule, ULONG ulFlag); 65 ULONG APIENTRY inittermNTDLL(ULONG hModule, ULONG ulFlag); 66 ULONG APIENTRY inittermWsock32(ULONG hModule, ULONG ulFlag); 67 ULONG APIENTRY inittermWininet(ULONG hModule, ULONG ulFlag); 68 ULONG APIENTRY inittermRpcrt4(ULONG hModule, ULONG ulFlag); 69 ULONG APIENTRY inittermAvifil32(ULONG hModule, ULONG ulFlag); 70 ULONG APIENTRY inittermQuartz(ULONG hModule, ULONG ulFlag); 71 ULONG APIENTRY inittermRiched32(ULONG hModule, ULONG ulFlag); 72 ULONG APIENTRY inittermWnaspi32(ULONG hModule, ULONG ulFlag); 73 ULONG APIENTRY inittermUxTheme(ULONG hModule, ULONG ulFlag); 74 ULONG APIENTRY inittermDInput(ULONG hModule, ULONG ulFlag); 75 ULONG APIENTRY inittermDSound(ULONG hModule, ULONG ulFlag); 76 ULONG APIENTRY inittermWinSpool(ULONG hModule, ULONG ulFlag); 77 ULONG APIENTRY inittermDDraw(ULONG hModule, ULONG ulFlag); 78 ULONG APIENTRY inittermNTDLL(ULONG hModule, ULONG ulFlag); 79 ULONG APIENTRY inittermMSVCRT(ULONG hModule, ULONG ulFlag); 80 ULONG APIENTRY inittermImm32(ULONG hModule, ULONG ulFlag); 81 ULONG APIENTRY inittermCrypt32(ULONG hModule, ULONG ulFlag); 82 ULONG APIENTRY inittermOleacc(ULONG hModule, ULONG ulFlag); 83 ULONG APIENTRY inittermmscms(ULONG hModule, ULONG ulFlag); 84 ULONG APIENTRY inittermRsaenh(ULONG hModule, ULONG ulFlag); 85 ULONG APIENTRY inittermSecur32(ULONG hModule, ULONG ulFlag); 86 55 87 /*-------------------------------------------------------------------*/ 56 88 /* A clean up routine registered with DosExitList must be used if */ … … 140 172 SetCustomBuildName("KERNEL32.DLL", ORDINALBASE_KERNEL32); 141 173 rc = inittermKernel32(hModule, ulFlag); 142 if(rc == 0) 174 if(rc == 0) 143 175 return 0UL; 144 176 145 177 SetCustomBuildName("USER32.DLL", ORDINALBASE_USER32); 146 178 rc = inittermUser32(hModule, ulFlag); 147 if(rc == 0) 179 if(rc == 0) 148 180 return 0UL; 149 181 … … 156 188 return 0UL; 157 189 158 SetCustomBuildName("VERSION.DLL", 0); 190 SetCustomBuildName("VERSION.DLL", 0); 159 191 if(RegisterLxDll(hModule, NULL, (PVOID)NULL) == 0) 160 192 return 0UL; … … 162 194 SetCustomBuildName("WSOCK32.DLL", ORDINALBASE_WSOCK32); 163 195 rc = inittermWsock32(hModule, ulFlag); 164 if(rc == 0) 196 if(rc == 0) 165 197 return 0UL; 166 198 167 199 SetCustomBuildName("WINMM.DLL", 0); 168 200 rc = inittermWinmm(hModule, ulFlag); 169 if(rc == 0) 201 if(rc == 0) 170 202 return 0UL; 171 203 172 204 SetCustomBuildName("RPCRT4.DLL", 0); 173 205 rc = inittermRpcrt4(hModule, ulFlag); 174 if(rc == 0) 206 if(rc == 0) 175 207 return 0UL; 176 208 177 209 SetCustomBuildName("OLE32.DLL", ORDINALBASE_OLE32); 178 210 rc = inittermOle32(hModule, ulFlag); 179 if(rc == 0) 211 if(rc == 0) 180 212 return 0UL; 181 213 182 214 SetCustomBuildName("COMCTL32.DLL", ORDINALBASE_COMCTL32); 183 215 rc = inittermComctl32(hModule, ulFlag); 184 if(rc == 0) 216 if(rc == 0) 185 217 return 0UL; 186 218 … … 191 223 SetCustomBuildName("SHELL32.DLL", ORDINALBASE_SHELL32); 192 224 rc = inittermShell32(hModule, ulFlag); 193 if(rc == 0) 225 if(rc == 0) 194 226 return 0UL; 195 227 196 228 SetCustomBuildName("COMDLG32.DLL", 0); 197 229 rc = inittermComdlg32(hModule, ulFlag); 198 if(rc == 0) 230 if(rc == 0) 199 231 return 0UL; 200 232 201 233 SetCustomBuildName("RICHED32.DLL", 0); 202 234 rc = inittermRiched32(hModule, ulFlag); 203 if(rc == 0) 204 return 0UL; 205 235 if(rc == 0) 236 return 0UL; 237 206 238 SetCustomBuildName(NULL, 0); 207 239 break; … … 246 278 ULONG APIENTRY O32__DLL_InitTerm(ULONG handle, ULONG flag); 247 279 //****************************************************************************** 248 ULONGAPIENTRY InitializeKernel32()280 BOOL APIENTRY InitializeKernel32() 249 281 { 250 282 HMODULE hModule; 251 283 252 284 DosQueryModuleHandleStrict("WGSS50", &hModule); 253 return O32__DLL_InitTerm(hModule, 0) ;285 return O32__DLL_InitTerm(hModule, 0) != 0; 254 286 } 255 287 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.
