ReactOS  0.4.14-dev-845-g8381e29
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:157
#define TRUE
Definition: types.h:120
VOID error_invalid_drive(VOID)
Definition: error.c:115
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:182
#define GetCurrentDirectory
Definition: winbase.h:3639
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:26
static INT PrintVolumeHeader(LPTSTR pszRootPath)
Definition: vol.c:29
#define _tcsupr
Definition: tchar.h:1467
#define STRING_VOL_HELP4
Definition: resource.h:203
LPCWSTR szPath
Definition: env.c:35
static BOOL IsValidPathName(LPCWSTR pszPath)
Definition: label.c:91
int _tcsncmp(const _TCHAR *s1, const _TCHAR *s2, size_t n)
Definition: tcsncmp.h:9

◆ 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  {
44  ErrorMessage(GetLastError (), _T(""));
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(DWORD dwErrorCode, LPWSTR szFormat,...)
Definition: attrib.c:51
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define STRING_VOL_HELP2
Definition: resource.h:201
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define ConOutResPrintf(uID,...)
Definition: console.h:48
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GetVolumeInformation
Definition: winbase.h:3687
#define HIWORD(l)
Definition: typedefs.h:246
#define STRING_VOL_HELP1
Definition: resource.h:200
#define STRING_VOL_HELP3
Definition: resource.h:202
#define LOWORD(l)
Definition: pedump.c:82

Referenced by cmd_vol().