[SHELL32]

- Don't duplicate the code for getting the name of a drive. CDrivesFolder already does  it (and it does it better). Make the drive properties call it to get the name it needs.
CORE-10258

svn path=/trunk/; revision=69373
This commit is contained in:
Giannis Adamopoulos 2015-09-27 14:27:09 +00:00
parent 88ec65d6d7
commit e6b8a983ae

View file

@ -124,7 +124,8 @@ SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST
HPROPSHEETPAGE hpsp[MAX_PROPERTY_SHEET_PAGE];
PROPSHEETHEADERW psh;
CComObject<CDrvDefExt> *pDrvDefExt = NULL;
WCHAR wszName[256];
ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
psh.dwSize = sizeof(PROPSHEETHEADERW);
psh.dwFlags = 0; // FIXME: make it modeless
@ -132,33 +133,17 @@ SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST
psh.nStartPage = 0;
psh.phpage = hpsp;
WCHAR wszName[256];
if (GetVolumeInformationW(pwszDrive, wszName, _countof(wszName), NULL, NULL, NULL, NULL, 0))
LPITEMIDLIST completePidl = ILCombine(pidlFolder, apidl[0]);
if (!completePidl)
return FALSE;
if (ILGetDisplayNameExW(NULL, completePidl, wszName, ILGDN_NORMAL))
{
psh.pszCaption = wszName;
psh.dwFlags |= PSH_PROPTITLE;
pwszDrive[2] = 0;
if (wszName[0] == UNICODE_NULL)
{
UINT len;
switch (GetDriveTypeW(pwszDrive))
{
case DRIVE_CDROM:
len = LoadStringW(shell32_hInstance, IDS_DRIVE_CDROM, wszName, _countof(wszName));
break;
case DRIVE_REMOTE:
len = LoadStringW(shell32_hInstance, IDS_DRIVE_NETWORK, wszName, _countof(wszName));
break;
case DRIVE_FIXED:
default:
len = LoadStringW(shell32_hInstance, IDS_DRIVE_FIXED, wszName, _countof(wszName));
break;
}
StringCchPrintf(wszName + len, _countof(wszName) - len, L" (%s)", pwszDrive);
}
else
StringCchPrintf(wszName + wcslen(wszName), _countof(wszName) - wcslen(wszName), L" (%s)", pwszDrive);
}
ILFree(completePidl);
CComPtr<IDataObject> pDataObj;
HRESULT hr = SHCreateDataObject(pidlFolder, 1, apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj));