msvcp110: Add tr2_sys__Statvfs_wchar implementation and test.

This commit is contained in:
YongHao Hu 2015-08-19 01:27:43 +08:00 committed by Alexandre Julliard
parent 64eb3813c4
commit a2245d51cf
5 changed files with 36 additions and 6 deletions

View file

@ -1763,8 +1763,8 @@
@ stub -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z(str) tr2_sys__Statvfs
@ cdecl -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z(str) tr2_sys__Statvfs
@ stub -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z
@ stub -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@Z
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z(wstr) tr2_sys__Statvfs_wchar
@ cdecl -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@Z(wstr) tr2_sys__Statvfs_wchar
@ cdecl -arch=arm ?_Swap_all@_Container_base0@std@@QAAXAAU12@@Z(ptr ptr) Container_base0_Swap_all
@ thiscall -arch=i386 ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z(ptr ptr) Container_base0_Swap_all
@ cdecl -arch=win64 ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) Container_base0_Swap_all

View file

@ -1724,8 +1724,8 @@
@ stub -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z(str) tr2_sys__Statvfs
@ cdecl -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z(str) tr2_sys__Statvfs
@ stub -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z
@ stub -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@Z
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z(wstr) tr2_sys__Statvfs_wchar
@ cdecl -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@Z(wstr) tr2_sys__Statvfs_wchar
@ cdecl -arch=arm ?_Swap_all@_Container_base0@std@@QAAXAAU12@@Z(ptr ptr) Container_base0_Swap_all
@ thiscall -arch=i386 ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z(ptr ptr) Container_base0_Swap_all
@ cdecl -arch=win64 ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) Container_base0_Swap_all

View file

@ -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@sys@tr2@std@@YAHPEB_W0@Z");
SET(p_tr2_sys__Statvfs,
"?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z");
SET(p_tr2_sys__Statvfs_wchar,
"?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@Z");
SET(p_tr2_sys__Stat,
"?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z");
SET(p_tr2_sys__Lstat,
@ -192,6 +195,8 @@ static BOOL init(void)
"?_Rename@sys@tr2@std@@YAHPB_W0@Z");
SET(p_tr2_sys__Statvfs,
"?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z");
SET(p_tr2_sys__Statvfs_wchar,
"?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z");
SET(p_tr2_sys__Stat,
"?_Stat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@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));

View file

@ -1724,8 +1724,8 @@
@ stub -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z(str) msvcp120.?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z
@ cdecl -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z(str) msvcp120.?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z
@ stub -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z
@ stub -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@Z
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z(wstr) msvcp120.?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z
@ cdecl -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@Z(wstr) msvcp120.?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@Z
@ cdecl -arch=arm ?_Swap_all@_Container_base0@std@@QAAXAAU12@@Z(ptr ptr) msvcp120.?_Swap_all@_Container_base0@std@@QAAXAAU12@@Z
@ thiscall -arch=i386 ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z(ptr ptr) msvcp120.?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z
@ cdecl -arch=win64 ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) msvcp120.?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z

View file

@ -14858,6 +14858,24 @@ int __cdecl tr2_sys__Rename_wchar(WCHAR const* old_path, WCHAR const* new_path)
return GetLastError();
}
/* ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z */
/* ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEB_W@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@std@@QAE@XZ */
/* ??1_Winit@std@@QAE@XZ */
DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)