[KERNEL32]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 9 Jul 2016 22:23:23 +0000 (22:23 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 9 Jul 2016 22:23:23 +0000 (22:23 +0000)
- Do not use a "magic number" for the return value 0xFFFFFFFF from GetFileAttributes.
- Use a meaningful variable name for retrieving the result of GetFileAttributes.

svn path=/trunk/; revision=71879

reactos/dll/win32/kernel32/client/file/create.c
reactos/dll/win32/kernel32/client/proc.c

index 5f67758..f823f1f 100644 (file)
@@ -435,7 +435,7 @@ OpenFile(LPCSTR lpFileName,
 
         switch (dwAttributes)
         {
-            case 0xFFFFFFFF: /* File does not exist */
+            case INVALID_FILE_ATTRIBUTES: /* File does not exist */
                 SetLastError(ERROR_FILE_NOT_FOUND);
                 lpReOpenBuff->nErrCode = (WORD) ERROR_FILE_NOT_FOUND;
                 return -1;
index 041a712..0acbf74 100644 (file)
@@ -2329,7 +2329,7 @@ CreateProcessInternalW(IN HANDLE hUserToken,
     PCHAR pcScan;
     SIZE_T n;
     WCHAR SaveChar;
-    ULONG Length, CurdirLength, CmdQuoteLength;
+    ULONG Length, FileAttribs, CmdQuoteLength;
     ULONG CmdLineLength, ResultSize;
     PWCHAR QuotedCmdLine, AnsiCmdCommand, ExtBuffer, CurrentDirectory;
     PWCHAR NullBuffer, ScanString, NameBuffer, SearchPath, DebuggerCmdLine;
@@ -2734,9 +2734,9 @@ StartScan:
         if ((Length) && (Length < MAX_PATH))
         {
             /* Get file attributes */
-            CurdirLength = GetFileAttributesW(NameBuffer);
-            if ((CurdirLength != 0xFFFFFFFF) &&
-                (CurdirLength & FILE_ATTRIBUTE_DIRECTORY))
+            FileAttribs = GetFileAttributesW(NameBuffer);
+            if ((FileAttribs != INVALID_FILE_ATTRIBUTES) &&
+                (FileAttribs & FILE_ATTRIBUTE_DIRECTORY))
             {
                 /* This was a directory, fail later on */
                 Length = 0;
@@ -4066,9 +4066,9 @@ StartScan:
         }
 
         /* Make sure the directory is actually valid */
-        CurdirLength = GetFileAttributesW(CurrentDirectory);
-        if ((CurdirLength == 0xffffffff) ||
-           !(CurdirLength & FILE_ATTRIBUTE_DIRECTORY))
+        FileAttribs = GetFileAttributesW(CurrentDirectory);
+        if ((FileAttribs == INVALID_FILE_ATTRIBUTES) ||
+           !(FileAttribs & FILE_ATTRIBUTE_DIRECTORY))
         {
             /* It isn't, so bail out */
             DPRINT1("Current directory is invalid\n");