msvcp110: Add tr2_sys__Stat_wchar and tr2_sys__Lstat_wchar implementation and test.

Signed-off-by: YongHao Hu <christopherwuy@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
YongHao Hu 2016-02-20 00:41:43 +08:00 committed by Alexandre Julliard
parent dabadc8eaf
commit 613b2454e5
5 changed files with 74 additions and 12 deletions

View File

@ -1607,8 +1607,8 @@
@ cdecl ?_Lockit_dtor@_Lockit@std@@SAXH@Z(long) _Lockit_free
@ cdecl -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z(str ptr) tr2_sys__Lstat
@ cdecl -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z(str ptr) tr2_sys__Lstat
@ stub -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z
@ stub -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z(wstr ptr) tr2_sys__Lstat_wchar
@ cdecl -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z(wstr ptr) tr2_sys__Lstat_wchar
@ stub -arch=win32 ?_MP_Add@std@@YAXQA_K_K@Z
@ stub -arch=win64 ?_MP_Add@std@@YAXQEA_K_K@Z
@ stub -arch=win32 ?_MP_Get@std@@YA_KQA_K@Z
@ -1759,8 +1759,8 @@
@ stub -arch=win64 ?_Src@?3??_Getffld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@3@1AEAVios_base@3@PEAH@Z@4QBDB
@ cdecl -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z(str ptr) tr2_sys__Stat
@ cdecl -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z(str ptr) tr2_sys__Stat
@ stub -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z
@ stub -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z(wstr ptr) tr2_sys__Stat_wchar
@ cdecl -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z(wstr ptr) tr2_sys__Stat_wchar
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z(ptr str) tr2_sys__Statvfs
@ cdecl -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z(ptr str) tr2_sys__Statvfs
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z(ptr wstr) tr2_sys__Statvfs_wchar

View File

@ -1568,8 +1568,8 @@
@ cdecl ?_Lockit_dtor@_Lockit@std@@SAXH@Z(long) _Lockit_free
@ cdecl -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z(str ptr) tr2_sys__Lstat
@ cdecl -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z(str ptr) tr2_sys__Lstat
@ stub -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z
@ stub -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z(wstr ptr) tr2_sys__Lstat_wchar
@ cdecl -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z(wstr ptr) tr2_sys__Lstat_wchar
@ stub -arch=win32 ?_MP_Add@std@@YAXQA_K_K@Z
@ stub -arch=win64 ?_MP_Add@std@@YAXQEA_K_K@Z
@ stub -arch=win32 ?_MP_Get@std@@YA_KQA_K@Z
@ -1720,8 +1720,8 @@
@ stub -arch=win64 ?_Src@?3??_Getffld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@3@1AEAVios_base@3@PEAH@Z@4QBDB
@ cdecl -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z(str ptr) tr2_sys__Stat
@ cdecl -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z(str ptr) tr2_sys__Stat
@ stub -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z
@ stub -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z(wstr ptr) tr2_sys__Stat_wchar
@ cdecl -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z(wstr ptr) tr2_sys__Stat_wchar
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z(ptr str) tr2_sys__Statvfs
@ cdecl -arch=win64 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z(ptr str) tr2_sys__Statvfs
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z(ptr wstr) tr2_sys__Statvfs_wchar

View File

@ -126,7 +126,9 @@ static int (__cdecl *p_tr2_sys__Rename_wchar)(WCHAR const*, WCHAR const*);
static struct space_info* (__cdecl *p_tr2_sys__Statvfs)(struct space_info*, char const*);
static struct space_info* (__cdecl *p_tr2_sys__Statvfs_wchar)(struct space_info*, WCHAR const*);
static enum file_type (__cdecl *p_tr2_sys__Stat)(char const*, int *);
static enum file_type (__cdecl *p_tr2_sys__Stat_wchar)(WCHAR const*, int *);
static enum file_type (__cdecl *p_tr2_sys__Lstat)(char const*, int *);
static enum file_type (__cdecl *p_tr2_sys__Lstat_wchar)(WCHAR const*, int *);
static __int64 (__cdecl *p_tr2_sys__Last_write_time)(char const*);
static void (__cdecl *p_tr2_sys__Last_write_time_set)(char const*, __int64);
static void* (__cdecl *p_tr2_sys__Open_dir)(char*, char const*, int *, enum file_type*);
@ -256,8 +258,12 @@ static BOOL init(void)
"?_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__Stat_wchar,
"?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z");
SET(p_tr2_sys__Lstat,
"?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z");
SET(p_tr2_sys__Lstat_wchar,
"?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z");
SET(p_tr2_sys__Last_write_time,
"?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z");
SET(p_tr2_sys__Last_write_time_set,
@ -315,8 +321,12 @@ static BOOL init(void)
"?_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__Stat_wchar,
"?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z");
SET(p_tr2_sys__Lstat,
"?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z");
SET(p_tr2_sys__Lstat_wchar,
"?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z");
SET(p_tr2_sys__Last_write_time,
"?_Last_write_time@sys@tr2@std@@YA_JPBD@Z");
SET(p_tr2_sys__Last_write_time_set,
@ -1130,6 +1140,8 @@ static void test_tr2_sys__Stat(void)
{ "tr2_test_dir\\f1_link" , regular_file, ERROR_SUCCESS, TRUE },
{ "tr2_test_dir\\dir_link", directory_file, ERROR_SUCCESS, TRUE },
};
WCHAR testW[] = {'t','r','2','_','t','e','s','t','_','d','i','r',0};
WCHAR testW2[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','1',0};
CreateDirectoryA("tr2_test_dir", NULL);
file = CreateFileA("tr2_test_dir/f1", 0, 0, NULL, CREATE_ALWAYS, 0, NULL);
@ -1185,6 +1197,15 @@ static void test_tr2_sys__Stat(void)
i+1, tests[i].err_code, err_code);
}
err_code = 0xdeadbeef;
val = p_tr2_sys__Stat_wchar(testW, &err_code);
ok(directory_file == val, "tr2_sys__Stat_wchar() expect directory_file, got %d\n", val);
ok(ERROR_SUCCESS == err_code, "tr2_sys__Stat_wchar(): err_code expect ERROR_SUCCESS, got %d\n", err_code);
err_code = 0xdeadbeef;
val = p_tr2_sys__Lstat_wchar(testW2, &err_code);
ok(regular_file == val, "tr2_sys__Lstat_wchar() expect regular_file, got %d\n", val);
ok(ERROR_SUCCESS == err_code, "tr2_sys__Lstat_wchar(): err_code expect ERROR_SUCCESS, got %d\n", err_code);
if(ret) {
todo_wine ok(DeleteFileA("tr2_test_dir/f1_link"), "expect tr2_test_dir/f1_link to exist\n");
todo_wine ok(RemoveDirectoryA("tr2_test_dir/dir_link"), "expect tr2_test_dir/dir_link to exist\n");

View File

@ -1568,8 +1568,8 @@
@ cdecl ?_Lockit_dtor@_Lockit@std@@SAXH@Z(long) msvcp120.?_Lockit_dtor@_Lockit@std@@SAXH@Z
@ cdecl -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z(str ptr) msvcp120.?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z
@ cdecl -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z(str ptr) msvcp120.?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z
@ stub -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z
@ stub -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z(wstr ptr) msvcp120.?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z
@ cdecl -arch=win64 ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z(wstr ptr) msvcp120.?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ stub -arch=win32 ?_MP_Add@std@@YAXQA_K_K@Z
@ stub -arch=win64 ?_MP_Add@std@@YAXQEA_K_K@Z
@ stub -arch=win32 ?_MP_Get@std@@YA_KQA_K@Z
@ -1720,8 +1720,8 @@
@ stub -arch=win64 ?_Src@?3??_Getffld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@3@1AEAVios_base@3@PEAH@Z@4QBDB
@ cdecl -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z(str ptr) msvcp120.?_Stat@sys@tr2@std@@YA?AW4file_type@123@PBDAAH@Z
@ cdecl -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z(str ptr) msvcp120.?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEBDAEAH@Z
@ stub -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z
@ stub -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z(wstr ptr) msvcp120.?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z
@ cdecl -arch=win64 ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z(wstr ptr) msvcp120.?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z(ptr 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(ptr str) msvcp120.?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z
@ cdecl -arch=win32 ?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z(ptr wstr) msvcp120.?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PB_W@Z

View File

@ -15290,6 +15290,47 @@ struct space_info* __cdecl tr2_sys__Statvfs_wchar(struct space_info *ret, const
return ret;
}
/* ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z */
/* ?_Stat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z */
enum file_type __cdecl tr2_sys__Stat_wchar(WCHAR const* path, int* err_code)
{
DWORD attr;
TRACE("(%s %p)\n", debugstr_w(path), err_code);
if(!path) {
*err_code = ERROR_INVALID_PARAMETER;
return status_unknown;
}
attr=GetFileAttributesW(path);
if(attr == INVALID_FILE_ATTRIBUTES) {
enum file_type ret;
switch(GetLastError()) {
case ERROR_FILE_NOT_FOUND:
case ERROR_BAD_NETPATH:
case ERROR_INVALID_NAME:
case ERROR_BAD_PATHNAME:
case ERROR_PATH_NOT_FOUND:
ret = file_not_found;
*err_code = ERROR_SUCCESS;
break;
default:
ret = status_unknown;
*err_code = GetLastError();
}
return ret;
}
*err_code = ERROR_SUCCESS;
return (attr & FILE_ATTRIBUTE_DIRECTORY)?directory_file:regular_file;
}
/* ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PB_WAAH@Z */
/* ?_Lstat@sys@tr2@std@@YA?AW4file_type@123@PEB_WAEAH@Z */
enum file_type __cdecl tr2_sys__Lstat_wchar(WCHAR const* path, int* err_code)
{
return tr2_sys__Stat_wchar(path, err_code);
}
/* ??1_Winit@std@@QAE@XZ */
/* ??1_Winit@std@@QAE@XZ */
DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)