by OneTwoFree · 10y ago · 0 comments
*(v3 + 0x8)(*(VOID **)v3, &dword_AD002290, CommunicationBuffer + 0x18);
As I understand it is (was) an example code from Intel. Example codes should be easy to understand and well documented.The function pointer at `v3 + 0x8` is invoked with arguments: (1) the pointer at `v3 + 0x0`, (2) some fixed pointer, and (3) a pointer into the CommunicationBuffer.
E.g. here's more idiomatic C code to represent the same idea:
struct Thunk {
void *argument;
void (fp)(void *, DWORD *, void *);
};
struct CommunicationBuffer {
uint64_t unknown[4];
struct Thunk *thunk;
...;
};
EFI_STATUS __fastcall sub_AD3AFA54(
EFI_HANDLE SmmImageHandle, VOID *CommunicationBuffer, UINTN *SourceSize)
{
struct CommunicationBuffer *cb = CommunicationBuffer;
if (cb->thunk) {
cb->thunk->fp(cb->thunk->argument, &dword, &cb->unknown[3]);
cb->thunk = NULL;
}
return 0;
}