Daniel Lehman : msvcp140: Add _Thrd_id.

Alexandre Julliard julliard at winehq.org
Tue Sep 13 11:33:57 CDT 2016


Module: wine
Branch: master
Commit: 532999462d95af8d69afcb91ef8540928f11bd58
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=532999462d95af8d69afcb91ef8540928f11bd58

Author: Daniel Lehman <dlehman at esri.com>
Date:   Wed Aug 31 09:48:39 2016 -0700

msvcp140: Add _Thrd_id.

Signed-off-by: Daniel Lehman <dlehman at esri.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure                       |  1 +
 configure.ac                    |  1 +
 dlls/msvcp140/msvcp140.spec     |  2 +-
 dlls/msvcp140/tests/Makefile.in |  5 ++++
 dlls/msvcp140/tests/msvcp140.c  | 55 +++++++++++++++++++++++++++++++++++++++++
 dlls/msvcp90/misc.c             |  6 +++++
 6 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 0bda5d3..2e2186b 100755
--- a/configure
+++ b/configure
@@ -18016,6 +18016,7 @@ wine_fn_config_dll msvcp120 enable_msvcp120
 wine_fn_config_test dlls/msvcp120/tests msvcp120_test
 wine_fn_config_dll msvcp120_app enable_msvcp120_app
 wine_fn_config_dll msvcp140 enable_msvcp140
+wine_fn_config_test dlls/msvcp140/tests msvcp140_test
 wine_fn_config_dll msvcp60 enable_msvcp60
 wine_fn_config_test dlls/msvcp60/tests msvcp60_test
 wine_fn_config_dll msvcp70 enable_msvcp70
diff --git a/configure.ac b/configure.ac
index 15c8469..db9c6e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3135,6 +3135,7 @@ WINE_CONFIG_DLL(msvcp120)
 WINE_CONFIG_TEST(dlls/msvcp120/tests)
 WINE_CONFIG_DLL(msvcp120_app)
 WINE_CONFIG_DLL(msvcp140)
+WINE_CONFIG_TEST(dlls/msvcp140/tests)
 WINE_CONFIG_DLL(msvcp60)
 WINE_CONFIG_TEST(dlls/msvcp60/tests)
 WINE_CONFIG_DLL(msvcp70)
diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec
index f5a0838..e8f7e94 100644
--- a/dlls/msvcp140/msvcp140.spec
+++ b/dlls/msvcp140/msvcp140.spec
@@ -3726,7 +3726,7 @@
 @ cdecl _Thrd_equal(ptr ptr) _Thrd_equal
 @ stub _Thrd_exit
 @ cdecl _Thrd_hardware_concurrency() _Thrd_hardware_concurrency
-@ stub _Thrd_id
+@ cdecl _Thrd_id() _Thrd_id
 @ cdecl _Thrd_join(ptr long) _Thrd_join
 @ cdecl _Thrd_sleep(ptr) _Thrd_sleep
 @ cdecl _Thrd_start(ptr ptr ptr) msvcp110._Thrd_start
diff --git a/dlls/msvcp140/tests/Makefile.in b/dlls/msvcp140/tests/Makefile.in
new file mode 100644
index 0000000..fde164b
--- /dev/null
+++ b/dlls/msvcp140/tests/Makefile.in
@@ -0,0 +1,5 @@
+TESTDLL   = msvcp140.dll
+APPMODE   = -mno-cygwin
+
+C_SRCS = \
+	msvcp140.c
diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c
new file mode 100644
index 0000000..d54ced3
--- /dev/null
+++ b/dlls/msvcp140/tests/msvcp140.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2016 Daniel Lehman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdio.h>
+
+#include "wine/test.h"
+#include "winbase.h"
+
+static unsigned int (__cdecl *p__Thrd_id)(void);
+
+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)
+static BOOL init(void)
+{
+    msvcp = LoadLibraryA("msvcp140.dll");
+    if(!msvcp)
+    {
+        win_skip("msvcp140.dll not installed\n");
+        return FALSE;
+    }
+
+    SET(p__Thrd_id, "_Thrd_id");
+
+    return TRUE;
+}
+
+static void test_thrd(void)
+{
+    ok(p__Thrd_id() == GetCurrentThreadId(),
+        "expected same id, got _Thrd_id %u GetCurrentThreadId %u\n",
+        p__Thrd_id(), GetCurrentThreadId());
+}
+
+START_TEST(msvcp140)
+{
+    if(!init()) return;
+    test_thrd();
+    FreeLibrary(msvcp);
+}
diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c
index 7418fd2..96339e2 100644
--- a/dlls/msvcp90/misc.c
+++ b/dlls/msvcp90/misc.c
@@ -988,6 +988,12 @@ unsigned int __cdecl _Thrd_hardware_concurrency(void)
     return val;
 }
 
+unsigned int __cdecl _Thrd_id(void)
+{
+    TRACE("()\n");
+    return GetCurrentThreadId();
+}
+
 /* ??0_Pad at std@@QAE at XZ */
 /* ??0_Pad at std@@QEAA at XZ */
 DEFINE_THISCALL_WRAPPER(_Pad_ctor, 4)




More information about the wine-cvs mailing list