diff options
author | Cube <alessandro.devito91@gmail.com> | 2021-01-10 23:25:23 +0300 |
---|---|---|
committer | Cube <alessandro.devito91@gmail.com> | 2021-01-10 23:25:23 +0300 |
commit | 8585b6352e8c90460e2b78fe6a4d90c5674e85b8 (patch) | |
tree | 5555a4766b25c232bc05f6a8f10a4ca6590c2429 | |
parent | 829b960b50643b14d1af680f3bba231feb953d9d (diff) |
Fixed GetLongPathNameW
-rw-r--r-- | peloader/winapi/Paths.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/peloader/winapi/Paths.c b/peloader/winapi/Paths.c index 8a51aa8..6cb00ea 100644 --- a/peloader/winapi/Paths.c +++ b/peloader/winapi/Paths.c @@ -59,11 +59,11 @@ DWORD WINAPI GetLongPathNameW(LPCWSTR lpszShortPath, DWORD cchBuffer) { // For now we just return the 8.3 format path as the long path - if (cchBuffer > strlen(lpszShortPath)) { - memcpy(lpszLongPath, lpszShortPath, sizeof(lpszShortPath)); + if (cchBuffer > CountWideChars(lpszShortPath)) { + memcpy(lpszLongPath, lpszShortPath, CountWideChars(lpszShortPath) * sizeof(WCHAR)); } - return strlen(lpszShortPath); + return CountWideChars(lpszShortPath); } DECLARE_CRT_EXPORT("GetTempPathW", GetTempPathW); |