changeset 5:5d4e598c4535

Initial changes for building with Windows. Win9x is no longer supported so remove code for that. Updated Makefiles for new Visual C options and 64bit support.
author Brian Smith <brian@dbsoft.org>
date Sun, 13 Nov 2011 08:43:10 -0600
parents a6460dd3320a
children 60042a92863e
files instsup.c packace/makefile.vc sfxace/makefile.vc uninst/makefile.vc win/dw.c
diffstat 5 files changed, 61 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/instsup.c	Sun Nov 13 08:02:11 2011 -0600
+++ b/instsup.c	Sun Nov 13 08:43:10 2011 -0600
@@ -45,9 +45,6 @@
     return dw_color_depth_get();
 }
 
-/* This should return true for WinNT/2K/XP and false on Win9x */
-int IsWinNT(void);
-
 /*
  * Call the reboot vector.
  */
@@ -84,32 +81,29 @@
 		DosClose(hREBOOT);
 	}
 #elif defined(__WIN32__)
-	if(IsWinNT())
-	{
-		HANDLE hToken;              /* handle to process token */
-		TOKEN_PRIVILEGES tkp;       /* pointer to token structure */
+	HANDLE hToken;              /* handle to process token */
+	TOKEN_PRIVILEGES tkp;       /* pointer to token structure */
 
-		/* Get the current process token handle so we can get shutdown
-		 * privilege.
-		 */
+	/* Get the current process token handle so we can get shutdown
+	 * privilege.
+	 */
 
-		if (!OpenProcessToken(GetCurrentProcess(),
-							  TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
-			return;
+	if (!OpenProcessToken(GetCurrentProcess(),
+						  TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
+		return;
 
-		/* Get the LUID for shutdown privilege. */
+	/* Get the LUID for shutdown privilege. */
 
-		LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
-						 &tkp.Privileges[0].Luid);
+	LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
+					 &tkp.Privileges[0].Luid);
 
-		tkp.PrivilegeCount = 1;  // one privilege to set
-		tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
- 
-		/* Get shutdown privilege for this process. */
- 
-		AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
-							  (PTOKEN_PRIVILEGES) NULL, 0);
-	}
+	tkp.PrivilegeCount = 1;  // one privilege to set
+	tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+	/* Get shutdown privilege for this process. */
+
+	AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
+						  (PTOKEN_PRIVILEGES) NULL, 0);
 
 	ExitWindowsEx(EWX_REBOOT, 0);
 #endif
--- a/packace/makefile.vc	Sun Nov 13 08:02:11 2011 -0600
+++ b/packace/makefile.vc	Sun Nov 13 08:43:10 2011 -0600
@@ -1,11 +1,20 @@
+# Packinst Makefile
+
 #
+# Configure settings for the target platform
+#	Default to x86 if not specified
+#
+!if "$(TARGET_CPU)" == ""
+TARGET_CPU=x86
+!endif
+
 CC = cl
-CFLAGS = -c -G5 -GD -Zp1 -DWIN32 -D__WIN32__ -DMSVC -I. -I.. -I..\incace
+CFLAGS = -c -Zp1 -DWIN32 -D__WIN32__ -DMSVC -I. -I.. -I..\incace
 CFLAGS_DEBUG = -Zi
 CFLAGS_COMPILE = -MTd
 LIBS = kernel32.lib advapi32.lib user32.lib
 RES = 
-LINKFLAGS = -machine:i386 -debug:full -debugtype:cv
+LINKFLAGS = -machine:$(TARGET_CPU) -debug -debugtype:cv
 DLLLINKFLAGS = -dll
 LINK = link
 
--- a/sfxace/makefile.vc	Sun Nov 13 08:02:11 2011 -0600
+++ b/sfxace/makefile.vc	Sun Nov 13 08:43:10 2011 -0600
@@ -1,13 +1,22 @@
+# SFX Makefile
+
 #
+# Configure settings for the target platform
+#	Default to x86 if not specified
+#
+!if "$(TARGET_CPU)" == ""
+TARGET_CPU=x86
+!endif
+
 WXDIR = $(WXWIN)
 CC = cl
-CFLAGS = -c -G5 -GD -Zp1 -DWIN32 -D__WIN32__ -DMSVC -DENABLE_LOGGING -I. -I.. -I..\incace -I..\platform
+CFLAGS = -c -Zp1 -DWIN32 -D__WIN32__ -DMSVC -DENABLE_LOGGING -I. -I.. -I..\incace -I..\platform -I"$(REGINA_LANG_DIR)\include"
 CFLAGS_DEBUG = -Zi
 CFLAGS_COMPILE = -MT
-LIBS = wsock32.lib kernel32.lib user32.lib comctl32.lib gdi32.lib advapi32.lib shell32.lib comdlg32.lib ole32.lib rexx.lib
+LIBS = wsock32.lib kernel32.lib user32.lib comctl32.lib gdi32.lib advapi32.lib shell32.lib comdlg32.lib ole32.lib msimg32.lib userenv.lib "$(REGINA_LANG_DIR)\lib\rexx.lib"
 
 RES = 
-LINKFLAGS = -machine:i386 -debug:full -debugtype:cv
+LINKFLAGS = -machine:$(TARGET_CPU) -debug -debugtype:cv
 DLLLINKFLAGS = -dll
 LINK = link
 
--- a/uninst/makefile.vc	Sun Nov 13 08:02:11 2011 -0600
+++ b/uninst/makefile.vc	Sun Nov 13 08:43:10 2011 -0600
@@ -1,13 +1,22 @@
+# Uninst Makefile
+
 #
+# Configure settings for the target platform
+#	Default to x86 if not specified
+#
+!if "$(TARGET_CPU)" == ""
+TARGET_CPU=x86
+!endif
+
 WXDIR = $(WXWIN)
 CC = cl
-CFLAGS = -c -G5 -GD -Zp1 -DWIN32 -D__WIN32__ -DMSVC -DENABLE_LOGGING -I. -I.. -I..\incace
+CFLAGS = -c -Zp1 -DWIN32 -D__WIN32__ -DMSVC -DENABLE_LOGGING -I. -I.. -I..\incace
 CFLAGS_DEBUG = -Zi
 CFLAGS_COMPILE = -MT
-LIBS = wsock32.lib kernel32.lib user32.lib comctl32.lib gdi32.lib advapi32.lib shell32.lib comdlg32.lib ole32.lib rexx.lib
+LIBS = wsock32.lib kernel32.lib user32.lib comctl32.lib gdi32.lib advapi32.lib shell32.lib comdlg32.lib ole32.lib msimg32.lib userenv.lib "$(REGINA_LANG_DIR)\lib\rexx.lib"
 
 RES = 
-LINKFLAGS = -machine:i386 -debug:full -debugtype:cv
+LINKFLAGS = -machine:$(TARGET_CPU) -debug -debugtype:cv
 DLLLINKFLAGS = -dll
 LINK = link
 
--- a/win/dw.c	Sun Nov 13 08:02:11 2011 -0600
+++ b/win/dw.c	Sun Nov 13 08:43:10 2011 -0600
@@ -21,7 +21,9 @@
 #include <time.h>
 #include <math.h>
 #include "dw.h"
+#ifdef BUILD_DLL
 #include "XBrowseForFolder.h"
+#endif
 
 #ifdef GDIPLUS
 /* GDI+ Headers are not C compatible... so define what we need here instead */
@@ -158,7 +160,9 @@
 static int screenx, screeny;
 HFONT _DefaultFont = NULL;
 
+#ifdef BUILD_DLL
 LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+#endif
 void _resize_notebook_page(HWND handle, int pageid);
 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
 int _lookup_icon(HWND handle, HICON hicon, int type);
@@ -3627,7 +3631,9 @@
    INITCOMMONCONTROLSEX icc;
    char *fname, *alttmpdir;
    HFONT oldfont;
+#ifdef GDIPLUS
    struct GdiplusStartupInput si; 
+#endif
 
    /* Initialize our thread local storage */
    _foreground = TlsAlloc();
@@ -3692,12 +3698,14 @@
 
    RegisterClass(&wc);
 
+#ifdef BUILD_DLL
    /* Register HTML renderer class */
    memset(&wc, 0, sizeof(WNDCLASS));
    wc.lpfnWndProc = (WNDPROC)_browserWindowProc;
    wc.lpszClassName = BrowserClassName;
    wc.style = CS_HREDRAW|CS_VREDRAW;
    RegisterClass(&wc);
+#endif
 
    /* Create a set of brushes using the default OS/2 and DOS colors */
    for(z=0;z<18;z++)