int _winstart(void) { char *szCmd; STARTUPINFO startinfo; __set_app_type(__GUI_APP); _controlfp(0x10000, 0x30000); szCmd = GetCommandLine(); if (szCmd) { while (' ' == *szCmd) szCmd++; if ('\"' == *szCmd) { while (*++szCmd) if ('\"' == *szCmd) { szCmd++; break; } } else { while (*szCmd && ' ' != *szCmd) szCmd++; } while (' ' == *szCmd) szCmd++; } GetStartupInfo(&startinfo); exit(WinMain(GetModuleHandle(NULL), NULL, szCmd, (startinfo.dwFlags & STARTF_USESHOWWINDOW) ? startinfo.wShowWindow : SW_SHOWDEFAULT)); }
static int __cdecl pre_c_init (void) { managedapp = check_managed_app (); if (mingw_app_type) __set_app_type(_GUI_APP); else __set_app_type (_CONSOLE_APP); __onexitbegin = __onexitend = (_PVFV *) _encode_pointer ((_PVFV *)(-1)); * __MINGW_IMP_SYMBOL(_fmode) = _fmode; * __MINGW_IMP_SYMBOL(_commode) = _commode; #ifdef WPRFLAG _wsetargv(); #else _setargv(); #endif if (_MINGW_INSTALL_DEBUG_MATHERR) { if (! __defaultmatherr) { __setusermatherr (_matherr); __defaultmatherr = 1; } } if (__globallocalestatus == -1) { } return 0; }
void _start(void) { __TRY__ int argc; char **argv; char **env; _startupinfo start_info; // Sets the current application type __set_app_type(_CONSOLE_APP); // Set default FP precision to 53 bits (8-byte double) // _MCW_PC (Precision control) is not supported on // the ARM and x64 architectures #if defined(_X86_) && !defined(__x86_64) _controlfp(_PC_53, _MCW_PC); #endif start_info.newmode = 0; if ( __getmainargs( &argc, &argv, &env, 0, &start_info ) < 0 ) { ExitProcess(-1); } else { exit( main(argc, argv, env) ); } }
// address: 0x4012f8 void _start(int param1, int param2, int param3, int param4, RECT param5, int param6) { int eax; // r24 union { __size32 * x7; unsigned int x8; } eax_1; // r24{257} int ecx; // r25 int edx; // r26 unsigned int edx_1; // r26{338} int esp; // r28 eax = GetCurrentProcessId(); if (eax != 1019) { } CharUpperA(); OpenEventW(); GetDC(); eax = GetCurrentThreadId(); /* Warning: also results in ecx */ if (eax == 621) { ecx = ecx ^ param6; } if (ecx != 0) { } __set_app_type(); GetFileAttributesA(); CharUpperA(); GetProcessHeap(); CharUpperA(); OpenMutexA(); IsWindow(); eax = GetCurrentThreadId(); /* Warning: also results in ecx */ if ((eax & 0xae4) != ecx) { } eax = GetClientRect(0, ¶m5); /* Warning: also results in edx */ eax = eax | param4; if (eax != edx) { eax = (esp - 552); edx = edx ^ param2; edx = edx ^ param3; edx = edx & param1; } eax_1 = eax; edx_1 = edx; edx = edx_1 ^ 0x21cd; flags = SUBFLAGS32(eax_1, edx_1 ^ 0x21cd, eax_1 - (edx_1 ^ 0x21cd)); if (eax_1 != (edx_1 ^ 0x21cd)) { edx = (edx_1 ^ 0x21cd) + (edx_1 ^ 0x21cd) + (eax_1 < (unsigned int)(edx_1 ^ 0x21cd)); eax_1 = eax_1 - 0x3421; flags = SUBFLAGS32(eax_1, 0x3421, eax_1 - 0x3421); } if (eax_1 + edx + CF == 816) { } eax = CreateItemMoniker(); /* Warning: also results in edx */ if ((eax ^ 0x80070057) == 0) { if ((eax ^ 0x80070057) + edx == 0) { } } return; }
/* * Do the work that mainCRTStartup() would normally do */ void GetArgs(int *argc, char ***argv, char ***envp) { _startupinfo startinfo; /* * Set the app type to Console (check CRT/SRC/INTERNAL.H: * \#define _CONSOLE_APP 1) */ __set_app_type(1); /* Mark this module as an EXE file */ __onexitbegin = __onexitend = (_PVFV *)(-1); startinfo.newmode = _newmode; __getmainargs(argc, argv, envp, _dowildcard, &startinfo); __initenv = *envp; #ifdef _M_IX86 _adjust_fdiv = * _imp___adjust_fdiv; _setdefaultprecision(); #endif }
int QtWinMainCRTStartup() { #ifdef __MSVCRT__ __set_app_type (__GUI_APP); #endif SetUnhandledExceptionFilter (_gnu_exception_handler); /* * Initialize floating point unit. */ _fpreset (); /* Supplied by the runtime library. */ /* * Sets the default file mode. * If _CRT_fmode is set, also set mode for stdin, stdout * and stderr, as well * NOTE: DLLs don't do this because that would be rude! */ _mingw32_init_fmode (); /* Adust references to dllimported data that have non-zero offsets. */ _pei386_runtime_relocator (); char *szCmd; STARTUPINFO startinfo; int nRet; /* Get the command line passed to the process. */ szCmd = GetCommandLineA (); GetStartupInfo (&startinfo); /* Strip off the name of the application and any leading * whitespace. */ if (szCmd) { while (ISSPACE (*szCmd)) { szCmd++; } /* On my system I always get the app name enclosed * in quotes... */ if (*szCmd == '\"') { do { szCmd++; } while (*szCmd != '\"' && *szCmd != '\0'); if (*szCmd == '\"') { szCmd++; } } else { /* If no quotes then assume first token is program * name. */ while (!ISSPACE (*szCmd) && *szCmd != '\0') { szCmd++; } } while (ISSPACE (*szCmd)) { szCmd++; } } nRet = WinMain (GetModuleHandle (NULL), NULL, szCmd, (startinfo.dwFlags & STARTF_USESHOWWINDOW) ? startinfo.wShowWindow : SW_SHOWDEFAULT); /* * Perform exit processing for the C library. This means * flushing output and calling 'atexit' registered functions. */ _cexit (); ExitProcess (nRet); return 0; }
void fn004019E0(word32 ebp, Eq_3 * fs) { word32 * eax_14 = fs->ptr0000; fs->ptr0000 = fp - 0x00000014; __set_app_type(); globals->dw40312C = 0xFFFFFFFF; globals->dw403130 = 0xFFFFFFFF; __p__fmode(); *eax_14 = globals->dw403120; __p__commode(); *eax_14 = globals->dw40311C; Mem46[0x00403128:word32] = Mem43[_adjust_fdiv:word32]; fn00401BE0(); word32 esp_193 = fp + 0xFFFFFF6C; if (globals->dw403040 == 0x00000000) { __setusermatherr(); esp_193 = fp + 0xFFFFFF68; } fn00401BB0(); Eq_51 * esp_54 = esp_193 - 0x00000004; esp_54->dw0000 = 0x00403014; esp_54->dw0000 = 0x00403010; _initterm(); esp_54->dw0000 = fp - 0x00000070; esp_54->dw0000 = globals->dw403114; esp_54->dw0000 = fp - 0x00000068; Mem74[esp_54 - 0x00000010:word32] = fp - 0x00000074; esp_54->dw0000 = fp - 0x00000064; __getmainargs(); esp_54->dwFFFFFFF8 = 0x0040300C; esp_54->dwFFFFFFF4 = 0x00403000; _initterm(); __p__acmdln(); Eq_85 * esi_161 = dwLoc74; if (dwLoc74->b0000 == 0x22) { do { esi_161 = esi_161 + 1; bcu8 al_169 = esi_161->b0000; } while (al_169 == 0x00 || al_169 == 0x22); if (esi_161->b0000 == 0x22) { esi_161 = esi_161 + 1; goto l00401AEE; } } while (esi_161->b0000 >u 0x20) esi_161 = esi_161 + 1; l00401AEE: bcu8 al_99 = esi_161->b0000; while (al_99 != 0x00 && al_99 <=u 0x20) { esi_161 = esi_161 + 1; al_99 = esi_161->b0000; } Eq_80 eax_117; esp_54->tFFFFFFF0 = fp - 0x00000060; GetStartupInfoA(esp_54->tFFFFFFF0); if (0x00 != 0x00) eax_117 = dwLoc30 & 0x0000FFFF; else eax_117.u0 = 0x0000000A; esp_54->tFFFFFFF0 = eax_117; esp_54->ptrFFFFFFEC = esi_161; esp_54->dwFFFFFFE8 = 0x00000000; esp_54->tFFFFFFE4.u0 = 0x00000000; Eq_80 eax_127 = GetModuleHandleA(esp_54->tFFFFFFE4); esp_54->tFFFFFFE4 = eax_127; fn00401BFC(ebp, dwArg00, dwArg04, dwArg08); esp_54->tFFFFFFF0 = eax_127; exit(esp_54->tFFFFFFF0); fp->dwFFFFFFF8 = 0xFFFFFFFF; fs->ptr0000 = eax_14; return; }
static int __cdecl pre_c_init(void) { /* * Determine if this is a managed application */ managedapp = check_managed_app(); /* * Set __app_type properly */ #ifdef _WINMAIN_ __set_app_type(_GUI_APP); #else /* _WINMAIN_ */ __set_app_type(_CONSOLE_APP); #endif /* _WINMAIN_ */ /* * Mark this module as an EXE file so that atexit/_onexit * will do the right thing when called, including for C++ * d-tors. */ __onexitbegin = __onexitend = (_PVFV*)_encode_pointer((_PVFV*)(-1)); /* * Propogate the _fmode and _commode variables to the DLL */ *_IMP___FMODE = _fmode; *_IMP___COMMODE = _commode; #ifdef _M_IX86 /* * Set the local copy of the Pentium FDIV adjustment flag */ _adjust_fdiv = * _imp___adjust_fdiv; #endif /* _M_IX86 */ /* * Run the RTC initialization code for this DLL */ #ifdef _RTC _RTC_Initialize(); #endif /* _RTC */ /* * Call _setargv(), which will trigger a call to __setargv() if * SETARGV.OBJ is linked with the EXE. If SETARGV.OBJ is not * linked with the EXE, a dummy _setargv() will be called. */ #ifdef WPRFLAG _wsetargv(); #else /* WPRFLAG */ _setargv(); #endif /* WPRFLAG */ /* * If the user has supplied a _matherr routine then set * __pusermatherr to point to it. */ if (!__defaultmatherr) { __setusermatherr(_matherr); } #ifdef _M_IX86 _setdefaultprecision(); #endif /* _M_IX86 */ /* Enable per-thread locale if user asked for it */ if (__globallocalestatus == -1) { _configthreadlocale(-1); } return 0; }
void fn1310E4E5(Eq_281 * fs) { word32 * eax_14 = fs->ptr0000; fs->ptr0000 = fp - 0x00000014; __set_app_type(); __p__fmode(); *eax_14 = 0x00000000; __p__commode(); *eax_14 = 0x00000000; word32 eax_51 = Mem49[_adjust_fdiv:word32]; fn1310E63E(); word32 esp_193 = fp + 0xFFFFFF68; if (eax_51 == 0x00000000) { __setusermatherr(); esp_193 = fp + 0xFFFFFF64; } fn1310E629(); Eq_318 * esp_59 = esp_193 - 0x00000004; esp_59->dw0000 = fp - 0x00000080; esp_59->dw0000 = fp - 0x00000080; _initterm(); esp_59->tFFFFFFF4 = fp - 0x00000070; esp_59->dwFFFFFFF0 = eax_51; esp_59->dwFFFFFFEC = fp - 0x00000068; esp_59->dwFFFFFFE8 = fp - 0x00000074; esp_59->dwFFFFFFE4 = fp - 0x00000064; __getmainargs(); esp_59->dwFFFFFFDC = fp - 0x00000080; esp_59->dwFFFFFFD8 = fp - 0x00000080; _initterm(); word32 esi_161 = Mem85[_acmdln:word32]; if (esi_161->b0000 == 0x22) { l1310E597: do { esi_161 = esi_161 + 1; bcu8 al_171 = esi_161->b0000; } while (al_171 == 0x00 || al_171 == 0x22); if (esi_161->b0000 == 0x22) { l1310E5AA: esi_161 = esi_161 + 1; l1310E5AE: bcu8 al_98 = esi_161->b0000; if (al_98 != 0x00 && al_98 <=u 0x20) goto l1310E5AA; } else goto l1310E5AE; } else while (esi_161->b0000 >u 0x20) esi_161 = esi_161 + 1; Eq_57 eax_113; esp_59->tFFFFFFF4 = fp - 0x00000060; GetStartupInfoA(esp_59->tFFFFFFF4); word32 esp_109 = &esp_59->tFFFFFFF4; if (0x00 != 0x00) eax_113 = (word32) wLoc30; else { esp_59->tFFFFFFF4.u0 = 0x0000000A; eax_113 = esp_59->tFFFFFFF4; esp_109 = &esp_59->tFFFFFFF4; } Eq_439 * esp_115 = esp_109 - 0x00000004; esp_115->t0000 = eax_113; Mem118[esp_115 - 0x00000004:word32] = esi_161; esp_115->t0000.u0 = 0x00000000; esp_115->t0000.u0 = 0x00000000; Mem126[esp_115 - 0x0000000C:word32] = GetModuleHandleA(esp_115->t0000); esp_115->dw0016 = fn1310E09B(); exit(esp_115->dw0016); word32 ecx_137 = **dwLoc18; esp_115->ptr0012 = dwLoc18; esp_115->dw000E = ecx_137; _XcptFilter(); return; }
void fn004012F8(word32 edx, word32 ebp, word32 dwArg00, word32 dwArg01, word32 dwArg05, word32 dwArg0B) { // def fp // def dwArg00 // def dwArg01 // def dwLoc0120 // def dwLocB8 // def dwLoc0180 // def dwLoc03 // def dwLoc0154 // def dwLoc01B4 // def dwArg0B // def dwLoc010E // def dwLoc0118 // def dwLoc4C // def dwLoc8C // def dwLoc0234 // def dwLocBD // def dwLocC3 // def dwLoc0225 // def dwLoc021C // def dwLoc0227 // def dwLoc0140 // def dwArg05 eax_7 = GetCurrentProcessId(); if (eax_7 != 0x000003FB) ; dwLoc0268_28 = fp - 0x00000004; v15_29 = fp - 0x00000098; dwLoc0268_30 = fp - 0x00000098; CharUpperA(fp - 0x00000098); ecx_36 = &fp->dwFFFFFD98; dwLoc0268_38 = &fp->dwFFFFFD98; dwLoc026C_41 = 0x00000000; dwLoc0270_43.u0 = 0x00000000; OpenEventW(0x00000000, 0x00000000, &fp->dwFFFFFD98); dwLoc0268_52 = 0x00000000; GetDC(0x00000000); eax_55 = GetCurrentThreadId(); if (eax_55 == 0x0000026D) ecx_595 = &fp->dwFFFFFD98 ^ dwArg05; // ecx_64 = PHI(ecx_36, ecx_595) esp_68 = fp - 0x00000268; fp->dwFFFFFD98 = 0x00000002; if (ecx_64 != 0x00000000) ; __set_app_type(); dwLoc026C_85 = fp - 0x00000004; v20_86 = fp - 0x000000B4; dwLoc026C_87 = fp - 0x000000B4; GetFileAttributesA(fp - 0x000000B4); dwLoc026C_92 = &fp->dwFFFFFD98; CharUpperA(&fp->dwFFFFFD98); GetProcessHeap(); dwLoc026C_98 = &fp->dwFFFFFD98; eax_99 = CharUpperA(&fp->dwFFFFFD98); dwLoc026C_107 = &fp->dwFFFFFD98; esp_108 = &fp->tFFFFFD90; fp->tFFFFFD90.u0 = 0x00000000; eax_110 = eax_99 & 0x00000008; dwLoc0274_112 = eax_99 & 0x00000008; eax_113 = OpenMutexA(eax_99 & 0x00000008, 0x00000000, &fp->dwFFFFFD98); ecx_115 = &fp->dwFFFFFD98 & 0x0000011C; eax_118 = eax_113 - dwArg00; ecx_120 = ecx_115 - dwArg01; dwLoc026C_122 = eax_118; IsWindow(eax_118); v22_126 = dwLoc0120 - (fp - 0x00000004); dwLoc0120_127 = v22_126; edx_128 = fp - 0x00000004 ^ 0x00000611; eax_129 = GetCurrentThreadId(); eax_130 = eax_129 & 0x00000AE4; if ((eax_129 & 0x00000AE4) != ecx_120) { edx_564 = edx_128 | ecx_120; ecx_566 = ecx_120 | dwLoc0140; v25_570 = dwLocB8 + ecx_566; dwLocB8_571 = v25_570; ecx_572 = fp - 0x00000004; } // dwLocB8_142 = PHI(dwLocB8, dwLocB8_571) // ecx_143 = PHI(ecx_120, ecx_572) // edx_144 = PHI(edx_128, edx_564) dwLoc026C_148 = fp - 0x00000004; v26_149 = fp - 0x00000060; dwLoc026C_150 = fp - 0x00000060; esp_151 = &fp->tFFFFFD90; fp->tFFFFFD90.u0 = 0x00000000; eax_153 = GetClientRect(0x00000000, fp - 0x00000060); eax_156 = eax_153 | dwLoc0180; if (eax_156 != edx_144) { eax_552 = &fp->dwFFFFFD98; edx_556 = edx_144 ^ dwLoc0225; edx_558 = edx_556 ^ dwLoc021C; edx_560 = edx_558 & dwLoc0227; } // edx_165 = PHI(edx_144, edx_560) // eax_166 = PHI(eax_156, eax_552) edx_169 = edx_165 ^ 0x000021CD; SCZO_170 = cond(eax_166 - edx_169); C_173 = SCZO_170; if (eax_166 != edx_169) { edx_534 = edx_169 * 0x00000002 + (eax_166 <u edx_169); ecx_535 = ecx_143 + v22_126; eax_542 = eax_166 - 0x00003421; SCZO_545 = cond(eax_542); C_548 = SCZO_545; } // ecx_179 = PHI(ecx_143, ecx_535) // edx_180 = PHI(edx_169, edx_534) // eax_181 = PHI(eax_166, eax_542) // C_182 = PHI(C_173, C_548) esp_183 = &fp->tFFFFFD90; fp->tFFFFFD90.u0 = 0x00000000; eax_185 = eax_181 + edx_180 + C_182; if (eax_185 == 0x00000330) { edx_530 = edx_180 ^ 0x00001DF0; ecx_531 = ecx_179 - 0x0000292F; } // ecx_193 = PHI(ecx_179, ecx_531) // edx_194 = PHI(edx_180, edx_530) dwLoc0274_197 = 0x00000000; eax_198 = CreateItemMoniker(0x00000000, 0x00000000, null); eax_200 = eax_198 ^ 0x80070057; if ((eax_198 ^ 0x80070057) == 0x00000000) { eax_271 = (eax_198 ^ 0x80070057) + edx_194; if (eax_271 == 0x00000000) { edx_521 = &fp->dwFFFFFD98; eax_522 = eax_271 - dwLocB8_142; ecx_525 = ecx_193 & dwLocBD; ecx_527 = ecx_525 - dwLocC3; } // ecx_278 = PHI(ecx_193, ecx_527) // edx_279 = PHI(edx_194, edx_521) // eax_280 = PHI(eax_271, eax_522) esp_281 = &fp->dwFFFFFD94; fp->dwFFFFFD94 = eax_280; esp_283 = &fp->tFFFFFD90; fp->tFFFFFD90 = ecx_278; esp_285 = &fp->dwFFFFFD8C; fp->dwFFFFFD8C = edx_279; ecx_299 = ecx_278 & 0x00002F37; ecx_305 = ecx_299 + dwLoc03; if (fp - 0x00000004 != ecx_305) ecx_508 = &fp->dwFFFFFD98; // ecx_316 = PHI(ecx_305, ecx_508) if (ecx_316 != 0x00000000) ; dwLoc0294_329 = 0x00002000; dwLoc0298_334 = 0x00000000; eax_337 = VirtualAlloc(0x00000000, 0x00002000, 0x00001000, 0x00000040); dwLoc0218_340 = eax_337; if (dwLoc0154 == ecx_316) { ecx_487 = ecx_316 + 0x00001D56; ecx_491 = ecx_487 ^ 0x00002863; } // ecx_350 = PHI(ecx_316, ecx_491) ecx_354 = ecx_350 - dwLoc01B4; ecx_358 = ecx_354 | dwArg0B; eax_361 = fp - 0x00000004 ^ dwLoc010E; eax_363 = eax_361 + dwLoc0118; edi_365 = &globals->dw412E33; ecx_366 = ecx_358 + eax_363; esi_367 = eax_337; edx_370 = fp + 0xFFFFDB3F; dwLoc68_371 = 0xA37A6ED7; ecx_372 = ecx_366 - 0x000028C3; if (ecx_366 != 0x000028C3) { ecx_475 = ecx_366 - 0x000028C3 | 0x000028C3; goto l00401606; } l00401606: do { // dwLoc68_378 = PHI(dwLoc68_371, dwLoc68_371, dwLoc68_393) // edi_382 = PHI(edi_365, edi_365, edi_413) // esi_383 = PHI(esi_367, esi_367, esi_415) // ecx_384 = PHI(ecx_372, ecx_475, ecx_402) // edx_385 = PHI(edx_370, edx_370, edx_414) // eax_386 = PHI(eax_363, eax_363, eax_424) ebx_388 = *edi_382; ecx_390 = ecx_384 ^ dwLoc4C; ebx_391 = ebx_388 + dwLoc68_378; v44_392 = dwLoc68_378 + 0x623ED7F6; dwLoc68_393 = v44_392; ecx_394 = ecx_390 & edx_385; C_395 = false; edx_396 = edx_385 - eax_386; Mem397[esi_383 + 0x00000000:word32] = ebx_391; eax_398 = eax_386 | 0x00002279; edi_400 = edi_382 + 20138706; ecx_402 = ecx_394 - dwLoc8C; esi_404 = esi_383 + 0xA596E2A8; if (eax_398 == 0x000003EF) { eax_466 = eax_398 | 0x000038A7; edx_468 = &fp->dwFFFFFD98 - ecx_402; eax_469 = (eax_398 | 0x000038A7) & 0x00003565; } // edx_410 = PHI(edx_396, edx_468) // eax_412 = PHI(eax_398, eax_469) edi_413 = edi_400 + 0x04CD2B4C; edx_414 = edx_410 + 0x00003BBE; esi_415 = esi_404 + 0x5A691D5C; if ((dwLoc0234 & ecx_402) != 0x00000000) eax_461 = eax_412 ^ 0x000034ED; // eax_424 = PHI(eax_412, eax_461) } while (edi_413 != &globals->dw413EBF); dwLoc0218_340(); if (eax_424 == edx_414) ; }