# CVE-2026-47299 — monitor.sys patch diff

`monitor.sys` 10.0.26100.8737 -> 10.0.26100.8972 (ghidriff).

## `SetNitsBrightness`  (modified)

```diff
--- SetNitsBrightness
+++ SetNitsBrightness
@@ -1,49 +1,74 @@
 

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

 

 int SetNitsBrightness(undefined8 param_1,int *param_2,int param_3,int *param_4)

 

 {

-  undefined8 uVar1;

-  int iVar2;

-  undefined8 unaff_RBP;

-  longlong unaff_RSI;

-  int *unaff_RDI;

-  undefined4 in_register_00000084;

-  longlong unaff_R14;

-  int iStack0000000000000034;

-  undefined8 uStack0000000000000038;

-  undefined8 uStack0000000000000040;

+  int iVar1;

+  longlong lVar2;

+  undefined8 uVar3;

+  ulonglong uVar4;

+  undefined *puVar5;

+  undefined1 auStack_78 [32];

+  int local_58;

+  int local_48;

+  int local_44;

+  undefined8 local_40;

+  undefined8 uStack_38;

+  ulonglong local_30;

   

-  iStack0000000000000034 = unaff_RDI[2];

-  uStack0000000000000038 = 0;

-  uStack0000000000000040 = 0;

-  iVar2 = IoctlSetSdrWhiteLevel

-                    (unaff_RBP,(undefined4 *)&stack0x00000030,CONCAT44(in_register_00000084,param_3)

-                    );

-  if (iVar2 < 0) {

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      WPP_SF_LD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),WPP_GLOBAL_Control,

-                CONCAT44(in_register_00000084,param_3),unaff_RDI[1]);

+  local_30 = __security_cookie ^ (ulonglong)auStack_78;

+  puVar5 = PTR__WDF_DEVICE_CONTEXT_TYPE_INFO_14000b018;

+  lVar2 = (**(code **)(WdfFunctions_01015 + 0x650))(WdfDriverGlobals,param_1);

+  *param_4 = param_2[1];

+  param_4[3] = 1;

+  param_4[2] = 1;

+  if (param_3 == 0) {

+    uVar3 = *(undefined8 *)(param_2 + 2);

+    *(undefined8 *)(lVar2 + 0x430) = *(undefined8 *)param_2;

+    *(undefined8 *)(lVar2 + 0x438) = uVar3;

+    uVar3 = *(undefined8 *)(param_2 + 6);

+    *(undefined8 *)(lVar2 + 0x440) = *(undefined8 *)(param_2 + 4);

+    *(undefined8 *)(lVar2 + 0x448) = uVar3;

+  }

+  uVar3 = EnforceThermalThrottle(param_1,param_2);

+  param_4[4] = (int)uVar3;

+  uVar4 = Feature_HdrBrightnessPolicy__private_IsEnabledDeviceUsageNoInline();

+  if (((int)uVar4 != 0) && (*(char *)(lVar2 + 0x498) != '\0')) {

+    local_48 = param_2[1];

+    local_44 = param_2[2];

+    local_40 = 0;

+    uStack_38 = 0;

+    iVar1 = IoctlSetSdrWhiteLevel(param_1,&local_48,puVar5);

+    if (iVar1 < 0) {

+      if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+        return iVar1;

+      }

+      if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+        return iVar1;

+      }

+      if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+        return iVar1;

+      }

+      local_58 = iVar1;

+      WPP_SF_LD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),WPP_GLOBAL_Control,puVar5,param_2[1]);

+      return iVar1;

     }

   }

-  else {

-    *(int *)(unaff_R14 + 4) = unaff_RDI[1];

-    iVar2 = IoctlSetBrightness(unaff_RBP,unaff_RDI,CONCAT44(in_register_00000084,param_3));

-    *(int *)(unaff_R14 + 0x14) = iVar2;

-    if (-1 < iVar2) {

-      uVar1 = *(undefined8 *)(unaff_RDI + 2);

-      *(undefined8 *)(unaff_RSI + 0x408) = *(undefined8 *)unaff_RDI;

-      *(undefined8 *)(unaff_RSI + 0x410) = uVar1;

-      uVar1 = *(undefined8 *)(unaff_RDI + 6);

-      *(undefined8 *)(unaff_RSI + 0x418) = *(undefined8 *)(unaff_RDI + 4);

-      *(undefined8 *)(unaff_RSI + 0x420) = uVar1;

-      *(undefined8 *)(unaff_RSI + 0x428) = _DAT_0;

-    }

+  param_4[1] = param_2[1];

+  iVar1 = IoctlSetBrightness(param_1,param_2,puVar5);

+  param_4[5] = iVar1;

+  if (-1 < iVar1) {

+    uVar3 = *(undefined8 *)(param_2 + 2);

+    *(undefined8 *)(lVar2 + 0x408) = *(undefined8 *)param_2;

+    *(undefined8 *)(lVar2 + 0x410) = uVar3;

+    uVar3 = *(undefined8 *)(param_2 + 6);

+    *(undefined8 *)(lVar2 + 0x418) = *(undefined8 *)(param_2 + 4);

+    *(undefined8 *)(lVar2 + 0x420) = uVar3;

+    *(undefined8 *)(lVar2 + 0x428) = _DAT_0;

   }

-  return iVar2;

+  return iVar1;

 }
```

## `HandleBrightnessIoctlRedirection`  (modified)

```diff
--- HandleBrightnessIoctlRedirection
+++ HandleBrightnessIoctlRedirection
@@ -1,121 +1,121 @@
 

 /* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 uint HandleBrightnessIoctlRedirection

                (undefined8 param_1,undefined8 param_2,int param_3,longlong param_4)

 

 {

   uint uVar1;

   longlong lVar2;

   undefined8 uVar3;

   undefined8 uVar4;

   undefined1 auStack_b8 [32];

   ulonglong *local_98;

   int *local_88;

   ulonglong local_80;

   uint local_78 [6];

   undefined8 local_60;

   undefined8 uStack_58;

-  undefined8 uStack_50;

+  undefined8 local_50;

   ulonglong local_48;

   

   local_48 = __security_cookie ^ (ulonglong)auStack_b8;

   local_78[4] = 0;

   local_78[5] = 0;

   uVar3 = 0;

   local_80 = 0;

   uVar1 = 0xc0000022;

   local_78[0] = 0;

   local_78[1] = 0;

   local_78[2] = 0;

   local_78[3] = 0;

   lVar2 = (**(code **)(WdfFunctions_01015 + 0x650))

                     (WdfDriverGlobals,param_1,PTR__WDF_DEVICE_CONTEXT_TYPE_INFO_14000b018);

   if (*(char *)(lVar2 + 0x1c0) == '\0') {

     SetBrightnessTelemetry(local_78,param_4,1,0xc00000bb);

     if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

         ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29]))

     {

       WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xd,

               &WPP_a26ac74d6e7230b72a052569f10fcafc_Traceguids);

     }

     (**(code **)(WdfFunctions_01015 + 0x838))(WdfDriverGlobals,param_2,0xc00000bb);

     return 0xc00000bb;

   }

   if (*(int *)(param_4 + 0x29c) != 3) {

     if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

         ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29]))

     {

       WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xe,

               &WPP_a26ac74d6e7230b72a052569f10fcafc_Traceguids);

     }

 LAB_0:

     uVar1 = ForwardRequestToNextDriver(param_1,param_2);

     return uVar1;

   }

   if (param_3 == 0x230c04) {

     UpdateReferenceModeBrightnessCache(param_1);

   }

   if (*(char *)(param_4 + 0x498) == '\0') goto LAB_0;

   if (param_3 == 0x230c04) {

     local_98 = &local_80;

     local_88 = (int *)0x0;

     uVar1 = (**(code **)(WdfFunctions_01015 + 0x870))(WdfDriverGlobals,param_2,0xd0,&local_88);

     uVar3 = 0;

     if (-1 < (int)uVar1) {

       if (local_80 < 0xd0) {

         uVar1 = 0xc0000023;

       }

       else {

         *local_88 = 3;

         local_88[1] = 1;

         local_88[2] = 1;

         local_88[3] = 240000;

         local_88[4] = 80000;

         local_88[5] = 480000;

         local_88[6] = 8000;

         uVar3 = 0xd0;

       }

     }

     goto LAB_1;

   }

   if (param_3 == 0x230c08) {

     local_60 = 0;

     uStack_58 = 0;

-    uStack_50 = 0;

+    local_50 = 0;

     uVar1 = IoctlGetSdrWhiteLevel(param_1,(undefined4 *)&local_60);

     if ((int)uVar1 < 0) goto LAB_1;

     if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

         ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29]))

     {

       WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xf,

                &WPP_a26ac74d6e7230b72a052569f10fcafc_Traceguids,(int)local_60);

     }

     local_88 = (int *)0x0;

     local_98 = (ulonglong *)0x0;

     uVar1 = (**(code **)(WdfFunctions_01015 + 0x870))(WdfDriverGlobals,param_2,0xc,&local_88);

     if (-1 < (int)uVar1) {

       local_88[1] = (int)local_60;

       local_88[2] = (int)local_60;

       uVar3 = 0xc;

       goto LAB_1;

     }

 LAB_2:

     uVar4 = 2;

   }

   else {

     if (param_3 != 0x230c0c) goto LAB_1;

     local_88 = (int *)0x0;

     local_98 = (ulonglong *)0x0;

     uVar1 = (**(code **)(WdfFunctions_01015 + 0x868))(WdfDriverGlobals,param_2,0x20,&local_88);

     if ((int)uVar1 < 0) goto LAB_2;

     uVar1 = SetNitsBrightness(param_1,local_88,0,(int *)local_78);

     uVar4 = 0;

   }

   SetBrightnessTelemetry(local_78,param_4,uVar4,uVar1);

 LAB_1:

   (**(code **)(WdfFunctions_01015 + 0x848))(WdfDriverGlobals,param_2,uVar1,uVar3);

   return uVar1;

 }
```
