:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / drivers / fs / ms / msfs.c
1 /* $Id$
2  *
3  * COPYRIGHT:  See COPYING in the top level directory
4  * PROJECT:    ReactOS kernel
5  * FILE:       services/fs/ms/msfs.c
6  * PURPOSE:    Mailslot filesystem
7  * PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
8  */
9
10 /* INCLUDES ******************************************************************/
11
12 #include <ddk/ntddk.h>
13 #include "msfs.h"
14
15 #define NDEBUG
16 #include <debug.h>
17
18
19 /* FUNCTIONS *****************************************************************/
20
21 NTSTATUS STDCALL
22 DriverEntry(PDRIVER_OBJECT DriverObject,
23             PUNICODE_STRING RegistryPath)
24 {
25    PMSFS_DEVICE_EXTENSION DeviceExtension;
26    PDEVICE_OBJECT DeviceObject;
27    UNICODE_STRING DeviceName;
28    NTSTATUS Status;
29    
30    DbgPrint("Mailslot FSD 0.0.1\n");
31    
32    DriverObject->Flags = 0;
33    DriverObject->MajorFunction[IRP_MJ_CREATE] = MsfsCreate;
34    DriverObject->MajorFunction[IRP_MJ_CREATE_MAILSLOT] =
35      MsfsCreateMailslot;
36    DriverObject->MajorFunction[IRP_MJ_CLOSE] = MsfsClose;
37    DriverObject->MajorFunction[IRP_MJ_READ] = MsfsRead;
38    DriverObject->MajorFunction[IRP_MJ_WRITE] = MsfsWrite;
39    DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
40      MsfsQueryInformation;
41    DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
42      MsfsSetInformation;
43 //   DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
44 //     MsfsDirectoryControl;
45 //   DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = MsfsFlushBuffers;
46 //   DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = MsfsShutdown;
47 //   DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] = 
48 //     MsfsQuerySecurity;
49 //   DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
50 //     MsfsSetSecurity;
51    DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
52      MsfsFileSystemControl;
53    
54    DriverObject->DriverUnload = NULL;
55    
56    RtlInitUnicodeString(&DeviceName,
57                         L"\\Device\\MailSlot");
58    Status = IoCreateDevice(DriverObject,
59                            sizeof(MSFS_DEVICE_EXTENSION),
60                            &DeviceName,
61                            FILE_DEVICE_MAILSLOT,
62                            0,
63                            FALSE,
64                            &DeviceObject);
65    if (!NT_SUCCESS(Status))
66      {
67         return(Status);
68      }
69
70    /* initialize device extension */
71    DeviceExtension = DeviceObject->DeviceExtension;
72    InitializeListHead(&DeviceExtension->MailslotListHead);
73    KeInitializeMutex(&DeviceExtension->MailslotListLock,
74                      0);
75    
76    return(STATUS_SUCCESS);
77 }
78
79 /* EOF */