;
break;
}
/* some other thread is running native startup/shutdown during a cctor/domain unload.
Should only happen if this DLL was built using the Everett-compat loader lock fix in
vcclrit.h
*/
/* wait for the other thread to complete init before we return */
Sleep(1000);
}
if (__native_startup_state == __initializing)
{
_amsg_exit( _RT_CRT_INIT_CONFLICT);
}
else if (__native_startup_state == __uninitialized)
{
__native_startup_state = __initializing;
#ifndef _SYSCRT
if (_initterm_e( __xi_a, __xi_z ) != 0)
{
return 255;
}
#else /* _SYSCRT */
_initterm((_PVFV *)(void *)__xi_a, (_PVFV *)(void *)__xi_z);
#endif /* _SYSCRT */
}
else
{
has_cctor = 1;
}
/*
* do C++ constructors (initializers) specific to this EXE
*/
if (__native_startup_state == __initializing)
{
_initterm( __xc_a, __xc_z );
__native_startup_state = __initialized;
}
_ASSERTE(__native_startup_state == __initialized);
if(!nested)
{
/* For X86, the definition of InterlockedExchangePointer wrongly causes warning C4312 */
#pragma warning(push)
#pragma warning(disable:4312)
InterlockedExchangePointer((volatile PVOID *)&__native_startup_lock, 0);
#pragma warning(pop)
}
/*
* If we have any dynamically initialized __declspec(thread)
* variables, then invoke their initialization for the primary
* thread used to start the process, by calling __dyn_tls_init
* through a callback defined in tlsdyn.obj.
*/
if (__dyn_tls_init_callback != NULL &&
_IsNonwritableInCurrentImage((PBYTE)&__dyn_tls_init_callback))
{
__dyn_tls_init_callback(NULL, DLL_THREAD_ATTACH, NULL);
}
/* Enable buffer count checking if linking against static lib */
_CrtSetCheckCount(TRUE);
#ifdef _WINMAIN_
/*
* Skip past program name (first token in command line).
* Check for and handle quoted program name.
*/
#ifdef WPRFLAG
/* OS may not support "W" flavors */
if (_wcmdln == NULL)
return 255;
lpszCommandLine = (wchar_t *)_wcmdln;
#else /* WPRFLAG */
lpszCommandLine = (unsigned char *)_acmdln;
#endif /* WPRFLAG */
while (*lpszCommandLine > SPACECHAR ||
(*lpszCommandLine&&inDoubleQuote)) {
/*
* Flip the count from 1 to 0 or 0 to 1 if current character
* is DOUBLEQUOTE
*/
if (*lpszCommandLine==DQUOTECHAR) inDoubleQuote=!inDoubleQuote;
#ifdef _MBCS
if (_ismbblead(*lpszCo |