[KERNEL32]: Reimplement GetDiskFreeSpaceExA() to make it w2k3 compliant

This commit is contained in:
Pierre Schweitzer 2017-10-04 23:02:22 +02:00
parent 1e2424ee98
commit 8b6518139d

View file

@ -359,18 +359,23 @@ GetDiskFreeSpaceExA(IN LPCSTR lpDirectoryName OPTIONAL,
OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfBytes,
OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes) OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
{ {
PWCHAR DirectoryNameW=NULL; PCSTR RootPath;
PUNICODE_STRING RootPathU;
if (lpDirectoryName) RootPath = lpDirectoryName;
if (RootPath == NULL)
{ {
if (!(DirectoryNameW = FilenameA2W(lpDirectoryName, FALSE))) RootPath = "\\";
return FALSE;
} }
return GetDiskFreeSpaceExW (DirectoryNameW , RootPathU = Basep8BitStringToStaticUnicodeString(RootPath);
lpFreeBytesAvailableToCaller, if (RootPathU == NULL)
lpTotalNumberOfBytes, {
lpTotalNumberOfFreeBytes); return FALSE;
}
return GetDiskFreeSpaceExW(RootPathU->Buffer, lpFreeBytesAvailableToCaller,
lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes);
} }
/* /*