mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SHELL32] Return ERROR_INVALID_DRIVE if the drive type is unknown or there is no volume mounted (#2703)
Return ERROR_INVALID_DRIVE if the drive is either unknown or unmounted.
This commit is contained in:
parent
e2fdfae24f
commit
e978ec6125
1 changed files with 8 additions and 0 deletions
|
@ -582,6 +582,7 @@ HRESULT WINAPI CDrivesFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLEST
|
|||
HRESULT hr = E_INVALIDARG;
|
||||
LPCWSTR szNext = NULL;
|
||||
LPITEMIDLIST pidlTemp = NULL;
|
||||
WCHAR volumePathName[MAX_PATH];
|
||||
|
||||
TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
|
||||
hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
|
||||
|
@ -598,6 +599,13 @@ HRESULT WINAPI CDrivesFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLEST
|
|||
if (PathGetDriveNumberW(lpszDisplayName) < 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
/* check if this drive actually exists */
|
||||
if (!GetVolumePathNameW(lpszDisplayName, volumePathName, _countof(volumePathName)) ||
|
||||
GetDriveTypeW(volumePathName) < DRIVE_REMOVABLE)
|
||||
{
|
||||
return HRESULT_FROM_WIN32(ERROR_INVALID_DRIVE);
|
||||
}
|
||||
|
||||
pidlTemp = _ILCreateDrive(lpszDisplayName);
|
||||
if (!pidlTemp)
|
||||
return E_OUTOFMEMORY;
|
||||
|
|
Loading…
Reference in a new issue