25 __out PVOID Information,
30 #pragma alloc_text(PAGE, KpiOpenDriver)
31 #pragma alloc_text(PAGE, KpiQueryInformationDriver)
32 #pragma alloc_text(PAGE, KphpCopyInfoUnicodeString)
36 __out PHANDLE DriverHandle,
38 __in KPROCESSOR_MODE AccessMode
53 __in HANDLE DriverHandle,
55 __out_bcount(DriverInformationLength) PVOID DriverInformation,
56 __in ULONG DriverInformationLength,
57 __out_opt PULONG ReturnLength,
58 __in KPROCESSOR_MODE AccessMode
61 NTSTATUS status = STATUS_SUCCESS;
62 PDRIVER_OBJECT driverObject;
66 if (AccessMode != KernelMode)
70 ProbeForWrite(DriverInformation, DriverInformationLength, 1);
73 ProbeForWrite(ReturnLength,
sizeof(ULONG), 1);
75 __except (EXCEPTION_EXECUTE_HANDLER)
77 return GetExceptionCode();
81 status = ObReferenceObjectByHandle(
95 switch (DriverInformationClass)
105 basicInfo->
Flags = driverObject->Flags;
106 basicInfo->
DriverStart = driverObject->DriverStart;
107 basicInfo->
DriverSize = driverObject->DriverSize;
111 status = STATUS_INFO_LENGTH_MISMATCH;
122 if (DriverInformation)
127 driverObject->DriverName.Length <=
128 DriverInformationLength
133 &driverObject->DriverName
138 status = STATUS_BUFFER_TOO_SMALL;
143 *ReturnLength =
sizeof(
UNICODE_STRING) + driverObject->DriverName.Length;
150 if (driverObject->DriverExtension)
152 if (DriverInformation)
156 driverObject->DriverExtension->ServiceKeyName.Length <=
157 DriverInformationLength
162 &driverObject->DriverExtension->ServiceKeyName
167 status = STATUS_BUFFER_TOO_SMALL;
173 driverObject->DriverExtension->ServiceKeyName.Length;
177 if (DriverInformation)
189 status = STATUS_BUFFER_TOO_SMALL;
201 status = STATUS_INVALID_INFO_CLASS;
205 __except (EXCEPTION_EXECUTE_HANDLER)
207 status = GetExceptionCode();
210 ObDereferenceObject(driverObject);
216 __out PVOID Information,
226 targetUnicodeString->
Length = UnicodeString->Length;
228 targetUnicodeString->Buffer = (PWSTR)((PCHAR)Information +
sizeof(
UNICODE_STRING));
230 targetUnicodeString->Buffer,
231 UnicodeString->Buffer,
232 targetUnicodeString->
Length
237 targetUnicodeString->
Length = 0;
239 targetUnicodeString->Buffer = NULL;