Some more optimizations
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3223 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
edbc22d642
commit
b5a430dfa6
3 changed files with 37 additions and 38 deletions
|
@ -512,7 +512,7 @@ skipPage:
|
||||||
if (!ui_dlg_visible && m_curwnd)
|
if (!ui_dlg_visible && m_curwnd)
|
||||||
{
|
{
|
||||||
ShowWindow(hwndDlg, SW_SHOW);
|
ShowWindow(hwndDlg, SW_SHOW);
|
||||||
ui_dlg_visible = TRUE;
|
ui_dlg_visible = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bNextPage)
|
if (bNextPage)
|
||||||
|
|
|
@ -1011,22 +1011,21 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
hres = psl->lpVtbl->QueryInterface(psl,&IID_IPersistFile, (void **) &ppf);
|
hres = psl->lpVtbl->QueryInterface(psl,&IID_IPersistFile, (void **) &ppf);
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
{
|
{
|
||||||
|
hres = psl->lpVtbl->SetPath(psl,buf1);
|
||||||
|
psl->lpVtbl->SetWorkingDirectory(psl,state_output_directory);
|
||||||
|
if ((parm4&0xff00)>>8) psl->lpVtbl->SetShowCmd(psl,(parm4&0xff00)>>8);
|
||||||
|
psl->lpVtbl->SetHotkey(psl,(unsigned short)(parm4>>16));
|
||||||
|
if (buf3[0]) psl->lpVtbl->SetIconLocation(psl,buf3,parm4&0xff);
|
||||||
|
psl->lpVtbl->SetArguments(psl,buf0);
|
||||||
|
psl->lpVtbl->SetDescription(psl,buf4);
|
||||||
|
|
||||||
hres = psl->lpVtbl->SetPath(psl,buf1);
|
if (SUCCEEDED(hres))
|
||||||
psl->lpVtbl->SetWorkingDirectory(psl,state_output_directory);
|
{
|
||||||
if ((parm4&0xff00)>>8) psl->lpVtbl->SetShowCmd(psl,(parm4&0xff00)>>8);
|
static WCHAR wsz[1024];
|
||||||
psl->lpVtbl->SetHotkey(psl,(unsigned short)(parm4>>16));
|
wsz[0]=0;
|
||||||
if (buf3[0]) psl->lpVtbl->SetIconLocation(psl,buf3,parm4&0xff);
|
MultiByteToWideChar(CP_ACP, 0, buf2, -1, wsz, 1024);
|
||||||
psl->lpVtbl->SetArguments(psl,buf0);
|
hres=ppf->lpVtbl->Save(ppf,(const WCHAR*)wsz,TRUE);
|
||||||
psl->lpVtbl->SetDescription(psl,buf4);
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hres))
|
|
||||||
{
|
|
||||||
static WCHAR wsz[1024];
|
|
||||||
wsz[0]=0;
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, buf2, -1, wsz, 1024);
|
|
||||||
hres=ppf->lpVtbl->Save(ppf,(const WCHAR*)wsz,TRUE);
|
|
||||||
}
|
|
||||||
ppf->lpVtbl->Release(ppf);
|
ppf->lpVtbl->Release(ppf);
|
||||||
}
|
}
|
||||||
psl->lpVtbl->Release(psl);
|
psl->lpVtbl->Release(psl);
|
||||||
|
@ -1187,34 +1186,33 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
int rootkey=parm0;
|
int rootkey=parm0;
|
||||||
int type=parm4;
|
int type=parm4;
|
||||||
|
int rtype=parm5;
|
||||||
char *buf1=GetStringFromParm(0x12);
|
char *buf1=GetStringFromParm(0x12);
|
||||||
char *buf3=GetStringFromParm(0x31);
|
char *buf3=GetStringFromParm(0x31);
|
||||||
exec_error++;
|
exec_error++;
|
||||||
if (RegCreateKey((HKEY)rootkey,buf3,&hKey) == ERROR_SUCCESS)
|
if (RegCreateKey((HKEY)rootkey,buf3,&hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (type <= 1)
|
LPBYTE data = (LPBYTE) buf2;
|
||||||
|
DWORD size = 0;
|
||||||
|
if (type == REG_SZ)
|
||||||
{
|
{
|
||||||
char *buf2=GetStringFromParm(0x23);
|
GetStringFromParm(0x23);
|
||||||
if (RegSetValueEx(hKey,buf1,0,type==1?REG_SZ:REG_EXPAND_SZ,buf2,mystrlen(buf2)+1) == ERROR_SUCCESS) exec_error--;
|
size = mystrlen((char *) data) + 1;
|
||||||
log_printf5("WriteRegStr: set %d\\%s\\%s to %s",rootkey,buf3,buf1,buf2);
|
log_printf5("WriteRegStr: set %d\\%s\\%s to %s",rootkey,buf3,buf1,buf2);
|
||||||
}
|
}
|
||||||
else if (type == 2)
|
if (type == REG_DWORD)
|
||||||
{
|
{
|
||||||
DWORD l;
|
*(LPDWORD) data = GetIntFromParm(3);
|
||||||
l=GetIntFromParm(3);
|
size = sizeof(DWORD);
|
||||||
if (RegSetValueEx(hKey,buf1,0,REG_DWORD,(unsigned char*)&l,4) == ERROR_SUCCESS) exec_error--;
|
log_printf5("WriteRegDWORD: set %d\\%s\\%s to %d",rootkey,buf3,buf1,*(LPDWORD)data);
|
||||||
log_printf5("WriteRegDWORD: set %d\\%s\\%s to %d",rootkey,buf3,buf1,l);
|
|
||||||
}
|
}
|
||||||
else if (type == 3)
|
if (type == REG_BINARY)
|
||||||
{
|
{
|
||||||
int len=GetCompressedDataFromDataBlockToMemory(parm3, buf2, NSIS_MAX_STRLEN);
|
size = GetCompressedDataFromDataBlockToMemory(parm3, data, NSIS_MAX_STRLEN);
|
||||||
if (len >= 0)
|
|
||||||
{
|
|
||||||
if (RegSetValueEx(hKey,buf1,0,REG_BINARY,buf2,len) == ERROR_SUCCESS) exec_error--;
|
|
||||||
}
|
|
||||||
log_printf5("WriteRegBin: set %d\\%s\\%s with %d bytes",rootkey,buf3,buf1,len);
|
log_printf5("WriteRegBin: set %d\\%s\\%s with %d bytes",rootkey,buf3,buf1,len);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (size >= 0 && RegSetValueEx(hKey,buf1,0,rtype,data,size) == ERROR_SUCCESS)
|
||||||
|
exec_error--;
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
else { log_printf3("WriteReg: error creating key %d\\%s",rootkey,buf3); }
|
else { log_printf3("WriteReg: error creating key %d\\%s",rootkey,buf3); }
|
||||||
|
@ -1572,7 +1570,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
#ifdef NSIS_LOCKWINDOW_SUPPORT
|
#ifdef NSIS_LOCKWINDOW_SUPPORT
|
||||||
case EW_LOCKWINDOW:
|
case EW_LOCKWINDOW:
|
||||||
{
|
{
|
||||||
SendMessage(g_hwnd, WM_SETREDRAW, parm0 && ui_dlg_visible, 0);
|
// ui_dlg_visible is 1 or 0, so is parm0
|
||||||
|
SendMessage(g_hwnd, WM_SETREDRAW, parm0 & ui_dlg_visible, 0);
|
||||||
if ( parm0 )
|
if ( parm0 )
|
||||||
InvalidateRect(g_hwnd, NULL, FALSE);
|
InvalidateRect(g_hwnd, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4437,11 +4437,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
SCRIPT_MSG("%s: %s\\%s\\%s=%s\n",
|
SCRIPT_MSG("%s: %s\\%s\\%s=%s\n",
|
||||||
line.gettoken_str(0),line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4));
|
line.gettoken_str(0),line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4));
|
||||||
ent.offsets[3]=add_string(line.gettoken_str(4));
|
ent.offsets[3]=add_string(line.gettoken_str(4));
|
||||||
|
ent.offsets[4]=ent.offsets[5]=REG_SZ;
|
||||||
if (which_token == TOK_WRITEREGEXPANDSTR)
|
if (which_token == TOK_WRITEREGEXPANDSTR)
|
||||||
{
|
{
|
||||||
ent.offsets[4]=0;
|
ent.offsets[5]=REG_EXPAND_SZ;
|
||||||
}
|
}
|
||||||
else ent.offsets[4]=1;
|
|
||||||
}
|
}
|
||||||
if (which_token == TOK_WRITEREGBIN)
|
if (which_token == TOK_WRITEREGBIN)
|
||||||
{
|
{
|
||||||
|
@ -4476,12 +4476,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4));
|
line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4));
|
||||||
ent.offsets[3]=add_db_data(data,data_len);
|
ent.offsets[3]=add_db_data(data,data_len);
|
||||||
if (ent.offsets[3] < 0) return PS_ERROR;
|
if (ent.offsets[3] < 0) return PS_ERROR;
|
||||||
ent.offsets[4]=3;
|
ent.offsets[4]=ent.offsets[5]=REG_BINARY;
|
||||||
}
|
}
|
||||||
if (which_token == TOK_WRITEREGDWORD)
|
if (which_token == TOK_WRITEREGDWORD)
|
||||||
{
|
{
|
||||||
ent.offsets[3]=add_string(line.gettoken_str(4));
|
ent.offsets[3]=add_string(line.gettoken_str(4));
|
||||||
ent.offsets[4]=2;
|
ent.offsets[4]=ent.offsets[5]=REG_DWORD;
|
||||||
|
|
||||||
SCRIPT_MSG("WriteRegDWORD: %s\\%s\\%s=%s\n",
|
SCRIPT_MSG("WriteRegDWORD: %s\\%s\\%s=%s\n",
|
||||||
line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4));
|
line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4));
|
||||||
|
@ -5188,8 +5188,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
SCRIPT_MSG("LockWindow: lock state=%d\n",line.gettoken_str(1));
|
SCRIPT_MSG("LockWindow: lock state=%d\n",line.gettoken_str(1));
|
||||||
ent.which=EW_LOCKWINDOW;
|
ent.which=EW_LOCKWINDOW;
|
||||||
ent.offsets[0]=line.gettoken_enum(1,"on\0off\0");
|
ent.offsets[0]=line.gettoken_enum(1,"on\0off\0");
|
||||||
if ( ent.offsets[0] == -1 )
|
if (ent.offsets[0] == -1)
|
||||||
PRINTHELP();
|
PRINTHELP();
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
#else
|
#else
|
||||||
case TOK_LOCKWINDOW:
|
case TOK_LOCKWINDOW:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue