(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 z1, z2; // I've made them static for easier use at callback procs
|
||||||
int LastStackPlace = 0;
|
int LastStackPlace = 0;
|
||||||
int LastStackReal = 0;
|
int LastStackReal = 0;
|
||||||
|
DWORD LastError = 0;
|
||||||
SystemProc *LastProc = NULL;
|
SystemProc *LastProc = NULL;
|
||||||
int CallbackIndex = 0;
|
int CallbackIndex = 0;
|
||||||
HINSTANCE g_hInstance;
|
HINSTANCE g_hInstance;
|
||||||
|
@ -211,10 +212,15 @@ PLUGINFUNCTION(Call)
|
||||||
ParamsOut(proc);
|
ParamsOut(proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deallocate params if not callback
|
|
||||||
if (proc->ProcResult != PR_CALLBACK)
|
if (proc->ProcResult != PR_CALLBACK)
|
||||||
|
{
|
||||||
|
// Deallocate params if not callback
|
||||||
ParamsDeAllocate(proc);
|
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 is permanent?
|
||||||
if ((proc->Options & POPT_PERMANENT) == 0)
|
if ((proc->Options & POPT_PERMANENT) == 0)
|
||||||
GlobalFree((HANDLE) proc); // No, free it
|
GlobalFree((HANDLE) proc); // No, free it
|
||||||
|
@ -546,6 +552,9 @@ SystemProc *PrepareProc(BOOL NeedForCall)
|
||||||
case 's':
|
case 's':
|
||||||
temp2 = POPT_GENSTACK;
|
temp2 = POPT_GENSTACK;
|
||||||
break;
|
break;
|
||||||
|
case 'e':
|
||||||
|
temp2 = POPT_ERROR;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// New Options
|
// New Options
|
||||||
|
@ -626,8 +635,8 @@ void ParamsIn(SystemProc *proc)
|
||||||
int i, *place;
|
int i, *place;
|
||||||
char *realbuf;
|
char *realbuf;
|
||||||
|
|
||||||
i = 1;
|
i = (proc->ParamCount > 0)?(1):(0);
|
||||||
do
|
while (TRUE)
|
||||||
{
|
{
|
||||||
// Step 1: retrive value
|
// Step 1: retrive value
|
||||||
if ((proc->Params[i].Input == IOT_NONE) || (proc->Params[i].Input == IOT_INLINE))
|
if ((proc->Params[i].Input == IOT_NONE) || (proc->Params[i].Input == IOT_INLINE))
|
||||||
|
@ -684,10 +693,10 @@ void ParamsIn(SystemProc *proc)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (i == 0) break;
|
||||||
if (i == proc->ParamCount) i = 0;
|
if (i == proc->ParamCount) i = 0;
|
||||||
else i++;
|
else i++;
|
||||||
}
|
}
|
||||||
while (i != 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParamsDeAllocate(SystemProc *proc)
|
void ParamsDeAllocate(SystemProc *proc)
|
||||||
|
@ -889,6 +898,12 @@ SystemProc __declspec(naked) *CallProc(SystemProc *proc)
|
||||||
// Proc result: OK
|
// Proc result: OK
|
||||||
proc->ProcResult = PR_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 ")
|
SYSTEM_EVENT("\n\t\t\tAfter call ")
|
||||||
#ifdef SYSTEM_LOG_DEBUG
|
#ifdef SYSTEM_LOG_DEBUG
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,8 @@
|
||||||
#define POPT_ALWRETURN 0x4 // Always return
|
#define POPT_ALWRETURN 0x4 // Always return
|
||||||
#define POPT_NEVERREDEF 0x8 // Never redefine
|
#define POPT_NEVERREDEF 0x8 // Never redefine
|
||||||
#define POPT_GENSTACK 0x10 // Use general stack (non temporary for callback)
|
#define POPT_GENSTACK 0x10 // Use general stack (non temporary for callback)
|
||||||
#define POPT_CLONE 0x20 // This is clone callback
|
#define POPT_ERROR 0x20 // Call GetLastError after proc and push it to stack
|
||||||
|
#define POPT_CLONE 0x40 // This is clone callback
|
||||||
|
|
||||||
// Our single proc parameter
|
// Our single proc parameter
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -159,6 +159,7 @@ return place.
|
||||||
redefined either by GET or CALL. This options is never inherited to childs.
|
redefined either by GET or CALL. This options is never inherited to childs.
|
||||||
s - use general Stack. Whenever the first callback defined the system
|
s - use general Stack. Whenever the first callback defined the system
|
||||||
starts using the temporary stacks for function calls.
|
starts using the temporary stacks for function calls.
|
||||||
|
e - call GetLastError() after procedure end and push result on stack,
|
||||||
|
|
||||||
----------------------------------
|
----------------------------------
|
||||||
Callback:
|
Callback:
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue