Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __try
- {
- switch (DriverInformationClass)
- {
- // Basic information such as flags, driver base and driver size.
- case DriverBasicInformation:
- {
- if (DriverInformationLength == sizeof(DRIVER_BASIC_INFORMATION))
- {
- PDRIVER_BASIC_INFORMATION basicInfo;
- basicInfo = (PDRIVER_BASIC_INFORMATION)DriverInformation;
- basicInfo->Flags = driverObject->Flags;
- basicInfo->DriverStart = driverObject->DriverStart;
- basicInfo->DriverSize = driverObject->DriverSize;
- }
- else
- {
- status = STATUS_INFO_LENGTH_MISMATCH;
- }
- if (ReturnLength)
- *ReturnLength = sizeof(DRIVER_BASIC_INFORMATION);
- }
- break;
- // The name of the driver - e.g. \Driver\Null.
- case DriverNameInformation:
- {
- if (DriverInformation)
- {
- /* Check buffer length. */
- if (sizeof(UNICODE_STRING) + driverObject->DriverName.Length <=
- DriverInformationLength)
- {
- KphpCopyInfoUnicodeString(
- DriverInformation,
- &driverObject->DriverName
- );
- }
- else
- {
- status = STATUS_BUFFER_TOO_SMALL;
- }
- }
- if (ReturnLength)
- *ReturnLength = sizeof(UNICODE_STRING) + driverObject->DriverName.Length;
- }
- break;
- // The name of the driver's service key - e.g. \REGISTRY\...
- case DriverServiceKeyNameInformation:
- {
- if (driverObject->DriverExtension)
- {
- if (DriverInformation)
- {
- if (sizeof(UNICODE_STRING) +
- driverObject->DriverExtension->ServiceKeyName.Length <=
- DriverInformationLength)
- {
- KphpCopyInfoUnicodeString(
- DriverInformation,
- &driverObject->DriverExtension->ServiceKeyName
- );
- }
- else
- {
- status = STATUS_BUFFER_TOO_SMALL;
- }
- }
- if (ReturnLength)
- {
- *ReturnLength = sizeof(UNICODE_STRING) +
- driverObject->DriverExtension->ServiceKeyName.Length;
- }
- }
- else
- {
- if (DriverInformation)
- {
- if (sizeof(UNICODE_STRING) <= DriverInformationLength)
- {
- // Zero the information buffer.
- KphpCopyInfoUnicodeString(
- DriverInformation,
- NULL
- );
- }
- else
- {
- status = STATUS_BUFFER_TOO_SMALL;
- }
- }
- if (ReturnLength)
- *ReturnLength = sizeof(UNICODE_STRING);
- }
- }
- break;
- default:
- {
- status = STATUS_INVALID_INFO_CLASS;
- }
- }
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- status = GetExceptionCode();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement