Author: cwittich Date: Sun Aug 23 06:53:08 2015 New Revision: 68797
URL: http://svn.reactos.org/svn/reactos?rev=68797&view=rev Log: [KERNEL32] sync GetTempPathW with wine wine-1.7.50
Modified: trunk/reactos/dll/win32/kernel32/client/path.c
Modified: trunk/reactos/dll/win32/kernel32/client/path.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/p... ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] Sun Aug 23 06:53:08 2015 @@ -2116,13 +2116,18 @@
ret++; /* add space for terminating 0 */
- if (count) - { - lstrcpynW(path, full_tmp_path, count); - if (count >= ret) - ret--; /* return length without 0 */ - else if (count < 4) - path[0] = 0; /* avoid returning ambiguous "X:" */ + if (count >= ret) + { + lstrcpynW(path, tmp_path, count); + /* the remaining buffer must be zeroed up to 32766 bytes in XP or 32767 + * bytes after it, we will assume the > XP behavior for now */ + memset(path + ret, 0, (min(count, 32767) - ret) * sizeof(WCHAR)); + ret--; /* return length without 0 */ + } + else if (count) + { + /* the buffer must be cleared if contents will not fit */ + memset(path, 0, count * sizeof(WCHAR)); }
DPRINT("GetTempPathW returning %u, %S\n", ret, path);