https://git.reactos.org/?p=reactos.git;a=commitdiff;h=07d38cd4c527b73e5feba3...
commit 07d38cd4c527b73e5feba38dc0bbf31303131bdd Author: Jérôme Gardou jerome.gardou@reactos.org AuthorDate: Thu Jun 17 17:52:12 2021 +0200 Commit: Jérôme Gardou zefklop@users.noreply.github.com CommitDate: Mon Jun 28 10:20:57 2021 +0200
[NTOS:PO] Do not ignore IoRegisterPlugPlayNotification return value
CORE-17637 --- ntoskrnl/po/power.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/ntoskrnl/po/power.c b/ntoskrnl/po/power.c index 5f100d7a8d5..7b5b39fa818 100644 --- a/ntoskrnl/po/power.c +++ b/ntoskrnl/po/power.c @@ -403,26 +403,27 @@ PoInitSystem(IN ULONG BootPhase) /* Check if this is phase 1 init */ if (BootPhase == 1) { + NTSTATUS Status; /* Register power button notification */ - IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, - PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, - (PVOID)&GUID_DEVICE_SYS_BUTTON, - IopRootDeviceNode-> - PhysicalDeviceObject->DriverObject, - PopAddRemoveSysCapsCallback, - NULL, - &NotificationEntry); + Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, + PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, + (PVOID)&GUID_DEVICE_SYS_BUTTON, + IopRootDeviceNode->PhysicalDeviceObject->DriverObject, + PopAddRemoveSysCapsCallback, + NULL, + &NotificationEntry); + if (!NT_SUCCESS(Status)) + return FALSE;
/* Register lid notification */ - IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, - PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, - (PVOID)&GUID_DEVICE_LID, - IopRootDeviceNode-> - PhysicalDeviceObject->DriverObject, - PopAddRemoveSysCapsCallback, - NULL, - &NotificationEntry); - return TRUE; + Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, + PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, + (PVOID)&GUID_DEVICE_LID, + IopRootDeviceNode->PhysicalDeviceObject->DriverObject, + PopAddRemoveSysCapsCallback, + NULL, + &NotificationEntry); + return NT_SUCCESS(Status); }
/* Initialize the power capabilities */