mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:05:41 +00:00
[KERNEL32]
- Use current directory for NULL parameter in GetDriveType Patch by Kenneth Deane (kde678 __AT__ gmail __DOT__ com), slightly modified by myself. Thanks! svn path=/trunk/; revision=62019
This commit is contained in:
parent
3a982ed8e3
commit
116102fec2
1 changed files with 26 additions and 5 deletions
|
@ -360,6 +360,9 @@ GetDriveTypeA(IN LPCSTR lpRootPathName)
|
||||||
{
|
{
|
||||||
PWCHAR RootPathNameW;
|
PWCHAR RootPathNameW;
|
||||||
|
|
||||||
|
if (!lpRootPathName)
|
||||||
|
return GetDriveTypeW(NULL);
|
||||||
|
|
||||||
if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE)))
|
if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE)))
|
||||||
return DRIVE_UNKNOWN;
|
return DRIVE_UNKNOWN;
|
||||||
|
|
||||||
|
@ -375,11 +378,29 @@ GetDriveTypeW(IN LPCWSTR lpRootPathName)
|
||||||
{
|
{
|
||||||
FILE_FS_DEVICE_INFORMATION FileFsDevice;
|
FILE_FS_DEVICE_INFORMATION FileFsDevice;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
NTSTATUS errCode;
|
NTSTATUS errCode;
|
||||||
|
|
||||||
|
if (!lpRootPathName)
|
||||||
|
{
|
||||||
|
/* If NULL is passed, use current directory path */
|
||||||
|
DWORD BufferSize = GetCurrentDirectoryW(0, NULL);
|
||||||
|
LPWSTR CurrentDir = HeapAlloc(GetProcessHeap(), 0, BufferSize * sizeof(WCHAR));
|
||||||
|
if (!CurrentDir)
|
||||||
|
return DRIVE_UNKNOWN;
|
||||||
|
if (!GetCurrentDirectoryW(BufferSize, CurrentDir))
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, CurrentDir);
|
||||||
|
return DRIVE_UNKNOWN;
|
||||||
|
}
|
||||||
|
hFile = InternalOpenDirW(CurrentDir, FALSE);
|
||||||
|
HeapFree(GetProcessHeap(), 0, CurrentDir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
hFile = InternalOpenDirW(lpRootPathName, FALSE);
|
hFile = InternalOpenDirW(lpRootPathName, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
return DRIVE_NO_ROOT_DIR; /* According to WINE regression tests */
|
return DRIVE_NO_ROOT_DIR; /* According to WINE regression tests */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue