[NDK] Change the data structure for PlugPlayControlResetDevice control class

PlugPlayControlResetDevice shares the input structure with several other
control classes.
Source: ProcessHacker sources e9c8121f41/ntpnpapi.h
This commit is contained in:
Victor Perevertkin 2021-02-23 04:24:41 +03:00
parent b66bdef370
commit 029accdcf7
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
4 changed files with 29 additions and 23 deletions

View file

@ -3081,7 +3081,7 @@ static CONFIGRET
EnableDeviceInstance( EnableDeviceInstance(
_In_ LPWSTR pszDeviceInstance) _In_ LPWSTR pszDeviceInstance)
{ {
PLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData; PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ResetDeviceData;
CONFIGRET ret = CR_SUCCESS; CONFIGRET ret = CR_SUCCESS;
NTSTATUS Status; NTSTATUS Status;
@ -3091,7 +3091,7 @@ EnableDeviceInstance(
pszDeviceInstance); pszDeviceInstance);
Status = NtPlugPlayControl(PlugPlayControlResetDevice, Status = NtPlugPlayControl(PlugPlayControlResetDevice,
&ResetDeviceData, &ResetDeviceData,
sizeof(PLUGPLAY_CONTROL_RESET_DEVICE_DATA)); sizeof(PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
ret = NtStatusToCrError(Status); ret = NtStatusToCrError(Status);

View file

@ -42,11 +42,11 @@ static BOOLEAN
ResetDevice( ResetDevice(
IN LPCWSTR DeviceId) IN LPCWSTR DeviceId)
{ {
PLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData; PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ResetDeviceData;
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString(&ResetDeviceData.DeviceInstance, DeviceId); RtlInitUnicodeString(&ResetDeviceData.DeviceInstance, DeviceId);
Status = NtPlugPlayControl(PlugPlayControlResetDevice, &ResetDeviceData, sizeof(PLUGPLAY_CONTROL_RESET_DEVICE_DATA)); Status = NtPlugPlayControl(PlugPlayControlResetDevice, &ResetDeviceData, sizeof(PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtPlugPlayControl() failed with status 0x%08x\n", Status); DPRINT1("NtPlugPlayControl() failed with status 0x%08x\n", Status);

View file

@ -1044,7 +1044,7 @@ IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
static NTSTATUS static NTSTATUS
IopResetDevice(PPLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData) IopResetDevice(PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ResetDeviceData)
{ {
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
NTSTATUS Status; NTSTATUS Status;
@ -1364,9 +1364,9 @@ NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass,
// case PlugPlayControlRetrieveDock: // case PlugPlayControlRetrieveDock:
case PlugPlayControlResetDevice: case PlugPlayControlResetDevice:
if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_RESET_DEVICE_DATA)) if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA))
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
return IopResetDevice((PPLUGPLAY_CONTROL_RESET_DEVICE_DATA)Buffer); return IopResetDevice((PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA)Buffer);
// case PlugPlayControlHaltDevice: // case PlugPlayControlHaltDevice:
// case PlugPlayControlGetBlockedDriverList: // case PlugPlayControlGetBlockedDriverList:

View file

@ -453,14 +453,26 @@ typedef struct _PLUGPLAY_EVENT_BLOCK
// Plug and Play Control Classes // Plug and Play Control Classes
// //
// Class 0x00 // PlugPlayControlEnumerateDevice (0x00)
typedef struct _PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA typedef struct _PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA
{ {
UNICODE_STRING DeviceInstance; UNICODE_STRING DeviceInstance;
ULONG Flags; ULONG Flags;
} PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA, *PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA; } PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA, *PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA;
// Class 0x06 // PlugPlayControlRegisterNewDevice (0x1)
// PlugPlayControlDeregisterDevice (0x2)
// PlugPlayControlInitializeDevice (0x3)
// PlugPlayControlStartDevice (0x4)
// PlugPlayControlUnlockDevice (0x5)
// PlugPlayControlResetDevice (0x14)
// PlugPlayControlHaltDevice (0x15)
typedef struct _PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA
{
UNICODE_STRING DeviceInstance;
} PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA, *PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA;
// PlugPlayControlQueryAndRemoveDevice (0x06)
typedef struct _PLUGPLAY_CONTROL_QUERY_REMOVE_DATA typedef struct _PLUGPLAY_CONTROL_QUERY_REMOVE_DATA
{ {
UNICODE_STRING DeviceInstance; UNICODE_STRING DeviceInstance;
@ -470,7 +482,7 @@ typedef struct _PLUGPLAY_CONTROL_QUERY_REMOVE_DATA
ULONG NameLength; ULONG NameLength;
} PLUGPLAY_CONTROL_QUERY_REMOVE_DATA, *PPLUGPLAY_CONTROL_QUERY_REMOVE_DATA; } PLUGPLAY_CONTROL_QUERY_REMOVE_DATA, *PPLUGPLAY_CONTROL_QUERY_REMOVE_DATA;
// Class 0x07 // PlugPlayControlUserResponse (0x07)
typedef struct _PLUGPLAY_CONTROL_USER_RESPONSE_DATA typedef struct _PLUGPLAY_CONTROL_USER_RESPONSE_DATA
{ {
ULONG Unknown1; ULONG Unknown1;
@ -479,7 +491,7 @@ typedef struct _PLUGPLAY_CONTROL_USER_RESPONSE_DATA
ULONG Unknown4; ULONG Unknown4;
} PLUGPLAY_CONTROL_USER_RESPONSE_DATA, *PPLUGPLAY_CONTROL_USER_RESPONSE_DATA; } PLUGPLAY_CONTROL_USER_RESPONSE_DATA, *PPLUGPLAY_CONTROL_USER_RESPONSE_DATA;
// Class 0x09 // PlugPlayControlGetInterfaceDeviceList (0x09)
typedef struct _PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA typedef struct _PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA
{ {
UNICODE_STRING DeviceInstance; UNICODE_STRING DeviceInstance;
@ -489,7 +501,7 @@ typedef struct _PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA
ULONG BufferSize; ULONG BufferSize;
} PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA, *PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA; } PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA, *PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA;
//Class 0x0A // PlugPlayControlProperty (0x0A)
typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA
{ {
UNICODE_STRING DeviceInstance; UNICODE_STRING DeviceInstance;
@ -498,7 +510,7 @@ typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA
ULONG BufferSize; ULONG BufferSize;
} PLUGPLAY_CONTROL_PROPERTY_DATA, *PPLUGPLAY_CONTROL_PROPERTY_DATA; } PLUGPLAY_CONTROL_PROPERTY_DATA, *PPLUGPLAY_CONTROL_PROPERTY_DATA;
// Class 0x0C // PlugPlayControlGetRelatedDevice (0x0C)
typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA
{ {
UNICODE_STRING TargetDeviceInstance; UNICODE_STRING TargetDeviceInstance;
@ -507,7 +519,7 @@ typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA
ULONG RelatedDeviceInstanceLength; ULONG RelatedDeviceInstanceLength;
} PLUGPLAY_CONTROL_RELATED_DEVICE_DATA, *PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA; } PLUGPLAY_CONTROL_RELATED_DEVICE_DATA, *PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA;
// Class 0x0E // PlugPlayControlDeviceStatus (0x0E)
typedef struct _PLUGPLAY_CONTOL_STATUS_DATA typedef struct _PLUGPLAY_CONTOL_STATUS_DATA
{ {
UNICODE_STRING DeviceInstance; UNICODE_STRING DeviceInstance;
@ -516,14 +528,14 @@ typedef struct _PLUGPLAY_CONTOL_STATUS_DATA
ULONG DeviceProblem; ULONG DeviceProblem;
} PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA; } PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA;
// Class 0x0F // PlugPlayControlGetDeviceDepth (0x0F)
typedef struct _PLUGPLAY_CONTROL_DEPTH_DATA typedef struct _PLUGPLAY_CONTROL_DEPTH_DATA
{ {
UNICODE_STRING DeviceInstance; UNICODE_STRING DeviceInstance;
ULONG Depth; ULONG Depth;
} PLUGPLAY_CONTROL_DEPTH_DATA, *PPLUGPLAY_CONTROL_DEPTH_DATA; } PLUGPLAY_CONTROL_DEPTH_DATA, *PPLUGPLAY_CONTROL_DEPTH_DATA;
// Class 0x10 // PlugPlayControlQueryDeviceRelations (0x10)
typedef struct _PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA typedef struct _PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA
{ {
UNICODE_STRING DeviceInstance; UNICODE_STRING DeviceInstance;
@ -532,19 +544,13 @@ typedef struct _PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA
PWCHAR Buffer; PWCHAR Buffer;
} PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA, *PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA; } PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA, *PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA;
// Class 0x13 // PlugPlayControlRetrieveDock (0x13)
typedef struct _PLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA typedef struct _PLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA
{ {
ULONG DeviceInstanceLength; ULONG DeviceInstanceLength;
PWSTR DeviceInstance; PWSTR DeviceInstance;
} PLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA, *PPLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA; } PLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA, *PPLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA;
// Class 0x14
typedef struct _PLUGPLAY_CONTROL_RESET_DEVICE_DATA
{
UNICODE_STRING DeviceInstance;
} PLUGPLAY_CONTROL_RESET_DEVICE_DATA, *PPLUGPLAY_CONTROL_RESET_DEVICE_DATA;
// //
// Plug and Play Bus Type Definition // Plug and Play Bus Type Definition
// //