check for console handles in Get/SetFileAttributesByHandle()
authorThomas Bluemel <thomas@reactsoft.com>
Thu, 25 Aug 2005 00:33:37 +0000 (00:33 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Thu, 25 Aug 2005 00:33:37 +0000 (00:33 +0000)
svn path=/trunk/; revision=17531

reactos/lib/kernel32/file/file.c

index fb31b65..9256f15 100644 (file)
@@ -979,6 +979,12 @@ GetFileAttributesByHandle(IN HANDLE hFile,
     
     UNREFERENCED_PARAMETER(dwFlags);
     
     
     UNREFERENCED_PARAMETER(dwFlags);
     
+    if (IsConsoleHandle(hFile))
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+    
     Status = NtQueryInformationFile(hFile,
                                     &IoStatusBlock,
                                     &FileBasic,
     Status = NtQueryInformationFile(hFile,
                                     &IoStatusBlock,
                                     &FileBasic,
@@ -1008,6 +1014,12 @@ SetFileAttributesByHandle(IN HANDLE hFile,
     NTSTATUS Status;
 
     UNREFERENCED_PARAMETER(dwFlags);
     NTSTATUS Status;
 
     UNREFERENCED_PARAMETER(dwFlags);
+    
+    if (IsConsoleHandle(hFile))
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
 
     Status = NtQueryInformationFile(hFile,
                                     &IoStatusBlock,
 
     Status = NtQueryInformationFile(hFile,
                                     &IoStatusBlock,