https://git.reactos.org/?p=reactos.git;a=commitdiff;h=47e90b5ea44076fa7a771…
commit 47e90b5ea44076fa7a77144939dfcb453f6b7d3f
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Jul 14 21:50:06 2019 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Jul 14 21:50:06 2019 +0200
[UMPNPMGR] PNP_GetDeviceStatus: Move the code that retrieves the status of a device
into a separate function so that we can use in other functions.
---
base/services/umpnpmgr/rpcserver.c | 59 ++++++++++++++++++++++++--------------
1 file changed, 38 insertions(+), 21 deletions(-)
diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c
index 63148af8623..58a28e3cb4e 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -191,6 +191,41 @@ SplitDeviceInstanceID(IN LPWSTR pszDeviceInstanceID,
}
+static
+CONFIGRET
+GetDeviceStatus(
+ _In_ LPWSTR pDeviceID,
+ _Out_ DWORD *pulStatus,
+ _Out_ DWORD *pulProblem)
+{
+ PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData;
+ CONFIGRET ret = CR_SUCCESS;
+ NTSTATUS Status;
+
+ DPRINT("GetDeviceStatus(%S %p %p)\n",
+ pDeviceID, pulStatus, pulProblem);
+
+ RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
+ pDeviceID);
+ PlugPlayData.Operation = 0; /* Get status */
+
+ Status = NtPlugPlayControl(PlugPlayControlDeviceStatus,
+ (PVOID)&PlugPlayData,
+ sizeof(PLUGPLAY_CONTROL_STATUS_DATA));
+ if (NT_SUCCESS(Status))
+ {
+ *pulStatus = PlugPlayData.DeviceStatus;
+ *pulProblem = PlugPlayData.DeviceProblem;
+ }
+ else
+ {
+ ret = NtStatusToCrError(Status);
+ }
+
+ return ret;
+}
+
+
/* PUBLIC FUNCTIONS **********************************************************/
/* Function 0 */
@@ -2695,28 +2730,10 @@ PNP_GetDeviceStatus(
UNREFERENCED_PARAMETER(hBinding);
UNREFERENCED_PARAMETER(ulFlags);
- DPRINT("PNP_GetDeviceStatus() called\n");
-
- RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
- pDeviceID);
- PlugPlayData.Operation = 0; /* Get status */
-
- Status = NtPlugPlayControl(PlugPlayControlDeviceStatus,
- (PVOID)&PlugPlayData,
- sizeof(PLUGPLAY_CONTROL_STATUS_DATA));
- if (NT_SUCCESS(Status))
- {
- *pulStatus = PlugPlayData.DeviceStatus;
- *pulProblem = PlugPlayData.DeviceProblem;
- }
- else
- {
- ret = NtStatusToCrError(Status);
- }
-
- DPRINT("PNP_GetDeviceStatus() done (returns %lx)\n", ret);
+ DPRINT("PNP_GetDeviceStatus(%p %S %p %p)\n",
+ hBinding, pDeviceID, pulStatus, pulProblem, ulFlags);
- return ret;
+ return GetDeviceStatus(pDeviceId, pulStatus, pulProblem);
}