Module: wine Branch: master Commit: 8536af685af8ac1707313c6383f37eb94f9caad0 URL: https://gitlab.winehq.org/wine/wine/-/commit/8536af685af8ac1707313c6383f37eb...
Author: Daniel Lehman dlehman25@gmail.com Date: Sun Jan 21 13:53:08 2024 -0800
msvcp140: Pad _Mtx_t struct to match Windows.
---
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 0140d4c3925..8966820f599 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; @@ -1640,6 +1641,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; @@ -1667,5 +1697,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 3ae190abeb3..c297f635e90 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -716,6 +716,9 @@ typedef struct { DWORD flags; cs cs; +#if _MSVCP_VER >= 140 + ULONG_PTR unknown; +#endif DWORD thread_id; DWORD count; } *_Mtx_t;