Author: pschweitzer
Date: Wed Sep 6 15:32:02 2017
New Revision: 75774
URL:
http://svn.reactos.org/svn/reactos?rev=75774&view=rev
Log:
[FSUTIL]
Implement fsutil fsinfo drives and fsutil fsinfo drivetype
Added:
trunk/reactos/base/applications/cmdutils/fsutil/fsinfo.c (with props)
Modified:
trunk/reactos/base/applications/cmdutils/fsutil/CMakeLists.txt
trunk/reactos/base/applications/cmdutils/fsutil/fsutil.c
Modified: trunk/reactos/base/applications/cmdutils/fsutil/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/fsutil/CMakeLists.txt [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/cmdutils/fsutil/CMakeLists.txt [iso-8859-1] Wed Sep 6
15:32:02 2017
@@ -1,6 +1,7 @@
list(APPEND SOURCE
common.c
dirty.c
+ fsinfo.c
fsutil.c
fsutil.h)
add_executable(fsutil ${SOURCE} fsutil.rc)
Added: trunk/reactos/base/applications/cmdutils/fsutil/fsinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/fsutil/fsinfo.c (added)
+++ trunk/reactos/base/applications/cmdutils/fsutil/fsinfo.c [iso-8859-1] Wed Sep 6
15:32:02 2017
@@ -0,0 +1,109 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS FS utility tool
+ * FILE: base/applications/cmdutils/fsinfo.c
+ * PURPOSE: FSutil file systems information
+ * PROGRAMMERS: Pierre Schweitzer <pierre(a)reactos.org>
+ */
+
+/* Add handlers here for subcommands */
+static int DrivesMain(int argc, const TCHAR *argv[]);
+static int DriveTypeMain(int argc, const TCHAR *argv[]);
+static HandlerItem HandlersList[] =
+{
+ /* Proc, name, help */
+ { DrivesMain, _T("drives"), _T("Enumerates the drives") },
+ { DriveTypeMain, _T("drivetype"), _T("Provides the type of a
drive") },
+};
+
+static int
+DrivesMain(int argc, const TCHAR *argv[])
+{
+ UINT i;
+ DWORD Drives;
+
+ /* Get the drives bitmap */
+ Drives = GetLogicalDrives();
+ if (Drives == 0)
+ {
+ _ftprintf(stderr, _T("Error: %d\n"), GetLastError());
+ return 1;
+ }
+
+ /* And output any found drive */
+ _ftprintf(stdout, _T("Drives:"));
+ for (i = 0; i < 26; i++)
+ {
+ if (Drives & (1 << i))
+ {
+ _ftprintf(stdout, _T(" %c:\\"), 'A' + i);
+ }
+ }
+ _ftprintf(stdout, _T("\n"));
+
+ return 0;
+}
+
+static int
+DriveTypeMain(int argc, const TCHAR *argv[])
+{
+ UINT Type;
+
+ /* We need a volume (letter) */
+ if (argc < 2)
+ {
+ _ftprintf(stderr, _T("Usage: fsutil fsinfo drivetype
<volume>\n"));
+ _ftprintf(stderr, _T("\tFor example: fsutil fsinfo drivetype c:\n"));
+ return 1;
+ }
+
+ /* Get its drive type and make it readable */
+ Type = GetDriveType(argv[1]);
+ switch (Type)
+ {
+ case DRIVE_UNKNOWN:
+ _ftprintf(stdout, _T("%s - unknown drive type\n"), argv[1]);
+ break;
+
+ case DRIVE_NO_ROOT_DIR:
+ _ftprintf(stdout, _T("%s - not a root directory\n"), argv[1]);
+ break;
+
+ case DRIVE_REMOVABLE:
+ _ftprintf(stdout, _T("%s - removable drive\n"), argv[1]);
+ break;
+
+ case DRIVE_FIXED:
+ _ftprintf(stdout, _T("%s - fixed drive\n"), argv[1]);
+ break;
+
+ case DRIVE_REMOTE:
+ _ftprintf(stdout, _T("%s - remote or network drive\n"), argv[1]);
+ break;
+
+ case DRIVE_CDROM:
+ _ftprintf(stdout, _T("%s - CD-ROM drive\n"), argv[1]);
+ break;
+
+ case DRIVE_RAMDISK:
+ _ftprintf(stdout, _T("%s - RAM disk drive\n"), argv[1]);
+ break;
+ }
+
+ return 0;
+}
+
+static void
+PrintUsage(const TCHAR * Command)
+{
+ PrintDefaultUsage(_T(" FSINFO "), Command, (HandlerItem
*)&HandlersList,
+ (sizeof(HandlersList) / sizeof(HandlersList[0])));
+}
+
+int
+FsInfoMain(int argc, const TCHAR *argv[])
+{
+ return FindHandler(argc, argv, (HandlerItem *)&HandlersList,
+ (sizeof(HandlersList) / sizeof(HandlersList[0])),
+ PrintUsage);
+}
Propchange: trunk/reactos/base/applications/cmdutils/fsutil/fsinfo.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/base/applications/cmdutils/fsutil/fsutil.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/fsutil/fsutil.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/cmdutils/fsutil/fsutil.c [iso-8859-1] Wed Sep 6
15:32:02 2017
@@ -10,10 +10,12 @@
/* Add handlers here for commands */
int DirtyMain(int argc, const TCHAR *argv[]);
+int FsInfoMain(int argc, const TCHAR *argv[]);
static HandlerItem HandlersList[] =
{
/* Proc, name, help */
{ DirtyMain, _T("dirty"), _T("Manipulates the dirty bit") },
+ { FsInfoMain, _T("fsinfo"), _T("Gathers informations about file
systems") },
};
static void