ReactOS 0.4.15-dev-8093-g3285f69
vol.c File Reference
#include "precomp.h"
Include dependency graph for vol.c:

Go to the source code of this file.

Functions

static INT PrintVolumeHeader (LPTSTR pszRootPath)
 
INT cmd_vol (LPTSTR param)
 

Function Documentation

◆ cmd_vol()

INT cmd_vol ( LPTSTR  param)

Definition at line 64 of file vol.c.

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}
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 STRING_VOL_HELP4
Definition: resource.h:204
#define TRUE
Definition: types.h:120
#define MAX_PATH
Definition: compat.h:34
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 _T(x)
Definition: vfdio.h:22
static INT PrintVolumeHeader(LPTSTR pszRootPath)
Definition: vol.c:29
#define GetCurrentDirectory
Definition: winbase.h:3805
char TCHAR
Definition: xmlstorage.h:189

◆ PrintVolumeHeader()

static INT PrintVolumeHeader ( LPTSTR  pszRootPath)
static

Definition at line 29 of file vol.c.

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}
static VOID ErrorMessage(_In_ DWORD dwErrorCode, _In_opt_ PCWSTR pszMsg,...)
Definition: attrib.c:33
#define ConOutResPrintf(uID,...)
Definition: console.h:47
#define STRING_VOL_HELP1
Definition: resource.h:201
#define STRING_VOL_HELP3
Definition: resource.h:203
#define STRING_VOL_HELP2
Definition: resource.h:202
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LOWORD(l)
Definition: pedump.c:82
#define HIWORD(l)
Definition: typedefs.h:247
#define GetVolumeInformation
Definition: winbase.h:3853
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by cmd_vol().