System Plugin: Fixed callback proc numbers and memleak in Free()

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6016 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2009-12-21 21:25:45 +00:00
parent a2b3b82ed9
commit 32fda4e830
3 changed files with 70 additions and 7 deletions

View file

@ -101,6 +101,34 @@ struct tag_SystemProc
SystemProc *Clone;
};
typedef struct tag_CallbackThunk CallbackThunk;
struct tag_CallbackThunk
{
#ifdef SYSTEM_X86
/*
#pragma pack(push,1)
char mov_eax_imm;
int sysprocptr;
char reljmp_imm;
int realprocaddr;
#pragma pack(pop)
*/
char asm[10];
#else
#error "Asm thunk not implemeted for this architecture!"
#endif
CallbackThunk* pNext;
};
// Free() only knows about pNext in CallbackThunk, it does not know anything about the assembly, that is where this helper comes in...
#ifdef SYSTEM_X86
# define GetAssociatedSysProcFromCallbackThunkPtr(pCbT) ( (SystemProc*) *(unsigned int*) (((char*)(pCbT))+1) )
#else
# error "GetAssociatedSysProcFromCallbackThunkPtr not defined for the current architecture!"
#endif
extern const int ParamSizeByType[]; // Size of every parameter type (*4 bytes)
extern HANDLE CreateCallback(SystemProc *cbproc);