ReactOS  0.4.15-dev-1647-g91fceab
seinfo.c File Reference
#include "npfs.h"
Include dependency graph for seinfo.c:

Go to the source code of this file.

Macros

#define NPFS_BUGCHECK_FILE_ID   (NPFS_BUGCHECK_SEINFO)
 

Functions

NTSTATUS NTAPI NpCommonQuerySecurityInfo (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpCommonSetSecurityInfo (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)
 

Macro Definition Documentation

◆ NPFS_BUGCHECK_FILE_ID

#define NPFS_BUGCHECK_FILE_ID   (NPFS_BUGCHECK_SEINFO)

Definition at line 14 of file seinfo.c.

Function Documentation

◆ NpCommonQuerySecurityInfo()

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

Definition at line 20 of file seinfo.c.

22 {
23  NODE_TYPE_CODE NodeTypeCode;
24  PIO_STACK_LOCATION IoStack;
26  PNP_FCB Fcb;
27  PNP_CCB Ccb;
28  ULONG NamedPipeEnd;
29  PAGED_CODE();
30 
32 
33  NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
34  (PVOID*)&Fcb,
35  &Ccb,
36  &NamedPipeEnd);
37  if (!NodeTypeCode) return STATUS_PIPE_DISCONNECTED;
38  if (NodeTypeCode != NPFS_NTC_CCB) return STATUS_INVALID_PARAMETER;
39 
40  Status = SeQuerySecurityDescriptorInfo(&IoStack->Parameters.QuerySecurity.SecurityInformation,
41  Irp->UserBuffer,
42  &IoStack->Parameters.QuerySecurity.Length,
43  &Fcb->SecurityDescriptor);
45  {
46  Irp->IoStatus.Information = IoStack->Parameters.QuerySecurity.Length;
48  }
49 
50  return Status;
51 }
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:412
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
Definition: npfs.h:228
Definition: npfs.h:258
_In_ PIRP Irp
Definition: csq.h:116
Status
Definition: gdiplustypes.h:24
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:588
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3165
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned int ULONG
Definition: retypes.h:1
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
NTKERNELAPI NTSTATUS NTAPI SeQuerySecurityDescriptorInfo(_In_ PSECURITY_INFORMATION SecurityInformation, _Out_writes_bytes_(*Length) PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PULONG Length, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor)
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3124
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define PAGED_CODE()

Referenced by NpFsdQuerySecurityInfo().

◆ NpCommonSetSecurityInfo()

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

Definition at line 55 of file seinfo.c.

57 {
58  NODE_TYPE_CODE NodeTypeCode;
59  PIO_STACK_LOCATION IoStack;
61  PNP_FCB Fcb;
62  PNP_CCB Ccb;
63  ULONG NamedPipeEnd;
64  PSECURITY_DESCRIPTOR OldSecurityDescriptor;
65  PSECURITY_DESCRIPTOR TempSecurityDescriptor;
66  PSECURITY_DESCRIPTOR NewSecurityDescriptor;
67  PAGED_CODE();
68 
70 
71  NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
72  (PVOID*)&Fcb,
73  &Ccb,
74  &NamedPipeEnd);
75  if (!NodeTypeCode) return STATUS_PIPE_DISCONNECTED;
76  if (NodeTypeCode != NPFS_NTC_CCB) return STATUS_INVALID_PARAMETER;
77 
78  OldSecurityDescriptor = TempSecurityDescriptor = Fcb->SecurityDescriptor;
80  &IoStack->Parameters.SetSecurity.SecurityInformation,
81  IoStack->Parameters.SetSecurity.SecurityDescriptor,
82  &TempSecurityDescriptor,
83  TRUE,
85  if (!NT_SUCCESS(Status)) return Status;
86 
87  Status = ObLogSecurityDescriptor(TempSecurityDescriptor, &NewSecurityDescriptor, 1);
88  ASSERT(TempSecurityDescriptor != OldSecurityDescriptor);
89  ExFreePoolWithTag(TempSecurityDescriptor, 0);
90 
91  if (!NT_SUCCESS(Status)) return Status;
92 
93  Fcb->SecurityDescriptor = NewSecurityDescriptor;
94  ObDereferenceSecurityDescriptor(OldSecurityDescriptor, 1);
95  return Status;
96 }
PGENERIC_MAPPING NTAPI IoGetFileObjectGenericMapping(VOID)
Definition: file.c:3266
NTKERNELAPI NTSTATUS NTAPI SeSetSecurityDescriptorInfo(_In_opt_ PVOID Object, _In_ PSECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, _In_ POOL_TYPE PoolType, _In_ PGENERIC_MAPPING GenericMapping)
VOID NTAPI ObDereferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Count)
Definition: obsdcach.c:287
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:412
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NPFS_NTC_CCB
Definition: npfs.h:115
Definition: npfs.h:228
Definition: npfs.h:258
_In_ PIRP Irp
Definition: csq.h:116
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor, OUT PSECURITY_DESCRIPTOR *OutputSecurityDescriptor, IN ULONG RefBias)
Definition: obsdcach.c:364
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:588
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3165
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
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
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3124
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define PAGED_CODE()

Referenced by NpFsdSetSecurityInfo().

◆ 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
LONG NTSTATUS
Definition: precomp.h:26
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS NTAPI NpCommonQuerySecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:20
Status
Definition: gdiplustypes.h:24
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:604
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
#define PAGED_CODE()

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
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NpCommonSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:55
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:604
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
#define PAGED_CODE()

Referenced by DriverEntry().