mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
- display volume label for disk drives. If there is no label, load default label
svn path=/trunk/; revision=34915
This commit is contained in:
parent
9655f89744
commit
67821bff32
|
@ -684,24 +684,59 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
|
|||
}
|
||||
else if (_ILIsDrive(pidl))
|
||||
{
|
||||
_ILSimpleGetTextW (pidl, pszPath, MAX_PATH); /* append my own path */
|
||||
|
||||
_ILSimpleGetTextW (pidl, pszPath, MAX_PATH); /* append my own path */
|
||||
/* long view "lw_name (C:)" */
|
||||
if (!(dwFlags & SHGDN_FORPARSING))
|
||||
{
|
||||
DWORD dwVolumeSerialNumber, dwMaximumComponetLength, dwFileSystemFlags;
|
||||
WCHAR wszDrive[18] = {0};
|
||||
DWORD dwVolumeSerialNumber, dwMaximumComponentLength, dwFileSystemFlags;
|
||||
static const WCHAR wszOpenBracket[] = {' ','(',0};
|
||||
static const WCHAR wszCloseBracket[] = {')',0};
|
||||
|
||||
GetVolumeInformationW (pszPath, wszDrive,
|
||||
sizeof(wszDrive)/sizeof(wszDrive[0]) - 6,
|
||||
lstrcpynW(wszDrive, pszPath, 4);
|
||||
GetVolumeInformationW (wszDrive, pszPath,
|
||||
MAX_PATH - 7,
|
||||
&dwVolumeSerialNumber,
|
||||
&dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0);
|
||||
strcatW (wszDrive, wszOpenBracket);
|
||||
lstrcpynW (wszDrive + strlenW(wszDrive), pszPath, 3);
|
||||
strcatW (wszDrive, wszCloseBracket);
|
||||
strcpyW (pszPath, wszDrive);
|
||||
&dwMaximumComponentLength, &dwFileSystemFlags, NULL, 0);
|
||||
pszPath[MAX_PATH-1] = L'\0';
|
||||
pszPath[0] = L'\0';
|
||||
|
||||
if (!wcslen(pszPath))
|
||||
{
|
||||
UINT DriveType, ResourceId;
|
||||
DriveType = GetDriveTypeW(wszDrive);
|
||||
switch(DriveType)
|
||||
{
|
||||
case DRIVE_FIXED:
|
||||
ResourceId = IDS_DRIVE_FIXED;
|
||||
break;
|
||||
case DRIVE_REMOTE:
|
||||
ResourceId = IDS_DRIVE_NETWORK;
|
||||
break;
|
||||
case DRIVE_CDROM:
|
||||
ResourceId = IDS_DRIVE_CDROM;
|
||||
break;
|
||||
default:
|
||||
ResourceId = 0;
|
||||
}
|
||||
if (ResourceId)
|
||||
{
|
||||
dwFileSystemFlags = LoadStringW(shell32_hInstance, ResourceId, pszPath, MAX_PATH);
|
||||
if (dwFileSystemFlags > MAX_PATH - 7)
|
||||
pszPath[MAX_PATH-7] = L'\0';
|
||||
else if (dwFileSystemFlags == 0)
|
||||
pszPath[0] = L'\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
pszPath[0] = L'\0';
|
||||
}
|
||||
}
|
||||
strcatW (pszPath, wszOpenBracket);
|
||||
wszDrive[2] = L'\0';
|
||||
strcatW (pszPath, wszDrive);
|
||||
strcatW (pszPath, wszCloseBracket);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue