From 32d3ffc5c51901bab829ecf66d45177cab4be732 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 28 Nov 2007 14:55:48 -0600 Subject: [PATCH] msi: Make sure attr is valid before checking for the directory bit. --- dlls/msi/appsearch.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c index 5baaa768541..64b2d485862 100644 --- a/dlls/msi/appsearch.c +++ b/dlls/msi/appsearch.c @@ -677,14 +677,15 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue, static UINT ACTION_CheckDirectory(MSIPACKAGE *package, LPCWSTR dir, LPWSTR *appValue) { - UINT rc = ERROR_SUCCESS; + DWORD attr = GetFileAttributesW(dir); - if (GetFileAttributesW(dir) & FILE_ATTRIBUTE_DIRECTORY) + if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY)) { TRACE("directory exists, returning %s\n", debugstr_w(dir)); *appValue = strdupW(dir); } - return rc; + + return ERROR_SUCCESS; } static BOOL ACTION_IsFullPath(LPCWSTR path)