Commit 8536af68 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcp140: Pad _Mtx_t struct to match Windows.

parent c3ee5751
...@@ -168,6 +168,7 @@ typedef struct ...@@ -168,6 +168,7 @@ typedef struct
{ {
DWORD flags; DWORD flags;
critical_section cs; critical_section cs;
ULONG_PTR unknown;
DWORD thread_id; DWORD thread_id;
DWORD count; DWORD count;
} *_Mtx_t; } *_Mtx_t;
...@@ -1640,6 +1641,35 @@ static void test_Copy_file(void) ...@@ -1640,6 +1641,35 @@ static void test_Copy_file(void)
ok(SetCurrentDirectoryW(origin_path), "SetCurrentDirectoryW to origin_path failed\n"); ok(SetCurrentDirectoryW(origin_path), "SetCurrentDirectoryW to origin_path failed\n");
} }
static void test__Mtx(void)
{
_Mtx_t mtx = NULL;
int r;
r = p__Mtx_init(&mtx, 0);
ok(!r, "failed to init mtx\n");
ok(mtx->thread_id == -1, "mtx.thread_id = %lx\n", mtx->thread_id);
ok(mtx->count == 0, "mtx.count = %lx\n", mtx->count);
p__Mtx_lock(mtx);
ok(mtx->thread_id == GetCurrentThreadId(), "mtx.thread_id = %lx\n", mtx->thread_id);
ok(mtx->count == 1, "mtx.count = %lx\n", mtx->count);
p__Mtx_lock(mtx);
ok(mtx->thread_id == GetCurrentThreadId(), "mtx.thread_id = %lx\n", mtx->thread_id);
ok(mtx->count == 1, "mtx.count = %lx\n", mtx->count);
p__Mtx_unlock(mtx);
ok(mtx->thread_id == -1, "mtx.thread_id = %lx\n", mtx->thread_id);
ok(mtx->count == 0, "mtx.count = %lx\n", mtx->count);
p__Mtx_unlock(mtx);
ok(mtx->thread_id == -1, "mtx.thread_id = %lx\n", mtx->thread_id);
ok(mtx->count == -1, "mtx.count = %lx\n", mtx->count);
p__Mtx_unlock(mtx);
ok(mtx->thread_id == -1, "mtx.thread_id = %lx\n", mtx->thread_id);
ok(mtx->count == -2, "mtx.count = %lx\n", mtx->count);
p__Mtx_destroy(mtx);
}
START_TEST(msvcp140) START_TEST(msvcp140)
{ {
if(!init()) return; if(!init()) return;
...@@ -1667,5 +1697,6 @@ START_TEST(msvcp140) ...@@ -1667,5 +1697,6 @@ START_TEST(msvcp140)
test_Equivalent(); test_Equivalent();
test_cnd(); test_cnd();
test_Copy_file(); test_Copy_file();
test__Mtx();
FreeLibrary(msvcp); FreeLibrary(msvcp);
} }
...@@ -716,6 +716,9 @@ typedef struct ...@@ -716,6 +716,9 @@ typedef struct
{ {
DWORD flags; DWORD flags;
cs cs; cs cs;
#if _MSVCP_VER >= 140
ULONG_PTR unknown;
#endif
DWORD thread_id; DWORD thread_id;
DWORD count; DWORD count;
} *_Mtx_t; } *_Mtx_t;
......
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