ReactOS  0.4.14-dev-50-g13bb5e2
npfs.h File Reference
#include <ntifs.h>
#include <ndk/obfuncs.h>
#include <pseh/pseh2.h>
#include <debug.h>
Include dependency graph for npfs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _NP_DATA_QUEUE
 
struct  _NP_DATA_QUEUE_ENTRY
 
struct  _NP_WAIT_QUEUE
 
struct  _NP_WAIT_QUEUE_ENTRY
 
struct  _NP_EVENT_BUFFER
 
struct  _NP_ROOT_DCB_CCB
 
struct  _NP_CB_HEADER
 
struct  _NP_CB_FOOTER
 
struct  _NP_DCB
 
struct  _NP_FCB
 
struct  _NP_NONPAGED_CCB
 
struct  _NP_CCB
 
struct  _NP_VCB
 
struct  _NPFS_ALIAS
 
struct  _NPFS_QUERY_VALUE_CONTEXT
 
struct  _NP_CLIENT_PROCESS
 

Macros

#define NDEBUG
 
#define TRACE(...)   /* DPRINT1("%s: ", __FUNCTION__); DbgPrint(__VA_ARGS__) */
 
#define MIN_INDEXED_LENGTH   5
 
#define MAX_INDEXED_LENGTH   9
 
#define NPFS_CCB_TAG   'cFpN'
 
#define NPFS_ROOT_DCB_CCB_TAG   'CFpN'
 
#define NPFS_DCB_TAG   'DFpN'
 
#define NPFS_FCB_TAG   'fFpN'
 
#define NPFS_GLOBAL_TAG   'gFpN'
 
#define NPFS_CLIENT_INFO_TAG   'iFpN'
 
#define NPFS_NAME_BLOCK_TAG   'nFpN'
 
#define NPFS_QUERY_TEMPLATE_TAG   'qFpN'
 
#define NPFS_DATA_ENTRY_TAG   'rFpN'
 
#define NPFS_CLIENT_SEC_CTX_TAG   'sFpN'
 
#define NPFS_WAIT_BLOCK_TAG   'tFpN'
 
#define NPFS_WRITE_BLOCK_TAG   'wFpN'
 
#define NPFS_BUGCHECK_CLEANUP   0x0001
 
#define NPFS_BUGCHECK_CLOSE   0x0002
 
#define NPFS_BUGCHECK_CREATE   0x0003
 
#define NPFS_BUGCHECK_DATASUP   0x0004
 
#define NPFS_BUGCHECK_FILEINFO   0x0005
 
#define NPFS_BUGCHECK_FILEOBSUP   0x0006
 
#define NPFS_BUGCHECK_FLUSHBUF   0x0007
 
#define NPFS_BUGCHECK_FSCTRL   0x0008
 
#define NPFS_BUGCHECK_MAIN   0x0009
 
#define NPFS_BUGCHECK_PREFXSUP   0x000a
 
#define NPFS_BUGCHECK_READ   0x000b
 
#define NPFS_BUGCHECK_READSUP   0x000c
 
#define NPFS_BUGCHECK_SECURSUP   0x000d
 
#define NPFS_BUGCHECK_SEINFO   0x000e
 
#define NPFS_BUGCHECK_STATESUP   0x000f
 
#define NPFS_BUGCHECK_STRUCSUP   0x0010
 
#define NPFS_BUGCHECK_VOLINFO   0x0011
 
#define NPFS_BUGCHECK_WAITSUP   0x0012
 
#define NPFS_BUGCHECK_WRITE   0x0013
 
#define NPFS_BUGCHECK_WRITESUP   0x0014
 
#define NpBugCheck(p1, p2, p3)
 
#define NPFS_NTC_VCB   1
 
#define NPFS_NTC_ROOT_DCB   2
 
#define NPFS_NTC_FCB   4
 
#define NPFS_NTC_CCB   6
 
#define NPFS_NTC_NONPAGED_CCB   7
 
#define NPFS_NTC_ROOT_DCB_CCB   8
 

Typedefs

typedef USHORT NODE_TYPE_CODE
 
typedef USHORTPNODE_TYPE_CODE
 
typedef enum _NP_DATA_QUEUE_STATE NP_DATA_QUEUE_STATE
 
typedef enum _NP_DATA_QUEUE_ENTRY_TYPE NP_DATA_QUEUE_ENTRY_TYPE
 
typedef struct _NP_DATA_QUEUE NP_DATA_QUEUE
 
typedef struct _NP_DATA_QUEUEPNP_DATA_QUEUE
 
typedef struct _NP_DATA_QUEUE_ENTRY NP_DATA_QUEUE_ENTRY
 
typedef struct _NP_DATA_QUEUE_ENTRYPNP_DATA_QUEUE_ENTRY
 
typedef struct _NP_WAIT_QUEUE NP_WAIT_QUEUE
 
typedef struct _NP_WAIT_QUEUEPNP_WAIT_QUEUE
 
typedef struct _NP_WAIT_QUEUE_ENTRY NP_WAIT_QUEUE_ENTRY
 
typedef struct _NP_WAIT_QUEUE_ENTRYPNP_WAIT_QUEUE_ENTRY
 
typedef struct _NP_EVENT_BUFFER NP_EVENT_BUFFER
 
typedef struct _NP_EVENT_BUFFERPNP_EVENT_BUFFER
 
typedef struct _NP_ROOT_DCB_CCB NP_ROOT_DCB_CCB
 
typedef struct _NP_ROOT_DCB_CCBPNP_ROOT_DCB_FCB
 
typedef struct _NP_CB_HEADER NP_CB_HEADER
 
typedef struct _NP_CB_HEADERPNP_CB_HEADER
 
typedef struct _NP_CB_FOOTER NP_CB_FOOTER
 
typedef struct _NP_DCB NP_DCB
 
typedef struct _NP_DCBPNP_DCB
 
typedef struct _NP_FCB NP_FCB
 
typedef struct _NP_FCBPNP_FCB
 
typedef struct _NP_NONPAGED_CCB NP_NONPAGED_CCB
 
typedef struct _NP_NONPAGED_CCBPNP_NONPAGED_CCB
 
typedef struct _NP_CCB NP_CCB
 
typedef struct _NP_CCBPNP_CCB
 
typedef struct _NP_VCB NP_VCB
 
typedef struct _NP_VCBPNP_VCB
 
typedef struct _NPFS_ALIAS NPFS_ALIAS
 
typedef struct _NPFS_ALIASPNPFS_ALIAS
 
typedef struct _NPFS_QUERY_VALUE_CONTEXT NPFS_QUERY_VALUE_CONTEXT
 
typedef struct _NPFS_QUERY_VALUE_CONTEXTPNPFS_QUERY_VALUE_CONTEXT
 
typedef struct _NP_CLIENT_PROCESS NP_CLIENT_PROCESS
 
typedef struct _NP_CLIENT_PROCESSPNP_CLIENT_PROCESS
 

Enumerations

enum  _NP_DATA_QUEUE_STATE { ReadEntries = 0, WriteEntries = 1, Empty = 2 }
 
enum  _NP_DATA_QUEUE_ENTRY_TYPE { Buffered = 0, Unbuffered }
 

Functions

 C_ASSERT (FIELD_OFFSET(NP_FCB, PrefixTableEntry)==FIELD_OFFSET(NP_DCB, PrefixTableEntry))
 
FORCEINLINE VOID NpAcquireSharedVcb (VOID)
 
FORCEINLINE VOID NpAcquireExclusiveVcb (VOID)
 
FORCEINLINE VOID NpReleaseVcb (VOID)
 
FORCEINLINE VOID NpCompleteDeferredIrps (IN PLIST_ENTRY DeferredList)
 
LONG NTAPI NpCompareAliasNames (_In_ PCUNICODE_STRING String1, _In_ PCUNICODE_STRING String2)
 
BOOLEAN NTAPI NpDeleteEventTableEntry (IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer)
 
VOID NTAPI NpInitializeWaitQueue (IN PNP_WAIT_QUEUE WaitQueue)
 
NTSTATUS NTAPI NpUninitializeDataQueue (IN PNP_DATA_QUEUE DataQueue)
 
PLIST_ENTRY NTAPI NpGetNextRealDataQueueEntry (IN PNP_DATA_QUEUE DataQueue, IN PLIST_ENTRY List)
 
PIRP NTAPI NpRemoveDataQueueEntry (IN PNP_DATA_QUEUE DataQueue, IN BOOLEAN Flag, 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)
 
VOID NTAPI NpCompleteStalledWrites (IN PNP_DATA_QUEUE DataQueue, IN PLIST_ENTRY List)
 
NTSTATUS NTAPI NpInitializeDataQueue (IN PNP_DATA_QUEUE DataQueue, IN ULONG Quota)
 
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)
 
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)
 
NTSTATUS NTAPI NpCreateRootDcb (VOID)
 
NTSTATUS NTAPI NpCreateRootDcbCcb (IN PNP_ROOT_DCB_FCB *NewRootCcb)
 
VOID NTAPI NpInitializeVcb (VOID)
 
VOID NTAPI NpDeleteCcb (IN PNP_CCB Ccb, IN PLIST_ENTRY ListEntry)
 
VOID NTAPI NpDeleteFcb (IN PNP_FCB Fcb, IN PLIST_ENTRY ListEntry)
 
NTSTATUS NTAPI NpFsdCreateNamedPipe (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdCreate (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdClose (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdCleanup (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdFileSystemControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpSetConnectedPipeState (IN PNP_CCB Ccb, IN PFILE_OBJECT FileObject, IN PLIST_ENTRY List)
 
NTSTATUS NTAPI NpSetListeningPipeState (IN PNP_CCB Ccb, IN PIRP Irp, IN PLIST_ENTRY List)
 
NTSTATUS NTAPI NpSetDisconnectedPipeState (IN PNP_CCB Ccb, IN PLIST_ENTRY List)
 
NTSTATUS NTAPI NpSetClosingPipeState (IN PNP_CCB Ccb, IN PIRP Irp, IN ULONG NamedPipeEnd, IN PLIST_ENTRY List)
 
VOID NTAPI NpFreeClientSecurityContext (IN PSECURITY_CLIENT_CONTEXT ClientContext)
 
NTSTATUS NTAPI NpImpersonateClientContext (IN PNP_CCB Ccb)
 
VOID NTAPI NpCopyClientContext (IN PNP_CCB Ccb, IN PNP_DATA_QUEUE_ENTRY DataQueueEntry)
 
VOID NTAPI NpUninitializeSecurity (IN PNP_CCB Ccb)
 
NTSTATUS NTAPI NpInitializeSecurity (IN PNP_CCB Ccb, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN PETHREAD Thread)
 
NTSTATUS NTAPI NpGetClientSecurityContext (IN ULONG NamedPipeEnd, IN PNP_CCB Ccb, IN PETHREAD Thread, IN PSECURITY_CLIENT_CONTEXT *Context)
 
VOID NTAPI NpSetFileObject (IN PFILE_OBJECT FileObject, IN PVOID PrimaryContext, IN PVOID Ccb, IN ULONG NamedPipeEnd)
 
NODE_TYPE_CODE NTAPI NpDecodeFileObject (IN PFILE_OBJECT FileObject, OUT PVOID *PrimaryContext OPTIONAL, OUT PNP_CCB *Ccb, OUT PULONG NamedPipeEnd OPTIONAL)
 
PNP_FCB NTAPI NpFindPrefix (IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix)
 
NTSTATUS NTAPI NpFindRelativePrefix (IN PNP_DCB Dcb, IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix, OUT PNP_FCB *FoundFcb)
 
VOID NTAPI NpCheckForNotify (IN PNP_DCB Dcb, IN BOOLEAN SecondList, IN PLIST_ENTRY List)
 
NTSTATUS NTAPI NpAddWaiter (IN PNP_WAIT_QUEUE WaitQueue, IN LARGE_INTEGER WaitTime, IN PIRP Irp, IN PUNICODE_STRING AliasName)
 
NTSTATUS NTAPI NpCancelWaiter (IN PNP_WAIT_QUEUE WaitQueue, IN PUNICODE_STRING PipeName, IN NTSTATUS Status, IN PLIST_ENTRY ListEntry)
 
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)
 
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 NpFsdRead (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
 _Function_class_ (FAST_IO_READ) _IRQL_requires_same_ BOOLEAN NTAPI NpFastRead(_In_ PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_WRITE) _IRQL_requires_same_ BOOLEAN NTAPI NpFastWrite(_In_ PFILE_OBJECT FileObject
 
NTSTATUS NTAPI NpFsdWrite (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdFlushBuffers (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdSetInformation (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdQueryInformation (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdQuerySecurityInfo (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdSetSecurityInfo (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdQueryVolumeInformation (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 

Variables

PNP_VCB NpVcb
 
PNPFS_ALIAS NpAliasList
 
PNPFS_ALIAS NpAliasListByLength [MAX_INDEXED_LENGTH+1 - MIN_INDEXED_LENGTH]
 
_In_ PLARGE_INTEGER FileOffset
 
_In_ PLARGE_INTEGER _In_ ULONG Length
 
_In_ PLARGE_INTEGER _In_ ULONG _In_ BOOLEAN Wait
 
_In_ PLARGE_INTEGER _In_ ULONG _In_ BOOLEAN _In_ ULONG LockKey
 
_In_ PLARGE_INTEGER _In_ ULONG _In_ BOOLEAN _In_ ULONG _Out_ PVOID Buffer
 
_In_ PLARGE_INTEGER _In_ ULONG _In_ BOOLEAN _In_ ULONG _Out_ PVOID _Out_ PIO_STATUS_BLOCK IoStatus
 
_In_ PLARGE_INTEGER _In_ ULONG _In_ BOOLEAN _In_ ULONG _Out_ PVOID _Out_ PIO_STATUS_BLOCK _In_ PDEVICE_OBJECT DeviceObject
 

Macro Definition Documentation

◆ MAX_INDEXED_LENGTH

#define MAX_INDEXED_LENGTH   9

Definition at line 33 of file npfs.h.

◆ MIN_INDEXED_LENGTH

#define MIN_INDEXED_LENGTH   5

Definition at line 32 of file npfs.h.

◆ NDEBUG

#define NDEBUG

Definition at line 21 of file npfs.h.

◆ NpBugCheck

#define NpBugCheck (   p1,
  p2,
  p3 
)
Value:
KeBugCheckEx(NPFS_FILE_SYSTEM, \
(NPFS_BUGCHECK_FILE_ID << 16) | __LINE__, \
(p1), (p2), (p3))
#define NPFS_BUGCHECK_FILE_ID
Definition: cleanup.c:14
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

Definition at line 106 of file npfs.h.

◆ NPFS_BUGCHECK_CLEANUP

#define NPFS_BUGCHECK_CLEANUP   0x0001

Definition at line 85 of file npfs.h.

◆ NPFS_BUGCHECK_CLOSE

#define NPFS_BUGCHECK_CLOSE   0x0002

Definition at line 86 of file npfs.h.

◆ NPFS_BUGCHECK_CREATE

#define NPFS_BUGCHECK_CREATE   0x0003

Definition at line 87 of file npfs.h.

◆ NPFS_BUGCHECK_DATASUP

#define NPFS_BUGCHECK_DATASUP   0x0004

Definition at line 88 of file npfs.h.

◆ NPFS_BUGCHECK_FILEINFO

#define NPFS_BUGCHECK_FILEINFO   0x0005

Definition at line 89 of file npfs.h.

◆ NPFS_BUGCHECK_FILEOBSUP

#define NPFS_BUGCHECK_FILEOBSUP   0x0006

Definition at line 90 of file npfs.h.

◆ NPFS_BUGCHECK_FLUSHBUF

#define NPFS_BUGCHECK_FLUSHBUF   0x0007

Definition at line 91 of file npfs.h.

◆ NPFS_BUGCHECK_FSCTRL

#define NPFS_BUGCHECK_FSCTRL   0x0008

Definition at line 92 of file npfs.h.

◆ NPFS_BUGCHECK_MAIN

#define NPFS_BUGCHECK_MAIN   0x0009

Definition at line 93 of file npfs.h.

◆ NPFS_BUGCHECK_PREFXSUP

#define NPFS_BUGCHECK_PREFXSUP   0x000a

Definition at line 94 of file npfs.h.

◆ NPFS_BUGCHECK_READ

#define NPFS_BUGCHECK_READ   0x000b

Definition at line 95 of file npfs.h.

◆ NPFS_BUGCHECK_READSUP

#define NPFS_BUGCHECK_READSUP   0x000c

Definition at line 96 of file npfs.h.

◆ NPFS_BUGCHECK_SECURSUP

#define NPFS_BUGCHECK_SECURSUP   0x000d

Definition at line 97 of file npfs.h.

◆ NPFS_BUGCHECK_SEINFO

#define NPFS_BUGCHECK_SEINFO   0x000e

Definition at line 98 of file npfs.h.

◆ NPFS_BUGCHECK_STATESUP

#define NPFS_BUGCHECK_STATESUP   0x000f

Definition at line 99 of file npfs.h.

◆ NPFS_BUGCHECK_STRUCSUP

#define NPFS_BUGCHECK_STRUCSUP   0x0010

Definition at line 100 of file npfs.h.

◆ NPFS_BUGCHECK_VOLINFO

#define NPFS_BUGCHECK_VOLINFO   0x0011

Definition at line 101 of file npfs.h.

◆ NPFS_BUGCHECK_WAITSUP

#define NPFS_BUGCHECK_WAITSUP   0x0012

Definition at line 102 of file npfs.h.

◆ NPFS_BUGCHECK_WRITE

#define NPFS_BUGCHECK_WRITE   0x0013

Definition at line 103 of file npfs.h.

◆ NPFS_BUGCHECK_WRITESUP

#define NPFS_BUGCHECK_WRITESUP   0x0014

Definition at line 104 of file npfs.h.

◆ NPFS_CCB_TAG

#define NPFS_CCB_TAG   'cFpN'

Definition at line 53 of file npfs.h.

◆ NPFS_CLIENT_INFO_TAG

#define NPFS_CLIENT_INFO_TAG   'iFpN'

Definition at line 58 of file npfs.h.

◆ NPFS_CLIENT_SEC_CTX_TAG

#define NPFS_CLIENT_SEC_CTX_TAG   'sFpN'

Definition at line 62 of file npfs.h.

◆ NPFS_DATA_ENTRY_TAG

#define NPFS_DATA_ENTRY_TAG   'rFpN'

Definition at line 61 of file npfs.h.

◆ NPFS_DCB_TAG

#define NPFS_DCB_TAG   'DFpN'

Definition at line 55 of file npfs.h.

◆ NPFS_FCB_TAG

#define NPFS_FCB_TAG   'fFpN'

Definition at line 56 of file npfs.h.

◆ NPFS_GLOBAL_TAG

#define NPFS_GLOBAL_TAG   'gFpN'

Definition at line 57 of file npfs.h.

◆ NPFS_NAME_BLOCK_TAG

#define NPFS_NAME_BLOCK_TAG   'nFpN'

Definition at line 59 of file npfs.h.

◆ NPFS_NTC_CCB

#define NPFS_NTC_CCB   6

Definition at line 115 of file npfs.h.

◆ NPFS_NTC_FCB

#define NPFS_NTC_FCB   4

Definition at line 114 of file npfs.h.

◆ NPFS_NTC_NONPAGED_CCB

#define NPFS_NTC_NONPAGED_CCB   7

Definition at line 116 of file npfs.h.

◆ NPFS_NTC_ROOT_DCB

#define NPFS_NTC_ROOT_DCB   2

Definition at line 113 of file npfs.h.

◆ NPFS_NTC_ROOT_DCB_CCB

#define NPFS_NTC_ROOT_DCB_CCB   8

Definition at line 117 of file npfs.h.

◆ NPFS_NTC_VCB

#define NPFS_NTC_VCB   1

Definition at line 112 of file npfs.h.

◆ NPFS_QUERY_TEMPLATE_TAG

#define NPFS_QUERY_TEMPLATE_TAG   'qFpN'

Definition at line 60 of file npfs.h.

◆ NPFS_ROOT_DCB_CCB_TAG

#define NPFS_ROOT_DCB_CCB_TAG   'CFpN'

Definition at line 54 of file npfs.h.

◆ NPFS_WAIT_BLOCK_TAG

#define NPFS_WAIT_BLOCK_TAG   'tFpN'

Definition at line 63 of file npfs.h.

◆ NPFS_WRITE_BLOCK_TAG

#define NPFS_WRITE_BLOCK_TAG   'wFpN'

Definition at line 64 of file npfs.h.

◆ TRACE

#define TRACE (   ...)    /* DPRINT1("%s: ", __FUNCTION__); DbgPrint(__VA_ARGS__) */

Definition at line 23 of file npfs.h.

Typedef Documentation

◆ NODE_TYPE_CODE

Definition at line 118 of file npfs.h.

◆ NP_CB_FOOTER

◆ NP_CB_HEADER

◆ NP_CCB

◆ NP_CLIENT_PROCESS

◆ NP_DATA_QUEUE

◆ NP_DATA_QUEUE_ENTRY

◆ NP_DATA_QUEUE_ENTRY_TYPE

◆ NP_DATA_QUEUE_STATE

◆ NP_DCB

◆ NP_EVENT_BUFFER

◆ NP_FCB

◆ NP_NONPAGED_CCB

◆ NP_ROOT_DCB_CCB

◆ NP_VCB

◆ NP_WAIT_QUEUE

◆ NP_WAIT_QUEUE_ENTRY

◆ NPFS_ALIAS

◆ NPFS_QUERY_VALUE_CONTEXT

◆ PNODE_TYPE_CODE

Definition at line 118 of file npfs.h.

◆ PNP_CB_HEADER

◆ PNP_CCB

typedef struct _NP_CCB * PNP_CCB

◆ PNP_CLIENT_PROCESS

◆ PNP_DATA_QUEUE

◆ PNP_DATA_QUEUE_ENTRY

◆ PNP_DCB

typedef struct _NP_DCB * PNP_DCB

◆ PNP_EVENT_BUFFER

◆ PNP_FCB

typedef struct _NP_FCB * PNP_FCB

◆ PNP_NONPAGED_CCB

◆ PNP_ROOT_DCB_FCB

◆ PNP_VCB

typedef struct _NP_VCB * PNP_VCB

◆ PNP_WAIT_QUEUE

◆ PNP_WAIT_QUEUE_ENTRY

◆ PNPFS_ALIAS

◆ PNPFS_QUERY_VALUE_CONTEXT

Enumeration Type Documentation

◆ _NP_DATA_QUEUE_ENTRY_TYPE

Enumerator
Buffered 
Unbuffered 

Definition at line 129 of file npfs.h.

130 {
131  Buffered = 0,
132  Unbuffered
Definition: npfs.h:131
enum _NP_DATA_QUEUE_ENTRY_TYPE NP_DATA_QUEUE_ENTRY_TYPE

◆ _NP_DATA_QUEUE_STATE

Enumerator
ReadEntries 
WriteEntries 
Empty 

Definition at line 121 of file npfs.h.

122 {
123  ReadEntries = 0,
124  WriteEntries = 1,
125  Empty = 2
enum _NP_DATA_QUEUE_STATE NP_DATA_QUEUE_STATE
Definition: npfs.h:125

Function Documentation

◆ _Function_class_() [1/2]

_Function_class_ ( FAST_IO_READ  )

◆ _Function_class_() [2/2]

_Function_class_ ( FAST_IO_WRITE  )

◆ C_ASSERT()

◆ NpAcquireExclusiveVcb()

FORCEINLINE VOID NpAcquireExclusiveVcb ( VOID  )

Definition at line 336 of file npfs.h.

337 {
338  /* Acquire the lock in exclusive mode */
340 }
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
PNP_VCB NpVcb
Definition: strucsup.c:19
ERESOURCE Lock
Definition: npfs.h:283

Referenced by NpCancelDataQueueIrp(), NpCancelListeningQueueIrp(), NpCommonCleanup(), NpCommonClose(), NpCommonFileSystemControl(), NpFsdCreate(), NpFsdCreateNamedPipe(), NpFsdQuerySecurityInfo(), NpFsdSetInformation(), and NpFsdSetSecurityInfo().

◆ NpAcquireSharedVcb()

FORCEINLINE VOID NpAcquireSharedVcb ( VOID  )

Definition at line 328 of file npfs.h.

329 {
330  /* Acquire the lock in shared mode */
332 }
#define TRUE
Definition: types.h:120
PNP_VCB NpVcb
Definition: strucsup.c:19
ERESOURCE Lock
Definition: npfs.h:283
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885

Referenced by _Function_class_(), NpCommonFileSystemControl(), NpFsdFlushBuffers(), NpFsdQueryInformation(), NpFsdQueryVolumeInformation(), NpFsdRead(), and NpFsdWrite().

◆ NpAddDataQueueEntry()

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 
)

Definition at line 295 of file datasup.c.

304 {
306  PNP_DATA_QUEUE_ENTRY DataEntry;
308  ULONG QuotaInEntry;
310  BOOLEAN HasSpace;
311 
313  ASSERT((DataQueue->QueueState == Empty) || (DataQueue->QueueState == Who));
314 
316 
317  if ((Type != 2) && (Who == WriteEntries))
318  {
319  Status = NpGetClientSecurityContext(NamedPipeEnd,
320  Ccb,
321  Irp ? Irp->Tail.Overlay.Thread :
323  &ClientContext);
324  if (!NT_SUCCESS(Status))
325  {
326  return Status;
327  }
328  }
329 
330  switch (Type)
331  {
332  case Unbuffered:
333  case 2:
334  case 3:
335 
336  ASSERT(Irp != NULL);
338  sizeof(*DataEntry),
340  if (!DataEntry)
341  {
344  }
345 
346  DataEntry->DataEntryType = Type;
347  DataEntry->QuotaInEntry = 0;
348  DataEntry->Irp = Irp;
349  DataEntry->DataSize = DataSize;
351  ASSERT((DataQueue->QueueState == Empty) || (DataQueue->QueueState == Who));
353  break;
354 
355  case Buffered:
356 
357  EntrySize = sizeof(*DataEntry);
358  if (Who != ReadEntries)
359  {
360  EntrySize += DataSize;
361  if (EntrySize < DataSize)
362  {
365  }
366  }
367 
368  QuotaInEntry = DataSize - ByteOffset;
369  if (DataQueue->Quota - DataQueue->QuotaUsed < QuotaInEntry)
370  {
371  QuotaInEntry = DataQueue->Quota - DataQueue->QuotaUsed;
372  HasSpace = TRUE;
373  }
374  else
375  {
376  HasSpace = FALSE;
377  }
378 
380  EntrySize,
382  if (!DataEntry)
383  {
386  }
387 
388  DataEntry->QuotaInEntry = QuotaInEntry;
389  DataEntry->Irp = Irp;
390  DataEntry->DataEntryType = Buffered;
392  DataEntry->DataSize = DataSize;
393 
394  if (Who == ReadEntries)
395  {
396  ASSERT(Irp);
397 
399  ASSERT((DataQueue->QueueState == Empty) ||
400  (DataQueue->QueueState == Who));
401  }
402  else
403  {
404  _SEH2_TRY
405  {
406  RtlCopyMemory(DataEntry + 1,
407  Irp ? Irp->UserBuffer: Buffer,
408  DataSize);
409  }
411  {
414  }
415  _SEH2_END;
416 
417  if (HasSpace && Irp)
418  {
420  }
421  else
422  {
423  DataEntry->Irp = NULL;
425  }
426 
427  ASSERT((DataQueue->QueueState == Empty) ||
428  (DataQueue->QueueState == Who));
429  }
430  break;
431 
432  default:
433  ASSERT(FALSE);
436  }
437 
438  ASSERT((DataQueue->QueueState == Empty) || (DataQueue->QueueState == Who));
439  if (DataQueue->QueueState == Empty)
440  {
441  ASSERT(DataQueue->BytesInQueue == 0);
442  ASSERT(DataQueue->EntriesInQueue == 0);
443  ASSERT(IsListEmpty(&DataQueue->Queue));
444  }
445  else
446  {
447  ASSERT(DataQueue->QueueState == Who);
448  ASSERT(DataQueue->QueueState != Empty);
449  ASSERT(DataQueue->EntriesInQueue != 0);
450  }
451 
452  DataQueue->QuotaUsed += DataEntry->QuotaInEntry;
453  DataQueue->QueueState = Who;
454  DataQueue->BytesInQueue += DataEntry->DataSize;
455  DataQueue->EntriesInQueue++;
456 
457  if (ByteOffset)
458  {
459  DataQueue->ByteOffset = ByteOffset;
460  ASSERT(Who == WriteEntries);
461  ASSERT(ByteOffset < DataEntry->DataSize);
462  ASSERT(DataQueue->EntriesInQueue == 1);
463  }
464 
465  InsertTailList(&DataQueue->Queue, &DataEntry->QueueEntry);
466 
467  if (Status == STATUS_PENDING)
468  {
470  Irp->Tail.Overlay.DriverContext[2] = DataQueue;
471  Irp->Tail.Overlay.DriverContext[3] = DataEntry;
472 
474 
475  if ((Irp->Cancel) && (IoSetCancelRoutine(Irp, NULL)))
476  {
478  }
479  }
480 
481  return Status;
482 }
VOID NTAPI NpCancelDataQueueIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: datasup.c:207
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS NTAPI NpGetClientSecurityContext(IN ULONG NamedPipeEnd, IN PNP_CCB Ccb, IN PETHREAD Thread, IN PSECURITY_CLIENT_CONTEXT *Context)
Definition: secursup.c:129
PVOID NTAPI ExAllocatePoolWithQuotaTag(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: expool.c:2939
Type
Definition: Type.h:6
#define NPFS_DATA_ENTRY_TAG
Definition: npfs.h:61
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LIST_ENTRY QueueEntry
Definition: npfs.h:150
LONG NTSTATUS
Definition: precomp.h:26
Definition: npfs.h:131
#define InsertTailList(ListHead, Entry)
IoSetCancelRoutine(Irp, CancelRoutine)
_In_ UCHAR EntrySize
Definition: iofuncs.h:640
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
_SEH2_TRY
Definition: create.c:4250
VOID NTAPI NpFreeClientSecurityContext(IN PSECURITY_CLIENT_CONTEXT ClientContext)
Definition: secursup.c:40
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
ULONG DataSize
Definition: npfs.h:155
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
_In_ PVOID ClientContext
Definition: netioddk.h:55
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: npfs.h:148
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_SEH2_END
Definition: create.c:4424
PSECURITY_CLIENT_CONTEXT ClientSecurityContext
Definition: npfs.h:154
ULONG DataEntryType
Definition: npfs.h:151
unsigned int ULONG
Definition: retypes.h:1
#define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2966
IoMarkIrpPending(Irp)
ULONG QuotaInEntry
Definition: npfs.h:153
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:716
Definition: npfs.h:125
PIRP Irp
Definition: npfs.h:152

Referenced by NpCommonFlushBuffers(), NpCommonRead(), NpCommonWrite(), and NpTransceive().

◆ NpAddWaiter()

NTSTATUS NTAPI NpAddWaiter ( IN PNP_WAIT_QUEUE  WaitQueue,
IN LARGE_INTEGER  WaitTime,
IN PIRP  Irp,
IN PUNICODE_STRING  AliasName 
)

Definition at line 221 of file waitsup.c.

225 {
226  PIO_STACK_LOCATION IoStack;
227  KIRQL OldIrql;
229  PNP_WAIT_QUEUE_ENTRY WaitEntry;
230  PFILE_PIPE_WAIT_FOR_BUFFER WaitBuffer;
232  ULONG i;
233 
235 
237  sizeof(*WaitEntry),
239  if (!WaitEntry)
240  {
242  }
243 
244  KeInitializeDpc(&WaitEntry->Dpc, NpTimerDispatch, WaitEntry);
245  KeInitializeTimer(&WaitEntry->Timer);
246 
247  if (AliasName)
248  {
249  WaitEntry->AliasName = *AliasName;
250  }
251  else
252  {
253  WaitEntry->AliasName.Length = 0;
254  WaitEntry->AliasName.Buffer = NULL;
255  }
256 
257  WaitEntry->WaitQueue = WaitQueue;
258  WaitEntry->Irp = Irp;
259 
260  WaitBuffer = Irp->AssociatedIrp.SystemBuffer;
261  if (WaitBuffer->TimeoutSpecified)
262  {
263  DueTime = WaitBuffer->Timeout;
264  }
265  else
266  {
267  DueTime = WaitTime;
268  }
269 
270  for (i = 0; i < WaitBuffer->NameLength / sizeof(WCHAR); i++)
271  {
272  WaitBuffer->Name[i] = RtlUpcaseUnicodeChar(WaitBuffer->Name[i]);
273  }
274 
275  Irp->Tail.Overlay.DriverContext[0] = WaitQueue;
276  Irp->Tail.Overlay.DriverContext[1] = WaitEntry;
277 
278  KeAcquireSpinLock(&WaitQueue->WaitLock, &OldIrql);
279 
281 
282  if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
283  {
285  }
286  else
287  {
288  InsertTailList(&WaitQueue->WaitList, &Irp->Tail.Overlay.ListEntry);
289 
292 
293  WaitEntry->FileObject = IoStack->FileObject;
294  ObReferenceObject(WaitEntry->FileObject);
295 
296  KeSetTimer(&WaitEntry->Timer, DueTime, &WaitEntry->Dpc);
297  WaitEntry = NULL;
298  }
299 
300  KeReleaseSpinLock(&WaitQueue->WaitLock, OldIrql);
301  if (WaitEntry) ExFreePool(WaitEntry);
302 
303  return Status;
304 }
PNP_WAIT_QUEUE WaitQueue
Definition: npfs.h:171
LARGE_INTEGER Timeout
Definition: winioctl.h:457
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PVOID NTAPI ExAllocatePoolWithQuotaTag(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: expool.c:2939
_In_ PIRP Irp
Definition: csq.h:116
_In_ LARGE_INTEGER DueTime
Definition: kefuncs.h:524
PFILE_OBJECT FileObject
Definition: npfs.h:173
LONG NTSTATUS
Definition: precomp.h:26
UNICODE_STRING AliasName
Definition: npfs.h:172
#define InsertTailList(ListHead, Entry)
IoSetCancelRoutine(Irp, CancelRoutine)
NTSYSAPI WCHAR NTAPI RtlUpcaseUnicodeChar(WCHAR Source)
VOID NTAPI NpCancelWaitQueueIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: waitsup.c:20
UCHAR KIRQL
Definition: env_spec_w32.h:591
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
KTIMER Timer
Definition: npfs.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STATUS_PENDING
Definition: ntstatus.h:82
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
Definition: npfs.h:166
PIRP Irp
Definition: npfs.h:168
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define NPFS_WRITE_BLOCK_TAG
Definition: npfs.h:64
Status
Definition: gdiplustypes.h:24
VOID NTAPI NpTimerDispatch(IN PKDPC Dpc, IN PVOID Context, IN PVOID Argument1, IN PVOID Argument2)
Definition: waitsup.c:59
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
KDPC Dpc
Definition: npfs.h:169
#define ObReferenceObject
Definition: obfuncs.h:204
unsigned int ULONG
Definition: retypes.h:1
#define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
IoMarkIrpPending(Irp)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NpWaitForNamedPipe().

◆ NpCancelWaiter()

NTSTATUS NTAPI NpCancelWaiter ( IN PNP_WAIT_QUEUE  WaitQueue,
IN PUNICODE_STRING  PipeName,
IN NTSTATUS  Status,
IN PLIST_ENTRY  ListEntry 
)

Definition at line 120 of file waitsup.c.

124 {
125  UNICODE_STRING PipePathUpper;
126  KIRQL OldIrql;
127  PWCHAR Buffer;
128  PLIST_ENTRY NextEntry;
129  PNP_WAIT_QUEUE_ENTRY WaitEntry, Linkage;
130  PIRP WaitIrp;
131  PFILE_PIPE_WAIT_FOR_BUFFER WaitBuffer;
132  UNICODE_STRING WaitName, PipeName;
133 
134  Linkage = NULL;
135 
137  PipePath->Length,
140 
141  RtlInitEmptyUnicodeString(&PipePathUpper, Buffer, PipePath->Length);
142  RtlUpcaseUnicodeString(&PipePathUpper, PipePath, FALSE);
143 
144  KeAcquireSpinLock(&WaitQueue->WaitLock, &OldIrql);
145 
146  NextEntry = WaitQueue->WaitList.Flink;
147  while (NextEntry != &WaitQueue->WaitList)
148  {
149  WaitIrp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
150  NextEntry = NextEntry->Flink;
151  WaitEntry = WaitIrp->Tail.Overlay.DriverContext[1];
152 
153  if (WaitEntry->AliasName.Length)
154  {
155  ASSERT(FALSE);
156  /* We have an alias. Use that for comparison */
157  WaitName = WaitEntry->AliasName;
158  PipeName = PipePathUpper;
159  }
160  else
161  {
162  /* Use the name from the wait buffer to compare */
163  WaitBuffer = WaitIrp->AssociatedIrp.SystemBuffer;
164  WaitName.Buffer = WaitBuffer->Name;
165  WaitName.Length = WaitBuffer->NameLength;
166  WaitName.MaximumLength = WaitName.Length;
167 
168  /* WaitName doesn't have a leading backslash,
169  * so skip the one in PipePathUpper for the comparison */
170  PipeName.Buffer = PipePathUpper.Buffer + 1;
171  PipeName.Length = PipePathUpper.Length - sizeof(WCHAR);
172  PipeName.MaximumLength = PipeName.Length;
173  }
174 
175  /* Can't use RtlEqualUnicodeString with a spinlock held */
176  if (NpEqualUnicodeString(&WaitName, &PipeName))
177  {
178  /* Found a matching wait. Cancel it */
179  RemoveEntryList(&WaitIrp->Tail.Overlay.ListEntry);
180  if (KeCancelTimer(&WaitEntry->Timer))
181  {
182  WaitEntry->WaitQueue = (PNP_WAIT_QUEUE)Linkage;
183  Linkage = WaitEntry;
184  }
185  else
186  {
187  WaitEntry->Irp = NULL;
188  WaitIrp->Tail.Overlay.DriverContext[1] = NULL;
189  }
190 
191  if (IoSetCancelRoutine(WaitIrp, NULL))
192  {
193  WaitIrp->IoStatus.Information = 0;
194  WaitIrp->IoStatus.Status = Status;
195  InsertTailList(List, &WaitIrp->Tail.Overlay.ListEntry);
196  }
197  else
198  {
199  WaitIrp->Tail.Overlay.DriverContext[1] = NULL;
200  }
201  }
202  }
203 
204  KeReleaseSpinLock(&WaitQueue->WaitLock, OldIrql);
205 
207 
208  while (Linkage)
209  {
210  WaitEntry = Linkage;
211  Linkage = (PNP_WAIT_QUEUE_ENTRY)Linkage->WaitQueue;
212  ObDereferenceObject(WaitEntry->FileObject);
213  ExFreePool(WaitEntry);
214  }
215 
216  return STATUS_SUCCESS;
217 }
PNP_WAIT_QUEUE WaitQueue
Definition: npfs.h:171
#define NPFS_WAIT_BLOCK_TAG
Definition: npfs.h:63
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
Definition: string_lib.cpp:46
USHORT MaximumLength
Definition: env_spec_w32.h:370
PFILE_OBJECT FileObject
Definition: npfs.h:173
UNICODE_STRING AliasName
Definition: npfs.h:172
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
IRP
Definition: iotypes.h:2463
uint16_t * PWCHAR
Definition: typedefs.h:54
#define InsertTailList(ListHead, Entry)
IoSetCancelRoutine(Irp, CancelRoutine)
struct _NP_WAIT_QUEUE_ENTRY * PNP_WAIT_QUEUE_ENTRY
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
KTIMER Timer
Definition: npfs.h:170
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
Definition: timerobj.c:206
LIST_ENTRY List
Definition: psmgr.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
Definition: npfs.h:166
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
PIRP Irp
Definition: npfs.h:168
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
struct _NP_WAIT_QUEUE * PNP_WAIT_QUEUE
static BOOLEAN NpEqualUnicodeString(IN PCUNICODE_STRING String1, IN PCUNICODE_STRING String2)
Definition: waitsup.c:104
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NpCreateExistingNamedPipe(), NpDeleteFcb(), and NpSetListeningPipeState().

◆ NpCheckForNotify()

VOID NTAPI NpCheckForNotify ( IN PNP_DCB  Dcb,
IN BOOLEAN  SecondList,
IN PLIST_ENTRY  List 
)

Definition at line 20 of file create.c.

23 {
24  PLIST_ENTRY NextEntry, ListHead;
25  PIRP Irp;
26  ULONG i;
27  PAGED_CODE();
28 
29  ListHead = &Dcb->NotifyList;
30  for (i = 0; i < 2; i++)
31  {
32  ASSERT(IsListEmpty(ListHead));
33  while (!IsListEmpty(ListHead))
34  {
35  NextEntry = RemoveHeadList(ListHead);
36 
37  Irp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
38 
40  {
41  Irp->IoStatus.Status = STATUS_SUCCESS;
42  InsertTailList(List, NextEntry);
43  }
44  else
45  {
46  InitializeListHead(NextEntry);
47  }
48  }
49 
50  if (!SecondList) break;
51  ListHead = &Dcb->NotifyList2;
52  }
53 }
_In_ PIRP Irp
Definition: csq.h:116
IRP
Definition: iotypes.h:2463
#define InsertTailList(ListHead, Entry)
IoSetCancelRoutine(Irp, CancelRoutine)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PAGED_CODE()
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: typedefs.h:117
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157

Referenced by NpCreateExistingNamedPipe(), NpCreateNewNamedPipe(), NpDeleteCcb(), NpDeleteFcb(), and NpSetPipeInfo().

◆ NpCompareAliasNames()

LONG NTAPI NpCompareAliasNames ( _In_ PCUNICODE_STRING  String1,
_In_ PCUNICODE_STRING  String2 
)

Definition at line 152 of file main.c.

155 {
156  ULONG Count;
157  PWCHAR P1, P2;
158 
159  /* First check if the string sizes match */
160  if (String1->Length != String2->Length)
161  {
162  /* They don't, return positive if the first is longer, negative otherwise */
163  return String1->Length - String2->Length;
164  }
165 
166  /* Now loop all characters */
167  Count = String1->Length / sizeof(WCHAR);
168  P1 = String1->Buffer;
169  P2 = String2->Buffer;
170  while (Count)
171  {
172  /* Check if they don't match */
173  if (*P1 != *P2)
174  {
175  /* Return positive if the first char is greater, negative otherwise */
176  return *P1 - *P2;
177  }
178 
179  /* Go to the next buffer position */
180  P1++;
181  P2++;
182  Count--;
183  }
184 
185  /* All characters matched, return 0 */
186  return 0;
187 }
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
uint16_t * PWCHAR
Definition: typedefs.h:54
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ const STRING * String2
Definition: rtlfuncs.h:2261
unsigned int ULONG
Definition: retypes.h:1

Referenced by NpInitializeAliases(), and NpTranslateAlias().

◆ NpCompleteDeferredIrps()

FORCEINLINE VOID NpCompleteDeferredIrps ( IN PLIST_ENTRY  DeferredList)

Definition at line 356 of file npfs.h.

357 {
358  PLIST_ENTRY ThisEntry, NextEntry;
359  PIRP Irp;
360 
361  /* Loop the list */
362  ThisEntry = DeferredList->Flink;
363  while (ThisEntry != DeferredList)
364  {
365  /* Remember the next entry, but don't switch to it yet */
366  NextEntry = ThisEntry->Flink;
367 
368  /* Complete the IRP for this entry */
369  Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
371 
372  /* And now switch to the next one */
373  ThisEntry = NextEntry;
374  }
375 }
_In_ PIRP Irp
Definition: csq.h:116
IRP
Definition: iotypes.h:2463
#define IoCompleteRequest
Definition: irp.c:1240
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Definition: typedefs.h:117

Referenced by _Function_class_(), NpCancelDataQueueIrp(), NpCommonCleanup(), NpCommonClose(), NpCommonFileSystemControl(), NpFsdCreate(), NpFsdCreateNamedPipe(), NpFsdRead(), NpFsdSetInformation(), and NpFsdWrite().

◆ NpCompleteStalledWrites()

VOID NTAPI NpCompleteStalledWrites ( IN PNP_DATA_QUEUE  DataQueue,
IN PLIST_ENTRY  List 
)

Definition at line 49 of file datasup.c.

51 {
52  ULONG QuotaLeft, ByteOffset, DataLeft, NewQuotaLeft;
53  PNP_DATA_QUEUE_ENTRY DataQueueEntry;
54  PIRP Irp;
55  PLIST_ENTRY NextEntry;
56 
57  QuotaLeft = DataQueue->Quota - DataQueue->QuotaUsed;
58  ByteOffset = DataQueue->ByteOffset;
59 
60  NextEntry = DataQueue->Queue.Flink;
61  while (NextEntry != &DataQueue->Queue)
62  {
63  if (!QuotaLeft) break;
64 
65  DataQueueEntry = CONTAINING_RECORD(NextEntry,
67  QueueEntry);
68 
69  Irp = DataQueueEntry->Irp;
70 
71  if ((DataQueueEntry->DataEntryType == Buffered) && (Irp))
72  {
73  DataLeft = DataQueueEntry->DataSize - ByteOffset;
74 
75  if (DataQueueEntry->QuotaInEntry < DataLeft)
76  {
77  NewQuotaLeft = DataLeft - DataQueueEntry->QuotaInEntry;
78  if (NewQuotaLeft > QuotaLeft) NewQuotaLeft = QuotaLeft;
79 
80  QuotaLeft -= NewQuotaLeft;
81  DataQueueEntry->QuotaInEntry += NewQuotaLeft;
82 
83  if (DataQueueEntry->QuotaInEntry == DataLeft &&
85  {
86  DataQueueEntry->Irp = NULL;
87 
88  Irp->IoStatus.Status = STATUS_SUCCESS;
89  Irp->IoStatus.Information = DataQueueEntry->DataSize;
90 
91  InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
92  }
93  }
94  }
95 
96  NextEntry = NextEntry->Flink;
97  ByteOffset = 0;
98  }
99 
100  DataQueue->QuotaUsed = DataQueue->Quota - QuotaLeft;
101 }
_In_ PIRP Irp
Definition: csq.h:116
Definition: npfs.h:131
#define InsertTailList(ListHead, Entry)
IoSetCancelRoutine(Irp, CancelRoutine)
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
ULONG DataSize
Definition: npfs.h:155
LIST_ENTRY List
Definition: psmgr.c:57
Definition: npfs.h:148
Definition: typedefs.h:117
ULONG DataEntryType
Definition: npfs.h:151
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966
ULONG QuotaInEntry
Definition: npfs.h:153
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:716
PIRP Irp
Definition: npfs.h:152

Referenced by NpCancelDataQueueIrp(), NpReadDataQueue(), and NpRemoveDataQueueEntry().

◆ NpCopyClientContext()

VOID NTAPI NpCopyClientContext ( IN PNP_CCB  Ccb,
IN PNP_DATA_QUEUE_ENTRY  DataQueueEntry 
)

Definition at line 58 of file secursup.c.

60 {
61  PAGED_CODE();
62 
63  if (!DataQueueEntry->ClientSecurityContext) return;
64 
65  NpFreeClientSecurityContext(Ccb->ClientContext);
66  Ccb->ClientContext = DataQueueEntry->ClientSecurityContext;
67  DataQueueEntry->ClientSecurityContext = NULL;
68 }
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
VOID NTAPI NpFreeClientSecurityContext(IN PSECURITY_CLIENT_CONTEXT ClientContext)
Definition: secursup.c:40

Referenced by NpReadDataQueue().

◆ NpCreateCcb()

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 
)

Definition at line 304 of file strucsup.c.

312 {
313  PNP_CCB Ccb;
314  PNP_NONPAGED_CCB CcbNonPaged;
316  PAGED_CODE();
317 
319  if (!Ccb) return STATUS_INSUFFICIENT_RESOURCES;
320 
321  CcbNonPaged = ExAllocatePoolWithTag(NonPagedPool, sizeof(*CcbNonPaged), NPFS_CCB_TAG);
322  if (!CcbNonPaged)
323  {
324  ExFreePool(Ccb);
326  }
327 
328  RtlZeroMemory(CcbNonPaged, sizeof(*CcbNonPaged));
329  CcbNonPaged->NodeType = NPFS_NTC_NONPAGED_CCB;
330 
331  RtlZeroMemory(Ccb, sizeof(*Ccb));
332  Ccb->NodeType = NPFS_NTC_CCB;
333  Ccb->NonPagedCcb = CcbNonPaged;
335  Ccb->Fcb = Fcb;
336  Ccb->NamedPipeState = State;
337  Ccb->ReadMode[FILE_PIPE_SERVER_END] = ReadMode;
338  Ccb->CompletionMode[FILE_PIPE_SERVER_END] = CompletionMode;
339 
340  Status = NpInitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_INBOUND], InQuota);
341  if (!NT_SUCCESS(Status))
342  {
343  ExFreePool(CcbNonPaged);
344  ExFreePool(Ccb);
346  }
347 
348  Status = NpInitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_OUTBOUND], OutQuota);
349  if (!NT_SUCCESS(Status))
350  {
352  ExFreePool(CcbNonPaged);
353  ExFreePool(Ccb);
355  }
356 
357  InsertTailList(&Fcb->CcbList, &Ccb->CcbEntry);
358 
359  Fcb->CurrentInstances++;
360  Fcb->ServerOpenCount++;
361  InitializeListHead(&Ccb->IrpList);
362  ExInitializeResourceLite(&Ccb->NonPagedCcb->Lock);
363  *NewCcb = Ccb;
364  return STATUS_SUCCESS;
365 }
#define NPFS_CCB_TAG
Definition: npfs.h:53
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PFILE_OBJECT FileObject
Definition: ntfs.h:516
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NpInitializeDataQueue(IN PNP_DATA_QUEUE DataQueue, IN ULONG Quota)
Definition: datasup.c:32
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define InsertTailList(ListHead, Entry)
#define PAGED_CODE()
Definition: video.h:57
Definition: npfs.h:258
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
NTSTATUS NTAPI NpUninitializeDataQueue(IN PNP_DATA_QUEUE DataQueue)
Definition: datasup.c:20
Status
Definition: gdiplustypes.h:24
enum State_ State
Definition: pofuncs.h:54
NODE_TYPE_CODE NodeType
Definition: npfs.h:252
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
struct _FCB::@693::@696 Fcb
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define NPFS_NTC_NONPAGED_CCB
Definition: npfs.h:116
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NpCreateExistingNamedPipe(), and NpCreateNewNamedPipe().

◆ NpCreateFcb()

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 
)

Definition at line 210 of file strucsup.c.

217 {
218  PNP_FCB Fcb;
219  BOOLEAN RootPipe;
220  PWCHAR NameBuffer;
222  PAGED_CODE();
223 
224  Length = PipeName->Length;
225  MaximumLength = Length + sizeof(UNICODE_NULL);
226 
227  if ((Length < sizeof(WCHAR)) || (MaximumLength < Length))
228  {
230  }
231 
232  RootPipe = FALSE;
233  if (PipeName->Buffer[0] != OBJ_NAME_PATH_SEPARATOR)
234  {
235  Length += sizeof(OBJ_NAME_PATH_SEPARATOR);
237  RootPipe = TRUE;
238  if (MaximumLength < sizeof(WCHAR))
239  {
241  }
242  }
243 
245  if (!Fcb) return STATUS_INSUFFICIENT_RESOURCES;
246 
247  RtlZeroMemory(Fcb, sizeof(*Fcb));
248  Fcb->MaximumInstances = MaximumInstances;
249  Fcb->Timeout = Timeout;
250  Fcb->NodeType = NPFS_NTC_FCB;
251  Fcb->ParentDcb = Dcb;
252  InitializeListHead(&Fcb->CcbList);
253 
254  NameBuffer = ExAllocatePoolWithTag(PagedPool,
257  if (!NameBuffer)
258  {
259  ExFreePool(Fcb);
261  }
262 
263  InsertTailList(&Dcb->FcbList, &Fcb->DcbEntry);
264 
265  if (RootPipe)
266  {
267  NameBuffer[0] = OBJ_NAME_PATH_SEPARATOR;
268  RtlCopyMemory(NameBuffer + 1,
269  PipeName->Buffer,
270  PipeName->Length);
271  }
272  else
273  {
274  RtlCopyMemory(NameBuffer,
275  PipeName->Buffer,
276  PipeName->Length);
277  }
278 
279  NameBuffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
280 
281  Fcb->FullName.Length = Length;
282  Fcb->FullName.MaximumLength = MaximumLength;
283  Fcb->FullName.Buffer = NameBuffer;
284 
285  Fcb->ShortName.MaximumLength = Length;
286  Fcb->ShortName.Length = Length - sizeof(OBJ_NAME_PATH_SEPARATOR);
287  Fcb->ShortName.Buffer = NameBuffer + 1;
288 
290  &Fcb->FullName,
291  &Fcb->PrefixTableEntry))
292  {
293  NpBugCheck(0, 0, 0);
294  }
295 
296  Fcb->NamedPipeConfiguration = NamedPipeConfiguration;
297  Fcb->NamedPipeType = NamedPipeType;
298  *NewFcb = Fcb;
299  return STATUS_SUCCESS;
300 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define NPFS_NAME_BLOCK_TAG
Definition: npfs.h:59
uint16_t * PWCHAR
Definition: typedefs.h:54
#define InsertTailList(ListHead, Entry)
struct _FCB * ParentDcb
Definition: fatstruc.h:835
#define PAGED_CODE()
Definition: video.h:57
Definition: npfs.h:228
#define UNICODE_NULL
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
PNP_VCB NpVcb
Definition: strucsup.c:19
unsigned char BOOLEAN
#define NpBugCheck(p1, p2, p3)
Definition: npfs.h:106
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NPFS_FCB_TAG
Definition: npfs.h:56
BOOLEAN NTAPI RtlInsertUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable, PUNICODE_STRING Prefix, PUNICODE_PREFIX_TABLE_ENTRY PrefixTableEntry)
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982
UNICODE_PREFIX_TABLE PrefixTable
Definition: npfs.h:282
static ULONG Timeout
Definition: ping.c:61
unsigned short USHORT
Definition: pedump.c:61
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NPFS_NTC_FCB
Definition: npfs.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2966
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1114
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NpCreateNewNamedPipe().

◆ NpCreateRootDcb()

NTSTATUS NTAPI NpCreateRootDcb ( VOID  )

Definition at line 165 of file strucsup.c.

166 {
167  PNP_DCB Dcb;
168  PAGED_CODE();
169 
170  if (NpVcb->RootDcb)
171  {
172  NpBugCheck(0, 0, 0);
173  }
174 
176  if (!NpVcb->RootDcb)
177  {
179  }
180 
181  Dcb = NpVcb->RootDcb;
182  RtlZeroMemory(Dcb, sizeof(*Dcb));
183  Dcb->NodeType = NPFS_NTC_ROOT_DCB;
184 
185  InitializeListHead(&Dcb->DcbEntry);
186  InitializeListHead(&Dcb->NotifyList);
187  InitializeListHead(&Dcb->NotifyList2);
188  InitializeListHead(&Dcb->FcbList);
189 
190  Dcb->FullName.Buffer = NpRootDCBName;
191  Dcb->FullName.Length = sizeof(NpRootDCBName) - sizeof(UNICODE_NULL);
192  Dcb->FullName.MaximumLength = sizeof(NpRootDCBName);
193 
194  Dcb->ShortName.Length = Dcb->FullName.Length;
195  Dcb->ShortName.MaximumLength = Dcb->FullName.MaximumLength;
196  Dcb->ShortName.Buffer = Dcb->FullName.Buffer;
197 
199  &Dcb->FullName,
200  &Dcb->PrefixTableEntry))
201  {
202  NpBugCheck(0, 0, 0);
203  }
204 
205  return STATUS_SUCCESS;
206 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define NPFS_DCB_TAG
Definition: npfs.h:55
#define PAGED_CODE()
Definition: video.h:57
Definition: npfs.h:210
#define UNICODE_NULL
PNP_VCB NpVcb
Definition: strucsup.c:19
#define NpBugCheck(p1, p2, p3)
Definition: npfs.h:106
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
BOOLEAN NTAPI RtlInsertUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable, PUNICODE_STRING Prefix, PUNICODE_PREFIX_TABLE_ENTRY PrefixTableEntry)
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
UNICODE_PREFIX_TABLE PrefixTable
Definition: npfs.h:282
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PNP_DCB RootDcb
Definition: npfs.h:281
WCHAR NpRootDCBName[]
Definition: strucsup.c:18
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2966
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157

Referenced by DriverEntry().

◆ NpCreateRootDcbCcb()

NTSTATUS NTAPI NpCreateRootDcbCcb ( IN PNP_ROOT_DCB_FCB NewRootCcb)

Definition at line 149 of file strucsup.c.

150 {
151  PNP_ROOT_DCB_FCB RootCcb;
152  PAGED_CODE();
153 
154  RootCcb = ExAllocatePoolWithTag(PagedPool, sizeof(*RootCcb), NPFS_ROOT_DCB_CCB_TAG);
155  if (!RootCcb) return STATUS_INSUFFICIENT_RESOURCES;
156 
157  RtlZeroMemory(RootCcb, sizeof(*RootCcb));
158  RootCcb->NodeType = NPFS_NTC_ROOT_DCB_CCB;
159  *NewRootCcb = RootCcb;
160  return STATUS_SUCCESS;
161 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PAGED_CODE()
Definition: video.h:57
#define NPFS_ROOT_DCB_CCB_TAG
Definition: npfs.h:54
#define NPFS_NTC_ROOT_DCB_CCB
Definition: npfs.h:117
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NODE_TYPE_CODE NodeType
Definition: npfs.h:185
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by NpOpenNamedPipeRootDirectory().

◆ NpDecodeFileObject()

NODE_TYPE_CODE NTAPI NpDecodeFileObject ( IN PFILE_OBJECT  FileObject,
OUT PVOID *PrimaryContext  OPTIONAL,
OUT PNP_CCB Ccb,
OUT PULONG NamedPipeEnd  OPTIONAL 
)

Definition at line 20 of file fileobsup.c.

24 {
26  PNP_CCB Node;
27  PAGED_CODE();
28 
29  Context = (ULONG_PTR)FileObject->FsContext;
30  if ((Context) && (Context != 1))
31  {
32  if (NamedPipeEnd) *NamedPipeEnd = Context & 1;
33 
34  Node = (PVOID)(Context & ~1);
35 
36  switch (Node->NodeType)
37  {
38  case NPFS_NTC_VCB:
39  return NPFS_NTC_VCB;
40 
41  case NPFS_NTC_ROOT_DCB:
42  *Ccb = FileObject->FsContext2;
43  if (PrimaryContext) *PrimaryContext = Node;
44  return NPFS_NTC_ROOT_DCB;
45 
46  case NPFS_NTC_CCB:
47  *Ccb = Node;
48  if (PrimaryContext) *PrimaryContext = Node->Fcb;
49  return NPFS_NTC_CCB;
50 
51  default:
52  NpBugCheck(Node->NodeType, 0, 0);
53  break;
54  }
55  }
56 
57  return 0;
58 }
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define PAGED_CODE()
Definition: video.h:57
uint32_t ULONG_PTR
Definition: typedefs.h:63
Definition: npfs.h:258
union node Node
Definition: types.h:1255
void * PVOID
Definition: retypes.h:9
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define NpBugCheck(p1, p2, p3)
Definition: npfs.h:106
if(!(yy_init))
Definition: macro.lex.yy.c:714
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
struct tagContext Context
Definition: acpixf.h:1024
#define ULONG_PTR
Definition: config.h:101
#define NPFS_NTC_VCB
Definition: npfs.h:112
Definition: dlist.c:348

Referenced by NpCommonCleanup(), NpCommonClose(), NpCommonFlushBuffers(), NpCommonQueryInformation(), NpCommonQuerySecurityInfo(), NpCommonRead(), NpCommonSetInformation(), NpCommonSetSecurityInfo(), NpCommonWrite(), NpDisconnect(), NpFsdCreate(), NpImpersonate(), NpListen(), NpPeek(), NpQueryClientProcess(), NpSetClientProcess(), NpTransceive(), and NpWaitForNamedPipe().

◆ NpDeleteCcb()

VOID NTAPI NpDeleteCcb ( IN PNP_CCB  Ccb,
IN PLIST_ENTRY  ListEntry 
)

Definition at line 92 of file strucsup.c.

94 {
95  PNP_ROOT_DCB_FCB RootDcbCcb;
96  PAGED_CODE();
97 
98  RootDcbCcb = (PNP_ROOT_DCB_FCB)Ccb;
99  if (Ccb->NodeType == NPFS_NTC_CCB)
100  {
101  RemoveEntryList(&Ccb->CcbEntry);
102  --Ccb->Fcb->CurrentInstances;
103 
105  Ccb->NonPagedCcb->EventBuffer[FILE_PIPE_CLIENT_END]);
107  Ccb->NonPagedCcb->EventBuffer[FILE_PIPE_SERVER_END]);
110  NpCheckForNotify(Ccb->Fcb->ParentDcb, FALSE, ListEntry);
111  ExDeleteResourceLite(&Ccb->NonPagedCcb->Lock);
113  if (Ccb->ClientSession)
114  {
115  ExFreePool(Ccb->ClientSession);
116  Ccb->ClientSession = NULL;
117  }
118  ExFreePool(Ccb->NonPagedCcb);
119  }
120  else if (RootDcbCcb->NodeType == NPFS_NTC_ROOT_DCB_CCB && RootDcbCcb->Unknown)
121  {
122  ExFreePool(RootDcbCcb->Unknown);
123  }
124 
125  ExFreePool(Ccb);
126 }
NTSTATUS NTAPI ExDeleteResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1456
#define FILE_PIPE_CLIENT_END
Definition: iotypes.h:84
#define NPFS_NTC_CCB
Definition: npfs.h:115
VOID NTAPI NpCheckForNotify(IN PNP_DCB Dcb, IN BOOLEAN SecondList, IN PLIST_ENTRY List)
Definition: create.c:20
#define PAGED_CODE()
Definition: video.h:57
PVOID Unknown
Definition: npfs.h:186
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
PNP_VCB NpVcb
Definition: strucsup.c:19
smooth NULL
Definition: ftsmooth.c:416
#define NPFS_NTC_ROOT_DCB_CCB
Definition: npfs.h:117
struct _NP_ROOT_DCB_CCB * PNP_ROOT_DCB_FCB
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
RTL_GENERIC_TABLE EventTable
Definition: npfs.h:284
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
VOID NTAPI NpUninitializeSecurity(IN PNP_CCB Ccb)
Definition: secursup.c:72
NTSTATUS NTAPI NpUninitializeDataQueue(IN PNP_DATA_QUEUE DataQueue)
Definition: datasup.c:20
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
struct _FCB::@693::@696 Fcb
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
NODE_TYPE_CODE NodeType
Definition: npfs.h:185
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
BOOLEAN NTAPI NpDeleteEventTableEntry(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer)
Definition: strucsup.c:52

Referenced by NpCommonClose(), NpCreateExistingNamedPipe(), NpCreateNewNamedPipe(), and NpSetClosingPipeState().

◆ NpDeleteEventTableEntry()

BOOLEAN NTAPI NpDeleteEventTableEntry ( IN PRTL_GENERIC_TABLE  Table,
IN PVOID  Buffer 
)

Definition at line 52 of file strucsup.c.

54 {
55  if (!Buffer) return FALSE;
56 
59 }
ASMGENDATA Table[]
Definition: genincdata.c:61
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
Definition: bufpool.h:45
NTSYSAPI BOOLEAN NTAPI RtlDeleteElementGenericTable(_In_ PRTL_GENERIC_TABLE Table, _In_ PVOID Buffer)

Referenced by NpDeleteCcb(), and NpSetDisconnectedPipeState().

◆ NpDeleteFcb()

VOID NTAPI NpDeleteFcb ( IN PNP_FCB  Fcb,
IN PLIST_ENTRY  ListEntry 
)

Definition at line 63 of file strucsup.c.

65 {
66  PNP_DCB Dcb;
67  PAGED_CODE();
68 
69  Dcb = Fcb->ParentDcb;
70  if (Fcb->CurrentInstances) NpBugCheck(0, 0, 0);
71 
73  &Fcb->FullName,
75  ListEntry);
76 
77  RemoveEntryList(&Fcb->DcbEntry);
78 
79  if (Fcb->SecurityDescriptor)
80  {
81  ObDereferenceSecurityDescriptor(Fcb->SecurityDescriptor, 1);
82  }
83 
84  RtlRemoveUnicodePrefix(&NpVcb->PrefixTable, &Fcb->PrefixTableEntry);
85  ExFreePool(Fcb->FullName.Buffer);
86  ExFreePool(Fcb);
87  NpCheckForNotify(Dcb, TRUE, ListEntry);
88 }
#define TRUE
Definition: types.h:120
VOID NTAPI ObDereferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Count)
Definition: obsdcach.c:287
NP_WAIT_QUEUE WaitQueue
Definition: npfs.h:285
VOID NTAPI RtlRemoveUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable, PUNICODE_PREFIX_TABLE_ENTRY PrefixTableEntry)
VOID NTAPI NpCheckForNotify(IN PNP_DCB Dcb, IN BOOLEAN SecondList, IN PLIST_ENTRY List)
Definition: create.c:20
struct _FCB * ParentDcb
Definition: fatstruc.h:835
#define PAGED_CODE()
Definition: video.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
Definition: npfs.h:210
PNP_VCB NpVcb
Definition: strucsup.c:19
#define NpBugCheck(p1, p2, p3)
Definition: npfs.h:106
UNICODE_PREFIX_TABLE PrefixTable
Definition: npfs.h:282
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
NTSTATUS NTAPI NpCancelWaiter(IN PNP_WAIT_QUEUE WaitQueue, IN PUNICODE_STRING PipeName, IN NTSTATUS Status, IN PLIST_ENTRY ListEntry)
Definition: waitsup.c:120
_In_ PFCB Fcb
Definition: cdprocs.h:151
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NpCreateNewNamedPipe(), and NpSetClosingPipeState().

◆ NpFindPrefix()

PNP_FCB NTAPI NpFindPrefix ( IN PUNICODE_STRING  Name,
IN ULONG  CaseInsensitiveIndex,
IN PUNICODE_STRING  Prefix 
)

Definition at line 20 of file prefxsup.c.

23 {
25  PNP_FCB Fcb;
26  PAGED_CODE();
27 
29  Name,
31  if (!Entry) NpBugCheck(0, 0, 0);
32 
34 
35  Prefix->Length = Name->Length - Fcb->FullName.Length;
37  Prefix->Buffer = &Name->Buffer[Fcb->FullName.Length / sizeof(WCHAR)];
38 
40  {
41  Prefix->Length -= sizeof(WCHAR);
42  Prefix->MaximumLength -= sizeof(WCHAR);
43  ++Prefix->Buffer;
44  }
45 
46  return Fcb;
47 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
struct _Entry Entry
Definition: kefuncs.h:640
_In_ __drv_aliasesMem PSTRING _Out_ PPREFIX_TABLE_ENTRY PrefixTableEntry
Definition: rtlfuncs.h:1631
unsigned short Length
Definition: sprintf.c:451
#define PAGED_CODE()
Definition: video.h:57
Definition: npfs.h:228
void * Buffer
Definition: sprintf.c:453
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
Definition: rtltypes.h:617
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NpBugCheck(p1, p2, p3)
Definition: npfs.h:106
__wchar_t WCHAR
Definition: xmlstorage.h:180
PUNICODE_PREFIX_TABLE_ENTRY NTAPI RtlFindUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable, PUNICODE_STRING FullName, ULONG CaseInsensitiveIndex)
PNP_VCB NpVcb
Definition: strucsup.c:19
UNICODE_PREFIX_TABLE PrefixTable
Definition: npfs.h:282
_In_ PFCB Fcb
Definition: cdprocs.h:151
unsigned short MaximumLength
Definition: sprintf.c:452
_In_ PUNICODE_STRING _In_ ULONG CaseInsensitiveIndex
Definition: rtlfuncs.h:1682
base of all file and directory entries
Definition: entries.h:82

Referenced by NpFindRelativePrefix(), NpFsdCreate(), NpFsdCreateNamedPipe(), and NpWaitForNamedPipe().

◆ NpFindRelativePrefix()

NTSTATUS NTAPI NpFindRelativePrefix ( IN PNP_DCB  Dcb,
IN PUNICODE_STRING  Name,
IN ULONG  CaseInsensitiveIndex,
IN PUNICODE_STRING  Prefix,
OUT PNP_FCB FoundFcb 
)

Definition at line 51 of file prefxsup.c.

56 {
57  PWCHAR Buffer;
58  PNP_FCB Fcb;
59  UNICODE_STRING RootName;
61  PAGED_CODE();
62 
63  Length = Name->Length;
66 
67  ASSERT(Dcb->NodeType == NPFS_NTC_ROOT_DCB);
68 
70  if (!Buffer)
71  {
73  }
74 
76  RtlCopyMemory(Buffer + 1, Name->Buffer, Length);
77  Buffer[(Length / sizeof(WCHAR)) + 1] = UNICODE_NULL;
78 
79  RootName.Length = Length + sizeof(OBJ_NAME_PATH_SEPARATOR);
80  RootName.MaximumLength = MaximumLength;
81  RootName.Buffer = Buffer;
82 
84 
86 
87  Prefix->Buffer = &Name->Buffer[(Length - Prefix->Length) / sizeof(WCHAR)];
88  *FoundFcb = Fcb;
89 
90  return STATUS_SUCCESS;
91 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define NPFS_NAME_BLOCK_TAG
Definition: npfs.h:59
unsigned short Length
Definition: sprintf.c:451
uint16_t * PWCHAR
Definition: typedefs.h:54
#define PAGED_CODE()
Definition: video.h:57
Definition: npfs.h:228
void * Buffer
Definition: sprintf.c:453
#define UNICODE_NULL
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982
unsigned short USHORT
Definition: pedump.c:61
PNP_FCB NTAPI NpFindPrefix(IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix)
Definition: prefxsup.c:20
_In_ PFCB Fcb
Definition: cdprocs.h:151
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
_In_ PUNICODE_STRING _In_ ULONG CaseInsensitiveIndex
Definition: rtlfuncs.h:1682
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NpFsdCreate(), and NpFsdCreateNamedPipe().

◆ NpFreeClientSecurityContext()

VOID NTAPI NpFreeClientSecurityContext ( IN PSECURITY_CLIENT_CONTEXT  ClientContext)

Definition at line 40 of file secursup.c.

41 {
43  PVOID ClientToken;
44 
45  if (!ClientContext) return;
46 
47  TokenType = SeTokenType(ClientContext->ClientToken);
48  ClientToken = ClientContext->ClientToken;
49  if ((TokenType == TokenPrimary) || (ClientToken))
50  {
51  ObDereferenceObject(ClientToken);
52  }
54 }
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTKERNELAPI TOKEN_TYPE NTAPI SeTokenType(IN PACCESS_TOKEN Token)
Definition: token.c:1780
_In_ PVOID ClientContext
Definition: netioddk.h:55
enum _TOKEN_TYPE TOKEN_TYPE
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ BOOLEAN _In_ TOKEN_TYPE TokenType
Definition: sefuncs.h:417

Referenced by NpAddDataQueueEntry(), NpCancelDataQueueIrp(), NpCopyClientContext(), NpRemoveDataQueueEntry(), NpUninitializeSecurity(), and NpWriteDataQueue().

◆ NpFsdCleanup()

NTSTATUS NTAPI NpFsdCleanup ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 58 of file cleanup.c.

60 {
62  PAGED_CODE();
63 
65 
67 
69 
70  if (Status != STATUS_PENDING)
71  {
72  Irp->IoStatus.Status = Status;
74  }
75 
76  return Status;
77 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NpCommonCleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: cleanup.c:20
#define PAGED_CODE()
Definition: video.h:57
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560

Referenced by DriverEntry().

◆ NpFsdClose()

NTSTATUS NTAPI NpFsdClose ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 59 of file close.c.

61 {
63  PAGED_CODE();
64 
66 
68 
70 
71  return Status;
72 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NpCommonClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: close.c:20
#define PAGED_CODE()
Definition: video.h:57
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560

Referenced by DriverEntry().

◆ NpFsdCreate()

NTSTATUS NTAPI NpFsdCreate ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 360 of file create.c.

362 {
364  PIO_STACK_LOCATION IoStack;
367  PFILE_OBJECT RelatedFileObject;
369  PNP_CCB Ccb;
370  PNP_FCB Fcb;
371  PNP_DCB Dcb;
373  LIST_ENTRY DeferredList;
375  TRACE("Entered\n");
376 
377  InitializeListHead(&DeferredList);
379  FileObject = IoStack->FileObject;
380  RelatedFileObject = FileObject->RelatedFileObject;
382  DesiredAccess = IoStack->Parameters.CreatePipe.SecurityContext->DesiredAccess;
383 
384  IoStatus.Information = 0;
385 
388 
389  if (RelatedFileObject)
390  {
391  Type = NpDecodeFileObject(RelatedFileObject, (PVOID*)&Fcb, &Ccb, FALSE);
392  }
393  else
394  {
395  Type = 0;
396  Fcb = NULL;
397  Ccb = NULL;
398  }
399 
400  if (FileName.Length)
401  {
402  if ((FileName.Length == sizeof(OBJ_NAME_PATH_SEPARATOR)) &&
403  (FileName.Buffer[0] == OBJ_NAME_PATH_SEPARATOR) &&
404  !(RelatedFileObject))
405  {
407  FileObject,
409  &DeferredList);
410  goto Quickie;
411  }
412  }
413  else if (!(RelatedFileObject) || (Type == NPFS_NTC_VCB))
414  {
416  DesiredAccess);
417  goto Quickie;
418  }
419  else if (Type == NPFS_NTC_ROOT_DCB)
420  {
422  FileObject,
424  &DeferredList);
425  goto Quickie;
426  }
427 
429  if (!NT_SUCCESS(IoStatus.Status)) goto Quickie;
430 
431  if (RelatedFileObject)
432  {
433  if (Type == NPFS_NTC_ROOT_DCB)
434  {
435  Dcb = (PNP_DCB)Ccb;
437  &FileName,
438  1,
439  &Prefix,
440  &Fcb);
441  if (!NT_SUCCESS(IoStatus.Status))
442  {
443  goto Quickie;
444  }
445  }
446  else if ((Type != NPFS_NTC_CCB) || (FileName.Length))
447  {
449  goto Quickie;
450  }
451  else
452  {
453  Prefix.Length = 0;
454  }
455  }
456  else
457  {
458  if ((FileName.Length <= sizeof(OBJ_NAME_PATH_SEPARATOR)) ||
459  (FileName.Buffer[0] != OBJ_NAME_PATH_SEPARATOR))
460  {
462  goto Quickie;
463  }
464 
465  Fcb = NpFindPrefix(&FileName, 1, &Prefix);
466  }
467 
468  if (Prefix.Length)
469  {
470  IoStatus.Status = Fcb->NodeType != NPFS_NTC_FCB ?
473  goto Quickie;
474  }
475 
476  if (Fcb->NodeType != NPFS_NTC_FCB)
477  {
479  goto Quickie;
480  }
481 
482  if (!Fcb->ServerOpenCount)
483  {
485  goto Quickie;
486  }
487 
489  FileObject,
491  IoStack->Parameters.CreatePipe.
492  SecurityContext->SecurityQos,
493  IoStack->Parameters.CreatePipe.
494  SecurityContext->AccessState,
495  IoStack->Flags &
497  UserMode : Irp->RequestorMode,
498  Irp->Tail.Overlay.Thread,
499  &DeferredList);
500 
501 Quickie:
502  NpReleaseVcb();
503  NpCompleteDeferredIrps(&DeferredList);
505 
506  Irp->IoStatus = IoStatus;
508  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
509  return IoStatus.Status;
510 }
IO_STATUS_BLOCK NTAPI NpCreateClientEnd(IN PNP_FCB Fcb, IN PFILE_OBJECT FileObject, IN ACCESS_MASK DesiredAccess, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN PACCESS_STATE AccessState, IN KPROCESSOR_MODE PreviousMode, IN PETHREAD Thread, IN PLIST_ENTRY List)
Definition: create.c:105
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
#define FsRtlEnterFileSystem
Type
Definition: Type.h:6
NTSTATUS NTAPI NpTranslateAlias(PUNICODE_STRING PipeName)
Definition: create.c:219
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
_In_ PIRP Irp
Definition: csq.h:116
unsigned short Length
Definition: sprintf.c:451
PNP_FCB NTAPI NpFindPrefix(IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix)
Definition: prefxsup.c:20
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define SL_FORCE_ACCESS_CHECK
Definition: iotypes.h:1773
struct _NP_DCB * PNP_DCB
IO_STATUS_BLOCK NTAPI NpOpenNamedPipeRootDirectory(IN PNP_DCB Dcb, IN PFILE_OBJECT FileObject, IN ACCESS_MASK DesiredAccess, IN PLIST_ENTRY List)
Definition: create.c:75
Definition: npfs.h:210
Definition: npfs.h:228
Definition: npfs.h:258
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT FileObject
Definition: create.c:4157
IO_STATUS_BLOCK NTAPI NpOpenNamedPipeFileSystem(IN PFILE_OBJECT FileObject, IN ACCESS_MASK DesiredAccess)
Definition: create.c:57
NTSTATUS NTAPI NpFindRelativePrefix(IN PNP_DCB Dcb, IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix, OUT PNP_FCB *FoundFcb)
Definition: prefxsup.c:51
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
* PFILE_OBJECT
Definition: iotypes.h:1955
PNP_VCB NpVcb
Definition: strucsup.c:19
PUNICODE_STRING FileName
Definition: iotypes.h:2793
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
Definition: typedefs.h:117
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
struct _FileName FileName
Definition: fatprocs.h:884
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
PNP_DCB RootDcb
Definition: npfs.h:281
#define NPFS_NTC_FCB
Definition: npfs.h:114
#define IO_NO_INCREMENT
Definition: iotypes.h:566
NODE_TYPE_CODE NTAPI NpDecodeFileObject(IN PFILE_OBJECT FileObject, OUT PVOID *PrimaryContext OPTIONAL, OUT PNP_CCB *Ccb, OUT PULONG NamedPipeEnd OPTIONAL)
Definition: fileobsup.c:20
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
_In_ PFCB Fcb
Definition: cdprocs.h:151
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
Definition: npfs.h:356
#define NPFS_NTC_VCB
Definition: npfs.h:112
ULONG ACCESS_MASK
Definition: nt_native.h:40

Referenced by DriverEntry().

◆ NpFsdCreateNamedPipe()

NTSTATUS NTAPI NpFsdCreateNamedPipe ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 791 of file create.c.

793 {
794  PIO_STACK_LOCATION IoStack;
796  PFILE_OBJECT RelatedFileObject;
799  LIST_ENTRY DeferredList;
801  PNP_FCB Fcb;
805  TRACE("Entered\n");
806 
807  InitializeListHead(&DeferredList);
809 
811  FileObject = IoStack->FileObject;
812  RelatedFileObject = FileObject->RelatedFileObject;
813 
814  Disposition = (IoStack->Parameters.CreatePipe.Options >> 24) & 0xFF;
815  ShareAccess = IoStack->Parameters.CreatePipe.ShareAccess & 0xFFFF;
816  Parameters = IoStack->Parameters.CreatePipe.Parameters;
817 
819 
820  IoStatus.Information = 0;
821 
824 
825  if (RelatedFileObject)
826  {
827  Fcb = (PNP_FCB)((ULONG_PTR)RelatedFileObject->FsContext & ~1);
828  if (!(Fcb) ||
829  (Fcb->NodeType != NPFS_NTC_ROOT_DCB) ||
830  (FileName.Length < sizeof(WCHAR)) ||
831  (FileName.Buffer[0] == OBJ_NAME_PATH_SEPARATOR))
832  {
834  goto Quickie;
835  }
836 
837  IoStatus.Status = NpFindRelativePrefix(RelatedFileObject->FsContext,
838  &FileName,
839  TRUE,
840  &Prefix,
841  &Fcb);
842  if (!NT_SUCCESS(IoStatus.Status))
843  {
844  goto Quickie;
845  }
846  }
847  else
848  {
849  if (FileName.Length <= sizeof(OBJ_NAME_PATH_SEPARATOR) ||
850  FileName.Buffer[0] != OBJ_NAME_PATH_SEPARATOR)
851  {
853  goto Quickie;
854  }
855 
856  Fcb = NpFindPrefix(&FileName, 1, &Prefix);
857  }
858 
859  if (Prefix.Length)
860  {
861  if (Fcb->NodeType == NPFS_NTC_ROOT_DCB)
862  {
864  FileObject,
865  FileName,
866  IoStack->Parameters.CreatePipe.
867  SecurityContext->DesiredAccess,
868  IoStack->Parameters.CreatePipe.
869  SecurityContext->AccessState,
870  Disposition,
871  ShareAccess,
872  Parameters,
873  Process,
874  &DeferredList,
875  &IoStatus);
876  goto Quickie;
877  }
878  else
879  {
881  goto Quickie;
882  }
883  }
884 
885  if (Fcb->NodeType != NPFS_NTC_FCB)
886  {
888  goto Quickie;
889  }
890 
892  FileObject,
893  IoStack->Parameters.CreatePipe.
894  SecurityContext->DesiredAccess,
895  IoStack->Parameters.CreatePipe.
896  SecurityContext->AccessState,
897  IoStack->Flags &
899  UserMode : Irp->RequestorMode,
900  Disposition,
901  ShareAccess,
902  Parameters,
903  Process,
904  &DeferredList);
905 
906 Quickie:
907  NpReleaseVcb();
908  NpCompleteDeferredIrps(&DeferredList);
910 
911  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
912  Irp->IoStatus = IoStatus;
914  return IoStatus.Status;
915 }
PEPROCESS NTAPI IoGetRequestorProcess(IN PIRP Irp)
Definition: irp.c:1782
#define TRUE
Definition: types.h:120
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
_In_ PIRP Irp
Definition: csq.h:116
unsigned short Length
Definition: sprintf.c:451
PNP_FCB NTAPI NpFindPrefix(IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix)
Definition: prefxsup.c:20
#define SL_FORCE_ACCESS_CHECK
Definition: iotypes.h:1773
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
Definition: create.c:4157
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:63
Definition: npfs.h:210
Definition: npfs.h:228
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT FileObject
Definition: create.c:4157
NTSTATUS NTAPI NpFindRelativePrefix(IN PNP_DCB Dcb, IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix, OUT PNP_FCB *FoundFcb)
Definition: prefxsup.c:51
#define IoCompleteRequest
Definition: irp.c:1240
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
* PFILE_OBJECT
Definition: iotypes.h:1955
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
_In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters
Definition: iotypes.h:872
PUNICODE_STRING FileName
Definition: iotypes.h:2793
Definition: typedefs.h:117
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
struct _FileName FileName
Definition: fatprocs.h:884
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
unsigned short USHORT
Definition: pedump.c:61
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
IO_STATUS_BLOCK NTAPI NpCreateExistingNamedPipe(IN PNP_FCB Fcb, IN PFILE_OBJECT FileObject, IN ACCESS_MASK DesiredAccess, IN PACCESS_STATE AccessState, IN KPROCESSOR_MODE PreviousMode, IN ULONG Disposition, IN ULONG ShareAccess, IN PNAMED_PIPE_CREATE_PARAMETERS Parameters, IN PEPROCESS Process, OUT PLIST_ENTRY List)
Definition: create.c:514
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define NPFS_NTC_FCB
Definition: npfs.h:114
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
_In_ PFCB Fcb
Definition: cdprocs.h:151
struct _NP_FCB * PNP_FCB
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
Definition: npfs.h:356
NTSTATUS NTAPI NpCreateNewNamedPipe(IN PNP_DCB Dcb, IN PFILE_OBJECT FileObject, IN UNICODE_STRING PipeName, IN ACCESS_MASK DesiredAccess, IN PACCESS_STATE AccessState, IN USHORT Disposition, IN USHORT ShareAccess, IN PNAMED_PIPE_CREATE_PARAMETERS Parameters, IN PEPROCESS Process, IN PLIST_ENTRY List, OUT PIO_STATUS_BLOCK IoStatus)
Definition: create.c:656

Referenced by DriverEntry().

◆ NpFsdFileSystemControl()

NTSTATUS NTAPI NpFsdFileSystemControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 857 of file fsctrl.c.

859 {
861  PAGED_CODE();
862 
864 
866 
868 
869  if (Status != STATUS_PENDING)
870  {
871  Irp->IoStatus.Status = Status;
873  }
874 
875  return Status;
876 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS NTAPI NpCommonFileSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:755

Referenced by DriverEntry().

◆ NpFsdFlushBuffers()

NTSTATUS NTAPI NpFsdFlushBuffers ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 70 of file flushbuf.c.

72 {
74  PAGED_CODE();
75 
78 
80 
81  NpReleaseVcb();
83 
84  if (Status != STATUS_PENDING)
85  {
86  Irp->IoStatus.Status = Status;
88  }
89 
90  return Status;
91 }
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI NpCommonFlushBuffers(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: flushbuf.c:20
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344

Referenced by DriverEntry().

◆ NpFsdQueryInformation()

NTSTATUS NTAPI NpFsdQueryInformation ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 462 of file fileinfo.c.

464 {
466  PAGED_CODE();
467 
470 
472 
473  NpReleaseVcb();
475 
476  if (Status != STATUS_PENDING)
477  {
478  Irp->IoStatus.Status = Status;
480  }
481 
482  return Status;
483 }
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
NTSTATUS NTAPI NpCommonQueryInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fileinfo.c:370

Referenced by DriverEntry().

◆ NpFsdQuerySecurityInfo()

NTSTATUS NTAPI NpFsdQuerySecurityInfo ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 100 of file seinfo.c.

102 {
104  PAGED_CODE();
105 
108 
110 
111  NpReleaseVcb();
113 
114  if (Status != STATUS_PENDING)
115  {
116  Irp->IoStatus.Status = Status;
118  }
119 
120  return Status;
121 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS NTAPI NpCommonQuerySecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:20
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336

Referenced by DriverEntry().

◆ NpFsdQueryVolumeInformation()

NTSTATUS NTAPI NpFsdQueryVolumeInformation ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 185 of file volinfo.c.

187 {
189  PAGED_CODE();
190  TRACE("Entered\n");
191 
194 
196 
197  NpReleaseVcb();
199 
200  if (Status != STATUS_PENDING)
201  {
202  Irp->IoStatus.Status = Status;
204  }
205 
206  TRACE("Leaving, Status = %lx\n", Status);
207  return Status;
208 }
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
#define IoCompleteRequest
Definition: irp.c:1240
#define TRACE(s)
Definition: solgame.cpp:4
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
NTSTATUS NTAPI NpCommonQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volinfo.c:140
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344

Referenced by DriverEntry().

◆ NpFsdRead()

NTSTATUS NTAPI NpFsdRead ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 159 of file read.c.

161 {
162  PIO_STACK_LOCATION IoStack;
164  LIST_ENTRY DeferredList;
165  PAGED_CODE();
166  NpSlowReadCalls++;
167 
168  InitializeListHead(&DeferredList);
170 
173 
174  NpCommonRead(IoStack->FileObject,
175  Irp->UserBuffer,
176  IoStack->Parameters.Read.Length,
177  &IoStatus,
178  Irp,
179  &DeferredList);
180 
181  NpReleaseVcb();
182  NpCompleteDeferredIrps(&DeferredList);
184 
185  if (IoStatus.Status != STATUS_PENDING)
186  {
187  Irp->IoStatus.Information = IoStatus.Information;
188  Irp->IoStatus.Status = IoStatus.Status;
190  }
191 
192  return IoStatus.Status;
193 }
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
_In_ PIRP Irp
Definition: csq.h:116
#define PAGED_CODE()
Definition: video.h:57
BOOLEAN NTAPI NpCommonRead(IN PFILE_OBJECT FileObject, IN PVOID Buffer, IN ULONG BufferSize, OUT PIO_STATUS_BLOCK IoStatus, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: read.c:26
#define IoCompleteRequest
Definition: irp.c:1240
LONG NpSlowReadCalls
Definition: read.c:18
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Definition: typedefs.h:117
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
Definition: npfs.h:356

Referenced by DriverEntry().

◆ NpFsdSetInformation()

NTSTATUS NTAPI NpFsdSetInformation ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 114 of file fileinfo.c.

116 {
118  LIST_ENTRY DeferredList;
119  PAGED_CODE();
120 
121  InitializeListHead(&DeferredList);
122 
125 
126  Status = NpCommonSetInformation(DeviceObject, Irp, &DeferredList);
127 
128  NpReleaseVcb();
129  NpCompleteDeferredIrps(&DeferredList);
131 
132  if (Status != STATUS_PENDING)
133  {
134  Irp->IoStatus.Status = Status;
136  }
137 
138  return Status;
139 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI NpCommonSetInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: fileinfo.c:80
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
Definition: npfs.h:356

Referenced by DriverEntry().

◆ NpFsdSetSecurityInfo()

NTSTATUS NTAPI NpFsdSetSecurityInfo ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 125 of file seinfo.c.

127 {
129  PAGED_CODE();
130 
133 
135 
136  NpReleaseVcb();
138 
139  if (Status != STATUS_PENDING)
140  {
141  Irp->IoStatus.Status = Status;
143  }
144 
145  return Status;
146 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI NpCommonSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:55
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336

Referenced by DriverEntry().

◆ NpFsdWrite()

NTSTATUS NTAPI NpFsdWrite ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 175 of file write.c.

177 {
178  PIO_STACK_LOCATION IoStack;
180  LIST_ENTRY DeferredList;
181  PAGED_CODE();
183 
184  InitializeListHead(&DeferredList);
186 
189 
190  NpCommonWrite(IoStack->FileObject,
191  Irp->UserBuffer,
192  IoStack->Parameters.Write.Length,
193  Irp->Tail.Overlay.Thread,
194  &IoStatus,
195  Irp,
196  &DeferredList);
197 
198  NpReleaseVcb();
199  NpCompleteDeferredIrps(&DeferredList);
201 
202  if (IoStatus.Status != STATUS_PENDING)
203  {
204  Irp->IoStatus.Information = IoStatus.Information;
205  Irp->IoStatus.Status = IoStatus.Status;
207  }
208 
209  return IoStatus.Status;
210 }
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
_In_ PIRP Irp
Definition: csq.h:116
#define PAGED_CODE()
Definition: video.h:57
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Definition: typedefs.h:117
LONG NpSlowWriteCalls
Definition: write.c:18
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
BOOLEAN NTAPI NpCommonWrite(IN PFILE_OBJECT FileObject, IN PVOID Buffer, IN ULONG DataSize, IN PETHREAD Thread, IN PIO_STATUS_BLOCK IoStatus, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: write.c:26
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
Definition: npfs.h:356

Referenced by DriverEntry().

◆ NpGetClientSecurityContext()

NTSTATUS NTAPI NpGetClientSecurityContext ( IN ULONG  NamedPipeEnd,
IN PNP_CCB  Ccb,
IN PETHREAD  Thread,
IN PSECURITY_CLIENT_CONTEXT Context 
)

Definition at line 129 of file secursup.c.

133 {
136  PAGED_CODE();
137 
138  if (NamedPipeEnd == FILE_PIPE_SERVER_END || Ccb->ClientQos.ContextTrackingMode != SECURITY_DYNAMIC_TRACKING)
139  {
140  NewContext = NULL;
142  }
143  else
144  {
146  sizeof(*NewContext),
149 
150  Status = SeCreateClientSecurity(Thread, &Ccb->ClientQos, 0, NewContext);
151  if (!NT_SUCCESS(Status))
152  {
154  NewContext = NULL;
155  }
156  }
157  *Context = NewContext;
158  return Status;
159 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PVOID NTAPI ExAllocatePoolWithQuotaTag(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: expool.c:2939
LONG NTSTATUS
Definition: precomp.h:26
#define NPFS_CLIENT_SEC_CTX_TAG
Definition: npfs.h:62
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
NTKERNELAPI NTSTATUS NTAPI SeCreateClientSecurity(IN PETHREAD Thread, IN PSECURITY_QUALITY_OF_SERVICE QualityOfService, IN BOOLEAN RemoteClient, OUT PSECURITY_CLIENT_CONTEXT ClientContext)
Definition: access.c:506
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
#define SECURITY_DYNAMIC_TRACKING
Definition: setypes.h:103
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
Status
Definition: gdiplustypes.h:24
_In_ FLT_SET_CONTEXT_OPERATION _In_ PFLT_CONTEXT NewContext
Definition: fltkernel.h:1468
#define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NpAddDataQueueEntry(), and NpWriteDataQueue().

◆ NpGetNextRealDataQueueEntry()

PLIST_ENTRY NTAPI NpGetNextRealDataQueueEntry ( IN PNP_DATA_QUEUE  DataQueue,
IN PLIST_ENTRY  List 
)

Definition at line 174 of file datasup.c.

176 {
177  PNP_DATA_QUEUE_ENTRY DataEntry;
178  ULONG Type;
179  PIRP Irp;
180  PLIST_ENTRY NextEntry;
181  PAGED_CODE();
182 
183  for (NextEntry = DataQueue->Queue.Flink;
184  NextEntry != &DataQueue->Queue;
185  NextEntry = DataQueue->Queue.Flink)
186  {
187  DataEntry = CONTAINING_RECORD(NextEntry,
189  QueueEntry);
190 
191  Type = DataEntry->DataEntryType;
192  if (Type == Buffered || Type == Unbuffered) break;
193 
194  Irp = NpRemoveDataQueueEntry(DataQueue, FALSE, List);
195  if (Irp)
196  {
197  Irp->IoStatus.Status = STATUS_SUCCESS;
198  InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
199  }
200  }
201 
202  return NextEntry;
203 }
Type
Definition: Type.h:6
_In_ PIRP Irp
Definition: csq.h:116
Definition: npfs.h:131
#define InsertTailList(ListHead, Entry)
#define PAGED_CODE()
Definition: video.h:57
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PIRP NTAPI NpRemoveDataQueueEntry(IN PNP_DATA_QUEUE DataQueue, IN BOOLEAN Flag, IN PLIST_ENTRY List)
Definition: datasup.c:105
LIST_ENTRY List
Definition: psmgr.c:57
Definition: npfs.h:148
Definition: typedefs.h:117
ULONG DataEntryType
Definition: npfs.h:151
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by NpCancelDataQueueIrp(), NpReadDataQueue(), NpRemoveDataQueueEntry(), and NpWriteDataQueue().

◆ NpImpersonateClientContext()

NTSTATUS NTAPI NpImpersonateClientContext ( IN PNP_CCB  Ccb)

Definition at line 20 of file secursup.c.

21 {
24  PAGED_CODE();
25 
26  ClientContext = Ccb->ClientContext;
27  if (ClientContext)
28  {
30  }
31  else
32  {
34  }
35  return Status;
36 }
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
_In_ PVOID ClientContext
Definition: netioddk.h:55
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
NTSTATUS NTAPI SeImpersonateClientEx(IN PSECURITY_CLIENT_CONTEXT ClientContext, IN PETHREAD ServerThread OPTIONAL)
Definition: access.c:589
Status
Definition: gdiplustypes.h:24
#define STATUS_CANNOT_IMPERSONATE
Definition: ntstatus.h:491

Referenced by NpImpersonate().

◆ NpInitializeDataQueue()

NTSTATUS NTAPI NpInitializeDataQueue ( IN PNP_DATA_QUEUE  DataQueue,
IN ULONG  Quota 
)

Definition at line 32 of file datasup.c.

34 {
35  PAGED_CODE();
36 
37  DataQueue->BytesInQueue = 0;
38  DataQueue->EntriesInQueue = 0;
39  DataQueue->QuotaUsed = 0;
40  DataQueue->ByteOffset = 0;
41  DataQueue->QueueState = Empty;
42  DataQueue->Quota = Quota;
43  InitializeListHead(&DataQueue->Queue);
44  return STATUS_SUCCESS;
45 }
#define PAGED_CODE()
Definition: video.h:57
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
return STATUS_SUCCESS
Definition: btrfs.c:2966
Definition: npfs.h:125

Referenced by NpCreateCcb().

◆ NpInitializeSecurity()

NTSTATUS NTAPI NpInitializeSecurity ( IN PNP_CCB  Ccb,
IN PSECURITY_QUALITY_OF_SERVICE  SecurityQos,
IN PETHREAD  Thread 
)

Definition at line 82 of file secursup.c.

85 {
88  PAGED_CODE();
89 
90  if (SecurityQos)
91  {
92  Ccb->ClientQos = *SecurityQos;
93  }
94  else
95  {
96  Ccb->ClientQos.Length = sizeof(Ccb->ClientQos);
97  Ccb->ClientQos.ImpersonationLevel = SecurityImpersonation;
98  Ccb->ClientQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
99  Ccb->ClientQos.EffectiveOnly = TRUE;
100  }
101 
103 
104  if (Ccb->ClientQos.ContextTrackingMode == SECURITY_DYNAMIC_TRACKING)
105  {
107  Ccb->ClientContext = NULL;
108  return Status;
109  }
110 
112  sizeof(*ClientContext),
114  Ccb->ClientContext = ClientContext;
116 
118  if (!NT_SUCCESS(Status))
119  {
120  ExFreePool(Ccb->ClientContext);
121  Ccb->ClientContext = NULL;
122  }
123 
124  return Status;
125 }
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PVOID NTAPI ExAllocatePoolWithQuotaTag(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: expool.c:2939
LONG NTSTATUS
Definition: precomp.h:26
#define NPFS_CLIENT_SEC_CTX_TAG
Definition: npfs.h:62
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
NTKERNELAPI NTSTATUS NTAPI SeCreateClientSecurity(IN PETHREAD Thread, IN PSECURITY_QUALITY_OF_SERVICE QualityOfService, IN BOOLEAN RemoteClient, OUT PSECURITY_CLIENT_CONTEXT ClientContext)
Definition: access.c:506
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ PVOID ClientContext
Definition: netioddk.h:55
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define SECURITY_DYNAMIC_TRACKING
Definition: setypes.h:103
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
Status
Definition: gdiplustypes.h:24
#define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
VOID NTAPI NpUninitializeSecurity(IN PNP_CCB Ccb)
Definition: secursup.c:72

Referenced by NpCreateClientEnd().

◆ NpInitializeVcb()

VOID NTAPI NpInitializeVcb ( VOID  )

Definition at line 130 of file strucsup.c.

131 {
132  PAGED_CODE();
133 
134  RtlZeroMemory(NpVcb, sizeof(*NpVcb));
135 
143  0);
145 }
NP_WAIT_QUEUE WaitQueue
Definition: npfs.h:285
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
VOID NTAPI RtlInitializeUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable)
VOID NTAPI RtlInitializeGenericTable(IN PRTL_GENERIC_TABLE Table, IN PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine, IN PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine, IN PRTL_GENERIC_FREE_ROUTINE FreeRoutine, IN PVOID TableContext)
Definition: generictable.c:100
#define PAGED_CODE()
Definition: video.h:57
NODE_TYPE_CODE NodeType
Definition: npfs.h:279
PVOID NTAPI NpEventTableAllocate(IN PRTL_GENERIC_TABLE Table, IN CLONG ByteSize)
Definition: strucsup.c:35
PNP_VCB NpVcb
Definition: strucsup.c:19
VOID NTAPI NpInitializeWaitQueue(IN PNP_WAIT_QUEUE WaitQueue)
Definition: waitsup.c:96
RTL_GENERIC_TABLE EventTable
Definition: npfs.h:284
ERESOURCE Lock
Definition: npfs.h:283
UNICODE_PREFIX_TABLE PrefixTable
Definition: npfs.h:282
RTL_GENERIC_COMPARE_RESULTS NTAPI NpEventTableCompareRoutine(IN PRTL_GENERIC_TABLE Table, IN PVOID FirstStruct, IN PVOID SecondStruct)
Definition: strucsup.c:25
VOID NTAPI NpEventTableDeallocate(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer)
Definition: strucsup.c:44
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define NPFS_NTC_VCB
Definition: npfs.h:112

Referenced by DriverEntry().

◆ NpInitializeWaitQueue()

VOID NTAPI NpInitializeWaitQueue ( IN PNP_WAIT_QUEUE  WaitQueue)

Definition at line 96 of file waitsup.c.

97 {
98  InitializeListHead(&WaitQueue->WaitList);
99  KeInitializeSpinLock(&WaitQueue->WaitLock);
100 }
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944

Referenced by NpInitializeVcb().

◆ NpReadDataQueue()

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 
)

Definition at line 20 of file readsup.c.

28 {
29  PNP_DATA_QUEUE_ENTRY DataEntry, TempDataEntry;
30  PVOID DataBuffer;
31  ULONG DataSize, DataLength, TotalBytesCopied, RemainingSize, Offset;
32  PIRP Irp;
34  BOOLEAN CompleteWrites = FALSE;
35  PAGED_CODE();
36 
37  if (ReadOverflowOperation) Peek = TRUE;
38 
39  RemainingSize = BufferSize;
40  IoStatus.Status = STATUS_SUCCESS;
41  TotalBytesCopied = 0;
42 
43  if (Peek)
44  {
45  DataEntry = CONTAINING_RECORD(DataQueue->Queue.Flink,
47  QueueEntry);
48  }
49  else
50  {
51  DataEntry = CONTAINING_RECORD(NpGetNextRealDataQueueEntry(DataQueue, List),
53  QueueEntry);
54  }
55 
56  while ((&DataEntry->QueueEntry != &DataQueue->Queue) && (RemainingSize))
57  {
58  if (!Peek ||
59  DataEntry->DataEntryType == Buffered ||
60  DataEntry->DataEntryType == Unbuffered)
61  {
62  if (DataEntry->DataEntryType == Unbuffered)
63  {
64  DataBuffer = DataEntry->Irp->AssociatedIrp.SystemBuffer;
65  }
66  else
67  {
68  DataBuffer = &DataEntry[1];
69  }
70 
71  DataSize = DataEntry->DataSize;
72  Offset = DataSize;
73 
74  if (&DataEntry->QueueEntry == DataQueue->Queue.Flink)
75  {
76  Offset -= DataQueue->ByteOffset;
77  }
78 
80  if (DataLength >= RemainingSize) DataLength = RemainingSize;
81 
82  _SEH2_TRY
83  {
84  RtlCopyMemory((PVOID)((ULONG_PTR)Buffer + BufferSize - RemainingSize),
85  (PVOID)((ULONG_PTR)DataBuffer + DataSize - Offset),
86  DataLength);
87  }
89  {
90  ASSERT(FALSE);
91  }
92  _SEH2_END;
93 
94 
95  RemainingSize -= DataLength;
96  Offset -= DataLength;
97  TotalBytesCopied += DataLength;
98 
99  if (!Peek)
100  {
101  DataEntry->QuotaInEntry -= DataLength;
102  DataQueue->QuotaUsed -= DataLength;
103  DataQueue->ByteOffset += DataLength;
104  CompleteWrites = TRUE;
105  }
106 
107  NpCopyClientContext(Ccb, DataEntry);
108 
109  if ((Offset) || (ReadOverflowOperation && !TotalBytesCopied))
110  {
112  {
114  break;
115  }
116  }
117  else
118  {
119  if (!Peek || ReadOverflowOperation)
120  {
121  if (ReadOverflowOperation)
122  {
123  TempDataEntry = CONTAINING_RECORD(NpGetNextRealDataQueueEntry(DataQueue, List),
125  QueueEntry);
126  ASSERT(TempDataEntry == DataEntry);
127  }
128 
129  Irp = NpRemoveDataQueueEntry(DataQueue, TRUE, List);
130  if (Irp)
131  {
132  Irp->IoStatus.Information = DataSize;
133  Irp->IoStatus.Status = STATUS_SUCCESS;
134  InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
135  }
136  }
137 
139  {
140  IoStatus.Status = STATUS_SUCCESS;
141  break;
142  }
143 
144  ASSERT(!ReadOverflowOperation);
145  }
146  }
147 
148  if (Peek)
149  {
150  DataEntry = CONTAINING_RECORD(DataEntry->QueueEntry.Flink,
152  QueueEntry);
153  }
154  else
155  {
156  DataEntry = CONTAINING_RECORD(NpGetNextRealDataQueueEntry(DataQueue, List),
158  QueueEntry);
159  }
160  }
161 
162  IoStatus.Information = TotalBytesCopied;
163  if (CompleteWrites) NpCompleteStalledWrites(DataQueue, List);
164  return IoStatus;
165 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PLIST_ENTRY NTAPI NpGetNextRealDataQueueEntry(IN PNP_DATA_QUEUE DataQueue, IN PLIST_ENTRY List)
Definition: datasup.c:174
_In_ ULONG Mode
Definition: hubbusif.h:303
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
_In_ PIRP Irp
Definition: csq.h:116
LIST_ENTRY QueueEntry
Definition: npfs.h:150
Definition: npfs.h:131
#define InsertTailList(ListHead, Entry)
#define PAGED_CODE()
Definition: video.h:57
VOID NTAPI NpCopyClientContext(IN PNP_CCB Ccb, IN PNP_DATA_QUEUE_ENTRY DataQueueEntry)
Definition: secursup.c:58
_SEH2_TRY
Definition: create.c:4250
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
Definition: bufpool.h:45
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
PIRP NTAPI NpRemoveDataQueueEntry(IN PNP_DATA_QUEUE DataQueue, IN BOOLEAN Flag, IN PLIST_ENTRY List)
Definition: datasup.c:105
ULONG DataSize
Definition: npfs.h:155
LIST_ENTRY List
Definition: psmgr.c:57
#define BufferSize
Definition: classpnp.h:419
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI NpCompleteStalledWrites(IN PNP_DATA_QUEUE DataQueue, IN PLIST_ENTRY List)
Definition: datasup.c:49
Definition: npfs.h:148
static VOID Peek(PUCHAR ReadDataPort, PVOID Buffer, ULONG Length)
Definition: hardware.c:228
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
_SEH2_END
Definition: create.c:4424
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define FILE_PIPE_MESSAGE_MODE
Definition: iotypes.h:78
ULONG DataEntryType
Definition: npfs.h:151
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
return STATUS_SUCCESS
Definition: btrfs.c:2966
ULONG QuotaInEntry
Definition: npfs.h:153
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
PIRP Irp
Definition: npfs.h:152

Referenced by NpCommonRead(), and NpPeek().

◆ NpReleaseVcb()

◆ NpRemoveDataQueueEntry()

PIRP NTAPI NpRemoveDataQueueEntry ( IN PNP_DATA_QUEUE  DataQueue,
IN BOOLEAN  Flag,
IN PLIST_ENTRY  List 
)

Definition at line 105 of file datasup.c.

108 {
109  PIRP Irp;
110  PNP_DATA_QUEUE_ENTRY QueueEntry;
111  BOOLEAN HasWrites;
112 
113  if (DataQueue->QueueState == Empty)
114  {
115  Irp = NULL;
116  ASSERT(IsListEmpty(&DataQueue->Queue));
117  ASSERT(DataQueue->EntriesInQueue == 0);
118  ASSERT(DataQueue->BytesInQueue == 0);
119  ASSERT(DataQueue->QuotaUsed == 0);
120  }
121  else
122  {
123  QueueEntry = CONTAINING_RECORD(RemoveHeadList(&DataQueue->Queue),
125  QueueEntry);
126 
127  DataQueue->BytesInQueue -= QueueEntry->DataSize;
128  --DataQueue->EntriesInQueue;
129 
130  HasWrites = TRUE;
131  if (DataQueue->QueueState != WriteEntries ||
132  DataQueue->QuotaUsed < DataQueue->Quota ||
133  !QueueEntry->QuotaInEntry)
134  {
135  HasWrites = FALSE;
136  }
137 
138  DataQueue->QuotaUsed -= QueueEntry->QuotaInEntry;
139 
140  if (IsListEmpty(&DataQueue->Queue))
141  {
142  DataQueue->QueueState = Empty;
143  HasWrites = FALSE;
144  }
145 
146  Irp = QueueEntry->Irp;
148 
149  if (Irp && !IoSetCancelRoutine(Irp, NULL))
150  {
151  Irp->Tail.Overlay.DriverContext[3] = NULL;
152  Irp = NULL;
153  }
154 
155  ExFreePool(QueueEntry);
156 
157  if (Flag)
158  {
159  NpGetNextRealDataQueueEntry(DataQueue, List);
160  }
161 
162  if (HasWrites)
163  {
164  NpCompleteStalledWrites(DataQueue, List);
165  }
166  }
167 
168  DataQueue->ByteOffset = 0;
169  return Irp;
170 }
#define TRUE
Definition: types.h:120
PLIST_ENTRY NTAPI NpGetNextRealDataQueueEntry(IN PNP_DATA_QUEUE DataQueue, IN PLIST_ENTRY List)
Definition: datasup.c:174
_In_ PIRP Irp
Definition: csq.h:116
IoSetCancelRoutine(Irp, CancelRoutine)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
VOID NTAPI NpFreeClientSecurityContext(IN PSECURITY_CLIENT_CONTEXT ClientContext)
Definition: secursup.c:40
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ULONG DataSize
Definition: npfs.h:155
LIST_ENTRY List
Definition: psmgr.c:57
Definition: xml2sdb.h:79
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI NpCompleteStalledWrites(IN PNP_DATA_QUEUE DataQueue, IN PLIST_ENTRY List)
Definition: datasup.c:49
Definition: npfs.h:148
PSECURITY_CLIENT_CONTEXT ClientSecurityContext
Definition: npfs.h:154
ULONG QuotaInEntry
Definition: npfs.h:153
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
Definition: npfs.h:125
PIRP Irp
Definition: npfs.h:152

Referenced by NpGetNextRealDataQueueEntry(), NpReadDataQueue(), NpSetClosingPipeState(), NpSetDisconnectedPipeState(), and NpWriteDataQueue().

◆ NpSetClosingPipeState()

NTSTATUS NTAPI NpSetClosingPipeState ( IN PNP_CCB  Ccb,
IN PIRP  Irp,
IN ULONG  NamedPipeEnd,
IN PLIST_ENTRY  List 
)

Definition at line 245 of file statesup.c.

249 {
250  PNP_NONPAGED_CCB NonPagedCcb;
251  PNP_FCB Fcb;
252  PLIST_ENTRY NextEntry;
253  PNP_DATA_QUEUE ReadQueue, WriteQueue, DataQueue;
254  PNP_EVENT_BUFFER EventBuffer;
255  PIRP ListIrp;
256 
257  NonPagedCcb = Ccb->NonPagedCcb;
258  Fcb = Ccb->Fcb;
259 
260  switch (Ccb->NamedPipeState)
261  {
263 
264  ASSERT(NamedPipeEnd == FILE_PIPE_SERVER_END);
265 
266  while (!IsListEmpty(&Ccb->IrpList))
267  {
268  NextEntry = RemoveHeadList(&Ccb->IrpList);
269 
270  ListIrp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
271 
272  if (IoSetCancelRoutine(ListIrp, NULL))
273  {
274  ListIrp->IoStatus.Status = STATUS_PIPE_BROKEN;
275  InsertTailList(List, NextEntry);
276  }
277  else
278  {
279  InitializeListHead(NextEntry);
280  }
281  }
282 
283  // Drop on purpose
284 
286 
287  ASSERT(NamedPipeEnd == FILE_PIPE_SERVER_END);
288 
291 
294 
295  NpDeleteCcb(Ccb, List);
296  if (!Fcb->CurrentInstances) NpDeleteFcb(Fcb, List);
297  break;
298 
300 
301  if (NamedPipeEnd == FILE_PIPE_SERVER_END)
302  {
303  DataQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
304  }
305  else
306  {
307  DataQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
308  }
309 
312 
315 
316  while (DataQueue->QueueState != Empty)
317  {
318  ListIrp = NpRemoveDataQueueEntry(DataQueue, FALSE, List);
319  if (ListIrp)
320  {
321  ListIrp->IoStatus.Status = STATUS_PIPE_BROKEN;
322  InsertTailList(List, &ListIrp->Tail.Overlay.ListEntry);
323  }
324  }
325 
327 
328  if (Ccb->ClientSession)
329  {
330  ExFreePool(Ccb->ClientSession);
331  Ccb->ClientSession = NULL;
332  }
333 
334  NpDeleteCcb(Ccb, List);
335  if (!Fcb->CurrentInstances) NpDeleteFcb(Fcb, List);
336  break;
337 
339 
340  if (NamedPipeEnd == FILE_PIPE_SERVER_END)
341  {
342  ReadQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
343  WriteQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
344 
347  }
348  else
349  {
350  ReadQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
351  WriteQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
352 
355  }
356 
357  EventBuffer = NonPagedCcb->EventBuffer[NamedPipeEnd];
358 
359  Ccb->NamedPipeState = FILE_PIPE_CLOSING_STATE;
360 
361  while (ReadQueue->QueueState != Empty)
362  {
363  ListIrp = NpRemoveDataQueueEntry(ReadQueue, FALSE, List);
364  if (ListIrp)
365  {
366  ListIrp->IoStatus.Status = STATUS_PIPE_BROKEN;
367  InsertTailList(List, &ListIrp->Tail.Overlay.ListEntry);
368  }
369  }
370 
371  while (WriteQueue->QueueState == ReadEntries)
372  {
373  ListIrp = NpRemoveDataQueueEntry(WriteQueue, FALSE, List);
374  if (ListIrp)
375  {
376  ListIrp->IoStatus.Status = STATUS_PIPE_BROKEN;
377  InsertTailList(List, &ListIrp->Tail.Overlay.ListEntry);
378  }
379  }
380 
381  if (EventBuffer) KeSetEvent(EventBuffer->Event, IO_NO_INCREMENT, FALSE);
382  break;
383 
384  default:
385  NpBugCheck(Ccb->NamedPipeState, 0, 0);
386  break;
387  }
388  return STATUS_SUCCESS;
389 }