ReactOS 0.4.16-dev-125-g798ea90
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;
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}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
_In_ PIRP Irp
Definition: csq.h:116
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
#define NPFS_NTC_CCB
Definition: npfs.h:115
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
Status
Definition: gdiplustypes.h:25
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:412
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
struct _IO_STACK_LOCATION::@3974::@3992 QuerySecurity
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
union _IO_STACK_LOCATION::@1575 Parameters
Definition: npfs.h:259
Definition: npfs.h:229
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTKERNELAPI NTSTATUS NTAPI SeQuerySecurityDescriptorInfo(_In_ PSECURITY_INFORMATION SecurityInformation, _Out_writes_bytes_(*Length) PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PULONG Length, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor)

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;
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,
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}
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define PagedPool
Definition: env_spec_w32.h:308
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
PGENERIC_MAPPING NTAPI IoGetFileObjectGenericMapping(VOID)
Definition: file.c:3267
NTSTATUS NTAPI ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor, OUT PSECURITY_DESCRIPTOR *OutputSecurityDescriptor, IN ULONG RefBias)
Definition: obsdcach.c:364
VOID NTAPI ObDereferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Count)
Definition: obsdcach.c:287
struct _IO_STACK_LOCATION::@3974::@3993 SetSecurity
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)

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}
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSTATUS NTAPI NpCommonQuerySecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:20
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:604

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}
NTSTATUS NTAPI NpCommonSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:55

Referenced by DriverEntry().