Changeset 1538 for trunk/gsinstaller
- Timestamp:
- 2000-09-12T11:06:36+12:00 (24 years ago)
- Location:
- trunk/gsinstaller
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsinstaller/Makefile
r1536 r1538 3 3 LINK = $(CXX) $(LDFLAGS) -o $@ 4 4 LIBS = -lcomctl32 -lgdi32 -lole32 -lcomdlg32 -luuid 5 CXXFLAGS = - fvtable-thunks5 CXXFLAGS = -Wall -fvtable-thunks 6 6 7 7 GSSETUP_OBJS = uninstall.o launchapp.o gsmanifest.o copyprogress.o \ … … 11 11 gsprofile.o dirent.o 12 12 13 all: gssetup.exe 13 SETUP_OBJS = gs16bit.o 14 15 all: gssetup.exe setup.exe 14 16 15 17 gssetup.exe: $(GSSETUP_OBJS) 16 18 $(LINK) $(GSSETUP_OBJS) $(LIBS) 17 19 20 setup.exe: $(SETUP_OBJS) 21 $(LINK) $(SETUP_OBJS) 22 18 23 $(GSSETUP_OBJS): %.o: %.cpp 24 25 $(SETUP_OBJS): %.o: %.cpp 19 26 20 27 clean: 21 28 del *.o 22 29 del gssetup.exe 30 del setup.exe -
trunk/gsinstaller/gs16bit.cpp
r1397 r1538 13 13 #ifdef _WIN32 14 14 int GetWinFlags() 15 { return 0; 15 { 16 return 0; 16 17 } 17 18 #endif 18 19 19 HWND 20 HINSTANCE 21 char * 20 HWND app_window; 21 HINSTANCE app_instance; 22 char *app_cmdLine; 22 23 23 24 typedef void (* splashfn) (HINSTANCE a, unsigned int time); … … 25 26 26 27 typedef struct 27 { BYTE majorVersion; 28 BYTE minorVersion; 29 WORD buildNumber; 30 BOOL debug; 28 { 29 BYTE majorVersion; 30 BYTE minorVersion; 31 WORD buildNumber; 32 BOOL debug; 31 33 } win32sInfo, FAR * lpWin32sInfo; 32 34 33 35 typedef enum 34 { Windows2x, Windows3_0x, Windows3_1x, Windows9x, WindowsNT 35 } gs16PlatformId; 36 { 37 Windows2x, Windows3_0x, Windows3_1x, Windows9x, WindowsNT 38 } gs16PlatformId; 36 39 37 40 typedef struct 38 { gs16PlatformId platform; 39 bool win32s; 40 } gs16PlatformInfo; 41 42 typedef int FAR PASCAL (* win32sInfoFn)(lpWin32sInfo); 41 { 42 gs16PlatformId platform; 43 bool win32s; 44 } gs16PlatformInfo; 45 46 //typedef int FAR PASCAL (* win32sInfoFn)(lpWin32sInfo); 47 typedef int (FAR PASCAL * win32sInfoFn)(lpWin32sInfo); 43 48 44 49 bool GS16bit_checkForWin32s() 45 { HANDLE w32sHandle; 46 win32sInfoFn infoFnPtr; 47 win32sInfo w32sInfo; 48 bool reply = false; 49 50 // try to get a handle onto the win32s library 51 w32sHandle = LoadLibrary("W32SYS.DLL"); 52 53 if (w32sHandle > HINSTANCE_ERROR) 54 { // now get the address of the GetWin32sInfo function 55 infoFnPtr = (win32sInfoFn) GetProcAddress(w32sHandle, "GETWIN32SINFO"); 50 { 51 // HANDLE w32sHandle; 52 HINSTANCE w32sHandle; 53 win32sInfoFn infoFnPtr; 54 win32sInfo w32sInfo; 55 bool reply = false; 56 57 // try to get a handle onto the win32s library 58 w32sHandle = LoadLibrary("W32SYS.DLL"); 59 60 // if (w32sHandle > HINSTANCE_ERROR) 61 if (w32sHandle != NULL) 62 { 63 // now get the address of the GetWin32sInfo function 64 infoFnPtr = (win32sInfoFn) GetProcAddress(w32sHandle, "GETWIN32SINFO"); 56 65 57 66 // if the function exists, we've got win32s1.1 or later 58 if (infoFnPtr != NULL) 59 { if ((*infoFnPtr)((lpWin32sInfo) &w32sInfo) == 0) // no error state 60 { reply = true; 61 } 62 else // error - call didn't work; assume that we have a non-functional 63 // win32s 64 { reply = false; 65 } 67 if (infoFnPtr != NULL) 68 { 69 if ((*infoFnPtr)((lpWin32sInfo) &w32sInfo) == 0) // no error state 70 { 71 reply = true; 72 } 73 else 74 // error - call didn't work; assume that we have a non-functional 75 // win32s 76 { 77 reply = false; 78 } 66 79 } 67 80 // else we've got win32s 1.0. TODO: We need to check if it's actually up and 68 81 // running; 69 82 else 70 { reply = true; 71 } 83 { 84 reply = true; 85 } 72 86 73 87 // we need to free the library before finishing this function … … 76 90 // no win32s at all 77 91 else 78 { reply = false; 92 { 93 reply = false; 79 94 } 80 95 … … 83 98 84 99 void GS16bit_getPlatformInfo(gs16PlatformInfo &info) 85 { DWORD version = GetVersion(); 100 { 101 DWORD version = GetVersion(); 86 102 87 103 /** … … 98 114 BYTE majorVersion = LOBYTE(LOWORD(version)); 99 115 BYTE minorVersion = HIBYTE(LOWORD(version)); 100 BYTE dosVersion 116 BYTE dosVersion = HIBYTE(HIWORD(version)); 101 117 102 118 if (majorVersion < 3) 103 { info.platform = Windows2x; 104 } 105 else if (majorVersion == 3 && minorVersion >= 95) // it's Windows 95 from the 106 // minor version; I guess that 107 // 98 may have minor version == 98, 108 // but I don't know! Hence the 109 // cautious check 110 { info.platform = Windows9x; 119 { 120 info.platform = Windows2x; 121 } 122 else if (majorVersion == 3 && minorVersion >= 95) 123 // it's Windows 95 from the 124 // minor version; I guess that 125 // 98 may have minor version == 98, 126 // but I don't know! Hence the 127 // cautious check 128 { 129 info.platform = Windows9x; 111 130 } 112 131 else // we're running in "some sort" of Windows 3.x environment 113 { if (minorVersion == 10 && dosVersion == 5) // it could be running under WOW 114 // (16-bit Windows emulation in 115 // Windows NT) 116 { if ((GetWinFlags() & WF_WINNT) == WF_WINNT) // check for NT in emulation mode 117 { info.platform = WindowsNT; 118 } 119 else 120 { info.platform = Windows3_1x; 121 } 122 } 123 else if (minorVersion >= 10) // perhaps Windows 3.11 124 { info.platform = Windows3_1x; 125 } 132 { 133 if (minorVersion == 10 && dosVersion == 5) 134 // it could be running under WOW 135 // (16-bit Windows emulation in 136 // Windows NT) 137 { 138 if ((GetWinFlags() & WF_WINNT) == WF_WINNT) // check for NT in emulation mode 139 { 140 info.platform = WindowsNT; 141 } 142 else 143 { 144 info.platform = Windows3_1x; 145 } 146 } 147 else if (minorVersion >= 10) // perhaps Windows 3.11 148 { 149 info.platform = Windows3_1x; 150 } 126 151 else 127 { info.platform = Windows3_0x; 128 } 152 { 153 info.platform = Windows3_0x; 154 } 129 155 } 130 156 131 157 if (info.platform == Windows3_1x) 132 { info.win32s = GS16bit_checkForWin32s(); 133 } 158 { 159 info.win32s = GS16bit_checkForWin32s(); 160 } 134 161 else 135 { info.win32s = false; 136 } 162 { 163 info.win32s = false; 164 } 137 165 } 138 166 139 167 void GS16bit_checkWindowsVersion() 140 { gs16PlatformInfo platformInfo; 141 142 GS16bit_getPlatformInfo(platformInfo); 168 { 169 gs16PlatformInfo platformInfo; 170 171 GS16bit_getPlatformInfo(platformInfo); 143 172 if (platformInfo.platform == Windows3_0x || 144 platformInfo.platform == Windows2x) 145 { MessageBox(app_window, 146 "Greenstone cannot be installed on this computer. It requires " 147 "Windows 3.10 or later", 148 "Greenstone Installer", 149 MB_OK); 150 } 151 else if ( platformInfo.platform == Windows3_1x && 152 platformInfo.win32s == false) 153 { MessageBox(app_window, 154 "Greenstone requires 32 bit Windows. Win32s will now be installed " 155 "on your computer to provide this, before continuing with the main " 156 "installation.", 157 "Greenstone Installer", 158 MB_OK); 159 } 173 platformInfo.platform == Windows2x) 174 { 175 MessageBox(app_window, 176 "Greenstone cannot be installed on this computer. It requires " 177 "Windows 3.10 or later", 178 "Greenstone Installer", 179 MB_OK); 180 } 181 else if (platformInfo.platform == Windows3_1x && 182 platformInfo.win32s == false) 183 { 184 MessageBox(app_window, 185 "Greenstone requires 32 bit Windows. Win32s will now be installed " 186 "on your computer to provide this, before continuing with the main " 187 "installation.", 188 "Greenstone Installer", 189 MB_OK); 190 } 160 191 else 161 { char buffer[20]; 162 int result; 163 /* MessageBox(app_window, 164 "Greenstone will now install", "Greenstone Installer", MB_OK);*/ 165 result = WinExec("gssetup.exe", SW_SHOWNORMAL); 166 } 167 } 168 169 long FAR PASCAL GS16bitWindProc(HWND Window, 170 WORD Message, 171 WPARAM wParameter, 172 LPARAM lParameter) 173 { long reply = 0; 192 { 193 char buffer[20]; 194 int result; 195 /* MessageBox(app_window, 196 "Greenstone will now install", "Greenstone Installer", MB_OK);*/ 197 result = WinExec("gssetup.exe", SW_SHOWNORMAL); 198 } 199 } 200 201 long FAR PASCAL GS16bitWindProc(HWND Window, 202 WORD Message, 203 WPARAM wParameter, 204 LPARAM lParameter) 205 { 206 long reply = 0; 174 207 175 208 switch(Message) 176 { case WM_CREATE: 177 { 178 } 179 break; 180 181 case WM_COMMAND: 182 break; 183 184 case WM_CLOSE: 185 DestroyWindow(Window); 186 return 0L; 187 188 case WM_DESTROY: 189 { PostQuitMessage(0); 190 } 191 break; 192 193 default: 194 return(DefWindowProc(Window, Message, wParameter, lParameter)); 195 } 209 { 210 case WM_CREATE: 211 { 212 } 213 break; 214 215 case WM_COMMAND: 216 break; 217 218 case WM_CLOSE: 219 DestroyWindow(Window); 220 return 0L; 221 222 case WM_DESTROY: 223 { 224 PostQuitMessage(0); 225 } 226 break; 227 228 default: 229 return(DefWindowProc(Window, Message, wParameter, lParameter)); 230 } 196 231 return reply; 197 232 } 198 233 199 234 void GS16bit_init(HINSTANCE instance, int Show) 200 { FARPROC showsplash; 201 FARPROC loadbmp; 202 HDC dc; 235 { 236 FARPROC showsplash; 237 FARPROC loadbmp; 238 HDC dc; 203 239 char buffer[20]; 204 240 205 /*206 dc= GetDC(GetDesktopWindow());207 bmpUtil_loadBitmap(dc, "C:\\gs.bmp");208 ReleaseDC(GetDesktopWindow(), dc);209 */210 // showsplash = MakeProcInstance((FARPROC) splash_show, instance);211 // (*(splashfn) showsplash)(instance, 3000);241 /* 242 dc = GetDC(GetDesktopWindow()); 243 bmpUtil loadBitmap(dc, "C:\\gs.bmp"); 244 ReleaseDC(GetDesktopWindow(), dc); 245 */ 246 // showsplash = MakeProcInstance((FARPROC) splash_show, instance); 247 // (*(splashfn) showsplash)(instance, 3000); 212 248 213 249 GS16bit_checkWindowsVersion(); 214 250 215 216 217 218 219 220 221 222 223 224 225 226 227 251 app_window = CreateWindow("GS16bit:Main", "GreenStone Installer", 252 WS_OVERLAPPEDWINDOW | WS_MINIMIZE | CS_DBLCLKS, 253 CW_USEDEFAULT, 254 0, 255 CW_USEDEFAULT, 256 0, 257 NULL, 258 NULL, 259 app_instance, 260 NULL); 261 262 ShowWindow(app_window, Show); 263 228 264 PostQuitMessage(0); 229 265 } 230 266 231 267 void WinClassInit(void) 232 { WNDCLASS Class; 233 234 Class.lpszClassName = "GS16bit:Main"; 235 Class.hInstance = app_instance; 236 Class.lpfnWndProc = (WNDPROC) GS16bitWindProc; 237 Class.hCursor = LoadCursor(NULL, IDC_ARROW); 238 Class.hIcon = NULL; //LoadIcon(app_instance, "GSInstall"); 239 Class.lpszMenuName = NULL; 240 Class.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); 241 Class.style = NULL; 242 Class.cbClsExtra = 0; 243 Class.cbWndExtra = 0; 244 RegisterClass(&Class); 268 { 269 WNDCLASS Class; 270 271 Class.lpszClassName = "GS16bit:Main"; 272 Class.hInstance = app_instance; 273 Class.lpfnWndProc = (WNDPROC) GS16bitWindProc; 274 Class.hCursor = LoadCursor(NULL, IDC_ARROW); 275 Class.hIcon = NULL; //LoadIcon(app_instance, "GSInstall"); 276 Class.lpszMenuName = NULL; 277 Class.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); 278 // Class.style = NULL; 279 Class.style = 0; 280 Class.cbClsExtra = 0; 281 Class.cbWndExtra = 0; 282 RegisterClass(&Class); 245 283 } 246 284 247 285 int PASCAL WinMain(HINSTANCE Current, 248 HINSTANCE Previous, 249 LPSTR CmdLine, 250 int CmdShow) 251 { MSG msg; 252 253 app_cmdLine = (char *) LocalAlloc(LMEM_FIXED, lstrlen(CmdLine) + 1); 254 lstrcpy(app_cmdLine, CmdLine); 255 256 app_instance = Current; 257 /* -- init application */ 258 if (!Previous) 259 { WinClassInit(); 260 } 261 262 /* -- init instance */ 286 HINSTANCE Previous, 287 LPSTR CmdLine, 288 int CmdShow) 289 { 290 MSG msg; 291 292 app_cmdLine = (char *) LocalAlloc(LMEM_FIXED, lstrlen(CmdLine) + 1); 293 lstrcpy(app_cmdLine, CmdLine); 294 295 app_instance = Current; 296 /* -- init application */ 297 if (!Previous) 298 { 299 WinClassInit(); 300 } 301 302 /* -- init instance */ 263 303 GS16bit_init(Current, CmdShow); 264 304 265 while (GetMessage(&msg, NULL, 0, 0)) 266 { TranslateMessage(&msg); 267 DispatchMessage(&msg); 268 } 269 return (int) msg.wParam; 270 } 305 while (GetMessage(&msg, NULL, 0, 0)) 306 { 307 TranslateMessage(&msg); 308 DispatchMessage(&msg); 309 } 310 return (int) msg.wParam; 311 }
Note:
See TracChangeset
for help on using the changeset viewer.