James Hawkins : msi: Make sure attr is valid before checking for the directory bit.

Alexandre Julliard julliard at winehq.org
Thu Nov 29 10:31:23 CST 2007


Module: wine
Branch: master
Commit: 32d3ffc5c51901bab829ecf66d45177cab4be732
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=32d3ffc5c51901bab829ecf66d45177cab4be732

Author: James Hawkins <truiken at gmail.com>
Date:   Wed Nov 28 14:55:48 2007 -0600

msi: Make sure attr is valid before checking for the directory bit.

---

 dlls/msi/appsearch.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c
index 5baaa76..64b2d48 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)




More information about the wine-cvs mailing list