From 3fda95a9145b4bf7e4a89365aaeb2ce54f6c06c8 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Tue, 27 Oct 2015 23:21:07 -0700 Subject: [PATCH] msvcp120: implement _Thrd_equal/lt Signed-off-by: Daniel Lehman --- dlls/msvcp110/msvcp110.spec | 4 +-- dlls/msvcp120/msvcp120.spec | 4 +-- dlls/msvcp120/tests/msvcp120.c | 58 +++++++++++++++++++++++++++++++++++++ dlls/msvcp120_app/msvcp120_app.spec | 4 +-- dlls/msvcp90/misc.c | 20 +++++++++++++ 5 files changed, 84 insertions(+), 6 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index b8d21eb..9fb938a 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -3859,10 +3859,10 @@ @ stub _Thrd_create @ stub _Thrd_current @ stub _Thrd_detach -@ stub _Thrd_equal +@ cdecl _Thrd_equal(ptr ptr) @ stub _Thrd_exit @ stub _Thrd_join -@ stub _Thrd_lt +@ cdecl _Thrd_lt(ptr ptr) @ stub _Thrd_sleep @ stub _Thrd_start @ stub _Thrd_yield diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 0458b01..c25e2e4 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -3806,10 +3806,10 @@ @ stub _Thrd_create @ stub _Thrd_current @ stub _Thrd_detach -@ stub _Thrd_equal +@ cdecl _Thrd_equal(ptr ptr) @ stub _Thrd_exit @ stub _Thrd_join -@ stub _Thrd_lt +@ cdecl _Thrd_lt(ptr ptr) @ stub _Thrd_sleep @ stub _Thrd_start @ stub _Thrd_yield diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index d754191..fc69fd0 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -130,6 +130,16 @@ static enum file_type (__cdecl *p_tr2_sys__Lstat)(char const*, int *); static __int64 (__cdecl *p_tr2_sys__Last_write_time)(char const*); static void (__cdecl *p_tr2_sys__Last_write_time_set)(char const*, __int64); +/* thrd */ +typedef struct +{ + HANDLE hnd; + DWORD id; +} _Thrd_t; + +static int (__cdecl *p__Thrd_equal)(_Thrd_t, _Thrd_t); +static int (__cdecl *p__Thrd_lt)(_Thrd_t, _Thrd_t); + static HMODULE msvcp; #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) #define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0) @@ -253,6 +263,10 @@ static BOOL init(void) SET(p_tr2_sys__Last_write_time_set, "?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z"); } + SET(p__Thrd_equal, + "_Thrd_equal"); + SET(p__Thrd_lt, + "_Thrd_lt"); msvcr = GetModuleHandleA("msvcr120.dll"); p_setlocale = (void*)GetProcAddress(msvcr, "setlocale"); @@ -1120,6 +1134,47 @@ static void test_tr2_sys__Last_write_time(void) ok(ret == 1, "test_tr2_sys__Remove_dir(): expect 1 got %d\n", ret); } +static void test_thrd(void) +{ + int ret, i; + struct test { + _Thrd_t a; + _Thrd_t b; + int r; + }; + const HANDLE hnd1 = (HANDLE)0xcccccccc; + const HANDLE hnd2 = (HANDLE)0xdeadbeef; + + struct test testeq[] = { + { {0, 0}, {0, 0}, 1 }, + { {0, 1}, {0, 0}, 0 }, + { {hnd1, 0}, {hnd1, 1}, 0 }, + { {hnd1, 0}, {hnd2, 0}, 1 } + }; + + struct test testlt[] = { + { {0, 0}, {0, 0}, 0 }, + { {0, 0}, {0, 1}, 1 }, + { {0, 1}, {0, 0}, 0 }, + { {hnd1, 0}, {hnd2, 0}, 0 }, + { {hnd1, 0}, {hnd2, 1}, 1 } + }; + + /* test for equal */ + for(i=0; i= 110 +typedef struct +{ + HANDLE hnd; + DWORD id; +} _Thrd_t; + +int __cdecl _Thrd_equal(_Thrd_t a, _Thrd_t b) +{ + TRACE("(%p %u %p %u)\n", a.hnd, a.id, b.hnd, b.id); + return a.id == b.id; +} + +int __cdecl _Thrd_lt(_Thrd_t a, _Thrd_t b) +{ + TRACE("(%p %u %p %u)\n", a.hnd, a.id, b.hnd, b.id); + return a.id < b.id; +} +#endif -- 1.9.5