ReactOS 0.4.16-dev-290-g89a3b8f
fileobsup.c File Reference
#include "npfs.h"
Include dependency graph for fileobsup.c:

Go to the source code of this file.

Macros

#define NPFS_BUGCHECK_FILE_ID   (NPFS_BUGCHECK_FILEOBSUP)
 

Functions

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

Macro Definition Documentation

◆ NPFS_BUGCHECK_FILE_ID

#define NPFS_BUGCHECK_FILE_ID   (NPFS_BUGCHECK_FILEOBSUP)

Definition at line 14 of file fileobsup.c.

Function Documentation

◆ 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{
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
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 PAGED_CODE()
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
union node Node
Definition: types.h:1255
#define NPFS_NTC_VCB
Definition: npfs.h:112
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
#define NpBugCheck(p1, p2, p3)
Definition: npfs.h:106
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define ULONG_PTR
Definition: config.h:101
if(dx< 0)
Definition: linetemp.h:194
Definition: npfs.h:259
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: dlist.c:348
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550

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

◆ NpSetFileObject()

VOID NTAPI NpSetFileObject ( IN PFILE_OBJECT  FileObject,
IN PVOID  PrimaryContext,
IN PVOID  Ccb,
IN ULONG  NamedPipeEnd 
)

Definition at line 62 of file fileobsup.c.

66{
67 BOOLEAN FileIsPipe;
68 PAGED_CODE();
69
70 if (!FileObject) return;
71
72 if ((PrimaryContext) && (((PNP_CCB)PrimaryContext)->NodeType == NPFS_NTC_CCB))
73 {
74 FileIsPipe = TRUE;
75 if (NamedPipeEnd == FILE_PIPE_SERVER_END)
76 {
77 PrimaryContext = (PVOID) ((ULONG_PTR) PrimaryContext | 1);
78 }
79 }
80 else
81 {
82 FileIsPipe = FALSE;
83 }
84
85 FileObject->FsContext = PrimaryContext;
86 FileObject->FsContext2 = Ccb;
87 FileObject->PrivateCacheMap = (PVOID)1;
88 if (FileIsPipe) FileObject->Flags |= FO_NAMED_PIPE;
89}
NodeType
Definition: Node.h:6
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
ULONG Flags
Definition: ntfs.h:536
#define FO_NAMED_PIPE
Definition: iotypes.h:1782

Referenced by NpCreateExistingNamedPipe(), NpCreateNewNamedPipe(), NpOpenNamedPipeFileSystem(), NpOpenNamedPipeRootDirectory(), NpSetClosingPipeState(), NpSetConnectedPipeState(), and NpSetDisconnectedPipeState().