2 * LABEL.C - label internal command.
7 * 10-Dec-1998 (Eric Kohl)
10 * 11-Dec-1998 (Eric Kohl)
13 * 19-Jan-1998 (Eric Kohl)
16 * 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
17 * Remove all hardcode string to En.rc
22 #ifdef INCLUDE_CMD_LABEL
25 INT
cmd_label (LPTSTR cmd
, LPTSTR param
)
27 TCHAR szMsg
[RC_STRING_MAX_SIZE
];
28 TCHAR szRootPath
[] = _T("A:\\");
35 /* set empty label string */
36 szLabel
[0] = _T('\0');
39 if (!_tcsncmp (param
, _T("/?"), 2))
41 ConOutResPaging(TRUE
,STRING_LABEL_HELP1
);
48 arg
= split (param
, &args
, FALSE
);
52 /* too many parameters */
53 error_too_many_parameters (arg
[args
- 1]);
61 /* get label of current drive */
62 TCHAR szCurPath
[MAX_PATH
];
63 GetCurrentDirectory (MAX_PATH
, szCurPath
);
64 szRootPath
[0] = szCurPath
[0];
68 if ((_tcslen (arg
[0]) >= 2) && (arg
[0][1] == _T(':')))
70 szRootPath
[0] = toupper (*arg
[0]);
72 _tcsncpy (szLabel
, arg
[1], 12);
76 TCHAR szCurPath
[MAX_PATH
];
77 GetCurrentDirectory (MAX_PATH
, szCurPath
);
78 szRootPath
[0] = szCurPath
[0];
79 _tcsncpy (szLabel
, arg
[0], 12);
84 if (!IsValidPathName (szRootPath
))
86 error_invalid_drive ();
92 GetVolumeInformation(szRootPath
, szOldLabel
, 80, &dwSerialNr
,
95 /* print drive info */
96 if (szOldLabel
[0] != _T('\0'))
98 LoadString(CMD_ModuleHandle
, STRING_LABEL_HELP2
, szMsg
, RC_STRING_MAX_SIZE
);
99 ConOutPrintf(szMsg
, _totupper(szRootPath
[0]), szOldLabel
);
103 LoadString(CMD_ModuleHandle
, STRING_LABEL_HELP3
, szMsg
, RC_STRING_MAX_SIZE
);
104 ConOutPrintf(szMsg
, _totupper(szRootPath
[0]));
107 /* print the volume serial number */
108 LoadString(CMD_ModuleHandle
, STRING_LABEL_HELP4
, szMsg
, RC_STRING_MAX_SIZE
);
109 ConOutPrintf(szMsg
, HIWORD(dwSerialNr
), LOWORD(dwSerialNr
));
111 if (szLabel
[0] == _T('\0'))
113 LoadString(CMD_ModuleHandle
, STRING_LABEL_HELP5
, szMsg
, RC_STRING_MAX_SIZE
);
114 ConOutResPuts(STRING_LABEL_HELP5
);
116 ConInString(szLabel
, 80);
119 SetVolumeLabel(szRootPath
, szLabel
);
126 #endif /* INCLUDE_CMD_LABEL */