Commit 589a54bb authored by YongHao Hu's avatar YongHao Hu Committed by Alexandre Julliard

msvcp110: Add tr2_sys__File_size_wchar implementation and test.

parent 5520ce55
......@@ -1208,8 +1208,8 @@
@ cdecl -arch=win64 ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) num_put_wchar__Ffmt
@ cdecl -ret64 -arch=win32 ?_File_size@sys@tr2@std@@YA_KPBD@Z(str) tr2_sys__File_size
@ cdecl -ret64 -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEBD@Z(str) tr2_sys__File_size
@ stub -arch=win32 ?_File_size@sys@tr2@std@@YA_KPB_W@Z
@ stub -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEB_W@Z
@ cdecl -arch=win32 ?_File_size@sys@tr2@std@@YA_KPB_W@Z(wstr) tr2_sys__File_size_wchar
@ cdecl -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEB_W@Z(wstr) tr2_sys__File_size_wchar
@ cdecl -arch=arm ?_Findarr@ios_base@std@@AAAAAU_Iosarray@12@H@Z(ptr long) ios_base_Findarr
@ thiscall -arch=i386 ?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z(ptr long) ios_base_Findarr
@ cdecl -arch=win64 ?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z(ptr long) ios_base_Findarr
......
......@@ -1173,8 +1173,8 @@
@ cdecl -arch=win64 ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) num_put_wchar__Ffmt
@ cdecl -ret64 -arch=win32 ?_File_size@sys@tr2@std@@YA_KPBD@Z(str) tr2_sys__File_size
@ cdecl -ret64 -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEBD@Z(str) tr2_sys__File_size
@ stub -arch=win32 ?_File_size@sys@tr2@std@@YA_KPB_W@Z
@ stub -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEB_W@Z
@ cdecl -arch=win32 ?_File_size@sys@tr2@std@@YA_KPB_W@Z(wstr) tr2_sys__File_size_wchar
@ cdecl -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEB_W@Z(wstr) tr2_sys__File_size_wchar
@ cdecl -arch=arm ?_Findarr@ios_base@std@@AAAAAU_Iosarray@12@H@Z(ptr long) ios_base_Findarr
@ thiscall -arch=i386 ?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z(ptr long) ios_base_Findarr
@ cdecl -arch=win64 ?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z(ptr long) ios_base_Findarr
......
......@@ -73,6 +73,7 @@ static void (CDECL *p__Do_call)(void *this);
/* filesystem */
static ULONGLONG(__cdecl *p_tr2_sys__File_size)(char const*);
static ULONGLONG(__cdecl *p_tr2_sys__File_size_wchar)(WCHAR const*);
static int (__cdecl *p_tr2_sys__Equivalent)(char const*, char const*);
static char* (__cdecl *p_tr2_sys__Current_get)(char *);
static MSVCP_bool (__cdecl *p_tr2_sys__Current_set)(char const*);
......@@ -113,6 +114,8 @@ static BOOL init(void)
if(sizeof(void*) == 8) { /* 64-bit initialization */
SET(p_tr2_sys__File_size,
"?_File_size@sys@tr2@std@@YA_KPEBD@Z");
SET(p_tr2_sys__File_size_wchar,
"?_File_size@sys@tr2@std@@YA_KPEB_W@Z");
SET(p_tr2_sys__Equivalent,
"?_Equivalent@sys@tr2@std@@YAHPEBD0@Z");
SET(p_tr2_sys__Current_get,
......@@ -136,6 +139,8 @@ static BOOL init(void)
} else {
SET(p_tr2_sys__File_size,
"?_File_size@sys@tr2@std@@YA_KPBD@Z");
SET(p_tr2_sys__File_size_wchar,
"?_File_size@sys@tr2@std@@YA_KPB_W@Z");
SET(p_tr2_sys__Equivalent,
"?_Equivalent@sys@tr2@std@@YAHPBD0@Z");
SET(p_tr2_sys__Current_get,
......@@ -367,6 +372,7 @@ static void test_tr2_sys__File_size(void)
ULONGLONG val;
HANDLE file;
LARGE_INTEGER file_size;
WCHAR testW[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','1',0};
CreateDirectoryA("tr2_test_dir", NULL);
file = CreateFileA("tr2_test_dir/f1", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
......@@ -377,6 +383,8 @@ static void test_tr2_sys__File_size(void)
CloseHandle(file);
val = p_tr2_sys__File_size("tr2_test_dir/f1");
ok(val == 7, "file_size is %s\n", debugstr_longlong(val));
val = p_tr2_sys__File_size_wchar(testW);
ok(val == 7, "file_size is %s\n", debugstr_longlong(val));
file = CreateFileA("tr2_test_dir/f2", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "create file failed: INVALID_HANDLE_VALUE\n");
......@@ -397,9 +405,9 @@ static void test_tr2_sys__File_size(void)
ok(val == 0, "file_size is %s\n", debugstr_longlong(val));
ok(errno == 0xdeadbeef, "errno = %d\n", errno);
ok(DeleteFileA("tr2_test_dir/f1"), "Expected tr2_test_dir/f1 to exist\n");
ok(DeleteFileA("tr2_test_dir/f2"), "Expected tr2_test_dir/f2 to exist\n");
ok(RemoveDirectoryA("tr2_test_dir"), "Expected tr2_test_dir to exist\n");
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(RemoveDirectoryA("tr2_test_dir"), "expect tr2_test_dir to exist\n");
}
static void test_tr2_sys__Equivalent(void)
......
......@@ -1173,8 +1173,8 @@
@ cdecl -arch=win64 ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z(ptr ptr long long) msvcp120.?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z
@ cdecl -ret64 -arch=win32 ?_File_size@sys@tr2@std@@YA_KPBD@Z(str) msvcp120.?_File_size@sys@tr2@std@@YA_KPBD@Z
@ cdecl -ret64 -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEBD@Z(str) msvcp120.?_File_size@sys@tr2@std@@YA_KPEBD@Z
@ stub -arch=win32 ?_File_size@sys@tr2@std@@YA_KPB_W@Z
@ stub -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEB_W@Z
@ cdecl -arch=win32 ?_File_size@sys@tr2@std@@YA_KPB_W@Z(wstr) msvcp120.?_File_size@sys@tr2@std@@YA_KPB_W@Z
@ cdecl -arch=win64 ?_File_size@sys@tr2@std@@YA_KPEB_W@Z(wstr) msvcp120.?_File_size@sys@tr2@std@@YA_KPEB_W@Z
@ cdecl -arch=arm ?_Findarr@ios_base@std@@AAAAAU_Iosarray@12@H@Z(ptr long) msvcp120.?_Findarr@ios_base@std@@AAAAAU_Iosarray@12@H@Z
@ thiscall -arch=i386 ?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z(ptr long) msvcp120.?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z
@ cdecl -arch=win64 ?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z(ptr long) msvcp120.?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z
......
......@@ -14204,7 +14204,7 @@ basic_ostream_char* __cdecl basic_ostream_char_print_complex_ldouble(basic_ostre
/* ?_File_size@sys@tr2@std@@YA_KPBD@Z */
/* ?_File_size@sys@tr2@std@@YA_KPEBD@Z */
ULONGLONG __cdecl tr2_sys__File_size(const char* path)
ULONGLONG __cdecl tr2_sys__File_size(char const* path)
{
WIN32_FILE_ATTRIBUTE_DATA fad;
......@@ -14739,6 +14739,21 @@ void* __thiscall _Winit_ctor(void *this)
return this;
}
/* ?_File_size@sys@tr2@std@@YA_KPB_W@Z */
/* ?_File_size@sys@tr2@std@@YA_KPEB_W@Z */
ULONGLONG __cdecl tr2_sys__File_size_wchar(WCHAR const* path)
{
WIN32_FILE_ATTRIBUTE_DATA fad;
TRACE("(%s)\n", debugstr_w(path));
if(!GetFileAttributesExW(path, GetFileExInfoStandard, &fad))
return 0;
if(fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
return 0;
return ((ULONGLONG)(fad.nFileSizeHigh) << 32) + fad.nFileSizeLow;
}
/* ??1_Winit@std@@QAE@XZ */
/* ??1_Winit@std@@QAE@XZ */
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