[PATCH 3/3] msvcp120: Add ?_Byte_reverse_table at details@Concurrency@@3QBEB data export.

Paul Gofman pgofman at codeweavers.com
Wed Jan 19 10:50:34 CST 2022


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
 dlls/msvcp120/msvcp120.spec         |  2 +-
 dlls/msvcp120/tests/msvcp120.c      | 26 ++++++++++++++++++++++++++
 dlls/msvcp120_app/msvcp120_app.spec |  2 +-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index 269290bbf90..6f868e190a9 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1114,7 +1114,7 @@
 @ stub -arch=win64 ?_Assign at _Concurrent_queue_iterator_base_v4@details at Concurrency@@IEAAXAEBV123@@Z
 @ stub ?_Atexit@@YAXP6AXXZ at Z
 @ extern ?_BADOFF at std@@3_JB std_BADOFF
-# extern ?_Byte_reverse_table at details@Concurrency@@3QBEB
+@ extern ?_Byte_reverse_table at details@Concurrency@@3QBEB byte_reverse_table
 @ cdecl -arch=arm ?_C_str@?$_Yarn at D@std@@QBAPBDXZ(ptr) _Yarn_char_c_str
 @ thiscall -arch=i386 ?_C_str@?$_Yarn at D@std@@QBEPBDXZ(ptr) _Yarn_char_c_str
 @ cdecl -arch=win64 ?_C_str@?$_Yarn at D@std@@QEBAPEBDXZ(ptr) _Yarn_char_c_str
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 6bc636c4b1f..9e36071d06a 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -417,6 +417,8 @@ static void (__thiscall *p_vector_base_v4__Internal_resize)(
         vector_base_v4*, size_t, size_t, size_t, void (__cdecl*)(void*, size_t),
         void (__cdecl *copy)(void*, const void*, size_t), const void*);
 
+static const BYTE *p_byte_reverse_table;
+
 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)
@@ -809,6 +811,8 @@ static BOOL init(void)
     SET(p__Cnd_do_broadcast_at_thread_exit,
             "_Cnd_do_broadcast_at_thread_exit");
 
+    SET(p_byte_reverse_table, "?_Byte_reverse_table at details@Concurrency@@3QBEB");
+
     hdll = GetModuleHandleA("msvcr120.dll");
     p_setlocale = (void*)GetProcAddress(hdll, "setlocale");
     p__setmbcp = (void*)GetProcAddress(hdll, "_setmbcp");
@@ -3305,6 +3309,26 @@ static void test_vector_base_v4(void)
     ok(!vector_alloc_count, "vector_alloc_count = %d, expected 0\n", vector_alloc_count);
 }
 
+static BYTE byte_reverse(BYTE b)
+{
+    b = ((b & 0xf0) >> 4) | ((b & 0x0f) << 4);
+    b = ((b & 0xcc) >> 2) | ((b & 0x33) << 2);
+    b = ((b & 0xaa) >> 1) | ((b & 0x55) << 1);
+    return b;
+}
+
+static void test_data_exports(void)
+{
+    unsigned int i;
+
+    ok(IsBadWritePtr((BYTE *)p_byte_reverse_table, 256), "byte_reverse_table is writeable.\n");
+    for (i = 0; i < 256; ++i)
+    {
+        ok(p_byte_reverse_table[i] == byte_reverse(i), "Got unexpected byte %#x, expected %#x.\n",
+                p_byte_reverse_table[i], byte_reverse(i));
+    }
+}
+
 START_TEST(msvcp120)
 {
     if(!init()) return;
@@ -3350,6 +3374,8 @@ START_TEST(msvcp120)
 
     test_vbtable_size_exports();
 
+    test_data_exports();
+
     free_expect_struct();
     TlsFree(expect_idx);
     FreeLibrary(msvcp);
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index 4d91e8c6a17..0de36db8b36 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1114,7 +1114,7 @@
 @ stub -arch=win64 ?_Assign at _Concurrent_queue_iterator_base_v4@details at Concurrency@@IEAAXAEBV123@@Z
 @ stub ?_Atexit@@YAXP6AXXZ at Z
 @ extern ?_BADOFF at std@@3_JB msvcp120.?_BADOFF at std@@3_JB
-# extern ?_Byte_reverse_table at details@Concurrency@@3QBEB
+@ extern ?_Byte_reverse_table at details@Concurrency@@3QBEB msvcp120.?_Byte_reverse_table at details@Concurrency@@3QBEB
 @ cdecl -arch=arm ?_C_str@?$_Yarn at D@std@@QBAPBDXZ(ptr) msvcp120.?_C_str@?$_Yarn at D@std@@QBAPBDXZ
 @ thiscall -arch=i386 ?_C_str@?$_Yarn at D@std@@QBEPBDXZ(ptr) msvcp120.?_C_str@?$_Yarn at D@std@@QBEPBDXZ
 @ cdecl -arch=win64 ?_C_str@?$_Yarn at D@std@@QEBAPEBDXZ(ptr) msvcp120.?_C_str@?$_Yarn at D@std@@QEBAPEBDXZ
-- 
2.34.1




More information about the wine-devel mailing list