ReactOS 0.4.15-dev-5672-gf73ac17
free.c File Reference
#include "precomp.h"
Include dependency graph for free.c:

Go to the source code of this file.

Functions

static VOID PrintDiskInfo (LPTSTR szDisk)
 
INT CommandFree (LPTSTR param)
 

Function Documentation

◆ CommandFree()

INT CommandFree ( LPTSTR  param)

Definition at line 86 of file free.c.

87{
88 LPTSTR szParam;
89 TCHAR szDefPath[MAX_PATH];
90 INT argc, i;
91 LPTSTR *arg;
92
93 if (!_tcsncmp (param, _T("/?"), 2))
94 {
96 return 0;
97 }
98
99 if (!param || *param == _T('\0'))
100 {
101 GetCurrentDirectory (MAX_PATH, szDefPath);
102 szDefPath[2] = _T('\0');
103 szParam = szDefPath;
104 }
105 else
106 szParam = param;
107
108 arg = split (szParam, &argc, FALSE, FALSE);
109
110 for (i = 0; i < argc; i++)
112
113 freep (arg);
114
115 return 0;
116}
static int argc
Definition: ServiceArgs.c:12
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:182
#define STRING_FREE_HELP2
Definition: resource.h:131
static VOID freep(LPSTR *p)
Definition: cmdcons.c:98
static LPSTR * split(LPSTR s, LPINT args)
Definition: cmdcons.c:163
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
static VOID PrintDiskInfo(LPTSTR szDisk)
Definition: free.c:19
GLfloat param
Definition: glext.h:5796
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _tcsncmp
Definition: tchar.h:1428
int32_t INT
Definition: typedefs.h:58
#define _T(x)
Definition: vfdio.h:22
#define GetCurrentDirectory
Definition: winbase.h:3676
void * arg
Definition: msvc.h:10
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192

◆ PrintDiskInfo()

static VOID PrintDiskInfo ( LPTSTR  szDisk)
static

Definition at line 19 of file free.c.

20{
22 TCHAR szRootPath[4] = _T("A:\\");
23 TCHAR szDrive[2] = _T("A");
24 TCHAR szVolume[64];
25 TCHAR szSerial[10];
26 TCHAR szTotal[40];
27 TCHAR szUsed[40];
28 TCHAR szFree[40];
29 DWORD dwSerial;
30 ULONGLONG uliSize;
31 DWORD dwSecPerCl;
32 DWORD dwBytPerSec;
33 DWORD dwFreeCl;
34 DWORD dwTotCl;
35
36 if (_tcslen (szDisk) < 2 || szDisk[1] != _T(':'))
37 {
39 return;
40 }
41
42 szRootPath[0] = szDisk[0];
43 szDrive[0] = _totupper (szRootPath[0]);
44
45 if (!GetVolumeInformation (szRootPath, szVolume, 64, &dwSerial,
46 NULL, NULL, NULL, 0))
47 {
49 ConErrPrintf(_T("%s %s:\n"), szMsg, szDrive);
50 return;
51 }
52
53 if (szVolume[0] == _T('\0'))
54 {
55
57 _tcscpy (szVolume, szMsg);
58 }
59
60 _stprintf (szSerial,
61 _T("%04X-%04X"),
62 HIWORD(dwSerial),
63 LOWORD(dwSerial));
64
65 if (!GetDiskFreeSpace (szRootPath, &dwSecPerCl,
66 &dwBytPerSec, &dwFreeCl, &dwTotCl))
67 {
69 ConErrPrintf(_T("%s %s:\n"), szMsg, szDrive);
70 return;
71 }
72
73 uliSize = dwSecPerCl * dwBytPerSec * (ULONGLONG)dwTotCl;
74 ConvertULargeInteger(uliSize, szTotal, 40, TRUE);
75
76 uliSize = dwSecPerCl * dwBytPerSec * (ULONGLONG)(dwTotCl - dwFreeCl);
77 ConvertULargeInteger(uliSize, szUsed, 40, TRUE);
78
79 uliSize = dwSecPerCl * dwBytPerSec * (ULONGLONG)dwFreeCl;
80 ConvertULargeInteger(uliSize, szFree, 40, TRUE);
81
82 ConOutResPrintf(STRING_FREE_HELP1, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
83}
#define RC_STRING_MAX_SIZE
Definition: resource.h:3
HANDLE CMD_ModuleHandle
Definition: cmd.c:165
INT ConvertULargeInteger(ULONGLONG num, LPTSTR des, UINT len, BOOL bPutSeparator)
Definition: cmd.c:189
#define ConErrPrintf(szStr,...)
Definition: console.h:45
#define ConOutResPrintf(uID,...)
Definition: console.h:48
#define ConErrResPrintf(uID,...)
Definition: console.h:51
#define STRING_FREE_ERROR2
Definition: resource.h:50
#define STRING_FREE_HELP1
Definition: resource.h:130
#define STRING_FREE_ERROR1
Definition: resource.h:49
#define NULL
Definition: types.h:112
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
unsigned long DWORD
Definition: ntddk_ex.h:95
#define _tcscpy
Definition: tchar.h:623
#define _totupper
Definition: tchar.h:1509
#define _stprintf
Definition: utility.h:124
#define LOWORD(l)
Definition: pedump.c:82
uint64_t ULONGLONG
Definition: typedefs.h:67
#define HIWORD(l)
Definition: typedefs.h:247
#define GetVolumeInformation
Definition: winbase.h:3724
#define GetDiskFreeSpace
Definition: winbase.h:3678
#define LoadString
Definition: winuser.h:5809
#define _tcslen
Definition: xmlstorage.h:198

Referenced by CommandFree().