Commit 10b36e39 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp140: Add task_continuation_context constructor implementation.

parent aedd6e95
...@@ -358,9 +358,9 @@ ...@@ -358,9 +358,9 @@
@ cdecl -arch=arm ??0ios_base@std@@IAA@XZ(ptr) ios_base_ctor @ cdecl -arch=arm ??0ios_base@std@@IAA@XZ(ptr) ios_base_ctor
@ thiscall -arch=i386 ??0ios_base@std@@IAE@XZ(ptr) ios_base_ctor @ thiscall -arch=i386 ??0ios_base@std@@IAE@XZ(ptr) ios_base_ctor
@ cdecl -arch=win64 ??0ios_base@std@@IEAA@XZ(ptr) ios_base_ctor @ cdecl -arch=win64 ??0ios_base@std@@IEAA@XZ(ptr) ios_base_ctor
@ stub -arch=arm ??0task_continuation_context@Concurrency@@AAA@XZ @ cdecl -arch=arm ??0task_continuation_context@Concurrency@@AAA@XZ(ptr) task_continuation_context_ctor
@ stub -arch=i386 ??0task_continuation_context@Concurrency@@AAE@XZ @ thiscall -arch=i386 ??0task_continuation_context@Concurrency@@AAE@XZ(ptr) task_continuation_context_ctor
@ stub -arch=win64 ??0task_continuation_context@Concurrency@@AEAA@XZ @ cdecl -arch=win64 ??0task_continuation_context@Concurrency@@AEAA@XZ(ptr) task_continuation_context_ctor
@ stub -arch=arm ??0time_base@std@@QAA@I@Z @ stub -arch=arm ??0time_base@std@@QAA@I@Z
@ stub -arch=i386 ??0time_base@std@@QAE@I@Z @ stub -arch=i386 ??0time_base@std@@QAE@I@Z
@ stub -arch=win64 ??0time_base@std@@QEAA@_K@Z @ stub -arch=win64 ??0time_base@std@@QEAA@_K@Z
......
...@@ -21,7 +21,57 @@ ...@@ -21,7 +21,57 @@
#include "wine/test.h" #include "wine/test.h"
#include "winbase.h" #include "winbase.h"
#undef __thiscall
#ifdef __i386__
#define __thiscall __stdcall
#else
#define __thiscall __cdecl
#endif
/* Emulate a __thiscall */
#ifdef __i386__
#include "pshpack1.h"
struct thiscall_thunk
{
BYTE pop_eax; /* popl %eax (ret addr) */
BYTE pop_edx; /* popl %edx (func) */
BYTE pop_ecx; /* popl %ecx (this) */
BYTE push_eax; /* pushl %eax */
WORD jmp_edx; /* jmp *%edx */
};
#include "poppack.h"
static void * (WINAPI *call_thiscall_func1)( void *func, void *this );
static void init_thiscall_thunk(void)
{
struct thiscall_thunk *thunk = VirtualAlloc( NULL, sizeof(*thunk),
MEM_COMMIT, PAGE_EXECUTE_READWRITE );
thunk->pop_eax = 0x58; /* popl %eax */
thunk->pop_edx = 0x5a; /* popl %edx */
thunk->pop_ecx = 0x59; /* popl %ecx */
thunk->push_eax = 0x50; /* pushl %eax */
thunk->jmp_edx = 0xe2ff; /* jmp *%edx */
call_thiscall_func1 = (void *)thunk;
}
#define call_func1(func,_this) call_thiscall_func1(func,_this)
#else
#define init_thiscall_thunk()
#define call_func1(func,_this) func(_this)
#endif /* __i386__ */
typedef struct {
void *unk0;
BYTE unk1;
} task_continuation_context;
static unsigned int (__cdecl *p__Thrd_id)(void); static unsigned int (__cdecl *p__Thrd_id)(void);
static task_continuation_context* (__thiscall *p_task_continuation_context_ctor)(task_continuation_context*);
static HMODULE msvcp; static HMODULE msvcp;
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
...@@ -37,6 +87,17 @@ static BOOL init(void) ...@@ -37,6 +87,17 @@ static BOOL init(void)
SET(p__Thrd_id, "_Thrd_id"); SET(p__Thrd_id, "_Thrd_id");
if(sizeof(void*) == 8) { /* 64-bit initialization */
SET(p_task_continuation_context_ctor, "??0task_continuation_context@Concurrency@@AEAA@XZ");
} else {
#ifdef __arm__
SET(p_task_continuation_context_ctor, "??0task_continuation_context@Concurrency@@AAA@XZ");
#else
SET(p_task_continuation_context_ctor, "??0task_continuation_context@Concurrency@@AAE@XZ");
#endif
}
init_thiscall_thunk();
return TRUE; return TRUE;
} }
...@@ -82,10 +143,21 @@ static void test_vbtable_size_exports(void) ...@@ -82,10 +143,21 @@ static void test_vbtable_size_exports(void)
} }
} }
static void test_task_continuation_context(void)
{
task_continuation_context tcc;
memset(&tcc, 0xdead, sizeof(tcc));
call_func1(p_task_continuation_context_ctor, &tcc);
ok(!tcc.unk0, "tcc.unk0 != NULL (%p)\n", tcc.unk0);
ok(!tcc.unk1, "tcc.unk1 != 0 (%x)\n", tcc.unk1);
}
START_TEST(msvcp140) START_TEST(msvcp140)
{ {
if(!init()) return; if(!init()) return;
test_thrd(); test_thrd();
test_vbtable_size_exports(); test_vbtable_size_exports();
test_task_continuation_context();
FreeLibrary(msvcp); FreeLibrary(msvcp);
} }
...@@ -1360,3 +1360,20 @@ void __cdecl _Unlock_shared_ptr_spin_lock(void) ...@@ -1360,3 +1360,20 @@ void __cdecl _Unlock_shared_ptr_spin_lock(void)
shared_ptr_lock = 0; shared_ptr_lock = 0;
} }
#endif #endif
#if _MSVCP_VER >= 140
typedef struct {
void *unk0;
BYTE unk1;
} task_continuation_context;
/* ??0task_continuation_context@Concurrency@@AAE@XZ */
/* ??0task_continuation_context@Concurrency@@AEAA@XZ */
DEFINE_THISCALL_WRAPPER(task_continuation_context_ctor, 4)
task_continuation_context* __thiscall task_continuation_context_ctor(task_continuation_context *this)
{
TRACE("(%p)\n", this);
memset(this, 0, sizeof(*this));
return this;
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment