[NPFS/NPFS_NEW]
[reactos.git] / reactos / drivers / filesystems / npfs / main.c
1 /*
2 * PROJECT: ReactOS Named Pipe FileSystem
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/filesystems/npfs/main.c
5 * PURPOSE: Named Pipe FileSystem Driver Initialization
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #include "npfs.h"
12
13 // File ID number for NPFS bugchecking support
14 #define NPFS_BUGCHECK_FILE_ID (NPFS_BUGCHECK_MAIN)
15
16 /* GLOBALS ********************************************************************/
17
18 PDEVICE_OBJECT NpfsDeviceObject;
19
20 /* FUNCTIONS ******************************************************************/
21
22 NTSTATUS
23 NTAPI
24 NpFsdDirectoryControl(IN PDEVICE_OBJECT DeviceObject,
25 IN PIRP Irp)
26 {
27 UNIMPLEMENTED;
28
29 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
30 Irp->IoStatus.Information = 0;
31
32 IoCompleteRequest(Irp, IO_NO_INCREMENT);
33 return STATUS_NOT_IMPLEMENTED;
34 }
35
36 NTSTATUS
37 NTAPI
38 DriverEntry(IN PDRIVER_OBJECT DriverObject,
39 IN PUNICODE_STRING RegistryPath)
40 {
41 PDEVICE_OBJECT DeviceObject;
42 UNICODE_STRING DeviceName;
43 NTSTATUS Status;
44 UNREFERENCED_PARAMETER(RegistryPath);
45
46 DPRINT1("Next-Generation NPFS-Lite\n");
47
48 DriverObject->MajorFunction[IRP_MJ_CREATE] = NpFsdCreate;
49 DriverObject->MajorFunction[IRP_MJ_CREATE_NAMED_PIPE] = NpFsdCreateNamedPipe;
50 DriverObject->MajorFunction[IRP_MJ_CLOSE] = NpFsdClose;
51 DriverObject->MajorFunction[IRP_MJ_READ] = NpFsdRead;
52 DriverObject->MajorFunction[IRP_MJ_WRITE] = NpFsdWrite;
53 DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = NpFsdQueryInformation;
54 DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = NpFsdSetInformation;
55 DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = NpFsdQueryVolumeInformation;
56 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = NpFsdCleanup;
57 DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = NpFsdFlushBuffers;
58 DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = NpFsdDirectoryControl;
59 DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = NpFsdFileSystemControl;
60 DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] = NpFsdQuerySecurityInfo;
61 DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] = NpFsdSetSecurityInfo;
62
63 DriverObject->DriverUnload = NULL;
64
65 RtlInitUnicodeString(&DeviceName, L"\\Device\\NamedPipe");
66 Status = IoCreateDevice(DriverObject,
67 sizeof(NP_VCB),
68 &DeviceName,
69 FILE_DEVICE_NAMED_PIPE,
70 0,
71 FALSE,
72 &DeviceObject);
73 if (!NT_SUCCESS(Status))
74 {
75 DPRINT1("Failed to create named pipe device! (Status %lx)\n", Status);
76 return Status;
77 }
78
79 /* Initialize the device object */
80 NpfsDeviceObject = DeviceObject;
81 DeviceObject->Flags |= DO_LONG_TERM_REQUESTS;
82
83 /* Initialize the Volume Control Block (VCB) */
84 NpVcb = DeviceObject->DeviceExtension;
85 NpInitializeVcb();
86 Status = NpCreateRootDcb();
87 ASSERT(Status == STATUS_SUCCESS);
88 return STATUS_SUCCESS;
89 }
90
91 /* EOF */