import -ko -b 1.1.3 XEmacs XEmacs-21_2 r21-2-35
[chise/xemacs-chise.git.1] / src / unexnt.c
index 53abecf..77cf487 100644 (file)
@@ -61,6 +61,9 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include <fcntl.h>
 #include <windows.h>
 
+#include "nt.h"
+#include "ntheap.h"
+
 /* From IMAGEHLP.H which is not installed by default by MSVC < 5 */
 /* The IMAGEHLP.DLL library is not distributed by default with Windows95 */
 typedef PIMAGE_NT_HEADERS
@@ -72,9 +75,8 @@ typedef PIMAGE_NT_HEADERS
 extern BOOL ctrl_c_handler (unsigned long type);
 #endif
 
-#include "ntheap.h"
-
-/* Sync with FSF Emacs 19.34.6 note: struct file_data is now defined in ntheap.h */
+/* Sync with FSF Emacs 19.34.6
+   note: struct file_data is now defined in nt.h */
 
 enum {
   HEAP_UNINITIALIZED = 1,
@@ -101,13 +103,6 @@ DWORD  data_size = UNINIT_LONG;
 PUCHAR bss_start = UNINIT_PTR;
 DWORD  bss_size = UNINIT_LONG;
 
-#ifdef HAVE_NTGUI
-HINSTANCE hinst = NULL;
-HINSTANCE hprevinst = NULL;
-LPSTR lpCmdLine = "";
-int nCmdShow = 0;
-#endif /* HAVE_NTGUI */
-
 /* Startup code for running on NT.  When we are running as the dumped
    version, we need to bootstrap our heap and .bss section into our
    address space before we can actually hand off control to the startup
@@ -161,7 +156,7 @@ _start (void)
      hit and fix all the weirdities this causes us, the better --kkm */
 #if 0
   /* The default behavior is to treat files as binary and patch up
-     text files appropriately, in accordance with the MSDOS code.  */
+     text files appropriately.  */
   _fmode = O_BINARY;
 #endif
 
@@ -171,14 +166,6 @@ _start (void)
   SetConsoleCtrlHandler ((PHANDLER_ROUTINE) ctrl_c_handler, TRUE);
 #endif
 
-  /* Invoke the NT CRT startup routine now that our housecleaning
-     is finished.  */
-#ifdef HAVE_NTGUI
-  /* determine WinMain args like crt0.c does */
-  hinst = GetModuleHandle(NULL);
-  lpCmdLine = GetCommandLine();
-  nCmdShow = SW_SHOWDEFAULT;
-#endif
   mainCRTStartup ();
 }
 
@@ -282,40 +269,6 @@ unexec (char *new_name, char *old_name, void *start_data, void *start_bss,
   close_file_data (&out_file);
 }
 
-
-/* File handling.  */
-
-
-int
-open_output_file (file_data *p_file, const char *filename, unsigned long size)
-{
-  HANDLE file;
-  HANDLE file_mapping;
-  void  *file_base;
-
-  file = CreateFile (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
-                    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
-  if (file == INVALID_HANDLE_VALUE) 
-    return FALSE;
-
-  file_mapping = CreateFileMapping (file, NULL, PAGE_READWRITE, 
-                                   0, size, NULL);
-  if (!file_mapping) 
-    return FALSE;
-  
-  file_base = MapViewOfFile (file_mapping, FILE_MAP_WRITE, 0, 0, size);
-  if (file_base == NULL) 
-    return FALSE;
-  
-  p_file->name = filename;
-  p_file->size = size;
-  p_file->file = file;
-  p_file->file_mapping = file_mapping;
-  p_file->file_base = (char*) file_base;
-
-  return TRUE;
-}
-
 /* Routines to manipulate NT executable file sections.  */
 
 #ifndef DUMP_SEPARATE_SECTION