Module: wine Branch: oldstable Commit: 2f3e5e7f1008530cba11b538e6cf7437909c4720 URL: https://source.winehq.org/git/wine.git/?a=commit;h=2f3e5e7f1008530cba11b538e...
Author: Stefan Dösinger stefan@codeweavers.com Date: Fri Jul 20 10:51:54 2018 +0200
msvcp140: Implement _Temp_get.
Signed-off-by: Stefan Dösinger stefan@codeweavers.com Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 17c203ea86fa9f7b1739c638c9ca20f34b8c9d1d) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/msvcp140/msvcp140.spec | 2 +- dlls/msvcp140/tests/msvcp140.c | 26 ++++++++++++++++++++++++++ dlls/msvcp90/ios.c | 6 ++++++ 3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index 0efd785..ef58db6 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -3718,7 +3718,7 @@ @ stub _Strxfrm @ cdecl _Symlink(wstr wstr) tr2_sys__Symlink_wchar @ stub _Symlink_get -@ stub _Temp_get +@ cdecl _Temp_get(ptr) @ stub _Thrd_abort @ cdecl _Thrd_create(ptr ptr ptr) _Thrd_create @ cdecl -norelay _Thrd_current() diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c index 593e0ce..6620b95 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -178,6 +178,7 @@ static WCHAR* (__cdecl *p_Read_dir)(WCHAR*, void*, enum file_type*); static MSVCP_bool (__cdecl *p_Remove_dir)(WCHAR const*); static enum file_type (__cdecl *p_Stat)(WCHAR const *, int *); static int (__cdecl *p_Symlink)(WCHAR const*, WCHAR const*); +static WCHAR* (__cdecl *p_Temp_get)(WCHAR *); static int (__cdecl *p_To_byte)(const WCHAR *src, char *dst); static int (__cdecl *p_To_wide)(const char *src, WCHAR *dst); static int (__cdecl *p_Unlink)(WCHAR const*); @@ -260,6 +261,7 @@ static BOOL init(void) SET(p_Remove_dir, "_Remove_dir"); SET(p_Stat, "_Stat"); SET(p_Symlink, "_Symlink"); + SET(p_Temp_get, "_Temp_get"); SET(p_To_byte, "_To_byte"); SET(p_To_wide, "_To_wide"); SET(p_Unlink, "_Unlink"); @@ -1061,6 +1063,29 @@ static void test_Unlink(void) ok(SetCurrentDirectoryW(current_path), "SetCurrentDirectoryW failed\n"); }
+static void test_Temp_get(void) +{ + WCHAR path[MAX_PATH + 1], temp_path[MAX_PATH]; + WCHAR *retval; + DWORD len; + + GetTempPathW(ARRAY_SIZE(temp_path), temp_path); + + /* This crashes on Windows, the input pointer is not validated. */ + if (0) + { + retval = p_Temp_get(NULL); + ok(!retval, "_Temp_get(): Got %p\n", retval); + } + + memset(path, 0xaa, sizeof(path)); + retval = p_Temp_get(path); + ok(retval == path, "_Temp_get(): Got %p, expected %p\n", retval, path); + ok(!wcscmp(path, temp_path), "Expected path %s, got %s\n", wine_dbgstr_w(temp_path), wine_dbgstr_w(path)); + len = wcslen(path); + todo_wine ok(path[len + 1] == 0xaaaa, "Too many bytes were zeroed - %x\n", path[len + 1]); +} + START_TEST(msvcp140) { if(!init()) return; @@ -1079,5 +1104,6 @@ START_TEST(msvcp140) test_Stat(); test_dir_operation(); test_Unlink(); + test_Temp_get(); FreeLibrary(msvcp); } diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 4778aad..88cd454 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -15798,6 +15798,12 @@ enum file_type __cdecl _Lstat(WCHAR const* path, int* permissions) return _Stat(path, permissions); }
+WCHAR * __cdecl _Temp_get(WCHAR *dst) +{ + GetTempPathW(MAX_PATH, dst); + return dst; +} + /* ??1_Winit@std@@QAE@XZ */ /* ??1_Winit@std@@QAE@XZ */ DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)