27#pragma warning(disable:4201)
28#pragma warning(disable:4214)
29#pragma warning(disable:4100)
32#define MIN_INDEXED_LENGTH 5
33#define MAX_INDEXED_LENGTH 9
53#define NPFS_CCB_TAG 'cFpN'
54#define NPFS_ROOT_DCB_CCB_TAG 'CFpN'
55#define NPFS_DCB_TAG 'DFpN'
56#define NPFS_FCB_TAG 'fFpN'
57#define NPFS_GLOBAL_TAG 'gFpN'
58#define NPFS_CLIENT_INFO_TAG 'iFpN'
59#define NPFS_NAME_BLOCK_TAG 'nFpN'
60#define NPFS_QUERY_TEMPLATE_TAG 'qFpN'
61#define NPFS_DATA_ENTRY_TAG 'rFpN'
62#define NPFS_CLIENT_SEC_CTX_TAG 'sFpN'
63#define NPFS_WAIT_BLOCK_TAG 'tFpN'
64#define NPFS_WRITE_BLOCK_TAG 'wFpN'
85#define NPFS_BUGCHECK_CLEANUP 0x0001
86#define NPFS_BUGCHECK_CLOSE 0x0002
87#define NPFS_BUGCHECK_CREATE 0x0003
88#define NPFS_BUGCHECK_DATASUP 0x0004
89#define NPFS_BUGCHECK_FILEINFO 0x0005
90#define NPFS_BUGCHECK_FILEOBSUP 0x0006
91#define NPFS_BUGCHECK_FLUSHBUF 0x0007
92#define NPFS_BUGCHECK_FSCTRL 0x0008
93#define NPFS_BUGCHECK_MAIN 0x0009
94#define NPFS_BUGCHECK_PREFXSUP 0x000a
95#define NPFS_BUGCHECK_READ 0x000b
96#define NPFS_BUGCHECK_READSUP 0x000c
97#define NPFS_BUGCHECK_SECURSUP 0x000d
98#define NPFS_BUGCHECK_SEINFO 0x000e
99#define NPFS_BUGCHECK_STATESUP 0x000f
100#define NPFS_BUGCHECK_STRUCSUP 0x0010
101#define NPFS_BUGCHECK_VOLINFO 0x0011
102#define NPFS_BUGCHECK_WAITSUP 0x0012
103#define NPFS_BUGCHECK_WRITE 0x0013
104#define NPFS_BUGCHECK_WRITESUP 0x0014
106#define NpBugCheck(p1, p2, p3) \
107 KeBugCheckEx(NPFS_FILE_SYSTEM, \
108 (NPFS_BUGCHECK_FILE_ID << 16) | __LINE__, \
112#define NPFS_NTC_VCB 1
113#define NPFS_NTC_ROOT_DCB 2
114#define NPFS_NTC_FCB 4
115#define NPFS_NTC_CCB 6
116#define NPFS_NTC_NONPAGED_CCB 7
117#define NPFS_NTC_ROOT_DCB_CCB 8
362 ThisEntry = DeferredList->
Flink;
363 while (ThisEntry != DeferredList)
366 NextEntry = ThisEntry->
Flink;
373 ThisEntry = NextEntry;
char * Pad(char *Str, char PadChar, ULONG Length)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
static VOID Peek(_In_ PUCHAR ReadDataPort, _Out_writes_bytes_all_opt_(Length) PVOID Buffer, _In_ USHORT Length)
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
VOID NTAPI NpInitializeVcb(VOID)
_In_ PLARGE_INTEGER FileOffset
struct _NP_ROOT_DCB_CCB NP_ROOT_DCB_CCB
NTSTATUS NTAPI NpCreateCcb(IN PNP_FCB Fcb, IN PFILE_OBJECT FileObject, IN UCHAR State, IN UCHAR ReadMode, IN UCHAR CompletionMode, IN ULONG InQuota, IN ULONG OutQuota, OUT PNP_CCB *NewCcb)
VOID NTAPI NpSetFileObject(IN PFILE_OBJECT FileObject, IN PVOID PrimaryContext, IN PVOID Ccb, IN ULONG NamedPipeEnd)
NTSTATUS NTAPI NpFindRelativePrefix(IN PNP_DCB Dcb, IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix, OUT PNP_FCB *FoundFcb)
struct _NP_EVENT_BUFFER NP_EVENT_BUFFER
LONG NTAPI NpCompareAliasNames(_In_ PCUNICODE_STRING String1, _In_ PCUNICODE_STRING String2)
struct _NP_DATA_QUEUE * PNP_DATA_QUEUE
struct _NPFS_ALIAS * PNPFS_ALIAS
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
FORCEINLINE VOID NpReleaseVcb(VOID)
IO_STATUS_BLOCK NTAPI NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue, IN BOOLEAN Peek, IN BOOLEAN ReadOverflowOperation, IN PVOID Buffer, IN ULONG BufferSize, IN ULONG Mode, IN PNP_CCB Ccb, IN PLIST_ENTRY List)
_NP_DATA_QUEUE_ENTRY_TYPE
VOID NTAPI NpCheckForNotify(IN PNP_DCB Dcb, IN BOOLEAN SecondList, IN PLIST_ENTRY List)
PIRP NTAPI NpRemoveDataQueueEntry(IN PNP_DATA_QUEUE DataQueue, IN BOOLEAN Flag, IN PLIST_ENTRY List)
NTSTATUS NTAPI NpSetConnectedPipeState(IN PNP_CCB Ccb, IN PFILE_OBJECT FileObject, IN PLIST_ENTRY List)
struct _NP_WAIT_QUEUE NP_WAIT_QUEUE
struct _NP_CB_FOOTER NP_CB_FOOTER
_In_ PLARGE_INTEGER _In_ ULONG _In_ BOOLEAN _In_ ULONG LockKey
struct _NP_CB_HEADER * PNP_CB_HEADER
NTSTATUS NTAPI NpInitializeSecurity(IN PNP_CCB Ccb, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN PETHREAD Thread)
NTSTATUS NTAPI NpFsdQuerySecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI NpFsdCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID NTAPI NpCopyClientContext(IN PNP_CCB Ccb, IN PNP_DATA_QUEUE_ENTRY DataQueueEntry)
NTSTATUS NTAPI NpSetDisconnectedPipeState(IN PNP_CCB Ccb, IN PLIST_ENTRY List)
NTSTATUS NTAPI NpAddDataQueueEntry(IN ULONG NamedPipeEnd, IN PNP_CCB Ccb, IN PNP_DATA_QUEUE DataQueue, IN ULONG Who, IN ULONG Type, IN ULONG DataSize, IN PIRP Irp, IN PVOID Buffer, IN ULONG ByteOffset)
NTSTATUS NTAPI NpUninitializeDataQueue(IN PNP_DATA_QUEUE DataQueue)
struct _NP_WAIT_QUEUE_ENTRY * PNP_WAIT_QUEUE_ENTRY
struct _NP_CLIENT_PROCESS NP_CLIENT_PROCESS
NTSTATUS NTAPI NpSetClosingPipeState(IN PNP_CCB Ccb, IN PIRP Irp, IN ULONG NamedPipeEnd, IN PLIST_ENTRY List)
NTSTATUS NTAPI NpFsdFileSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct _NPFS_ALIAS NPFS_ALIAS
enum _NP_DATA_QUEUE_STATE NP_DATA_QUEUE_STATE
NTSTATUS NTAPI NpCreateFcb(IN PNP_DCB Dcb, IN PUNICODE_STRING PipeName, IN ULONG MaximumInstances, IN LARGE_INTEGER Timeout, IN USHORT NamedPipeConfiguration, IN USHORT NamedPipeType, OUT PNP_FCB *NewFcb)
struct _NP_NONPAGED_CCB NP_NONPAGED_CCB
NTSTATUS NTAPI NpFsdWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI NpCreateRootDcb(VOID)
VOID NTAPI NpCompleteStalledWrites(IN PNP_DATA_QUEUE DataQueue, IN PLIST_ENTRY List)
NTSTATUS NTAPI NpFsdCleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID NTAPI NpDeleteFcb(IN PNP_FCB Fcb, IN PLIST_ENTRY ListEntry)
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
struct _NP_WAIT_QUEUE * PNP_WAIT_QUEUE
struct _NP_CB_HEADER NP_CB_HEADER
struct _NP_EVENT_BUFFER * PNP_EVENT_BUFFER
struct _NP_WAIT_QUEUE_ENTRY NP_WAIT_QUEUE_ENTRY
NTSTATUS NTAPI NpCreateRootDcbCcb(IN PNP_ROOT_DCB_FCB *NewRootCcb)
NTSTATUS NTAPI NpGetClientSecurityContext(IN ULONG NamedPipeEnd, IN PNP_CCB Ccb, IN PETHREAD Thread, IN PSECURITY_CLIENT_CONTEXT *Context)
NTSTATUS NTAPI NpFsdQueryInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NODE_TYPE_CODE NTAPI NpDecodeFileObject(IN PFILE_OBJECT FileObject, OUT PVOID *PrimaryContext OPTIONAL, OUT PNP_CCB *Ccb, OUT PULONG NamedPipeEnd OPTIONAL)
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
VOID NTAPI NpInitializeWaitQueue(IN PNP_WAIT_QUEUE WaitQueue)
NTSTATUS NTAPI NpCancelWaiter(IN PNP_WAIT_QUEUE WaitQueue, IN PUNICODE_STRING PipeName, IN NTSTATUS Status, IN PLIST_ENTRY ListEntry)
struct _NPFS_QUERY_VALUE_CONTEXT NPFS_QUERY_VALUE_CONTEXT
VOID NTAPI NpDeleteCcb(IN PNP_CCB Ccb, IN PLIST_ENTRY ListEntry)
NTSTATUS NTAPI NpFsdQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct _NP_DATA_QUEUE_ENTRY * PNP_DATA_QUEUE_ENTRY
BOOLEAN NTAPI NpDeleteEventTableEntry(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer)
NTSTATUS NTAPI NpAddWaiter(IN PNP_WAIT_QUEUE WaitQueue, IN LARGE_INTEGER WaitTime, IN PIRP Irp, IN PUNICODE_STRING AliasName)
struct _NPFS_QUERY_VALUE_CONTEXT * PNPFS_QUERY_VALUE_CONTEXT
PNP_FCB NTAPI NpFindPrefix(IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix)
NTSTATUS NTAPI NpFsdCreateNamedPipe(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
PNPFS_ALIAS NpAliasListByLength[MAX_INDEXED_LENGTH+1 - MIN_INDEXED_LENGTH]
PLIST_ENTRY NTAPI NpGetNextRealDataQueueEntry(IN PNP_DATA_QUEUE DataQueue, IN PLIST_ENTRY List)
NTSTATUS NTAPI NpFsdClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct _NP_NONPAGED_CCB * PNP_NONPAGED_CCB
enum _NP_DATA_QUEUE_ENTRY_TYPE NP_DATA_QUEUE_ENTRY_TYPE
NTSTATUS NTAPI NpFsdRead(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct _NP_ROOT_DCB_CCB * PNP_ROOT_DCB_FCB
NTSTATUS NTAPI NpFsdSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI NpFsdFlushBuffers(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI NpSetListeningPipeState(IN PNP_CCB Ccb, IN PIRP Irp, IN PLIST_ENTRY List)
struct _NP_DATA_QUEUE NP_DATA_QUEUE
NTSTATUS NTAPI NpFsdSetInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
#define MAX_INDEXED_LENGTH
struct _NP_DATA_QUEUE_ENTRY NP_DATA_QUEUE_ENTRY
NTSTATUS NTAPI NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue, IN ULONG Mode, IN PVOID OutBuffer, IN ULONG OutBufferSize, IN ULONG PipeType, OUT PULONG BytesWritten, IN PNP_CCB Ccb, IN ULONG NamedPipeEnd, IN PETHREAD Thread, IN PLIST_ENTRY List)
NTSTATUS NTAPI NpInitializeDataQueue(IN PNP_DATA_QUEUE DataQueue, IN ULONG Quota)
struct _NP_CLIENT_PROCESS * PNP_CLIENT_PROCESS
VOID NTAPI NpUninitializeSecurity(IN PNP_CCB Ccb)
VOID NTAPI NpFreeClientSecurityContext(IN PSECURITY_CLIENT_CONTEXT ClientContext)
#define MIN_INDEXED_LENGTH
NTSTATUS NTAPI NpImpersonateClientContext(IN PNP_CCB Ccb)
#define _IRQL_requires_same_
#define ExAcquireResourceExclusiveLite(res, wait)
#define ExAcquireResourceSharedLite(res, wait)
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
#define _Function_class_(x)
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
_In_ const STRING * String2
_In_ ULONG _In_ ULONG _In_ ULONG Length
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
#define IoCompleteRequest
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
PULONG MinorVersion OPTIONAL
struct _LIST_ENTRY * Flink
PUNICODE_STRING TargetName
struct _NPFS_ALIAS * Next
PUNICODE_STRING CurrentTargetName
PWCHAR CurrentStringPointer
PNP_NONPAGED_CCB NonPagedCcb
PSECURITY_CLIENT_CONTEXT ClientContext
NP_DATA_QUEUE DataQueue[2]
SECURITY_QUALITY_OF_SERVICE ClientQos
PSECURITY_CLIENT_CONTEXT ClientSecurityContext
USHORT NamedPipeConfiguration
PNP_EVENT_BUFFER EventBuffer[2]
UNICODE_PREFIX_TABLE PrefixTable
RTL_GENERIC_TABLE EventTable
#define FIELD_OFFSET(t, f)
#define CONTAINING_RECORD(address, type, field)
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_In_ WDFDPC _In_ BOOLEAN Wait
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ WDFCMRESLIST List
#define IO_NAMED_PIPE_INCREMENT
_In_ PUNICODE_STRING _In_ ULONG CaseInsensitiveIndex
_In_ __drv_aliasesMem PSTRING Prefix
_In_ __drv_aliasesMem PSTRING _Out_ PPREFIX_TABLE_ENTRY PrefixTableEntry