4ba9ba2b242cbbda13fb547569a5a74d2f3c7581
[reactos.git] / reactos / drivers / filesystems / ms / msfs.h
1 #ifndef __SERVICES_FS_MS_MSFS_H
2 #define __SERVICES_FS_MS_MSFS_H
3
4 #include <ntifs.h>
5 #include <ndk/ntndk.h>
6
7 /*
8 * FIXME: GCC doesn't have a working option for defaulting to a calling
9 * convention. It will always default to cdecl. The MS DDK was designed
10 * for compilers which support this option, and thus some of their headers
11 * do not specify STDCALL or NTAPI everywhere. As such, callbacks will be
12 * interpreted as cdecl on gcc, while they should be stdcall. Defining
13 * NTAPI manually won't work either, since msvc will realize that the
14 * two definitions are different. So we have to use something to close
15 * the compatibility gap, until someone fixes gcc.
16 */
17 #ifdef _MSC_VER
18 #define DEFAULTAPI
19 #else
20 #define DEFAULTAPI __stdcall
21 #endif
22
23 typedef struct _MSFS_DEVICE_EXTENSION
24 {
25 LIST_ENTRY FcbListHead;
26 KMUTEX FcbListLock;
27 } MSFS_DEVICE_EXTENSION, *PMSFS_DEVICE_EXTENSION;
28
29 typedef struct _MSFS_FCB
30 {
31 UNICODE_STRING Name;
32 LIST_ENTRY FcbListEntry;
33 KSPIN_LOCK CcbListLock;
34 LIST_ENTRY CcbListHead;
35 struct _MSFS_CCB *ServerCcb;
36 ULONG ReferenceCount;
37 LARGE_INTEGER TimeOut;
38 KEVENT MessageEvent;
39 ULONG MaxMessageSize;
40 ULONG MessageCount;
41 KSPIN_LOCK MessageListLock;
42 LIST_ENTRY MessageListHead;
43 } MSFS_FCB, *PMSFS_FCB;
44
45 typedef struct _MSFS_CCB
46 {
47 LIST_ENTRY CcbListEntry;
48 PMSFS_FCB Fcb;
49 } MSFS_CCB, *PMSFS_CCB;
50
51 typedef struct _MSFS_MESSAGE
52 {
53 LIST_ENTRY MessageListEntry;
54 ULONG Size;
55 UCHAR Buffer[1];
56 } MSFS_MESSAGE, *PMSFS_MESSAGE;
57
58
59 #define KeLockMutex(x) KeWaitForSingleObject(x, \
60 UserRequest, \
61 KernelMode, \
62 FALSE, \
63 NULL);
64
65 #define KeUnlockMutex(x) KeReleaseMutex(x, FALSE);
66
67 NTSTATUS DEFAULTAPI MsfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp);
68 NTSTATUS DEFAULTAPI MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject, PIRP Irp);
69 NTSTATUS DEFAULTAPI MsfsClose(PDEVICE_OBJECT DeviceObject, PIRP Irp);
70
71 NTSTATUS DEFAULTAPI MsfsQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
72 NTSTATUS DEFAULTAPI MsfsSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
73
74 NTSTATUS DEFAULTAPI MsfsRead(PDEVICE_OBJECT DeviceObject, PIRP Irp);
75 NTSTATUS DEFAULTAPI MsfsWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp);
76
77 NTSTATUS DEFAULTAPI MsfsFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
78
79 NTSTATUS NTAPI
80 DriverEntry(PDRIVER_OBJECT DriverObject,
81 PUNICODE_STRING RegistryPath);
82
83 #endif /* __SERVICES_FS_NP_NPFS_H */