YongHao Hu : msvcp110: Add tr2_sys__Statvfs_wchar implementation and test.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 21 09:07:19 CDT 2015


Module: wine
Branch: master
Commit: a2245d51cf9162e5161fa705404094d2f0341a28
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a2245d51cf9162e5161fa705404094d2f0341a28

Author: YongHao Hu <christopherwuy at gmail.com>
Date:   Wed Aug 19 01:27:43 2015 +0800

msvcp110: Add tr2_sys__Statvfs_wchar implementation and test.

---

 dlls/msvcp110/msvcp110.spec         |  4 ++--
 dlls/msvcp120/msvcp120.spec         |  4 ++--
 dlls/msvcp120/tests/msvcp120.c      | 12 ++++++++++++
 dlls/msvcp120_app/msvcp120_app.spec |  4 ++--
 dlls/msvcp90/ios.c                  | 18 ++++++++++++++++++
 5 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index 91e1503..ff4facb 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1763,8 +1763,8 @@
 @ stub -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEB_WAEAH at Z
 @ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(str) tr2_sys__Statvfs
 @ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(str) tr2_sys__Statvfs
-@ stub -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z
-@ stub -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(wstr) tr2_sys__Statvfs_wchar
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(wstr) tr2_sys__Statvfs_wchar
 @ cdecl -arch=arm ?_Swap_all at _Container_base0@std@@QAAXAAU12@@Z(ptr ptr) Container_base0_Swap_all
 @ thiscall -arch=i386 ?_Swap_all at _Container_base0@std@@QAEXAAU12@@Z(ptr ptr) Container_base0_Swap_all
 @ cdecl -arch=win64 ?_Swap_all at _Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) Container_base0_Swap_all
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index 745fecb..715703e 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1724,8 +1724,8 @@
 @ stub -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEB_WAEAH at Z
 @ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(str) tr2_sys__Statvfs
 @ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(str) tr2_sys__Statvfs
-@ stub -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z
-@ stub -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(wstr) tr2_sys__Statvfs_wchar
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(wstr) tr2_sys__Statvfs_wchar
 @ cdecl -arch=arm ?_Swap_all at _Container_base0@std@@QAAXAAU12@@Z(ptr ptr) Container_base0_Swap_all
 @ thiscall -arch=i386 ?_Swap_all at _Container_base0@std@@QAEXAAU12@@Z(ptr ptr) Container_base0_Swap_all
 @ cdecl -arch=win64 ?_Swap_all at _Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) Container_base0_Swap_all
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index dc833e9..10e0370 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -89,6 +89,7 @@ static int (__cdecl *p_tr2_sys__Copy_file_wchar)(WCHAR const*, WCHAR const*, MSV
 static int (__cdecl *p_tr2_sys__Rename)(char const*, char const*);
 static int (__cdecl *p_tr2_sys__Rename_wchar)(WCHAR const*, WCHAR const*);
 static struct space_info (__cdecl *p_tr2_sys__Statvfs)(char const*);
+static struct space_info (__cdecl *p_tr2_sys__Statvfs_wchar)(WCHAR const*);
 static enum file_type (__cdecl *p_tr2_sys__Stat)(char const*, int *);
 static enum file_type (__cdecl *p_tr2_sys__Lstat)(char const*, int *);
 
@@ -153,6 +154,8 @@ static BOOL init(void)
                 "?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z");
         SET(p_tr2_sys__Statvfs,
                 "?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z");
+        SET(p_tr2_sys__Statvfs_wchar,
+                "?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z");
         SET(p_tr2_sys__Stat,
                 "?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEBDAEAH at Z");
         SET(p_tr2_sys__Lstat,
@@ -192,6 +195,8 @@ static BOOL init(void)
                 "?_Rename at sys@tr2 at std@@YAHPB_W0 at Z");
         SET(p_tr2_sys__Statvfs,
                 "?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z");
+        SET(p_tr2_sys__Statvfs_wchar,
+                "?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z");
         SET(p_tr2_sys__Stat,
                 "?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PBDAAH at Z");
         SET(p_tr2_sys__Lstat,
@@ -777,13 +782,20 @@ static void test_tr2_sys__Statvfs(void)
 {
     struct space_info info;
     char current_path[MAX_PATH];
+    WCHAR current_path_wchar[MAX_PATH];
     memset(current_path, 0, MAX_PATH);
     p_tr2_sys__Current_get(current_path);
+    memset(current_path_wchar, 0, MAX_PATH);
+    p_tr2_sys__Current_get_wchar(current_path_wchar);
 
     info = p_tr2_sys__Statvfs(current_path);
     ok(info.capacity >= info.free, "test_tr2_sys__Statvfs(): info.capacity < info.free\n");
     ok(info.free >= info.available, "test_tr2_sys__Statvfs(): info.free < info.available\n");
 
+    info = p_tr2_sys__Statvfs_wchar(current_path_wchar);
+    ok(info.capacity >= info.free, "tr2_sys__Statvfs_wchar(): info.capacity < info.free\n");
+    ok(info.free >= info.available, "tr2_sys__Statvfs_wchar(): info.free < info.available\n");
+
     info = p_tr2_sys__Statvfs(NULL);
     ok(info.available == 0, "test_tr2_sys__Statvfs(): info.available expect: %d, got %s\n",
             0, debugstr_longlong(info.available));
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index c5e4da0..1e04e77 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1724,8 +1724,8 @@
 @ stub -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEB_WAEAH at Z
 @ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(str) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z
 @ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(str) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z
-@ stub -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z
-@ stub -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(wstr) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(wstr) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z
 @ cdecl -arch=arm ?_Swap_all at _Container_base0@std@@QAAXAAU12@@Z(ptr ptr) msvcp120.?_Swap_all at _Container_base0@std@@QAAXAAU12@@Z
 @ thiscall -arch=i386 ?_Swap_all at _Container_base0@std@@QAEXAAU12@@Z(ptr ptr) msvcp120.?_Swap_all at _Container_base0@std@@QAEXAAU12@@Z
 @ cdecl -arch=win64 ?_Swap_all at _Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) msvcp120.?_Swap_all at _Container_base0@std@@QEAAXAEAU12@@Z
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index c7a3be9..bae733b 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -14858,6 +14858,24 @@ int __cdecl tr2_sys__Rename_wchar(WCHAR const* old_path, WCHAR const* new_path)
     return GetLastError();
 }
 
+/* ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z */
+/* ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z */
+struct space_info __cdecl tr2_sys__Statvfs_wchar(const WCHAR* path)
+{
+    ULARGE_INTEGER available, total, free;
+    struct space_info info;
+    TRACE("(%s)\n", debugstr_w(path));
+
+    if(!path || !GetDiskFreeSpaceExW(path, &available, &total, &free)) {
+        info.capacity = info.free = info.available = 0;
+    }else {
+        info.capacity = total.QuadPart;
+        info.free = free.QuadPart;
+        info.available = available.QuadPart;
+    }
+    return info;
+}
+
 /* ??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