Author: akhaldi
Date: Sat Apr 30 14:26:21 2011
New Revision: 51504
URL:
http://svn.reactos.org/svn/reactos?rev=51504&view=rev
Log:
[CRT/MINGW-W64]
* Reorganize dll entry and C runtime initialization. By Kai Tietz.
Modified:
trunk/reactos/lib/3rdparty/mingw/crtdll.c
Modified: trunk/reactos/lib/3rdparty/mingw/crtdll.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/crtdll.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/crtdll.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/crtdll.c [iso-8859-1] Sat Apr 30 14:26:21 2011
@@ -180,33 +180,33 @@
goto i__leave;
}
_pei386_runtime_relocator ();
- if (retcode && dwReason == DLL_PROCESS_ATTACH)
+ if (dwReason == DLL_PROCESS_ATTACH || dwReason == DLL_THREAD_ATTACH)
+ {
+ retcode = _CRT_INIT (hDllHandle, dwReason, lpreserved);
+ if (!retcode)
+ goto i__leave;
+ retcode = DllEntryPoint (hDllHandle, dwReason, lpreserved);
+ if (! retcode)
+ {
+ if (dwReason == DLL_PROCESS_ATTACH)
+ _CRT_INIT (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
+ goto i__leave;
+ }
+ }
+ if (dwReason == DLL_PROCESS_ATTACH)
__main ();
- if (dwReason == DLL_PROCESS_ATTACH || dwReason == DLL_THREAD_ATTACH)
+ retcode = DllMain(hDllHandle,dwReason,lpreserved);
+ if (dwReason == DLL_PROCESS_ATTACH && ! retcode)
+ {
+ DllMain (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
+ DllEntryPoint (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
+ _CRT_INIT (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
+ }
+ if (dwReason == DLL_PROCESS_DETACH || dwReason == DLL_THREAD_DETACH)
{
retcode = DllEntryPoint (hDllHandle, dwReason, lpreserved);
- if (retcode)
- retcode = _CRT_INIT (hDllHandle, dwReason, lpreserved);
- if (! retcode)
- goto i__leave;
- }
- retcode = DllMain(hDllHandle,dwReason,lpreserved);
- if ((dwReason == DLL_PROCESS_ATTACH) && ! retcode)
- {
- DllMain (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
- _CRT_INIT (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
- DllEntryPoint (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)
- {
- retcode = DllEntryPoint (hDllHandle, dwReason, lpreserved);
- }
+ retcode = FALSE;
}
i__leave:
__native_dllmain_reason = UINT_MAX;