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;