diff options
| author | Geoff Voelker | 1996-05-03 18:39:18 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1996-05-03 18:39:18 +0000 |
| commit | c2ccbd4304f754eae74decb1a2fe40327772e0ad (patch) | |
| tree | 9d865e507c26cd57d80020fc0b9da1031bef438d /src | |
| parent | c519b5e10e0706332a557a49299b96537305d459 (diff) | |
| download | emacs-c2ccbd4304f754eae74decb1a2fe40327772e0ad.tar.gz emacs-c2ccbd4304f754eae74decb1a2fe40327772e0ad.zip | |
(WinMain): Function removed.
(_start) [HAVE_NTGUI]: Don't invoke WinMain, but do set up
WinMain args as crt0.c would.
Diffstat (limited to 'src')
| -rw-r--r-- | src/unexw32.c | 53 |
1 files changed, 6 insertions, 47 deletions
diff --git a/src/unexw32.c b/src/unexw32.c index e00662a0fea..8fb1f8001b7 100644 --- a/src/unexw32.c +++ b/src/unexw32.c | |||
| @@ -67,45 +67,6 @@ HINSTANCE hinst = NULL; | |||
| 67 | HINSTANCE hprevinst = NULL; | 67 | HINSTANCE hprevinst = NULL; |
| 68 | LPSTR lpCmdLine = ""; | 68 | LPSTR lpCmdLine = ""; |
| 69 | int nCmdShow = 0; | 69 | int nCmdShow = 0; |
| 70 | |||
| 71 | int __stdcall | ||
| 72 | WinMain (_hinst, _hPrevInst, _lpCmdLine, _nCmdShow) | ||
| 73 | HINSTANCE _hinst; | ||
| 74 | HINSTANCE _hPrevInst; | ||
| 75 | LPSTR _lpCmdLine; | ||
| 76 | int _nCmdShow; | ||
| 77 | { | ||
| 78 | int i, j, new_argc; | ||
| 79 | char **new_argv; | ||
| 80 | |||
| 81 | /* Need to parse command line */ | ||
| 82 | |||
| 83 | hinst = _hinst; | ||
| 84 | hprevinst = _hPrevInst; | ||
| 85 | lpCmdLine = _lpCmdLine; | ||
| 86 | nCmdShow = _nCmdShow; | ||
| 87 | |||
| 88 | new_argc = __argc; | ||
| 89 | new_argv = (char **) xmalloc (sizeof (char *) * new_argc); | ||
| 90 | if (!new_argv) | ||
| 91 | return main (__argc, __argv, _environ); | ||
| 92 | |||
| 93 | for (i = j = 0; i < __argc; i++) | ||
| 94 | { | ||
| 95 | /* Allocate a console window for stdout and stderr if requested. | ||
| 96 | We want to allocate as soon as we possibly can to catch | ||
| 97 | debugging output. */ | ||
| 98 | if (!strcmp ("-output_console", __argv[i])) | ||
| 99 | { | ||
| 100 | AllocConsole (); | ||
| 101 | new_argc--; | ||
| 102 | continue; | ||
| 103 | } | ||
| 104 | new_argv[j++] = __argv[i]; | ||
| 105 | } | ||
| 106 | |||
| 107 | return main (new_argc, new_argv, _environ); | ||
| 108 | } | ||
| 109 | #endif /* HAVE_NTGUI */ | 70 | #endif /* HAVE_NTGUI */ |
| 110 | 71 | ||
| 111 | /* Startup code for running on NT. When we are running as the dumped | 72 | /* Startup code for running on NT. When we are running as the dumped |
| @@ -115,11 +76,7 @@ WinMain (_hinst, _hPrevInst, _lpCmdLine, _nCmdShow) | |||
| 115 | void | 76 | void |
| 116 | _start (void) | 77 | _start (void) |
| 117 | { | 78 | { |
| 118 | #ifdef HAVE_NTGUI | ||
| 119 | extern void WinMainCRTStartup (void); | ||
| 120 | #else | ||
| 121 | extern void mainCRTStartup (void); | 79 | extern void mainCRTStartup (void); |
| 122 | #endif /* HAVE_NTGUI */ | ||
| 123 | 80 | ||
| 124 | /* Cache system info, e.g., the NT page size. */ | 81 | /* Cache system info, e.g., the NT page size. */ |
| 125 | cache_system_info (); | 82 | cache_system_info (); |
| @@ -153,10 +110,12 @@ _start (void) | |||
| 153 | /* Invoke the NT CRT startup routine now that our housecleaning | 110 | /* Invoke the NT CRT startup routine now that our housecleaning |
| 154 | is finished. */ | 111 | is finished. */ |
| 155 | #ifdef HAVE_NTGUI | 112 | #ifdef HAVE_NTGUI |
| 156 | WinMainCRTStartup (); | 113 | /* determine WinMain args like crt0.c does */ |
| 157 | #else | 114 | hinst = GetModuleHandle(NULL); |
| 115 | lpCmdLine = GetCommandLine(); | ||
| 116 | nCmdShow = SW_SHOWDEFAULT; | ||
| 117 | #endif | ||
| 158 | mainCRTStartup (); | 118 | mainCRTStartup (); |
| 159 | #endif /* HAVE_NTGUI */ | ||
| 160 | } | 119 | } |
| 161 | 120 | ||
| 162 | /* Dump out .data and .bss sections into a new executable. */ | 121 | /* Dump out .data and .bss sections into a new executable. */ |
| @@ -415,7 +374,7 @@ get_section_info (file_data *p_infile) | |||
| 415 | 374 | ||
| 416 | /* The .data section. */ | 375 | /* The .data section. */ |
| 417 | data_section = section; | 376 | data_section = section; |
| 418 | ptr = (char *) nt_header->OptionalHeader.ImageBase + | 377 | ptr = (char *) nt_header->OptionalHeader.ImageBase + |
| 419 | section->VirtualAddress; | 378 | section->VirtualAddress; |
| 420 | data_start_va = ptr; | 379 | data_start_va = ptr; |
| 421 | data_start_file = section->PointerToRawData; | 380 | data_start_file = section->PointerToRawData; |