From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcp120/tests/msvcp120.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 060dda5b45f..f3cce632f51 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -2429,18 +2429,28 @@ static void test__Mtx(void)
r = p__Mtx_init(&mtx, flags[i]); ok(!r, "failed to init mtx (flags %x)\n", flags[i]); + ok(mtx->thread_id == -1, "mtx.thread_id = %lx (flags %x)\n", mtx->thread_id, flags[i]); + ok(mtx->count == 0, "mtx.count = %lu (flags %x)\n", mtx->count, flags[i]);
r = p__Mtx_trylock(&mtx); ok(!r, "_Mtx_trylock returned %x (flags %x)\n", r, flags[i]); + ok(mtx->thread_id == GetCurrentThreadId(), "mtx.thread_id = %lx (flags %x)\n", mtx->thread_id, flags[i]); + ok(mtx->count == 1, "mtx.count = %lu (flags %x)\n", mtx->count, flags[i]); r = p__Mtx_trylock(&mtx); ok(r == expect, "_Mtx_trylock returned %x (flags %x)\n", r, flags[i]); + ok(mtx->thread_id == GetCurrentThreadId(), "mtx.thread_id = %lx (flags %x)\n", mtx->thread_id, flags[i]); + ok(mtx->count == r ? 1 : 2, "mtx.count = %lu, expected %u (flags %x)\n", mtx->count, r ? 1 : 2, flags[i]); if(!r) p__Mtx_unlock(&mtx);
r = p__Mtx_lock(&mtx); ok(r == expect, "_Mtx_lock returned %x (flags %x)\n", r, flags[i]); + ok(mtx->thread_id == GetCurrentThreadId(), "mtx.thread_id = %lx (flags %x)\n", mtx->thread_id, flags[i]); + ok(mtx->count == r ? 1 : 2, "mtx.count = %lu, expected %u (flags %x)\n", mtx->count, r ? 1 : 2, flags[i]); if(!r) p__Mtx_unlock(&mtx);
p__Mtx_unlock(&mtx); + ok(mtx->thread_id == -1, "mtx.thread_id = %lx (flags %x)\n", mtx->thread_id, flags[i]); + ok(mtx->count == 0, "mtx.count = %lu (flags %x)\n", mtx->count, flags[i]); p__Mtx_destroy(&mtx); } }
From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcp140/tests/msvcp140.c | 31 +++++++++++++++++++++++++++++++ dlls/msvcp90/misc.c | 3 +++ 2 files changed, 34 insertions(+)
diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c index 6affa2f9c29..d0673e20a27 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -168,6 +168,7 @@ typedef struct { DWORD flags; critical_section cs; + ULONG_PTR unknown; DWORD thread_id; DWORD count; } *_Mtx_t; @@ -1638,6 +1639,35 @@ static void test_Copy_file(void) 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) { if(!init()) return; @@ -1665,5 +1695,6 @@ START_TEST(msvcp140) test_Equivalent(); test_cnd(); test_Copy_file(); + test__Mtx(); FreeLibrary(msvcp); } diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index f82456cbf4b..9db6f39184c 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -710,6 +710,9 @@ typedef struct { DWORD flags; cs cs; +#if _MSVCP_VER >= 140 + ULONG_PTR unknown; +#endif DWORD thread_id; DWORD count; } *_Mtx_t;
This merge request was approved by Piotr Caban.