randy 99/08/12 09:22:35
Modified: src/os/win32/installer/installdll install.c Log: Changes to migrate to InstallShield 5.5 and provide a bit more error checking. Changes to allow compiling on VS 6.0. Revision Changes Path 1.5 +28 -29 apache-1.3/src/os/win32/installer/installdll/install.c Index: install.c =================================================================== RCS file: /home/cvs/apache-1.3/src/os/win32/installer/installdll/install.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- install.c 1999/02/16 12:28:10 1.4 +++ install.c 1999/08/12 16:22:34 1.5 @@ -9,8 +9,7 @@ #define VERSION ( "1.003 " __DATE__ " " __TIME__ ) -#include <windows.h> -#include <winsock.h> +#include <winsock2.h> #include <string.h> #include <stdio.h> #include <direct.h> @@ -23,20 +22,14 @@ #undef strftime #endif +#define AP_WIN32ERROR 1 + /* Global to store the instance handle */ HINSTANCE hInstance = NULL; static char *szLogFilename = NULL; static FILE *fpLog = NULL; -void OpenLog(char *dir, char *fn) -{ - szLogFilename = malloc(strlen(dir) + 1 + strlen(fn) + 1); - sprintf(szLogFilename, "%s/%s", dir, fn); - - fpLog = fopen(szLogFilename, "a+"); -} - void LogMessage(char *fmt, ...) { char buf[4000]; @@ -70,13 +63,6 @@ fprintf(fpLog, "%s\n", buf); } -void CloseLog(void) -{ - if (fpLog) { - fclose(fpLog); - } -} - /* * MessageBox_error() is a helper function to display an error in a * message box, optionally including a Win32 error message. If @@ -87,8 +73,6 @@ * passed on to the Win32 MessageBox() call. */ -#define AP_WIN32ERROR 1 - int MessageBox_error(HWND hWnd, int opt, char *title, int mb_opt, char *fmt, ...) { @@ -162,6 +146,29 @@ return MessageBox(hWnd, buf, title, mb_opt); } +int OpenLog(HWND hwnd, char *dir, char *fn) +{ + szLogFilename = malloc(strlen(dir) + 1 + strlen(fn) + 1); + sprintf(szLogFilename, "%s\\%s", dir, fn); + + if ((fpLog = fopen(szLogFilename, "a+")) == NULL) { + MessageBox_error(hwnd, + AP_WIN32ERROR, + "Installation Problem", + MB_OK | MB_ICONSTOP, + "Cannot open log file %s", szLogFilename); + return -1; + } + return 0; +} + +void CloseLog(void) +{ + if (fpLog) { + fclose(fpLog); + } +} + /* * The next few functions handle expanding the @@ServerRoot@@ type * sequences found in the distribution files. The main entry point @@ -558,14 +565,6 @@ { CMD_COPY, ".tmp\\highperformance.conf-dist", "conf\\highperformance.conf-dist", OPT_EXPAND|OPT_OVERWRITE|OPT_DELETESOURCE }, - /* Move the default htdocs files into place, provided they don't already - * exist. - */ - { CMD_COPY, ".tmp\\index.html", "htdocs\\index.html", OPT_DELETESOURCE|OPT_SILENT }, - { CMD_RM, ".tmp\\index.html", NULL, OPT_SILENT }, - { CMD_COPY, ".tmp\\apache_pb.gif", "htdocs\\apache_pb.gif", OPT_DELETESOURCE|OPT_SILENT }, - { CMD_RM, ".tmp\\apache_pb.gif", NULL, OPT_SILENT }, - { CMD_RMDIR, ".tmp", NULL }, { CMD_END, NULL, NULL, OPT_NONE } @@ -583,7 +582,7 @@ ACTIONITEM *pactionItem; int end = 0; - OpenLog(szInst, "install.log"); + OpenLog(hwnd, szInst, "install.log"); LogMessage("STARTED %s", VERSION); LogMessage("src=%s support=%s inst=%s", szSrcDir, szSupport, szInst); @@ -593,7 +592,7 @@ pactionItem = actionTable; while (!end) { - LogMessage("command=%d in=%s out=%s options=%d", + LogMessage("command=%d 1in=%s out=%s options=%d", pactionItem->command, pactionItem->in ? pactionItem->in : "NULL", pactionItem->out ? pactionItem->out : "NULL",