From: YongHao Hu Subject: [PATCH 03/12] msvcp110: Add tr2_sys__Open_dir implementation.(resend) Message-Id: <55ED9D63.1080502@gmail.com> Date: Mon, 7 Sep 2015 22:21:23 +0800 --- dlls/msvcp110/msvcp110.spec | 4 ++-- dlls/msvcp120/msvcp120.spec | 4 ++-- dlls/msvcp120_app/msvcp120_app.spec | 4 ++-- dlls/msvcp90/ios.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 6f75f86..18c6001 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1641,8 +1641,8 @@ @ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z(ptr) locale__Locimp__New_Locimp @ cdecl -arch=win32 ?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z(long) locale__Locimp__New_Locimp_transparent @ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z(long) locale__Locimp__New_Locimp_transparent -@ stub -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXPADPBDAAHAAW4file_type@123@@Z -@ stub -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXPEADPEBDAEAHAEAW4file_type@123@@Z +@ cdecl -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXPADPBDAAHAAW4file_type@123@@Z(ptr str long long) tr2_sys__Open_dir +@ cdecl -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@DPEBDAEAHAEAW4file_type@123@@Z(ptr str long long) tr2_sys__Open_dir @ stub -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXPA_WPB_WAAHAAW4file_type@123@@Z @ stub -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXPEA_WPEB_WAEAHAEAW4file_type@123@@Z @ cdecl -arch=arm ?_Orphan_all@_Container_base0@std@@QAAXXZ(ptr) Container_base0_Orphan_all diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 00861a1..560346d 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1602,8 +1602,8 @@ @ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z(ptr) locale__Locimp__New_Locimp @ cdecl -arch=win32 ?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z(long) locale__Locimp__New_Locimp_transparent @ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z(long) locale__Locimp__New_Locimp_transparent -@ stub -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@DPBDAAHAAW4file_type@123@@Z -@ stub -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@DPEBDAEAHAEAW4file_type@123@@Z +@ cdecl -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@DPBDAAHAAW4file_type@123@@Z(ptr str long long) tr2_sys__Open_dir +@ cdecl -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@DPEBDAEAHAEAW4file_type@123@@Z(ptr str long long) tr2_sys__Open_dir @ stub -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@_WPB_WAAHAAW4file_type@123@@Z @ stub -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@_WPEB_WAEAHAEAW4file_type@123@@Z @ cdecl -arch=arm ?_Orphan_all@_Container_base0@std@@QAAXXZ(ptr) Container_base0_Orphan_all diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index af73a16..0cf7bca 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -1602,8 +1602,8 @@ @ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z(ptr) msvcp120.?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z @ cdecl -arch=win32 ?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z(long) msvcp120.?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z @ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z(long) msvcp120.?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z -@ stub -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@DPBDAAHAAW4file_type@123@@Z -@ stub -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@DPEBDAEAHAEAW4file_type@123@@Z +@ cdecl -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@DPBDAAHAAW4file_type@123@@Z(ptr str long long) msvcp120.?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@DPBDAAHAAW4file_type@123@@Z +@ cdecl -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@DPEBDAEAHAEAW4file_type@123@@Z(ptr str long long) msvcp120.?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@DPEBDAEAHAEAW4file_type@123@@Z @ stub -arch=win32 ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@_WPB_WAAHAAW4file_type@123@@Z @ stub -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@_WPEB_WAEAHAEAW4file_type@123@@Z @ cdecl -arch=arm ?_Orphan_all@_Container_base0@std@@QAAXXZ(ptr) msvcp120.?_Orphan_all@_Container_base0@std@@QAAXXZ diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index cabeaee..5fcc5bf 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -14439,6 +14439,42 @@ void __cdecl tr2_sys__Last_write_time_set(char const* path, __int64 newtime) CloseHandle(handle); } +/* ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@DPBDAAHAAW4file_type@123@@Z */ +/* ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@DPEBDAEAHAEAW4file_type@123@@Z */ +void* __cdecl tr2_sys__Open_dir(char* target, char const* dest, int* err_code, enum file_type* type) +{ + HANDLE handle; + WIN32_FIND_DATAA data; + char temppath[MAX_PATH]; + TRACE("(%s %s %p %p)\n", debugstr_a(target), debugstr_a(dest), err_code, type); + strcpy(temppath, dest); + strcat(temppath, "\\*.*"); + + handle = FindFirstFileA(temppath, &data); + if(handle == INVALID_HANDLE_VALUE) { + if(GetLastError() == ERROR_PATH_NOT_FOUND) + *err_code = ERROR_BAD_PATHNAME; + else + *err_code = GetLastError(); + return NULL; + } + while(!strcmp(data.cFileName, ".") || !strcmp(data.cFileName, "..")) { + if(!FindNextFileA(handle, &data)) { + *err_code = ERROR_SUCCESS; + *type = status_unknown; + return NULL; + } + } + + strcpy(target, data.cFileName); + *err_code = ERROR_SUCCESS; + if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + *type = directory_file; + else + *type = regular_file; + return handle; +} + /* ??0strstream@std@@QAE@PADHH@Z */ /* ??0strstream@std@@QEAA@PEAD_JH@Z */ #if STREAMSIZE_BITS == 64