Back to 37KB

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@673 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-08-09 14:21:45 +00:00
parent d9fe9f1282
commit 2c01f3ae15
7 changed files with 134 additions and 154 deletions

View file

@ -361,7 +361,7 @@ end:
#ifdef NSIS_COMPRESS_WHOLE #ifdef NSIS_COMPRESS_WHOLE
if (dbd_hFile!=INVALID_HANDLE_VALUE) CloseHandle(dbd_hFile); if (dbd_hFile!=INVALID_HANDLE_VALUE) CloseHandle(dbd_hFile);
#endif #endif
if (m_Err) MessageBox(NULL,m_Err,g_caption,MB_OK|MB_ICONSTOP); if (m_Err) my_MessageBox(m_Err,MB_OK|MB_ICONSTOP);
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT #ifdef NSIS_CONFIG_PLUGIN_SUPPORT
// Clean up after plug-ins // Clean up after plug-ins

View file

@ -113,36 +113,20 @@ BOOL my_SetDlgItemText(HWND dlg, WORD id, int strtab) {
} }
BOOL SetUIText(HWND defhw, WORD def, WORD custom, int strtab) { BOOL SetUIText(HWND defhw, WORD def, WORD custom, int strtab) {
if (custom) return my_SetDlgItemText(custom?g_hwnd:defhw,custom?custom:def,strtab);
return my_SetDlgItemText(g_hwnd,custom,strtab);
else
return my_SetDlgItemText(defhw,def,strtab);
//my_SetDlgItemText(custom?g_hwnd:defhw,custom?custom:def,strtab);
} }
// no tab // no tab
BOOL SetUITextNT(HWND defhw, WORD def, WORD custom, const char *text) { BOOL SetUITextNT(HWND defhw, WORD def, WORD custom, const char *text) {
if (custom) return SetDlgItemText(custom?g_hwnd:defhw,custom?custom:def,text);
return SetDlgItemText(g_hwnd,custom,text);
else
return SetDlgItemText(defhw,def,text);
//return SetDlgItemText(custom?g_hwnd:defhw,custom?custom:def,text);
} }
UINT GetUIText(WORD def, WORD custom, char *str, int max_size) { UINT GetUIText(WORD def, WORD custom, char *str, int max_size) {
if (custom) return GetDlgItemText(custom?g_hwnd:m_curwnd,custom?custom:def,str,max_size);
return GetDlgItemText(g_hwnd,custom,str,max_size);
else
return GetDlgItemText(m_curwnd,def,str,max_size);
//return GetDlgItemText(custom?g_hwnd:m_curwnd,custom?custom:def,str,max_size);
} }
HWND GetUIItem(HWND defhw, WORD def, WORD custom) { HWND GetUIItem(HWND defhw, WORD def, WORD custom) {
if (custom) return GetDlgItem(custom?g_hwnd:defhw,custom?custom:def);
return GetDlgItem(g_hwnd,custom);
else
return GetDlgItem(defhw,def);
//return GetDlgItem(custom?g_hwnd:defhw,custom?custom:def);
} }
#endif #endif
@ -162,28 +146,28 @@ static void SetChildrenStates(HWND hWnd, TV_ITEM *pItem, int iState) {
pItem->mask|=TVIF_PARAM; pItem->mask|=TVIF_PARAM;
TreeView_GetItem(hWnd, pItem); TreeView_GetItem(hWnd, pItem);
if (pItem->state >> 12 == 0) if (pItem->state >> 12 == 0)
return; return;
if (iState < 3 && (g_inst_section[pItem->lParam].default_state & DFS_RO)) l=3; if (iState < 3 && (g_inst_section[pItem->lParam].default_state & DFS_RO)) l=3;
pItem->state = INDEXTOSTATEIMAGEMASK(iState+l); pItem->state = INDEXTOSTATEIMAGEMASK(iState+l);
pItem->stateMask = TVIS_STATEIMAGEMASK; pItem->stateMask = TVIS_STATEIMAGEMASK;
if (!(g_inst_section[pItem->lParam].default_state & DFS_RO)) if (!(g_inst_section[pItem->lParam].default_state & DFS_RO))
{ {
if (iState == 2) g_inst_section[pItem->lParam].default_state |= DFS_SET; if (iState == 2) g_inst_section[pItem->lParam].default_state |= DFS_SET;
else g_inst_section[pItem->lParam].default_state &= ~DFS_SET; else g_inst_section[pItem->lParam].default_state &= ~DFS_SET;
TreeView_SetItem(hWnd, pItem); TreeView_SetItem(hWnd, pItem);
} }
hItem = TreeView_GetChild(hWnd, pItem->hItem); hItem = TreeView_GetChild(hWnd, pItem->hItem);
while (hItem) { while (hItem) {
pItem->hItem = hItem; pItem->hItem = hItem;
SetChildrenStates(hWnd, pItem, iState); SetChildrenStates(hWnd, pItem, iState);
hItem = TreeView_GetNextSibling(hWnd, hItem); hItem = TreeView_GetNextSibling(hWnd, hItem);
} }
} }
static void SetParentState(HWND hWnd, TV_ITEM *pItem) { static void SetParentState(HWND hWnd, TV_ITEM *pItem) {
@ -191,63 +175,59 @@ static void SetParentState(HWND hWnd, TV_ITEM *pItem) {
HTREEITEM hItem; HTREEITEM hItem;
int iState = 0, iStatePrev = 0; int iState = 0, iStatePrev = 0;
HTREEITEM hParent = TreeView_GetParent(hWnd, pItem->hItem); HTREEITEM hParent = TreeView_GetParent(hWnd, pItem->hItem);
if (!hParent) if (!hParent)
return; return;
hItem = TreeView_GetChild(hWnd, hParent); hItem = TreeView_GetChild(hWnd, hParent);
while (hItem) { while (hItem) {
pItem->hItem = hItem;
pItem->hItem = hItem; pItem->mask|=TVIF_PARAM;
pItem->mask|=TVIF_PARAM; TreeView_GetItem(hWnd, pItem);
TreeView_GetItem(hWnd, pItem); iState = pItem->state >> 12;
iState = pItem->state >> 12; if (iState && !(g_inst_section[pItem->lParam].default_state & DFS_RO))
if (iState && !(g_inst_section[pItem->lParam].default_state & DFS_RO)) {
{ if (iState==5) iState=2;
if (iState==5) iState=2; else if (iState==4) iState=1;
else if (iState==4) iState=1; if (iStatePrev && (iStatePrev != iState)) {
iState = 3;
if (iStatePrev && (iStatePrev != iState)) { break;
iState = 3;
break;
}
iStatePrev = iState;
} }
hItem = TreeView_GetNextSibling(hWnd, hItem); iStatePrev = iState;
} }
hItem = TreeView_GetNextSibling(hWnd, hItem);
}
pItem->hItem = hParent; pItem->hItem = hParent;
if (iState) { if (iState) {
pItem->state = INDEXTOSTATEIMAGEMASK(iState); pItem->state = INDEXTOSTATEIMAGEMASK(iState);
TreeView_SetItem(hWnd, pItem); TreeView_SetItem(hWnd, pItem);
} }
SetParentState(hWnd, pItem);
SetParentState(hWnd, pItem);
} }
static void CheckTreeItem(HWND hWnd, TV_ITEM *pItem, int checked) { static void CheckTreeItem(HWND hWnd, TV_ITEM *pItem, int checked) {
HTREEITEM hItem = pItem->hItem;
int l=0;
HTREEITEM hItem = pItem->hItem; pItem->mask = TVIF_STATE|TVIF_PARAM;
int l=0; TreeView_GetItem(hWnd, pItem);
if (pItem->state >> 12 == 0)
return;
pItem->mask = TVIF_STATE|TVIF_PARAM; if (g_inst_section[pItem->lParam].default_state & DFS_RO) l=3;
TreeView_GetItem(hWnd, pItem);
if (pItem->state >> 12 == 0)
return;
if (g_inst_section[pItem->lParam].default_state & DFS_RO) l=3; pItem->state = INDEXTOSTATEIMAGEMASK(checked?2:1+l);
pItem->stateMask = TVIS_STATEIMAGEMASK;
pItem->state = INDEXTOSTATEIMAGEMASK(checked?2:1+l);
pItem->stateMask = TVIS_STATEIMAGEMASK;
TreeView_SetItem(hWnd, pItem); TreeView_SetItem(hWnd, pItem);
SetChildrenStates(hWnd, pItem, checked?2:1); SetChildrenStates(hWnd, pItem, checked?2:1);
pItem->hItem = hItem; pItem->hItem = hItem;
SetParentState(hWnd, pItem); SetParentState(hWnd, pItem);
} }
#endif//NSIS_CONFIG_COMPONENTPAGE #endif//NSIS_CONFIG_COMPONENTPAGE
@ -320,42 +300,41 @@ int ui_doinstall(void)
{ {
// Added by Amir Szekely 3rd August 2002 // Added by Amir Szekely 3rd August 2002
// Multilingual support // Multilingual support
char pa=0; char pa=1;
int num=g_inst_header->str_tables_num; int num=g_inst_header->str_tables_num;
LANGID user_lang=GetUserDefaultLangID(); LANGID user_lang=GetUserDefaultLangID();
int size=num*sizeof(common_strings); int size=num*sizeof(common_strings);
cur_common_strings_table=common_strings_tables=(common_strings*)GlobalAlloc(GPTR,size); cur_common_strings_table=common_strings_tables=(common_strings*)GlobalAlloc(GPTR,size);
GetCompressedDataFromDataBlockToMemory(g_inst_header->common.str_tables,(char*)common_strings_tables,size); GetCompressedDataFromDataBlockToMemory(g_inst_header->common.str_tables,(char*)common_strings_tables,size);
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
if (!g_is_uninstaller) { if (g_is_uninstaller) {
#endif
size=num*sizeof(installer_strings);
cur_install_strings_table=install_strings_tables=(installer_strings*)GlobalAlloc(GPTR,size);
GetCompressedDataFromDataBlockToMemory(g_inst_header->str_tables,(char*)install_strings_tables,size);
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
}
else {
size=num*sizeof(uninstall_strings); size=num*sizeof(uninstall_strings);
cur_uninstall_strings_table=uninstall_strings_tables=(uninstall_strings*)GlobalAlloc(GPTR,size); cur_uninstall_strings_table=uninstall_strings_tables=(uninstall_strings*)GlobalAlloc(GPTR,size);
GetCompressedDataFromDataBlockToMemory(g_inst_uninstheader->str_tables,(char*)uninstall_strings_tables,size); GetCompressedDataFromDataBlockToMemory(g_inst_uninstheader->str_tables,(char*)uninstall_strings_tables,size);
} }
else
#endif #endif
lang_again: {
size=num*sizeof(installer_strings);
cur_install_strings_table=install_strings_tables=(installer_strings*)GlobalAlloc(GPTR,size);
GetCompressedDataFromDataBlockToMemory(g_inst_header->str_tables,(char*)install_strings_tables,size);
}
lang_again:
for (size=0; size < num; size++) { for (size=0; size < num; size++) {
if (user_lang == common_strings_tables[size].lang_id) { if (user_lang == common_strings_tables[size].lang_id) {
cur_install_strings_table = &install_strings_tables[size]; cur_install_strings_table+=size;
cur_common_strings_table = &common_strings_tables[size]; cur_common_strings_table+=size;
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
cur_uninstall_strings_table = &uninstall_strings_tables[size]; cur_uninstall_strings_table+=size;
#endif #endif
pa++; pa--;
break; break;
} }
common_strings_tables[size].lang_id&=0x3ff; // primary lang common_strings_tables[size].lang_id&=0x3ff; // primary lang
} }
if (!pa) { if (pa) {
user_lang&=0x3ff; // primary lang user_lang&=0x3ff; // primary lang
pa++; pa--;
goto lang_again; goto lang_again;
} }
} }
@ -542,7 +521,7 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
LANG_BTN_NEXT LANG_BTN_NEXT
); );
lstrcpy(g_tmp,g_caption); lstrcpy(g_tmp,g_caption);
process_string_fromtab(g_tmp+lstrlen(g_tmp),COMMON_STR(subcaptions[m_page])); process_string_fromtab(g_tmp+lstrlen(g_tmp),LANG_SUBCAPTION(m_page));
SetWindowText(hwndDlg,g_tmp); SetWindowText(hwndDlg,g_tmp);
@ -604,11 +583,6 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
} }
} }
} }
if (uMsg == WM_CTLCOLORSTATIC) {
SetTextColor((HDC)wParam, RGB(0,0,0));
SetBkMode((HDC)wParam, TRANSPARENT);
return (long)GetStockObject(NULL_BRUSH);
}
if (uMsg == WM_CLOSE) if (uMsg == WM_CLOSE)
{ {
if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDCANCEL)) && IsWindowEnabled(GetDlgItem(hwndDlg,IDOK))) if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDCANCEL)) && IsWindowEnabled(GetDlgItem(hwndDlg,IDOK)))
@ -624,9 +598,9 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
#undef _RICHEDIT_VER #undef _RICHEDIT_VER
static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
static HWND hwLicense = 0; static HWND hwLicense;
static HINSTANCE hRichEditDLL = 0; static HINSTANCE hRichEditDLL;
if (!hRichEditDLL) hRichEditDLL= LoadLibrary("RichEd32.dll"); if (!hRichEditDLL) hRichEditDLL=LoadLibrary("RichEd32.dll");
if (uMsg == WM_INITDIALOG) if (uMsg == WM_INITDIALOG)
{ {
hwLicense=GetDlgItem(hwndDlg,IDC_EDIT1); hwLicense=GetDlgItem(hwndDlg,IDC_EDIT1);
@ -641,8 +615,9 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
if (enlink->nmhdr.code==EN_LINK) { if (enlink->nmhdr.code==EN_LINK) {
if (enlink->msg==WM_LBUTTONDOWN) { if (enlink->msg==WM_LBUTTONDOWN) {
char *szUrl; char *szUrl;
SendMessage(hwLicense,EM_SETSEL,enlink->chrg.cpMin,enlink->chrg.cpMax); long min=enlink->chrg.cpMin, max=enlink->chrg.cpMax;
szUrl=(char *)GlobalAlloc(GPTR,enlink->chrg.cpMax-enlink->chrg.cpMin+1); SendMessage(hwLicense,EM_SETSEL,min,max);
szUrl=(char *)GlobalAlloc(GPTR,max-min+1);
SendMessage(hwLicense,EM_GETSELTEXT,0,(LPARAM)szUrl); SendMessage(hwLicense,EM_GETSELTEXT,0,(LPARAM)szUrl);
SetCursor(LoadCursor(0,IDC_WAIT)); SetCursor(LoadCursor(0,IDC_WAIT));
ShellExecute(hwndDlg,"open",szUrl,NULL,NULL,SW_SHOWNORMAL); ShellExecute(hwndDlg,"open",szUrl,NULL,NULL,SW_SHOWNORMAL);
@ -658,8 +633,7 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
} }
} }
else if (uMsg == WM_CLOSE) { else if (uMsg == WM_CLOSE) {
FreeLibrary(hRichEditDLL); SendMessage(g_hwnd,WM_CLOSE,0,0);
SendMessage(GetParent(hwndDlg),WM_CLOSE,0,0);
} }
return 0; return 0;
} }
@ -820,7 +794,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
SetUITextNT(hwndDlg,IDC_SPACEAVAILABLE,g_inst_header->space_avail_id,""); SetUITextNT(hwndDlg,IDC_SPACEAVAILABLE,g_inst_header->space_avail_id,"");
} }
EnableWindow(GetDlgItem(GetParent(hwndDlg),IDOK), EnableWindow(GetDlgItem(g_hwnd,IDOK),
is_valid_path && (available >= total || available == -1) is_valid_path && (available >= total || available == -1)
#ifdef NSIS_SUPPORT_CODECALLBACKS #ifdef NSIS_SUPPORT_CODECALLBACKS
&& !ExecuteCodeSegment(g_inst_entry,g_inst_header->code_onVerifyInstDir,NULL) && !ExecuteCodeSegment(g_inst_entry,g_inst_header->code_onVerifyInstDir,NULL)
@ -1183,8 +1157,7 @@ void update_status_text(const char *text1, const char *text2)
if (insthwnd) if (insthwnd)
{ {
if (lstrlen(text1)+lstrlen(text2) >= sizeof(ps_tmpbuf)) return; if (lstrlen(text1)+lstrlen(text2) >= sizeof(ps_tmpbuf)) return;
lstrcpy(ps_tmpbuf,text1); wsprintf(ps_tmpbuf,"%s%s",text1,text2);
lstrcat(ps_tmpbuf,text2);
if ((ui_st_updateflag&1)) if ((ui_st_updateflag&1))
{ {
// Changed by Amir Szekely 26th July 2002 // Changed by Amir Szekely 26th July 2002
@ -1242,16 +1215,13 @@ static DWORD WINAPI install_thread(LPVOID p)
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_VISIBLE_SUPPORT
static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
static HBRUSH hBrush;
static int lb_bg,lb_fg;
if (uMsg == WM_DESTROY && hBrush) DeleteObject(hBrush);
if (uMsg == WM_INITDIALOG) if (uMsg == WM_INITDIALOG)
{ {
DWORD id; DWORD id;
HWND hwnd;
int num=0; int num=0;
int x=0; int x=0;
LVCOLUMN lvc = {0, 0, -1, 0, 0, -1}; LVCOLUMN lvc = {0, 0, -1, 0, 0, -1};
int lb_bg=g_inst_cmnheader->lb_bg,lb_fg=g_inst_cmnheader->lb_fg;
insthwndbutton=GetDlgItem(hwndDlg,IDC_SHOWDETAILS); insthwndbutton=GetDlgItem(hwndDlg,IDC_SHOWDETAILS);
insthwnd2=GetUIItem(hwndDlg,IDC_INTROTEXT,g_inst_header->common.intro_text_id); insthwnd2=GetUIItem(hwndDlg,IDC_INTROTEXT,g_inst_header->common.intro_text_id);
@ -1277,9 +1247,9 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
ListView_InsertColumn(insthwnd, 0, &lvc); ListView_InsertColumn(insthwnd, 0, &lvc);
#define LVS_EX_LABELTIP 0x00004000 // listview unfolds partly hidden labels if it does not have infotip text #define LVS_EX_LABELTIP 0x00004000 // listview unfolds partly hidden labels if it does not have infotip text
ListView_SetExtendedListViewStyleEx(insthwnd, LVS_EX_LABELTIP, LVS_EX_LABELTIP); ListView_SetExtendedListViewStyleEx(insthwnd, LVS_EX_LABELTIP, LVS_EX_LABELTIP);
ListView_SetBkColor(insthwnd, g_inst_cmnheader->lb_bg); ListView_SetBkColor(insthwnd, lb_bg);
ListView_SetTextBkColor(insthwnd, g_inst_cmnheader->lb_bg); ListView_SetTextBkColor(insthwnd, lb_bg);
ListView_SetTextColor(insthwnd, g_inst_cmnheader->lb_fg); ListView_SetTextColor(insthwnd, lb_fg);
SetWindowText(insthwndbutton,STR(LANG_BTN_DETAILS)); SetWindowText(insthwndbutton,STR(LANG_BTN_DETAILS));
if (g_inst_cmnheader->show_details) if (g_inst_cmnheader->show_details)
{ {
@ -1292,16 +1262,14 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
g_progresswnd=GetDlgItem(hwndDlg,IDC_PROGRESS1+(g_inst_cmnheader->progress_flags&1)); g_progresswnd=GetDlgItem(hwndDlg,IDC_PROGRESS1+(g_inst_cmnheader->progress_flags&1));
ShowWindow(g_progresswnd,SW_SHOWNA); ShowWindow(g_progresswnd,SW_SHOWNA);
SendMessage(g_progresswnd,PBM_SETRANGE,0,MAKELPARAM(0,30000)); SendMessage(g_progresswnd,PBM_SETRANGE,0,MAKELPARAM(0,30000));
SendMessage(g_progresswnd,PBM_SETPOS,0,0);
if (g_inst_cmnheader->progress_flags&2) if (g_inst_cmnheader->progress_flags&2)
{ {
SendMessage(g_progresswnd,PBM_SETBARCOLOR,0,g_inst_cmnheader->lb_fg); SendMessage(g_progresswnd,PBM_SETBARCOLOR,0,lb_fg);
SendMessage(g_progresswnd,PBM_SETBKCOLOR,0,g_inst_cmnheader->lb_bg); SendMessage(g_progresswnd,PBM_SETBKCOLOR,0,lb_bg);
} }
hwnd=GetParent(hwndDlg); EnableWindow(GetDlgItem(g_hwnd,IDOK),0);
EnableWindow(GetDlgItem(hwnd,IDOK),0); EnableWindow(GetDlgItem(g_hwnd,IDCANCEL),0);
EnableWindow(GetDlgItem(hwnd,IDCANCEL),0);
CloseHandle(CreateThread(NULL,0,install_thread,(LPVOID)hwndDlg,0,&id)); CloseHandle(CreateThread(NULL,0,install_thread,(LPVOID)hwndDlg,0,&id));
} }
@ -1313,11 +1281,10 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
} }
if (uMsg == WM_NOTIFY_INSTPROC_DONE) if (uMsg == WM_NOTIFY_INSTPROC_DONE)
{ {
if (g_quit_flag) EndDialog(GetParent(hwndDlg),1); if (g_quit_flag) EndDialog(g_hwnd,1);
else if (!wParam) else if (!wParam)
{ {
HWND h2=GetParent(hwndDlg); HWND h=GetDlgItem(g_hwnd,IDOK);
HWND h=GetDlgItem(h2,IDOK);
EnableWindow(h,1); EnableWindow(h,1);
if (!g_autoclose) if (!g_autoclose)
{ {
@ -1325,17 +1292,17 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
lstrcpy(g_tmp,g_caption); lstrcpy(g_tmp,g_caption);
process_string_fromtab(g_tmp+lstrlen(g_caption),COMMON_STR(subcaptions[g_max_page+1])); process_string_fromtab(g_tmp+lstrlen(g_caption),COMMON_STR(subcaptions[g_max_page+1]));
update_status_text_from_tab(LANG_COMPLETED,""); update_status_text_from_tab(LANG_COMPLETED,"");
SetWindowText(h2,g_tmp); SetWindowText(g_hwnd,g_tmp);
SetFocus(h); SetFocus(h);
} }
else else
{ {
SendMessage(GetParent(hwndDlg),WM_NOTIFY_OUTER_NEXT,1,0); SendMessage(g_hwnd,WM_NOTIFY_OUTER_NEXT,1,0);
} }
} }
else else
{ {
HWND h=GetDlgItem(GetParent(hwndDlg),IDCANCEL); HWND h=GetDlgItem(g_hwnd,IDCANCEL);
EnableWindow(h,1); EnableWindow(h,1);
SetFocus(h); SetFocus(h);
} }

View file

@ -269,11 +269,25 @@
#endif #endif
#endif #endif
#ifndef NSIS_COMPRESS_BZIP2_LEVEL #ifndef NSIS_COMPRESS_BZIP2_LEVEL
#define NSIS_COMPRESS_BZIP2_LEVEL 9 #define NSIS_COMPRESS_BZIP2_LEVEL 9
#endif #endif
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
#ifndef NSIS_SUPPORT_RMDIR
#error NSIS_CONFIG_PLUGIN_SUPPORT relies on NSIS_SUPPORT_RMDIR, but NSIS_SUPPORT_RMDIR is not defined
#endif
#ifndef NSIS_SUPPORT_FILE
#error NSIS_CONFIG_PLUGIN_SUPPORT relies on NSIS_SUPPORT_FILE, but NSIS_SUPPORT_FILE is not defined
#endif
#ifndef NSIS_SUPPORT_ACTIVEXREG
#error NSIS_CONFIG_PLUGIN_SUPPORT relies on NSIS_SUPPORT_ACTIVEXREG, but NSIS_SUPPORT_ACTIVEXREG is not defined
#endif
#ifndef NSIS_SUPPORT_STACK
#error NSIS_CONFIG_PLUGIN_SUPPORT relies on NSIS_SUPPORT_STACK, but NSIS_SUPPORT_STACK is not defined
#endif
#endif
#if NSIS_MAX_INST_TYPES > 30 #if NSIS_MAX_INST_TYPES > 30
#error NSIS_MAX_INST_TYPES > 30 #error NSIS_MAX_INST_TYPES > 30
#endif #endif

View file

@ -363,7 +363,7 @@ static int ExecuteEntry(entry *entries, int pos)
process_string_fromtab(buf2,COMMON_STR(fileerrtext)); process_string_fromtab(buf2,COMMON_STR(fileerrtext));
lstrcpy(g_usrvars[0],buf3); // restore $0 lstrcpy(g_usrvars[0],buf3); // restore $0
switch (MessageBox(g_hwnd,buf2,g_caption,MB_ABORTRETRYIGNORE|MB_ICONSTOP)) switch (my_MessageBox(buf2,MB_ABORTRETRYIGNORE|MB_ICONSTOP))
{ {
case IDRETRY: case IDRETRY:
log_printf("File: error, user retry"); log_printf("File: error, user retry");
@ -393,15 +393,14 @@ static int ExecuteEntry(entry *entries, int pos)
{ {
if (ret == -2) if (ret == -2)
{ {
lstrcpy(buf,STR(LANG_ERRORWRITING)); wsprintf(buf,"%s%s",STR(LANG_ERRORWRITING),buf4);
lstrcat(buf,buf4);
} }
else else
{ {
lstrcpy(buf,STR(LANG_ERRORDECOMPRESSING)); lstrcpy(buf,STR(LANG_ERRORDECOMPRESSING));
} }
log_printf2("%s",buf); log_printf2("%s",buf);
MessageBox(g_hwnd,buf,g_caption,MB_OK|MB_ICONSTOP); my_MessageBox(buf,MB_OK|MB_ICONSTOP);
return EXEC_ERROR; return EXEC_ERROR;
} }
} }
@ -462,7 +461,7 @@ static int ExecuteEntry(entry *entries, int pos)
int v; int v;
process_string_fromtab(buf4,parms[1]); process_string_fromtab(buf4,parms[1]);
log_printf3("MessageBox: %d,\"%s\"",parms[0],buf4); log_printf3("MessageBox: %d,\"%s\"",parms[0],buf4);
v=MessageBox(g_hwnd,buf4,g_caption,parms[0]); v=my_MessageBox(buf4,parms[0]);
if (v) if (v)
{ {
if (v==(parms[2]&0xffff)) if (v==(parms[2]&0xffff))
@ -672,9 +671,7 @@ static int ExecuteEntry(entry *entries, int pos)
process_string_fromtab(buf,parms[0]); process_string_fromtab(buf,parms[0]);
process_string_fromtab(buf2,parms[1]); process_string_fromtab(buf2,parms[1]);
process_string_fromtab(buf3,parms[2]); process_string_fromtab(buf3,parms[2]);
lstrcpy(buf4,buf); wsprintf(buf4,"%s %s",buf,buf2);
lstrcat(buf4," ");
lstrcat(buf4,buf2);
update_status_text_from_tab(LANG_EXECSHELL, buf4); update_status_text_from_tab(LANG_EXECSHELL, buf4);
x=(int)ShellExecute(g_hwnd,buf[0]?buf:NULL,buf2,buf3[0]?buf3:NULL,state_output_directory,parms[3]); x=(int)ShellExecute(g_hwnd,buf[0]?buf:NULL,buf2,buf3[0]?buf3:NULL,state_output_directory,parms[3]);
if (x < 33) if (x < 33)
@ -881,8 +878,7 @@ static int ExecuteEntry(entry *entries, int pos)
buf[lstrlen(buf)+1]=0; buf[lstrlen(buf)+1]=0;
buf2[lstrlen(buf2)+1]=0; buf2[lstrlen(buf2)+1]=0;
lstrcpy(buf3,STR(LANG_COPYTO)); wsprintf(buf3,"%s%s",STR(LANG_COPYTO),buf2);
lstrcat(buf3,buf2);
op.pFrom=buf; op.pFrom=buf;
op.pTo=buf2; op.pTo=buf2;
@ -1271,7 +1267,7 @@ static int ExecuteEntry(entry *entries, int pos)
// Changed by Amir Szekely 11th July 2002 // Changed by Amir Szekely 11th July 2002
unsigned char* unicon_data = (unsigned char*)GlobalAlloc(GMEM_FIXED, g_inst_header->uninsticon_size); unsigned char* unicon_data = (unsigned char*)GlobalAlloc(GMEM_FIXED, g_inst_header->uninsticon_size);
if (unicon_data) { if (unicon_data) {
DWORD i, j; DWORD i;
unsigned char* seeker = unicon_data + sizeof(DWORD); unsigned char* seeker = unicon_data + sizeof(DWORD);
GetCompressedDataFromDataBlockToMemory(g_inst_header->uninstdata_offset, GetCompressedDataFromDataBlockToMemory(g_inst_header->uninstdata_offset,
unicon_data,g_inst_header->uninsticon_size); unicon_data,g_inst_header->uninsticon_size);
@ -1281,8 +1277,7 @@ static int ExecuteEntry(entry *entries, int pos)
seeker += sizeof(DWORD); seeker += sizeof(DWORD);
dwOffset = *(DWORD*)seeker; dwOffset = *(DWORD*)seeker;
seeker += sizeof(DWORD); seeker += sizeof(DWORD);
for (j = 0; j < dwSize; j++) mini_memcpy(filebuf, seeker, dwSize);
filebuf[dwOffset+j] = seeker[j];
seeker += dwSize; seeker += dwSize;
} }
GlobalFree(unicon_data); GlobalFree(unicon_data);
@ -1309,10 +1304,10 @@ static int ExecuteEntry(entry *entries, int pos)
case EW_LOG: case EW_LOG:
if (parms[0]) if (parms[0])
{ {
if (!g_log_file && parms[1]) build_g_logfile();
log_printf2("settings logging to %d",parms[1]); log_printf2("settings logging to %d",parms[1]);
log_dolog=parms[1]; log_dolog=parms[1];
log_printf2("logging set to %d",parms[1]); log_printf2("logging set to %d",parms[1]);
if (!g_log_file && log_dolg) build_g_logfile();
} }
else else
{ {
@ -1400,6 +1395,6 @@ static int ExecuteEntry(entry *entries, int pos)
return 0; return 0;
#endif // NSIS_CONFIG_PLUGIN_SUPPORT #endif // NSIS_CONFIG_PLUGIN_SUPPORT
} }
MessageBox(g_hwnd,STR(LANG_INSTCORRUPTED),g_caption,MB_OK|MB_ICONSTOP); my_MessageBox(STR(LANG_INSTCORRUPTED),MB_OK|MB_ICONSTOP);
return EXEC_ERROR; return EXEC_ERROR;
} }

View file

@ -72,7 +72,7 @@ int loadHeaders(void)
dbd_hFile=CreateFile(fno,GENERIC_WRITE|GENERIC_READ,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,NULL); dbd_hFile=CreateFile(fno,GENERIC_WRITE|GENERIC_READ,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,NULL);
if (dbd_hFile == INVALID_HANDLE_VALUE) if (dbd_hFile == INVALID_HANDLE_VALUE)
{ {
MessageBox(NULL,"Error writing temp file",g_caption,MB_OK); my_MessageBox("Error writing temp file",MB_OK);
return -1; return -1;
} }
} }
@ -82,7 +82,7 @@ int loadHeaders(void)
if (GetCompressedDataFromDataBlockToMemory(-1,data,h.length_of_header) != h.length_of_header) if (GetCompressedDataFromDataBlockToMemory(-1,data,h.length_of_header) != h.length_of_header)
{ {
MessageBox(NULL,"Error reading installer info block",g_caption,MB_OK); my_MessageBox("Error reading installer info block",MB_OK);
GlobalFree((HGLOBAL)data); GlobalFree((HGLOBAL)data);
return -1; return -1;
} }

View file

@ -19,14 +19,17 @@ HANDLE g_hInstance;
HANDLE myCreateProcess(char *cmd, char *dir) HANDLE myCreateProcess(char *cmd, char *dir)
{ {
PROCESS_INFORMATION ProcInfo={0,}; PROCESS_INFORMATION ProcInfo={0,};
STARTUPINFO StartUp={0,}; STARTUPINFO StartUp={sizeof(StartUp),};
StartUp.cb=sizeof(StartUp);
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, dir, &StartUp, &ProcInfo)) if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, dir, &StartUp, &ProcInfo))
return NULL; return NULL;
if (NULL != ProcInfo.hThread) CloseHandle( ProcInfo.hThread ); if (NULL != ProcInfo.hThread) CloseHandle( ProcInfo.hThread );
return ProcInfo.hProcess; return ProcInfo.hProcess;
} }
int my_MessageBox(const char *text, UINT type) {
return MessageBox(g_hwnd, text, g_caption, type);
}
#ifdef NSIS_SUPPORT_RMDIR #ifdef NSIS_SUPPORT_RMDIR
void doRMDir(char *buf, int recurse) void doRMDir(char *buf, int recurse)
{ {
@ -491,7 +494,7 @@ void process_string(char *out, const char *in)
break; break;
case VAR_CODES_START + 34: // LANGUAGE case VAR_CODES_START + 34: // LANGUAGE
wsprintf(out, "%u", cur_common_strings_table->lang_id); wsprintf(out, "%u", cur_install_strings_table->lang_id);
break; break;
#if VAR_CODES_START + 34 >= 255 #if VAR_CODES_START + 34 >= 255

View file

@ -33,6 +33,7 @@ extern char g_log_file[1024];
#endif #endif
HANDLE myCreateProcess(char *cmd, char *dir); HANDLE myCreateProcess(char *cmd, char *dir);
int my_MessageBox(const char *text, UINT type);
void doRMDir(char *buf, int recurse); void doRMDir(char *buf, int recurse);