Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

686 lines
22 KiB

  1. /***
  2. *crt0.c - C runtime initialization routine
  3. *
  4. * Copyright (c) 1989-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This is the actual startup routine for apps. It calls the user's main
  8. * routine [w]main() or [w]WinMain after performing C Run-Time Library
  9. * initialization.
  10. *
  11. * With ifdefs, this source file also provides the source code for:
  12. * wcrt0.c the startup routine for console apps with wide chars
  13. * wincrt0.c the startup routine for Windows apps
  14. * wwincrt0.c the startup routine for Windows apps with wide chars
  15. *
  16. *Revision History:
  17. * 06-27-89 PHG Module created, based on asm version
  18. * 11-02-89 JCR Added DOS32QUERYSYSINFO to get osversion
  19. * 04-09-90 GJF Added #include <cruntime.h>. Put in explicit calling
  20. * types (_CALLTYPE1 or _CALLTYPE4) for __crt0(),
  21. * inherit(), __amsg_exit() and _cintDIV(). Also, fixed
  22. * the copyright and cleaned up the formatting a bit.
  23. * 04-10-90 GJF Fixed compiler warnings (-W3).
  24. * 08-08-90 GJF Added exception handling stuff (needed to support
  25. * runtime errors and signal()).
  26. * 08-31-90 GJF Removed 32 from API names.
  27. * 10-08-90 GJF New-style function declarators.
  28. * 12-05-90 GJF Fixed off-by-one error in inherit().
  29. * 12-06-90 GJF Win32 version of inherit().
  30. * 12-06-90 SRW Added _osfile back for win32. Changed _osfinfo from
  31. * an array of structures to an array of 32-bit handles
  32. * (_osfhnd)
  33. * 01-21-91 GJF ANSI naming.
  34. * 01-25-91 SRW Changed Win32 Process Startup [_WIN32_]
  35. * 02-01-91 SRW Removed usage of PPEB type [_WIN32_]
  36. * 02-05-91 SRW Changed to pass _osfile and _osfhnd arrays as binary
  37. * data to child process. [_WIN32_]
  38. * 04-02-91 GJF Need to get version number sooner so it can be used in
  39. * _heap_init. Prefixed an '_' onto BaseProcessStartup.
  40. * Version info now stored in _os[version|major|minor] and
  41. * _base[version|major|minor] (_WIN32_).
  42. * 04-10-91 PNT Added _MAC_ conditional
  43. * 04-26-91 SRW Removed level 3 warnings
  44. * 05-14-91 GJF Turn on exception handling for Dosx32.
  45. * 05-22-91 GJF Fixed careless errors.
  46. * 07-12-91 GJF Fixed one more careless error.
  47. * 08-13-91 GJF Removed definitions of _confh and _coninpfh.
  48. * 09-13-91 GJF Incorporated Stevewo's startup variations.
  49. * 11-07-91 GJF Revised try-except, fixed outdated comments on file
  50. * handle inheritance [_WIN32_].
  51. * 12-02-91 SRW Fixed WinMain startup code to skip over first token
  52. * plus delimiters for the lpszCommandLine parameter.
  53. * 01-17-92 GJF Merge of NT and CRT version. Restored Stevewo's scheme
  54. * for unhandled exceptions.
  55. * 02-13-92 GJF For Win32, moved file inheritance stuff to ioinit.c.
  56. * Call to inherit() is replace by call to _ioinit().
  57. * 03-23-92 OLM Created MAC version
  58. * 04-01-92 XY Add cinit call (MAC)
  59. * 04-16-92 DJM POSIX support
  60. * 06-10-92 PLM Added putenv support (MAC)
  61. * 08-26-92 SKS Add _osver, _winver, _winmajor, _winminor
  62. * 08-26-92 GJF Deleted version number(s) fetch from POSIX startup (it
  63. * involved a Win32 API call).
  64. * 09-30-92 SRW Call _heap_init before _mtinit
  65. * 03-20-93 SKS Remove obsolete variables _osmode, _cpumode, etc.
  66. * 04-01-93 CFW Change try-except to __try-__except
  67. * 04-05-93 JWM GUI apps now call MessageBox() from _amsg_exit().
  68. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  69. * 04-19-93 SKS Remove obsolete variable _atopsp
  70. * 04-26-93 SKS Change _mtinit to return failure
  71. * remove a number of OS/2 (CRUISER) ifdefs
  72. * 04-26-93 GJF Made lpszCommandLine (unsigned char *) to deal with
  73. * chars > 127 in the command line.
  74. * 04-27-93 GJF Removed support for _RT_STACK, _RT_INTDIV,
  75. * _RT_INVALDISP and _RT_NONCONT.
  76. * 05-14-93 GJF Added support for quoted program names.
  77. * 09-08-93 CFW Added call to _initmbctable.
  78. * 09-15-93 CFW Use ANSI conformant "__" names.
  79. * 09-21-93 CFW Move _initmbctable call to _cinit().
  80. * 11-05-93 CFW Undefine GetEnviromentStrings.
  81. * 11-08-93 GJF Guard as much init. code as possible with the __try -
  82. * __except statement, especially _cinit(). Also,
  83. * restored the call to __initmbctable to this module.
  84. * 11-19-93 CFW Add _wcmdln variable, enable wide char command line
  85. * only.
  86. * 11-23-93 CFW GetEnviromentStrings undef moved to internal.h.
  87. * 11-29-93 CFW Wide environment.
  88. * 12-21-93 CFW Fix API failure error handling.
  89. * 01-04-94 CFW Pass copy of environment to main.
  90. * 01-28-94 CFW Move environment copying to setenv.c.
  91. * 02-07-94 CFW POSIXify.
  92. * 03-30-93 CFW Use __crtXXX calls for Unicode model.
  93. * 04-08-93 CFW cinit() should be later.
  94. * 04-12-94 GJF Moved declaration of _[w]initenv to internal.h.
  95. * 04-14-94 GJF Enclosed whole source in #ifndef CRTDLL - #endif.
  96. * 09-02-94 SKS Fix inaccurate description in file header comment
  97. * 09-06-94 CFW Remove _MBCS_OS switch.
  98. * 09-06-94 GJF Added definitions of __error_mode and __app_type.
  99. * 10-14-94 BWT try->__try / except->__except for POSIX
  100. * 01-16-95 CFW Set default debug output for console.
  101. * 02-11-95 CFW PPC -> _M_MPPC.
  102. * 02-16-95 JWM Spliced _WIN32 & Mac versions.
  103. * 03-28-95 BWT Fail if unable to retrieve cmdline or envptr (fixes
  104. * stress bug).
  105. * 04-06-95 CFW Set default debug output for Mac.
  106. * 04-06-95 CFW Use __crtGetEnvironmentStringsA.
  107. * 04-26-95 CFW Change default debug output for Mac to debugger.
  108. * 07-04-95 GJF Interface to __crtGetEnvironmentStrings and _setenvp
  109. * changes slightly.
  110. * 07-07-95 CFW Simplify default report mode scheme.
  111. * 04-22-96 GJF Check for error on _heap_init.
  112. * 01-17-97 GJF For _heap_init() or _mtinit() failure, exit the
  113. * process without going through _exit().
  114. * 07-24-97 GJF Moved building of lpszCommandLine to wincmdln.c. Also,
  115. * heap_init changed slightly to support option to use
  116. * heap running directly on Win32 API.
  117. * 08-06-97 GJF Moved __mbctype_initialized to crt0dat.c
  118. * 12-23-97 RKP Corrected posix use of _heap_init()
  119. * 02-27-98 RKP Added 64 bit support.
  120. * 10-02-98 GJF Use GetVersionEx instead of GetVersion and store OS ID
  121. * in _osplatform.
  122. * 11-13-98 KBF Moved RTC_Initialize from _cinit to just after
  123. * _heap_init
  124. * 05-11-99 KBF Wrap RTC support in #ifdef.
  125. * 05-17-99 PML Remove all Macintosh support.
  126. * 11-03-99 RDL Win64 POSIX warning fix.
  127. * 11-12-99 KBF Create 4 new COM+ specific entrypoints which return
  128. * instead of calling exit().
  129. * 11-16-99 PML ... and remove them - linker problems mean new
  130. * entrypoints don't work. Instead, look directly at the
  131. * COM Descriptor Image Directory entry in the optional
  132. * header to see if we are a COM+ app.
  133. * 02-15-00 GB Changed GetModuleHandle to GetModuleHandleA in
  134. * check_complus_app.
  135. * 03-06-00 PML Call __crtExitProcess instead of ExitProcess.
  136. * 08-04-00 PML check_complus_app -> check_managed_app (VS7#117746).
  137. * 12-09-00 PML Tighten up check_managed_app tests (VS7#167293).
  138. * 03-17-01 PML _alloca the OSVERSIONINFO so /GS can work (vs7#224261)
  139. * 03-26-01 PML Use GetVersionExA, not GetVersionEx (vs7#230286)
  140. * 03-27-01 PML Call to _amsg_exit on startup failure now pushed up to
  141. * this level (vs7#231220)
  142. * 04-29-01 BWT Fix posix build
  143. *
  144. *******************************************************************************/
  145. #ifndef CRTDLL
  146. #include <cruntime.h>
  147. #include <dos.h>
  148. #include <internal.h>
  149. #include <process.h>
  150. #include <stdlib.h>
  151. #include <string.h>
  152. #ifndef _POSIX_
  153. #include <rterr.h>
  154. #include <rtcapi.h>
  155. #else
  156. #include <posix/sys/types.h>
  157. #include <posix/unistd.h>
  158. #include <posix/signal.h>
  159. #endif
  160. #include <windows.h>
  161. #include <awint.h>
  162. #include <tchar.h>
  163. #include <dbgint.h>
  164. /*
  165. * wWinMain is not yet defined in winbase.h. When it is, this should be
  166. * removed.
  167. */
  168. int
  169. WINAPI
  170. wWinMain(
  171. HINSTANCE hInstance,
  172. HINSTANCE hPrevInstance,
  173. LPWSTR lpCmdLine,
  174. int nShowCmd
  175. );
  176. #ifdef WPRFLAG
  177. _TUCHAR * __cdecl _wwincmdln(void);
  178. #else
  179. _TUCHAR * __cdecl _wincmdln(void);
  180. #endif
  181. /*
  182. * command line, environment, and a few other globals
  183. */
  184. #ifdef WPRFLAG
  185. wchar_t *_wcmdln; /* points to wide command line */
  186. #else
  187. char *_acmdln; /* points to command line */
  188. #endif
  189. char *_aenvptr = NULL; /* points to environment block */
  190. #ifndef _POSIX_
  191. wchar_t *_wenvptr = NULL; /* points to wide environment block */
  192. #endif
  193. #ifdef _POSIX_
  194. char *_cmdlin;
  195. #endif
  196. void (__cdecl * _aexit_rtn)(int) = _exit; /* RT message return procedure */
  197. static void __cdecl fast_error_exit(int); /* Error exit via ExitProcess */
  198. static int __cdecl check_managed_app(void); /* Determine if a managed app */
  199. /*
  200. * _error_mode and _apptype, together, determine how error messages are
  201. * written out.
  202. */
  203. int __error_mode = _OUT_TO_DEFAULT;
  204. #ifdef _WINMAIN_
  205. int __app_type = _GUI_APP;
  206. #else
  207. int __app_type = _CONSOLE_APP;
  208. #endif
  209. #ifdef _POSIX_
  210. /***
  211. *mainCRTStartup(void)
  212. *
  213. *Purpose:
  214. * This routine does the C runtime initialization, calls main(), and
  215. * then exits. It never returns.
  216. *
  217. *Entry:
  218. *
  219. *Exit:
  220. * This function never returns.
  221. *
  222. *******************************************************************************/
  223. void
  224. mainCRTStartup(
  225. void
  226. )
  227. {
  228. int mainret;
  229. int initret;
  230. char **ppch;
  231. extern char **environ;
  232. extern char * __PdxGetCmdLine(void); /* an API in the Posix SS */
  233. extern main(int,char**);
  234. _cmdlin = __PdxGetCmdLine();
  235. ppch = (char **)_cmdlin;
  236. __argv = ppch;
  237. // normalize argv pointers
  238. __argc = 0;
  239. while (NULL != *ppch) {
  240. *ppch += (int)(intptr_t)_cmdlin;
  241. ++__argc;
  242. ++ppch;
  243. }
  244. // normalize environ pointers
  245. ++ppch;
  246. environ = ppch;
  247. while (NULL != *ppch) {
  248. *ppch = *ppch + (int)(intptr_t)_cmdlin;
  249. ++ppch;
  250. }
  251. /*
  252. * If POSIX runtime needs to fetch and store POSIX verion info,
  253. * it should be done here.
  254. *
  255. * Get_and_save_version_info;
  256. */
  257. #ifdef _MT
  258. _heap_init(1); /* initialize heap */
  259. #else
  260. _heap_init(0); /* initialize heap */
  261. #endif
  262. initret = _cinit(); /* do C data initialize */
  263. if (initret != 0)
  264. _amsg_exit(initret);
  265. __try {
  266. mainret = main(__argc, __argv);
  267. } __except (EXCEPTION_EXECUTE_HANDLER) {
  268. switch (GetExceptionCode()) {
  269. case STATUS_ACCESS_VIOLATION:
  270. kill(getpid(), SIGSEGV);
  271. break;
  272. case STATUS_ILLEGAL_INSTRUCTION:
  273. case STATUS_PRIVILEGED_INSTRUCTION:
  274. kill(getpid(), SIGILL);
  275. break;
  276. case STATUS_FLOAT_DENORMAL_OPERAND:
  277. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  278. case STATUS_FLOAT_INEXACT_RESULT:
  279. case STATUS_FLOAT_OVERFLOW:
  280. case STATUS_FLOAT_STACK_CHECK:
  281. case STATUS_FLOAT_UNDERFLOW:
  282. kill(getpid(), SIGFPE);
  283. break;
  284. default:
  285. kill(getpid(), SIGKILL);
  286. }
  287. mainret = -1;
  288. }
  289. exit(mainret);
  290. }
  291. #else /* ndef _POSIX_ */
  292. /***
  293. *mainCRTStartup(void)
  294. *wmainCRTStartup(void)
  295. *WinMainCRTStartup(void)
  296. *wWinMainCRTStartup(void)
  297. *
  298. *Purpose:
  299. * These routines do the C runtime initialization, call the appropriate
  300. * user entry function, and handle termination cleanup. For a managed
  301. * app, they then return the exit code back to the calling routine, which
  302. * is the managed startup code. For an unmanaged app, they call exit and
  303. * never return.
  304. *
  305. * Function: User entry called:
  306. * mainCRTStartup main
  307. * wmainCRTStartup wmain
  308. * WinMainCRTStartup WinMain
  309. * wWinMainCRTStartup wWinMain
  310. *
  311. *Entry:
  312. *
  313. *Exit:
  314. * Managed app: return value from main() et al, or the exception code if
  315. * execution was terminated by the __except guarding the call
  316. * to main().
  317. * Unmanaged app: never return.
  318. *
  319. *******************************************************************************/
  320. #ifdef _WINMAIN_
  321. #ifdef WPRFLAG
  322. int wWinMainCRTStartup(
  323. #else
  324. int WinMainCRTStartup(
  325. #endif
  326. #else /* ndef _WINMAIN_ */
  327. #ifdef WPRFLAG
  328. int wmainCRTStartup(
  329. #else
  330. int mainCRTStartup(
  331. #endif
  332. #endif /* _WINMAIN_ */
  333. void
  334. )
  335. {
  336. int initret;
  337. int mainret;
  338. OSVERSIONINFOA *posvi;
  339. int managedapp;
  340. #ifdef _WINMAIN_
  341. _TUCHAR *lpszCommandLine;
  342. STARTUPINFO StartupInfo;
  343. #endif
  344. /*
  345. * Dynamically allocate the OSVERSIONINFOA buffer, so we avoid
  346. * triggering the /GS buffer overrun detection. That can't be
  347. * used here, since the guard cookie isn't available until we
  348. * initialize it from here!
  349. */
  350. posvi = (OSVERSIONINFOA *)_alloca(sizeof(OSVERSIONINFOA));
  351. /*
  352. * Get the full Win32 version
  353. */
  354. posvi->dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
  355. (void)GetVersionExA(posvi);
  356. _osplatform = posvi->dwPlatformId;
  357. _winmajor = posvi->dwMajorVersion;
  358. _winminor = posvi->dwMinorVersion;
  359. /*
  360. * The somewhat bizarre calculations of _osver and _winver are
  361. * required for backward compatibility (used to use GetVersion)
  362. */
  363. _osver = (posvi->dwBuildNumber) & 0x07fff;
  364. if ( _osplatform != VER_PLATFORM_WIN32_NT )
  365. _osver |= 0x08000;
  366. _winver = (_winmajor << 8) + _winminor;
  367. /*
  368. * Determine if this is a managed application
  369. */
  370. managedapp = check_managed_app();
  371. #ifdef _MT
  372. if ( !_heap_init(1) ) /* initialize heap */
  373. #else
  374. if ( !_heap_init(0) ) /* initialize heap */
  375. #endif
  376. fast_error_exit(_RT_HEAPINIT); /* write message and die */
  377. #ifdef _MT
  378. if( !_mtinit() ) /* initialize multi-thread */
  379. fast_error_exit(_RT_THREAD); /* write message and die */
  380. #endif
  381. /*
  382. * Initialize the Runtime Checks stuff
  383. */
  384. #ifdef _RTC
  385. _RTC_Initialize();
  386. #endif
  387. /*
  388. * Guard the remainder of the initialization code and the call
  389. * to user's main, or WinMain, function in a __try/__except
  390. * statement.
  391. */
  392. __try {
  393. if ( _ioinit() < 0 ) /* initialize lowio */
  394. _amsg_exit(_RT_LOWIOINIT);
  395. #ifdef WPRFLAG
  396. /* get wide cmd line info */
  397. _wcmdln = (wchar_t *)__crtGetCommandLineW();
  398. /* get wide environ info */
  399. _wenvptr = (wchar_t *)__crtGetEnvironmentStringsW();
  400. if ( _wsetargv() < 0 )
  401. _amsg_exit(_RT_SPACEARG);
  402. if ( _wsetenvp() < 0 )
  403. _amsg_exit(_RT_SPACEENV);
  404. #else
  405. /* get cmd line info */
  406. _acmdln = (char *)GetCommandLineA();
  407. /* get environ info */
  408. _aenvptr = (char *)__crtGetEnvironmentStringsA();
  409. if ( _setargv() < 0 )
  410. _amsg_exit(_RT_SPACEARG);
  411. if ( _setenvp() < 0 )
  412. _amsg_exit(_RT_SPACEENV);
  413. #endif
  414. initret = _cinit(); /* do C data initialize */
  415. if (initret != 0)
  416. _amsg_exit(initret);
  417. #ifdef _WINMAIN_
  418. StartupInfo.dwFlags = 0;
  419. GetStartupInfo( &StartupInfo );
  420. #ifdef WPRFLAG
  421. lpszCommandLine = _wwincmdln();
  422. mainret = wWinMain(
  423. #else
  424. lpszCommandLine = _wincmdln();
  425. mainret = WinMain(
  426. #endif
  427. GetModuleHandleA(NULL),
  428. NULL,
  429. lpszCommandLine,
  430. StartupInfo.dwFlags & STARTF_USESHOWWINDOW
  431. ? StartupInfo.wShowWindow
  432. : SW_SHOWDEFAULT
  433. );
  434. #else /* _WINMAIN_ */
  435. #ifdef WPRFLAG
  436. __winitenv = _wenviron;
  437. mainret = wmain(__argc, __wargv, _wenviron);
  438. #else
  439. __initenv = _environ;
  440. mainret = main(__argc, __argv, _environ);
  441. #endif
  442. #endif /* _WINMAIN_ */
  443. if ( !managedapp )
  444. exit(mainret);
  445. _cexit();
  446. }
  447. __except ( _XcptFilter(GetExceptionCode(), GetExceptionInformation()) )
  448. {
  449. /*
  450. * Should never reach here
  451. */
  452. mainret = GetExceptionCode();
  453. if ( !managedapp )
  454. _exit(mainret);
  455. _c_exit();
  456. } /* end of try - except */
  457. return mainret;
  458. }
  459. #endif /* _POSIX_ */
  460. /***
  461. *_amsg_exit(rterrnum) - Fast exit fatal errors
  462. *
  463. *Purpose:
  464. * Exit the program with error code of 255 and appropriate error
  465. * message.
  466. *
  467. *Entry:
  468. * int rterrnum - error message number (amsg_exit only).
  469. *
  470. *Exit:
  471. * Calls exit() (for integer divide-by-0) or _exit() indirectly
  472. * through _aexit_rtn [amsg_exit].
  473. * For multi-thread: calls _exit() function
  474. *
  475. *Exceptions:
  476. *
  477. *******************************************************************************/
  478. void __cdecl _amsg_exit (
  479. int rterrnum
  480. )
  481. {
  482. #ifdef _WINMAIN_
  483. if ( __error_mode == _OUT_TO_STDERR )
  484. #else
  485. if ( __error_mode != _OUT_TO_MSGBOX )
  486. #endif
  487. _FF_MSGBANNER(); /* write run-time error banner */
  488. _NMSG_WRITE(rterrnum); /* write message */
  489. _aexit_rtn(255); /* normally _exit(255) */
  490. }
  491. /***
  492. *fast_error_exit(rterrnum) - Faster exit fatal errors
  493. *
  494. *Purpose:
  495. * Exit the process with error code of 255 and appropriate error
  496. * message.
  497. *
  498. *Entry:
  499. * int rterrnum - error message number (amsg_exit only).
  500. *
  501. *Exit:
  502. * Calls ExitProcess (through __crtExitProcess).
  503. *
  504. *Exceptions:
  505. *
  506. *******************************************************************************/
  507. static void __cdecl fast_error_exit (
  508. int rterrnum
  509. )
  510. {
  511. #ifdef _WINMAIN_
  512. if ( __error_mode == _OUT_TO_STDERR )
  513. #else
  514. if ( __error_mode != _OUT_TO_MSGBOX )
  515. #endif
  516. _FF_MSGBANNER(); /* write run-time error banner */
  517. _NMSG_WRITE(rterrnum); /* write message */
  518. __crtExitProcess(255); /* normally _exit(255) */
  519. }
  520. /***
  521. *check_managed_app() - Check for a managed executable
  522. *
  523. *Purpose:
  524. * Determine if the EXE the startup code is linked into is a managed app
  525. * by looking for the COM Runtime Descriptor in the Image Data Directory
  526. * of the PE or PE+ header.
  527. *
  528. *Entry:
  529. * None
  530. *
  531. *Exit:
  532. * 1 if managed app, 0 if not.
  533. *
  534. *Exceptions:
  535. *
  536. *******************************************************************************/
  537. static int __cdecl check_managed_app (
  538. void
  539. )
  540. {
  541. PIMAGE_DOS_HEADER pDOSHeader;
  542. PIMAGE_NT_HEADERS pPEHeader;
  543. PIMAGE_OPTIONAL_HEADER32 pNTHeader32;
  544. PIMAGE_OPTIONAL_HEADER64 pNTHeader64;
  545. pDOSHeader = (PIMAGE_DOS_HEADER)GetModuleHandleA(NULL);
  546. if ( pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE )
  547. return 0;
  548. pPEHeader = (PIMAGE_NT_HEADERS)((char *)pDOSHeader +
  549. pDOSHeader->e_lfanew);
  550. if ( pPEHeader->Signature != IMAGE_NT_SIGNATURE )
  551. return 0;
  552. pNTHeader32 = (PIMAGE_OPTIONAL_HEADER32)&pPEHeader->OptionalHeader;
  553. switch ( pNTHeader32->Magic ) {
  554. case IMAGE_NT_OPTIONAL_HDR32_MAGIC:
  555. /* PE header */
  556. if ( pNTHeader32->NumberOfRvaAndSizes <=
  557. IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR )
  558. return 0;
  559. return !! pNTHeader32 ->
  560. DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR] .
  561. VirtualAddress;
  562. case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
  563. /* PE+ header */
  564. pNTHeader64 = (PIMAGE_OPTIONAL_HEADER64)pNTHeader32;
  565. if ( pNTHeader64->NumberOfRvaAndSizes <=
  566. IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR )
  567. return 0;
  568. return !! pNTHeader64 ->
  569. DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR] .
  570. VirtualAddress;
  571. }
  572. /* Not PE or PE+, so not managed */
  573. return 0;
  574. }
  575. #ifndef WPRFLAG
  576. #ifdef _POSIX_
  577. /***
  578. *RaiseException() - stub for posix FP routines
  579. *
  580. *Purpose:
  581. * Stub of a Win32 API that posix can't call
  582. *
  583. *Entry:
  584. *
  585. *Exit:
  586. *
  587. *Exceptions:
  588. *
  589. *******************************************************************************/
  590. VOID
  591. WINAPI
  592. RaiseException(
  593. DWORD dwExceptionCode,
  594. DWORD dwExceptionFlags,
  595. DWORD nNumberOfArguments,
  596. const ULONG_PTR * lpArguments
  597. )
  598. {
  599. }
  600. #endif /* _POSIX_ */
  601. #endif /* WPRFLAG */
  602. #endif /* CRTDLL */