Commit 4193e717 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

msvcp: Implement the wchar version of _Open_dir.

parent 0657b1d1
......@@ -1643,8 +1643,8 @@
@ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z(long) locale__Locimp__New_Locimp_transparent
@ 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=win32 ?_Open_dir@sys@tr2@std@@YAPAXPA_WPB_WAAHAAW4file_type@123@@Z(ptr wstr long long) tr2_sys__Open_dir_wchar
@ cdecl -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXPEA_WPEB_WAEAHAEAW4file_type@123@@Z(ptr wstr long long) tr2_sys__Open_dir_wchar
@ cdecl -arch=arm ?_Orphan_all@_Container_base0@std@@QAAXXZ(ptr) Container_base0_Orphan_all
@ thiscall -arch=i386 ?_Orphan_all@_Container_base0@std@@QAEXXZ(ptr) Container_base0_Orphan_all
@ cdecl -arch=win64 ?_Orphan_all@_Container_base0@std@@QEAAXXZ(ptr) Container_base0_Orphan_all
......
......@@ -1604,8 +1604,8 @@
@ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z(long) locale__Locimp__New_Locimp_transparent
@ 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=win32 ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@_WPB_WAAHAAW4file_type@123@@Z(ptr wstr long long) tr2_sys__Open_dir_wchar
@ cdecl -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@_WPEB_WAEAHAEAW4file_type@123@@Z(ptr wstr long long) tr2_sys__Open_dir_wchar
@ cdecl -arch=arm ?_Orphan_all@_Container_base0@std@@QAAXXZ(ptr) Container_base0_Orphan_all
@ thiscall -arch=i386 ?_Orphan_all@_Container_base0@std@@QAEXXZ(ptr) Container_base0_Orphan_all
@ cdecl -arch=win64 ?_Orphan_all@_Container_base0@std@@QEAAXXZ(ptr) Container_base0_Orphan_all
......
......@@ -1604,8 +1604,8 @@
@ cdecl -arch=win64 ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z(long) msvcp120.?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@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=win32 ?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@_WPB_WAAHAAW4file_type@123@@Z(ptr wstr long long) msvcp120.?_Open_dir@sys@tr2@std@@YAPAXAAY0BAE@_WPB_WAAHAAW4file_type@123@@Z
@ cdecl -arch=win64 ?_Open_dir@sys@tr2@std@@YAPEAXAEAY0BAE@_WPEB_WAEAHAEAW4file_type@123@@Z(ptr wstr long long) msvcp120.?_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
@ thiscall -arch=i386 ?_Orphan_all@_Container_base0@std@@QAEXXZ(ptr) msvcp120.?_Orphan_all@_Container_base0@std@@QAEXXZ
@ cdecl -arch=win64 ?_Orphan_all@_Container_base0@std@@QEAAXXZ(ptr) msvcp120.?_Orphan_all@_Container_base0@std@@QEAAXXZ
......
......@@ -3689,7 +3689,7 @@
@ stub _Mtxlock
@ stub _Mtxunlock
@ extern _Nan _Nan
@ stub _Open_dir
@ cdecl _Open_dir(ptr wstr long long) tr2_sys__Open_dir_wchar
@ cdecl -ret64 _Query_perf_counter()
@ cdecl -ret64 _Query_perf_frequency()
@ stub _Read_dir
......
......@@ -26,7 +26,9 @@
#include "msvcp90.h"
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
#define SECSPERDAY 86400
......@@ -14893,29 +14895,32 @@ 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)
/* ??_Open_dir@sys@tr2@std@@YAPAXPA_WPB_WAAHAAW4file_type@123@@Z */
/* ??_Open_dir@sys@tr2@std@@YAPEAXPEA_WPEB_WAEAHAEAW4file_type@123@@Z */
void* __cdecl tr2_sys__Open_dir_wchar(wchar_t* target, wchar_t const* dest, int* err_code, enum file_type* type)
{
HANDLE handle;
WIN32_FIND_DATAA data;
char temppath[MAX_PATH];
TRACE("(%p %s %p %p)\n", target, debugstr_a(dest), err_code, type);
if(strlen(dest) > MAX_PATH - 3) {
WIN32_FIND_DATAW data;
wchar_t temppath[MAX_PATH];
static const wchar_t dot[] = {'.', 0};
static const wchar_t dotdot[] = {'.', '.', 0};
static const wchar_t asterisk[] = {'\\', '*', 0};
TRACE("(%p %s %p %p)\n", target, debugstr_w(dest), err_code, type);
if(wcslen(dest) > MAX_PATH - 3) {
*err_code = ERROR_BAD_PATHNAME;
return NULL;
}
strcpy(temppath, dest);
strcat(temppath, "\\*");
wcscpy(temppath, dest);
wcscat(temppath, asterisk);
handle = FindFirstFileA(temppath, &data);
handle = FindFirstFileW(temppath, &data);
if(handle == INVALID_HANDLE_VALUE) {
*err_code = GetLastError();
return NULL;
}
while(!strcmp(data.cFileName, ".") || !strcmp(data.cFileName, "..")) {
if(!FindNextFileA(handle, &data)) {
while(!wcscmp(data.cFileName, dot) || !wcscmp(data.cFileName, dotdot)) {
if(!FindNextFileW(handle, &data)) {
*err_code = ERROR_SUCCESS;
*type = status_unknown;
FindClose(handle);
......@@ -14923,7 +14928,7 @@ void* __cdecl tr2_sys__Open_dir(char* target, char const* dest, int* err_code, e
}
}
strcpy(target, data.cFileName);
wcscpy(target, data.cFileName);
*err_code = ERROR_SUCCESS;
if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
*type = directory_file;
......@@ -14932,6 +14937,31 @@ void* __cdecl tr2_sys__Open_dir(char* target, char const* dest, int* err_code, e
return 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)
{
void *handle;
wchar_t target_w[MAX_PATH];
wchar_t dest_w[MAX_PATH];
TRACE("(%p %s %p %p)\n", target, debugstr_a(dest), err_code, type);
if (dest && !MultiByteToWideChar(CP_ACP, 0, dest, -1, dest_w, MAX_PATH))
{
WARN("Failed to convert input string.\n");
*err_code = ERROR_BAD_PATHNAME;
return NULL;
}
handle = tr2_sys__Open_dir_wchar(target_w, dest ? dest_w : NULL, err_code, type);
if (handle)
WideCharToMultiByte(CP_ACP, 0, target_w, -1, target, MAX_PATH, NULL, NULL);
return handle;
}
/* ?_Read_dir@sys@tr2@std@@YAPADAAY0BAE@DPAXAAW4file_type@123@@Z */
/* ?_Read_dir@sys@tr2@std@@YAPEADAEAY0BAE@DPEAXAEAW4file_type@123@@Z */
char* __cdecl tr2_sys__Read_dir(char* target, void* handle, enum file_type* type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment