Commit a29f606e authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcr110: Add _Context::_CurrentContext.

parent b698da22
......@@ -327,7 +327,7 @@
@ stub -arch=win64 ?_ConcRT_Trace@details@Concurrency@@YAXHPEB_WZZ
@ stub -arch=i386 ?_Confirm_cancel@_Cancellation_beacon@details@Concurrency@@QAE_NXZ
@ stub -arch=win64 ?_Confirm_cancel@_Cancellation_beacon@details@Concurrency@@QEAA_NXZ
@ stub ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ
@ cdecl ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ() msvcr120.?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ
@ stub ?_Current_node@location@Concurrency@@SA?AV12@XZ
@ stub -arch=i386 ?_Destroy@_AsyncTaskCollection@details@Concurrency@@EAEXXZ
@ stub -arch=win64 ?_Destroy@_AsyncTaskCollection@details@Concurrency@@EEAAXXZ
......
......@@ -513,7 +513,7 @@
@ stub -arch=arm ?_Copy_str@exception@std@@AAAXPBD@Z
@ stub -arch=i386 ?_Copy_str@exception@std@@AAEXPBD@Z
@ stub -arch=win64 ?_Copy_str@exception@std@@AEAAXPEBD@Z
@ stub ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ
@ cdecl ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ(ptr) _Context__CurrentContext
@ stub ?_Current_node@location@Concurrency@@SA?AV12@XZ
@ stub -arch=arm ?_DeregisterCallback@_CancellationTokenState@details@Concurrency@@QAAXPAV_CancellationTokenRegistration@23@@Z
@ stub -arch=i386 ?_DeregisterCallback@_CancellationTokenState@details@Concurrency@@QAEXPAV_CancellationTokenRegistration@23@@Z
......
......@@ -31,6 +31,16 @@
#include <locale.h>
typedef void (*vtable_ptr)(void);
typedef struct {
const vtable_ptr *vtable;
} Context;
typedef struct {
Context *ctx;
} _Context;
static char* (CDECL *p_setlocale)(int category, const char* locale);
static size_t (CDECL *p___strncnt)(const char *str, size_t count);
......@@ -39,6 +49,9 @@ static unsigned int (CDECL *p__CurrentScheduler__GetNumberOfVirtualProcessors)(v
static unsigned int (CDECL *p_CurrentScheduler_Id)(void);
static unsigned int (CDECL *p__CurrentScheduler__Id)(void);
static Context* (__cdecl *p_Context_CurrentContext)(void);
static _Context* (__cdecl *p__Context__CurrentContext)(_Context*);
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(module,y)
#define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
......@@ -60,6 +73,17 @@ static BOOL init(void)
SET(p_CurrentScheduler_Id, "?Id@CurrentScheduler@Concurrency@@SAIXZ");
SET(p__CurrentScheduler__Id, "?_Id@_CurrentScheduler@details@Concurrency@@SAIXZ");
SET(p__Context__CurrentContext, "?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ");
if(sizeof(void*) == 8)
{
SET(p_Context_CurrentContext, "?CurrentContext@Context@Concurrency@@SAPEAV12@XZ");
}
else
{
SET(p_Context_CurrentContext, "?CurrentContext@Context@Concurrency@@SAPAV12@XZ");
}
return TRUE;
}
......@@ -146,10 +170,25 @@ static void test___strncnt(void)
}
}
static void test_CurrentContext(void)
{
_Context _ctx, *ret;
Context *ctx;
ctx = p_Context_CurrentContext();
ok(!!ctx, "got NULL\n");
memset(&_ctx, 0xcc, sizeof(_ctx));
ret = p__Context__CurrentContext(&_ctx);
ok(_ctx.ctx == ctx, "expected %p, got %p\n", ctx, _ctx.ctx);
ok(ret == &_ctx, "expected %p, got %p\n", &_ctx, ret);
}
START_TEST(msvcr110)
{
if (!init()) return;
test_CurrentScheduler(); /* MUST be first (at least among Concurrency tests) */
test_setlocale();
test___strncnt();
test_CurrentContext();
}
......@@ -509,7 +509,7 @@
@ stub -arch=arm ?_Copy_str@exception@std@@AAAXPBD@Z
@ stub -arch=i386 ?_Copy_str@exception@std@@AAEXPBD@Z
@ stub -arch=win64 ?_Copy_str@exception@std@@AEAAXPEBD@Z
@ stub ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ
@ cdecl ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ() _Context__CurrentContext
@ stub ?_Current_node@location@Concurrency@@SA?AV12@XZ
@ stub -arch=arm ?_Destroy@_AsyncTaskCollection@details@Concurrency@@EAAXXZ
@ stub -arch=i386 ?_Destroy@_AsyncTaskCollection@details@Concurrency@@EAEXXZ
......
......@@ -505,7 +505,7 @@
@ stub -arch=arm ?_Copy_str@exception@std@@AAAXPBD@Z
@ stub -arch=i386 ?_Copy_str@exception@std@@AAEXPBD@Z
@ stub -arch=win64 ?_Copy_str@exception@std@@AEAAXPEBD@Z
@ stub ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ
@ cdecl ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ() msvcr120.?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ
@ stub ?_Current_node@location@Concurrency@@SA?AV12@XZ
@ stub -arch=arm ?_Destroy@_AsyncTaskCollection@details@Concurrency@@EAAXXZ
@ stub -arch=i386 ?_Destroy@_AsyncTaskCollection@details@Concurrency@@EAEXXZ
......
......@@ -68,6 +68,10 @@ typedef struct {
#define call_Context_dtor(this, flags) CALL_VTBL_FUNC(this, 20, \
Context*, (Context*, unsigned int), (this, flags))
typedef struct {
Context *context;
} _Context;
union allocator_cache_entry {
struct _free {
int depth;
......@@ -278,6 +282,16 @@ unsigned int __cdecl Context_VirtualProcessorId(void)
return ctx ? call_Context_GetVirtualProcessorId(ctx) : -1;
}
#if _MSVCR_VER > 100
/* ?_CurrentContext@_Context@details@Concurrency@@SA?AV123@XZ */
_Context *__cdecl _Context__CurrentContext(_Context *ret)
{
TRACE("(%p)\n", ret);
ret->context = Context_CurrentContext();
return ret;
}
#endif
DEFINE_THISCALL_WRAPPER(ExternalContextBase_GetId, 4)
unsigned int __thiscall ExternalContextBase_GetId(const ExternalContextBase *this)
{
......
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