# CVE-2026-119821 — ncbservice.dll patch diff

`ncbservice.dll` 10.0.26100.9711 -> 10.0.26100.9974 (ghidriff).

## `wil_RtlStagingConfig_QueryFeatureState`  (modified)

```diff
--- wil_RtlStagingConfig_QueryFeatureState
+++ wil_RtlStagingConfig_QueryFeatureState
@@ -1,29 +1,50 @@
 

-undefined8 wil_RtlStagingConfig_QueryFeatureState(uint *param_1,undefined4 param_2,int param_3)

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

+/* WARNING: Function: _guard_dispatch_icall$thunk$10345483385596137414 replaced with injection:

+   guard_dispatch_icall */

+

+undefined4

+wil_RtlStagingConfig_QueryFeatureState(uint *param_1,undefined4 param_2,int param_3,uint *param_4)

 

 {

-  char in_AL;

-  undefined8 uVar1;

-  undefined1 *puVar2;

-  char *unaff_RSI;

-  char unaff_R14B;

-  char unaff_R15B;

-  undefined1 *puStack0000000000000028;

-  undefined1 uStack0000000000000034;

-  undefined1 uStack0000000000000035;

-  undefined8 in_stack_00000090;

+  int iVar1;

+  undefined4 uVar2;

+  undefined1 auStack_78 [48];

+  undefined8 local_48;

+  undefined8 local_40;

+  uint local_38;

+  ulonglong local_30;

   

-  *unaff_RSI = *unaff_RSI - in_AL;

-  puStack0000000000000028 = &stack0x00000030;

-  uStack0000000000000034 = unaff_R15B != '\0';

-  puVar2 = &stack0x00000040;

-  uStack0000000000000035 = unaff_R14B != '\0';

-  uVar1 = BrSignalBrokerEvent(in_stack_00000090,puVar2,0,&CCT_RESET_EVENT_PARSER_CLSID,8);

-  if (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0) {

-    uVar1 = McTemplateU0zq_EventWriteTransfer

-                      (in_stack_00000090,puVar2,L"NcbCCResetSignalEventId: BrSignalBrokerEvent",

-                       (int)uVar1);

+  local_30 = __security_cookie ^ (ulonglong)auStack_78;

+  local_48 = 0;

+  uVar2 = 0;

+  local_40 = 0;

+  local_38 = 0;

+  if ((g_wil_details_pfnRtlQueryFeatureConfiguration == (code *)0x0) &&

+     (g_wil_details_pfnRtlQueryFeatureConfiguration =

+           (code *)wil_details_GetNtDllProcedureAddress("RtlQueryFeatureConfiguration"),

+     g_wil_details_pfnRtlQueryFeatureConfiguration == (code *)0x0)) {

+    iVar1 = -0x3ffffec7;

+    uVar2 = 0;

   }

-  return uVar1;

+  else {

+    iVar1 = (*g_wil_details_pfnRtlQueryFeatureConfiguration)

+                      (param_2,param_3 == 0,&local_48,&local_40);

+    if (iVar1 == 0) {

+      *param_1 = local_40._4_4_ >> 4 & 3;

+      *(byte *)(param_1 + 1) = (byte)((ulonglong)local_40 >> 0x28) & 0x3f;

+      param_1[3] = local_38;

+      param_1[2] = local_40._4_4_ >> 0xe & 3;

+      param_1[5] = local_40._4_4_ >> 6 & 1;

+    }

+    else if (iVar1 != 0x117) goto LAB_0;

+    uVar2 = 1;

+    param_1[4] = local_40._4_4_ >> 7 & 1;

+  }

+LAB_0:

+  if (param_4 != (uint *)0x0) {

+    *param_4 = (uint)(iVar1 != -0x7fffffde);

+  }

+  return uVar2;

 }
```

## `VpnAllowedPluginDeclarationGetSecurityDescriptor`  (modified)

```diff
--- VpnAllowedPluginDeclarationGetSecurityDescriptor
+++ VpnAllowedPluginDeclarationGetSecurityDescriptor
@@ -1,46 +1,70 @@
 

 DWORD VpnAllowedPluginDeclarationGetSecurityDescriptor(undefined8 *param_1,undefined4 *param_2)

 

 {

-  int iVar1;

-  DWORD DVar2;

-  undefined *unaff_RBX;

-  undefined *in_R8;

-  bool bVar3;

+  HLOCAL pvVar1;

+  bool bVar2;

+  int iVar3;

+  DWORD DVar4;

+  undefined8 uVar5;

+  undefined4 local_res8 [2];

+  HLOCAL local_res10;

   

-  if (((param_1 != (undefined8 *)0x80051018) && ((*(byte *)((longlong)param_1 + 0x1c) & 2) != 0)) &&

-     (5 < *(byte *)((longlong)param_1 + 0x19))) {

-    param_1 = (undefined8 *)param_1[2];

-    in_R8 = &WPP_6aeccb702aab34019b2140bc812a3df3_Traceguids;

-    param_2 = (undefined4 *)0x68;

-    WPP_SF_(param_1,0x68,&WPP_6aeccb702aab34019b2140bc812a3df3_Traceguids);

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

+     ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+    WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xa5,

+            &WPP_672b541566103487d192f0b957157036_Traceguids);

   }

-  if (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0) {

-    param_2 = (undefined4 *)&NcbKapiProviderDestroy;

-    in_R8 = unaff_RBX;

-    McTemplateU0pqsq_EventWriteTransfer

-              (param_1,(PCEVENT_DESCRIPTOR)&NcbKapiProviderDestroy,unaff_RBX,0);

+  DVar4 = 0;

+  local_res10 = (HLOCAL)0x0;

+  local_res8[0] = 0;

+  *param_1 = 0;

+  *param_2 = 0;

+  uVar5 = 1;

+  iVar3 = ConvertStringSecurityDescriptorToSecurityDescriptorW

+                    (L"O:SYG:SYD:(A;;RCWDCC;;;BA)(A;;RCWD;;;NO)(A;;RCWDCC;;;AU)(A;;RCWDCC;;;S-1-15-3-1024-2579400809-3867311217-3984994116-908665914-3508570097-1336497314-873935804-1444405236)(A;;RCWDCC;;;S-1-15-3-1024-1068037383-729401668-2768096886-125909118-1680096985-174794564-3112554050-3241210738)"

+                     ,1,&local_res10,local_res8);

+  pvVar1 = local_res10;

+  if (iVar3 == 0) {

+    DVar4 = GetLastError();

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

+       ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

+      uVar5 = 0xa6;

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xa6,

+               &WPP_672b541566103487d192f0b957157036_Traceguids,DVar4);

+    }

+    bVar2 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+            __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                 ::__l2::impl);

+    if (bVar2) {

+      TraceVpnWppErrorW32Impl

+                (DVar4,uVar5,0x52b,(_GUID *)"VpnAllowedPluginDeclarationGetSecurityDescriptor");

+    }

   }

-  if (*(longlong *)(unaff_RBX + 0x18) != 0) {

-    *(undefined8 *)(*(longlong *)(unaff_RBX + 0x18) + 0x30) = 0;

-    KapiProcessUpdateRequest(*(undefined8 **)(unaff_RBX + 0x18),param_2,in_R8);

-    *(undefined8 *)(unaff_RBX + 0x18) = 0;

+  else {

+    local_res10 = (HLOCAL)0x0;

+    *param_1 = pvVar1;

+    *param_2 = local_res8[0];

   }

-  _FREE__YAXPEAX_Z(unaff_RBX);

-  LOCK();

-  iVar1 = g_KapiRpcReferenceObject - 1;

-  UNLOCK();

-  bVar3 = g_KapiRpcReferenceObject == 1;

-  DVar2 = g_KapiRpcReferenceObject;

-  g_KapiRpcReferenceObject = iVar1;

-  if (bVar3) {

-    DVar2 = SetEvent(g_KapiRpcReferenceEvent);

+  _FREE__YAXPEAX_Z((void *)0x0);

+  LocalFree(local_res10);

+  if ((int)DVar4 < 0) {

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

+       ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xa7,

+               &WPP_672b541566103487d192f0b957157036_Traceguids,DVar4);

+    }

+    bVar2 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+            __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                 ::__l2::impl);

+    if (bVar2) {

+      TraceVpnWppErrorHRImpl

+                (DVar4,L"onecoreuap\\net\\netio\\vpnplugin\\protocolengine\\vpn_proteng_common.c",

+                 0x534,(_GUID *)"VpnAllowedPluginDeclarationGetSecurityDescriptor");

+    }

   }

-  if (((WPP_GLOBAL_Control != (undefined *)0x80051018) && ((WPP_GLOBAL_Control[0x1c] & 2) != 0)) &&

-     (5 < (byte)WPP_GLOBAL_Control[0x19])) {

-    DVar2 = WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0x69,

-                    &WPP_6aeccb702aab34019b2140bc812a3df3_Traceguids);

-  }

-  return DVar2;

+  return DVar4;

 }
```

## `VpnReportReturnError`  (modified)

```diff
--- VpnReportReturnError
+++ VpnReportReturnError
@@ -1,32 +1,42 @@
 

-int VpnReportReturnError(longlong param_1,int param_2)

+int VpnReportReturnError(undefined8 param_1,int param_2)

 

 {

-  int extraout_EAX;

-  int iVar1;

-  undefined *unaff_R14;

-  bool in_ZF;

+  bool bVar1;

   

-  if (((!in_ZF) && ((*(byte *)(param_1 + 0x1c) & 2) != 0)) && (4 < *(byte *)(param_1 + 0x19))) {

-    WPP_SF_(*(undefined8 *)(param_1 + 0x10),0x1e,&WPP_6aeccb702aab34019b2140bc812a3df3_Traceguids);

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

+     ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+    WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0x38,

+            &WPP_f6c99ea100633433985745fbf1db6cda_Traceguids);

   }

-  CloseHandle(g_KapiRpcReferenceEvent);

-  KapiStopRpcServer();

-  StopWorkQueue(0x1800523c0);

-  UninitializeWorkQueue((LPCRITICAL_SECTION)&g_KapiNcbWorkQueue);

-  CloseHandle(g_KapiClientCallbackRefEvent);

-  if (g_KapiKaSampleSet != (void *)0x0) {

-    FreeSampleSetHelper(g_KapiKaSampleSet);

-    g_KapiKaSampleSet = (void *)0x0;

+  if (-1 < param_2) {

+    MicrosoftTelemetryAssertTriggeredNoArgs();

   }

-  StubNlmCacheUninitialize(g_KapiNlmCache);

-  DeleteCriticalSection((LPCRITICAL_SECTION)&g_KapiProviderSetLock);

-  iVar1 = extraout_EAX;

-  if (((WPP_GLOBAL_Control != unaff_R14) && ((WPP_GLOBAL_Control[0x1c] & 2) != 0)) &&

-     (5 < (byte)WPP_GLOBAL_Control[0x19])) {

-    iVar1 = WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0x1f,

-                    &WPP_6aeccb702aab34019b2140bc812a3df3_Traceguids);

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

+    if ((WPP_GLOBAL_Control[0x1c] & 1) != 0) {

+      WPP_SF_sD(*(undefined8 *)(WPP_GLOBAL_Control + 0x10));

+    }

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

+       ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

+      WPP_SF_sd(*(undefined8 *)(WPP_GLOBAL_Control + 0x10));

+    }

   }

-  return iVar1;

+  if (param_2 < 0) {

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

+       ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0x3b,

+               &WPP_f6c99ea100633433985745fbf1db6cda_Traceguids,param_2);

+    }

+    bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+            __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                 ::__l2::impl);

+    if (bVar1) {

+      TraceVpnWppErrorHRImpl

+                (param_2,L"onecoreuap\\net\\netio\\vpnplugin\\utils\\vpn_util.cpp",0x635,

+                 (_GUID *)"VpnReportReturnError");

+    }

+  }

+  return param_2;

 }
```

## `VpnReportErrorAsWinError`  (modified)

```diff
--- VpnReportErrorAsWinError
+++ __GSHandlerCheck
@@ -1,12 +1,32 @@
 

-uint VpnReportErrorAsWinError(undefined8 param_1,undefined8 param_2,uint param_3)

+undefined8

+__GSHandlerCheck(undefined8 param_1,undefined8 param_2,undefined8 param_3,longlong param_4)

 

 {

-  code *pcVar1;

-  uint uVar2;

+  undefined8 extraout_RAX;

+  undefined8 uVar1;

+  longlong *unaff_RBX;

+  undefined *unaff_RSI;

+  longlong lVar2;

   

-  pcVar1 = (code *)swi(3);

-  uVar2 = (*pcVar1)();

-  return uVar2;

+  lVar2 = 4;

+  do {

+    _FREE__YAXPEAX_Z((void *)unaff_RBX[5]);

+    uVar1 = extraout_RAX;

+    if (*unaff_RBX != 0) {

+      uVar1 = RtlFreeSid();

+    }

+    if (unaff_RBX[2] != 0) {

+      uVar1 = RtlFreeSid();

+    }

+    unaff_RBX = unaff_RBX + 10;

+    lVar2 = lVar2 + -1;

+  } while (lVar2 != 0);

+  g_bAllowedPluginDeclInit = 0;

+  if ((WPP_GLOBAL_Control != unaff_RSI) && ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+    uVar1 = WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xb0,

+                    &WPP_672b541566103487d192f0b957157036_Traceguids);

+  }

+  return uVar1;

 }
```

## `RpcSrvSBCreatePushEnabledContext`  (modified)

```diff
--- RpcSrvSBCreatePushEnabledContext
+++ RpcSrvSBCreatePushEnabledContext
@@ -1,9 +1,129 @@
 

-uint RpcSrvSBCreatePushEnabledContext(undefined8 param_1,_GUID *param_2)

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

+/* WARNING: Type propagation algorithm not settling */

+

+uint RpcSrvSBCreatePushEnabledContext

+               (_tlgProvider_t *param_1,_GUID *param_2,_GUID *param_3,_GUID *param_4)

 

 {

-  uint in_EAX;

+  uint uVar1;

+  SocketBrokerContext *pSVar2;

+  _GUID *p_Var3;

+  uchar auVar4 [8];

+  char cVar5;

+  wchar_t *pwVar6;

+  undefined1 auStackY_b8 [32];

+  bool local_88 [8];

+  _GUID local_80;

+  SocketBrokerContext *local_70;

+  ushort *local_68 [2];

+  _EVENT_DATA_DESCRIPTOR local_58;

+  _GUID *local_48;

+  undefined4 local_40;

+  undefined4 local_3c;

+  _GUID *local_38;

+  undefined4 local_30;

+  undefined4 local_2c;

+  _GUID **local_28;

+  undefined4 local_20;

+  undefined4 local_1c;

+  ulonglong local_18;

   

-  return in_EAX & 0xffffff30;

+  local_18 = __security_cookie ^ (ulonglong)auStackY_b8;

+  local_70 = (SocketBrokerContext *)0x0;

+  local_68[0] = (ushort *)0x0;

+  local_80.Data4[0] = '\0';

+  local_80.Data4[1] = '\0';

+  local_80.Data4[2] = '\0';

+  local_80.Data4[3] = '\0';

+  local_80.Data4[4] = '\0';

+  local_80.Data4[5] = '\0';

+  local_80.Data4[6] = '\0';

+  local_80.Data4[7] = '\0';

+  local_88[0] = false;

+  if (param_2 == (_GUID *)0x0) {

+    if (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0) {

+      McTemplateU0zq_EventWriteTransfer

+                (param_1,0,L"RpcSrvSBCreatePushEnabledContext: invalid EventID",0x57);

+    }

+    uVar1 = 0x80070057;

+  }

+  else {

+    p_Var3 = param_2;

+    if (5 < DAT_0) {

+      p_Var3 = (_GUID *)&DAT_1;

+      local_80._0_8_ = param_2;

+      _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EventWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+      ::Write<_tlgWrapperByRef<16>_>

+                (param_1,&DAT_1,param_3,param_4,(_tlgWrapperByRef<16> *)&local_80);

+    }

+    pSVar2 = (SocketBrokerContext *)0x0;

+    pwVar6 = (wchar_t *)local_88;

+    uVar1 = RpcHelperRetriveSbContext

+                      ((ushort *)0x0,p_Var3,(bool *)pwVar6,local_68,&local_70,

+                       (void **)local_80.Data4);

+    cVar5 = local_88[0];

+    if (uVar1 == 0) {

+      if (local_88[0] != false) {

+        RpcRevertToSelf();

+        cVar5 = '\0';

+      }

+      pSVar2 = local_70;

+      auVar4 = local_80.Data4;

+      uVar1 = SocketBrokerContext::CreatePushEnabledContext(local_70,(void *)local_80.Data4);

+      if ((uVar1 != 0) && (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0))

+      {

+        pwVar6 = L"RpcSrvSBCreatePushEnabledContext: CreatePushEnabledContext failed";

+        McTemplateU0zq_EventWriteTransfer

+                  (pSVar2,auVar4,

+                   L"RpcSrvSBCreatePushEnabledContext: CreatePushEnabledContext failed",uVar1);

+      }

+    }

+    else if (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0) {

+      pwVar6 = L"RpcSrvSBCreatePushEnabledContext: RpcHelperRetriveSbContext failed";

+      McTemplateU0zq_EventWriteTransfer

+                (pSVar2,p_Var3,L"RpcSrvSBCreatePushEnabledContext: RpcHelperRetriveSbContext failed"

+                 ,uVar1);

+      cVar5 = local_88[0];

+    }

+    if (5 < DAT_0) {

+      local_1c = 0;

+      local_28 = (_GUID **)&local_80;

+      local_2c = 0;

+      pSVar2 = (SocketBrokerContext *)&DAT_0;

+      local_80.Data1 = uVar1;

+      pwVar6 = (wchar_t *)0x0;

+      local_20 = 4;

+      local_30 = 0x10;

+      local_38 = param_2;

+      _tlgWriteTransfer_EventWriteTransfer

+                (0x180051068,&DAT_2,(LPCGUID)0x0,(LPCGUID)0x0,4,&local_58);

+    }

+    if (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0) {

+      local_3c = 0;

+      local_38 = &local_80;

+      local_2c = 0;

+      local_80.Data1 = uVar1;

+      local_40 = 0x10;

+      local_30 = 4;

+      local_48 = param_2;

+      McGenEventWrite_EventWriteTransfer

+                (pSVar2,(PCEVENT_DESCRIPTOR)&SbCreatePushEnabledContext,pwVar6,3,&local_58);

+    }

+    _FREE__YAXPEAX_Z(local_68[0]);

+    if (cVar5 != '\0') {

+      RpcRevertToSelf();

+    }

+    if (local_80.Data4 != (uchar  [8])0x0) {

+      CloseHandle((HANDLE)local_80.Data4);

+    }

+    if (local_70 != (SocketBrokerContext *)0x0) {

+      SocketBrokerContext::ReleaseRef(local_70);

+    }

+    if (0 < (int)uVar1) {

+      uVar1 = uVar1 & 0xffff | 0x80070000;

+    }

+  }

+  return uVar1;

 }
```

## `VpnAllowedPluginDeclarationInitialize`  (modified)

```diff
--- VpnAllowedPluginDeclarationInitialize
+++ VpnAllowedPluginDeclarationInitialize
@@ -1,51 +1,128 @@
 

 uint VpnAllowedPluginDeclarationInitialize(undefined8 param_1,undefined8 param_2,undefined *param_3)

 

 {

   bool bVar1;

   uint uVar2;

-  int iVar3;

-  LPCWSTR lpSubKey;

-  HKEY pHVar4;

-  wchar_t *pwVar5;

-  int iVar6;

-  undefined *unaff_RSI;

-  HKEY pHStack0000000000000040;

+  undefined8 *puVar3;

+  uint uVar4;

+  ulonglong uVar5;

+  undefined8 uVar6;

+  undefined **ppuVar7;

   

-  WPP_SF_(param_1,0xc,param_3);

-  pHStack0000000000000040 = (HKEY)0x0;

-  lpSubKey = (LPCWSTR)&DAT_0;

-  iVar6 = 0;

-  bVar1 = std::_String_val<std::_Simple_types<unsigned_short>_>::_Large_mode_engaged

-                    ((_String_val<std::_Simple_types<unsigned_short>_> *)&DAT_0);

-  if (bVar1) {

-    lpSubKey = DAT_0;

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

+     ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+    param_3 = &WPP_672b541566103487d192f0b957157036_Traceguids;

+    param_2 = 0xa8;

+    WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xa8,

+            &WPP_672b541566103487d192f0b957157036_Traceguids);

   }

-  uVar2 = RegOpenKeyExW((HKEY)0xffffffff80000002,lpSubKey,0,0x20019,&stack0x00000040);

-  if (uVar2 == 0) {

-    pwVar5 = L"ReservedSlotTestOverride";

-    pHVar4 = pHStack0000000000000040;

-    iVar3 = GetInteger2(pHStack0000000000000040,L"ReservedSlotTestOverride",0);

-    if (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0) {

-      McTemplateU0zq_EventWriteTransfer(pHVar4,pwVar5,L"NcbReg: Test override value",iVar3);

+  if (g_bAllowedPluginDeclInit == 1) {

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

+       ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

+      param_2 = 0xa9;

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xa9,

+               &WPP_672b541566103487d192f0b957157036_Traceguids,0);

     }

-    uVar2 = RegCloseKey(pHStack0000000000000040);

+    bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+            __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                 ::__l2::impl);

+    uVar2 = 0;

+    if (bVar1) {

+      TraceVpnWppErrorW32Impl(0,param_2,0x540,(_GUID *)"VpnAllowedPluginDeclarationInitialize");

+      uVar2 = 0;

+    }

   }

   else {

-    iVar3 = 0;

-    if (((WPP_GLOBAL_Control != unaff_RSI) && (iVar3 = iVar6, (WPP_GLOBAL_Control[0x1c] & 1) != 0))

-       && (2 < (byte)WPP_GLOBAL_Control[0x19])) {

-      uVar2 = WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xd,

-                       &WPP_bf9fab00fa853a5bd6fbfd2bc0219c8d_Traceguids,uVar2);

+    uVar5 = 0;

+    ppuVar7 = &allowedPluginDecl;

+    do {

+      puVar3 = &DAT_0 + uVar5 * 10;

+      uVar2 = VpnExpandEnvironmentStrings((wchar_t *)ppuVar7[7],puVar3,param_3);

+      uVar2 = VpnHResultToWindowsError(uVar2);

+      if (uVar2 != 0) {

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

+           ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

+          puVar3 = (undefined8 *)0xaa;

+          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xaa,

+                   &WPP_672b541566103487d192f0b957157036_Traceguids,uVar2);

+        }

+        bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+                __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                    &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                     ::__l2::impl);

+        if (bVar1) {

+          uVar6 = 0x546;

+LAB_1:

+          TraceVpnWppErrorW32Impl

+                    (uVar2,puVar3,uVar6,(_GUID *)"VpnAllowedPluginDeclarationInitialize");

+        }

+        goto LAB_2;

+      }

+      puVar3 = &DAT_3 + uVar5 * 10;

+      uVar2 = AppContainerDeriveSidFromMoniker(*ppuVar7);

+      uVar2 = VpnHResultToWindowsError(uVar2);

+      if (uVar2 != 0) {

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

+           ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

+          puVar3 = (undefined8 *)0xab;

+          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xab,

+                   &WPP_672b541566103487d192f0b957157036_Traceguids,uVar2);

+        }

+        bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+                __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                    &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                     ::__l2::impl);

+        if (bVar1) {

+          uVar6 = 0x54a;

+          goto LAB_1;

+        }

+        goto LAB_2;

+      }

+      puVar3 = &DAT_4 + uVar5 * 10;

+      uVar2 = AppContainerDeriveSidFromMoniker(ppuVar7[4]);

+      uVar2 = VpnHResultToWindowsError(uVar2);

+      if (uVar2 != 0) {

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

+           ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

+          puVar3 = (undefined8 *)0xac;

+          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xac,

+                   &WPP_672b541566103487d192f0b957157036_Traceguids,uVar2);

+        }

+        bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+                __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                    &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                     ::__l2::impl);

+        if (bVar1) {

+          uVar6 = 0x54e;

+          goto LAB_1;

+        }

+        goto LAB_2;

+      }

+      uVar4 = (int)uVar5 + 1;

+      uVar5 = (ulonglong)uVar4;

+      ppuVar7 = ppuVar7 + 10;

+    } while (uVar4 < 4);

+    g_bAllowedPluginDeclInit = 1;

+LAB_2:

+    if ((int)uVar2 < 0) {

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

+         ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xad,

+                 &WPP_672b541566103487d192f0b957157036_Traceguids,uVar2);

+      }

+      bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+              __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                  &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                   ::__l2::impl);

+      if (bVar1) {

+        TraceVpnWppErrorHRImpl

+                  (uVar2,L"onecoreuap\\net\\netio\\vpnplugin\\protocolengine\\vpn_proteng_common.c",

+                   0x555,(_GUID *)"VpnAllowedPluginDeclarationInitialize");

+      }

     }

-  }

-  g_NcbRegistrarSlotTestOverride = iVar3 != 0;

-  if (((WPP_GLOBAL_Control != unaff_RSI) && ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) &&

-     (5 < (byte)WPP_GLOBAL_Control[0x19])) {

-    uVar2 = WPP_SF_c(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xe,

-                     &WPP_bf9fab00fa853a5bd6fbfd2bc0219c8d_Traceguids,g_NcbRegistrarSlotTestOverride

-                    );

   }

   return uVar2;

 }
```

## `VpnAllowedPluginDeclarationInitialize`  (modified)

```diff
--- VpnAllowedPluginDeclarationInitialize
+++ DllMain
@@ -1,128 +1,44 @@
 

-uint VpnAllowedPluginDeclarationInitialize(undefined8 param_1,undefined8 param_2,undefined *param_3)

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

+

+undefined8 DllMain(HMODULE param_1,int param_2)

 

 {

-  bool bVar1;

-  uint uVar2;

-  undefined8 *puVar3;

-  uint uVar4;

-  ulonglong uVar5;

-  undefined8 uVar6;

-  undefined **ppuVar7;

+  REGHANDLE RegHandle;

+  ULONG UVar1;

   

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

-     ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

-    param_3 = &WPP_672b541566103487d192f0b957157036_Traceguids;

-    param_2 = 0xa8;

-    WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xa8,

-            &WPP_672b541566103487d192f0b957157036_Traceguids);

+  RegHandle = DAT_0;

+  if (param_2 == 0) {

+    if (g_TraceLoggingRegistered) {

+      DAT_0 = 0;

+      DAT_1 = 0;

+      EventUnregister(RegHandle);

+    }

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

+        ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x19])) {

+      WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xb,

+              &WPP_a60c5a6cd17d354d3dfe4cb5efd04b06_Traceguids);

+    }

+    WppCleanupUm();

   }

-  if (g_bAllowedPluginDeclInit == 1) {

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

-       ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

-      param_2 = 0xa9;

-      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xa9,

-               &WPP_672b541566103487d192f0b957157036_Traceguids,0);

+  else if (param_2 == 1) {

+    DisableThreadLibraryCalls(param_1);

+    UVar1 = TraceLoggingRegisterEx_EventRegister_EventSetInformation(&DAT_1);

+    if (-1 < (int)UVar1) {

+      g_TraceLoggingRegistered = true;

     }

-    bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

-            __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

-                                &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

-                                 ::__l2::impl);

-    uVar2 = 0;

-    if (bVar1) {

-      TraceVpnWppErrorW32Impl(0,param_2,0x540,(_GUID *)"VpnAllowedPluginDeclarationInitialize");

-      uVar2 = 0;

+    DAT_2 = 0;

+    WPP_REGISTRATION_GUIDS = &WPP_ThisDir_CTLGUID_NCBSVC;

+    WPP_GLOBAL_Control = &WPP_MAIN_CB;

+    _WPP_MAIN_CB = 0;

+    _DAT_3 = 1;

+    WppInitUm();

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

+        ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x19])) {

+      WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),10,

+              &WPP_a60c5a6cd17d354d3dfe4cb5efd04b06_Traceguids);

     }

   }

-  else {

-    uVar5 = 0;

-    ppuVar7 = &allowedPluginDecl;

-    do {

-      puVar3 = &DAT_0 + uVar5 * 10;

-      uVar2 = VpnExpandEnvironmentStrings((wchar_t *)ppuVar7[7],puVar3,param_3);

-      uVar2 = VpnHResultToWindowsError(uVar2);

-      if (uVar2 != 0) {

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

-           ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

-          puVar3 = (undefined8 *)0xaa;

-          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xaa,

-                   &WPP_672b541566103487d192f0b957157036_Traceguids,uVar2);

-        }

-        bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

-                __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

-                                    &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

-                                     ::__l2::impl);

-        if (bVar1) {

-          uVar6 = 0x546;

-LAB_1:

-          TraceVpnWppErrorW32Impl

-                    (uVar2,puVar3,uVar6,(_GUID *)"VpnAllowedPluginDeclarationInitialize");

-        }

-        goto LAB_2;

-      }

-      puVar3 = &DAT_3 + uVar5 * 10;

-      uVar2 = AppContainerDeriveSidFromMoniker(*ppuVar7);

-      uVar2 = VpnHResultToWindowsError(uVar2);

-      if (uVar2 != 0) {

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

-           ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

-          puVar3 = (undefined8 *)0xab;

-          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xab,

-                   &WPP_672b541566103487d192f0b957157036_Traceguids,uVar2);

-        }

-        bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

-                __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

-                                    &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

-                                     ::__l2::impl);

-        if (bVar1) {

-          uVar6 = 0x54a;

-          goto LAB_1;

-        }

-        goto LAB_2;

-      }

-      puVar3 = &DAT_4 + uVar5 * 10;

-      uVar2 = AppContainerDeriveSidFromMoniker(ppuVar7[4]);

-      uVar2 = VpnHResultToWindowsError(uVar2);

-      if (uVar2 != 0) {

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

-           ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

-          puVar3 = (undefined8 *)0xac;

-          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xac,

-                   &WPP_672b541566103487d192f0b957157036_Traceguids,uVar2);

-        }

-        bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

-                __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

-                                    &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

-                                     ::__l2::impl);

-        if (bVar1) {

-          uVar6 = 0x54e;

-          goto LAB_1;

-        }

-        goto LAB_2;

-      }

-      uVar4 = (int)uVar5 + 1;

-      uVar5 = (ulonglong)uVar4;

-      ppuVar7 = ppuVar7 + 10;

-    } while (uVar4 < 4);

-    g_bAllowedPluginDeclInit = 1;

-LAB_2:

-    if ((int)uVar2 < 0) {

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

-         ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

-        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xad,

-                 &WPP_672b541566103487d192f0b957157036_Traceguids,uVar2);

-      }

-      bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

-              __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

-                                  &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

-                                   ::__l2::impl);

-      if (bVar1) {

-        TraceVpnWppErrorHRImpl

-                  (uVar2,L"onecoreuap\\net\\netio\\vpnplugin\\protocolengine\\vpn_proteng_common.c",

-                   0x555,(_GUID *)"VpnAllowedPluginDeclarationInitialize");

-      }

-    }

-  }

-  return uVar2;

+  return 1;

 }
```

## `VpnAllowedPluginDeclarationShutdown`  (modified)

```diff
--- VpnAllowedPluginDeclarationShutdown
+++ VpnAllowedPluginDeclarationShutdown
@@ -1,7 +1,53 @@
 

-void VpnAllowedPluginDeclarationShutdown(void)

+void VpnAllowedPluginDeclarationShutdown(undefined8 param_1,undefined8 param_2)

 

 {

+  bool bVar1;

+  longlong *plVar2;

+  longlong lVar3;

+  

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

+     ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+    param_2 = 0xae;

+    WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xae,

+            &WPP_672b541566103487d192f0b957157036_Traceguids);

+  }

+  if (g_bAllowedPluginDeclInit == 0) {

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

+       ((WPP_GLOBAL_Control[0x1c] & 1) != 0)) {

+      param_2 = 0xaf;

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xaf,

+               &WPP_672b541566103487d192f0b957157036_Traceguids,0);

+    }

+    bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::

+            __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04> *)

+                                &`private:_static_class_wil::details::FeatureImpl<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>&___ptr64___cdecl_wil::Feature<__WilFeatureTraits_Feature_VPN_Tracelog_26_04>::GetImpl(void)'

+                                 ::__l2::impl);

+    if (bVar1) {

+      TraceVpnWppErrorW32Impl(0,param_2,0x560,(_GUID *)"VpnAllowedPluginDeclarationShutdown");

+    }

+  }

+  else {

+    plVar2 = &DAT_0;

+    lVar3 = 4;

+    do {

+      _FREE__YAXPEAX_Z((void *)plVar2[5]);

+      if (*plVar2 != 0) {

+        RtlFreeSid();

+      }

+      if (plVar2[2] != 0) {

+        RtlFreeSid();

+      }

+      plVar2 = plVar2 + 10;

+      lVar3 = lVar3 + -1;

+    } while (lVar3 != 0);

+    g_bAllowedPluginDeclInit = 0;

+  }

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

+     ((WPP_GLOBAL_Control[0x1c] & 8) != 0)) {

+    WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xb0,

+            &WPP_672b541566103487d192f0b957157036_Traceguids);

+  }

   return;

 }
```

## `wil_RtlStagingConfig_RecordFeatureUsage`  (modified)

```diff
--- wil_RtlStagingConfig_RecordFeatureUsage
+++ wil_details_FeatureReporting_RecordUsageInCache
@@ -1,41 +1,14 @@
 

-undefined8 wil_RtlStagingConfig_RecordFeatureUsage(int param_1,undefined2 param_2,int param_3)

+/* WARNING: Control flow encountered bad instruction data */

+

+uint * wil_details_FeatureReporting_RecordUsageInCache

+                 (uint *param_1,uint *param_2,uint param_3,uint param_4,uint param_5)

 

 {

-  int iVar1;

-  undefined8 uVar2;

-  undefined4 in_register_0000000c;

-  undefined8 *puVar3;

-  undefined6 in_register_00000012;

-  undefined8 uVar4;

-  undefined4 in_register_00000084;

+  longlong in_RAX;

   

-  uVar4 = CONCAT62(in_register_00000012,param_2);

-  uVar2 = CONCAT44(in_register_0000000c,param_1);

-  if (param_1 != 0) {

-    uVar4 = 0;

-    iVar1 = RpcServerInterfaceGroupDeactivate(uVar2,0,CONCAT44(in_register_00000084,param_3));

-    if ((iVar1 != 0) && (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0)) {

-      McTemplateU0zq_EventWriteTransfer

-                (uVar2,uVar4,L"StopNcbCCResetRpcServer: RpcServerInterfaceGroupDeactivate failed",

-                 iVar1);

-    }

-    uVar2 = g_ncbCCResetRpcInterfaceGroup;

-    iVar1 = RpcServerInterfaceGroupClose();

-    if ((iVar1 != 0) && (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0)) {

-      McTemplateU0zq_EventWriteTransfer

-                (uVar2,uVar4,L"StopNcbCCResetRpcServer: RpcServerInterfaceGroupClose failed",iVar1);

-    }

-  }

-  BrDeleteBrokerInstance(g_NcbCCResetBroker);

-  BrDeleteBrokerInstance(g_NcbCCResetSebLegacyBroker);

-  puVar3 = &g_NcbCCResetAppResurrectionManager;

-  uVar2 = CleanupAppResurrectionManager(&g_NcbCCResetAppResurrectionManager);

-  g_NcbCCResetSebLegacyBroker = 0;

-  g_NcbCCResetBroker = 0;

-  if (((byte)Microsoft_Windows_Network_Connection_BrokerEnableBits & 1) != 0) {

-    uVar2 = McTemplateU0z_EventWriteTransfer(puVar3,uVar4,L"NcbCCResetUninitialize completed.");

-  }

-  return uVar2;

+  *(byte *)(in_RAX + -0x7d) = *(byte *)(in_RAX + -0x7d) & (byte)param_1;

+                    /* WARNING: Bad instruction - Truncating control flow here */

+  halt_baddata();

 }
```

## `wil::details::WilFailureNotifyWatchers`  (modified)

```diff
--- wil::details::WilFailureNotifyWatchers
+++ wil::details::WilFailureNotifyWatchers
@@ -1,2 +1,28 @@
-Failed to decompile ncbservice.dll - .ProgramDB wil::details::WilFailureNotifyWatchers : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: _guard_dispatch_icall$thunk$10345483385596137414 replaced with injection:

+   guard_dispatch_icall */

+/* void __cdecl wil::details::WilFailureNotifyWatchers(unsigned int,struct WilFailureReport const *

+   __ptr64,struct WilFailureReportInformation * __ptr64) */

+

+void __cdecl

+wil::details::WilFailureNotifyWatchers

+          (uint param_1,WilFailureReport *param_2,WilFailureReportInformation *param_3)

+

+{

+  if ((`void___cdecl_wil::details::WilFailureNotifyWatchers(unsigned_int,WilFailureReport_const*___ptr64,WilFailureReportInformation*___ptr64)'

+       ::__l2::s_pfnFailureNotifyWatchers ==

+       (_func_void_uint_WilFailureReport_ptr_WilFailureReportInformation_ptr *)0x0) &&

+     (`void___cdecl_wil::details::WilFailureNotifyWatchers(unsigned_int,WilFailureReport_const*___ptr64,WilFailureReportInformation*___ptr64)'

+      ::__l2::s_pfnFailureNotifyWatchers =

+           (_func_void_uint_WilFailureReport_ptr_WilFailureReportInformation_ptr *)

+           wil_details_GetKernelBaseProcAddress("WilFailureNotifyWatchers"),

+     `void___cdecl_wil::details::WilFailureNotifyWatchers(unsigned_int,WilFailureReport_const*___ptr64,WilFailureReportInformation*___ptr64)'

+     ::__l2::s_pfnFailureNotifyWatchers ==

+     (_func_void_uint_WilFailureReport_ptr_WilFailureReportInformation_ptr *)0x0)) {

+    return;

+  }

+  (*`void___cdecl_wil::details::WilFailureNotifyWatchers(unsigned_int,WilFailureReport_const*___ptr64,WilFailureReportInformation*___ptr64)'

+    ::__l2::s_pfnFailureNotifyWatchers)(0,param_2,param_3);

+  return;

+}

+
```

## `wil::details::ReportFailure_CaughtExceptionCommon<1>`  (modified)

```diff
--- wil::details::ReportFailure_CaughtExceptionCommon<1>
+++ wil::details::ReportFailure_CaughtExceptionCommon<1>
@@ -1,2 +1,59 @@
-Failed to decompile ncbservice.dll - .ProgramDB wil::details::ReportFailure_CaughtExceptionCommon<1> : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: _guard_dispatch_icall$thunk$10345483385596137414 replaced with injection:

+   guard_dispatch_icall */

+/* struct wil::details::ResultStatus __cdecl

+   wil::details::ReportFailure_CaughtExceptionCommon<1>(void * __ptr64,unsigned int,char const *

+   __ptr64,char const * __ptr64,char const * __ptr64,void * __ptr64,unsigned short *

+   __ptr64,unsigned __int64,enum wil::SupportedExceptions) */

+

+void * __cdecl

+wil::details::ReportFailure_CaughtExceptionCommon<1>

+          (void *param_1,uint param_2,char *param_3,char *param_4,char *param_5,void *param_6,

+          ushort *param_7,__uint64 param_8,SupportedExceptions param_9)

+

+{

+  undefined4 uVar1;

+  code *pcVar2;

+  long lVar3;

+  undefined8 *puVar4;

+  longlong lVar5;

+  undefined4 in_register_00000014;

+  char cStack0000000000000050;

+  char *in_stack_ffffffffffffffb8;

+  ReportFailureOptions in_stack_ffffffffffffffd8;

+  undefined1 local_18 [16];

+  

+  pcVar2 = g_pfnResultFromCaughtExceptionInternal;

+  cStack0000000000000050 = '\0';

+  lVar5 = -1;

+  do {

+    lVar5 = lVar5 + 1;

+  } while (*(short *)(param_8 + lVar5 * 2) != 0);

+  *(undefined8 *)param_1 = 0;

+  *(undefined4 *)((longlong)param_1 + 8) = 1;

+  if (pcVar2 != (code *)0x0) {

+    param_4 = &stack0x00000050;

+    puVar4 = (undefined8 *)(*pcVar2)(local_18,param_8 + lVar5 * 2,0x800 - lVar5);

+    uVar1 = *(undefined4 *)(puVar4 + 1);

+    *(undefined8 *)param_1 = *puVar4;

+    *(undefined4 *)((longlong)param_1 + 8) = uVar1;

+    if (*(int *)param_1 < 0) {

+      ReportFailure_Base<1,0>

+                ((void *)CONCAT44(in_register_00000014,param_2),(uint)param_3,

+                 "onecoreuap\\net\\netio\\iphlpsvc\\ncb\\src\\firewallhelper.cpp",param_4,

+                 in_stack_ffffffffffffffb8,param_7,param_1,(ushort *)param_8,

+                 in_stack_ffffffffffffffd8);

+      return param_1;

+    }

+  }

+  *(undefined4 *)param_1 = 0x8007023e;

+  lVar3 = HrToNtStatus(-0x7ff8fdc2);

+  *(long *)((longlong)param_1 + 4) = lVar3;

+  *(undefined4 *)((longlong)param_1 + 8) = 0;

+                    /* WARNING: Subroutine does not return */

+  ReportFailure_Base<3,0>

+            ((void *)CONCAT44(in_register_00000014,param_2),(uint)param_3,

+             "onecoreuap\\net\\netio\\iphlpsvc\\ncb\\src\\firewallhelper.cpp",param_4,

+             in_stack_ffffffffffffffb8,param_7,param_1,(ushort *)param_8,in_stack_ffffffffffffffd8);

+}

+
```

## `wil::details::ReportFailure_NoReturn<3>`  (modified)

```diff
--- wil::details::ReportFailure_NoReturn<3>
+++ wil::details::ReportFailure_NoReturn<3>
@@ -1,2 +1,30 @@
-Failed to decompile ncbservice.dll - .ProgramDB wil::details::ReportFailure_NoReturn<3> : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: __chkstk replaced with injection: alloca_probe */

+/* void __cdecl wil::details::ReportFailure_NoReturn<3>(void * __ptr64,unsigned int,char const *

+   __ptr64,char const * __ptr64,char const * __ptr64,void * __ptr64,struct

+   wil::details::ResultStatus const & __ptr64,unsigned short const * __ptr64,enum

+   wil::details::ReportFailureOptions) */

+

+void __cdecl

+wil::details::ReportFailure_NoReturn<3>

+          (void *param_1,uint param_2,char *param_3,char *param_4,char *param_5,void *param_6,

+          ResultStatus *param_7,ushort *param_8,ReportFailureOptions param_9)

+

+{

+  undefined1 in_stack_ffffffffffffeb10;

+  __uint64 in_stack_ffffffffffffeb20;

+  __uint64 in_stack_ffffffffffffeb30;

+  FailureInfo local_14b8 [160];

+  char local_1418 [1024];

+  ushort local_1018 [2044];

+  undefined8 uStack_20;

+  

+  uStack_20 = 0x18002c32a;

+  memset(local_14b8,0,0x98);

+  LogFailure(param_1,param_2,param_3,(char *)0x0,(char *)0x0,param_6,3,param_7,param_8,

+             (bool)in_stack_ffffffffffffeb10,local_1018,in_stack_ffffffffffffeb20,local_1418,

+             in_stack_ffffffffffffeb30,local_14b8);

+                    /* WARNING: Subroutine does not return */

+  WilFailFast(local_14b8);

+}

+
```

## `wil::details::WilFailureNotifyWatchers`  (modified)

```diff
--- wil::details::WilFailureNotifyWatchers
+++ wil_details_GetNtDllModuleHandle
@@ -1,28 +1,15 @@
 

-/* WARNING: Function: _guard_dispatch_icall$thunk$10345483385596137414 replaced with injection:

-   guard_dispatch_icall */

-/* void __cdecl wil::details::WilFailureNotifyWatchers(unsigned int,struct WilFailureReport const *

-   __ptr64,struct WilFailureReportInformation * __ptr64) */

+/* struct HINSTANCE__ * __ptr64 __cdecl wil_details_GetNtDllModuleHandle(void) */

 

-void __cdecl

-wil::details::WilFailureNotifyWatchers

-          (uint param_1,WilFailureReport *param_2,WilFailureReportInformation *param_3)

+HINSTANCE__ * __cdecl wil_details_GetNtDllModuleHandle(void)

 

 {

-  if ((`void___cdecl_wil::details::WilFailureNotifyWatchers(unsigned_int,WilFailureReport_const*___ptr64,WilFailureReportInformation*___ptr64)'

-       ::__l2::s_pfnFailureNotifyWatchers ==

-       (_func_void_uint_WilFailureReport_ptr_WilFailureReportInformation_ptr *)0x0) &&

-     (`void___cdecl_wil::details::WilFailureNotifyWatchers(unsigned_int,WilFailureReport_const*___ptr64,WilFailureReportInformation*___ptr64)'

-      ::__l2::s_pfnFailureNotifyWatchers =

-           (_func_void_uint_WilFailureReport_ptr_WilFailureReportInformation_ptr *)

-           wil_details_GetKernelBaseProcAddress("WilFailureNotifyWatchers"),

-     `void___cdecl_wil::details::WilFailureNotifyWatchers(unsigned_int,WilFailureReport_const*___ptr64,WilFailureReportInformation*___ptr64)'

-     ::__l2::s_pfnFailureNotifyWatchers ==

-     (_func_void_uint_WilFailureReport_ptr_WilFailureReportInformation_ptr *)0x0)) {

-    return;

+  if (`struct_HINSTANCE__*___ptr64___cdecl_wil_details_GetNtDllModuleHandle(void)'::__l2::

+      wil_details_ntdllModuleHandle == (HINSTANCE__ *)0x0) {

+    `struct_HINSTANCE__*___ptr64___cdecl_wil_details_GetNtDllModuleHandle(void)'::__l2::

+    wil_details_ntdllModuleHandle = GetModuleHandleW(L"ntdll.dll");

   }

-  (*`void___cdecl_wil::details::WilFailureNotifyWatchers(unsigned_int,WilFailureReport_const*___ptr64,WilFailureReportInformation*___ptr64)'

-    ::__l2::s_pfnFailureNotifyWatchers)(0,param_2,param_3);

-  return;

+  return `struct_HINSTANCE__*___ptr64___cdecl_wil_details_GetNtDllModuleHandle(void)'::__l2::

+         wil_details_ntdllModuleHandle;

 }
```

## `wil::details::WriteResultString<char_const*___ptr64>`  (modified)

```diff
--- wil::details::WriteResultString<char_const*___ptr64>
+++ wil::last_error_context::last_error_context
@@ -1,2 +1,2 @@
-Failed to decompile ncbservice.dll - .ProgramDB wil::details::WriteResultString<char_const*___ptr64> : Error: Decompile error: 
+Failed to decompile ncbservice.dll - .ProgramDB wil::last_error_context::last_error_context : Error: Decompile error: 
 Marshaling error: Did not see expected closing element
```

## `wil::details_abi::ProcessLocalStorageData<wil::details_abi::ProcessLocalData>::Acquire`  (modified)

```diff
--- wil::details_abi::ProcessLocalStorageData<wil::details_abi::ProcessLocalData>::Acquire
+++ wil::details::`dynamic_initializer_for_'g_header_init_WilInitialize_ResultMacros_DesktopOrSystem''
@@ -1,94 +1,15 @@
 

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

-/* public: static long __cdecl wil::details_abi::ProcessLocalStorageData<struct

-   wil::details_abi::ProcessLocalData>::Acquire(char const * __ptr64,class

-   wil::details_abi::ProcessLocalStorageData<struct wil::details_abi::ProcessLocalData> * __ptr64 *

-   __ptr64) */

-

-long __cdecl

-wil::details_abi::ProcessLocalStorageData<wil::details_abi::ProcessLocalData>::Acquire

-          (char *param_1,

-          ProcessLocalStorageData<struct_wil::details_abi::ProcessLocalData> **param_2)

+void wil::details::

+     _dynamic_initializer_for__g_header_init_WilInitialize_ResultMacros_DesktopOrSystem__(void)

 

 {

-  DWORD DVar1;

-  long lVar2;

-  HANDLE pvVar3;

-  uint uVar4;

-  ulong uVar5;

-  int iVar6;

-  void *unaff_retaddr;

-  undefined1 auStack_278 [32];

-  undefined4 local_258;

-  char *local_250;

-  longlong local_248;

-  unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::ReleaseMutex(void*___ptr64),wistd::integral_constant<unsigned___int64,2>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-  local_240 [8];

-  ProcessLocalStorageData<struct_wil::details_abi::ProcessLocalData> *local_238 [2];

-  WCHAR local_228 [264];

-  ulonglong local_18;

-  

-  local_18 = __security_cookie ^ (ulonglong)auStack_278;

-  *param_2 = (ProcessLocalStorageData<struct_wil::details_abi::ProcessLocalData> *)0x0;

-  DVar1 = GetCurrentProcessId();

-  local_258 = 0x78;

-  local_250 = param_1;

-  StringCchPrintfW((ushort *)local_228,0x104,(ushort *)L"Local\\SM0:%lu:%lu:%hs",(ulonglong)DVar1);

-  local_248 = 0;

-  iVar6 = 0x1f0001;

-  uVar5 = 0;

-  pvVar3 = CreateMutexExW((LPSECURITY_ATTRIBUTES)0x0,local_228,0,0x1f0001);

-  details::

-  unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-  ::reset((unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-           *)&local_248,pvVar3);

-  if (local_248 == 0) {

-    lVar2 = details::GetLastErrorFailHr();

-    goto LAB_0;

-  }

-  mutex_t<wil::details::unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>,wil::err_returncode_policy>

-  ::acquire((mutex_t<wil::details::unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>,wil::err_returncode_policy>

-             *)&local_248,(ulong *)local_240,uVar5,iVar6);

-  local_238[0] = (ProcessLocalStorageData<struct_wil::details_abi::ProcessLocalData> *)0x0;

-  lVar2 = SemaphoreValue::TryGetPointer((ushort *)local_228,local_238);

-  if (lVar2 < 0) {

-    uVar4 = 299;

-LAB_1:

-    details::in1diag3::Return_Hr(unaff_retaddr,uVar4,"wil",lVar2);

-    details::

-    unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::ReleaseMutex(void*___ptr64),wistd::integral_constant<unsigned___int64,2>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-    ::

-    ~unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::ReleaseMutex(void*___ptr64),wistd::integral_constant<unsigned___int64,2>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-              (local_240);

-  }

-  else {

-    if (local_238[0] == (ProcessLocalStorageData<struct_wil::details_abi::ProcessLocalData> *)0x0) {

-      lVar2 = MakeAndInitialize((ushort *)local_228,

-                                (unique_any_t<wil::mutex_t<wil::details::unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>,wil::err_returncode_policy>_>

-                                 *)&local_248,param_2);

-      if (lVar2 < 0) {

-        uVar4 = 0x134;

-        goto LAB_1;

-      }

-    }

-    else {

-      *param_2 = local_238[0];

-      *(int *)*param_2 = *(int *)local_238[0] + 1;

-    }

-    details::

-    unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::ReleaseMutex(void*___ptr64),wistd::integral_constant<unsigned___int64,2>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-    ::

-    ~unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::ReleaseMutex(void*___ptr64),wistd::integral_constant<unsigned___int64,2>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-              (local_240);

-    lVar2 = 0;

-  }

-LAB_0:

-  details::

-  unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-  ::

-  ~unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-            ((unique_storage<wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>

-              *)&local_248);

-  return lVar2;

+  g_pfnGetModuleName = GetCurrentModuleName;

+  g_pfnDebugBreak = DebugBreak;

+  g_pfnRaiseFailFastException = WilDynamicLoadRaiseFailFastException;

+  g_pfnFormatNtStatusMsg = FormatNtStatusMsg;

+  g_pfnNotifyFailure = MicrosoftInternalNotifyFailure;

+  g_pfnRtlNtStatusToDosErrorNoTeb = RtlNtStatusToDosErrorNoTeb;

+  g_pfnDllShutdownInProgress = RtlDllShutdownInProgress;

+  return;

 }
```
