update for HEAD-2003021201
[reactos.git] / lib / kernel32 / file / volume.c
index 1852032..654d48c 100644 (file)
  * Copyright 1996 Alexandre Julliard
  */
 
-#include <ddk/ntddk.h>
-#include <windows.h>
-#include <ntos/minmax.h>
+#include <k32.h>
 
 #define NDEBUG
 #include <kernel32/kernel32.h>
-#include <kernel32/error.h>
 
 
 #define MAX_DOS_DRIVES 26
 
-HANDLE InternalOpenDirW(PWCHAR DirName, BOOLEAN Write)
-{
-    UNICODE_STRING NtPathU;
-    OBJECT_ATTRIBUTES ObjectAttributes;
-    NTSTATUS errCode;
-    IO_STATUS_BLOCK IoStatusBlock;
-    HANDLE hFile;
 
-    if (!RtlDosPathNameToNtPathName_U ((LPWSTR)DirName,
-                                      &NtPathU,
-                                      NULL,
-                                      NULL))
+static HANDLE
+InternalOpenDirW(LPCWSTR DirName,
+                BOOLEAN Write)
+{
+  UNICODE_STRING NtPathU;
+  OBJECT_ATTRIBUTES ObjectAttributes;
+  NTSTATUS errCode;
+  IO_STATUS_BLOCK IoStatusBlock;
+  HANDLE hFile;
+
+  if (!RtlDosPathNameToNtPathName_U((LPWSTR)DirName,
+                                   &NtPathU,
+                                   NULL,
+                                   NULL))
     {
        DPRINT("Invalid path\n");
        SetLastError(ERROR_BAD_PATHNAME);
@@ -76,6 +76,7 @@ HANDLE InternalOpenDirW(PWCHAR DirName, BOOLEAN Write)
     return hFile;
 }
 
+
 DWORD STDCALL
 GetLogicalDriveStringsA(DWORD nBufferLength,
                        LPSTR lpBuffer)
@@ -222,12 +223,12 @@ GetDiskFreeSpaceW(
         GetCurrentDirectoryW (MAX_PATH, RootPathName);
         RootPathName[3] = 0;
     }
-       
-    if (INVALID_HANDLE_VALUE == (hFile = InternalOpenDirW((PWCHAR)lpRootPathName, FALSE)))
+
+  hFile = InternalOpenDirW(lpRootPathName, FALSE);
+  if (INVALID_HANDLE_VALUE == hFile)
     {
-        return FALSE;
+      return FALSE;
     }
-   
 
     errCode = NtQueryVolumeInformationFile(hFile,
                                            &IoStatusBlock,
@@ -321,8 +322,9 @@ GetDiskFreeSpaceExW(
         GetCurrentDirectoryW (MAX_PATH, RootPathName);
         RootPathName[3] = 0;
     }
-       
-    if (INVALID_HANDLE_VALUE == (hFile = InternalOpenDirW(lpDirectoryName, FALSE)))
+
+    hFile = InternalOpenDirW(lpDirectoryName, FALSE);
+    if (INVALID_HANDLE_VALUE == hFile)
     {
         return FALSE;
     }
@@ -555,11 +557,11 @@ GetVolumeInformationW(
         DPRINT("FileFsVolume %p\n", FileFsVolume);
         DPRINT("FileFsAttribute %p\n", FileFsAttribute);
 
-       hFile = InternalOpenDirW(lpRootPathName, FALSE);
-       if (hFile == INVALID_HANDLE_VALUE)
-       {
-           return FALSE;
-       }
+  hFile = InternalOpenDirW(lpRootPathName, FALSE);
+  if (hFile == INVALID_HANDLE_VALUE)
+    {
+      return FALSE;
+    }
 
         DPRINT("hFile: %x\n", hFile);
         errCode = NtQueryVolumeInformationFile(hFile,
@@ -677,8 +679,9 @@ SetVolumeLabelW(LPCWSTR lpRootPathName,
    LabelInfo->VolumeLabelLength = LabelLength;
    wcscpy(LabelInfo->VolumeLabel,
          lpVolumeName);
-   
-   if (INVALID_HANDLE_VALUE == (hFile = InternalOpenDirW(lpRootPathName, TRUE)))
+
+   hFile = InternalOpenDirW(lpRootPathName, TRUE);
+   if (INVALID_HANDLE_VALUE == hFile)
    {
         return FALSE;
    }