From 54466dac1149ba84e0ebff353eca8922cbdc5908 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Mon, 11 Dec 2023 12:17:19 +0100 Subject: [PATCH] simbatt: Fix broken registry read-back The GetSimBattStateFromRegistry function is currently using default settings if GetSimBattStateFromRegistry succeeds, whereas settings from registry are only applied if GetSimBattStateFromRegistry fails. This does not make sense to me. Therefore proposing to remove the `!` negation from `if (!NT_SUCCESS(Status)) {` on the line after `Status = GetSimBattStateFromRegistry(Device, RegState);` so that default settings are loaded when registry read-back fails. --- simbatt/func/miniclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simbatt/func/miniclass.c b/simbatt/func/miniclass.c index ba2df340b..612b4c660 100644 --- a/simbatt/func/miniclass.c +++ b/simbatt/func/miniclass.c @@ -202,7 +202,7 @@ Return Value: } Status = GetSimBattStateFromRegistry(Device, RegState); - if (!NT_SUCCESS(Status)) { + if (NT_SUCCESS(Status)) { RtlZeroMemory(RegState, sizeof(SIMBATT_STATE)); WdfWaitLockAcquire(DevExt->StateLock, NULL);