2 * PROJECT: ReactOS Drivers
3 * COPYRIGHT: See COPYING in the top level directory
4 * PURPOSE: Kernel Security Support Provider Interface Driver
6 * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
9 /* INCLUDES *******************************************************************/
17 /* FUNCTIONS ******************************************************************/
21 KsecQueryFileInformation(
23 FILE_INFORMATION_CLASS FileInformationClass
,
26 PFILE_STANDARD_INFORMATION StandardInformation
;
28 /* Only FileStandardInformation is supported */
29 if (FileInformationClass
!= FileStandardInformation
)
31 return STATUS_INVALID_INFO_CLASS
;
34 /* Validate buffer size */
35 if (*BufferLength
>= sizeof(FILE_STANDARD_INFORMATION
))
37 *BufferLength
= sizeof(FILE_STANDARD_INFORMATION
);
38 return STATUS_INFO_LENGTH_MISMATCH
;
41 /* Fill the structure */
42 StandardInformation
= (PFILE_STANDARD_INFORMATION
)InfoBuffer
;
43 StandardInformation
->AllocationSize
.QuadPart
= 0;
44 StandardInformation
->EndOfFile
.QuadPart
= 0;
45 StandardInformation
->NumberOfLinks
= 1;
46 StandardInformation
->DeletePending
= FALSE
;
47 StandardInformation
->Directory
= FALSE
;
48 *BufferLength
= sizeof(FILE_STANDARD_INFORMATION
);
50 return STATUS_SUCCESS
;
55 KsecQueryVolumeInformation(
57 FS_INFORMATION_CLASS FsInformationClass
,
60 PFILE_FS_DEVICE_INFORMATION DeviceInformation
;
62 /* Only FileFsDeviceInformation is supported */
63 if (FsInformationClass
== FileFsDeviceInformation
)
65 return STATUS_INVALID_INFO_CLASS
;
68 /* Validate buffer size */
69 if (*BufferLength
< sizeof(FILE_FS_DEVICE_INFORMATION
))
71 *BufferLength
= sizeof(FILE_FS_DEVICE_INFORMATION
);
72 return STATUS_INFO_LENGTH_MISMATCH
;
75 /* Fill the structure */
76 DeviceInformation
= (PFILE_FS_DEVICE_INFORMATION
)InfoBuffer
;
77 DeviceInformation
->DeviceType
= FILE_DEVICE_NULL
;
78 DeviceInformation
->Characteristics
= 0;
79 *BufferLength
= sizeof(FILE_FS_DEVICE_INFORMATION
);
81 return STATUS_SUCCESS
;
87 PDEVICE_OBJECT DeviceObject
,
90 PIO_STACK_LOCATION IoStackLocation
;
91 ULONG_PTR Information
;
95 FILE_INFORMATION_CLASS FileInfoClass
;
96 FS_INFORMATION_CLASS FsInfoClass
;
98 IoStackLocation
= IoGetCurrentIrpStackLocation(Irp
);
100 switch (IoStackLocation
->MajorFunction
)
105 /* Just return success */
106 Status
= STATUS_SUCCESS
;
112 /* There is nothing to read */
113 Status
= STATUS_END_OF_FILE
;
119 /* Pretend to have written everything */
120 Status
= STATUS_SUCCESS
;
121 Information
= IoStackLocation
->Parameters
.Write
.Length
;
124 case IRP_MJ_QUERY_INFORMATION
:
126 /* Extract the parameters */
127 Buffer
= Irp
->AssociatedIrp
.SystemBuffer
;
128 OutputLength
= IoStackLocation
->Parameters
.QueryFile
.Length
;
129 FileInfoClass
= IoStackLocation
->Parameters
.QueryFile
.FileInformationClass
;
131 /* Call the internal function */
132 Status
= KsecQueryFileInformation(Buffer
,
135 Information
= OutputLength
;
138 case IRP_MJ_QUERY_VOLUME_INFORMATION
:
140 /* Extract the parameters */
141 Buffer
= Irp
->AssociatedIrp
.SystemBuffer
;
142 OutputLength
= IoStackLocation
->Parameters
.QueryVolume
.Length
;
143 FsInfoClass
= IoStackLocation
->Parameters
.QueryVolume
.FsInformationClass
;
145 /* Call the internal function */
146 Status
= KsecQueryVolumeInformation(Buffer
,
149 Information
= OutputLength
;
153 DPRINT1("Unhandled major function %lu!\n",
154 IoStackLocation
->MajorFunction
);
158 /* Return the information */
159 Irp
->IoStatus
.Status
= Status
;
160 Irp
->IoStatus
.Information
= Information
;
162 /* Complete the request */
163 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);