mirror of
https://github.com/reactos/reactos.git
synced 2024-09-10 04:42:00 +00:00
- cmd_label: If a label is given on the command line, don't truncate it to only 12 characters; NTFS supports up to 32. Also, use _tcsncat, since _tcsncpy won't always nul-terminate.
- Don't show the old volume information if a label was given on the command line. (Bug 3621) - If setting the label was unsuccessful, give an error message. svn path=/trunk/; revision=35098
This commit is contained in:
parent
65c33891f6
commit
489d4d8089
|
@ -57,7 +57,7 @@ INT cmd_label (LPTSTR cmd, LPTSTR param)
|
||||||
szRootPath[0] = szCurPath[0];
|
szRootPath[0] = szCurPath[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
_tcsncpy (szLabel, param, 12);
|
_tcsncat(szLabel, param, 79);
|
||||||
|
|
||||||
/* check root path */
|
/* check root path */
|
||||||
if (!IsValidPathName (szRootPath))
|
if (!IsValidPathName (szRootPath))
|
||||||
|
@ -67,30 +67,35 @@ INT cmd_label (LPTSTR cmd, LPTSTR param)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetVolumeInformation(szRootPath, szOldLabel, 80, &dwSerialNr,
|
|
||||||
NULL, NULL, NULL, 0);
|
|
||||||
|
|
||||||
/* print drive info */
|
|
||||||
if (szOldLabel[0] != _T('\0'))
|
|
||||||
{
|
|
||||||
ConOutResPrintf(STRING_LABEL_HELP2, _totupper(szRootPath[0]), szOldLabel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ConOutResPrintf(STRING_LABEL_HELP3, _totupper(szRootPath[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* print the volume serial number */
|
|
||||||
ConOutResPrintf(STRING_LABEL_HELP4, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
|
||||||
|
|
||||||
if (szLabel[0] == _T('\0'))
|
if (szLabel[0] == _T('\0'))
|
||||||
{
|
{
|
||||||
|
GetVolumeInformation(szRootPath, szOldLabel, 80, &dwSerialNr,
|
||||||
|
NULL, NULL, NULL, 0);
|
||||||
|
|
||||||
|
/* print drive info */
|
||||||
|
if (szOldLabel[0] != _T('\0'))
|
||||||
|
{
|
||||||
|
ConOutResPrintf(STRING_LABEL_HELP2, _totupper(szRootPath[0]), szOldLabel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ConOutResPrintf(STRING_LABEL_HELP3, _totupper(szRootPath[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* print the volume serial number */
|
||||||
|
ConOutResPrintf(STRING_LABEL_HELP4, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||||
|
|
||||||
ConOutResPuts(STRING_LABEL_HELP5);
|
ConOutResPuts(STRING_LABEL_HELP5);
|
||||||
|
|
||||||
ConInString(szLabel, 80);
|
ConInString(szLabel, 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetVolumeLabel(szRootPath, szLabel);
|
if (!SetVolumeLabel(szRootPath, szLabel))
|
||||||
|
{
|
||||||
|
ConOutFormatMessage(GetLastError());
|
||||||
|
nErrorLevel = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue