msvcp120: Add _Do_call implementation.

This commit is contained in:
Piotr Caban 2015-05-20 22:19:06 +02:00 committed by Alexandre Julliard
parent a7a3cd84b5
commit d20c5965f1
5 changed files with 36 additions and 3 deletions

View File

@ -3742,7 +3742,7 @@
@ extern _Denorm
@ stub _Dint
@ stub _Dnorm
@ stub _Do_call
@ cdecl _Do_call(ptr)
@ stub _Dscale
@ stub _Dtento
@ stub _Dtest

View File

@ -3683,7 +3683,7 @@
@ extern _Denorm
@ stub _Dint
@ stub _Dnorm
@ stub _Do_call
@ cdecl _Do_call(ptr)
@ stub _Dscale
@ stub _Dtento
@ stub _Dtest

View File

@ -45,6 +45,7 @@ static int (__cdecl *p_xtime_get)(xtime*, int);
static _Cvtvec* (__cdecl *p__Getcvt)(_Cvtvec*);
static void (CDECL *p__Call_once)(int *once, void (CDECL *func)(void));
static void (CDECL *p__Call_onceEx)(int *once, void (CDECL *func)(void*), void *argv);
static void (CDECL *p__Do_call)(void *this);
static HMODULE msvcp;
@ -64,6 +65,7 @@ static BOOL init(void)
p__Getcvt = (void*)GetProcAddress(msvcp, "_Getcvt");
p__Call_once = (void*)GetProcAddress(msvcp, "_Call_once");
p__Call_onceEx = (void*)GetProcAddress(msvcp, "_Call_onceEx");
p__Do_call = (void*)GetProcAddress(msvcp, "_Do_call");
msvcr = GetModuleHandleA("msvcr120.dll");
p_setlocale = (void*)GetProcAddress(msvcr, "setlocale");
@ -244,6 +246,31 @@ static void test__Call_once(void)
ok(once == 1, "once = %x\n", once);
}
static void **vtbl_func0;
#ifdef __i386__
/* TODO: this should be a __thiscall function */
static void __stdcall thiscall_func(void)
{
cnt = 1;
}
#else
static void __cdecl thiscall_func(void *this)
{
ok(this == &vtbl_func0, "incorrect this value\n");
cnt = 1;
}
#endif
static void test__Do_call(void)
{
void *pfunc = thiscall_func;
cnt = 0;
vtbl_func0 = &pfunc;
p__Do_call(&vtbl_func0);
ok(cnt == 1, "func was not called\n");
}
START_TEST(msvcp120)
{
if(!init()) return;
@ -251,6 +278,7 @@ START_TEST(msvcp120)
test_xtime_get();
test__Getcvt();
test__Call_once();
test__Do_call();
FreeLibrary(msvcp);
}

View File

@ -3683,7 +3683,7 @@
@ extern _Denorm msvcp120._Denorm
@ stub _Dint
@ stub _Dnorm
@ stub _Do_call
@ cdecl _Do_call(ptr) msvcp120._Do_call
@ stub _Dscale
@ stub _Dtento
@ stub _Dtest

View File

@ -663,6 +663,11 @@ void __cdecl _Call_once(int *once, void (__cdecl *func)(void))
TRACE("%p %p\n", once, func);
_Call_onceEx(once, call_once_func_wrapper, func);
}
void __cdecl _Do_call(void *this)
{
CALL_VTBL_FUNC(this, 0, void, (void*), (this));
}
#endif
void init_misc(void *base)