clean.bat |
|
138 |
invoke_test.cpp |
class baz : public base {
public:
NS_IMETHOD ignored() override;
NS_IMETHOD callme1() override;
NS_IMETHOD callme2() override;
NS_IMETHOD callme3() override;
void setfoo(foo* f) {other = f;}
foo* other;
};
NS_IMETHODIMP baz::ignored(){return 0;}
|
5149 |
mk_invoke.bat |
|
296 |
mk_stub.bat |
|
278 |
moz.build |
|
340 |
README |
These are just simple test programs in which stripped down versions of the |
444 |
stub_test.cpp |
/
#if defined(WIN32)
static int __stdcall PrepareAndDispatch(baz* self, uint32_t methodIndex,
uint32_t* args,
uint32_t* stackBytesToPop) {
fprintf(stdout, "PrepareAndDispatch (%p, %d, %p)\n", (void*)self, methodIndex,
(void*)args);
foo* a = self->other;
int p1 = (int)*args;
int p2 = (int)*(args + 1);
int out = 0;
switch (methodIndex) {
case 1:
out = a->callme1(p1, p2);
break;
case 2:
out = a->callme2(p1, p2);
break;
case 3:
out = a->callme3(p1, p2);
break;
}
stackBytesToPop = 2 * 4;
return out;
}
# ifndef __GNUC__
static __declspec(naked) void SharedStub(void) {
__asm {
push ebp // set up simple stack frame
mov ebp, esp // stack has: ebp/vtbl_index/retaddr/this/args
push ecx // make room for a ptr
lea eax, [ebp-4] // pointer to stackBytesToPop
push eax
lea ecx, [ebp+16] // pointer to args
push ecx
mov edx, [ebp+4] // vtbl_index
push edx
mov eax, [ebp+12] // this
push eax
call PrepareAndDispatch
mov edx, [ebp+8] // return address
mov ecx, [ebp-4] // stackBytesToPop
add ecx, 12 // for this, the index, and ret address
mov esp, ebp
pop ebp
add esp, ecx // fix up stack pointer
jmp edx // simulate __stdcall return
}
}
// these macros get expanded (many times) in the file #included below
# define STUB_ENTRY(n) \
__declspec(naked) nsresult __stdcall baz::callme##n() { \
__asm push n __asm jmp SharedStub \
}
# else /* __GNUC__ |
6324 |