https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d5b20cb1183bba925f365…
commit d5b20cb1183bba925f365752b264d7084551d4c3
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Apr 24 11:59:22 2021 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sat Apr 24 11:59:22 2021 +0200
[UMPNPMGR] Implement PNP_SetDeviceProblem
CORE-17527
---
base/services/umpnpmgr/rpcserver.c | 43 ++++++++++++++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 2 deletions(-)
diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c
index cba896860d5..63ae6e9b9ae 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -3207,8 +3207,47 @@ PNP_SetDeviceProblem(
DWORD ulProblem,
DWORD ulFlags)
{
- UNIMPLEMENTED;
- return CR_CALL_NOT_IMPLEMENTED;
+ ULONG ulOldStatus, ulOldProblem;
+ CONFIGRET ret = CR_SUCCESS;
+
+ UNREFERENCED_PARAMETER(hBinding);
+
+ DPRINT1("PNP_SetDeviceProblem(%p %S %lu 0x%08lx)\n",
+ hBinding, pDeviceID, ulProblem, ulFlags);
+
+ if (ulFlags & ~CM_SET_DEVNODE_PROBLEM_BITS)
+ return CR_INVALID_FLAG;
+
+ if (!IsValidDeviceInstanceID(pDeviceID))
+ return CR_INVALID_DEVINST;
+
+ ret = GetDeviceStatus(pDeviceID,
+ &ulOldStatus,
+ &ulOldProblem);
+ if (ret != CR_SUCCESS)
+ return ret;
+
+ if (((ulFlags & CM_SET_DEVNODE_PROBLEM_OVERRIDE) == 0) &&
+ (ulOldProblem != 0) &&
+ (ulOldProblem != ulProblem))
+ {
+ return CR_FAILURE;
+ }
+
+ if (ulProblem == 0)
+ {
+ ret = ClearDeviceStatus(pDeviceID,
+ DN_HAS_PROBLEM,
+ ulOldProblem);
+ }
+ else
+ {
+ ret = SetDeviceStatus(pDeviceID,
+ DN_HAS_PROBLEM,
+ ulProblem);
+ }
+
+ return ret;
}