[CDFS]
authorColin Finck <colin@reactos.org>
Thu, 17 Aug 2017 12:21:27 +0000 (12:21 +0000)
committerColin Finck <colin@reactos.org>
Thu, 17 Aug 2017 12:21:27 +0000 (12:21 +0000)
- Add a basic CDFS filesystem library "cdfslib" for checking and formatting a CDFS volume. Checking is unimplemented and formatting not supported anyway :)
- Use this library in the new "ucdfs" DLL and that DLL in "autochk". Fixes the "Unable to verify a CDFS volume" message at boot.
- Return the right device type (FILE_DEVICE_CD_ROM or FILE_DEVICE_DISK) in when querying volume information in cdfs.sys to get the proper icon in Explorer.

svn path=/trunk/; revision=75591

reactos/base/system/autochk/autochk.c
reactos/dll/win32/CMakeLists.txt
reactos/dll/win32/ucdfs/CMakeLists.txt [new file with mode: 0644]
reactos/dll/win32/ucdfs/ucdfs.c [new file with mode: 0644]
reactos/dll/win32/ucdfs/ucdfs.rc [new file with mode: 0644]
reactos/dll/win32/ucdfs/ucdfs.spec [new file with mode: 0644]
reactos/drivers/filesystems/cdfs/volinfo.c
reactos/sdk/lib/fslib/CMakeLists.txt
reactos/sdk/lib/fslib/cdfslib/CMakeLists.txt [new file with mode: 0644]
reactos/sdk/lib/fslib/cdfslib/cdfslib.c [new file with mode: 0644]

index 6606f26..5ebefb6 100644 (file)
@@ -283,7 +283,11 @@ LoadProvider(
     {
       RtlInitUnicodeString(&ProviderDll, L"uffs.dll");
     }
-    else
+    else if (wcscmp(FileSystem, L"CDFS") == 0)
+    {
+      RtlInitUnicodeString(&ProviderDll, L"ucdfs.dll");
+    }
+    else 
     {
       return NULL;
     }
index 291f5ab..c0a16ad 100644 (file)
@@ -206,6 +206,7 @@ add_subdirectory(themeui)
 add_subdirectory(traffic)
 add_subdirectory(twain_32)
 add_subdirectory(ubtrfs)
+add_subdirectory(ucdfs)
 add_subdirectory(uext2)
 add_subdirectory(ufat)
 add_subdirectory(ufatx)
diff --git a/reactos/dll/win32/ucdfs/CMakeLists.txt b/reactos/dll/win32/ucdfs/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9dfe3ea
--- /dev/null
@@ -0,0 +1,13 @@
+
+spec2def(ucdfs.dll ucdfs.spec)
+
+list(APPEND SOURCE
+    ucdfs.c
+    ucdfs.rc
+    ${CMAKE_CURRENT_BINARY_DIR}/ucdfs.def)
+
+add_library(ucdfs SHARED ${SOURCE})
+set_module_type(ucdfs nativedll)
+target_link_libraries(ucdfs cdfslib)
+add_importlibs(ucdfs ntdll)
+add_cd_file(TARGET ucdfs DESTINATION reactos/system32 FOR all)
diff --git a/reactos/dll/win32/ucdfs/ucdfs.c b/reactos/dll/win32/ucdfs/ucdfs.c
new file mode 100644 (file)
index 0000000..83440d8
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * PROJECT:     CDFS File System Management
+ * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE:     DLL Initialization
+ * COPYRIGHT:   Copyright 2017 Colin Finck <colin@reactos.org>
+ */
+
+#include <windef.h>
+
+INT WINAPI
+DllMain(IN HINSTANCE hinstDLL,
+    IN DWORD dwReason,
+    IN LPVOID lpvReserved)
+{
+    UNREFERENCED_PARAMETER(hinstDLL);
+    UNREFERENCED_PARAMETER(dwReason);
+    UNREFERENCED_PARAMETER(lpvReserved);
+
+    return TRUE;
+}
diff --git a/reactos/dll/win32/ucdfs/ucdfs.rc b/reactos/dll/win32/ucdfs/ucdfs.rc
new file mode 100644 (file)
index 0000000..9c87155
--- /dev/null
@@ -0,0 +1,5 @@
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION  "CDFS File System Management"
+#define REACTOS_STR_INTERNAL_NAME     "ucdfs"
+#define REACTOS_STR_ORIGINAL_FILENAME "ucdfs.dll"
+#include <reactos/version.rc>
diff --git a/reactos/dll/win32/ucdfs/ucdfs.spec b/reactos/dll/win32/ucdfs/ucdfs.spec
new file mode 100644 (file)
index 0000000..5ad590f
--- /dev/null
@@ -0,0 +1,2 @@
+@ stdcall ChkdskEx(ptr long long long long ptr) CdfsChkdsk
+@ stdcall FormatEx(ptr long ptr long long ptr) CdfsFormat
index 8666064..cffaf9f 100644 (file)
@@ -159,7 +159,11 @@ CdfsGetFsDeviceInformation(
     if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
         return STATUS_BUFFER_OVERFLOW;
 
-    FsDeviceInfo->DeviceType = FILE_DEVICE_CD_ROM;
+    if (DeviceObject->DeviceType == FILE_DEVICE_CD_ROM_FILE_SYSTEM)
+        FsDeviceInfo->DeviceType = FILE_DEVICE_CD_ROM;
+    else
+        FsDeviceInfo->DeviceType = FILE_DEVICE_DISK;
+
     FsDeviceInfo->Characteristics = DeviceObject->Characteristics;
 
     DPRINT("FsdGetFsDeviceInformation() finished.\n");
index a2b261f..be804e8 100644 (file)
@@ -1,5 +1,6 @@
 
 add_subdirectory(btrfslib)
+add_subdirectory(cdfslib)
 add_subdirectory(ext2lib)
 add_subdirectory(ffslib)
 add_subdirectory(ntfslib)
diff --git a/reactos/sdk/lib/fslib/cdfslib/CMakeLists.txt b/reactos/sdk/lib/fslib/cdfslib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..963d74c
--- /dev/null
@@ -0,0 +1,3 @@
+
+add_library(cdfslib cdfslib.c)
+add_dependencies(cdfslib psdk)
diff --git a/reactos/sdk/lib/fslib/cdfslib/cdfslib.c b/reactos/sdk/lib/fslib/cdfslib/cdfslib.c
new file mode 100644 (file)
index 0000000..296ac66
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * PROJECT:     ReactOS CDFS library
+ * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE:     Checking and Formatting CDFS volumes
+ * COPYRIGHT:   Copyright 2017 Colin Finck <colin@reactos.org>
+ */
+
+#define NTOS_MODE_USER
+#include <ndk/umtypes.h>
+#include <fmifs/fmifs.h>
+
+#define NDEBUG
+#include <debug.h>
+
+NTSTATUS NTAPI
+CdfsChkdsk(IN PUNICODE_STRING DriveRoot,
+    IN BOOLEAN FixErrors,
+    IN BOOLEAN Verbose,
+    IN BOOLEAN CheckOnlyIfDirty,
+    IN BOOLEAN ScanDrive,
+    IN PFMIFSCALLBACK Callback)
+{
+    UNIMPLEMENTED;
+    return STATUS_SUCCESS;
+}
+
+NTSTATUS NTAPI
+CdfsFormat(IN PUNICODE_STRING DriveRoot,
+    IN FMIFS_MEDIA_FLAG MediaFlag,
+    IN PUNICODE_STRING Label,
+    IN BOOLEAN QuickFormat,
+    IN ULONG ClusterSize,
+    IN PFMIFSCALLBACK Callback)
+{
+    // Not possible for CDFS (ISO-9660).
+    return STATUS_NOT_SUPPORTED;
+}