Improve API of recently-added bool vector functions.
[bpt/emacs.git] / src / unexw32.c
index 1e591a7..a01ac79 100644 (file)
@@ -1,5 +1,5 @@
 /* unexec for GNU Emacs on Windows NT.
-   Copyright (C) 1994, 2001-201 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2013 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -85,13 +85,6 @@ DWORD_PTR  extra_bss_size_static = 0;
 
 PIMAGE_SECTION_HEADER heap_section;
 
-#ifdef HAVE_NTGUI
-extern HINSTANCE hinst;
-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
@@ -121,15 +114,6 @@ _start (void)
   /* Prevent Emacs from being locked up (eg. in batch mode) when
      accessing devices that aren't mounted (eg. removable media drives).  */
   SetErrorMode (SEM_FAILCRITICALERRORS);
-
-  /* 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 ();
 }
 
@@ -175,6 +159,14 @@ open_output_file (file_data *p_file, char *filename, unsigned long size)
   HANDLE file_mapping;
   void  *file_base;
 
+  /* We delete any existing FILENAME because loadup.el will create a
+     hard link to it under the name emacs-XX.YY.ZZ.nn.exe.  Evidently,
+     overwriting a file on Unix breaks any hard links to it, but that
+     doesn't happen on Windows.  If we don't delete the file before
+     creating it, all the emacs-XX.YY.ZZ.nn.exe end up being hard
+     links to the same file, which defeats the purpose of these hard
+     links: being able to run previous builds.  */
+  DeleteFile (filename);
   file = CreateFile (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
                     CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
   if (file == INVALID_HANDLE_VALUE)
@@ -738,7 +730,7 @@ unexec (const char *new_name, const char *old_name)
   /* Ignore old_name, and get our actual location from the OS.  */
   if (!GetModuleFileName (NULL, in_filename, MAX_PATH))
     abort ();
-  dostounix_filename (in_filename);
+  dostounix_filename (in_filename, 0);
   strcpy (out_filename, in_filename);
 
   /* Change the base of the output filename to match the requested name.  */