- fixed limit on LangStrings and user variables number which was lower than designed. limit is now 16383 for both.
- made log window respond to the context menu key and not just right click - set back the default style for the next after it's re-enabled - set focus on main controls for every page (can still hit enter for next) - added code to prevent weird usage of WM_COMMAND which can cause weird behavior such as disabled next button on the components page - eccles fixed a bug which caused beeping when the space key is hit on the components tree git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3351 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
e1c4b80991
commit
fcd2c16685
15 changed files with 266 additions and 188 deletions
|
@ -112,6 +112,7 @@ static LRESULT CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LP
|
|||
while ( !TryEnterCS() ) Sleep(0);
|
||||
if (message == WM_COMMAND && LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwnd, IDCANCEL), BM_SETSTATE, FALSE, 0);
|
||||
g_cancelled = 1;
|
||||
}
|
||||
else
|
||||
|
@ -308,10 +309,7 @@ __declspec(dllexport) void download (HWND parent,
|
|||
|
||||
// enable the cancel button
|
||||
wasen=EnableWindow(GetDlgItem(parent,IDCANCEL),TRUE);
|
||||
SendMessage(parent, DM_SETDEFID, IDCANCEL, 0);
|
||||
// remove the BS_DEFPUSHBUTTON style from IDOK
|
||||
SendMessage(GetDlgItem(parent, IDOK), BM_SETSTYLE, BS_PUSHBUTTON, TRUE);
|
||||
SetFocus(GetDlgItem(parent,IDCANCEL));
|
||||
SendMessage(parent, WM_NEXTDLGCTL, (WPARAM) GetDlgItem(parent, IDCANCEL), TRUE);
|
||||
}
|
||||
{
|
||||
WSADATA wsaData;
|
||||
|
@ -387,10 +385,16 @@ __declspec(dllexport) void download (HWND parent,
|
|||
|
||||
if (hwndB) ShowWindow(hwndB,SW_SHOWNA);
|
||||
if (hwndL) ShowWindow(hwndL,SW_SHOWNA);
|
||||
|
||||
SetWindowPos(childwnd,0,0,0,orig_childRc.right-orig_childRc.left,orig_childRc.bottom-orig_childRc.top,SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE);
|
||||
|
||||
if (wasen) EnableWindow(GetDlgItem(parent,IDCANCEL),FALSE);
|
||||
|
||||
SetWindowPos(
|
||||
childwnd,0,0,0,
|
||||
orig_childRc.right-orig_childRc.left,
|
||||
orig_childRc.bottom-orig_childRc.top,
|
||||
SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE
|
||||
);
|
||||
|
||||
if (wasen)
|
||||
EnableWindow(GetDlgItem(parent, IDCANCEL), FALSE);
|
||||
}
|
||||
if ( !error )
|
||||
error = "cancel";
|
||||
|
|
|
@ -308,7 +308,10 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
// Tell NSIS to remove old inner dialog and pass handle of the new inner dialog
|
||||
SendMessage(hwParent, WM_NOTIFY_CUSTOM_READY, (WPARAM)hwndDlg, 0);
|
||||
ShowWindow(hwndDlg, SW_SHOWNA);
|
||||
SetFocus(GetDlgItem(hwParent, IDOK));
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK) == BST_CHECKED)
|
||||
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwCheckBox, TRUE);
|
||||
else
|
||||
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwLocation, TRUE);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -419,6 +419,8 @@ definedlist.add("NSIS_SUPPORT_LANG_IN_STRINGS");
|
|||
m_UserVarNames.add("HWNDPARENT",-1); // 27
|
||||
m_UserVarNames.add("_CLICK",-1); // 28
|
||||
|
||||
m_iBaseVarsNum = m_UserVarNames.getnum();
|
||||
|
||||
m_ShellConstants.add("WINDIR",CSIDL_WINDOWS,CSIDL_WINDOWS);
|
||||
m_ShellConstants.add("SYSDIR",CSIDL_SYSTEM,CSIDL_SYSTEM);
|
||||
m_ShellConstants.add("PROGRAMFILES",CSIDL_PROGRAM_FILES, CSIDL_PROGRAM_FILES);
|
||||
|
@ -498,8 +500,8 @@ int CEXEBuild::preprocess_string(char *out, const char *in, WORD codepage/*=CP_A
|
|||
while (l--)
|
||||
{
|
||||
int i = (unsigned char)*p++;
|
||||
if (i >= VAR_CODES_START) {
|
||||
*out++ = (char)255;
|
||||
if (i >= NS_CODES_START) {
|
||||
*out++ = (char)NS_SKIP_CODE;
|
||||
}
|
||||
*out++=i;
|
||||
}
|
||||
|
@ -511,8 +513,8 @@ int CEXEBuild::preprocess_string(char *out, const char *in, WORD codepage/*=CP_A
|
|||
p=np;
|
||||
|
||||
// Test for characters extending into the variable codes
|
||||
if (i >= VAR_CODES_START) {
|
||||
*out++ = (char)255;
|
||||
if (i >= NS_CODES_START) {
|
||||
*out++ = (char)NS_SKIP_CODE;
|
||||
}
|
||||
else if (i == '$')
|
||||
{
|
||||
|
@ -541,8 +543,8 @@ int CEXEBuild::preprocess_string(char *out, const char *in, WORD codepage/*=CP_A
|
|||
// which is also memory wasting
|
||||
// So the line below must be commented !??
|
||||
//m_UserVarNames.inc_reference(idxUserVar);
|
||||
*out++ = (unsigned int) VAR_CODES_START; // Named user variable;
|
||||
*(WORD*)out = (WORD) ((idxUserVar + 1) | 0x8000);
|
||||
*out++ = (unsigned int) NS_VAR_CODE; // Named user variable;
|
||||
*(WORD*)out = CODE_SHORT(idxUserVar);
|
||||
out += sizeof(WORD);
|
||||
p += pUserVarName-p;
|
||||
bProceced = true;
|
||||
|
@ -564,7 +566,7 @@ int CEXEBuild::preprocess_string(char *out, const char *in, WORD codepage/*=CP_A
|
|||
{
|
||||
int CSIDL_Value_current = m_ShellConstants.get_value1(idxConst);
|
||||
int CSIDL_Value_all = m_ShellConstants.get_value2(idxConst);
|
||||
*out++=(unsigned int)SHELL_CODES_START; // Constant code identifier
|
||||
*out++=(unsigned int)NS_SHELL_CODE; // Constant code identifier
|
||||
*out++=(char)CSIDL_Value_current;
|
||||
*out++=(char)CSIDL_Value_all;
|
||||
p = pShellConstName;
|
||||
|
@ -585,8 +587,8 @@ int CEXEBuild::preprocess_string(char *out, const char *in, WORD codepage/*=CP_A
|
|||
idx = DefineLangString(cp);
|
||||
if (idx < 0)
|
||||
{
|
||||
*out++ = (unsigned int)LANG_CODES_START; // Next word is lang-string Identifier
|
||||
*(WORD*)out= (WORD) idx;
|
||||
*out++ = (unsigned int)NS_LANG_CODE; // Next word is lang-string Identifier
|
||||
*(WORD*)out= CODE_SHORT(-idx-1);
|
||||
out += sizeof(WORD);
|
||||
p += strlen(cp) + 2;
|
||||
bProceced = true;
|
||||
|
@ -2231,7 +2233,8 @@ int CEXEBuild::write_output(void)
|
|||
init_res_editor();
|
||||
VerifyDeclaredUserVarRefs(&m_UserVarNames);
|
||||
int MaxUserVars = m_UserVarNames.getnum();
|
||||
if (!res_editor->AddExtraVirtualSize2PESection(VARS_SECTION_NAME, (MaxUserVars-TOTAL_COMPATIBLE_STATIC_VARS_COUNT) * sizeof(NSIS_STRING)))
|
||||
// -1 because the default size is 1
|
||||
if (!res_editor->AddExtraVirtualSize2PESection(VARS_SECTION_NAME, (MaxUserVars - 1) * sizeof(NSIS_STRING)))
|
||||
{
|
||||
ERROR_MSG("Internal compiler error #12346: invalid exehead cannot find section \"%s\"!\n", VARS_SECTION_NAME);
|
||||
return PS_ERROR;
|
||||
|
@ -3218,9 +3221,9 @@ int CEXEBuild::DeclaredUserVar(const char *szVarName)
|
|||
}
|
||||
|
||||
m_UserVarNames.add(szVarName);
|
||||
if ( m_UserVarNames.getnum() > MAX_NAMED_USER_VARS )
|
||||
if (m_UserVarNames.getnum() > MAX_CODED)
|
||||
{
|
||||
ERROR_MSG("Error: too many user variables declared!\n");
|
||||
ERROR_MSG("Error: too many user variables declared. Maximum allowed is %u.\n", MAX_CODED - m_iBaseVarsNum);
|
||||
return PS_ERROR;
|
||||
}
|
||||
return PS_OK;
|
||||
|
@ -3252,9 +3255,9 @@ int CEXEBuild::GetUserVarIndex(LineParser &line, int token)
|
|||
|
||||
void CEXEBuild::VerifyDeclaredUserVarRefs(UserVarsStringList *pVarsStringList)
|
||||
{
|
||||
for ( int i = TOTAL_COMPATIBLE_STATIC_VARS_COUNT; i < pVarsStringList->getnum(); i++ )
|
||||
for (int i = m_iBaseVarsNum; i < pVarsStringList->getnum(); i++)
|
||||
{
|
||||
if ( !pVarsStringList->get_reference(i) )
|
||||
if (!pVarsStringList->get_reference(i))
|
||||
{
|
||||
warning("Variable \"%s\" not referenced, wasting memory!", pVarsStringList->idx2name(i));
|
||||
}
|
||||
|
|
|
@ -254,6 +254,7 @@ class CEXEBuild {
|
|||
int GetUserVarIndex(LineParser &line, int token);
|
||||
// Added by ramon 3 jun 2003
|
||||
UserVarsStringList m_UserVarNames;
|
||||
int m_iBaseVarsNum;
|
||||
int DeclaredUserVar(const char *VarName);
|
||||
void VerifyDeclaredUserVarRefs(UserVarsStringList *pVarsStringList);
|
||||
|
||||
|
|
|
@ -81,17 +81,39 @@ static DWORD WINAPI install_thread(LPVOID p);
|
|||
|
||||
HWND insthwnd, insthwnd2, insthwndbutton;
|
||||
|
||||
static HWND m_curwnd, m_bgwnd, m_hwndOK, m_hwndCancel;
|
||||
HWND m_curwnd;
|
||||
static HWND m_bgwnd, m_hwndOK, m_hwndCancel;
|
||||
|
||||
static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) {
|
||||
return my_SetDialogItemText(dlg,id+1000,GetNSISStringTT(lid));
|
||||
}
|
||||
|
||||
static void NSISCALL SetNextDef()
|
||||
{
|
||||
SendMessage(g_exec_flags.abort ? m_hwndCancel : m_hwndOK, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE);
|
||||
}
|
||||
|
||||
static void NSISCALL EnableNext(BOOL e)
|
||||
{
|
||||
EnableWindow(m_hwndOK, e);
|
||||
}
|
||||
|
||||
static void NSISCALL SetActiveCtl(HWND hDlg, HWND hCtl)
|
||||
{
|
||||
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM) hCtl, TRUE);
|
||||
}
|
||||
|
||||
static void NSISCALL NotifyCurWnd(UINT uNotifyCode)
|
||||
{
|
||||
if (m_curwnd)
|
||||
SendMessage(m_curwnd, uNotifyCode, 0, 0);
|
||||
}
|
||||
|
||||
#define SetDlgItemTextFromLang(dlg,id,lid) SetDlgItemTextFromLang_(dlg,(id)-1000,lid)
|
||||
|
||||
#define SetUITextFromLang(it,la) SetDlgItemTextFromLang_(hwndDlg,(it)-1000,la)
|
||||
#define SetUITextNT(it,text) my_SetDialogItemText(hwndDlg,it,text)
|
||||
#define GetUIText(it,s,ss) my_GetDialogItemText(hwndDlg,it,s,ss)
|
||||
#define GetUIText(it,s) my_GetDialogItemText(it,s)
|
||||
#define GetUIItem(it) GetDlgItem(hwndDlg,it)
|
||||
|
||||
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
||||
|
@ -183,7 +205,7 @@ lang_again:
|
|||
}
|
||||
}
|
||||
|
||||
int NSISCALL ui_doinstall(void)
|
||||
__forceinline int NSISCALL ui_doinstall(void)
|
||||
{
|
||||
header *header = g_header;
|
||||
static WNDCLASS wc; // richedit subclassing and bgbg creation
|
||||
|
@ -359,7 +381,7 @@ static int CALLBACK WINAPI BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lPara
|
|||
{
|
||||
if (uMsg==BFFM_INITIALIZED)
|
||||
{
|
||||
my_GetDialogItemText(m_curwnd,IDC_DIR,(char*)lpData,NSIS_MAX_STRLEN);
|
||||
my_GetDialogItemText(IDC_DIR,(char*)lpData);
|
||||
SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)1,lpData);
|
||||
}
|
||||
if (uMsg==BFFM_SELCHANGED)
|
||||
|
@ -418,14 +440,14 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
// But if quit called we must exit now
|
||||
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) return !g_quit_flag;
|
||||
#endif
|
||||
|
||||
|
||||
// if the last page was a custom page, wait for it to finish by itself.
|
||||
// if it doesn't, it's a BAD plugin.
|
||||
// plugins should react to WM_NOTIFY_OUTER_NEXT.
|
||||
if (!this_page->dlg_id) return 0;
|
||||
}
|
||||
|
||||
SendMessage(m_curwnd, WM_NOTIFY_INIGO_MONTOYA, 0, 0);
|
||||
NotifyCurWnd(WM_NOTIFY_INIGO_MONTOYA);
|
||||
|
||||
nextPage:
|
||||
m_page+=m_delta;
|
||||
|
@ -451,22 +473,32 @@ nextPage:
|
|||
SetDlgItemTextFromLang(hwndDlg, IDOK, this_page->next);
|
||||
SetDlgItemTextFromLang(hwndDlg, IDC_BACK, this_page->back);
|
||||
SetDlgItemTextFromLang(hwndDlg, IDCANCEL, this_page->cancel);
|
||||
|
||||
|
||||
hwndtmp = GetDlgItem(hwndDlg, IDC_BACK);
|
||||
|
||||
if (g_exec_flags.abort)
|
||||
{
|
||||
pflags &= ~(PF_BACK_ENABLE | PF_NEXT_ENABLE);
|
||||
pflags |= PF_CANCEL_ENABLE;
|
||||
SendMessage(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
|
||||
}
|
||||
else SendMessage(hwndDlg, DM_SETDEFID, IDOK, 0);
|
||||
|
||||
SetWindowLong(hwndtmp, GWL_STYLE, GetWindowLong(hwndtmp, GWL_STYLE) & ~BS_DEFPUSHBUTTON);
|
||||
|
||||
ShowWindow(hwndtmp, pflags & PF_BACK_SHOW);// SW_HIDE = 0, PF_BACK_SHOW = SW_SHOWNA = 8
|
||||
EnableWindow(hwndtmp, pflags & PF_BACK_ENABLE);
|
||||
EnableWindow(m_hwndOK, pflags & PF_NEXT_ENABLE);
|
||||
EnableNext(pflags & PF_NEXT_ENABLE);
|
||||
EnableWindow(m_hwndCancel, pflags & PF_CANCEL_ENABLE);
|
||||
|
||||
SendMessage(hwndtmp, BM_SETSTYLE, BS_PUSHBUTTON, TRUE);
|
||||
|
||||
if (g_exec_flags.abort)
|
||||
{
|
||||
SendMessage(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
|
||||
SetActiveCtl(hwndDlg, m_hwndCancel);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetActiveCtl(hwndDlg, m_hwndOK);
|
||||
}
|
||||
|
||||
mystrcpy(g_tmp,g_caption);
|
||||
GetNSISString(g_tmp+mystrlen(g_tmp),this_page->caption);
|
||||
my_SetWindowText(hwndDlg,g_tmp);
|
||||
|
@ -478,12 +510,15 @@ nextPage:
|
|||
}
|
||||
#endif //NSIS_SUPPORT_CODECALLBACKS
|
||||
|
||||
if (this_page->wndproc_id != PWP_COMPLETED) DestroyWindow(m_curwnd);
|
||||
if (this_page->wndproc_id != PWP_COMPLETED)
|
||||
{
|
||||
DestroyWindow(m_curwnd);
|
||||
}
|
||||
else {
|
||||
if (g_exec_flags.abort) SetFocus(m_hwndCancel);
|
||||
else if (g_exec_flags.autoclose) goto nextPage;
|
||||
else SetFocus(m_hwndOK); // without focus button, the system Beeps every time user press one key
|
||||
goto skipPage;
|
||||
if (!g_exec_flags.abort && g_exec_flags.autoclose)
|
||||
goto nextPage;
|
||||
// no need to go to skipPage because PWP_COMPLETED always follows PWP_INSTFILES
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// update g_this_page for the dialog proc
|
||||
|
@ -509,15 +544,8 @@ nextPage:
|
|||
ExecuteCodeSegment(this_page->showfunc,NULL);
|
||||
#endif //NSIS_SUPPORT_CODECALLBACKS
|
||||
ShowWindow(m_curwnd,SW_SHOWNA);
|
||||
SendMessage(m_curwnd,WM_NOTIFY_START,0,0);
|
||||
NotifyCurWnd(WM_NOTIFY_START);
|
||||
}
|
||||
|
||||
//XGE 5th September 2002 - Do *not* move the focus to the OK button if we are
|
||||
//on the license page, instead we want the focus left alone because in
|
||||
//WM_INITDIALOG it is given to the richedit control.
|
||||
if ((pflags & PF_NO_NEXT_FOCUS) == 0)
|
||||
SetFocus(m_hwndOK);
|
||||
//XGE End
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -525,7 +553,7 @@ skipPage:
|
|||
|
||||
if (!ui_dlg_visible && m_curwnd)
|
||||
{
|
||||
ShowWindow(hwndDlg, SW_SHOW);
|
||||
ShowWindow(hwndDlg, SW_SHOWDEFAULT);
|
||||
ui_dlg_visible = 1;
|
||||
}
|
||||
|
||||
|
@ -559,8 +587,12 @@ skipPage:
|
|||
{
|
||||
int id = LOWORD(wParam);
|
||||
HWND hCtl = GetDlgItem(hwndDlg, id);
|
||||
if (hCtl && !IsWindowEnabled(hCtl))
|
||||
return 0;
|
||||
if (hCtl)
|
||||
{
|
||||
SendMessage(hCtl, BM_SETSTATE, FALSE, 0);
|
||||
if (!IsWindowEnabled(hCtl))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (id == IDOK)
|
||||
{
|
||||
|
@ -621,6 +653,7 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
page *m_this_page=g_this_page;
|
||||
HWND hwLicense;
|
||||
static int ignoreWMCommand;
|
||||
|
||||
if (uMsg == WM_INITDIALOG)
|
||||
{
|
||||
|
@ -636,10 +669,11 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
|
||||
SetUITextFromLang(IDC_LICENSEAGREE,this_page->parms[2]);
|
||||
SetUITextFromLang(IDC_LICENSEDISAGREE,this_page->parms[3]);
|
||||
SendMessage(GetUIItem(IDC_LICENSEAGREE+!selected),BM_SETCHECK,BST_CHECKED,0);
|
||||
EnableWindow(m_hwndOK,selected);
|
||||
CheckDlgButton(hwndDlg,IDC_LICENSEAGREE+!selected,BST_CHECKED);
|
||||
EnableNext(selected);
|
||||
|
||||
hwLicense=GetUIItem(IDC_EDIT1);
|
||||
SetActiveCtl(hwndDlg, hwLicense);
|
||||
SendMessage(hwLicense,EM_AUTOURLDETECT,TRUE,0);
|
||||
#define lbg g_header->license_bg
|
||||
SendMessage(hwLicense,EM_SETBKGNDCOLOR,0,lbg>=0?lbg:GetSysColor(-lbg));
|
||||
|
@ -648,20 +682,16 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
dwRead=0;
|
||||
SendMessage(hwLicense,EM_EXLIMITTEXT,0,mystrlen(l));
|
||||
SendMessage(hwLicense,EM_STREAMIN,lt,(LPARAM)&es);
|
||||
//XGE 5th September 2002 - place the initial focus in the richedit control
|
||||
SetFocus(hwLicense);
|
||||
ignoreWMCommand = 0;
|
||||
return FALSE;
|
||||
//End Xge
|
||||
}
|
||||
if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) {
|
||||
if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && !ignoreWMCommand) {
|
||||
if (m_this_page->flags & PF_LICENSE_FORCE_SELECTION) {
|
||||
int is = SendMessage(GetUIItem(IDC_LICENSEAGREE), BM_GETCHECK, 0, 0) & BST_CHECKED;
|
||||
m_this_page->flags &= ~PF_LICENSE_SELECTED;
|
||||
m_this_page->flags |= is;
|
||||
EnableWindow(
|
||||
m_hwndOK,
|
||||
is
|
||||
);
|
||||
EnableNext(is);
|
||||
SetNextDef();
|
||||
}
|
||||
}
|
||||
if (uMsg == WM_NOTIFY) {
|
||||
|
@ -712,6 +742,10 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
#undef enlink
|
||||
#undef msgfilter
|
||||
}
|
||||
if (uMsg == WM_NOTIFY_INIGO_MONTOYA)
|
||||
{
|
||||
ignoreWMCommand++;
|
||||
}
|
||||
return HandleStaticBkColor();
|
||||
}
|
||||
#endif
|
||||
|
@ -750,7 +784,7 @@ static char * NSISCALL inttosizestr(int kb, char *str)
|
|||
return str;
|
||||
}
|
||||
|
||||
static int NSISCALL getreqsize()
|
||||
static int NSISCALL _sumsecsfield(int idx)
|
||||
{
|
||||
int x,total;
|
||||
section *sections = g_sections;
|
||||
|
@ -759,19 +793,22 @@ static int NSISCALL getreqsize()
|
|||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
if (sections[x].flags & SF_SELECTED)
|
||||
#endif
|
||||
total += sections[x].size_kb;
|
||||
total += sections[x].fields[idx];
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
#define sumsecsfield(x) _sumsecsfield(SECTION_OFFSET(x))
|
||||
|
||||
static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static int dontsetdefstyle;
|
||||
page *thispage = g_this_page;
|
||||
char *dir = g_usrvars[thispage->parms[4]];
|
||||
int browse_text = thispage->parms[3];
|
||||
if (uMsg == WM_NOTIFY_INIGO_MONTOYA)
|
||||
{
|
||||
GetUIText(IDC_DIR,dir,NSIS_MAX_STRLEN);
|
||||
GetUIText(IDC_DIR,dir);
|
||||
validate_filename(dir);
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
#ifndef NSIS_CONFIG_LOG_ODS
|
||||
|
@ -795,6 +832,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
SetUITextNT(IDC_DIR,dir);
|
||||
SetUITextFromLang(IDC_BROWSE,this_page->parms[2]);
|
||||
SetUITextFromLang(IDC_SELDIRTEXT,this_page->parms[1]);
|
||||
SetActiveCtl(hwndDlg, GetUIItem(IDC_DIR));
|
||||
}
|
||||
if (uMsg == WM_COMMAND)
|
||||
{
|
||||
|
@ -805,11 +843,10 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
}
|
||||
if (id == IDC_BROWSE)
|
||||
{
|
||||
char name[MAX_PATH];
|
||||
BROWSEINFO bi = {0,};
|
||||
ITEMIDLIST *idlist;
|
||||
bi.hwndOwner = hwndDlg;
|
||||
bi.pszDisplayName = name;
|
||||
bi.pszDisplayName = g_tmp;
|
||||
bi.lpfn = BrowseCallbackProc;
|
||||
bi.lParam = (LPARAM)dir;
|
||||
bi.lpszTitle = GetNSISStringTT(browse_text);
|
||||
|
@ -821,19 +858,20 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
if (idlist)
|
||||
{
|
||||
// Get and free idlist
|
||||
my_PIDL2Path(name, idlist);
|
||||
my_PIDL2Path(g_tmp, idlist);
|
||||
|
||||
if (g_header->install_directory_auto_append)
|
||||
{
|
||||
const char *post_str=ps_tmpbuf;
|
||||
GetNSISStringTT(g_header->install_directory_auto_append);
|
||||
// name gives just the folder name
|
||||
if (lstrcmpi(post_str,name))
|
||||
if (lstrcmpi(post_str,g_tmp))
|
||||
{
|
||||
lstrcat(addtrailingslash(dir),post_str);
|
||||
}
|
||||
}
|
||||
|
||||
dontsetdefstyle++;
|
||||
SetUITextNT(IDC_DIR,dir);
|
||||
}
|
||||
}
|
||||
|
@ -846,7 +884,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
int total, available=-1;
|
||||
DWORD spc,bps,fc,tc;
|
||||
|
||||
GetUIText(IDC_DIR,dir,NSIS_MAX_STRLEN);
|
||||
GetUIText(IDC_DIR,dir);
|
||||
if (!is_valid_instpath(dir))
|
||||
error = NSIS_INSTDIR_INVALID;
|
||||
|
||||
|
@ -862,7 +900,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
available=(int)r;
|
||||
}
|
||||
|
||||
total = getreqsize();
|
||||
total = sumsecsfield(size_kb);
|
||||
|
||||
if ((unsigned int)available < (unsigned int)total)
|
||||
error = NSIS_INSTDIR_NOT_ENOUGH_SPACE;
|
||||
|
@ -885,7 +923,10 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
if (thispage->flags & PF_DIR_NO_BTN_DISABLE)
|
||||
error = 0;
|
||||
|
||||
EnableWindow(m_hwndOK, !error);
|
||||
EnableNext(!error);
|
||||
if (!error && !dontsetdefstyle)
|
||||
SetNextDef();
|
||||
dontsetdefstyle = 0;
|
||||
}
|
||||
return HandleStaticBkColor();
|
||||
}
|
||||
|
@ -901,7 +942,7 @@ static int NSISCALL SetChildrenStates(HWND hwTree, HTREEITEM hItem, int iChecked
|
|||
int iCheckedChildren = 0, iChildren = 0, *pFlags, iState = 1;
|
||||
HTREEITEM hItrItem;
|
||||
TVITEM tvItem;
|
||||
|
||||
|
||||
hItrItem = TreeView_GetChild(hwTree, hItem);
|
||||
while (hItrItem)
|
||||
{
|
||||
|
@ -909,12 +950,12 @@ static int NSISCALL SetChildrenStates(HWND hwTree, HTREEITEM hItem, int iChecked
|
|||
iChildren++;
|
||||
hItrItem = TreeView_GetNextSibling(hwTree, hItrItem);
|
||||
}
|
||||
|
||||
|
||||
tvItem.hItem = hItem;
|
||||
tvItem.mask = TVIF_PARAM | TVIF_STATE;
|
||||
tvItem.stateMask = TVIS_STATEIMAGEMASK;
|
||||
TreeView_GetItem(hwTree, &tvItem);
|
||||
|
||||
|
||||
pFlags = &(g_sections[tvItem.lParam].flags);
|
||||
|
||||
if (*pFlags & SF_RO)
|
||||
|
@ -995,10 +1036,10 @@ HTREEITEM NSISCALL TreeHitTest(HWND tree)
|
|||
|
||||
ht.pt.x = GET_X_LPARAM(dwpos);
|
||||
ht.pt.y = GET_Y_LPARAM(dwpos);
|
||||
MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1);
|
||||
ScreenToClient(tree, &ht.pt);
|
||||
|
||||
TreeView_HitTest(tree, &ht);
|
||||
|
||||
|
||||
if (ht.flags & (TVHT_ONITEMSTATEICON|TVHT_ONITEMLABEL|TVHT_ONITEMRIGHT|TVHT_ONITEM))
|
||||
return ht.hItem;
|
||||
|
||||
|
@ -1009,9 +1050,9 @@ static LONG oldTreeWndProc;
|
|||
static DWORD WINAPI newTreeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static LPARAM last_item=-1;
|
||||
if (uMsg == WM_KEYDOWN && wParam == VK_SPACE)
|
||||
if (uMsg == WM_CHAR && wParam == VK_SPACE)
|
||||
{
|
||||
SendMessage(m_curwnd,WM_TREEVIEW_KEYHACK,0,0);
|
||||
NotifyCurWnd(WM_TREEVIEW_KEYHACK);
|
||||
}
|
||||
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
|
||||
if (uMsg == WM_DESTROY) {
|
||||
|
@ -1020,9 +1061,9 @@ static DWORD WINAPI newTreeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
if (uMsg == WM_MOUSEMOVE) {
|
||||
TVITEM tvItem;
|
||||
|
||||
if (GetWindowLong(hwnd, GWL_STYLE) & WS_VISIBLE) {
|
||||
if (IsWindowVisible(hwnd)) {
|
||||
tvItem.hItem = TreeHitTest(hwnd);
|
||||
|
||||
|
||||
lParam = -1;
|
||||
|
||||
if (tvItem.hItem)
|
||||
|
@ -1030,7 +1071,7 @@ static DWORD WINAPI newTreeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
tvItem.mask = TVIF_PARAM;
|
||||
|
||||
TreeView_GetItem(hwnd, &tvItem);
|
||||
|
||||
|
||||
lParam = tvItem.lParam;
|
||||
}
|
||||
uMsg = WM_NOTIFY_SELCHANGE;
|
||||
|
@ -1062,6 +1103,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
HWND hwndTree1 = GetUIItem(IDC_TREE1);
|
||||
extern HWND g_SectionHack;
|
||||
section *sections=g_sections;
|
||||
int *install_types=g_header->install_types;
|
||||
if (uMsg == WM_INITDIALOG)
|
||||
{
|
||||
int doLines=0;
|
||||
|
@ -1071,14 +1113,11 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
g_SectionHack=hwndDlg;
|
||||
|
||||
if (hTreeItems) GlobalFree(hTreeItems);
|
||||
hTreeItems=(HTREEITEM*)my_GlobalAlloc(sizeof(HTREEITEM)*num_sections);
|
||||
|
||||
hBMcheck1=LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
|
||||
|
||||
oldTreeWndProc=SetWindowLong(hwndTree1,GWL_WNDPROC,(DWORD)newTreeWndProc);
|
||||
|
||||
if (hImageList) ImageList_Destroy(hImageList);
|
||||
oldTreeWndProc=SetWindowLong(hwndTree1,GWL_WNDPROC,(long)newTreeWndProc);
|
||||
|
||||
hImageList = ImageList_Create(16,16, ILC_COLOR32|ILC_MASK, 6, 0);
|
||||
ImageList_AddMasked(hImageList,hBMcheck1,RGB(255,0,255));
|
||||
|
@ -1099,11 +1138,11 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
for (i = 0; i < NSIS_MAX_INST_TYPES+1; i++)
|
||||
{
|
||||
if (g_header->install_types[i])
|
||||
if (install_types[i])
|
||||
{
|
||||
int j;
|
||||
if (i != NSIS_MAX_INST_TYPES) noCombo = 0;
|
||||
GetNSISString(g_tmp,g_header->install_types[i]);
|
||||
GetNSISString(g_tmp,install_types[i]);
|
||||
j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)g_tmp);
|
||||
SendMessage(hwndCombo1,CB_SETITEMDATA,j,i);
|
||||
if (i == g_exec_flags.cur_insttype)
|
||||
|
@ -1111,9 +1150,6 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
}
|
||||
}
|
||||
|
||||
if (!noCombo)
|
||||
ShowWindow(hwndCombo1,SW_SHOW);
|
||||
|
||||
SetUITextFromLang(IDC_TEXT1,this_page->parms[1+noCombo]);
|
||||
SetUITextFromLang(IDC_TEXT2,this_page->parms[2+noCombo]);
|
||||
|
||||
|
@ -1177,6 +1213,14 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
}
|
||||
SendMessage(hwndTree1,WM_VSCROLL,SB_TOP,0);
|
||||
|
||||
if (!noCombo)
|
||||
{
|
||||
ShowWindow(hwndCombo1, SW_SHOW);
|
||||
SetActiveCtl(hwndDlg, hwndCombo1);
|
||||
}
|
||||
else
|
||||
SetActiveCtl(hwndDlg, hwndTree1);
|
||||
|
||||
uMsg = g_exec_flags.insttype_changed ? WM_NOTIFY_INSTTYPE_CHANGE : WM_IN_UPDATEMSG;
|
||||
}
|
||||
if (uMsg == WM_NOTIFY_SECTEXT) // update text
|
||||
|
@ -1280,7 +1324,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
if (uMsg == WM_NOTIFY_INSTTYPE_CHANGE ||
|
||||
(uMsg == WM_COMMAND && LOWORD(wParam)==IDC_COMBO1 && HIWORD(wParam)==CBN_SELCHANGE))
|
||||
{
|
||||
int t=SendMessage(hwndCombo1,CB_GETCURSEL,0,0);
|
||||
int t=SendMessage(hwndCombo1,CB_GETCURSEL,0,0);
|
||||
if (uMsg == WM_NOTIFY_INSTTYPE_CHANGE || t != CB_ERR)
|
||||
{
|
||||
int whichcfg=SendMessage(hwndCombo1,CB_GETITEMDATA,t,0);
|
||||
|
@ -1291,7 +1335,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
}
|
||||
else lParam = 1;
|
||||
|
||||
if (whichcfg == CB_ERR || !(g_header->install_types[whichcfg]))
|
||||
if (whichcfg == CB_ERR || !(install_types[whichcfg]))
|
||||
whichcfg = NSIS_MAX_INST_TYPES;
|
||||
|
||||
if (whichcfg != NSIS_MAX_INST_TYPES) // not custom
|
||||
|
@ -1336,8 +1380,9 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
{
|
||||
if (hImageList) ImageList_Destroy(hImageList);
|
||||
if (hTreeItems) GlobalFree(hTreeItems);
|
||||
hTreeItems=0;
|
||||
g_SectionHack=0;
|
||||
hImageList=NULL;
|
||||
hTreeItems=NULL;
|
||||
g_SectionHack=NULL;
|
||||
}
|
||||
if (uMsg == WM_IN_UPDATEMSG)
|
||||
{
|
||||
|
@ -1362,7 +1407,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
section *t=sections;
|
||||
x=num_sections;
|
||||
|
||||
if (!g_header->install_types[r]) continue;
|
||||
if (!install_types[r]) continue;
|
||||
|
||||
while (x--)
|
||||
{
|
||||
|
@ -1387,8 +1432,8 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
} // end of typecheckshit
|
||||
|
||||
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
|
||||
char s[128];
|
||||
SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(getreqsize(),GetNSISString(s,LANG_SPACE_REQ)));
|
||||
SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(sumsecsfield(size_kb),GetNSISString(g_tmp,LANG_SPACE_REQ)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1448,14 +1493,18 @@ static DWORD WINAPI install_thread(LPVOID p)
|
|||
}
|
||||
#endif
|
||||
|
||||
while (m_inst_sec<num_sections && !g_exec_flags.abort)
|
||||
while (m_inst_sec<num_sections)
|
||||
{
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
if (g_sections[m_inst_sec].flags&SF_SELECTED)
|
||||
#endif
|
||||
{
|
||||
log_printf2("Section: \"%s\"",GetNSISStringTT(g_sections[m_inst_sec].name_ptr));
|
||||
if (ExecuteCodeSegment(g_sections[m_inst_sec].code,progresswnd)) g_exec_flags.abort++;
|
||||
if (ExecuteCodeSegment(g_sections[m_inst_sec].code,progresswnd))
|
||||
{
|
||||
g_exec_flags.abort++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
else
|
||||
|
@ -1465,7 +1514,7 @@ static DWORD WINAPI install_thread(LPVOID p)
|
|||
#endif
|
||||
m_inst_sec++;
|
||||
}
|
||||
if (m_curwnd) SendMessage(m_curwnd,WM_NOTIFY_INSTPROC_DONE,0,0);
|
||||
NotifyCurWnd(WM_NOTIFY_INSTPROC_DONE);
|
||||
|
||||
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
|
||||
OleUninitialize();
|
||||
|
@ -1487,21 +1536,15 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
RECT r;
|
||||
LVCOLUMN lvc = {LVCF_WIDTH, 0, -1, 0, 0, -1};
|
||||
int lb_bg=g_header->lb_bg,lb_fg=g_header->lb_fg;
|
||||
int x=num_sections;
|
||||
|
||||
insthwndbutton=GetUIItem(IDC_SHOWDETAILS);
|
||||
insthwnd2=GetUIItem(IDC_INTROTEXT);
|
||||
linsthwnd=insthwnd=GetUIItem(IDC_LIST1);
|
||||
|
||||
progress_bar_len=0;
|
||||
progress_bar_len=sumsecsfield(code_size);
|
||||
progress_bar_pos=0;
|
||||
|
||||
log_printf3("New install of \"%s\" to \"%s\"",GetNSISStringTT(LANG_NAME),state_install_directory);
|
||||
while (x--)
|
||||
{
|
||||
if (g_sections[x].flags&SF_SELECTED)
|
||||
progress_bar_len+=g_sections[x].code_size;
|
||||
}
|
||||
|
||||
GetClientRect(linsthwnd, &r);
|
||||
lvc.cx = r.right - GetSystemMetrics(SM_CXHSCROLL);
|
||||
|
@ -1543,6 +1586,7 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
{
|
||||
ShowWindow(insthwndbutton,SW_HIDE);
|
||||
ShowWindow(linsthwnd,SW_SHOWNA);
|
||||
SetNextDef();
|
||||
}
|
||||
if (uMsg == WM_NOTIFY_INSTPROC_DONE)
|
||||
{
|
||||
|
@ -1562,22 +1606,33 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
//>>>Ximon Eighteen aka Sunjammer 30th August 2002
|
||||
//+++Popup "Copy Details To Clipboard" menu when RMB clicked in DetailView
|
||||
//+++Currently this has no language support for the popup menu tex
|
||||
if (uMsg == WM_NOTIFY && ((NMHDR*)lParam)->code == NM_RCLICK)
|
||||
if (uMsg == WM_CONTEXTMENU && wParam == (WPARAM) linsthwnd)
|
||||
{
|
||||
int count = ListView_GetItemCount(linsthwnd);
|
||||
if (count > 0)
|
||||
{
|
||||
DWORD pos = GetMessagePos();
|
||||
HMENU menu = CreatePopupMenu();
|
||||
POINT pt;
|
||||
AppendMenu(menu,MF_STRING,1,GetNSISStringTT(LANG_COPYDETAILS));
|
||||
if (lParam == ((UINT)-1))
|
||||
{
|
||||
RECT r;
|
||||
GetWindowRect(linsthwnd, &r);
|
||||
pt.x = r.left;
|
||||
pt.y = r.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt.x = GET_X_LPARAM(lParam);
|
||||
pt.y = GET_Y_LPARAM(lParam);
|
||||
}
|
||||
if (1==TrackPopupMenu(
|
||||
menu,
|
||||
TPM_NONOTIFY|TPM_RETURNCMD,
|
||||
GET_X_LPARAM(pos),
|
||||
GET_Y_LPARAM(pos),
|
||||
pt.x,
|
||||
pt.y,
|
||||
0,linsthwnd,0))
|
||||
{
|
||||
char textBuf[1024];
|
||||
int i,total = 1; // 1 for the null char
|
||||
LVITEM item;
|
||||
HGLOBAL memory;
|
||||
|
@ -1585,8 +1640,8 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
|
||||
// 1st pass - determine clipboard memory required.
|
||||
item.iSubItem = 0;
|
||||
item.pszText = textBuf;
|
||||
item.cchTextMax = 1023;
|
||||
item.pszText = g_tmp;
|
||||
item.cchTextMax = sizeof(g_tmp) - 1;
|
||||
i = count;
|
||||
while (i--)
|
||||
// Add 2 for the CR/LF combination that must follow every line.
|
||||
|
|
|
@ -391,27 +391,10 @@
|
|||
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||
#endif
|
||||
|
||||
// This is the old static var count that occupies memory
|
||||
// From $0 to $PLUGINSDIR, $_CLICK
|
||||
#define USER_VARS_COUNT 28
|
||||
|
||||
// This is the total number of old static var
|
||||
// From $0 to $HWNDPARENT
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
#define TOTAL_COMPATIBLE_STATIC_VARS_COUNT 32
|
||||
#else
|
||||
#define TOTAL_COMPATIBLE_STATIC_VARS_COUNT 31
|
||||
#endif
|
||||
|
||||
#define VARS_SECTION_NAME ".ndata"
|
||||
|
||||
typedef char NSIS_STRING[NSIS_MAX_STRLEN];
|
||||
|
||||
// MAX_NAMED_USER_VARS defines the maximum of named user variables
|
||||
// the complier also use this value to abort if exceded
|
||||
// The real maximum is (0x0FFF - USER_VARS_COUNT) = 4068
|
||||
#define MAX_NAMED_USER_VARS (0x0FFF - USER_VARS_COUNT)
|
||||
|
||||
#endif//!APSTUDIO_INVOKED
|
||||
|
||||
#endif // NSIS_CONFIG_H
|
||||
|
|
|
@ -315,16 +315,22 @@ typedef struct
|
|||
#define SF_EXPAND 32
|
||||
#define SF_PSELECTED 64
|
||||
|
||||
typedef struct
|
||||
typedef union
|
||||
{
|
||||
int name_ptr; // '' for non-optional components
|
||||
int install_types; // bits set for each of the different install_types, if any.
|
||||
int flags; // SF_* - defined above
|
||||
int code;
|
||||
int code_size;
|
||||
int size_kb;
|
||||
struct
|
||||
{
|
||||
int name_ptr; // '' for non-optional components
|
||||
int install_types; // bits set for each of the different install_types, if any.
|
||||
int flags; // SF_* - defined above
|
||||
int code;
|
||||
int code_size;
|
||||
int size_kb;
|
||||
};
|
||||
int fields[1];
|
||||
} section;
|
||||
|
||||
#define SECTION_OFFSET(field) (FIELD_OFFSET(section, field)/sizeof(int))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int which;
|
||||
|
@ -427,9 +433,14 @@ DWORD NSISCALL SetSelfFilePointer(LONG lDistanceToMove);
|
|||
|
||||
// $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value.
|
||||
// Added by ramon 3 jun 2003
|
||||
#define VAR_CODES_START 252
|
||||
#define SHELL_CODES_START 253
|
||||
#define LANG_CODES_START 254
|
||||
#define NS_SKIP_CODE 252
|
||||
#define NS_VAR_CODE 253
|
||||
#define NS_SHELL_CODE 254
|
||||
#define NS_LANG_CODE 255
|
||||
#define NS_CODES_START NS_SKIP_CODE
|
||||
|
||||
#define CODE_SHORT(x) (WORD)((((WORD)x & 0x7F) | (((WORD)x & 0x3F80) << 1) | 0x8080))
|
||||
#define MAX_CODED 16383
|
||||
|
||||
#define NSIS_INSTDIR_INVALID 1
|
||||
#define NSIS_INSTDIR_NOT_ENOUGH_SPACE 2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extern NSIS_STRING g_usrvars[TOTAL_COMPATIBLE_STATIC_VARS_COUNT];
|
||||
extern NSIS_STRING g_usrvars[1];
|
||||
|
||||
#define state_command_line g_usrvars[20]
|
||||
#define state_install_directory g_usrvars[21]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
extern int *cur_langtable;
|
||||
|
||||
int NSISCALL ui_doinstall(void);
|
||||
extern int NSISCALL ui_doinstall(void);
|
||||
void NSISCALL update_status_text(int strtab, const char *text2);
|
||||
extern int ui_st_updateflag;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ char g_log_file[1024];
|
|||
// which result in extra memory for extra variables without code to do allocation :)
|
||||
// nsis then removes the "DISCARDABLE" style from section (for safe)
|
||||
#pragma bss_seg( VARS_SECTION_NAME )
|
||||
NSIS_STRING g_usrvars[TOTAL_COMPATIBLE_STATIC_VARS_COUNT];
|
||||
NSIS_STRING g_usrvars[1];
|
||||
#pragma bss_seg()
|
||||
#define SECTION_VARS_RWD "/section:" ## VARS_SECTION_NAME ## ",rwd"
|
||||
#pragma comment(linker, SECTION_VARS_RWD)
|
||||
|
@ -48,10 +48,12 @@ int NSISCALL my_PIDL2Path(char *out, LPITEMIDLIST idl)
|
|||
HANDLE NSISCALL myCreateProcess(char *cmd, char *dir)
|
||||
{
|
||||
DWORD d;
|
||||
static PROCESS_INFORMATION ProcInfo;
|
||||
STARTUPINFO StartUp = {sizeof(StartUp), };
|
||||
PROCESS_INFORMATION ProcInfo;
|
||||
static STARTUPINFO StartUp;
|
||||
StartUp.cb=sizeof(StartUp);
|
||||
d=GetFileAttributes(dir);
|
||||
if (d == INVALID_FILE_ATTRIBUTES || !(d&FILE_ATTRIBUTE_DIRECTORY)) dir=0;
|
||||
if (d == INVALID_FILE_ATTRIBUTES || !(d&FILE_ATTRIBUTE_DIRECTORY))
|
||||
dir=0;
|
||||
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, dir, &StartUp, &ProcInfo))
|
||||
return NULL;
|
||||
CloseHandle(ProcInfo.hThread);
|
||||
|
@ -69,25 +71,21 @@ BOOL NSISCALL my_SetDialogItemText(HWND dlg, UINT idx, const char *val)
|
|||
//return my_SetWindowText(GetDlgItem(dlg,idx),val);
|
||||
}
|
||||
|
||||
/*int NSISCALL my_GetWindowText(HWND hWnd, char *val, int size)
|
||||
int NSISCALL my_GetDialogItemText(UINT idx, char *val)
|
||||
{
|
||||
return SendMessage(hWnd,WM_GETTEXT,size,(LPARAM)val);
|
||||
extern HWND m_curwnd;
|
||||
return GetDlgItemText(m_curwnd, idx, val, NSIS_MAX_STRLEN);
|
||||
}
|
||||
|
||||
int NSISCALL my_GetDialogItemText(HWND dlg, UINT idx, char *val, int size)
|
||||
{
|
||||
return my_GetWindowText(GetDlgItem(dlg,idx),val,size);
|
||||
}*/
|
||||
|
||||
int NSISCALL my_MessageBox(const char *text, UINT type) {
|
||||
int _type = type & 0x000FFFFF;
|
||||
// default for silent installers
|
||||
if (g_exec_flags.silent && type >> 20)
|
||||
return type >> 20;
|
||||
// no silent or no default, just show
|
||||
if (!g_exec_flags.rtl)
|
||||
return MessageBox(g_hwnd, text, g_caption, type & 0x000FFFFF);
|
||||
else
|
||||
return MessageBox(g_hwnd, text, g_caption, (type & 0x000FFFFF) ^ (MB_RIGHT | MB_RTLREADING));
|
||||
if (g_exec_flags.rtl)
|
||||
_type ^= MB_RIGHT | MB_RTLREADING;
|
||||
return MessageBox(g_hwnd, text, g_caption, _type);
|
||||
}
|
||||
|
||||
void * NSISCALL my_GlobalAlloc(DWORD dwBytes) {
|
||||
|
@ -102,7 +100,7 @@ void NSISCALL doRMDir(char *buf, int flags) // 1 - recurse, 2 - rebootok
|
|||
if (flags&1) {
|
||||
SHFILEOPSTRUCT op;
|
||||
|
||||
op.hwnd=0;
|
||||
op.hwnd=g_hwnd;
|
||||
op.wFunc=FO_DELETE;
|
||||
buf[mystrlen(buf)+1]=0;
|
||||
op.pFrom=buf;
|
||||
|
@ -472,12 +470,23 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
|||
}
|
||||
while (*in && out - ps_tmpbuf < NSIS_MAX_STRLEN)
|
||||
{
|
||||
int nVarIdx = (unsigned char)*in++;
|
||||
if (nVarIdx == 255)
|
||||
unsigned char nVarIdx = (unsigned char)*in++;
|
||||
int nData;
|
||||
int fldrs[4];
|
||||
if (nVarIdx > NS_SKIP_CODE)
|
||||
{
|
||||
nData = ((in[1] & 0x7F) << 7) | (in[0] & 0x7F);
|
||||
fldrs[0] = in[0]; // current user
|
||||
fldrs[1] = in[0] | CSIDL_FLAG_CREATE;
|
||||
fldrs[2] = in[1]; // all users
|
||||
fldrs[3] = in[1] | CSIDL_FLAG_CREATE;
|
||||
in += 2;
|
||||
}
|
||||
if (nVarIdx == NS_SKIP_CODE)
|
||||
{
|
||||
*out++ = *in++;
|
||||
}
|
||||
else if (nVarIdx == SHELL_CODES_START)
|
||||
else if (nVarIdx == NS_SHELL_CODE)
|
||||
{
|
||||
// NOTE 1: the code CSIDL_PRINTERS, is used for QUICKLAUNCH
|
||||
// NOTE 2: the code CSIDL_BITBUCKET is used for COMMONFILES
|
||||
|
@ -485,19 +494,10 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
|||
LPITEMIDLIST idl;
|
||||
char *append = 0;
|
||||
|
||||
int fldrs[4] = {
|
||||
in[0], // current user
|
||||
in[0] | CSIDL_FLAG_CREATE,
|
||||
in[1], // all users
|
||||
in[1] | CSIDL_FLAG_CREATE
|
||||
};
|
||||
|
||||
int x = 0;
|
||||
|
||||
*out = 0;
|
||||
|
||||
in += 2;
|
||||
|
||||
if (fldrs[2] == CSIDL_PRINTERS) // QUICKLAUNCH
|
||||
{
|
||||
append = "\\Microsoft\\Internet Explorer\\Quick Launch";
|
||||
|
@ -550,27 +550,23 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
|||
validate_filename(out);
|
||||
out += mystrlen(out);
|
||||
}
|
||||
else if (nVarIdx == VAR_CODES_START)
|
||||
else if (nVarIdx == NS_VAR_CODE)
|
||||
{
|
||||
nVarIdx = (*(WORD*)in - 1) & 0x7FFF;
|
||||
in += sizeof(WORD);
|
||||
if (nVarIdx == 27) // HWNDPARENT
|
||||
if (nData == 27) // HWNDPARENT
|
||||
myitoa(out, (unsigned int) g_hwnd);
|
||||
else
|
||||
mystrcpy(out, g_usrvars[nVarIdx]);
|
||||
mystrcpy(out, g_usrvars[nData]);
|
||||
// validate the directory name
|
||||
if ((unsigned int)(nVarIdx - 21) < 6) {
|
||||
if ((unsigned int)(nData - 21) < 6) {
|
||||
// validate paths for $INSTDIR, $OUTDIR, $EXEDIR, $LANGUAGE, $TEMP and $PLUGINSDIR
|
||||
// $LANGUAGE is just a number anyway...
|
||||
validate_filename(out);
|
||||
}
|
||||
out += mystrlen(out);
|
||||
} // == VAR_CODES_START
|
||||
else if (nVarIdx == LANG_CODES_START)
|
||||
else if (nVarIdx == NS_LANG_CODE)
|
||||
{
|
||||
nVarIdx = *(short*)in;
|
||||
in += sizeof(short);
|
||||
GetNSISString(out, nVarIdx);
|
||||
GetNSISString(out, -nData-1);
|
||||
out += mystrlen(out);
|
||||
}
|
||||
else // Normal char
|
||||
|
|
|
@ -19,10 +19,11 @@ int NSISCALL my_PIDL2Path(char *out, LPITEMIDLIST idl);
|
|||
//BOOL NSISCALL my_SetWindowText(HWND hWnd, const char *val);
|
||||
#define my_SetWindowText SetWindowText
|
||||
BOOL NSISCALL my_SetDialogItemText(HWND dlg, UINT idx, const char *val);
|
||||
//#define my_SetDialogItemText SetDlgItemText
|
||||
//int NSISCALL my_GetWindowText(HWND hWnd, char *val, int size);
|
||||
#define my_GetWindowText GetWindowText
|
||||
//int NSISCALL my_GetDialogItemText(HWND dlg, UINT idx, char *val, int size);
|
||||
#define my_GetDialogItemText GetDlgItemText
|
||||
int NSISCALL my_GetDialogItemText(UINT idx, char *val);
|
||||
//#define my_GetDialogItemText GetDlgItemText
|
||||
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
extern char log_text[NSIS_MAX_STRLEN*4];
|
||||
|
|
|
@ -286,6 +286,17 @@ int CEXEBuild::GenerateLangTables() {
|
|||
|
||||
SCRIPT_MSG("Generating language tables... ");
|
||||
|
||||
if (
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
ubuild_langstring_num > MAX_CODED ||
|
||||
#endif
|
||||
build_langstring_num > MAX_CODED
|
||||
)
|
||||
{
|
||||
ERROR_MSG("\nError: too many LangStrings. Maximum allowed is %u.\n", MAX_CODED);
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
||||
// If we have no tables (user didn't set any string and didn't load any NLF) create the default one
|
||||
if (!lang_tables.getlen()) {
|
||||
LANGID lang = NSIS_DEFAULT_LANG;
|
||||
|
@ -334,7 +345,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
#undef ADD_FONT
|
||||
}
|
||||
catch (exception& err) {
|
||||
ERROR_MSG("Error while applying font: %s\n", err.what());
|
||||
ERROR_MSG("\nError while applying font: %s\n", err.what());
|
||||
return PS_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -390,7 +401,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
#undef ADD_FONT
|
||||
}
|
||||
catch (exception& err) {
|
||||
ERROR_MSG("Error while applying NLF font/RTL: %s\n", err.what());
|
||||
ERROR_MSG("\nError while applying NLF font/RTL: %s\n", err.what());
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -411,7 +422,9 @@ int CEXEBuild::GenerateLangTables() {
|
|||
build_langtables.add(&rtl, sizeof(int));
|
||||
}
|
||||
|
||||
int *lst = (int *)((char *)build_langtables.get() + build_langtables.getlen());
|
||||
int *lst = NULL;
|
||||
unsigned int oldlen = build_langtables.getlen();
|
||||
|
||||
cnt = 0;
|
||||
tabsset = 1;
|
||||
|
||||
|
@ -426,6 +439,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
lang_strings = build_langstrings.sort_index(&l);
|
||||
|
||||
for (j = 0; j < l; j++) {
|
||||
lst = (int *)((char *)build_langtables.get() + oldlen);
|
||||
if (lang_strings[j].index >= 0) {
|
||||
if (cnt >= lastcnt || !lst[lang_strings[j].index]) {
|
||||
const char *str = lt[i].lang_strings->get(lang_strings[j].sn);
|
||||
|
@ -460,6 +474,8 @@ int CEXEBuild::GenerateLangTables() {
|
|||
}
|
||||
}
|
||||
|
||||
lst = (int *)((char *)build_langtables.get() + oldlen);
|
||||
|
||||
// optimize langstrings and check for recursion
|
||||
TinyGrowBuf rec;
|
||||
for (j = 0; j < build_langstring_num; j++) {
|
||||
|
@ -498,7 +514,9 @@ int CEXEBuild::GenerateLangTables() {
|
|||
ubuild_langtables.add(&rtl, sizeof(int));
|
||||
}
|
||||
|
||||
int *lst = (int *)((char *)ubuild_langtables.get() + ubuild_langtables.getlen());
|
||||
int *lst = NULL;
|
||||
unsigned int oldlen = ubuild_langtables.getlen();
|
||||
|
||||
cnt = 0;
|
||||
tabsset = 1;
|
||||
|
||||
|
@ -513,6 +531,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
lang_strings = build_langstrings.sort_uindex(&l);
|
||||
|
||||
for (j = 0; j < l; j++) {
|
||||
lst = (int *)((char *)ubuild_langtables.get() + oldlen);
|
||||
if (lang_strings[j].uindex >= 0) {
|
||||
if (cnt >= lastcnt || !lst[lang_strings[j].uindex]) {
|
||||
const char *str = lt[i].lang_strings->get(lang_strings[j].sn);
|
||||
|
@ -547,6 +566,8 @@ int CEXEBuild::GenerateLangTables() {
|
|||
}
|
||||
}
|
||||
|
||||
lst = (int *)((char *)ubuild_langtables.get() + oldlen);
|
||||
|
||||
// optimize langstrings and check for recursion
|
||||
TinyGrowBuf rec;
|
||||
for (j = 0; j < ubuild_langstring_num; j++) {
|
||||
|
|
|
@ -4985,7 +4985,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
{
|
||||
SCRIPT_MSG("VAR \"%s\"\n",line.gettoken_str(1));
|
||||
int res = DeclaredUserVar(line.gettoken_str(1));
|
||||
if ( res != PS_OK )
|
||||
if (res != PS_OK)
|
||||
return res;
|
||||
}
|
||||
return PS_OK;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue