Author: pschweitzer
Date: Wed Sep 20 11:41:28 2017
New Revision: 75913
URL:
http://svn.reactos.org/svn/reactos?rev=75913&view=rev
Log:
[FSUTIL]
Implement fsutil volume diskfree
Modified:
trunk/reactos/base/applications/cmdutils/fsutil/volume.c
Modified: trunk/reactos/base/applications/cmdutils/fsutil/volume.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/fsutil/volume.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/cmdutils/fsutil/volume.c [iso-8859-1] Wed Sep 20
11:41:28 2017
@@ -10,10 +10,12 @@
/* Add handlers here for subcommands */
static HandlerProc DismountMain;
+static HandlerProc DiskFreeMain;
static HandlerItem HandlersList[] =
{
/* Proc, name, help */
{ DismountMain, _T("dismount"), _T("Dismounts a volume") },
+ { DiskFreeMain, _T("diskfree"), _T("Prints free space on a
volume") },
};
static int
@@ -80,6 +82,32 @@
return 0;
}
+static int
+DiskFreeMain(int argc, const TCHAR *argv[])
+{
+ ULARGE_INTEGER FreeAvail, TotalNumber, TotalNumberFree;
+
+ /* We need a path */
+ if (argc < 2)
+ {
+ _ftprintf(stderr, _T("Usage: fsutil volume diskfree <volume
path>\n"));
+ _ftprintf(stderr, _T("\tFor example: fsutil volume diskfree c:\n"));
+ return 1;
+ }
+
+ if (!GetDiskFreeSpaceEx(argv[1], &FreeAvail, &TotalNumber,
&TotalNumberFree))
+ {
+ PrintErrorMessage(GetLastError());
+ return 1;
+ }
+
+ _ftprintf(stdout, _T("Total free bytes\t\t: %I64i\n"),
TotalNumberFree.QuadPart);
+ _ftprintf(stdout, _T("Total bytes\t\t\t: %I64i\n"), TotalNumber.QuadPart);
+ _ftprintf(stdout, _T("Total free available bytes\t: %I64i\n"),
FreeAvail.QuadPart);
+
+ return 0;
+}
+
static void
PrintUsage(const TCHAR * Command)
{