From 87448f3d8b26a6696f143872874200ef5799565d Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Wed, 4 Oct 2017 22:30:18 +0200 Subject: [PATCH] [KERNEL32]: Reimplement GetDiskFreeSpaceA() to make it w2k3 compliant --- dll/win32/kernel32/client/file/disk.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/dll/win32/kernel32/client/file/disk.c b/dll/win32/kernel32/client/file/disk.c index 7ff6e88f1a7..5854b2320ef 100644 --- a/dll/win32/kernel32/client/file/disk.c +++ b/dll/win32/kernel32/client/file/disk.c @@ -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 = "\\"; } - return GetDiskFreeSpaceW (RootPathNameW, - lpSectorsPerCluster, - lpBytesPerSector, - lpNumberOfFreeClusters, - lpTotalNumberOfClusters); + RootPathU = Basep8BitStringToStaticUnicodeString(RootPath); + if (RootPathU == NULL) + { + return FALSE; + } + + return GetDiskFreeSpaceW(RootPathU->Buffer, lpSectorsPerCluster, + lpBytesPerSector, lpNumberOfFreeClusters, + lpTotalNumberOfClusters); } /*