diff options
Diffstat (limited to 'winpr/libwinpr/path')
-rw-r--r-- | winpr/libwinpr/path/CMakeLists.txt | 4 | ||||
-rw-r--r-- | winpr/libwinpr/path/path.c | 8 | ||||
-rw-r--r-- | winpr/libwinpr/path/shell.c | 6 |
3 files changed, 8 insertions, 10 deletions
diff --git a/winpr/libwinpr/path/CMakeLists.txt b/winpr/libwinpr/path/CMakeLists.txt index 1e4ed92..a5a75c6 100644 --- a/winpr/libwinpr/path/CMakeLists.txt +++ b/winpr/libwinpr/path/CMakeLists.txt @@ -17,6 +17,10 @@ winpr_module_add(path.c shell.c) +if (MSVC OR MINGW) + winpr_library_add_public(shlwapi) +endif() + if (IOS) winpr_module_add(shell_ios.m) endif (IOS) diff --git a/winpr/libwinpr/path/path.c b/winpr/libwinpr/path/path.c index 82e6be1..3f20465 100644 --- a/winpr/libwinpr/path/path.c +++ b/winpr/libwinpr/path/path.c @@ -1002,7 +1002,7 @@ PCSTR PathGetSharedLibraryExtensionA(unsigned long dwFlags) PCWSTR PathGetSharedLibraryExtensionW(unsigned long dwFlags) { - WCHAR buffer[6][16] = { 0 }; + static WCHAR buffer[6][16] = { 0 }; const WCHAR* SharedLibraryExtensionDotDllW = InitializeConstWCharFromUtf8( SharedLibraryExtensionDotDllA, buffer[0], ARRAYSIZE(buffer[0])); const WCHAR* SharedLibraryExtensionDotSoW = @@ -1131,11 +1131,12 @@ BOOL winpr_RemoveDirectory_RecursiveW(LPCWSTR lpPathName) WCHAR starbuffer[8] = { 0 }; const WCHAR* star = InitializeConstWCharFromUtf8("*", starbuffer, ARRAYSIZE(starbuffer)); const HRESULT hr = NativePathCchAppendW(path_slash, path_slash_len, star); + HANDLE dir = INVALID_HANDLE_VALUE; if (FAILED(hr)) goto fail; WIN32_FIND_DATAW findFileData = { 0 }; - HANDLE dir = FindFirstFileW(path_slash, &findFileData); + dir = FindFirstFileW(path_slash, &findFileData); if (dir == INVALID_HANDLE_VALUE) goto fail; @@ -1167,8 +1168,6 @@ BOOL winpr_RemoveDirectory_RecursiveW(LPCWSTR lpPathName) break; } while (ret && FindNextFileW(dir, &findFileData) != 0); - FindClose(dir); - if (ret) { if (!RemoveDirectoryW(lpPathName)) @@ -1176,6 +1175,7 @@ BOOL winpr_RemoveDirectory_RecursiveW(LPCWSTR lpPathName) } fail: + FindClose(dir); free(path_slash); return ret; } diff --git a/winpr/libwinpr/path/shell.c b/winpr/libwinpr/path/shell.c index 4380a9b..a1e7b4e 100644 --- a/winpr/libwinpr/path/shell.c +++ b/winpr/libwinpr/path/shell.c @@ -670,12 +670,6 @@ fail: return ret; } -#else - -#ifdef _MSC_VER -#pragma comment(lib, "shlwapi.lib") -#endif - #endif BOOL winpr_MoveFile(LPCSTR lpExistingFileName, LPCSTR lpNewFileName) |