Commit 70ac10af authored by YongHao Hu's avatar YongHao Hu Committed by Alexandre Julliard

msvcp110: Add tr2_sys__Equivalent_wchar implementation and test.

parent 589a54bb
...@@ -1198,8 +1198,8 @@ ...@@ -1198,8 +1198,8 @@
@ cdecl -arch=win64 ?_Empty@?$_Yarn@_W@std@@QEBA_NXZ(ptr) _Yarn_wchar__Empty @ cdecl -arch=win64 ?_Empty@?$_Yarn@_W@std@@QEBA_NXZ(ptr) _Yarn_wchar__Empty
@ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Equivalent @ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Equivalent
@ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Equivalent @ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Equivalent
@ stub -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPB_W0@Z @ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPB_W0@Z(wstr wstr) tr2_sys__Equivalent_wchar
@ stub -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z @ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z(wstr wstr) tr2_sys__Equivalent_wchar
@ cdecl -arch=win32 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) num_put_char__Ffmt @ cdecl -arch=win32 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) num_put_char__Ffmt
@ cdecl -arch=win64 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) num_put_char__Ffmt @ cdecl -arch=win64 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) num_put_char__Ffmt
@ cdecl -arch=win32 ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) num_put_wchar__Ffmt @ cdecl -arch=win32 ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) num_put_wchar__Ffmt
......
...@@ -1163,8 +1163,8 @@ ...@@ -1163,8 +1163,8 @@
@ cdecl -arch=win64 ?_Empty@?$_Yarn@_W@std@@QEBA_NXZ(ptr) _Yarn_wchar__Empty @ cdecl -arch=win64 ?_Empty@?$_Yarn@_W@std@@QEBA_NXZ(ptr) _Yarn_wchar__Empty
@ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Equivalent @ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Equivalent
@ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Equivalent @ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Equivalent
@ stub -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPB_W0@Z @ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPB_W0@Z(wstr wstr) tr2_sys__Equivalent_wchar
@ stub -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z @ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z(wstr wstr) tr2_sys__Equivalent_wchar
@ cdecl -arch=win32 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) num_put_char__Ffmt @ cdecl -arch=win32 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) num_put_char__Ffmt
@ cdecl -arch=win64 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) num_put_char__Ffmt @ cdecl -arch=win64 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) num_put_char__Ffmt
@ cdecl -arch=win32 ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) num_put_wchar__Ffmt @ cdecl -arch=win32 ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) num_put_wchar__Ffmt
......
...@@ -75,6 +75,7 @@ static void (CDECL *p__Do_call)(void *this); ...@@ -75,6 +75,7 @@ static void (CDECL *p__Do_call)(void *this);
static ULONGLONG(__cdecl *p_tr2_sys__File_size)(char const*); static ULONGLONG(__cdecl *p_tr2_sys__File_size)(char const*);
static ULONGLONG(__cdecl *p_tr2_sys__File_size_wchar)(WCHAR const*); static ULONGLONG(__cdecl *p_tr2_sys__File_size_wchar)(WCHAR const*);
static int (__cdecl *p_tr2_sys__Equivalent)(char const*, char const*); static int (__cdecl *p_tr2_sys__Equivalent)(char const*, char const*);
static int (__cdecl *p_tr2_sys__Equivalent_wchar)(WCHAR const*, WCHAR const*);
static char* (__cdecl *p_tr2_sys__Current_get)(char *); static char* (__cdecl *p_tr2_sys__Current_get)(char *);
static MSVCP_bool (__cdecl *p_tr2_sys__Current_set)(char const*); static MSVCP_bool (__cdecl *p_tr2_sys__Current_set)(char const*);
static int (__cdecl *p_tr2_sys__Make_dir)(char const*); static int (__cdecl *p_tr2_sys__Make_dir)(char const*);
...@@ -118,6 +119,8 @@ static BOOL init(void) ...@@ -118,6 +119,8 @@ static BOOL init(void)
"?_File_size@sys@tr2@std@@YA_KPEB_W@Z"); "?_File_size@sys@tr2@std@@YA_KPEB_W@Z");
SET(p_tr2_sys__Equivalent, SET(p_tr2_sys__Equivalent,
"?_Equivalent@sys@tr2@std@@YAHPEBD0@Z"); "?_Equivalent@sys@tr2@std@@YAHPEBD0@Z");
SET(p_tr2_sys__Equivalent_wchar,
"?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z");
SET(p_tr2_sys__Current_get, SET(p_tr2_sys__Current_get,
"?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z"); "?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z");
SET(p_tr2_sys__Current_set, SET(p_tr2_sys__Current_set,
...@@ -143,6 +146,8 @@ static BOOL init(void) ...@@ -143,6 +146,8 @@ static BOOL init(void)
"?_File_size@sys@tr2@std@@YA_KPB_W@Z"); "?_File_size@sys@tr2@std@@YA_KPB_W@Z");
SET(p_tr2_sys__Equivalent, SET(p_tr2_sys__Equivalent,
"?_Equivalent@sys@tr2@std@@YAHPBD0@Z"); "?_Equivalent@sys@tr2@std@@YAHPBD0@Z");
SET(p_tr2_sys__Equivalent_wchar,
"?_Equivalent@sys@tr2@std@@YAHPB_W0@Z");
SET(p_tr2_sys__Current_get, SET(p_tr2_sys__Current_get,
"?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z"); "?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z");
SET(p_tr2_sys__Current_set, SET(p_tr2_sys__Current_set,
...@@ -415,6 +420,8 @@ static void test_tr2_sys__Equivalent(void) ...@@ -415,6 +420,8 @@ static void test_tr2_sys__Equivalent(void)
int val, i; int val, i;
HANDLE file; HANDLE file;
char temp_path[MAX_PATH], current_path[MAX_PATH]; char temp_path[MAX_PATH], current_path[MAX_PATH];
WCHAR testW[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','1',0};
WCHAR testW2[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','2',0};
struct { struct {
char const *path1; char const *path1;
char const *path2; char const *path2;
...@@ -456,9 +463,14 @@ static void test_tr2_sys__Equivalent(void) ...@@ -456,9 +463,14 @@ static void test_tr2_sys__Equivalent(void)
ok(errno == 0xdeadbeef, "errno = %d\n", errno); ok(errno == 0xdeadbeef, "errno = %d\n", errno);
} }
ok(DeleteFileA("tr2_test_dir/f1"), "Expected tr2_test_dir/f1 to exist\n"); val = p_tr2_sys__Equivalent_wchar(testW, testW);
ok(DeleteFileA("tr2_test_dir/f2"), "Expected tr2_test_dir/f2 to exist\n"); ok(val == 1, "tr2_sys__Equivalent(): expect: 1, got %d\n", val);
ok(RemoveDirectoryA("tr2_test_dir"), "Expected tr2_test_dir to exist\n"); val = p_tr2_sys__Equivalent_wchar(testW, testW2);
ok(val == 0, "tr2_sys__Equivalent(): expect: 0, got %d\n", val);
ok(DeleteFileA("tr2_test_dir/f1"), "expect tr2_test_dir/f1 to exist\n");
ok(DeleteFileA("tr2_test_dir/f2"), "expect tr2_test_dir/f2 to exist\n");
ok(p_tr2_sys__Remove_dir("tr2_test_dir"), "expect tr2_test_dir to exist\n");
ok(SetCurrentDirectoryA(current_path), "SetCurrentDirectoryA failed\n"); ok(SetCurrentDirectoryA(current_path), "SetCurrentDirectoryA failed\n");
} }
......
...@@ -1163,8 +1163,8 @@ ...@@ -1163,8 +1163,8 @@
@ cdecl -arch=win64 ?_Empty@?$_Yarn@_W@std@@QEBA_NXZ(ptr) msvcp120.?_Empty@?$_Yarn@_W@std@@QEBA_NXZ @ cdecl -arch=win64 ?_Empty@?$_Yarn@_W@std@@QEBA_NXZ(ptr) msvcp120.?_Empty@?$_Yarn@_W@std@@QEBA_NXZ
@ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPBD0@Z(str str) msvcp120.?_Equivalent@sys@tr2@std@@YAHPBD0@Z @ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPBD0@Z(str str) msvcp120.?_Equivalent@sys@tr2@std@@YAHPBD0@Z
@ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEBD0@Z(str str) msvcp120.?_Equivalent@sys@tr2@std@@YAHPEBD0@Z @ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEBD0@Z(str str) msvcp120.?_Equivalent@sys@tr2@std@@YAHPEBD0@Z
@ stub -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPB_W0@Z @ cdecl -arch=win32 ?_Equivalent@sys@tr2@std@@YAHPB_W0@Z(wstr wstr) msvcp120.?_Equivalent@sys@tr2@std@@YAHPB_W0@Z
@ stub -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z @ cdecl -arch=win64 ?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z(wstr wstr) msvcp120.?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z
@ cdecl -arch=win32 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) msvcp120.?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z @ cdecl -arch=win32 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) msvcp120.?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z
@ cdecl -arch=win64 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) msvcp120.?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z @ cdecl -arch=win64 ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) msvcp120.?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z
@ cdecl -arch=win32 ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) msvcp120.?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z @ cdecl -arch=win32 ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z(ptr ptr long long) msvcp120.?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z
......
...@@ -14754,6 +14754,42 @@ ULONGLONG __cdecl tr2_sys__File_size_wchar(WCHAR const* path) ...@@ -14754,6 +14754,42 @@ ULONGLONG __cdecl tr2_sys__File_size_wchar(WCHAR const* path)
return ((ULONGLONG)(fad.nFileSizeHigh) << 32) + fad.nFileSizeLow; return ((ULONGLONG)(fad.nFileSizeHigh) << 32) + fad.nFileSizeLow;
} }
/* ?_Equivalent@sys@tr2@std@@YAHPB_W0@Z */
/* ?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z */
int __cdecl tr2_sys__Equivalent_wchar(WCHAR const* path1, WCHAR const* path2)
{
HANDLE h1, h2;
int ret;
BY_HANDLE_FILE_INFORMATION info1, info2;
TRACE("(%s %s)\n", debugstr_w(path1), debugstr_w(path2));
h1 = CreateFileW(path1, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, 0);
h2 = CreateFileW(path2, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, 0);
if(h1 == INVALID_HANDLE_VALUE) {
if(h2 == INVALID_HANDLE_VALUE) {
return -1;
}else {
CloseHandle(h2);
return 0;
}
}else if(h2 == INVALID_HANDLE_VALUE) {
CloseHandle(h1);
return 0;
}
ret = GetFileInformationByHandle(h1, &info1) && GetFileInformationByHandle(h2, &info2);
CloseHandle(h1);
CloseHandle(h2);
if(!ret)
return -1;
return (info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber
&& info1.nFileIndexHigh == info2.nFileIndexHigh
&& info1.nFileIndexLow == info2.nFileIndexLow
);
}
/* ??1_Winit@std@@QAE@XZ */ /* ??1_Winit@std@@QAE@XZ */
/* ??1_Winit@std@@QAE@XZ */ /* ??1_Winit@std@@QAE@XZ */
DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4) DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment