-/*
- unexec for GNU Emacs on Windows NT.
-
+/* unexec for GNU Emacs on Windows NT.
Copyright (C) 1994 Free Software Foundation, Inc.
- This file is part of GNU Emacs.
+This file is part of GNU Emacs.
- GNU Emacs is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any later
- version.
+GNU Emacs is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
- GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with GNU Emacs; see the file COPYING. If not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+You should have received a copy of the GNU General Public License
+along with GNU Emacs; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
Geoff Voelker (voelker@cs.washington.edu) 8-12-94
*/
extern BOOL ctrl_c_handler (unsigned long type);
-#include "ntheap.h"
+#include "w32heap.h"
/* A convenient type for keeping all the info about a mapped file together. */
typedef struct file_data {
HINSTANCE hprevinst = NULL;
LPSTR lpCmdLine = "";
int nCmdShow = 0;
-
-int __stdcall
-WinMain (_hinst, _hPrevInst, _lpCmdLine, _nCmdShow)
- HINSTANCE _hinst;
- HINSTANCE _hPrevInst;
- LPSTR _lpCmdLine;
- int _nCmdShow;
-{
- /* Need to parse command line */
-
- hinst = _hinst;
- hprevinst = _hPrevInst;
- lpCmdLine = _lpCmdLine;
- nCmdShow = _nCmdShow;
-
- return (main (__argc,__argv,_environ));
-}
#endif /* HAVE_NTGUI */
/* Startup code for running on NT. When we are running as the dumped
void
_start (void)
{
-#ifdef HAVE_NTGUI
- extern void WinMainCRTStartup (void);
-#else
extern void mainCRTStartup (void);
-#endif /* HAVE_NTGUI */
/* Cache system info, e.g., the NT page size. */
cache_system_info ();
/* Invoke the NT CRT startup routine now that our housecleaning
is finished. */
#ifdef HAVE_NTGUI
- WinMainCRTStartup ();
-#else
+ /* determine WinMain args like crt0.c does */
+ hinst = GetModuleHandle(NULL);
+ lpCmdLine = GetCommandLine();
+ nCmdShow = SW_SHOWDEFAULT;
+#endif
mainCRTStartup ();
-#endif /* HAVE_NTGUI */
}
/* Dump out .data and .bss sections into a new executable. */
get_section_size (PIMAGE_SECTION_HEADER p_section)
{
/* The section size is in different locations in the different versions. */
- switch (get_nt_minor_version ())
+ switch (get_w32_minor_version ())
{
case 10:
return p_section->SizeOfRawData;
/* The .data section. */
data_section = section;
- ptr = (char *) nt_header->OptionalHeader.ImageBase +
+ ptr = (char *) nt_header->OptionalHeader.ImageBase +
section->VirtualAddress;
data_start_va = ptr;
data_start_file = section->PointerToRawData;