mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[NTOSKRNL][NDK][UMPNPMGR] Define and use PLUGPLAY_CONTROL_PROPERTY_DATA.Properties values
NDK: Define PLUGPLAY_CONTROL_PROPERTY_DATA.Properties and PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA.Relations values. NTOSKRNL: Map PLUGPLAY_CONTROL_PROPERTY_DATA.Properties values to IoGetDeviceProperty properties and add (dummy) code for unsupported cases. UMPNPMGR: Use PLUGPLAY_CONTROL_PROPERTY_DATA.Properties values in PNP_GetDeviceRegProp.
This commit is contained in:
parent
0075c2a02d
commit
4ffa0a2e55
3 changed files with 169 additions and 33 deletions
|
@ -926,61 +926,58 @@ PNP_GetDeviceRegProp(
|
|||
switch (ulProperty)
|
||||
{
|
||||
case CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME:
|
||||
PlugPlayData.Property = 0xb; // DevicePropertyPhysicalDeviceObjectName;
|
||||
PlugPlayData.Property = PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME;
|
||||
break;
|
||||
|
||||
case CM_DRP_UI_NUMBER:
|
||||
PlugPlayData.Property = 0x11; // DevicePropertyUINumber;
|
||||
PlugPlayData.Property = PNP_PROPERTY_UI_NUMBER;
|
||||
break;
|
||||
|
||||
case CM_DRP_BUSTYPEGUID:
|
||||
PlugPlayData.Property = 0xc; // DevicePropertyBusTypeGuid;
|
||||
PlugPlayData.Property = PNP_PROPERTY_BUSTYPEGUID;
|
||||
break;
|
||||
|
||||
case CM_DRP_LEGACYBUSTYPE:
|
||||
PlugPlayData.Property = 0xd; // DevicePropertyLegacyBusType;
|
||||
PlugPlayData.Property = PNP_PROPERTY_LEGACYBUSTYPE;
|
||||
break;
|
||||
|
||||
case CM_DRP_BUSNUMBER:
|
||||
PlugPlayData.Property = 0xe; // DevicePropertyBusNumber;
|
||||
PlugPlayData.Property = PNP_PROPERTY_BUSNUMBER;
|
||||
break;
|
||||
|
||||
case CM_DRP_ENUMERATOR_NAME:
|
||||
PlugPlayData.Property = 0xf; // DevicePropertyEnumeratorName;
|
||||
PlugPlayData.Property = PNP_PROPERTY_ENUMERATOR_NAME;
|
||||
break;
|
||||
|
||||
case CM_DRP_ADDRESS:
|
||||
PlugPlayData.Property = 0x10; // DevicePropertyAddress;
|
||||
PlugPlayData.Property = PNP_PROPERTY_ADDRESS;
|
||||
break;
|
||||
|
||||
#if 0
|
||||
/* FIXME: This property is not supported by IoGetDeviceProperty */
|
||||
case CM_DRP_DEVICE_POWER_DATA:
|
||||
#endif
|
||||
PlugPlayData.Property = PNP_PROPERTY_POWER_DATA;
|
||||
break;
|
||||
|
||||
case CM_DRP_REMOVAL_POLICY:
|
||||
PlugPlayData.Property = 0x13; // DevicePropertyRemovalPolicy
|
||||
PlugPlayData.Property = PNP_PROPERTY_REMOVAL_POLICY;
|
||||
break;
|
||||
|
||||
#if 0
|
||||
/* FIXME: This property is not supported by IoGetDeviceProperty */
|
||||
case CM_DRP_REMOVAL_POLICY_HW_DEFAULT:
|
||||
#endif
|
||||
PlugPlayData.Property = PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT;
|
||||
break;
|
||||
|
||||
case CM_DRP_INSTALL_STATE:
|
||||
PlugPlayData.Property = 0x12; // DevicePropertyInstallState;
|
||||
PlugPlayData.Property = PNP_PROPERTY_INSTALL_STATE;
|
||||
break;
|
||||
|
||||
#if 0
|
||||
/* FIXME: This property is not supported by IoGetDeviceProperty */
|
||||
#if (WINVER >= _WIN32_WINNT_WS03)
|
||||
case CM_DRP_LOCATION_PATHS:
|
||||
#endif
|
||||
PlugPlayData.Property = PNP_PROPERTY_LOCATION_PATHS;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if (WINVER >= _WIN32_WINNT_WIN7)
|
||||
case CM_DRP_BASE_CONTAINERID:
|
||||
PlugPlayData.Property = 0x16; // DevicePropertyContainerID;
|
||||
PlugPlayData.Property = PNP_PROPERTY_CONTAINERID;
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -294,11 +294,13 @@ static NTSTATUS
|
|||
IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject = NULL;
|
||||
NTSTATUS Status;
|
||||
PDEVICE_NODE DeviceNode;
|
||||
UNICODE_STRING DeviceInstance;
|
||||
ULONG BufferSize;
|
||||
ULONG Property = 0;
|
||||
ULONG Property;
|
||||
DEVICE_REGISTRY_PROPERTY DeviceProperty;
|
||||
PVOID Buffer;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("IopGetDeviceProperty() called\n");
|
||||
DPRINT("Device name: %wZ\n", &PropertyData->DeviceInstance);
|
||||
|
@ -341,14 +343,124 @@ IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
|
|||
Buffer = ExAllocatePool(NonPagedPool, BufferSize);
|
||||
if (Buffer == NULL)
|
||||
{
|
||||
ObDereferenceObject(DeviceObject);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Status = IoGetDeviceProperty(DeviceObject,
|
||||
Property,
|
||||
BufferSize,
|
||||
Buffer,
|
||||
&BufferSize);
|
||||
|
||||
DeviceNode = ((PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension)->DeviceNode;
|
||||
|
||||
if (Property == PNP_PROPERTY_POWER_DATA)
|
||||
{
|
||||
if (BufferSize < sizeof(CM_POWER_DATA))
|
||||
{
|
||||
BufferSize = 0;
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// DEVICE_CAPABILITIES DeviceCapabilities;
|
||||
PCM_POWER_DATA PowerData;
|
||||
|
||||
// Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities);
|
||||
|
||||
PowerData = (PCM_POWER_DATA)Buffer;
|
||||
PowerData->PD_Size = sizeof(CM_POWER_DATA);
|
||||
/*
|
||||
PowerData->PD_MostRecentPowerState;
|
||||
PowerData->PD_Capabilities;
|
||||
PowerData->PD_D1Latency;
|
||||
PowerData->PD_D2Latency;
|
||||
PowerData->PD_D3Latency;
|
||||
PowerData->PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM];
|
||||
PowerData->PD_DeepestSystemWake;
|
||||
*/
|
||||
}
|
||||
}
|
||||
else if (Property == PNP_PROPERTY_REMOVAL_POLICY_OVERRIDE)
|
||||
{
|
||||
}
|
||||
else if (Property == PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT)
|
||||
{
|
||||
if (BufferSize < sizeof(DeviceNode->HardwareRemovalPolicy))
|
||||
{
|
||||
BufferSize = 0;
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
BufferSize = sizeof(DeviceNode->HardwareRemovalPolicy);
|
||||
RtlCopyMemory(Buffer,
|
||||
&DeviceNode->HardwareRemovalPolicy,
|
||||
BufferSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (Property)
|
||||
{
|
||||
case PNP_PROPERTY_UI_NUMBER:
|
||||
DeviceProperty = DevicePropertyUINumber;
|
||||
break;
|
||||
|
||||
case PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME:
|
||||
DeviceProperty = DevicePropertyPhysicalDeviceObjectName;
|
||||
break;
|
||||
|
||||
case PNP_PROPERTY_BUSTYPEGUID:
|
||||
DeviceProperty = DevicePropertyBusTypeGuid;
|
||||
break;
|
||||
|
||||
case PNP_PROPERTY_LEGACYBUSTYPE:
|
||||
DeviceProperty = DevicePropertyLegacyBusType;
|
||||
break;
|
||||
|
||||
case PNP_PROPERTY_BUSNUMBER:
|
||||
DeviceProperty = DevicePropertyBusNumber;
|
||||
break;
|
||||
|
||||
case PNP_PROPERTY_REMOVAL_POLICY:
|
||||
DeviceProperty = DevicePropertyRemovalPolicy;
|
||||
break;
|
||||
|
||||
case PNP_PROPERTY_ADDRESS:
|
||||
DeviceProperty = DevicePropertyAddress;
|
||||
break;
|
||||
|
||||
case PNP_PROPERTY_ENUMERATOR_NAME:
|
||||
DeviceProperty = DevicePropertyEnumeratorName;
|
||||
break;
|
||||
|
||||
case PNP_PROPERTY_INSTALL_STATE:
|
||||
DeviceProperty = DevicePropertyInstallState;
|
||||
break;
|
||||
|
||||
#if (WINVER >= _WIN32_WINNT_WS03)
|
||||
case PNP_PROPERTY_LOCATION_PATHS:
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if (WINVER >= _WIN32_WINNT_WIN7)
|
||||
case PNP_PROPERTY_CONTAINERID:
|
||||
DeviceProperty = DevicePropertyContainerID;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
BufferSize = 0;
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
Status = IoGetDeviceProperty(DeviceObject,
|
||||
DeviceProperty,
|
||||
BufferSize,
|
||||
Buffer,
|
||||
&BufferSize);
|
||||
}
|
||||
}
|
||||
|
||||
ObDereferenceObject(DeviceObject);
|
||||
|
||||
|
@ -696,19 +808,19 @@ IopGetDeviceRelations(PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA RelationsData)
|
|||
|
||||
switch (Relations)
|
||||
{
|
||||
case 0: /* EjectRelations */
|
||||
case PNP_EJECT_RELATIONS:
|
||||
Stack.Parameters.QueryDeviceRelations.Type = EjectionRelations;
|
||||
break;
|
||||
|
||||
case 1: /* RemovalRelations */
|
||||
case PNP_REMOVAL_RELATIONS:
|
||||
Stack.Parameters.QueryDeviceRelations.Type = RemovalRelations;
|
||||
break;
|
||||
|
||||
case 2: /* PowerRelations */
|
||||
case PNP_POWER_RELATIONS:
|
||||
Stack.Parameters.QueryDeviceRelations.Type = PowerRelations;
|
||||
break;
|
||||
|
||||
case 3: /* BusRelations */
|
||||
case PNP_BUS_RELATIONS:
|
||||
Stack.Parameters.QueryDeviceRelations.Type = BusRelations;
|
||||
break;
|
||||
|
||||
|
|
|
@ -28,6 +28,24 @@ Author:
|
|||
|
||||
#define MAX_BUS_NAME 24
|
||||
|
||||
//
|
||||
// PLUGPLAY_CONTROL_PROPERTY_DATA.Properties
|
||||
//
|
||||
#define PNP_PROPERTY_UI_NUMBER 0
|
||||
#define PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME 1
|
||||
#define PNP_PROPERTY_BUSTYPEGUID 2
|
||||
#define PNP_PROPERTY_LEGACYBUSTYPE 3
|
||||
#define PNP_PROPERTY_BUSNUMBER 4
|
||||
#define PNP_PROPERTY_POWER_DATA 5
|
||||
#define PNP_PROPERTY_REMOVAL_POLICY 6
|
||||
#define PNP_PROPERTY_REMOVAL_POLICY_OVERRIDE 7
|
||||
#define PNP_PROPERTY_ADDRESS 8
|
||||
#define PNP_PROPERTY_ENUMERATOR_NAME 9
|
||||
#define PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT 10
|
||||
#define PNP_PROPERTY_INSTALL_STATE 11
|
||||
#define PNP_PROPERTY_LOCATION_PATHS 12
|
||||
#define PNP_PROPERTY_CONTAINERID 13
|
||||
|
||||
//
|
||||
// PLUGPLAY_CONTROL_RELATED_DEVICE_DATA.Relations
|
||||
//
|
||||
|
@ -36,12 +54,21 @@ Author:
|
|||
#define PNP_GET_SIBLING_DEVICE 3
|
||||
|
||||
//
|
||||
// PLUGPLAY_CONTROL_STATUS_DATA Operations
|
||||
// PLUGPLAY_CONTROL_STATUS_DATA.Operation
|
||||
//
|
||||
#define PNP_GET_DEVICE_STATUS 0
|
||||
#define PNP_SET_DEVICE_STATUS 1
|
||||
#define PNP_CLEAR_DEVICE_STATUS 2
|
||||
|
||||
//
|
||||
// PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA.Relations
|
||||
//
|
||||
#define PNP_EJECT_RELATIONS 0
|
||||
#define PNP_REMOVAL_RELATIONS 1
|
||||
#define PNP_POWER_RELATIONS 2
|
||||
#define PNP_BUS_RELATIONS 3
|
||||
|
||||
|
||||
#ifdef NTOS_MODE_USER
|
||||
|
||||
//
|
||||
|
@ -466,7 +493,7 @@ typedef struct _PLUGPLAY_CONTROL_DEPTH_DATA
|
|||
typedef struct _PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA
|
||||
{
|
||||
UNICODE_STRING DeviceInstance;
|
||||
ULONG Relations; // 0:EjectRelations, 1:RemovalRelations, 2:PowerRelations, 3:BusRelations
|
||||
ULONG Relations;
|
||||
ULONG BufferSize;
|
||||
PWCHAR Buffer;
|
||||
} PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA, *PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA;
|
||||
|
@ -481,7 +508,7 @@ typedef struct _PLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA
|
|||
// Class 0x14
|
||||
typedef struct _PLUGPLAY_CONTROL_RESET_DEVICE_DATA
|
||||
{
|
||||
UNICODE_STRING DeviceInstance;
|
||||
UNICODE_STRING DeviceInstance;
|
||||
} PLUGPLAY_CONTROL_RESET_DEVICE_DATA, *PPLUGPLAY_CONTROL_RESET_DEVICE_DATA;
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue