aboutsummaryrefslogtreecommitdiff
path: root/c/ext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c/ext.cpp')
-rw-r--r--c/ext.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/c/ext.cpp b/c/ext.cpp
index 272f4a3..398804e 100644
--- a/c/ext.cpp
+++ b/c/ext.cpp
@@ -78,8 +78,6 @@ static inline bool MatchFileName(wchar_t (&file)[MAX_PATH], const wchar_t* const
static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const root,
const wchar_t* const siEp, const int level = 0)
{
- using FindHandle = Managed<HANDLE, FindClose, Win32Error, -1>;
-
/* Don't recurse too much. */
if (level > 3)
return false;
@@ -88,7 +86,9 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo
Swprintf(pat, L"%s\\*", root);
WIN32_FIND_DATA fdata;
- FindHandle h = FindFirstFileW(pat, &fdata);
+ Unique<HANDLE, FindClose> h = FindFirstFileW(pat, &fdata);
+ if (!h.Not(INVALID_HANDLE_VALUE))
+ throw Win32Error();
do
if (fdata.cFileName[0] == L'.')
@@ -103,7 +103,7 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo
Swprintf(file, L"%s\\%s", root, fdata.cFileName);
return true;
}
- while (FindNextFileW(h, &fdata));
+ while (FindNextFileW(h.v, &fdata));
if (GetLastError() != ERROR_NO_MORE_FILES)
throw Win32Error();