mirror of
https://github.com/reactos/reactos.git
synced 2025-05-21 18:16:07 +00:00
- Implement PlugPlayControlProperty and PlugPlayControlGetDeviceDepth
- Move documentation from NDK headers svn path=/trunk/; revision=16399
This commit is contained in:
parent
3988ea5599
commit
2bdea48b49
2 changed files with 97 additions and 31 deletions
|
@ -279,7 +279,8 @@ typedef enum _PLUGPLAY_CONTROL_CLASS
|
||||||
PlugPlayControlUserResponse = 0x07,
|
PlugPlayControlUserResponse = 0x07,
|
||||||
PlugPlayControlProperty = 0x0A,
|
PlugPlayControlProperty = 0x0A,
|
||||||
PlugPlayControlGetRelatedDevice = 0x0C,
|
PlugPlayControlGetRelatedDevice = 0x0C,
|
||||||
PlugPlayControlDeviceStatus = 0x0E
|
PlugPlayControlDeviceStatus = 0x0E,
|
||||||
|
PlugPlayControlGetDeviceDepth
|
||||||
} PLUGPLAY_CONTROL_CLASS;
|
} PLUGPLAY_CONTROL_CLASS;
|
||||||
|
|
||||||
/* TYPES *********************************************************************/
|
/* TYPES *********************************************************************/
|
||||||
|
@ -287,34 +288,6 @@ typedef enum _PLUGPLAY_CONTROL_CLASS
|
||||||
typedef unsigned short LANGID;
|
typedef unsigned short LANGID;
|
||||||
typedef LANGID *PLANGID;
|
typedef LANGID *PLANGID;
|
||||||
|
|
||||||
/*
|
|
||||||
* Plug and Play event structure used by NtGetPlugPlayEvent.
|
|
||||||
*
|
|
||||||
* EventGuid
|
|
||||||
* Can be one of the following values:
|
|
||||||
* GUID_HWPROFILE_QUERY_CHANGE
|
|
||||||
* GUID_HWPROFILE_CHANGE_CANCELLED
|
|
||||||
* GUID_HWPROFILE_CHANGE_COMPLETE
|
|
||||||
* GUID_TARGET_DEVICE_QUERY_REMOVE
|
|
||||||
* GUID_TARGET_DEVICE_REMOVE_CANCELLED
|
|
||||||
* GUID_TARGET_DEVICE_REMOVE_COMPLETE
|
|
||||||
* GUID_PNP_CUSTOM_NOTIFICATION
|
|
||||||
* GUID_PNP_POWER_NOTIFICATION
|
|
||||||
* GUID_DEVICE_* (see above)
|
|
||||||
*
|
|
||||||
* EventCategory
|
|
||||||
* Type of the event that happened.
|
|
||||||
*
|
|
||||||
* Result
|
|
||||||
* ?
|
|
||||||
*
|
|
||||||
* Flags
|
|
||||||
* ?
|
|
||||||
*
|
|
||||||
* TotalSize
|
|
||||||
* Size of the event block including the device IDs and other
|
|
||||||
* per category specific fields.
|
|
||||||
*/
|
|
||||||
typedef struct _PLUGPLAY_EVENT_BLOCK
|
typedef struct _PLUGPLAY_EVENT_BLOCK
|
||||||
{
|
{
|
||||||
GUID EventGuid;
|
GUID EventGuid;
|
||||||
|
@ -1285,4 +1258,11 @@ typedef struct _PLUGPLAY_CONTOL_STATUS_DATA
|
||||||
ULONG DeviceProblem; /* CM_PROB_ see cfg.h */
|
ULONG DeviceProblem; /* CM_PROB_ see cfg.h */
|
||||||
} PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA;
|
} PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA;
|
||||||
|
|
||||||
|
/* Class 0x0F */
|
||||||
|
typedef struct _PLUGPLAY_CONTOL_DEPTH_DATA
|
||||||
|
{
|
||||||
|
UNICODE_STRING DeviceInstance;
|
||||||
|
ULONG Depth;
|
||||||
|
} PLUGPLAY_CONTROL_DEPTH_DATA, *PPLUGPLAY_CONTROL_DEPTH_DATA;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -103,6 +103,34 @@ IopRemovePlugPlayEvent(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Plug and Play event structure used by NtGetPlugPlayEvent.
|
||||||
|
*
|
||||||
|
* EventGuid
|
||||||
|
* Can be one of the following values:
|
||||||
|
* GUID_HWPROFILE_QUERY_CHANGE
|
||||||
|
* GUID_HWPROFILE_CHANGE_CANCELLED
|
||||||
|
* GUID_HWPROFILE_CHANGE_COMPLETE
|
||||||
|
* GUID_TARGET_DEVICE_QUERY_REMOVE
|
||||||
|
* GUID_TARGET_DEVICE_REMOVE_CANCELLED
|
||||||
|
* GUID_TARGET_DEVICE_REMOVE_COMPLETE
|
||||||
|
* GUID_PNP_CUSTOM_NOTIFICATION
|
||||||
|
* GUID_PNP_POWER_NOTIFICATION
|
||||||
|
* GUID_DEVICE_* (see above)
|
||||||
|
*
|
||||||
|
* EventCategory
|
||||||
|
* Type of the event that happened.
|
||||||
|
*
|
||||||
|
* Result
|
||||||
|
* ?
|
||||||
|
*
|
||||||
|
* Flags
|
||||||
|
* ?
|
||||||
|
*
|
||||||
|
* TotalSize
|
||||||
|
* Size of the event block including the device IDs and other
|
||||||
|
* per category specific fields.
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
* NtGetPlugPlayEvent
|
* NtGetPlugPlayEvent
|
||||||
*
|
*
|
||||||
|
@ -311,6 +339,32 @@ IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT DeviceObject = NULL;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("IopGetDeviceProperty() called\n");
|
||||||
|
DPRINT("Device name: %wZ\n", &PropertyData->DeviceInstance);
|
||||||
|
|
||||||
|
/* Get the device object */
|
||||||
|
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&PropertyData->DeviceInstance);
|
||||||
|
if (DeviceObject == NULL)
|
||||||
|
return STATUS_NO_SUCH_DEVICE;
|
||||||
|
|
||||||
|
Status = IoGetDeviceProperty(DeviceObject,
|
||||||
|
PropertyData->Property,
|
||||||
|
PropertyData->BufferSize,
|
||||||
|
PropertyData->Buffer,
|
||||||
|
&PropertyData->BufferSize);
|
||||||
|
|
||||||
|
ObDereferenceObject(DeviceObject);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
|
IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
|
||||||
{
|
{
|
||||||
|
@ -320,7 +374,6 @@ IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
|
||||||
PDEVICE_NODE RelatedDeviceNode;
|
PDEVICE_NODE RelatedDeviceNode;
|
||||||
|
|
||||||
DPRINT("IopGetRelatedDevice() called\n");
|
DPRINT("IopGetRelatedDevice() called\n");
|
||||||
|
|
||||||
DPRINT("Device name: %wZ\n", &RelatedDeviceData->TargetDeviceInstance);
|
DPRINT("Device name: %wZ\n", &RelatedDeviceData->TargetDeviceInstance);
|
||||||
|
|
||||||
RtlInitUnicodeString(&RootDeviceName,
|
RtlInitUnicodeString(&RootDeviceName,
|
||||||
|
@ -410,7 +463,6 @@ IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
|
||||||
PDEVICE_NODE DeviceNode;
|
PDEVICE_NODE DeviceNode;
|
||||||
|
|
||||||
DPRINT("IopDeviceStatus() called\n");
|
DPRINT("IopDeviceStatus() called\n");
|
||||||
|
|
||||||
DPRINT("Device name: %wZ\n", &StatusData->DeviceInstance);
|
DPRINT("Device name: %wZ\n", &StatusData->DeviceInstance);
|
||||||
|
|
||||||
/* Get the device object */
|
/* Get the device object */
|
||||||
|
@ -445,6 +497,30 @@ IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT DeviceObject;
|
||||||
|
PDEVICE_NODE DeviceNode;
|
||||||
|
|
||||||
|
DPRINT("IopGetDeviceDepth() called\n");
|
||||||
|
DPRINT("Device name: %wZ\n", &DepthData->DeviceInstance);
|
||||||
|
|
||||||
|
/* Get the device object */
|
||||||
|
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DepthData->DeviceInstance);
|
||||||
|
if (DeviceObject == NULL)
|
||||||
|
return STATUS_NO_SUCH_DEVICE;
|
||||||
|
|
||||||
|
DeviceNode = DeviceObject->DeviceObjectExtension->DeviceNode;
|
||||||
|
|
||||||
|
DepthData->Depth = DeviceNode->Level;
|
||||||
|
|
||||||
|
ObDereferenceObject(DeviceObject);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NtPlugPlayControl
|
* NtPlugPlayControl
|
||||||
*
|
*
|
||||||
|
@ -551,6 +627,11 @@ NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass,
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
return IopRemovePlugPlayEvent();
|
return IopRemovePlugPlayEvent();
|
||||||
|
|
||||||
|
case PlugPlayControlProperty:
|
||||||
|
if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_PROPERTY_DATA))
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
return IopGetDeviceProperty((PPLUGPLAY_CONTROL_PROPERTY_DATA)Buffer);
|
||||||
|
|
||||||
case PlugPlayControlGetRelatedDevice:
|
case PlugPlayControlGetRelatedDevice:
|
||||||
if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_RELATED_DEVICE_DATA))
|
if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_RELATED_DEVICE_DATA))
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
@ -561,6 +642,11 @@ NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass,
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
return IopDeviceStatus((PPLUGPLAY_CONTROL_STATUS_DATA)Buffer);
|
return IopDeviceStatus((PPLUGPLAY_CONTROL_STATUS_DATA)Buffer);
|
||||||
|
|
||||||
|
case PlugPlayControlGetDeviceDepth:
|
||||||
|
if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_DEPTH_DATA))
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
return IopGetDeviceDepth((PPLUGPLAY_CONTROL_DEPTH_DATA)Buffer);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue