Author: mladen.turk(a)jboss.com
Date: 2008-04-08 08:32:35 -0400 (Tue, 08 Apr 2008)
New Revision: 1534
Modified:
trunk/build/install/installer/dhtml.c
trunk/build/install/installer/installers/jbossas/README
trunk/build/install/installer/main.c
trunk/build/install/installer/sinstall.h
Log:
Add option to close the splash on demand (when unzipping is done)
Modified: trunk/build/install/installer/dhtml.c
===================================================================
--- trunk/build/install/installer/dhtml.c 2008-04-08 10:49:32 UTC (rev 1533)
+++ trunk/build/install/installer/dhtml.c 2008-04-08 12:32:35 UTC (rev 1534)
@@ -37,6 +37,9 @@
typedef struct {
IMoniker *lpImk;
CHAR szReturnVal[HBUF_SIZE];
+ HWND hWnd;
+ HANDLE hThread;
+ int iIndex;
} MC_HTML_DIALOG, *LPMC_HTML_DIALOG;
typedef struct DHTML_THREAD_PARAMS {
@@ -268,3 +271,86 @@
return hDlg->szReturnVal;
}
+
+BOOL
+DHTMLDialogStart(
+ HWND hParent,
+ HANDLE hHtmlDlg,
+ LPCSTR szTitle,
+ DWORD dwWidth,
+ DWORD dwHeight,
+ DWORD dwFlags,
+ DWORD dwTimeout,
+ LPCSTR szArguments)
+{
+ DWORD dwThreadId;
+ HANDLE hThread;
+ HWND hWnd = NULL;
+ DWORD i;
+ LPMC_HTML_DIALOG hDlg = (LPMC_HTML_DIALOG)hHtmlDlg;
+ 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; status: no; help: no; dialogHeight: %dpx; dialogWidth:
%dpx",
+ dwHeight, dwWidth);
+ if (dwFlags == 1)
+ wcscat(pD.szOptions, L"; unadorned:yes");
+ if (szArguments)
+ AnsiToWide(szArguments, pD.szArguments,
+ ARRAYSIZE(pD.szArguments));
+
+ hThread = CreateThread(NULL,
+ 0,
+ dhtmlRunThread,
+ &pD,
+ 0,
+ &dwThreadId);
+ if (IS_INVALID_HANDLE(hThread))
+ return FALSE;
+
+ /* 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;
+ }
+ if (pD.bDone)
+ break;
+ Sleep(1);
+ }
+ hDlg->hThread = hThread;
+ hDlg->hWnd = hWnd;
+ hDlg->iIndex = w;
+ return TRUE;
+}
+
+BOOL
+DHTMLDialogStop(HANDLE hHtmlDlg)
+{
+ DWORD i;
+ BOOL rv = FALSE;
+ LPMC_HTML_DIALOG hDlg = (LPMC_HTML_DIALOG)hHtmlDlg;
+
+ if (IS_INVALID_HANDLE(hHtmlDlg))
+ return FALSE;
+
+ if ((i = WaitForSingleObject(hDlg->hThread, 0)) == WAIT_TIMEOUT) {
+ if (hDlg->hWnd) {
+ SendMessage(hDlg->hWnd, WM_CLOSE, 0, 0);
+ WaitForSingleObject(hDlg->hThread, INFINITE);
+ }
+ }
+ if (GetExitCodeThread(hDlg->hThread, &i) && i == 0) {
+ rv = TRUE;
+ }
+ CloseHandle(hDlg->hThread);
+ GuiUnregisterWindow(hDlg->iIndex);
+
+ return rv;
+}
Modified: trunk/build/install/installer/installers/jbossas/README
===================================================================
--- trunk/build/install/installer/installers/jbossas/README 2008-04-08 10:49:32 UTC (rev
1533)
+++ trunk/build/install/installer/installers/jbossas/README 2008-04-08 12:32:35 UTC (rev
1534)
@@ -9,6 +9,9 @@
4. Merge the sinstall stub
copy /Y /b sinstall.exe + /b jboss-5.0.0.Beta4.install.zip
jboss-5.0.0.Beta4.exe
5. Embedd parameters to the installer
- > sinstall -qxu -S 2 -e jboss-5.0.0.Beta4.exe
+ > sinstall -qxu -S 0 -e jboss-5.0.0.Beta4.exe
+ This step can be ommited if the sinstall already has embedded config
+6. Fix zip sfx archive
+ > zip -A jboss-5.0.0.Beta4.exe
That's it
Modified: trunk/build/install/installer/main.c
===================================================================
--- trunk/build/install/installer/main.c 2008-04-08 10:49:32 UTC (rev 1533)
+++ trunk/build/install/installer/main.c 2008-04-08 12:32:35 UTC (rev 1534)
@@ -845,32 +845,34 @@
return rv;
}
-static BOOL
-ShowSplash(LPCSTR szPage, DWORD dwTimeout)
+static HANDLE
+StartSplash(LPCSTR szPage, DWORD dwTimeout)
{
HANDLE hHtml;
CHAR sBuf[MAX_PATH] = { 0 };
- CHAR *retVal;
- BOOL rv = FALSE;
hHtml = DHTMLDialogInit(GetModuleHandle(NULL), szPage);
if (IS_INVALID_HANDLE(hHtml))
- return FALSE;
+ return NULL;
sprintf(sBuf, "%s", GetProgramName());
- DHTMLDialogRun(NULL, hHtml,
- "JBoss",
- DEF_WWIDTH, DEF_WHEIGHT, 1, dwTimeout,
- sBuf);
- retVal = DHTMLDialogResult(hHtml);
- if (retVal && !strncmp(retVal, "OK", 2)) {
- rv = TRUE;
- }
- DHTMLDialogClose(hHtml);
+ DHTMLDialogStart(NULL, hHtml,
+ "JBoss",
+ DEF_WWIDTH, DEF_WHEIGHT, 1, dwTimeout,
+ sBuf);
+ return hHtml;
+}
- return rv;
+static void
+StopSplash(HANDLE hHtml)
+{
+ if (IS_INVALID_HANDLE(hHtml))
+ return;
+ DHTMLDialogStop(hHtml);
+ DHTMLDialogClose(hHtml);
}
+
static BOOL
RunCustomPage(
LPCSTR szHtmlPage,
@@ -1064,6 +1066,7 @@
DWORD dwHtmlHeight = DEF_WHEIGHT;
DWORD dwFlags = 0;
LPCSTR szEulaPage = "/HTML_EULAMAIN";
+ HANDLE hSplash = NULL;
PROCESS_INFORMATION prInfo;
atexit(ExitCleanup);
@@ -1231,8 +1234,7 @@
goto cleanup;
}
if (bShowSplash) {
- ShowSplash("/HTML_SPLASH", dwSplTimeout);
- Sleep(200);
+ hSplash = StartSplash("/HTML_SPLASH", dwSplTimeout);
}
/* Standard Install */
@@ -1312,6 +1314,7 @@
x_perror(EINVAL, "Uncompressing");
}
DESTROYGLOBALS();
+ StopSplash(hSplash);
if (bRunScript) {
szCmdLine = BuildCommandLine(szCmdExe,
CMD_BATCH,
Modified: trunk/build/install/installer/sinstall.h
===================================================================
--- trunk/build/install/installer/sinstall.h 2008-04-08 10:49:32 UTC (rev 1533)
+++ trunk/build/install/installer/sinstall.h 2008-04-08 12:32:35 UTC (rev 1534)
@@ -141,5 +141,7 @@
void DHTMLDialogClose(HANDLE);
BOOL DHTMLDialogRun(HWND, HANDLE, LPCSTR, DWORD, DWORD, DWORD, DWORD, LPCSTR);
LPSTR DHTMLDialogResult(HANDLE);
+BOOL DHTMLDialogStart(HWND, HANDLE, LPCSTR, DWORD, DWORD, DWORD, DWORD, LPCSTR);
+BOOL DHTMLDialogStop(HANDLE);
#endif /* SINSTALL_H */