ReactOS  0.4.15-dev-489-g75a0787
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 {
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
uint32_t ULONG_PTR
Definition: typedefs.h:64
Definition: npfs.h:258
union node Node
Definition: types.h:1255
void * PVOID
Definition: retypes.h:9
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
#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:588
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
struct tagContext Context
Definition: acpixf.h:1034
#define ULONG_PTR
Definition: config.h:101
#define NPFS_NTC_VCB
Definition: npfs.h:112
Definition: dlist.c:348
#define PAGED_CODE()

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 }
#define TRUE
Definition: types.h:120
#define NPFS_NTC_CCB
Definition: npfs.h:115
uint32_t ULONG_PTR
Definition: typedefs.h:64
Definition: npfs.h:258
#define FO_NAMED_PIPE
Definition: iotypes.h:1741
unsigned char BOOLEAN
void * PVOID
Definition: retypes.h:9
NodeType
Definition: Node.h:5
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:588
#define PAGED_CODE()

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