ReactOS 0.4.15-dev-7906-g1b85a5f
vol.c
Go to the documentation of this file.
1/*
2 * VOL.C - vol internal command.
3 *
4 *
5 * History:
6 *
7 * 03-Dec-1998 (Eric Kohl)
8 * Replaced DOS calls by Win32 calls.
9 *
10 * 08-Dec-1998 (Eric Kohl)
11 * Added help text ("/?").
12 *
13 * 07-Jan-1999 (Eric Kohl)
14 * Cleanup.
15 *
16 * 18-Jan-1999 (Eric Kohl)
17 * Unicode ready!
18 *
19 * 20-Jan-1999 (Eric Kohl)
20 * Redirection ready!
21 */
22
23#include "precomp.h"
24
25#ifdef INCLUDE_CMD_VOL
26
27
28static INT
30{
31 TCHAR szVolName[80];
32 DWORD dwSerialNr;
33
34 /* get the volume information of the drive */
35 if (!GetVolumeInformation(pszRootPath,
36 szVolName,
37 80,
38 &dwSerialNr,
39 NULL,
40 NULL,
41 NULL,
42 0))
43 {
45 return 1;
46 }
47
48 /* print drive info */
49 if (szVolName[0] != '\0')
50 {
51 ConOutResPrintf(STRING_VOL_HELP1, pszRootPath[0],szVolName);
52 }
53 else
54 {
55 ConOutResPrintf(STRING_VOL_HELP2, pszRootPath[0]);
56 }
57
58 /* print the volume serial number */
59 ConOutResPrintf(STRING_VOL_HELP3, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
60 return 0;
61}
62
63
65{
66 TCHAR szRootPath[] = _T("A:\\");
68
69 if (!_tcsncmp(param, _T("/?"), 2))
70 {
72 return 0;
73 }
74
75 nErrorLevel = 0;
76
77 if (param[0] == _T('\0'))
78 {
80 szRootPath[0] = szPath[0];
81 }
82 else
83 {
84 _tcsupr (param);
85 if (param[1] == _T(':'))
86 {
87 szRootPath[0] = param[0];
88 }
89 else
90 {
92 nErrorLevel = 1;
93 return 1;
94 }
95 }
96
97 if (!IsValidPathName (szRootPath))
98 {
100 nErrorLevel = 1;
101 return 1;
102 }
103
104 /* print the header */
105 if (!PrintVolumeHeader (szRootPath))
106 {
107 nErrorLevel = 1;
108 return 1;
109 }
110
111 return 0;
112}
113
114#endif
static VOID ErrorMessage(_In_ DWORD dwErrorCode, _In_opt_ PCWSTR pszMsg,...)
Definition: attrib.c:33
INT nErrorLevel
Definition: cmd.c:158
VOID error_invalid_drive(VOID)
Definition: error.c:117
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:182
#define ConOutResPrintf(uID,...)
Definition: console.h:47
#define STRING_VOL_HELP1
Definition: resource.h:200
#define STRING_VOL_HELP4
Definition: resource.h:203
#define STRING_VOL_HELP3
Definition: resource.h:202
#define STRING_VOL_HELP2
Definition: resource.h:201
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat param
Definition: glext.h:5796
#define _tcsupr
Definition: tchar.h:1467
#define _tcsncmp
Definition: tchar.h:1428
static BOOL IsValidPathName(LPCWSTR pszPath)
Definition: label.c:91
LPCWSTR szPath
Definition: env.c:37
#define LOWORD(l)
Definition: pedump.c:82
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define _T(x)
Definition: vfdio.h:22
INT cmd_vol(LPTSTR param)
Definition: vol.c:64
static INT PrintVolumeHeader(LPTSTR pszRootPath)
Definition: vol.c:29
#define GetVolumeInformation
Definition: winbase.h:3853
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetCurrentDirectory
Definition: winbase.h:3805
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192