赞
踩
- static
- BOOL __cdecl
- __DllMainCRTStartup(
- HANDLE hDllHandle,
- DWORD dwReason,
- LPVOID lpreserved
- );
-
- BOOL WINAPI
- _DllMainCRTStartup(
- HANDLE hDllHandle,
- DWORD dwReason,
- LPVOID lpreserved
- )
- {
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- /*
- * The /GS security cookie must be initialized before any exception
- * handling targetting the current image is registered. No function
- * using exception handling can be called in the current image until
- * after __security_init_cookie has been called.
- */
- __security_init_cookie();
- }
-
- return __DllMainCRTStartup(hDllHandle, dwReason, lpreserved);
- }
-
- __declspec(noinline)
- BOOL __cdecl
- __DllMainCRTStartup(
- HANDLE hDllHandle,
- DWORD dwReason,
- LPVOID lpreserved
- )
- {
- BOOL retcode = TRUE;
-
- __try {
- __native_dllmain_reason = dwReason;
- __try{
- /*
- * If this is a process detach notification, check that there has
- * been a prior process attach notification.
- */
- if ( (dwReason == DLL_PROCESS_DETACH) && (__proc_attached == 0) ) {
- retcode = FALSE;
- __leave;
- }
-
- if ( dwReason == DLL_PROCESS_ATTACH || dwReason == DLL_THREAD_ATTACH ) {
- if ( _pRawDllMain )
- retcode = (*_pRawDllMain)(hDllHandle, dwReason, lpreserved);
-
- if ( retcode )
- retcode = _CRT_INIT(hDllHandle, dwReason, lpreserved);
-
- if ( !retcode )
- __leave;
- }
-
- retcode = DllMain(hDllHandle, dwReason, lpreserved);
-
- if ( (dwReason == DLL_PROCESS_ATTACH) && !retcode ) {
- /*
- * The user's DllMain routine returned failure. Unwind the init.
- */
- DllMain(hDllHandle, DLL_PROCESS_DETACH, lpreserved);
- _CRT_INIT(hDllHandle, DLL_PROCESS_DETACH, lpreserved);
- if ( _pRawDllMain )
- (*_pRawDllMain)(hDllHandle, DLL_PROCESS_DETACH, lpreserved);
- }
-
- if ( (dwReason == DLL_PROCESS_DETACH) ||
- (dwReason == DLL_THREAD_DETACH) ) {
- if ( _CRT_INIT(hDllHandle, dwReason, lpreserved) == FALSE ) {
- retcode = FALSE ;
- }
-
- if ( retcode && _pRawDllMain ) {
- retcode = (*_pRawDllMain)(hDllHandle, dwReason, lpreserved);
- }
- }
- } __except ( __CppXcptFilter(GetExceptionCode(), GetExceptionInformation()) ) {
- retcode = FALSE;
- }
- } __finally
- {
- __native_dllmain_reason = __NO_REASON;
- }
-
- return retcode ;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。