allocate g_sdata.script_cmd_args as GMEM_MOVEABLE
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5100 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
c72c1d9520
commit
2263524b66
3 changed files with 15 additions and 8 deletions
|
@ -94,7 +94,7 @@ void SetScript(const char *script, bool clearArgs /*= true*/)
|
|||
GlobalFree(g_sdata.script_cmd_args);
|
||||
}
|
||||
|
||||
g_sdata.script_cmd_args = (char *) GlobalAlloc(GPTR, 1);
|
||||
g_sdata.script_cmd_args = GlobalAlloc(GHND, 1);
|
||||
}
|
||||
|
||||
g_sdata.script = (char *) GlobalAlloc(GPTR, lstrlen(script) + 1);
|
||||
|
@ -103,13 +103,17 @@ void SetScript(const char *script, bool clearArgs /*= true*/)
|
|||
|
||||
void AddScriptCmdArgs(const char *arg)
|
||||
{
|
||||
g_sdata.script_cmd_args = (char *) GlobalReAlloc(g_sdata.script_cmd_args,
|
||||
g_sdata.script_cmd_args = GlobalReAlloc(g_sdata.script_cmd_args,
|
||||
GlobalSize(g_sdata.script_cmd_args) + lstrlen(arg) + 2 /* quotes */ + 1 /* space */,
|
||||
0);
|
||||
|
||||
lstrcat(g_sdata.script_cmd_args, " \"");
|
||||
lstrcat(g_sdata.script_cmd_args, arg);
|
||||
lstrcat(g_sdata.script_cmd_args, "\"");
|
||||
char *args = (char *) GlobalLock(g_sdata.script_cmd_args);
|
||||
|
||||
lstrcat(args, " \"");
|
||||
lstrcat(args, arg);
|
||||
lstrcat(args, "\"");
|
||||
|
||||
GlobalUnlock(args);
|
||||
}
|
||||
|
||||
void ProcessCommandLine()
|
||||
|
|
|
@ -165,7 +165,7 @@ void SaveMRUList();
|
|||
|
||||
typedef struct NSISScriptData {
|
||||
char *script;
|
||||
char *script_cmd_args;
|
||||
HGLOBAL script_cmd_args;
|
||||
char *compile_command;
|
||||
char *output_exe;
|
||||
char *input_script;
|
||||
|
|
|
@ -280,11 +280,13 @@ void CompileNSISScript() {
|
|||
lstrcpy(compressor,"");
|
||||
}
|
||||
|
||||
char *args = (char *) GlobalLock(g_sdata.script_cmd_args);
|
||||
|
||||
g_sdata.compile_command = (char *) GlobalAlloc(
|
||||
GPTR,
|
||||
/* makensis.exe */ sizeof(EXENAME) + /* space */ 1 +
|
||||
/* script path */ lstrlen(g_sdata.script) + /* space */ 1 +
|
||||
/* script cmd args */ lstrlen(g_sdata.script_cmd_args) + /* space */ 1 +
|
||||
/* script cmd args */ lstrlen(args) + /* space */ 1 +
|
||||
/* defines /Dblah=... */ lstrlen(symbols) + /* space */ 1 +
|
||||
/* /XSetCompressor... */ lstrlen(compressor) + /* space */ 1 +
|
||||
/* /NOTTIFYHWND + HWND */ sizeof("/NOTIFYHWND -4294967295") + /* space */ 1
|
||||
|
@ -297,10 +299,11 @@ void CompileNSISScript() {
|
|||
compressor,
|
||||
symbols,
|
||||
g_sdata.hwnd,
|
||||
g_sdata.script_cmd_args,
|
||||
args,
|
||||
g_sdata.script
|
||||
);
|
||||
|
||||
GlobalUnlock(args);
|
||||
GlobalFree(symbols);
|
||||
}
|
||||
GlobalFree(g_sdata.input_script);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue