Commit 03afdb02 authored by Nicolas Le Cam's avatar Nicolas Le Cam Committed by Alexandre Julliard

msi: Enfore use of GetFileAttributes return value.

parent 11cb788f
......@@ -178,7 +178,8 @@ static LPWSTR app_search_file(LPWSTR path, MSISIGNATURE *sig)
}
attr = GetFileAttributesW(path);
if (attr == INVALID_FILE_ATTRIBUTES || attr == FILE_ATTRIBUTE_DIRECTORY)
if (attr == INVALID_FILE_ATTRIBUTES ||
(attr & FILE_ATTRIBUTE_DIRECTORY))
return NULL;
size = GetFileVersionInfoSizeW(path, &handle);
......@@ -298,7 +299,8 @@ static UINT ACTION_AppSearchComponents(MSIPACKAGE *package, LPWSTR *appValue, MS
lstrcatW(path, MSI_RecordGetString(rec, 2));
attr = GetFileAttributesW(path);
if (attr != INVALID_FILE_ATTRIBUTES && attr != FILE_ATTRIBUTE_DIRECTORY)
if (attr != INVALID_FILE_ATTRIBUTES &&
!(attr & FILE_ATTRIBUTE_DIRECTORY))
*appValue = strdupW(path);
}
......@@ -901,7 +903,8 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig,
}
attr = GetFileAttributesW(val);
if ((attr & FILE_ATTRIBUTE_DIRECTORY) &&
if (attr != INVALID_FILE_ATTRIBUTES &&
(attr & FILE_ATTRIBUTE_DIRECTORY) &&
val && val[lstrlenW(val) - 1] != '\\')
{
val = msi_realloc(val, (lstrlenW(val) + 2) * sizeof(WCHAR));
......@@ -933,7 +936,7 @@ static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATU
WCHAR expanded[MAX_PATH];
MSIRECORD *row;
int depth;
DWORD sz;
DWORD sz, attr;
UINT rc;
TRACE("%s\n", debugstr_w(sig->Name));
......@@ -970,7 +973,9 @@ static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATU
if (parent)
{
if (!(GetFileAttributesW(parent) & FILE_ATTRIBUTE_DIRECTORY))
attr = GetFileAttributesW(parent);
if (attr != INVALID_FILE_ATTRIBUTES &&
!(attr & FILE_ATTRIBUTE_DIRECTORY))
{
PathRemoveFileSpecW(parent);
PathAddBackslashW(parent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment