increased instruction parameter count to 6, made SendMessage support strings differently and made it support timeouts
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1006 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
b319c52229
commit
680c8f78af
4 changed files with 34 additions and 11 deletions
|
@ -135,6 +135,7 @@ static int NSISCALL ExecuteEntry(entry *entries, int pos)
|
|||
int parm2=parms[2];
|
||||
int parm3=parms[3];
|
||||
int parm4=parms[4];
|
||||
int parm5=parms[5];
|
||||
int which=entries[pos].which;
|
||||
switch (which)
|
||||
{
|
||||
|
@ -654,12 +655,21 @@ static int NSISCALL ExecuteEntry(entry *entries, int pos)
|
|||
|
||||
if (which == EW_SENDMESSAGE)
|
||||
{
|
||||
process_string_fromtab(buf,parm3);
|
||||
process_string_fromtab(buf2,parm4);
|
||||
if (*(int*)buf == *(int*)"STR:") b3=(int)buf+4;
|
||||
if (*(int*)buf2 == *(int*)"STR:") b4=(int)buf2+4;
|
||||
HWND hwnd=(HWND)process_string_fromtab_toint(parm1);
|
||||
int msg=process_string_fromtab_toint(parm2);
|
||||
if (parm5&1)
|
||||
{
|
||||
process_string_fromtab(buf,parm3);
|
||||
b3=(int)buf;
|
||||
}
|
||||
if (parm5&2)
|
||||
{
|
||||
process_string_fromtab(buf2,parm4);
|
||||
b4=(int)buf2;
|
||||
}
|
||||
|
||||
v=SendMessage((HWND)process_string_fromtab_toint(parm1),process_string_fromtab_toint(parm2),b3,b4);
|
||||
if (parm5>>2) exec_errorflag += !SendMessageTimeout(hwnd,msg,b3,b4, SMTO_BLOCK, (parm5>>2), (LPDWORD)&v);
|
||||
else v=SendMessage(hwnd,msg,b3,b4);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// CRC (optional - 4 bytes)
|
||||
|
||||
|
||||
#define MAX_ENTRY_OFFSETS 5
|
||||
#define MAX_ENTRY_OFFSETS 6
|
||||
|
||||
|
||||
// if you want people to not be able to decompile your installers as easily,
|
||||
|
@ -66,7 +66,7 @@ enum
|
|||
EW_PUSHPOP, // Push/Pop/Exchange: 3 [variable/string, ?pop:push, ?exch]
|
||||
|
||||
EW_FINDWINDOW, // FindWindow: 5, [outputvar, window class,window name, window_parent, window_after]
|
||||
EW_SENDMESSAGE, // SendMessage: 5 [output, hwnd, msg, lparam, wparam]
|
||||
EW_SENDMESSAGE, // SendMessage: 6 [output, hwnd, msg, wparam, lparam, [wparamstring?1:0 | lparamstring?2:0 | timeout<<2]
|
||||
EW_ISWINDOW, // IsWindow: 3 [hwnd, jump_if_window, jump_if_notwindow]
|
||||
EW_GETDLGITEM, // GetDlgItem: 3 [outputvar, dialog, item_id]
|
||||
EW_SETWINDOWLONG, // SetStaticBkColor: 2 [hwnd, color]
|
||||
|
|
|
@ -2281,12 +2281,25 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
case TOK_SENDMESSAGE:
|
||||
ent.which=EW_SENDMESSAGE;
|
||||
SCRIPT_MSG("SendMessage:");
|
||||
ent.offsets[0]=line.gettoken_enum(5,usrvars);
|
||||
if (ent.offsets[0]>=0)
|
||||
{
|
||||
SCRIPT_MSG("(->%s)",line.gettoken_str(5));
|
||||
int a=5;
|
||||
ent.offsets[0]=line.gettoken_enum(5,usrvars);
|
||||
if (ent.offsets[0]>=0)
|
||||
{
|
||||
SCRIPT_MSG("(->%s)",line.gettoken_str(5));
|
||||
a++;
|
||||
}
|
||||
|
||||
if (!strncmp(line.gettoken_str(a),"/TIMEOUT=",9))
|
||||
{
|
||||
ent.offsets[5]|=atoi(line.gettoken_str(a)+9)<<2;
|
||||
SCRIPT_MSG(" (timeout=%d)",ent.offsets[5]>>2);
|
||||
}
|
||||
}
|
||||
|
||||
if (!strncmp(line.gettoken_str(3),"STR:",4)) ent.offsets[5]|=1;
|
||||
if (!strncmp(line.gettoken_str(4),"STR:",4)) ent.offsets[5]|=2;
|
||||
|
||||
ent.offsets[1]=add_string(line.gettoken_str(1));
|
||||
ent.offsets[2]=add_string(line.gettoken_str(2));
|
||||
ent.offsets[3]=add_string(line.gettoken_str(3));
|
||||
|
|
|
@ -124,7 +124,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_SECTIONSETTEXT,"SectionSetText",2,0,"section_index text_string"},
|
||||
{TOK_SECTIONEND,"SectionEnd",0,0,""},
|
||||
{TOK_SECTIONIN,"SectionIn",1,-1,"InstTypeIdx [InstTypeIdx [...]]"},
|
||||
{TOK_SENDMESSAGE,"SendMessage",4,1,"hwnd message wparam lparam [$(user_var: return value)]"},
|
||||
{TOK_SENDMESSAGE,"SendMessage",4,2,"hwnd message [wparam|STR:wParam] [lparam|STR:lParam] [$(user_var: return value)] [/TIMEOUT=X]"},
|
||||
{TOK_SETAUTOCLOSE,"SetAutoClose",1,0,"(false|true)"},
|
||||
{TOK_SETBRANDINGIMAGE,"SetBrandingImage",1,2,"[/IMGID=image_item_id_in_dialog] [/RESIZETOFIT] bitmap.bmp"},
|
||||
{TOK_SETCOMPRESS,"SetCompress",1,0,"(off|auto|force)"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue