]> code.delx.au - gnu-emacs/blobdiff - src/unexw32.c
* nsfns.m (Fns_do_applescript): Run event loop until script has
[gnu-emacs] / src / unexw32.c
index f8e755cbd2e6863bcd4e43974a0bbddaf7e6ccf5..ee1deb5f92e0455ffd8cfe088caf1ef583f33530 100644 (file)
@@ -22,6 +22,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include "unexec.h"
+#include "lisp.h"
+#include "w32common.h"
+#include "w32.h"
 
 #include <stdio.h>
 #include <fcntl.h>
@@ -82,13 +85,6 @@ DWORD_PTR  extra_bss_size_static = 0;
 
 PIMAGE_SECTION_HEADER heap_section;
 
-#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
@@ -118,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 ();
 }
 
@@ -314,19 +301,19 @@ relocate_offset (DWORD_PTR offset,
 }
 
 #define OFFSET_TO_RVA(offset, section) \
-         (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData))
+  ((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData))
 
 #define RVA_TO_OFFSET(rva, section) \
-         (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress))
+  ((section)->PointerToRawData + ((DWORD_PTR)(rva) - (section)->VirtualAddress))
 
 #define RVA_TO_SECTION_OFFSET(rva, section) \
-         ((DWORD_PTR)(rva) - section->VirtualAddress)
+  ((DWORD_PTR)(rva) - (section)->VirtualAddress)
 
 /* Convert address in executing image to RVA.  */
 #define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))
 
 #define RVA_TO_PTR(var,section,filedata) \
-         ((DWORD_PTR)(RVA_TO_OFFSET (var,section) + (filedata).file_base))
+         ((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base))
 
 #define PTR_TO_OFFSET(ptr, pfile_data) \
           ((unsigned char *)(ptr) - (pfile_data)->file_base)