From: YeshunYe <yeyeshun(a)uniontech.com> 'mbstowcs_s' will make a wrong path in non-ASCII environments. Signed-off-by: YeshunYe <yeyeshun(a)uniontech.com> --- dlls/msvcp90/ios.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index ef2c122f17f..9b68226c8c0 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -3259,10 +3259,12 @@ FILE* __cdecl _Fiopen_wchar(const wchar_t *name, int mode, int prot) FILE* __cdecl _Fiopen(const char *name, int mode, int prot) { wchar_t nameW[FILENAME_MAX]; - + int result; TRACE("(%s %d %d)\n", name, mode, prot); + result = MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, FILENAME_MAX-1); + nameW[result] = 0; - if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0) + if(result == 0) return NULL; return _Fiopen_wchar(nameW, mode, prot); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/603