[SDK] Add a driverdbg header for helper debug function to put into drivers

This commit is contained in:
Victor Perevertkin 2020-06-13 06:30:50 +03:00
parent f144b8c10d
commit 4ae8a77aad
No known key found for this signature in database
GPG key ID: C750B7222E9C7830

View file

@ -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_