YongHao Hu : msvcp110: Add tr2_sys__File_size_wchar implementation and test.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 17 09:01:13 CDT 2015
Module: wine
Branch: master
Commit: 589a54bb8488b80f517168503d3c5d0ecd033445
URL: http://source.winehq.org/git/wine.git/?a=commit;h=589a54bb8488b80f517168503d3c5d0ecd033445
Author: YongHao Hu <christopherwuy at gmail.com>
Date: Mon Aug 10 14:37:25 2015 +0800
msvcp110: Add tr2_sys__File_size_wchar implementation and test.
---
dlls/msvcp110/msvcp110.spec | 4 ++--
dlls/msvcp120/msvcp120.spec | 4 ++--
dlls/msvcp120/tests/msvcp120.c | 14 +++++++++++---
dlls/msvcp120_app/msvcp120_app.spec | 4 ++--
dlls/msvcp90/ios.c | 17 ++++++++++++++++-
5 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index c5d438a..858af32 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1208,8 +1208,8 @@
@ cdecl -arch=win64 ?_Ffmt@?$num_put at _WV?$ostreambuf_iterator at _WU?$char_traits at _W@std@@@std@@@std@@AEBAPEADPEADDH at Z(ptr ptr long long) num_put_wchar__Ffmt
@ cdecl -ret64 -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPBD at Z(str) tr2_sys__File_size
@ cdecl -ret64 -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEBD at Z(str) tr2_sys__File_size
-@ stub -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPB_W at Z
-@ stub -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEB_W at Z
+@ cdecl -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPB_W at Z(wstr) tr2_sys__File_size_wchar
+@ cdecl -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEB_W at Z(wstr) tr2_sys__File_size_wchar
@ cdecl -arch=arm ?_Findarr at ios_base@std@@AAAAAU_Iosarray at 12@H at Z(ptr long) ios_base_Findarr
@ thiscall -arch=i386 ?_Findarr at ios_base@std@@AAEAAU_Iosarray at 12@H at Z(ptr long) ios_base_Findarr
@ cdecl -arch=win64 ?_Findarr at ios_base@std@@AEAAAEAU_Iosarray at 12@H at Z(ptr long) ios_base_Findarr
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index e9a7217..430690c 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1173,8 +1173,8 @@
@ cdecl -arch=win64 ?_Ffmt@?$num_put at _WV?$ostreambuf_iterator at _WU?$char_traits at _W@std@@@std@@@std@@AEBAPEADPEADDH at Z(ptr ptr long long) num_put_wchar__Ffmt
@ cdecl -ret64 -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPBD at Z(str) tr2_sys__File_size
@ cdecl -ret64 -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEBD at Z(str) tr2_sys__File_size
-@ stub -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPB_W at Z
-@ stub -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEB_W at Z
+@ cdecl -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPB_W at Z(wstr) tr2_sys__File_size_wchar
+@ cdecl -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEB_W at Z(wstr) tr2_sys__File_size_wchar
@ cdecl -arch=arm ?_Findarr at ios_base@std@@AAAAAU_Iosarray at 12@H at Z(ptr long) ios_base_Findarr
@ thiscall -arch=i386 ?_Findarr at ios_base@std@@AAEAAU_Iosarray at 12@H at Z(ptr long) ios_base_Findarr
@ cdecl -arch=win64 ?_Findarr at ios_base@std@@AEAAAEAU_Iosarray at 12@H at Z(ptr long) ios_base_Findarr
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 1a53bee..f2fdd92 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -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 at sys@tr2 at std@@YA_KPEBD at Z");
+ SET(p_tr2_sys__File_size_wchar,
+ "?_File_size at sys@tr2 at std@@YA_KPEB_W at Z");
SET(p_tr2_sys__Equivalent,
"?_Equivalent at sys@tr2 at std@@YAHPEBD0 at Z");
SET(p_tr2_sys__Current_get,
@@ -136,6 +139,8 @@ static BOOL init(void)
} else {
SET(p_tr2_sys__File_size,
"?_File_size at sys@tr2 at std@@YA_KPBD at Z");
+ SET(p_tr2_sys__File_size_wchar,
+ "?_File_size at sys@tr2 at std@@YA_KPB_W at Z");
SET(p_tr2_sys__Equivalent,
"?_Equivalent at sys@tr2 at std@@YAHPBD0 at 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)
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index 53dd548..04585c1 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1173,8 +1173,8 @@
@ cdecl -arch=win64 ?_Ffmt@?$num_put at _WV?$ostreambuf_iterator at _WU?$char_traits at _W@std@@@std@@@std@@AEBAPEADPEADDH at Z(ptr ptr long long) msvcp120.?_Ffmt@?$num_put at _WV?$ostreambuf_iterator at _WU?$char_traits at _W@std@@@std@@@std@@AEBAPEADPEADDH at Z
@ cdecl -ret64 -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPBD at Z(str) msvcp120.?_File_size at sys@tr2 at std@@YA_KPBD at Z
@ cdecl -ret64 -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEBD at Z(str) msvcp120.?_File_size at sys@tr2 at std@@YA_KPEBD at Z
-@ stub -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPB_W at Z
-@ stub -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEB_W at Z
+@ cdecl -arch=win32 ?_File_size at sys@tr2 at std@@YA_KPB_W at Z(wstr) msvcp120.?_File_size at sys@tr2 at std@@YA_KPB_W at Z
+@ cdecl -arch=win64 ?_File_size at sys@tr2 at std@@YA_KPEB_W at Z(wstr) msvcp120.?_File_size at sys@tr2 at std@@YA_KPEB_W at Z
@ cdecl -arch=arm ?_Findarr at ios_base@std@@AAAAAU_Iosarray at 12@H at Z(ptr long) msvcp120.?_Findarr at ios_base@std@@AAAAAU_Iosarray at 12@H at Z
@ thiscall -arch=i386 ?_Findarr at ios_base@std@@AAEAAU_Iosarray at 12@H at Z(ptr long) msvcp120.?_Findarr at ios_base@std@@AAEAAU_Iosarray at 12@H at Z
@ cdecl -arch=win64 ?_Findarr at ios_base@std@@AEAAAEAU_Iosarray at 12@H at Z(ptr long) msvcp120.?_Findarr at ios_base@std@@AEAAAEAU_Iosarray at 12@H at Z
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 006b787..49a3e4b 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -14204,7 +14204,7 @@ basic_ostream_char* __cdecl basic_ostream_char_print_complex_ldouble(basic_ostre
/* ?_File_size at sys@tr2 at std@@YA_KPBD at Z */
/* ?_File_size at sys@tr2 at std@@YA_KPEBD at 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 at sys@tr2 at std@@YA_KPB_W at Z */
+/* ?_File_size at sys@tr2 at std@@YA_KPEB_W at 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 at std@@QAE at XZ */
/* ??1_Winit at std@@QAE at XZ */
DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)
More information about the wine-cvs
mailing list