(brainsucker) fixed a bug with calling proc(void) and added e switch to get GetLastError return value.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2465 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
e720007649
commit
96a524c1b7
4 changed files with 22 additions and 5 deletions
|
@ -27,6 +27,7 @@ int ParamSizeByType[6] = {0, // PAT_VOID (Size will be equal to 1)
|
|||
int z1, z2; // I've made them static for easier use at callback procs
|
||||
int LastStackPlace = 0;
|
||||
int LastStackReal = 0;
|
||||
DWORD LastError = 0;
|
||||
SystemProc *LastProc = NULL;
|
||||
int CallbackIndex = 0;
|
||||
HINSTANCE g_hInstance;
|
||||
|
@ -211,10 +212,15 @@ PLUGINFUNCTION(Call)
|
|||
ParamsOut(proc);
|
||||
}
|
||||
|
||||
// Deallocate params if not callback
|
||||
if (proc->ProcResult != PR_CALLBACK)
|
||||
{
|
||||
// Deallocate params if not callback
|
||||
ParamsDeAllocate(proc);
|
||||
|
||||
// In case of POPT_ERROR - first pop will be proc error
|
||||
if ((proc->Options & POPT_ERROR) != 0) pushint(LastError);
|
||||
}
|
||||
|
||||
// If proc is permanent?
|
||||
if ((proc->Options & POPT_PERMANENT) == 0)
|
||||
GlobalFree((HANDLE) proc); // No, free it
|
||||
|
@ -546,6 +552,9 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
|||
case 's':
|
||||
temp2 = POPT_GENSTACK;
|
||||
break;
|
||||
case 'e':
|
||||
temp2 = POPT_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
// New Options
|
||||
|
@ -626,8 +635,8 @@ void ParamsIn(SystemProc *proc)
|
|||
int i, *place;
|
||||
char *realbuf;
|
||||
|
||||
i = 1;
|
||||
do
|
||||
i = (proc->ParamCount > 0)?(1):(0);
|
||||
while (TRUE)
|
||||
{
|
||||
// Step 1: retrive value
|
||||
if ((proc->Params[i].Input == IOT_NONE) || (proc->Params[i].Input == IOT_INLINE))
|
||||
|
@ -684,10 +693,10 @@ void ParamsIn(SystemProc *proc)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (i == 0) break;
|
||||
if (i == proc->ParamCount) i = 0;
|
||||
else i++;
|
||||
}
|
||||
while (i != 1);
|
||||
}
|
||||
|
||||
void ParamsDeAllocate(SystemProc *proc)
|
||||
|
@ -889,6 +898,12 @@ SystemProc __declspec(naked) *CallProc(SystemProc *proc)
|
|||
// Proc result: OK
|
||||
proc->ProcResult = PR_OK;
|
||||
|
||||
// In case of POPT_ERROR -> GetLastError
|
||||
if ((proc->Options & POPT_ERROR) != 0)
|
||||
{
|
||||
LastError = GetLastError();
|
||||
}
|
||||
|
||||
SYSTEM_EVENT("\n\t\t\tAfter call ")
|
||||
#ifdef SYSTEM_LOG_DEBUG
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue