https://git.reactos.org/?p=reactos.git;a=commitdiff;h=029accdcf7ccf25b7cb0d8...
commit 029accdcf7ccf25b7cb0d875fe065913ddc4d50f Author: Victor Perevertkin victor.perevertkin@reactos.org AuthorDate: Tue Feb 23 04:24:41 2021 +0300 Commit: Victor Perevertkin victor.perevertkin@reactos.org CommitDate: Tue Mar 16 03:17:42 2021 +0300
[NDK] Change the data structure for PlugPlayControlResetDevice control class
PlugPlayControlResetDevice shares the input structure with several other control classes. Source: ProcessHacker sources https://github.com/processhacker/phnt/blob/e9c8121f41b00cd24e31eb466c9795785... --- base/services/umpnpmgr/rpcserver.c | 4 ++-- base/setup/usetup/devinst.c | 4 ++-- ntoskrnl/io/pnpmgr/plugplay.c | 6 +++--- sdk/include/ndk/cmtypes.h | 38 ++++++++++++++++++++++---------------- 4 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c index 1d14d978ab0..cf9ba100f1b 100644 --- a/base/services/umpnpmgr/rpcserver.c +++ b/base/services/umpnpmgr/rpcserver.c @@ -3081,7 +3081,7 @@ static CONFIGRET EnableDeviceInstance( _In_ LPWSTR pszDeviceInstance) { - PLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData; + PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ResetDeviceData; CONFIGRET ret = CR_SUCCESS; NTSTATUS Status;
@@ -3091,7 +3091,7 @@ EnableDeviceInstance( pszDeviceInstance); Status = NtPlugPlayControl(PlugPlayControlResetDevice, &ResetDeviceData, - sizeof(PLUGPLAY_CONTROL_RESET_DEVICE_DATA)); + sizeof(PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA)); if (!NT_SUCCESS(Status)) ret = NtStatusToCrError(Status);
diff --git a/base/setup/usetup/devinst.c b/base/setup/usetup/devinst.c index 81eb382f5fb..80d93ce1d51 100644 --- a/base/setup/usetup/devinst.c +++ b/base/setup/usetup/devinst.c @@ -42,11 +42,11 @@ static BOOLEAN ResetDevice( IN LPCWSTR DeviceId) { - PLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData; + PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ResetDeviceData; NTSTATUS Status;
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)) { DPRINT1("NtPlugPlayControl() failed with status 0x%08x\n", Status); diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c index 66c1da7fde1..6c0e84fdb92 100644 --- a/ntoskrnl/io/pnpmgr/plugplay.c +++ b/ntoskrnl/io/pnpmgr/plugplay.c @@ -1044,7 +1044,7 @@ IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
static NTSTATUS -IopResetDevice(PPLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData) +IopResetDevice(PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ResetDeviceData) { PDEVICE_OBJECT DeviceObject; NTSTATUS Status; @@ -1364,9 +1364,9 @@ NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, // case PlugPlayControlRetrieveDock:
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 IopResetDevice((PPLUGPLAY_CONTROL_RESET_DEVICE_DATA)Buffer); + return IopResetDevice((PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA)Buffer);
// case PlugPlayControlHaltDevice: // case PlugPlayControlGetBlockedDriverList: diff --git a/sdk/include/ndk/cmtypes.h b/sdk/include/ndk/cmtypes.h index d5cbced0aea..7448c7d19be 100644 --- a/sdk/include/ndk/cmtypes.h +++ b/sdk/include/ndk/cmtypes.h @@ -453,14 +453,26 @@ typedef struct _PLUGPLAY_EVENT_BLOCK // Plug and Play Control Classes //
-// Class 0x00 +// PlugPlayControlEnumerateDevice (0x00) typedef struct _PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA { UNICODE_STRING DeviceInstance; ULONG Flags; } 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 { UNICODE_STRING DeviceInstance; @@ -470,7 +482,7 @@ typedef struct _PLUGPLAY_CONTROL_QUERY_REMOVE_DATA ULONG NameLength; } PLUGPLAY_CONTROL_QUERY_REMOVE_DATA, *PPLUGPLAY_CONTROL_QUERY_REMOVE_DATA;
-// Class 0x07 +// PlugPlayControlUserResponse (0x07) typedef struct _PLUGPLAY_CONTROL_USER_RESPONSE_DATA { ULONG Unknown1; @@ -479,7 +491,7 @@ typedef struct _PLUGPLAY_CONTROL_USER_RESPONSE_DATA ULONG Unknown4; } PLUGPLAY_CONTROL_USER_RESPONSE_DATA, *PPLUGPLAY_CONTROL_USER_RESPONSE_DATA;
-// Class 0x09 +// PlugPlayControlGetInterfaceDeviceList (0x09) typedef struct _PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA { UNICODE_STRING DeviceInstance; @@ -489,7 +501,7 @@ typedef struct _PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA ULONG BufferSize; } PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA, *PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA;
-//Class 0x0A +// PlugPlayControlProperty (0x0A) typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA { UNICODE_STRING DeviceInstance; @@ -498,7 +510,7 @@ typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA ULONG BufferSize; } PLUGPLAY_CONTROL_PROPERTY_DATA, *PPLUGPLAY_CONTROL_PROPERTY_DATA;
-// Class 0x0C +// PlugPlayControlGetRelatedDevice (0x0C) typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA { UNICODE_STRING TargetDeviceInstance; @@ -507,7 +519,7 @@ typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA ULONG RelatedDeviceInstanceLength; } PLUGPLAY_CONTROL_RELATED_DEVICE_DATA, *PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA;
-// Class 0x0E +// PlugPlayControlDeviceStatus (0x0E) typedef struct _PLUGPLAY_CONTOL_STATUS_DATA { UNICODE_STRING DeviceInstance; @@ -516,14 +528,14 @@ typedef struct _PLUGPLAY_CONTOL_STATUS_DATA ULONG DeviceProblem; } PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA;
-// Class 0x0F +// PlugPlayControlGetDeviceDepth (0x0F) typedef struct _PLUGPLAY_CONTROL_DEPTH_DATA { UNICODE_STRING DeviceInstance; ULONG Depth; } PLUGPLAY_CONTROL_DEPTH_DATA, *PPLUGPLAY_CONTROL_DEPTH_DATA;
-// Class 0x10 +// PlugPlayControlQueryDeviceRelations (0x10) typedef struct _PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA { UNICODE_STRING DeviceInstance; @@ -532,19 +544,13 @@ typedef struct _PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA PWCHAR Buffer; } PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA, *PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA;
-// Class 0x13 +// PlugPlayControlRetrieveDock (0x13) typedef struct _PLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA { ULONG DeviceInstanceLength; PWSTR DeviceInstance; } 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 //