mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 00:23:10 +00:00
Create a branch for network fixes.
svn path=/branches/aicom-network-fixes/; revision=34994
This commit is contained in:
parent
0e213bbc00
commit
c501d8112c
18148 changed files with 0 additions and 860488 deletions
100
base/shell/cmd/label.c
Normal file
100
base/shell/cmd/label.c
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* LABEL.C - label internal command.
|
||||
*
|
||||
*
|
||||
* History:
|
||||
*
|
||||
* 10-Dec-1998 (Eric Kohl)
|
||||
* Started.
|
||||
*
|
||||
* 11-Dec-1998 (Eric Kohl)
|
||||
* Finished.
|
||||
*
|
||||
* 19-Jan-1998 (Eric Kohl)
|
||||
* Unicode ready!
|
||||
*
|
||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
||||
* Remove all hardcode string to En.rc
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#ifdef INCLUDE_CMD_LABEL
|
||||
|
||||
|
||||
INT cmd_label (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szRootPath[] = _T("A:\\");
|
||||
TCHAR szLabel[80];
|
||||
TCHAR szOldLabel[80];
|
||||
DWORD dwSerialNr;
|
||||
|
||||
/* set empty label string */
|
||||
szLabel[0] = _T('\0');
|
||||
|
||||
nErrorLevel = 0;
|
||||
|
||||
/* print help */
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutResPaging(TRUE,STRING_LABEL_HELP1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get parameters */
|
||||
if (param[0] != _T('\0') && param[1] == _T(':'))
|
||||
{
|
||||
szRootPath[0] = toupper(*param);
|
||||
param += 2;
|
||||
while (_istspace(*param))
|
||||
param++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get label of current drive */
|
||||
TCHAR szCurPath[MAX_PATH];
|
||||
GetCurrentDirectory (MAX_PATH, szCurPath);
|
||||
szRootPath[0] = szCurPath[0];
|
||||
}
|
||||
|
||||
_tcsncpy (szLabel, param, 12);
|
||||
|
||||
/* check root path */
|
||||
if (!IsValidPathName (szRootPath))
|
||||
{
|
||||
error_invalid_drive ();
|
||||
nErrorLevel = 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'))
|
||||
{
|
||||
ConOutResPuts(STRING_LABEL_HELP5);
|
||||
|
||||
ConInString(szLabel, 80);
|
||||
}
|
||||
|
||||
SetVolumeLabel(szRootPath, szLabel);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* INCLUDE_CMD_LABEL */
|
||||
|
||||
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue