diff options
author | Cube <alessandro.devito91@gmail.com> | 2021-01-06 22:37:59 +0300 |
---|---|---|
committer | Cube <alessandro.devito91@gmail.com> | 2021-01-06 22:37:59 +0300 |
commit | 33dac1dfc9ece1efd2a6c260de5e7fa481b4f5e7 (patch) | |
tree | bc6a5ac829361eb46893b3ff2e7c93ee7d7f1ea9 | |
parent | de5bda0d19064f85d103da69ab2f5d167bf7d9c9 (diff) |
Added GetLongPathName APIs, which basically return the short path passed as argument.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | peloader/winapi/Paths.c | 26 |
2 files changed, 28 insertions, 0 deletions
@@ -7,3 +7,5 @@ mpclient avscript eicar.com +.gradle/ +.idea/ diff --git a/peloader/winapi/Paths.c b/peloader/winapi/Paths.c index bab53d0..8a51aa8 100644 --- a/peloader/winapi/Paths.c +++ b/peloader/winapi/Paths.c @@ -42,6 +42,32 @@ UINT WINAPI GetDriveTypeW(PWCHAR lpRootPathName) return DRIVE_FIXED; } +DWORD WINAPI GetLongPathNameA(LPCSTR lpszShortPath, + LPSTR lpszLongPath, + 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)); + } + + return strlen(lpszShortPath); +} + +DWORD WINAPI GetLongPathNameW(LPCWSTR lpszShortPath, + LPWSTR lpszLongPath, + 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)); + } + + return strlen(lpszShortPath); +} + DECLARE_CRT_EXPORT("GetTempPathW", GetTempPathW); DECLARE_CRT_EXPORT("GetLogicalDrives", GetLogicalDrives); DECLARE_CRT_EXPORT("GetDriveTypeW", GetDriveTypeW); +DECLARE_CRT_EXPORT("GetLongPathNameA", GetLongPathNameA); +DECLARE_CRT_EXPORT("GetLongPathNameW", GetLongPathNameW); |