Author: mladen.turk(a)jboss.com
Date: 2008-04-01 05:53:12 -0400 (Tue, 01 Apr 2008)
New Revision: 1491
Modified:
trunk/build/install/installer/dhtml.c
trunk/build/install/installer/gui.c
trunk/build/install/installer/main.c
trunk/build/install/installer/sinstall.h
trunk/build/install/installer/sinstall.rc
Log:
Installer updates
Modified: trunk/build/install/installer/dhtml.c
===================================================================
--- trunk/build/install/installer/dhtml.c 2008-03-31 12:15:21 UTC (rev 1490)
+++ trunk/build/install/installer/dhtml.c 2008-04-01 09:53:12 UTC (rev 1491)
@@ -47,7 +47,7 @@
WCHAR szArguments[MBUF_SIZE];
} DHTML_THREAD_PARAMS;
-static LPWSTR
+LPWSTR
AnsiToWide(
LPCSTR szAnsi,
LPWSTR szWide,
@@ -68,7 +68,7 @@
return NULL;
}
-static LPSTR
+LPSTR
WideToAnsi(
LPCWSTR szWide,
LPSTR szAnsi,
@@ -130,7 +130,6 @@
if (!hDlg->lpImk)
goto cleanup;
-
return hDlg;
cleanup:
@@ -199,6 +198,8 @@
LPCSTR szTitle,
DWORD dwWidth,
DWORD dwHeight,
+ DWORD dwFlags,
+ DWORD dwTimeout,
LPCSTR szArguments)
{
DWORD dwThreadId;
@@ -207,17 +208,20 @@
DWORD i;
BOOL rv = FALSE;
DHTML_THREAD_PARAMS pD;
+ int w = -1;
-
if (IS_INVALID_HANDLE(hHtmlDlg))
return FALSE;
pD.hParent = hParent;
pD.hHtmlDlg = hHtmlDlg;
swprintf(pD.szOptions,
- L"scroll: no; help: no; dialogHeight: %dpx; dialogWidth: %dpx",
+ L"scroll: no; status: no; help: no; dialogHeight: %dpx; dialogWidth:
%dpx",
dwHeight, dwWidth);
- AnsiToWide(szArguments, pD.szArguments,
- ARRAYSIZE(pD.szArguments));
+ if (dwFlags == 1)
+ wcscat(pD.szOptions, L"; unadorned:yes");
+ if (szArguments)
+ AnsiToWide(szArguments, pD.szArguments,
+ ARRAYSIZE(pD.szArguments));
hThread = CreateThread(NULL,
0,
@@ -231,6 +235,7 @@
/* Hack to change the Icon of HTML Dialog */
for (i = 0; i < 1000; i++) {
if ((hWnd = FindWindowEx(hParent, NULL, NULL, szTitle))) {
+ w = GuiRegisterWindow(hWnd);
SetClassLong(hWnd, GCL_HICONSM, (LONG)gui_h16Icon);
break;
}
@@ -238,11 +243,17 @@
break;
Sleep(1);
}
- WaitForSingleObject(hThread, INFINITE);
+ if ((i = WaitForSingleObject(hThread, dwTimeout)) == WAIT_TIMEOUT) {
+ if (hWnd) {
+ SendMessage(hWnd, WM_CLOSE, 0, 0);
+ WaitForSingleObject(hThread, INFINITE);
+ }
+ }
if (GetExitCodeThread(hThread, &i) && i == 0) {
rv = TRUE;
}
CloseHandle(hThread);
+ GuiUnregisterWindow(w);
return rv;
}
Modified: trunk/build/install/installer/gui.c
===================================================================
--- trunk/build/install/installer/gui.c 2008-03-31 12:15:21 UTC (rev 1490)
+++ trunk/build/install/installer/gui.c 2008-04-01 09:53:12 UTC (rev 1491)
@@ -29,10 +29,13 @@
#include <stdio.h>
#include <string.h>
+#define MGUI_WINDOWS 32
+
HICON gui_h16Icon = NULL;
HICON gui_h32Icon = NULL;
HICON gui_h48Icon = NULL;
HMODULE gui_hMSHTML = NULL;
+HWND gui_DialogWnd = NULL;
static HINSTANCE gui_hInstance = NULL;
static HWND gui_hMainWnd = NULL;
static HMODULE gui_hRichedit = NULL;
@@ -40,9 +43,33 @@
static UINT gui_ucNumLines = 3;
static CHAR gui_szWndClass[MAX_PATH];
+
+static HWND gui_Windows[MGUI_WINDOWS];
+
+int
+GuiRegisterWindow(HWND hWnd)
+{
+ int i;
+ for (i = 0; i < MGUI_WINDOWS; i++) {
+ if (!gui_Windows[i]) {
+ gui_Windows[i] = hWnd;
+ return i;
+ }
+ }
+ return -1;
+}
+
+void
+GuiUnregisterWindow(int nIndex)
+{
+ if (nIndex >= 0 && nIndex < MGUI_WINDOWS)
+ gui_Windows[nIndex] = NULL;
+}
+
BOOL
GuiInitialize()
{
+ int i;
INITCOMMONCONTROLSEX stCmn;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
@@ -66,12 +93,21 @@
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
&gui_ucNumLines, 0);
+ for (i = 0; i < MGUI_WINDOWS; i++)
+ gui_Windows[i] = NULL;
return TRUE;
}
BOOL
GuiTerminate()
{
+ int i;
+ for (i = 0; i < MGUI_WINDOWS; i++) {
+ if (gui_Windows[i]) {
+ SendMessage(gui_Windows[i], WM_CLOSE, 0, 0);
+ gui_Windows[i] = NULL;
+ }
+ }
FreeLibrary(gui_hRichedit);
FreeLibrary(gui_hMSHTML);
@@ -180,12 +216,24 @@
{
static HWND hRich = NULL;
static POINT ptScroll;
+ static int nIndex = -1;
HRSRC hRsrc;
HGLOBAL hGlob;
LPSTR szTxt;
switch (uMsg) {
+ case WM_DESTROY:
+ GuiUnregisterWindow(nIndex);
+ nIndex = -1;
+ PostQuitMessage(0);
+ break;
+ case WM_CLOSE:
+ GuiUnregisterWindow(nIndex);
+ nIndex = -1;
+ return FALSE;
+ break;
case WM_INITDIALOG:
+ nIndex = GuiRegisterWindow(hDlg);
GuiCenterWindow(hDlg);
hRich = GetDlgItem(hDlg, IDC_LICENSE);
hRsrc = FindResourceA(GetModuleHandleA(NULL),
@@ -239,3 +287,36 @@
(DLGPROC)guiAboutDlgProc);
}
+BOOL
+GuiYesNoMessage(
+ HWND hWnd,
+ LPCTSTR szTitle,
+ LPCTSTR szMessage,
+ BOOL bStop)
+{
+ UINT uType = MB_YESNO | MB_APPLMODAL;
+
+ if (bStop)
+ uType |= MB_DEFBUTTON2 | MB_ICONEXCLAMATION;
+ else
+ uType |= MB_DEFBUTTON1 | MB_ICONQUESTION;
+
+ return (MessageBoxA(hWnd, szMessage, szTitle, uType) == IDYES);
+}
+
+BOOL
+GuiOkMessage(
+ HWND hWnd,
+ LPCTSTR szTitle,
+ LPCTSTR szMessage,
+ BOOL bStop)
+{
+ UINT uType = MB_OK | MB_APPLMODAL;
+
+ if (bStop)
+ uType |= MB_ICONSTOP;
+ else
+ uType |= MB_ICONINFORMATION;
+
+ return (MessageBoxA(hWnd, szMessage, szTitle, uType) == IDYES);
+}
Modified: trunk/build/install/installer/main.c
===================================================================
--- trunk/build/install/installer/main.c 2008-03-31 12:15:21 UTC (rev 1490)
+++ trunk/build/install/installer/main.c 2008-04-01 09:53:12 UTC (rev 1491)
@@ -44,6 +44,7 @@
static LPCSTR CMD_PREFIX = "%s /E:ON /S /C \"SET
JBINSTALL_PPID=%d&&CALL %s ";
static LPCSTR CMD_SUFIX = "> install.log 2>&1\"";
static LPCSTR CMD_BATCH = "install.bat";
+static LPCSTR CMD_PARAM = "install";
static LPCSTR DIR_BATCH = "\\_install";
static LPCSTR CMD_QUOTE = " &()[]{}^=;!'+,`~";
static LPSTR ppUnizpArgs[] = { "unzip", "-qq", "-d", NULL,
NULL };
@@ -94,6 +95,51 @@
0
};
+static int
+ErrorMessage(
+ LPCSTR szTitle,
+ LPCSTR szError,
+ BOOL bFatal)
+{
+ LPVOID lpMsgBuf = NULL;
+ UINT nType;
+ int nRet = 0;
+ DWORD dwErr = GetLastError();
+
+ if (bFatal)
+ nType = MB_ICONERROR | MB_ABORTRETRYIGNORE | MB_SYSTEMMODAL;
+ else
+ nType = MB_ICONEXCLAMATION | MB_OK | MB_APPLMODAL;
+ if (szError) {
+#ifdef _CONSOLE
+ fprintf(stderr, "Application Error (08X): %s\n", dwErr, szError);
+#else
+ nRet = MessageBoxA(NULL, szError, "Application Error", nType);
+#endif
+ }
+ else {
+ if (!szTitle)
+ szTitle = "Application System Error";
+ FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ dwErr,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
+ (LPSTR) &lpMsgBuf, 0, NULL);
+#ifdef _CONSOLE
+ fprintf(stderr, "%s (08X): %s\n", dwErr,
+ szTitle, (LPCSTR)lpMsgBuf);
+#else
+ nRet = MessageBoxA(NULL, (LPCSTR)lpMsgBuf,
+ szTitle, nType);
+#endif
+
+ LocalFree(lpMsgBuf);
+ }
+ return nRet;
+}
+
int x_cerror(int err)
{
if (err == 0) {
@@ -124,7 +170,18 @@
int err = errno;
errno = x_cerror(err);
- perror(msg);
+
+#ifdef _CONSOLE
+ if (!opt_Quiet)
+ perror(msg);
+ if (opt_Verbose)
+ fprintf(stderr, "(%s): exit(%d)\n", GetProgramName(), err);
+#else
+ if (GetLastError() == 0 && err)
+ SetLastError(err);
+ if (!opt_Quiet)
+ ErrorMessage(msg, NULL, TRUE);
+#endif
exit(err);
}
@@ -160,7 +217,34 @@
return p;
}
+/*
+ * Makes a full path from partial path
+ */
+static char *x_fullpath(const char *path, char *buf)
+{
+ char full[MAX_PATH];
+ char *fn;
+ size_t len;
+ len = GetFullPathNameA(path,
+ MAX_PATH,
+ full, &fn);
+ if (len >= MAX_PATH) {
+ errno = ERANGE;
+ return NULL;
+ }
+ if (len == 0) {
+ errno = EINVAL;
+ return NULL;
+ }
+ if (buf) {
+ strcpy(buf, full);
+ return buf;
+ }
+ else
+ return x_strdup(full);
+}
+
LPCSTR
GetProgramName()
{
@@ -185,6 +269,29 @@
return szProgramName;
}
+static LPSTR
+GetHtmlPath(
+ LPCSTR szWorkDir,
+ LPCSTR szHtmlPage)
+{
+
+ LPSTR p;
+ LPSTR pHtml = (LPSTR)x_malloc(MAX_PATH);
+
+ strcpy(pHtml, "file://");
+ if (szWorkDir) {
+ strcpy(pHtml, szWorkDir);
+ if (*szHtmlPage != '/')
+ strcat(pHtml, "/");
+ }
+ strcat(pHtml, szHtmlPage);
+ for (p = pHtml; *p; p++) {
+ if (*p == '\\')
+ *p = '/';
+ }
+ return pHtml;
+}
+
LPCSTR
GetProgramPath()
{
@@ -211,10 +318,13 @@
static void vwarnx(const char *fmt, va_list ap)
{
- fprintf(stderr, "%s: ", GetProgramName());
- if (fmt != NULL)
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
+
+ if (!opt_Quiet) {
+ fprintf(stderr, "%s: ", GetProgramName());
+ if (fmt != NULL)
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ }
}
static void warnx(const char *fmt, ...)
@@ -353,51 +463,7 @@
return optopt; /* return option letter */
}
-
static int
-ErrorMessage(
- LPCSTR szError,
- BOOL bFatal)
-{
- LPVOID lpMsgBuf = NULL;
- UINT nType;
- int nRet = 0;
- DWORD dwErr = GetLastError();
-
- if (bFatal)
- nType = MB_ICONERROR | MB_ABORTRETRYIGNORE | MB_SYSTEMMODAL;
- else
- nType = MB_ICONEXCLAMATION | MB_OK;
- if (szError) {
-#ifdef _CONSOLE
- nRet = MessageBoxA(NULL, szError, "Application Error", nType);
-#else
- fprintf(stderr, "Application Error (08X): %s\n", dwErr, szError);
-#endif
- }
- else {
- FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- dwErr,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
- (LPSTR) &lpMsgBuf, 0, NULL);
-#ifdef _CONSOLE
- nRet = MessageBoxA(NULL, (LPCSTR)lpMsgBuf,
- "Application System Error", nType);
-#else
- fprintf(stderr, "Application Error (08X): %s\n", dwErr,
- (LPCSTR)lpMsgBuf);
-#endif
-
- LocalFree(lpMsgBuf);
- }
- return nRet;
-}
-
-
-static int
SXDeleteDirectory(LPCSTR szName)
{
SHFILEOPSTRUCTA shfop;
@@ -409,32 +475,40 @@
return SHFileOperationA(&shfop);
}
-static void
+static int
+SXCreateDirectory(LPCSTR szName)
+{
+ return SHCreateDirectoryExA(NULL, szName, NULL);
+}
+
+
+static LPSTR
BuildCommandLine(
- LPSTR szBuf,
LPCSTR szCmdExe,
LPCSTR szBatchFile,
...)
{
+ char *buf;
char *p;
va_list vl;
va_start(vl, szBatchFile);
- sprintf(szBuf, CMD_PREFIX, szCmdExe,
+ buf = x_malloc(MAX_CMDLINE);
+ sprintf(buf, CMD_PREFIX, szCmdExe,
_getpid(), szBatchFile);
while ((p = va_arg(vl, char *)) != NULL) {
if (p[strcspn(p, CMD_QUOTE)]) {
- strcat(szBuf, "\"");
- strcat(szBuf, p);
- strcat(szBuf, "\"");
+ strcat(buf, "\"");
+ strcat(buf, p);
+ strcat(buf, "\"");
}
else
- strcat(szBuf, p);
- strcat(szBuf, " ");
+ strcat(buf, p);
+ strcat(buf, " ");
}
va_end(vl);
- strcat(szBuf, CMD_SUFIX);
- fprintf(stdout, "Service Cmd %s\n", szBuf);
+ strcat(buf, CMD_SUFIX);
+ return buf;
}
@@ -448,6 +522,11 @@
STARTUPINFO stInfo;
BOOL bResult;
+ if (opt_Verbose) {
+ fprintf(stdout, "Executing: %s\n", szApplication);
+ fprintf(stdout, " %s\n", szCmdLine);
+ fprintf(stdout, " in %s\n", szWorkingPath);
+ }
ZeroMemory(&stInfo, sizeof(stInfo));
stInfo.cb = sizeof(stInfo);
stInfo.dwFlags = STARTF_USESHOWWINDOW;
@@ -480,11 +559,11 @@
sprintf(sBuf, "%s", GetProgramName());
DHTMLDialogRun(NULL, hHtml,
- "Accept License Agreement",
- 505, 360,
+ GuiLoadResource(IDS_LICTITLE, 0),
+ 505, 360, 0, INFINITE,
sBuf);
retVal = DHTMLDialogResult(hHtml);
- if (retVal && !strcmp(retVal, "OK")) {
+ if (retVal && !strncmp(retVal, "OK", 2)) {
rv = TRUE;
}
DHTMLDialogClose(hHtml);
@@ -492,6 +571,56 @@
return rv;
}
+static BOOL
+RunCustomPage(
+ LPCSTR szHtmlPage,
+ LPCSTR szHtmlTitle,
+ LPCSTR szHtmlParams,
+ DWORD dwHtmlWidth,
+ DWORD dwHtmlHeight,
+ DWORD dwTimeout,
+ DWORD dwFlags,
+ LPCSTR szFile)
+{
+ HANDLE hHtml;
+ LPSTR szUrl;
+ LPSTR retVal;
+ BOOL rv = FALSE;
+ FILE *fp;
+
+ szUrl = GetHtmlPath(NULL, szHtmlPage);
+ hHtml = DHTMLDialogInit(NULL, szUrl);
+ if (IS_INVALID_HANDLE(hHtml))
+ return FALSE;
+
+ DHTMLDialogRun(NULL, hHtml,
+ szHtmlTitle,
+ dwHtmlWidth,
+ dwHtmlHeight,
+ dwFlags,
+ dwTimeout,
+ szHtmlParams);
+ retVal = DHTMLDialogResult(hHtml);
+ if (szFile)
+ fp = fopen(szFile, "w");
+ else
+ fp = stdout;
+ if (fp) {
+ if (retVal && *retVal) {
+ if (!strncmp(retVal, "OK", 2))
+ rv = TRUE;
+ fputs(retVal, fp);
+ }
+ else
+ fputs("NULL", fp);
+ fflush(fp);
+ if (fp != stdout)
+ fclose(fp);
+ }
+ DHTMLDialogClose(hHtml);
+ return rv;
+}
+
static void ExitCleanup(void)
{
static int cleanup = 0;
@@ -535,21 +664,32 @@
int nShowCmd)
{
#endif
- int i, r, ch;
- int ap = 1;
- int hasDest = 0;
- LPSTR szCmdLine = NULL;
- CHAR szBuf[MAX_PATH];
- CHAR szCmdExe[MAX_PATH];
- CHAR szDest[MAX_PATH] = { 0 };
+ int i, r, ch;
+ int ap = 1;
+ size_t l;
+ BOOL selectDest = TRUE;
+ LPSTR szCmdLine = NULL;
+ CHAR szBuf[MAX_PATH];
+ CHAR szCmdExe[MAX_PATH];
+ CHAR szWorkDir[MAX_PATH];
+ CHAR szDest[MAX_PATH] = { 0, 0 };
+
+ LPSTR szHtmlPage = NULL;
+ LPSTR szHtmlTitle = NULL;
+ LPSTR szHtmlParams = NULL;
+ LPSTR szHtmlResult = NULL;
+ DWORD dwHtmlWidth = 505;
+ DWORD dwHtmlHeight = 360;
+ DWORD dwTimeout = INFINITE;
+ DWORD dwFlags = 0;
PROCESS_INFORMATION prInfo;
-
+
atexit(ExitCleanup);
if (!GuiInitialize()) {
exit(-1);
}
- while ((ch = getopt(__argc, __argv, "aAd:D:hHqQvV")) != EOF) {
+ while ((ch = getopt(__argc, __argv, "aAd:f:h:n:p:qQr:st:vVw:")) != EOF) {
switch (ch) {
case 'a':
case 'A':
@@ -560,38 +700,123 @@
case 'q':
case 'Q':
opt_Quiet = TRUE;
+ opt_Verbose = FALSE;
break;
case 'v':
case 'V':
- opt_Verbose = TRUE;
+#ifdef _CONSOLE
+ /* Verbosity makes sense in console
+ * mode only
+ */
+ if (!opt_Quiet)
+ opt_Verbose = TRUE;
+#endif
break;
case 'd':
- case 'D':
- hasDest = ap++;
+ if (*optarg != '~') {
+ if (x_fullpath(optarg, szDest))
+ selectDest = FALSE;
+ }
+ else {
+ szDest[0] = '~';
+ selectDest = FALSE;
+ }
break;
+ case 'n':
+ szHtmlTitle = x_strdup(optarg);
+ break;
+ case 'r':
+ szHtmlPage = x_fullpath(optarg, NULL);
+ break;
+ case 's':
+ dwFlags = 1;
+ break;
+ case 'f':
+ szHtmlResult = x_fullpath(optarg, NULL);
+ break;
+ case 'p':
+ szHtmlParams = x_strdup(optarg);
+ for (l = 0; l < strlen(szHtmlParams); l++) {
+ if (szHtmlParams[l] == ',')
+ szHtmlParams[l] = '\t';
+ }
+ break;
+ case 't':
+ dwTimeout = (DWORD)atoi(optarg);
+ break;
+ case 'w':
+ dwHtmlWidth = (DWORD)atoi(optarg);
+ break;
+ case 'h':
+ dwHtmlHeight = (DWORD)atoi(optarg);
+ break;
+ case '?':
+ r = EINVAL;
+ goto cleanup;
+ break;
}
}
__argc -= optind;
__argv += optind;
- if (!AcceptLicensePage()) {
+ if (szHtmlPage) {
+ if (!szHtmlTitle) {
+ r = EINVAL;
+ goto cleanup;
+ }
+ if (RunCustomPage(szHtmlPage,
+ szHtmlTitle,
+ szHtmlParams,
+ dwHtmlWidth,
+ dwHtmlHeight,
+ dwTimeout,
+ dwFlags,
+ szHtmlResult)) {
+ r = 0;
+ }
+ else
+ r = EACCES;
+ x_free(szHtmlPage);
+ x_free(szHtmlTitle);
+ x_free(szHtmlParams);
+ x_free(szHtmlResult);
+ goto cleanup;
+ }
+ /* Standard Install */
+ if (!opt_Quiet && !AcceptLicensePage()) {
r = EPERM;
goto cleanup;
}
- if (hasDest) {
- strcpy(szDest, __argv[hasDest - 1]);
- /* TODO: Check if valid */
- }
- else {
+ if (selectDest) {
if (!GuiBrowseForFolder(NULL,
- "Select Installation Directory",
+ GuiLoadResource(IDS_SELDEST, 0),
szDest)) {
r = EACCES;
goto cleanup;
}
}
- szCmdLine = (char *)x_malloc(MAX_CMDLINE);
-
+ if (szDest[0] != '~' && access(szDest, 06)) {
+ if (errno == ENOENT) {
+ char msg[MAX_PATH + 64];
+ sprintf(msg, GuiLoadResource(IDS_NDIRMSG, 0),
+ szDest);
+ if (GuiYesNoMessage(NULL,
+ GuiLoadResource(IDS_NDIRTITLE, 1),
+ msg,
+ FALSE)) {
+ if (SXCreateDirectory(szDest)) {
+ x_perror(szDest);
+ }
+ }
+ else {
+ r = 0;
+ goto cleanup;
+ }
+ }
+ else {
+ x_perror(szDest);
+ }
+ }
if (GetSystemDirectory(szBuf, MAX_PATH - 20)) {
strcat(szBuf, "\\cmd.exe");
if (strchr(szBuf, ' ')) {
@@ -603,19 +828,16 @@
strcpy(szCmdExe, szBuf);
}
else {
- perror("System Directory");
- exit(-1);
+ x_perror("System Directory");
}
if (GetTempPathA(MAX_PATH - 20, szBuf) == 0) {
- perror("Temp Path");
- exit(-1);
+ x_perror("Temp Path");
}
for (i = 0; i < 100; i++) {
CHAR szTmp[MAX_PATH];
if (GetTempFileName(szBuf, "_sx", _getpid(), szTmp) == 0) {
- perror("Temp File");
- exit(-1);
+ x_perror("Temp File");
}
if (!mkdir(szTmp)) {
strcpy(szTempPath, szTmp);
@@ -623,41 +845,51 @@
}
else {
if (errno != EEXIST) {
- perror("Creating Temp directory");
- exit(-1);
+ x_perror("Creating Temp directory");
}
}
}
if (!szTempPath[0]) {
errno = EPERM;
- perror("Creating Temp directory");
- exit(-1);
+ x_perror("Creating Temp directory");
}
-#if 0
+ strcpy(szWorkDir, szTempPath);
+ strcat(szWorkDir, DIR_BATCH);
ppUnizpArgs[3] = szTempPath;
- printf("Running main %s\n", szTempPath);
+ if (opt_Verbose) {
+ fprintf(stdout, "Running main: %s\n", szTempPath);
+ }
+ /* Unzip the embeded archive */
CONSTRUCTGLOBALS();
r = unzip(4, ppUnizpArgs);
+ if (r != 0) {
+ SetLastError(ERROR_INVALID_BLOCK);
+ errno = EINVAL;
+ x_perror("Uncompressing");
+ }
DESTROYGLOBALS();
- if (RunChildProcess(szCmdExe, szCmdLine, szBuf, &prInfo)) {
+ szCmdLine = BuildCommandLine(szCmdExe,
+ CMD_BATCH,
+ CMD_PARAM,
+ szDest,
+ NULL);
+ if (RunChildProcess(szCmdExe, szCmdLine, szWorkDir, &prInfo)) {
-
- }
-
-#endif
- strcpy(szBuf, szTempPath);
- strcat(szBuf, DIR_BATCH);
- BuildCommandLine(szCmdLine, szCmdExe, CMD_BATCH,
- "install", szDest, NULL);
- if (RunChildProcess(szCmdExe, szCmdLine, szBuf, &prInfo)) {
-
r = 0;
}
else
r = GetLastError();
- printf("(%s) Done %d!\n", GetProgramName(), r);
+#if 0
+ GuiOkMessage(NULL,
+ "Continue",
+ "Click OK to continue",
+ TRUE);
+#endif
cleanup:
+ if (opt_Verbose) {
+ fprintf(stdout, "(%s) exit(%d)\n", GetProgramName(), r);
+ }
x_free(szCmdLine);
ExitCleanup();
return r;
Modified: trunk/build/install/installer/sinstall.h
===================================================================
--- trunk/build/install/installer/sinstall.h 2008-03-31 12:15:21 UTC (rev 1490)
+++ trunk/build/install/installer/sinstall.h 2008-04-01 09:53:12 UTC (rev 1491)
@@ -97,8 +97,11 @@
#define IDS_DLLFILES 156
#define IDS_EXEFILES 157
#define IDS_PPIMAGE 158
+#define IDS_SELDEST 159
+#define IDS_NDIRMSG 160
+#define IDS_NDIRTITLE 162
+#define IDS_LICTITLE 163
-
#define IDD_ABOUTBOX 250
#define IDC_LICENSE 251
#define IDR_LICENSE 252
@@ -109,22 +112,33 @@
#define SIZ_BUFMAX (SIZ_BUFLEN - 1)
#define IS_INVALID_HANDLE(x) (((x) == NULL || (x) == INVALID_HANDLE_VALUE))
+LPCSTR GetProgramName();
+LPWSTR AnsiToWide(LPCSTR, LPWSTR, DWORD);
+LPSTR WideToAnsi(LPCWSTR, LPSTR, DWORD);
+
BOOL GuiInitialize();
BOOL GuiTerminate();
+int GuiRegisterWindow();
+void GuiUnregisterWindow(int);
+
+
LPSTR GuiLoadResource(UINT, UINT);
void GuiCenterWindow(HWND);
BOOL GuiBrowseForFolder(HWND, LPCSTR, LPSTR);
void GuiAboutBox(HWND);
+BOOL GuiYesNoMessage(HWND, LPCTSTR, LPCTSTR, BOOL);
+BOOL GuiOkMessage(HWND, LPCTSTR, LPCTSTR, BOOL);
HICON gui_h16Icon;
HICON gui_h32Icon;
HICON gui_h48Icon;
HMODULE gui_hMSHTML;
+HWND gui_DialogWnd;
HANDLE DHTMLDialogInit(HINSTANCE, LPCSTR);
void DHTMLDialogClose(HANDLE);
-BOOL DHTMLDialogRun(HWND, HANDLE, LPCSTR, DWORD, DWORD, LPCSTR);
+BOOL DHTMLDialogRun(HWND, HANDLE, LPCSTR, DWORD, DWORD, DWORD, DWORD, LPCSTR);
LPSTR DHTMLDialogResult(HANDLE);
#endif /* SINSTALL_H */
Modified: trunk/build/install/installer/sinstall.rc
===================================================================
--- trunk/build/install/installer/sinstall.rc 2008-03-31 12:15:21 UTC (rev 1490)
+++ trunk/build/install/installer/sinstall.rc 2008-04-01 09:53:12 UTC (rev 1491)
@@ -78,7 +78,11 @@
IDS_ALLFILES "All Files (*.*)\0*.*\0"
IDS_DLLFILES "Dynamic Link Libraries (*.dll)\0*.dll\0"
IDS_EXEFILES "Executables (*.exe)\0*.exe\0"
- IDS_PPIMAGE "Select Executable Image"
+ IDS_PPIMAGE "Select Executable Image\0"
+ IDS_SELDEST "Select Installation Base Directory"
+ IDS_NDIRMSG "Destination directory\r\n%s\r\ndoes not exist. Create
directory ?"
+ IDS_NDIRTITLE "Directory does not exist"
+ IDS_LICTITLE "Accept License Agreement"
END