2 * VOL.C - vol internal command.
7 * 03-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
8 * Replaced DOS calls by Win32 calls.
10 * 08-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
11 * Added help text ("/?").
13 * 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
16 * 18-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
19 * 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
25 #ifdef INCLUDE_CMD_VOL
35 PrintVolumeHeader (LPTSTR pszRootPath
)
40 /* get the volume information of the drive */
41 if(!GetVolumeInformation (pszRootPath
,
50 ErrorMessage (GetLastError (), _T(""));
54 /* print drive info */
55 ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath
[0]);
57 if (szVolName
[0] != '\0')
58 ConOutPrintf (_T(" is %s\n"),
61 ConOutPrintf (_T(" has no label\n"));
63 /* print the volume serial number */
64 ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
71 INT
cmd_vol (LPTSTR cmd
, LPTSTR param
)
73 TCHAR szRootPath
[] = _T("A:\\");
74 TCHAR szPath
[MAX_PATH
];
76 if (!_tcsncmp (param
, _T("/?"), 2))
78 ConOutPuts (_T("Displays the disk volume label and serial number, if they exist.\n\n"
83 if (param
[0] == _T('\0'))
85 GetCurrentDirectory (MAX_PATH
, szPath
);
86 szRootPath
[0] = szPath
[0];
91 if (param
[1] == _T(':'))
92 szRootPath
[0] = param
[0];
95 error_invalid_drive ();
100 if (!IsValidPathName (szRootPath
))
102 error_invalid_drive ();
106 /* print the header */
107 if (!PrintVolumeHeader (szRootPath
))