https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4ae8a77aad7a6b36ad106f...
commit 4ae8a77aad7a6b36ad106f89098dcb32370a6ebf Author: Victor Perevertkin victor.perevertkin@reactos.org AuthorDate: Sat Jun 13 06:30:50 2020 +0300 Commit: Victor Perevertkin victor.perevertkin@reactos.org CommitDate: Sun Aug 30 03:58:37 2020 +0300
[SDK] Add a driverdbg header for helper debug function to put into drivers --- sdk/include/reactos/debug/driverdbg.h | 113 ++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+)
diff --git a/sdk/include/reactos/debug/driverdbg.h b/sdk/include/reactos/debug/driverdbg.h new file mode 100644 index 00000000000..963236e503f --- /dev/null +++ b/sdk/include/reactos/debug/driverdbg.h @@ -0,0 +1,113 @@ +/* + * PROJECT: ReactOS SDK + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: Helper functions for driver debugging + * COPYRIGHT: 2020 Victor Perevertkin (victor.perevertkin@reactos.org) + */ + +#ifndef _DBG_DRIVERDBG_H_ +#define _DBG_DRIVERDBG_H_ + +inline +PCHAR +GetIRPMinorFunctionString( + UCHAR MinorFunction) +{ + switch (MinorFunction) + { + case IRP_MN_START_DEVICE: + return "IRP_MN_START_DEVICE"; + case IRP_MN_QUERY_REMOVE_DEVICE: + return "IRP_MN_QUERY_REMOVE_DEVICE"; + case IRP_MN_REMOVE_DEVICE: + return "IRP_MN_REMOVE_DEVICE"; + case IRP_MN_CANCEL_REMOVE_DEVICE: + return "IRP_MN_CANCEL_REMOVE_DEVICE"; + case IRP_MN_STOP_DEVICE: + return "IRP_MN_STOP_DEVICE"; + case IRP_MN_QUERY_STOP_DEVICE: + return "IRP_MN_QUERY_STOP_DEVICE"; + case IRP_MN_CANCEL_STOP_DEVICE: + return "IRP_MN_CANCEL_STOP_DEVICE"; + case IRP_MN_QUERY_DEVICE_RELATIONS: + return "IRP_MN_QUERY_DEVICE_RELATIONS"; + case IRP_MN_QUERY_INTERFACE: + return "IRP_MN_QUERY_INTERFACE"; + case IRP_MN_QUERY_CAPABILITIES: + return "IRP_MN_QUERY_CAPABILITIES"; + case IRP_MN_QUERY_RESOURCES: + return "IRP_MN_QUERY_RESOURCES"; + case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: + return "IRP_MN_QUERY_RESOURCE_REQUIREMENTS"; + case IRP_MN_QUERY_DEVICE_TEXT: + return "IRP_MN_QUERY_DEVICE_TEXT"; + case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: + return "IRP_MN_FILTER_RESOURCE_REQUIREMENTS"; + case IRP_MN_READ_CONFIG: + return "IRP_MN_READ_CONFIG"; + case IRP_MN_WRITE_CONFIG: + return "IRP_MN_WRITE_CONFIG"; + case IRP_MN_EJECT: + return "IRP_MN_EJECT"; + case IRP_MN_SET_LOCK: + return "IRP_MN_SET_LOCK"; + case IRP_MN_QUERY_ID: + return "IRP_MN_QUERY_ID"; + case IRP_MN_QUERY_PNP_DEVICE_STATE: + return "IRP_MN_QUERY_PNP_DEVICE_STATE"; + case IRP_MN_QUERY_BUS_INFORMATION: + return "IRP_MN_QUERY_BUS_INFORMATION"; + case IRP_MN_DEVICE_USAGE_NOTIFICATION: + return "IRP_MN_DEVICE_USAGE_NOTIFICATION"; + case IRP_MN_SURPRISE_REMOVAL: + return "IRP_MN_SURPRISE_REMOVAL"; + case IRP_MN_QUERY_LEGACY_BUS_INFORMATION: + return "IRP_MN_QUERY_LEGACY_BUS_INFORMATION"; + default: + return "(unknown)IRP_MN"; + } +} + +inline +PCHAR +DbgGetDeviceRelationString( + DEVICE_RELATION_TYPE Type) +{ + switch (Type) + { + case BusRelations: + return "BusRelations"; + case EjectionRelations: + return "EjectionRelations"; + case RemovalRelations: + return "RemovalRelations"; + case TargetDeviceRelation: + return "TargetDeviceRelation"; + default: + return "(unknown)Relation"; + } +} + +inline +PCHAR +DbgGetDeviceIDString( + BUS_QUERY_ID_TYPE Type) +{ + switch (Type) + { + case BusQueryDeviceID: + return "BusQueryDeviceID"; + case BusQueryHardwareIDs: + return "BusQueryHardwareIDs"; + case BusQueryCompatibleIDs: + return "BusQueryCompatibleIDs"; + case BusQueryInstanceID: + return "BusQueryInstanceID"; + case BusQueryDeviceSerialNumber: + return "BusQueryDeviceSerialNumber"; + default: + return "(unknown)QueryID"; + } +} + +#endif // _DBG_DRIVERDBG_H_