Index: /trunk/include/iprt/fs.h
===================================================================
--- /trunk/include/iprt/fs.h	(revision 30364)
+++ /trunk/include/iprt/fs.h	(revision 30365)
@@ -180,21 +180,78 @@
 
 
-/** @name Filesystem type IDs. Used by RTFsQueryType. */
-#define RTFS_FS_TYPE_UNKNOWN            0
-#define RTFS_FS_TYPE_EXT                1
-#define RTFS_FS_TYPE_EXT2               2
-#define RTFS_FS_TYPE_EXT3               3
-#define RTFS_FS_TYPE_EXT4               4
-#define RTFS_FS_TYPE_TMPFS              5
-#define RTFS_FS_TYPE_JFS                6
-#define RTFS_FS_TYPE_NFS                7
-#define RTFS_FS_TYPE_HFS                8
-#define RTFS_FS_TYPE_CIFS               9
-#define RTFS_FS_TYPE_FAT               10
-#define RTFS_FS_TYPE_NTFS              11
-#define RTFS_FS_TYPE_ZFS               12
-#define RTFS_FS_TYPE_XFS               13
-#define RTFS_FS_TYPE_AUTOFS            14
-#define RTFS_FS_TYPE_DEVFS             15
+/**
+ * Filesystem type IDs returned by RTFsQueryType.
+ *
+ * This enum is subject to changes and must not be used as part of any ABI or
+ * binary format (file, network, etc).
+ *
+ * @remarks When adding new entries, please update RTFsTypeName().  Also, try
+ *          add them to the most natural group.
+ */
+typedef enum RTFSTYPE
+{
+    /** Unknown file system. */
+    RTFSTYPE_UNKNOWN = 0,
+
+    /** Universal Disk Format. */
+    RTFSTYPE_UDF,
+    /** ISO 9660, aka Compact Disc File System (CDFS). */
+    RTFSTYPE_ISO9660,
+    /** Filesystem in Userspace. */
+    RTFSTYPE_FUSE,
+    /** VirtualBox shared folders.  */
+    RTFSTYPE_VBOXSHF,
+
+    /* Linux: */
+    RTFSTYPE_EXT,
+    RTFSTYPE_EXT2,
+    RTFSTYPE_EXT3,
+    RTFSTYPE_EXT4,
+    RTFSTYPE_XFS,
+    RTFSTYPE_CIFS,
+    RTFSTYPE_SMBFS,
+    RTFSTYPE_TMPFS,
+    RTFSTYPE_SYSFS,
+    RTFSTYPE_PROC,
+
+    /* Windows: */
+    /** New Technology File System. */
+    RTFSTYPE_NTFS,
+    /** FAT12, FAT16 and FAT32 lumped into one basket.
+     * The partition size limit of FAT12 and FAT16 will be the factor
+     * limiting the file size (except, perhaps for the 64KB cluster case on
+     * non-Windows hosts). */
+    RTFSTYPE_FAT,
+
+    /* Solaris: */
+    /** Zettabyte File System.  */
+    RTFSTYPE_ZFS,
+    /** Unix File System. */
+    RTFSTYPE_UFS,
+    /** Network File System. */
+    RTFSTYPE_NFS,
+
+    /* Mac OS X: */
+    /** Hierarchical File System. */
+    RTFSTYPE_HFS,
+    /** @todo RTFSTYPE_HFS_PLUS? */
+    RTFSTYPE_AUTOFS,
+    RTFSTYPE_DEVFS,
+
+    /* *BSD: */
+
+    /* OS/2: */
+    /** High Performance File System. */
+    RTFSTYPE_HPFS,
+    /** Journaled File System (v2).  */
+    RTFSTYPE_JFS,
+
+    /** The end of valid Filesystem types IDs. */
+    RTFSTYPE_END,
+    /** The usual 32-bit type blow up. */
+    RTFSTYPE_32BIT_HACK = 0x7fffffff
+} RTFSTYPE;
+/** Pointer to a Filesystem type ID. */
+typedef RTFSTYPE *PRTFSTYPE;
 
 
@@ -408,13 +465,24 @@
  *
  * @returns iprt status code.
- * @param   pszFsPath       Path within the mounted filesystem.
- *                          In case this is a symlink, the file it refers to
- *                          is evaluated.
- * @param   pu32Type        Where to store the filesystem type.
- *                          See RTFS_FS_TYPE_xxx constants.
- */
-RTR3DECL(int) RTFsQueryType(const char *pszFsPath, uint32_t *pu32Type);
+ * @param   pszFsPath       Path within the mounted filesystem.  It must exist.
+ *                          In case this is a symlink, the file it refers to is
+ *                          evaluated.
+ * @param   penmType        Where to store the filesystem type, this is always
+ *                          set.  See RTFSTYPE for the values.
+ */
+RTR3DECL(int) RTFsQueryType(const char *pszFsPath, PRTFSTYPE penmType);
 
 #endif /* IN_RING3 */
+
+/**
+ * Gets the name of a filesystem type.
+ *
+ * @returns Pointer to a read-only string containing the name.
+ * @param   enmType         A valid filesystem ID.  If outside the valid range,
+ *                          the returned string will be pointing to a static
+ *                          memory buffer which will be changed on subsequent
+ *                          calls to this function by any thread.
+ */
+RTDECL(const char *) RTFsTypeName(RTFSTYPE enmType);
 
 /**
Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 30364)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 30365)
@@ -2421,8 +2421,9 @@
             hrc = pMachine->COMGETTER(SnapshotFolder)(strSnap.asOutParam());            H();
             Utf8Str utfSnap = Utf8Str(strSnap);
-            uint32_t typeFile, typeSnap;
-            rc = RTFsQueryType(utfFile.c_str(), &typeFile);
+            RTFSTYPE enmFsTypeFile;
+            RTFSTYPE enmFsTypeSnap;
+            rc = RTFsQueryType(utfFile.c_str(), &enmFsTypeFile);
             if (RT_SUCCESS(rc))
-                rc = RTFsQueryType(utfSnap.c_str(), &typeSnap);
+                rc = RTFsQueryType(utfSnap.c_str(), &enmFsTypeSnap);
             ULONG64 u64Size;
             hrc = pMedium->COMGETTER(LogicalSize)(&u64Size);                            H();
@@ -2431,5 +2432,5 @@
             {
 #ifdef RT_OS_WINDOWS
-                if (   typeFile == RTFS_FS_TYPE_FAT
+                if (   enmFsTypeFile == RTFSTYPE_FAT
                     && u64Size >= _4G)
                 {
@@ -2446,9 +2447,9 @@
                 }
 #else /* !RT_OS_WINDOWS */
-                if (   typeFile == RTFS_FS_TYPE_FAT
-                    || typeFile == RTFS_FS_TYPE_EXT
-                    || typeFile == RTFS_FS_TYPE_EXT2
-                    || typeFile == RTFS_FS_TYPE_EXT3
-                    || typeFile == RTFS_FS_TYPE_EXT4)
+                if (   enmFsTypeFile == RTFSTYPE_FAT
+                    || enmFsTypeFile == RTFSTYPE_EXT
+                    || enmFsTypeFile == RTFSTYPE_EXT2
+                    || enmFsTypeFile == RTFSTYPE_EXT3
+                    || enmFsTypeFile == RTFSTYPE_EXT4)
                 {
                     RTFILE file;
@@ -2486,5 +2487,5 @@
                  * Here we test only for a FAT partition as we had to create a dummy file otherwise
                  */
-                if (   typeSnap == RTFS_FS_TYPE_FAT
+                if (   enmFsTypeSnap == RTFSTYPE_FAT
                     && u64Size >= _4G
                     && !mfSnapshotFolderSizeWarningShown)
@@ -2522,6 +2523,6 @@
                 if (   (uCaps & MediumFormatCapabilities_Asynchronous)
                     && !fUseHostIOCache
-                    && (   typeFile == RTFS_FS_TYPE_EXT4
-                        || typeFile == RTFS_FS_TYPE_XFS))
+                    && (   enmFsTypeFile == RTFSTYPE_EXT4
+                        || enmFsTypeFile == RTFSTYPE_XFS))
                 {
                     setVMRuntimeErrorCallbackF(pVM, this, 0,
@@ -2536,11 +2537,11 @@
                                "onto a different file system.\n"
                                "The host I/O cache will now be enabled for this medium"),
-                            strFile.raw(), typeFile == RTFS_FS_TYPE_EXT4 ? "ext4" : "xfs");
+                            strFile.raw(), enmFsTypeFile == RTFSTYPE_EXT4 ? "ext4" : "xfs");
                     fUseHostIOCache = true;
                 }
                 else if (   (uCaps & MediumFormatCapabilities_Asynchronous)
                          && !fUseHostIOCache
-                         && (   typeSnap == RTFS_FS_TYPE_EXT4
-                             || typeSnap == RTFS_FS_TYPE_XFS)
+                         && (   enmFsTypeSnap == RTFSTYPE_EXT4
+                             || enmFsTypeSnap == RTFSTYPE_XFS)
                          && !mfSnapshotFolderExt4WarningShown)
                 {
@@ -2556,5 +2557,5 @@
                                "onto a different file system.\n"
                                "The host I/O cache will now be enabled for this medium"),
-                            typeSnap == RTFS_FS_TYPE_EXT4 ? "ext4" : "xfs");
+                            enmFsTypeSnap == RTFSTYPE_EXT4 ? "ext4" : "xfs");
                     fUseHostIOCache = true;
                     mfSnapshotFolderExt4WarningShown = true;
Index: /trunk/src/VBox/Runtime/r3/fs.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/fs.cpp	(revision 30364)
+++ /trunk/src/VBox/Runtime/r3/fs.cpp	(revision 30365)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -40,9 +40,12 @@
 
 #include <iprt/fs.h>
+#include "internal/iprt.h"
+
+#include <iprt/asm.h>
 #include <iprt/assert.h>
+#include <iprt/ctype.h>
+#include <iprt/path.h>
+#include <iprt/string.h>
 #include <iprt/time.h>
-#include <iprt/string.h>
-#include <iprt/path.h>
-#include <iprt/ctype.h>
 #include "internal/fs.h"
 
@@ -292,4 +295,52 @@
     pObjInfo->Attr.u.Unix.Device          = pStat->st_rdev;
 }
-
 #endif /* !RT_OS_WINDOWS */
+
+
+RTDECL(const char *) RTFsTypeName(RTFSTYPE enmType)
+{
+    switch (enmType)
+    {
+        case RTFSTYPE_UNKNOWN:      return "unknown";
+        case RTFSTYPE_UDF:          return "udf";
+        case RTFSTYPE_ISO9660:      return "iso9660";
+        case RTFSTYPE_FUSE:         return "fuse";
+        case RTFSTYPE_VBOXSHF:      return "vboxshf";
+
+        case RTFSTYPE_EXT:          return "ext";
+        case RTFSTYPE_EXT2:         return "ext2";
+        case RTFSTYPE_EXT3:         return "ext3";
+        case RTFSTYPE_EXT4:         return "ext4";
+        case RTFSTYPE_XFS:          return "xfs";
+        case RTFSTYPE_CIFS:         return "cifs";
+        case RTFSTYPE_SMBFS:        return "smbfs";
+        case RTFSTYPE_TMPFS:        return "tmpfs";
+        case RTFSTYPE_SYSFS:        return "sysfs";
+        case RTFSTYPE_PROC:         return "proc";
+
+        case RTFSTYPE_NTFS:         return "ntfs";
+        case RTFSTYPE_FAT:          return "fat";
+
+        case RTFSTYPE_ZFS:          return "zfs";
+        case RTFSTYPE_UFS:          return "ufs";
+        case RTFSTYPE_NFS:          return "nfs";
+
+        case RTFSTYPE_HFS:          return "hfs";
+        case RTFSTYPE_AUTOFS:       return "autofs";
+        case RTFSTYPE_DEVFS:        return "devfs";
+
+        case RTFSTYPE_HPFS:         return "hpfs";
+        case RTFSTYPE_JFS:          return "jfs";
+
+        case RTFSTYPE_END:          return "end";
+        case RTFSTYPE_32BIT_HACK:   break;
+    }
+
+    /* Don't put this in as 'default:', we wish GCC to warn about missing cases. */
+    static char                 s_asz[4][64];
+    static uint32_t volatile    s_i = 0;
+    uint32_t i = ASMAtomicIncU32(&s_i) % RT_ELEMENTS(s_asz);
+    RTStrPrintf(s_asz[i], sizeof(s_asz[i]), "type=%d", enmType);
+    return s_asz[i];
+}
+
Index: /trunk/src/VBox/Runtime/r3/posix/fs-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/fs-posix.cpp	(revision 30364)
+++ /trunk/src/VBox/Runtime/r3/posix/fs-posix.cpp	(revision 30365)
@@ -171,10 +171,13 @@
 
 
-RTR3DECL(int) RTFsQueryType(const char *pszFsPath, uint32_t *pu32Type)
-{
+RTR3DECL(int) RTFsQueryType(const char *pszFsPath, PRTFSTYPE penmType)
+{
+    *penmType = RTFSTYPE_UNKNOWN;
+
     /*
      * Validate input.
      */
-    AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER);
+    AssertReturn(*pszFsPath, VERR_INVALID_PARAMETER);
 
     /*
@@ -186,6 +189,4 @@
     if (RT_SUCCESS(rc))
     {
-        *pu32Type = RTFS_FS_TYPE_UNKNOWN;
-
         struct stat Stat;
         if (!stat(pszNativeFsPath, &Stat))
@@ -197,7 +198,7 @@
             if (mounted)
             {
-                char szBuf[1024];
-                struct stat mntStat;
-                struct mntent mntEnt;
+                char            szBuf[1024];
+                struct stat     mntStat;
+                struct mntent   mntEnt;
                 while (getmntent_r(mounted, &mntEnt, szBuf, sizeof(szBuf)))
                 {
@@ -207,18 +208,45 @@
                         {
                             if (!strcmp("ext4", mntEnt.mnt_type))
-                                *pu32Type = RTFS_FS_TYPE_EXT4;
+                                *penmType = RTFSTYPE_EXT4;
                             else if (!strcmp("ext3", mntEnt.mnt_type))
-                                *pu32Type = RTFS_FS_TYPE_EXT3;
+                                *penmType = RTFSTYPE_EXT3;
                             else if (!strcmp("ext2", mntEnt.mnt_type))
-                                *pu32Type = RTFS_FS_TYPE_EXT2;
+                                *penmType = RTFSTYPE_EXT2;
+                            else if (!strcmp("jfs", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_JFS;
                             else if (!strcmp("xfs", mntEnt.mnt_type))
-                                *pu32Type = RTFS_FS_TYPE_XFS;
+                                *penmType = RTFSTYPE_XFS;
                             else if (   !strcmp("vfat", mntEnt.mnt_type)
                                      || !strcmp("msdos", mntEnt.mnt_type))
-                                *pu32Type = RTFS_FS_TYPE_FAT;
+                                *penmType = RTFSTYPE_FAT;
+                            else if (!strcmp("ntfs", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_NTFS;
+                            else if (!strcmp("hpfs", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_HPFS;
+                            else if (!strcmp("ufs", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_UFS;
                             else if (!strcmp("tmpfs", mntEnt.mnt_type))
-                                *pu32Type = RTFS_FS_TYPE_TMPFS;
+                                *penmType = RTFSTYPE_TMPFS;
                             else if (!strcmp("hfsplus", mntEnt.mnt_type))
-                                *pu32Type = RTFS_FS_TYPE_HFS;
+                                *penmType = RTFSTYPE_HFS;
+                            else if (!strcmp("udf", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_UDF;
+                            else if (!strcmp("iso9660", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_ISO9660;
+                            else if (!strcmp("smbfs", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_SMBFS;
+                            else if (!strcmp("cifs", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_CIFS;
+                            else if (!strcmp("nfs", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_NFS;
+                            else if (!strcmp("nfs4", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_NFS;
+                            else if (!strcmp("sysfs", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_SYSFS;
+                            else if (!strcmp("proc", mntEnt.mnt_type))
+                                *penmType = RTFSTYPE_PROC;
+                            else if (   !strcmp("fuse", mntEnt.mnt_type)
+                                     || !strncmp("fuse.", mntEnt.mnt_type, 5))
+                                *penmType = RTFSTYPE_FUSE;
                             else
                             {
@@ -232,7 +260,13 @@
                 endmntent(mounted);
             }
+
 #elif defined(RT_OS_SOLARIS)
             if (!strcmp("zfs", Stat.st_fstype))
-                *pu32Type = RTFS_FS_TYPE_ZFS;
+                *penmType = RTFSTYPE_ZFS;
+            else if (!strcmp("ufs", Stat.st_fstype))
+                *penmType = RTFSTYPE_UFS;
+            else if (!strcmp("nfs", Stat.st_fstype))
+                *penmType = RTFSTYPE_NFS;
+
 #elif defined(RT_OS_DARWIN)
             struct statfs statfsBuf;
@@ -240,16 +274,16 @@
             {
                 if (!strcmp("hfs", statfsBuf.f_fstypename))
-                    *pu32Type = RTFS_FS_TYPE_HFS;
+                    *penmType = RTFSTYPE_HFS;
                 else if (   !strcmp("fat", statfsBuf.f_fstypename)
                          || !strcmp("msdos", statfsBuf.f_fstypename))
-                    *pu32Type = RTFS_FS_TYPE_FAT;
+                    *penmType = RTFSTYPE_FAT;
                 else if (!strcmp("ntfs", statfsBuf.f_fstypename))
-                    *pu32Type = RTFS_FS_TYPE_NTFS;
+                    *penmType = RTFSTYPE_NTFS;
                 else if (!strcmp("autofs", statfsBuf.f_fstypename))
-                    *pu32Type = RTFS_FS_TYPE_AUTOFS;
+                    *penmType = RTFSTYPE_AUTOFS;
                 else if (!strcmp("devfs", statfsBuf.f_fstypename))
-                    *pu32Type = RTFS_FS_TYPE_DEVFS;
+                    *penmType = RTFSTYPE_DEVFS;
                 else if (!strcmp("nfs", statfsBuf.f_fstypename))
-                    *pu32Type = RTFS_FS_TYPE_NFS;
+                    *penmType = RTFSTYPE_NFS;
             }
             else
Index: /trunk/src/VBox/Runtime/r3/win/fs-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/fs-win.cpp	(revision 30364)
+++ /trunk/src/VBox/Runtime/r3/win/fs-win.cpp	(revision 30365)
@@ -334,51 +334,78 @@
 }
 
-RTR3DECL(int) RTFsQueryType(const char *pszFsPath, uint32_t *pu32Type)
-{
-    int rc = VINF_SUCCESS;
-
-    *pu32Type = RTFS_FS_TYPE_UNKNOWN;
-
-    HANDLE hFile = CreateFile(pszFsPath,
-                              GENERIC_READ,
-                              FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
-                              NULL,
-                              OPEN_EXISTING,
-                              FILE_FLAG_BACKUP_SEMANTICS,
-                              NULL);
-    if (hFile != INVALID_HANDLE_VALUE)
-    {
-        char abBuf[8192];
-        IO_STATUS_BLOCK Ios;
-        NTSTATUS rcNt = NtQueryVolumeInformationFile(hFile, &Ios,
-                                                     abBuf, sizeof(abBuf),
-                                                     FileFsAttributeInformation);
-        if (rcNt >= 0)
-        {
-            PFILE_FS_ATTRIBUTE_INFORMATION pFsAttrInfo = (PFILE_FS_ATTRIBUTE_INFORMATION)abBuf;
-            if (   pFsAttrInfo->FileSystemName[0] == 'N'
-                && pFsAttrInfo->FileSystemName[1] == 'T'
-                && pFsAttrInfo->FileSystemName[2] == 'F'
-                && pFsAttrInfo->FileSystemName[3] == 'S'
-                && pFsAttrInfo->FileSystemName[4] == '\0')
-                *pu32Type = RTFS_FS_TYPE_NTFS;
-            else if (   pFsAttrInfo->FileSystemName[0] == 'F'
-                     && pFsAttrInfo->FileSystemName[1] == 'A'
-                     && pFsAttrInfo->FileSystemName[2] == 'T'
-                     && (   (   pFsAttrInfo->FileSystemName[3] == '3'
-                             && pFsAttrInfo->FileSystemName[4] == '2'
-                             && pFsAttrInfo->FileSystemName[5] == '\0')
-                         || pFsAttrInfo->FileSystemName[3] == '\0'))
-                /* This is either FAT32 or FAT12/16. IMO it doesn't make
-                 * sense to distinguish more detailed because we cannot
-                 * easily distinguish between these FAT types on Linux
-                 * and users who put some image file on an FAT16 partition
-                 * should know what they are doing. */
-                *pu32Type = RTFS_FS_TYPE_FAT;
+
+/**
+ * Internal helper for comparing a WCHAR string with a char string.
+ *
+ * @returns 0 if equal, -1 if @a psz1 < @a psz2, 1 if @a psz1 < @a psz2.
+ * @param   pwsz1               The first string.
+ * @param   psz2                The second string.
+ */
+static int rtFsWinCmpUtf16(WCHAR const *pwsz1, const char *psz2)
+{
+    for (;;)
+    {
+        unsigned ch1 = *pwsz1++;
+        unsigned ch2 = (unsigned char)*psz2++;
+        if (ch1 != ch2)
+            return ch1 < ch2 ? -1 : 1;
+        if (!ch1)
+            return 0;
+    }
+}
+
+
+RTR3DECL(int) RTFsQueryType(const char *pszFsPath, PRTFSTYPE penmType)
+{
+    *penmType = RTFSTYPE_UNKNOWN;
+
+    AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER);
+    AssertReturn(*pszFsPath, VERR_INVALID_PARAMETER);
+
+    /*
+     * Convert the path and try open it.
+     */
+    PRTUTF16 pwszFsPath;
+    int rc = RTStrToUtf16(pszFsPath, &pwszFsPath);
+    if (RT_SUCCESS(rc))
+    {
+        HANDLE hFile = CreateFileW(pwszFsPath,
+                                   GENERIC_READ,
+                                   FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+                                   NULL,
+                                   OPEN_EXISTING,
+                                   FILE_FLAG_BACKUP_SEMANTICS,
+                                   NULL);
+        if (hFile != INVALID_HANDLE_VALUE)
+        {
+            /*
+             * Use the NT api directly to get the file system name.
+             */
+            char            abBuf[8192];
+            IO_STATUS_BLOCK Ios;
+            NTSTATUS        rcNt = NtQueryVolumeInformationFile(hFile, &Ios,
+                                                                abBuf, sizeof(abBuf),
+                                                                FileFsAttributeInformation);
+            if (rcNt >= 0)
+            {
+                PFILE_FS_ATTRIBUTE_INFORMATION pFsAttrInfo = (PFILE_FS_ATTRIBUTE_INFORMATION)abBuf;
+
+                if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "NTFS"))
+                    *penmType = RTFSTYPE_NTFS;
+                else if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "FAT"))
+                    *penmType = RTFSTYPE_FAT;
+                else if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "FAT32"))
+                    *penmType = RTFSTYPE_FAT;
+                else if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "VBoxSharedFolderFS"))
+                    *penmType = RTFSTYPE_VBOXSHF;
+            }
+            else
+                rc = RTErrConvertFromNtStatus(rcNt);
+            CloseHandle(hFile);
         }
-        /* else: Is RTFS_FS_UNKNOWN suffient or should we return an error? */
-        CloseHandle(hFile);
-    }
-
+        else
+            rc = RTErrConvertFromWin32(GetLastError());
+        RTUtf16Free(pwszFsPath);
+    }
     return rc;
 }
Index: /trunk/src/VBox/Runtime/testcase/tstRTFsQueries.cpp
===================================================================
--- /trunk/src/VBox/Runtime/testcase/tstRTFsQueries.cpp	(revision 30364)
+++ /trunk/src/VBox/Runtime/testcase/tstRTFsQueries.cpp	(revision 30365)
@@ -77,37 +77,12 @@
         }
 
-        uint32_t u32Type;
-        rc = RTFsQueryType(argv[i], &u32Type);
-        if (RT_FAILURE(rc))
+        RTFSTYPE enmType;
+        rc = RTFsQueryType(argv[i], &enmType);
+        if (RT_SUCCESS(rc))
+            RTPrintf("tstRTFsQueries: file system type is '%s'\n", RTFsTypeName(enmType));
+        else
         {
             RTPrintf("tstRTFsQueries: RTFsQueryType failed, rc=%Rrc\n", rc);
             cErrors++;
-        }
-        else
-        {
-            static const char *s_apszType[] =
-            {
-                "unknown",
-                "ext",
-                "ext2",
-                "ext3",
-                "ext4",
-                "tmpfs",
-                "jfs",
-                "nfs",
-                "hfs",
-                "cifs",
-                "fat",
-                "ntfs",
-                "zfs",
-                "xfs",
-                "autofs",
-                "devfs"
-            };
-
-            if (u32Type < RT_ELEMENTS(s_apszType))
-                RTPrintf("tstRTFsQueries: file system type is '%s'\n", s_apszType[u32Type]);
-            else
-                RTPrintf("tstRTFsQueries: unknown file system type %d\n", u32Type);
         }
 
