[KERNEL32]: Reimplement GetDiskFreeSpaceA() to make it w2k3 compliant
authorPierre Schweitzer <pierre@reactos.org>
Wed, 4 Oct 2017 20:30:18 +0000 (22:30 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Thu, 5 Oct 2017 20:14:44 +0000 (22:14 +0200)
dll/win32/kernel32/client/file/disk.c

index 7ff6e88..5854b23 100644 (file)
@@ -189,19 +189,24 @@ GetDiskFreeSpaceA(IN LPCSTR lpRootPathName,
                   OUT LPDWORD lpNumberOfFreeClusters,
                   OUT LPDWORD lpTotalNumberOfClusters)
 {
-    PWCHAR RootPathNameW=NULL;
+    PCSTR RootPath;
+    PUNICODE_STRING RootPathU;
 
-    if (lpRootPathName)
+    RootPath = lpRootPathName;
+    if (RootPath == NULL)
     {
-        if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE)))
-            return FALSE;
+        RootPath = "\\";
+    }
+
+    RootPathU = Basep8BitStringToStaticUnicodeString(RootPath);
+    if (RootPathU == NULL)
+    {
+        return FALSE;
     }
 
-    return GetDiskFreeSpaceW (RootPathNameW,
-                              lpSectorsPerCluster,
-                              lpBytesPerSector,
-                              lpNumberOfFreeClusters,
-                              lpTotalNumberOfClusters);
+    return GetDiskFreeSpaceW(RootPathU->Buffer, lpSectorsPerCluster,
+                             lpBytesPerSector, lpNumberOfFreeClusters,
+                             lpTotalNumberOfClusters);
 }
 
 /*