Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/msvcp120/msvcp120.spec | 2 +- dlls/msvcp120/tests/msvcp120.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-)
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@_Concurrent_queue_iterator_base_v4@details@Concurrency@@IEAAXAEBV123@@Z @ stub ?_Atexit@@YAXP6AXXZ@Z @ extern ?_BADOFF@std@@3_JB std_BADOFF -# extern ?_Byte_reverse_table@details@Concurrency@@3QBEB +@ extern ?_Byte_reverse_table@details@Concurrency@@3QBEB byte_reverse_table @ cdecl -arch=arm ?_C_str@?$_Yarn@D@std@@QBAPBDXZ(ptr) _Yarn_char_c_str @ thiscall -arch=i386 ?_C_str@?$_Yarn@D@std@@QBEPBDXZ(ptr) _Yarn_char_c_str @ cdecl -arch=win64 ?_C_str@?$_Yarn@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@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);