]> code.delx.au - gnu-emacs/blobdiff - src/unexw32.c
(SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Adjusted for the change of
[gnu-emacs] / src / unexw32.c
index 684b617770920ad765384bbc7d311e1cd29c27cc..d449a79eaa0be89e31e71671c84620d0d81c106d 100644 (file)
@@ -1,23 +1,22 @@
-/*
-   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
 */
@@ -29,7 +28,7 @@
 
 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 {
@@ -68,23 +67,6 @@ HINSTANCE hinst = NULL;
 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
@@ -94,11 +76,7 @@ WinMain (_hinst, _hPrevInst, _lpCmdLine, _nCmdShow)
 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 ();
@@ -132,10 +110,12 @@ _start (void)
   /* 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.  */
@@ -334,7 +314,7 @@ static unsigned long
 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;
@@ -394,7 +374,7 @@ get_section_info (file_data *p_infile)
 
          /* 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;