# CVE-2026-61920 — dnsapi.dll patch diff

`dnsapi.dll` 10.0.26100.8875 -> 10.0.26100.9168 (ghidriff).

## `DnsValidateServer_A`  (modified)

```diff
--- DnsValidateServer_A
+++ DnsValidateServer_A
@@ -1,11 +1,101 @@
 

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

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

 

 ulonglong DnsValidateServer_A(short *param_1,LPCWSTR param_2,int param_3)

 

 {

-  ulonglong in_RAX;

+  bool bVar1;

+  uint uVar2;

+  _CERT_EXTENSION *p_Var3;

+  ulonglong uVar4;

+  undefined4 uVar5;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_168 [32];

+  uint local_138 [2];

+  undefined8 local_130;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  undefined8 local_d8 [2];

+  uint *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  return in_RAX;

+                    /* 0x94a20  248  DnsValidateServer_A */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

+  p_Var3 = (_CERT_EXTENSION *)0x0;

+  if (DAT_1 != 0) {

+    memset(local_b8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_fc = 0;

+        local_108 = &local_130;

+        local_ec = 0;

+        local_dc = 0;

+        uVar5 = 8;

+        local_130 = 1;

+        local_f8 = "DnsValidateServer_A";

+        local_e8 = "FALSE";

+        local_100 = 8;

+        local_f0 = 0x14;

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_bc = 0;

+        local_c8 = local_138;

+        local_138[0] = 0x1000000;

+        local_138[1] = 0;

+        local_c0 = uVar5;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_128);

+      }

+    }

+  }

+  if (param_2 != (LPCWSTR)0x0) {

+    uVar4 = 0xffffffffffffffff;

+    do {

+      uVar4 = uVar4 + 1;

+    } while (*(char *)((longlong)param_2 + uVar4) != '\0');

+    if (0xff < (uint)uVar4) {

+      return 0x7b;

+    }

+    uVar2 = (uint)uVar4 * 2 + 2;

+    local_138[0] = uVar2;

+    p_Var3 = FUN_18008a630((ulonglong)uVar2);

+    if (p_Var3 == (_CERT_EXTENSION *)0x0) {

+      return 0xe;

+    }

+    uVar2 = FUN_18002c5e0((LPWSTR)p_Var3,local_138,param_2,uVar4 & 0xffffffff,3,1);

+    if (uVar2 == 0) {

+      uVar4 = 0x7b;

+      goto LAB_7;

+    }

+  }

+  uVar4 = DnsValidateServer_W(param_1,p_Var3,param_3);

+  uVar4 = uVar4 & 0xffffffff;

+  if (p_Var3 == (_CERT_EXTENSION *)0x0) {

+    return uVar4;

+  }

+LAB_7:

+  DnsApiFree(p_Var3);

+  return uVar4;

 }
```

## `DnsStringCopyAllocateEx`  (modified)

```diff
--- DnsStringCopyAllocateEx
+++ DnsStringCopyAllocateEx
@@ -1,40 +1,74 @@
 

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

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

 

 LPVOID DnsStringCopyAllocateEx(longlong param_1,ulonglong param_2,int param_3,int param_4)

 

 {

-  uint in_EAX;

-  longlong unaff_RBP;

-  undefined4 uVar1;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  bool bVar1;

+  LPVOID pvVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  if ((in_EAX & (uint)param_2) == DAT_0) {

-    uStack000000000000006c = 0;

-    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-    uStack000000000000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    uVar1 = 8;

-    uStack0000000000000030 = 1;

-    pcStack0000000000000070 = "DnsAddrArrayCreate";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    uStack0000000000000068 = 8;

-    uStack0000000000000078 = 0x13;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

-    uStack0000000000000038 = 0x1000000;

-    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+                    /* 0x69470  230  DnsStringCopyAllocateEx */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    pvVar2 = FUN_18002ca60(param_1,param_2,2 - (uint)(param_3 != 0),2 - (uint)(param_4 != 0));

   }

-  return (LPVOID)0x0;

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsStringCopyAllocateEx";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x18;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    pvVar2 = (LPVOID)0x0;

+  }

+  return pvVar2;

 }
```

## `Dns_InitializeMsgRemoteSockaddr`  (modified)

```diff
--- Dns_InitializeMsgRemoteSockaddr
+++ Dns_InitializeMsgRemoteSockaddr
@@ -1,60 +1,75 @@
 

-/* WARNING: Instruction at (ram,0x000180095b31) overlaps instruction at (ram,0x000180095b30)

-    */

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

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

 

 void Dns_InitializeMsgRemoteSockaddr(longlong param_1,undefined4 param_2)

 

 {

-  uint uVar1;

-  undefined4 in_register_00000014;

-  undefined8 *puVar2;

-  undefined8 *unaff_RBX;

-  undefined8 *puVar3;

-  longlong unaff_RSI;

-  undefined8 unaff_RDI;

-  short unaff_R14W;

-  undefined8 in_stack_00000030;

-  undefined8 *in_stack_00000038;

-  undefined8 in_stack_00000040;

-  undefined8 *in_stack_00000048;

-  undefined8 in_stack_00000050;

-  undefined8 *in_stack_00000058;

-  undefined8 in_stack_00000060;

-  undefined8 *in_stack_00000068;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_188 [32];

+  undefined8 local_158;

+  undefined8 local_150;

+  undefined8 local_148 [8];

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  puVar2 = (undefined8 *)CONCAT44(in_register_00000014,param_2);

-  do {

-    puVar3 = unaff_RBX;

-    *in_stack_00000058 = puVar3;

-    while( true ) {

-      while( true ) {

-        unaff_RBX = puVar2;

-        if (unaff_RBX == (undefined8 *)0x0) {

-          *(undefined8 *)(unaff_RSI + 0x48) = in_stack_00000030;

-          *(undefined8 *)(unaff_RSI + 0x50) = in_stack_00000040;

-          *(undefined8 *)(unaff_RSI + 0x58) = in_stack_00000060;

-          *(undefined8 *)(unaff_RSI + 0x60) = in_stack_00000050;

-          return;

-        }

-        puVar2 = (undefined8 *)*unaff_RBX;

-        uVar1 = *(uint *)((longlong)unaff_RBX + 0x14) & 3;

-        *unaff_RBX = unaff_RDI;

-        if (1 < uVar1) break;

-        if ((*(short *)(unaff_RBX + 2) == (short)param_1) && (unaff_R14W != (short)param_1)) {

-          *in_stack_00000048 = unaff_RBX;

-          in_stack_00000048 = unaff_RBX;

-        }

-        else {

-          *in_stack_00000038 = unaff_RBX;

-          in_stack_00000038 = unaff_RBX;

-        }

+                    /* 0x9b840  277  Dns_InitializeMsgRemoteSockaddr */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_188;

+  memset(local_148,0,0x40);

+  if (DAT_1 == 0) {

+    FUN_180018a6c((undefined2 *)local_148,param_2,0);

+    FUN_180052ee8(param_1,local_148);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

       }

-      in_stack_00000058 = puVar3;

-      if (uVar1 == 3) break;

-      *in_stack_00000068 = unaff_RBX;

-      in_stack_00000068 = unaff_RBX;

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_158;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_158 = 1;

+        local_d8 = "Dns_InitializeMsgRemoteSockaddr";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x20;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_150;

+        local_150 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

     }

-  } while( true );

+  }

+  return;

 }
```

## `Dns_AnsiToUtf8`  (modified)

```diff
--- Dns_AnsiToUtf8
+++ Dns_AnsiToUtf8
@@ -1,16 +1,13 @@
 

-undefined8 Dns_AnsiToUtf8(byte *param_1,uint param_2,void *param_3,uint param_4)

+/* Library Function - Single Match

+    Dns_AnsiToUtf8

+   

+   Libraries: Visual Studio 2017 Release, Visual Studio 2019 Release */

+

+void Dns_AnsiToUtf8(byte *param_1,uint param_2,void *param_3,uint param_4)

 

 {

-  longlong in_RAX;

-  LPVOID unaff_RBX;

-  longlong unaff_RBP;

-  

-  out(0xf5,(int)in_RAX);

-  *(int *)(in_RAX + -0x7b) = *(int *)(in_RAX + -0x7b) + -1;

-  *(undefined1 *)(unaff_RBP + 0xb) = 0;

-  DnsApiFree((LPVOID)(ulonglong)*(uint *)((longlong)unaff_RBX + 0x20));

-  DnsApiFree(unaff_RBX);

-  return 0;

+  FUN_1800dfd6c(param_3,param_4,param_1,(ulonglong)param_2,3,2);

+  return;

 }
```

## `DnsSetQueryRetryTimeouts`  (modified)

```diff
--- DnsSetQueryRetryTimeouts
+++ DnsSetQueryRetryTimeouts
@@ -1,32 +1,127 @@
 

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

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

 

 ulonglong DnsSetQueryRetryTimeouts(uint *param_1,uint param_2,uint *param_3)

 

 {

-  uint uVar1;

-  ulonglong in_RAX;

-  undefined4 in_register_00000014;

-  uint unaff_EBX;

-  LPVOID unaff_RSI;

-  LPCWSTR unaff_RDI;

-  ulonglong uVar2;

-  int in_stack_00000028;

+  bool bVar1;

+  int iVar2;

+  ulonglong uVar3;

+  ulonglong uVar4;

+  BYTE *pBVar5;

+  BYTE *lpData;

+  longlong lVar6;

+  undefined4 uVar7;

+  uint uVar8;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_188 [32];

+  HKEY local_158;

+  undefined8 local_150;

+  undefined8 local_148 [2];

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined4 local_110;

+  undefined4 local_10c;

+  char *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  short local_c8 [64];

+  ulonglong local_48;

   

-  uVar1 = FUN_18002c5e0((LPWSTR)(in_RAX & 0xffffffffffffff30),

-                        (uint *)CONCAT44(in_register_00000014,param_2),unaff_RDI,

-                        (ulonglong)unaff_EBX,3,in_stack_00000028);

-  if (uVar1 == 0) {

-    uVar2 = 0x7b;

+                    /* 0x99f80  222  DnsSetQueryRetryTimeouts */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_188;

+  lpData = (BYTE *)0x0;

+  local_158 = (HKEY)0x0;

+  if (DAT_1 == 0) {

+    if ((param_2 == 0) || (param_3 == (uint *)0x0)) {

+      uVar3 = 0x57;

+    }

+    else {

+      uVar4 = FUN_180069150(param_1,1,&local_158);

+      uVar3 = uVar4 & 0xffffffff;

+      lpData = (BYTE *)0x0;

+      if ((int)uVar4 == 0) {

+        lVar6 = (ulonglong)param_2 * 0xb + 1;

+        lpData = FUN_18008a630((ulonglong)(uint)((int)lVar6 * 2));

+        if (lpData == (BYTE *)0x0) {

+          uVar3 = 0xe;

+        }

+        else {

+          uVar8 = 0;

+          pBVar5 = lpData;

+          if (param_2 != 0) {

+            do {

+              iVar2 = FUN_18008bf5c(pBVar5,lVar6,&DAT_2,(ulonglong)*param_3);

+              if (iVar2 < 1) {

+                uVar3 = 0xd;

+                goto LAB_3;

+              }

+              uVar8 = uVar8 + 1;

+              param_3 = param_3 + 1;

+              lVar6 = lVar6 - (iVar2 + 1);

+              pBVar5 = pBVar5 + (longlong)(iVar2 + 1) * 2;

+            } while (uVar8 < param_2);

+          }

+          if (lVar6 == 0) {

+            uVar3 = 0x50c;

+          }

+          else {

+            uVar8 = RegSetValueExW(local_158,L"DNSQueryTimeoutsMB",0,7,lpData,

+                                   (int)((longlong)(pBVar5 + (2 - (longlong)lpData)) >> 1) * 2);

+            uVar3 = (ulonglong)uVar8;

+          }

+        }

+      }

+    }

+LAB_3:

+    DnsApiFree(lpData);

+    if (local_158 != (HKEY)0x0) {

+      RegCloseKey(local_158);

+    }

   }

   else {

-    uVar1 = func_0x000180094900();

-    uVar2 = (ulonglong)uVar1;

-    if (unaff_RSI == (LPVOID)0x0) {

-      return uVar2;

+    memset(local_c8,0,0x80);

+    if (DAT_4 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

     }

+    if (5 < DAT_5) {

+      if (((_DAT_6 & 0x400000000000) == 0) ||

+         ((DAT_7 & 0x400000000000) != DAT_7)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_10c = 0;

+        local_118 = &local_150;

+        local_fc = 0;

+        local_ec = 0;

+        uVar7 = 8;

+        local_150 = 1;

+        local_108 = "DnsSetQueryRetryTimeouts";

+        local_f8 = "FALSE";

+        local_110 = 8;

+        local_100 = 0x19;

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_cc = 0;

+        local_d8 = local_148;

+        local_148[0] = 0x1000000;

+        local_d0 = uVar7;

+        FUN_1800e3690(0x180135218,&DAT_8,0,7,local_138);

+      }

+    }

+    uVar3 = 0x78;

   }

-  DnsApiFree(unaff_RSI);

-  return uVar2;

+  return uVar3;

 }
```

## `Dns_AddRecordsToMessage`  (modified)

```diff
--- Dns_AddRecordsToMessage
+++ Dns_AddRecordsToMessage
@@ -1,55 +1,74 @@
 

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

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

 

 DWORD Dns_AddRecordsToMessage(longlong param_1,undefined8 *param_2,int param_3)

 

 {

   bool bVar1;

-  longlong unaff_RBP;

-  undefined4 in_register_00000084;

-  undefined4 uVar2;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  DWORD DVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  memset((void *)param_1,(int)param_2,CONCAT44(in_register_00000084,param_3));

-  if (DAT_0 != 0) {

-    FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40);

+                    /* 0x695f0  259  Dns_AddRecordsToMessage */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    DVar2 = FUN_1800d2aac(param_1,param_2,param_3);

   }

-  if (5 < DAT_1) {

-    if (((_DAT_2 & 0x400000000000) == 0) ||

-       ((DAT_3 & 0x400000000000) != DAT_3)) {

-      bVar1 = false;

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    else {

-      bVar1 = true;

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_AddRecordsToMessage";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x18;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

     }

-    if (bVar1) {

-      uStack000000000000006c = 0;

-      puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-      uStack000000000000007c = 0;

-      *(undefined4 *)(unaff_RBP + -0x74) = 0;

-      uVar2 = 8;

-      uStack0000000000000030 = 1;

-      pcStack0000000000000070 = "DnsAddrBuildFromDnsRecord";

-      *(char **)(unaff_RBP + -0x80) = "FALSE";

-      uStack0000000000000068 = 8;

-      uStack0000000000000078 = 0x1a;

-      *(undefined4 *)(unaff_RBP + -0x78) = 6;

-      FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-      *(undefined4 *)(unaff_RBP + -0x54) = 0;

-      *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-      *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

-      uStack0000000000000038 = 0x1000000;

-      FUN_1800e3690(0x180135218,&DAT_4,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-    }

+    DVar2 = 0x78;

   }

-  return 0;

+  return DVar2;

 }
```

## `DnsNameCopy`  (modified)

```diff
--- DnsNameCopy
+++ DnsNameCopy
@@ -1,27 +1,75 @@
 

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

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

 

 uint DnsNameCopy(LPWSTR param_1,uint *param_2,LPCWSTR param_3,ulonglong param_4,int param_5,

                 int param_6)

 

 {

-  longlong unaff_RBP;

-  undefined4 uVar1;

-  undefined8 uStack0000000000000038;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack0000000000000078;

+  bool bVar1;

+  uint uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  uVar1 = (undefined4)param_4;

-  *(char **)(unaff_RBP + -0x80) = "FALSE";

-  uStack0000000000000078 = 0x14;

-  *(undefined4 *)(unaff_RBP + -0x78) = 6;

-  uStack0000000000000068 = uVar1;

-  FUN_180055600((undefined8 *)param_1,(undefined *)param_2);

-  *(undefined4 *)(unaff_RBP + -0x54) = 0;

-  *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-  *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

-  uStack0000000000000038 = 0x1000000;

-  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  return 0;

+                    /* 0x69300  163  DnsNameCopy */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_18002c5e0(param_1,param_2,param_3,param_4,param_5,param_6);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsNameCopy";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0xc;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0x78;

+  }

+  return uVar2;

 }
```

## `NetInfo_UpdateDnsInterfaceConfigChange`  (modified)

```diff
--- NetInfo_UpdateDnsInterfaceConfigChange
+++ NetInfo_UpdateDnsInterfaceConfigChange
@@ -1,80 +1,91 @@
 

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

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

 

 undefined4 NetInfo_UpdateDnsInterfaceConfigChange(longlong param_1)

 

 {

-  uint uVar1;

-  uint extraout_EAX;

-  undefined8 uVar2;

-  longlong *plVar3;

-  longlong *unaff_RBX;

-  longlong unaff_RBP;

-  uint unaff_ESI;

-  uint *unaff_RDI;

-  short unaff_R12W;

-  longlong unaff_R13;

-  undefined8 *unaff_R14;

-  undefined1 in_ZF;

+  bool bVar1;

+  int iVar2;

+  undefined4 uVar3;

+  undefined8 uVar4;

+  undefined4 uVar5;

+  uint uVar6;

+  ulonglong uVar7;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_158 [32];

+  undefined8 local_128;

+  undefined8 local_120;

+  _EVENT_DATA_DESCRIPTOR local_118 [2];

+  undefined8 *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  undefined8 local_c8 [2];

+  undefined8 *local_b8;

+  undefined4 local_b0;

+  undefined4 local_ac;

+  short local_a8 [64];

+  ulonglong local_28;

   

-code_r0x00018006cc92:

-  if ((!(bool)in_ZF) || ((*(uint *)((longlong)unaff_RBX + 0x14) & 0x800) != 0)) goto LAB_0;

-  *(longlong *)(unaff_RBP + -0x18) = param_1;

-  if (DAT_1 == 0) {

-    unaff_RBX = (longlong *)

-                FUN_180092c9c((_CERT_EXTENSION *)unaff_RBX[4],0x1c,(LPSTR)0x6008,unaff_R13,

-                              (undefined8 *)(unaff_RBP + -0x18));

-    uVar1 = extraout_EAX;

-  }

-  else {

-    uVar1 = FUN_1800a5270(unaff_RBX[4],0x1c,0x6008,unaff_R13,(undefined8 *)(unaff_RBP + -0x18));

-  }

-  if (uVar1 == 0) {

-    plVar3 = (longlong *)0x0;

-    if (*(undefined8 **)(unaff_RBP + -0x18) != (undefined8 *)0x0) {

-      uVar1 = unaff_RDI[1];

-      uVar2 = FUN_18000f8f4(unaff_RDI,*(undefined8 **)(unaff_RBP + -0x18),(PCNZWCH)unaff_RBX[4],

-                            *(int *)(unaff_RBP + -0x30),*(int *)(unaff_RBP + -0x2c));

-      if ((int)uVar2 != 0) {

-        if ((int)uVar2 != 0xea) goto LAB_2;

-        FUN_18002a140(*(longlong **)(unaff_RBP + -0x18));

-LAB_3:

-        FUN_18008ab7c((longlong)unaff_RDI);

-        if (unaff_R14 == (undefined8 *)0x0) {

-          if (*(longlong **)(unaff_RBP + -0x20) != (longlong *)0x0) {

-            FUN_18002a140(*(longlong **)(unaff_RBP + -0x20));

-          }

+                    /* 0x6f210  325  NetInfo_UpdateDnsInterfaceConfigChange */

+  local_28 = DAT_0 ^ (ulonglong)auStackY_158;

+  uVar5 = 0;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    uVar3 = uVar5;

+    if ((param_1 != 0) && (uVar7 = 0, uVar3 = 0, *(int *)(param_1 + 0x44) != 0)) {

+      do {

+        uVar4 = FUN_18001a5a8((longlong *)(uVar7 * 0xa0 + 0x68 + param_1));

+        if ((int)uVar4 != 0) {

+          uVar5 = 1;

         }

-        else {

-          *unaff_R14 = *(undefined8 *)(unaff_RBP + -0x20);

-          *(undefined8 *)(unaff_RBP + -0x20) = 0;

-        }

-        if ((DAT_4 & 8) != 0) {

-          FUN_1800f7614(0x40b,0x35,0x180111c20);

-        }

-        return (int)unaff_RDI;

-      }

-      unaff_ESI = unaff_ESI + 1;

-      thunk_FUN_18008ac4b((longlong)unaff_RDI,uVar1,unaff_RBX[4]);

-      goto LAB_2;

+        uVar6 = (int)uVar7 + 1;

+        uVar7 = (ulonglong)uVar6;

+        uVar3 = uVar5;

+      } while (uVar6 < *(uint *)(param_1 + 0x44));

     }

   }

   else {

-LAB_2:

-    plVar3 = *(longlong **)(unaff_RBP + -0x18);

+    memset(local_a8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_ec = 0;

+        local_f8 = &local_128;

+        local_dc = 0;

+        local_cc = 0;

+        uVar5 = 8;

+        local_128 = 1;

+        local_e8 = "NetInfo_UpdateDnsInterfaceConfigChange";

+        local_d8 = "FALSE";

+        local_f0 = 8;

+        local_e0 = 0x27;

+        local_d0 = 6;

+        FUN_180055600(local_c8,(undefined *)local_a8);

+        local_ac = 0;

+        local_b8 = &local_120;

+        local_120 = 0x1000000;

+        local_b0 = uVar5;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_118);

+      }

+    }

+    uVar3 = 0;

   }

-  FUN_18002a140(plVar3);

-  param_1 = 0;

-LAB_0:

-  if (1 < unaff_ESI) {

-    if ((DAT_4 & 0x20) != 0) {

-      FUN_1800f7614(0x40d,0x34,0x180111c20);

-    }

-    goto LAB_3;

-  }

-  unaff_RBX = (longlong *)*unaff_RBX;

-  if (unaff_RBX == (longlong *)0x0) goto LAB_3;

-  in_ZF = *(short *)(unaff_RBX + 2) == unaff_R12W;

-  goto code_r0x00018006cc92;

+  return uVar3;

 }
```

## `DnsConnectionGetHandleForHostUrlPrivate`  (modified)

```diff
--- DnsConnectionGetHandleForHostUrlPrivate
+++ DnsConnectionGetHandleForHostUrlPrivate
@@ -1,20 +1,70 @@
 

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

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

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

 

 void DnsConnectionGetHandleForHostUrlPrivate

-               (_GUID *param_1,ushort *param_2,_GUID *param_3,_GUID *param_4,ulong *param_5,

-               void **param_6)

+               (wchar_t *param_1,undefined *param_2,undefined8 *param_3,DWORD param_4,uint *param_5,

+               undefined8 *param_6)

 

 {

-  char *pcVar1;

-  int in_EAX;

-  undefined4 in_register_00000004;

+  int iVar1;

+  uint uVar2;

+  ulonglong uVar3;

+  wchar_t *pwVar4;

+  wchar_t *pwVar5;

+  wchar_t *unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_100;

+  wchar_t *local_f8;

+  char *local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  wchar_t local_d8 [64];

+  ulonglong local_58;

   

-  *(int *)CONCAT44(in_register_00000004,in_EAX) =

-       *(int *)CONCAT44(in_register_00000004,in_EAX) + in_EAX;

-  pcVar1 = (char *)(CONCAT44(in_register_00000004,in_EAX) + -0x7b);

-  *pcVar1 = *pcVar1 + (char)param_1;

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

-  halt_baddata();

+                    /* 0x47090  50  DnsConnectionGetHandleForHostUrlPrivate */

+  local_58 = DAT_0 ^ (ulonglong)auStackY_148;

+  pwVar4 = param_1;

+  if ((DAT_1 & 8) != 0) {

+    pwVar4 = (wchar_t *)0x40b;

+    FUN_1800f5ba4(0x40b,0x14,0x180114238,param_1,(longlong)param_2);

+  }

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (pwVar4 = unaff_retaddr, iVar1 = FUN_1800ca394((LPCSTR)unaff_retaddr), iVar1 != 0)) {

+    uVar2 = FUN_1800054c0();

+    if (0 < (int)uVar2) {

+      uVar2 = uVar2 & 0xffff | 0x80070000;

+    }

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

+      uVar3 = FUN_1800063f8(pwVar4,param_1,param_2,param_3,param_4,param_5,param_6);

+      uVar2 = (uint)uVar3;

+    }

+  }

+  else {

+    pwVar4 = local_d8;

+    pwVar5 = (wchar_t *)0x80;

+    memset(pwVar4,0,0x80);

+    if (DAT_3 != 0) {

+      pwVar5 = local_d8;

+      FUN_1800ca1b8((LPCSTR)unaff_retaddr,0,pwVar5,0x40);

+      pwVar4 = unaff_retaddr;

+    }

+    if (((5 < DAT_4) && ((_DAT_180135228 & 0x400000000000) != 0)) &&

+       ((DAT_5 & 0x400000000000) == DAT_5)) {

+      local_f8 = local_d8;

+      local_100 = 0x1000000;

+      local_e0 = 1;

+      local_f0 = "FALSE";

+      local_e8 = "DnsConnectionGetHandleForHostUrlPrivate";

+      FUN_18000103c(pwVar4,&DAT_6,pwVar5,&local_e0,&local_e8,&local_f0,&local_f8,&local_100)

+      ;

+    }

+    uVar2 = 0x80070078;

+  }

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x15,0x180114238,uVar2);

+  }

+  FUN_18001aa00(uVar2);

+  return;

 }
```

## `Dns_PingAdapterServers`  (modified)

```diff
--- Dns_PingAdapterServers
+++ Dns_PingAdapterServers
@@ -1,36 +1,74 @@
 

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

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

 

 undefined8 Dns_PingAdapterServers(void)

 

 {

-  ulonglong in_RAX;

-  longlong unaff_RBP;

-  undefined4 uVar1;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  ulonglong uStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  bool bVar1;

+  undefined8 uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  uStack0000000000000060 = in_RAX & 0xffffffffffffff30;

-  uStack000000000000007c = 0;

-  *(undefined4 *)(unaff_RBP + -0x74) = 0;

-  uVar1 = 8;

-  uStack0000000000000030 = 1;

-  pcStack0000000000000070 = "DnsAllocateRecord";

-  *(char **)(unaff_RBP + -0x80) = "FALSE";

-  uStack0000000000000068 = 8;

-  uStack0000000000000078 = 0x12;

-  *(undefined4 *)(unaff_RBP + -0x78) = 6;

-  FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-  *(undefined4 *)(unaff_RBP + -0x54) = 0;

-  *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-  *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

-  uStack0000000000000038 = 0x1000000;

-  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  return 0;

+                    /* 0x9be40  282  Dns_PingAdapterServers */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = 1;

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_PingAdapterServers";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x17;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0;

+  }

+  return uVar2;

 }
```

## `Dns_SetRecordsSection`  (modified)

```diff
--- Dns_SetRecordsSection
+++ Dns_SetRecordsSection
@@ -1,66 +1,79 @@
 

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

-/* WARNING: Removing unreachable block (ram,0x000180068d4e) */

-/* WARNING: Restarted to delay deadcode elimination for space: register */

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

 

-ulonglong Dns_SetRecordsSection(longlong *param_1,ushort param_2)

+void Dns_SetRecordsSection(longlong *param_1,uint param_2)

 

 {

-  ulonglong uVar1;

-  undefined6 in_register_00000012;

-  undefined8 *puVar2;

-  CLIENT_CALL_RETURN CVar3;

-  longlong *plStack0000000000000040;

-  undefined8 *puStack0000000000000048;

-  undefined8 uStack0000000000000050;

-  longlong lStack0000000000000058;

-  undefined8 uStack0000000000000060;

-  ulonglong uStack0000000000000068;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  puVar2 = (undefined8 *)CONCAT62(in_register_00000012,param_2);

-  uStack0000000000000068 = DAT_0 ^ (ulonglong)&stack0x00000000;

-  uStack0000000000000050 = 0;

-  lStack0000000000000058 = 0;

-  uStack0000000000000060 = 0;

+                    /* 0x6a570  292  Dns_SetRecordsSection */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    plStack0000000000000040 = param_1;

-    puStack0000000000000048 = puVar2;

-    if ((DAT_2 & 8) != 0) {

-      FUN_1800e51ec(param_1,0xe,0x180111af8,param_1,puVar2);

+    if (param_1 != (longlong *)0x0) {

+      do {

+        *(uint *)((longlong)param_1 + 0x14) =

+             *(uint *)((longlong)param_1 + 0x14) ^

+             (param_2 & 0xffff ^ *(uint *)((longlong)param_1 + 0x14)) & 3;

+        param_1 = (longlong *)*param_1;

+      } while (param_1 != (longlong *)0x0);

     }

-    if (puVar2 == (undefined8 *)0x0) {

-      CVar3.Simple = 0x57;

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    else {

-      *puVar2 = 0;

-      uVar1 = FUN_18002ddc4(&stack0x00000058);

-      CVar3.Simple = uVar1 & 0xffffffff;

-      if ((int)uVar1 == 0) {

-        CVar3 = NdrClientCall3((MIDL_STUBLESS_PROXY_INFO *)&PTR_PTR_1800ff490,0,(void *)0x0,

-                               uStack0000000000000060,param_1);

-        if ((int)CVar3.Simple == 0) {

-          *puVar2 = uStack0000000000000050;

-        }

-        else if ((DAT_2 & 8) != 0) {

-          FUN_1800f658c(0x40b,0x10,0x180111af8,(int)CVar3.Simple);

-        }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

       }

-      else if ((DAT_2 & 8) != 0) {

-        FUN_1800f658c(0x40b,0xf,0x180111af8,(int)uVar1);

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_SetRecordsSection";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x16;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    FUN_18002dd44(&stack0x00000058);

-    if ((DAT_2 & 8) != 0) {

-      FUN_1800f892c(0x40b,0x11,0x180111af8,uStack0000000000000050);

-    }

-    uVar1 = CVar3.Simple & 0xffffffff;

   }

-  else {

-    if (puVar2 != (undefined8 *)0x0) {

-      *puVar2 = 0;

-    }

-    uVar1 = 0;

-  }

-  return uVar1;

+  return;

 }
```

## `Dns_InitializeMsgRemoteSockaddr`  (modified)

```diff
--- Dns_InitializeMsgRemoteSockaddr
+++ Dns_CreateSocketEx
@@ -1,75 +1,85 @@
 

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

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

 

-void Dns_InitializeMsgRemoteSockaddr(longlong param_1,undefined4 param_2)

+SOCKET Dns_CreateSocketEx(int param_1,int param_2,int param_3,short param_4,undefined4 param_5)

 

 {

   bool bVar1;

-  undefined4 uVar2;

+  SOCKET SVar2;

+  undefined2 *puVar3;

+  undefined4 uVar4;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_188 [32];

-  undefined8 local_158;

-  undefined8 local_150;

-  undefined8 local_148 [8];

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

+  undefined1 auStackY_1b8 [32];

+  undefined8 local_188;

+  undefined8 local_180;

+  undefined2 local_178 [32];

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined4 local_110;

+  undefined4 local_10c;

+  char *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  short local_c8 [64];

+  ulonglong local_48;

   

-                    /* 0x9b840  277  Dns_InitializeMsgRemoteSockaddr */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_188;

-  memset(local_148,0,0x40);

+                    /* 0x9b520  271  Dns_CreateSocketEx */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_1b8;

+  memset(local_178,0,0x40);

+  puVar3 = (undefined2 *)0x0;

   if (DAT_1 == 0) {

-    FUN_180018a6c((undefined2 *)local_148,param_2,0);

-    FUN_180052ee8(param_1,local_148);

+    if (param_3 != 0) {

+      puVar3 = local_178;

+      FUN_180018a6c(local_178,param_3,0);

+    }

+    SVar2 = Socket_Create(param_1,param_2,puVar3,param_4,param_5);

+    if (SVar2 == 0) {

+      SVar2 = 0xffffffffffffffff;

+    }

   }

   else {

-    memset(local_98,0,0x80);

+    memset(local_c8,0,0x80);

     if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_158;

+        local_10c = 0;

+        local_118 = &local_188;

+        local_fc = 0;

+        local_ec = 0;

+        uVar4 = 8;

+        local_188 = 1;

+        local_108 = "Dns_CreateSocketEx";

+        local_f8 = "FALSE";

+        local_110 = 8;

+        local_100 = 0x13;

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

         local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_158 = 1;

-        local_d8 = "Dns_InitializeMsgRemoteSockaddr";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x20;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_150;

-        local_150 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+        local_d8 = &local_180;

+        local_180 = 0x1000000;

+        local_d0 = uVar4;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_138);

       }

     }

+    SVar2 = 0xffffffffffffffff;

   }

-  return;

+  return SVar2;

 }
```

## `DnsValidateServerArray_A`  (modified)

```diff
--- DnsValidateServerArray_A
+++ DnsValidateServerArray_A
@@ -1,14 +1,101 @@
+

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

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

 

 ulonglong DnsValidateServerArray_A(longlong param_1,LPCWSTR param_2,int param_3)

 

 {

-  ulonglong uVar1;

-  undefined4 in_register_00000084;

+  bool bVar1;

+  uint uVar2;

+  _CERT_EXTENSION *p_Var3;

+  ulonglong uVar4;

+  undefined4 uVar5;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_168 [32];

+  uint local_138 [2];

+  undefined8 local_130;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  undefined8 local_d8 [2];

+  uint *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  uVar1 = FUN_1800f7614(0x40b,(ushort)param_2,CONCAT44(in_register_00000084,param_3));

-  if ((DAT_0 & 8) != 0) {

-    uVar1 = FUN_1800f7614(0x40b,0x36,0x180110270);

+                    /* 0x94700  245  DnsValidateServerArray_A */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

+  p_Var3 = (_CERT_EXTENSION *)0x0;

+  if (DAT_1 != 0) {

+    memset(local_b8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_fc = 0;

+        local_108 = &local_130;

+        local_ec = 0;

+        local_dc = 0;

+        uVar5 = 8;

+        local_130 = 1;

+        local_f8 = "DnsValidateServerArray_A";

+        local_e8 = "FALSE";

+        local_100 = 8;

+        local_f0 = 0x19;

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_bc = 0;

+        local_c8 = local_138;

+        local_138[0] = 0x1000000;

+        local_138[1] = 0;

+        local_c0 = uVar5;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_128);

+      }

+    }

   }

-  return uVar1;

+  if (param_2 != (LPCWSTR)0x0) {

+    uVar4 = 0xffffffffffffffff;

+    do {

+      uVar4 = uVar4 + 1;

+    } while (*(char *)((longlong)param_2 + uVar4) != '\0');

+    if (0xff < (uint)uVar4) {

+      return 0x7b;

+    }

+    uVar2 = (uint)uVar4 * 2 + 2;

+    local_138[0] = uVar2;

+    p_Var3 = FUN_18008a630((ulonglong)uVar2);

+    if (p_Var3 == (_CERT_EXTENSION *)0x0) {

+      return 0xe;

+    }

+    uVar2 = FUN_18002c5e0((LPWSTR)p_Var3,local_138,param_2,uVar4 & 0xffffffff,3,1);

+    if (uVar2 == 0) {

+      uVar4 = 0x7b;

+      goto LAB_7;

+    }

+  }

+  uVar4 = DnsValidateServerArray_W(param_1,p_Var3,param_3);

+  uVar4 = uVar4 & 0xffffffff;

+  if (p_Var3 == (_CERT_EXTENSION *)0x0) {

+    return uVar4;

+  }

+LAB_7:

+  DnsApiFree(p_Var3);

+  return uVar4;

 }
```

## `HostsFile_Open`  (modified)

```diff
--- HostsFile_Open
+++ HostsFile_Open
@@ -1,30 +1,74 @@
 

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

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

 

-undefined8 HostsFile_Open(longlong *param_1,undefined *param_2,undefined8 param_3,char *param_4)

+undefined8 HostsFile_Open(longlong *param_1,undefined8 param_2,undefined8 param_3,char *param_4)

 

 {

-  longlong unaff_RBP;

-  undefined4 uVar1;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined4 uStack0000000000000068;

-  undefined8 uStack0000000000000070;

-  undefined4 uStack0000000000000078;

+  bool bVar1;

+  undefined8 uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  uVar1 = SUB84(param_4,0);

-  uStack0000000000000030 = 1;

-  uStack0000000000000070 = 0x80111540;

-  *(char **)(unaff_RBP + -0x80) = "FALSE";

-  uStack0000000000000078 = 0x18;

-  *(undefined4 *)(unaff_RBP + -0x78) = 6;

-  uStack0000000000000068 = uVar1;

-  FUN_180055600(param_1,param_2);

-  *(undefined4 *)(unaff_RBP + -0x54) = 0;

-  *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-  *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

-  uStack0000000000000038 = 0x1000000;

-  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  return 0x78;

+                    /* 0x6b3e0  306  HostsFile_Open */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800dabf8(param_1,param_2,param_3,param_4);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "HostsFile_Open";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0xf;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0;

+  }

+  return uVar2;

 }
```

## `Dns_AllocateMsgBuf`  (modified)

```diff
--- Dns_AllocateMsgBuf
+++ DnsNameCopy
@@ -1,10 +1,27 @@
 

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

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

 

-LPVOID Dns_AllocateMsgBuf(ushort param_1)

+uint DnsNameCopy(LPWSTR param_1,uint *param_2,LPCWSTR param_3,ulonglong param_4,int param_5,

+                int param_6)

 

 {

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

-  halt_baddata();

+  longlong unaff_RBP;

+  undefined4 uVar1;

+  undefined8 uStack0000000000000038;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack0000000000000078;

+  

+  uVar1 = (undefined4)param_4;

+  *(char **)(unaff_RBP + -0x80) = "FALSE";

+  uStack0000000000000078 = 0x14;

+  *(undefined4 *)(unaff_RBP + -0x78) = 6;

+  uStack0000000000000068 = uVar1;

+  FUN_180055600((undefined8 *)param_1,(undefined *)param_2);

+  *(undefined4 *)(unaff_RBP + -0x54) = 0;

+  *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+  *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

+  uStack0000000000000038 = 0x1000000;

+  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+  return 0;

 }
```

## `DnsDhcpSrvRegisterHostAddr`  (modified)

```diff
--- DnsDhcpSrvRegisterHostAddr
+++ DnsDhcpSrvRegisterHostAddr
@@ -1,10 +1,93 @@
 

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

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

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

 

 ulonglong DnsDhcpSrvRegisterHostAddr(longlong param_1)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  ulonglong uVar2;

+  uint uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_158 [32];

+  undefined8 local_128;

+  undefined8 local_120;

+  _EVENT_DATA_DESCRIPTOR local_118;

+  undefined8 local_108;

+  undefined8 local_100;

+  undefined8 *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined8 uStack_e0;

+  char *local_d8;

+  undefined8 uStack_d0;

+  undefined8 local_c8;

+  undefined8 uStack_c0;

+  undefined8 *local_b8;

+  ulonglong uStack_b0;

+  undefined4 local_a8;

+  undefined4 local_a4;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

+  

+                    /* 0x971f0  72  DnsDhcpSrvRegisterHostAddr */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

+  if (DAT_1 == 0) {

+    memset(&local_118,0,0x80);

+    local_f8 = *(undefined8 **)(param_1 + 0x20);

+    local_e8 = *(char **)(param_1 + 0x30);

+    uStack_e0 = *(undefined8 *)(param_1 + 0x38);

+    local_a8 = 0;

+    local_d8 = *(char **)(param_1 + 0x40);

+    uStack_d0 = *(undefined8 *)(param_1 + 0x48);

+    local_a0 = 0;

+    local_a4 = 0;

+    local_f0 = *(undefined4 *)(param_1 + 0x28);

+    local_ec = *(undefined4 *)(param_1 + 0x2c);

+    local_108 = *(undefined8 *)(param_1 + 8);

+    local_100 = *(undefined8 *)(param_1 + 0x18);

+    local_c8 = *(undefined8 *)(param_1 + 0x50);

+    uStack_c0 = *(undefined8 *)(param_1 + 0x58);

+    local_118.Ptr._4_4_ = *(undefined4 *)(param_1 + 4);

+    local_b8 = *(undefined8 **)(param_1 + 0x60);

+    uStack_b0 = *(undefined8 *)(param_1 + 0x68);

+    local_118.Ptr._0_4_ = 0x80;

+    uVar2 = DnsDhcpSrvRegisterHostAddrEx((int *)&local_118);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_ec = 0;

+        local_f8 = &local_128;

+        uVar3 = 8;

+        local_128 = 1;

+        local_e8 = "DnsDhcpSrvRegisterHostAddr";

+        local_d8 = "FALSE";

+        local_f0 = 8;

+        uStack_e0 = 0x1b;

+        uStack_d0 = 6;

+        FUN_180055600(&local_c8,(undefined *)local_98);

+        local_b8 = &local_120;

+        uStack_b0 = (ulonglong)uVar3;

+        local_120 = 0x1000000;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,&local_118);

+      }

+    }

+    uVar2 = 0x78;

+  }

+  return uVar2;

 }
```

## `Socket_CreateMulticast`  (modified)

```diff
--- Socket_CreateMulticast
+++ Socket_CreateMulticast
@@ -1,18 +1,70 @@
 

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

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

 

 undefined8 Socket_CreateMulticast(void)

 

 {

-  ulonglong in_RAX;

-  byte *in_RDX;

-  longlong unaff_RBP;

-  undefined8 uStack0000000000000048;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *(char *)(in_RAX - 0x73) = *(char *)(in_RAX - 0x73) + (char)in_RAX;

-  uStack0000000000000048 = 0x1000000;

-  *(undefined4 *)(unaff_RBP + -0x48) = 8;

-  FUN_1800e3690(0x180135218,in_RDX,0,7,(PEVENT_DATA_DESCRIPTOR)(in_RAX & 0xffffffffffffff50));

-  return 0x78;

+                    /* 0x9d540  348  Socket_CreateMulticast */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Socket_CreateMulticast";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x17;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

+  SetLastError(0x267b);

+  return 0;

 }
```

## `Dns_SetRecordsScopeId`  (modified)

```diff
--- Dns_SetRecordsScopeId
+++ Dns_SetRecordsScopeId
@@ -1,47 +1,72 @@
 

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

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

 

-undefined8 Dns_SetRecordsScopeId(longlong param_1,int param_2,undefined8 *param_3)

+void Dns_SetRecordsScopeId(longlong param_1,int param_2,undefined8 *param_3)

 

 {

-  byte bVar1;

-  byte *pbVar2;

-  byte *in_RAX;

-  ulonglong uVar3;

-  longlong unaff_RBP;

-  byte in_R9B;

-  byte *in_R10;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  while (((char)param_3 == '\t' && ((byte)((char)param_2 + 0x8fU) < 3))) {

-    uVar3 = (ulonglong)in_R9B;

-    in_R9B = in_R9B + 1;

-    *(char *)(unaff_RBP + -0x73 + uVar3 * 0x10) = (char)param_2;

-    if (in_R10 <= in_RAX) break;

-    do {

-      pbVar2 = in_RAX;

-      in_RAX = pbVar2 + 1;

-    } while (*pbVar2 != 0);

-    bVar1 = pbVar2[1];

-    if (-1 < (char)bVar1) break;

-    param_3 = (undefined8 *)(ulonglong)(bVar1 & 0x7f);

-    in_RAX = pbVar2 + 3;

-    if (-1 < (char)pbVar2[2]) break;

-    bVar1 = *in_RAX;

-    while (param_2 = (int)bVar1, (char)bVar1 < '\0') {

-      if (bVar1 != 0x80) goto LAB_0;

-      pbVar2 = in_RAX + 1;

-      in_RAX = in_RAX + 1;

-      bVar1 = *pbVar2;

+                    /* 0x6a410  291  Dns_SetRecordsScopeId */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    FUN_1800d3cbc(param_1,param_2,param_3);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_SetRecordsScopeId";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x16;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

     }

   }

-LAB_0:

-  if (in_R9B == 0) {

-    EventWriteTransfer(DAT_1,(PCEVENT_DESCRIPTOR)&stack0x00000038,(LPCGUID)0x0,(LPCGUID)0x0,

-                       7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

-  }

-  else {

-    FUN_1800e3380(0x180135218,(undefined8 *)&stack0x00000038,7,(longlong)&stack0x00000060,in_R9B);

-  }

-  return 0x78;

+  return;

 }
```

## `DnsNameCompareEx_UTF8`  (modified)

```diff
--- DnsNameCompareEx_UTF8
+++ DnsNameCompareEx_UTF8
@@ -1,59 +1,73 @@
 

-/* WARNING: Instruction at (ram,0x00018008d362) overlaps instruction at (ram,0x00018008d360)

-    */

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

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

 

-void DnsNameCompareEx_UTF8(wchar_t *param_1,LPCWSTR param_2,longlong param_3)

+void DnsNameCompareEx_UTF8(wchar_t *param_1,LPCWSTR param_2,short *param_3)

 

 {

-  LPCWSTR pWVar1;

-  undefined8 uVar2;

-  longlong in_RAX;

-  int *piVar3;

-  uint *unaff_RDI;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *unaff_RDI = *unaff_RDI | 0x10;

-  piVar3 = (int *)CONCAT71((int7)((ulonglong)param_1 >> 8),(byte)param_1 + (char)*unaff_RDI);

-  *piVar3 = *piVar3 + (int)in_RAX + (uint)CARRY1((byte)param_1,(byte)*unaff_RDI);

-  while( true ) {

-    uVar2 = *(undefined8 *)(param_2 + 0xc);

-    *(undefined8 *)(piVar3 + 4) = *(undefined8 *)(param_2 + 8);

-    *(undefined8 *)(piVar3 + 6) = uVar2;

-    uVar2 = *(undefined8 *)(param_2 + 0x14);

-    *(undefined8 *)(piVar3 + 8) = *(undefined8 *)(param_2 + 0x10);

-    *(undefined8 *)(piVar3 + 10) = uVar2;

-    uVar2 = *(undefined8 *)(param_2 + 0x1c);

-    *(undefined8 *)(piVar3 + 0xc) = *(undefined8 *)(param_2 + 0x18);

-    *(undefined8 *)(piVar3 + 0xe) = uVar2;

-    uVar2 = *(undefined8 *)(param_2 + 0x24);

-    *(undefined8 *)(piVar3 + 0x10) = *(undefined8 *)(param_2 + 0x20);

-    *(undefined8 *)(piVar3 + 0x12) = uVar2;

-    uVar2 = *(undefined8 *)(param_2 + 0x2c);

-    *(undefined8 *)(piVar3 + 0x14) = *(undefined8 *)(param_2 + 0x28);

-    *(undefined8 *)(piVar3 + 0x16) = uVar2;

-    uVar2 = *(undefined8 *)(param_2 + 0x34);

-    *(undefined8 *)(piVar3 + 0x18) = *(undefined8 *)(param_2 + 0x30);

-    *(undefined8 *)(piVar3 + 0x1a) = uVar2;

-    piVar3 = (int *)((longlong)piVar3 + in_RAX);

-    pWVar1 = param_2 + 0x38;

-    uVar2 = *(undefined8 *)(param_2 + 0x3c);

-    param_2 = (LPCWSTR)((longlong)param_2 + in_RAX);

-    *(undefined8 *)(piVar3 + -4) = *(undefined8 *)pWVar1;

-    *(undefined8 *)(piVar3 + -2) = uVar2;

-    param_3 = param_3 + -1;

-    if (param_3 == 0) break;

-    uVar2 = *(undefined8 *)(param_2 + 4);

-    *(undefined8 *)piVar3 = *(undefined8 *)param_2;

-    *(undefined8 *)(piVar3 + 2) = uVar2;

+                    /* 0x913f0  158  DnsNameCompareEx_UTF8 */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    param_3 = (short *)0x80;

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      param_3 = local_98;

+      FUN_1800ca1b8(unaff_retaddr,0,param_3,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "DnsNameCompareEx_UTF8";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x16;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        param_3 = (short *)0x0;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

   }

-  uVar2 = *(undefined8 *)(param_2 + 4);

-  *(undefined8 *)piVar3 = *(undefined8 *)param_2;

-  *(undefined8 *)(piVar3 + 2) = uVar2;

-  uVar2 = *(undefined8 *)(param_2 + 0xc);

-  *(undefined8 *)(piVar3 + 4) = *(undefined8 *)(param_2 + 8);

-  *(undefined8 *)(piVar3 + 6) = uVar2;

-  *(undefined8 *)(piVar3 + 8) = *(undefined8 *)(param_2 + 0x10);

-  piVar3[10] = *(int *)(param_2 + 0x14);

-  NetInfo_Free((longlong *)unaff_RDI);

+  FUN_18002b810(param_1,param_2,param_3,2);

   return;

 }
```

## `DnsGetZtRules`  (modified)

```diff
--- DnsGetZtRules
+++ DnsGetZtConfig
@@ -1,12 +1,13 @@
 

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

 

-ulonglong DnsGetZtRules(int param_1,longlong param_2,uint param_3,undefined4 *param_4,

-                       undefined8 *param_5)

+ulonglong DnsGetZtConfig(int param_1,uint param_2,undefined8 *param_3)

 

 {

-  ulonglong in_RAX;

+  ulonglong unaff_RBX;

+  longlong unaff_RBP;

   

-  return in_RAX;

+  *(char *)(unaff_RBP + -0xf) = *(char *)(unaff_RBP + -0xf) << ((byte)param_1 & 0x1f);

+  return unaff_RBX;

 }
```

## `NetInfo_CreatePerNetworkNetinfo`  (modified)

```diff
--- NetInfo_CreatePerNetworkNetinfo
+++ NetInfo_CreatePerNetworkNetinfo
@@ -1,24 +1,211 @@
 

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

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

 

 longlong * NetInfo_CreatePerNetworkNetinfo(longlong *param_1,undefined8 *param_2,undefined *param_3)

 

 {

-  longlong *in_RAX;

-  undefined8 unaff_RBX;

-  undefined4 unaff_ESI;

-  undefined4 unaff_EDI;

-  undefined *unaff_R14;

-  bool in_ZF;

-  undefined4 in_stack_0000002c;

-  undefined4 uStack0000000000000038;

+  undefined8 uVar1;

+  longlong *plVar2;

+  bool bVar3;

+  int iVar4;

+  ulonglong uVar5;

+  undefined7 extraout_var;

+  undefined8 *puVar6;

+  longlong *plVar7;

+  longlong *plVar8;

+  longlong *plVar9;

+  longlong *plVar10;

+  uint uVar11;

+  longlong *plVar12;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_198 [32];

+  uint local_168;

+  longlong *local_160;

+  uint local_158;

+  longlong *local_150;

+  undefined8 *local_148;

+  longlong *local_140;

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  longlong **local_118;

+  undefined8 local_110;

+  char *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  undefined8 local_e8 [2];

+  undefined8 **local_d8;

+  undefined8 local_d0;

+  short local_c8 [64];

+  ulonglong local_48;

   

-  if (!in_ZF) {

-    uStack0000000000000038 = SUB84(param_1,0);

-    in_RAX = (longlong *)

-             FUN_1800f7628(param_1,0xe,param_3,unaff_EDI,unaff_R14,

-                           CONCAT44(in_stack_0000002c,unaff_ESI),unaff_RBX);

-  }

-  return in_RAX;

+                    /* 0x12e80  316  NetInfo_CreatePerNetworkNetinfo */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_198;

+  plVar9 = (longlong *)0x0;

+  plVar7 = (longlong *)0x0;

+  local_150 = (longlong *)0x0;

+  local_160 = (longlong *)0x0;

+  local_140 = (longlong *)0x0;

+  local_158 = 0;

+  plVar8 = (longlong *)0x0;

+  local_148 = param_2;

+  if ((DAT_1 & 8) != 0) {

+    param_3 = &DAT_2;

+    FUN_1800f9070(0x40b,0x45,0x18010f550,param_1,param_2);

+  }

+  if (((DAT_3 == 0) || (DAT_18013630c != 0)) ||

+     (iVar4 = FUN_1800ca394(unaff_retaddr), iVar4 != 0)) {

+    if (param_2 != (undefined8 *)0x0) {

+      *param_2 = 0;

+    }

+    plVar10 = plVar9;

+    if (param_1 != (longlong *)0x0) {

+      uVar5 = FUN_18004c7fc((longlong)param_1,&local_150,param_3);

+      plVar10 = (longlong *)(uVar5 & 0xffffffff);

+      if ((int)uVar5 == 0) {

+        plVar12 = local_150;

+        do {

+          plVar7 = (longlong *)0x0;

+          uVar5 = FUN_180015bb0(param_1,*(uint *)(plVar12 + 4),&local_160);

+          plVar2 = local_160;

+          plVar10 = (longlong *)(uVar5 & 0xffffffff);

+          plVar8 = plVar9;

+          param_2 = local_148;

+          if ((int)uVar5 != 0) {

+            plVar7 = plVar2;

+            if ((DAT_1 & 8) != 0) {

+              FUN_1800f658c(0x40b,0x47,0x18010f550,(int)uVar5);

+              plVar7 = local_160;

+              param_2 = local_148;

+            }

+            goto LAB_4;

+          }

+          *(uint *)(local_160 + 7) = *(uint *)(local_160 + 7) & 0xffffffb3;

+          if ((plVar9 == (longlong *)0x0) &&

+             ((plVar8 = local_160, (int)plVar12[4] == 0 || (plVar12[5] == 0)))) goto LAB_4;

+          plVar7 = plVar12 + 2;

+          uVar5 = 0;

+          local_168 = 0;

+          *(undefined4 *)(local_160 + 10) = *(undefined4 *)(plVar12[5] + 0x60);

+          *(undefined4 *)((longlong)local_160 + 0x4c) = *(undefined4 *)(plVar12[5] + 0x5c);

+          uVar1 = *(undefined8 *)(plVar12[5] + 0x6c);

+          *(undefined8 *)((longlong)local_160 + 0x54) = *(undefined8 *)(plVar12[5] + 100);

+          *(undefined8 *)((longlong)local_160 + 0x5c) = uVar1;

+          uVar11 = 1;

+          do {

+            puVar6 = (undefined8 *)plVar7[3];

+            if (puVar6 != (undefined8 *)0x0) {

+              bVar3 = FUN_18004cc08((longlong)puVar6);

+              iVar4 = (int)CONCAT71(extraout_var,bVar3);

+              if (iVar4 == 0) {

+                local_158 = 1;

+              }

+              local_160 = (longlong *)CONCAT44(local_160._4_4_,-(uint)(iVar4 != 0) & uVar11);

+              uVar5 = FUN_1800155b0(plVar2 + (uVar5 & 0xffffffff) * 0x14 + 0xd,puVar6);

+              plVar10 = (longlong *)(uVar5 & 0xffffffff);

+              if ((int)uVar5 != 0) {

+                plVar7 = plVar2;

+                plVar8 = plVar9;

+                param_2 = local_148;

+                if ((DAT_1 & 8) != 0) {

+                  FUN_1800f658c(0x40b,0x48,0x18010f550,(int)uVar5);

+                  param_2 = local_148;

+                }

+                goto LAB_4;

+              }

+              local_168 = local_168 + 1;

+              *(uint *)((longlong)plVar2 + 0x44) = local_168;

+              if ((*(byte *)(plVar7[3] + 0x44) & 4) != 0) {

+                if ((DAT_1 & 8) != 0) {

+                  FUN_1800f71b8(0x40b,(short)uVar5 + 0x49,0x18010f550,plVar2);

+                }

+                *(uint *)(plVar2 + 7) = *(uint *)(plVar2 + 7) | 4;

+              }

+              if ((*(byte *)(plVar7[3] + 0x44) & 0x40) != 0) {

+                if ((DAT_1 & 8) != 0) {

+                  FUN_1800f71b8(0x40b,0x4a,0x18010f550,plVar2);

+                }

+                *(uint *)(plVar2 + 7) = *(uint *)(plVar2 + 7) | 0x40;

+              }

+              if ((*(byte *)(plVar7[3] + 0x44) & 8) != 0) {

+                if ((DAT_1 & 8) != 0) {

+                  FUN_1800f71b8(0x40b,0x4b,0x18010f550,plVar2);

+                }

+                *(uint *)(plVar2 + 7) = *(uint *)(plVar2 + 7) | 8;

+              }

+              uVar5 = (ulonglong)local_168;

+              uVar11 = (uint)local_160;

+            }

+            plVar7 = (longlong *)*plVar7;

+          } while (plVar7 != plVar12 + 2);

+          if (uVar11 != 0) {

+            *(uint *)(plVar2 + 7) = *(uint *)(plVar2 + 7) | 0x2000000;

+          }

+          FUN_180055c48(&local_140,plVar2);

+          plVar12 = (longlong *)*plVar12;

+          local_160 = (longlong *)0x0;

+          plVar9 = local_140;

+        } while (plVar12 != local_150);

+        plVar7 = (longlong *)0x0;

+        plVar8 = local_140;

+        param_2 = local_148;

+        if (local_158 == 0) {

+          *(uint *)(param_1 + 7) = *(uint *)(param_1 + 7) | 0x2000000;

+        }

+      }

+      else if ((DAT_1 & 8) != 0) {

+        FUN_1800f658c(0x40b,0x46,0x18010f550,(int)uVar5);

+      }

+    }

+  }

+  else {

+    memset(local_c8,0,0x80);

+    if (DAT_5 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+    }

+    if (5 < DAT_6) {

+      if (((_DAT_7 & 0x400000000000) == 0) ||

+         (bVar3 = true, (DAT_8 & 0x400000000000) != DAT_8)) {

+        bVar3 = false;

+      }

+      if (bVar3) {

+        local_118 = &local_140;

+        local_140 = (longlong *)0x1;

+        local_110 = 8;

+        local_108 = "NetInfo_CreatePerNetworkNetinfo";

+        local_100 = 0x20;

+        local_f8 = "FALSE";

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_d8 = &local_148;

+        local_148 = (undefined8 *)0x1000000;

+        local_d0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_9,0,7,local_138);

+      }

+    }

+    plVar7 = plVar9;

+    plVar8 = plVar9;

+    plVar10 = (longlong *)0x78;

+  }

+LAB_4:

+  FUN_18004cb5c(local_150);

+  if ((int)plVar10 == 0) {

+    if (plVar8 == (longlong *)0x0) {

+      plVar10 = (longlong *)0x267c;

+    }

+    else {

+      *param_2 = plVar8;

+    }

+  }

+  else {

+    NetInfo_Free(plVar8);

+  }

+  if (plVar7 != (longlong *)0x0) {

+    NetInfo_Free(plVar7);

+  }

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x4c,0x18010f550,(int)plVar10);

+  }

+  return plVar10;

 }
```

## `Local_GetRecordsForLocalNameEx`  (modified)

```diff
--- Local_GetRecordsForLocalNameEx
+++ Local_GetRecordsForLocalNameEx
@@ -1,50 +1,90 @@
 

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

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

 

 uint Local_GetRecordsForLocalNameEx

                (longlong param_1,ushort param_2,PCNZWCH param_3,PCNZWCH param_4,uint param_5)

 

 {

-  byte bVar1;

-  byte *pbVar2;

-  byte *in_RAX;

-  byte bVar3;

-  longlong unaff_RBP;

-  byte bVar4;

-  byte *in_R10;

+  bool bVar1;

+  int iVar2;

+  uint uVar3;

+  undefined8 uVar4;

+  undefined4 uVar5;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_178 [32];

+  undefined8 local_148;

+  undefined8 local_140;

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined4 local_110;

+  undefined4 local_10c;

+  char *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  short local_c8 [64];

+  ulonglong local_48;

   

-  bVar3 = (byte)param_2;

-  while( true ) {

-    bVar4 = (char)param_4 + 1;

-    param_4 = (PCNZWCH)(ulonglong)bVar4;

-    *(byte *)(unaff_RBP + -0x73 + param_1 * 0x10) = bVar3;

-    if (in_R10 <= in_RAX) break;

-    do {

-      pbVar2 = in_RAX;

-      in_RAX = pbVar2 + 1;

-    } while (*pbVar2 != 0);

-    bVar1 = pbVar2[1];

-    if (-1 < (char)bVar1) break;

-    in_RAX = pbVar2 + 3;

-    if (-1 < (char)pbVar2[2]) break;

-    bVar3 = *in_RAX;

-    while ((char)bVar3 < '\0') {

-      if (bVar3 != 0x80) goto LAB_0;

-      pbVar2 = in_RAX + 1;

-      in_RAX = in_RAX + 1;

-      bVar3 = *pbVar2;

+                    /* 0x6cef0  310  Local_GetRecordsForLocalNameEx */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_178;

+  uVar3 = 0x232b;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    if (DAT_2 == 0) {

+      FUN_180074930();

     }

-    if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar3 + 0x8f))) break;

-    param_1 = (longlong)bVar4;

-  }

-LAB_0:

-  if (bVar4 == 0) {

-    EventWriteTransfer(DAT_1,(PCEVENT_DESCRIPTOR)&stack0x00000038,(LPCGUID)0x0,(LPCGUID)0x0,

-                       7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

+    if ((param_2 == 1) || (param_2 == 0x1c)) {

+      uVar3 = FUN_18002a910(param_1,(uint)param_2,param_3,param_4,param_5);

+    }

+    else if (param_2 == 0xc) {

+      uVar4 = FUN_18006d0f8(param_1,param_3,(longlong)param_4,(undefined *)(ulonglong)param_5);

+      uVar3 = (uint)uVar4;

+    }

+    *(undefined8 *)(param_1 + 0x3c0) = *(undefined8 *)(param_1 + 0x3f8);

+    *(uint *)(param_1 + 0x1fc) = uVar3;

   }

   else {

-    FUN_1800e3380(0x180135218,(undefined8 *)&stack0x00000038,7,(longlong)&stack0x00000060,bVar4);

+    memset(local_c8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_10c = 0;

+        local_118 = &local_148;

+        local_fc = 0;

+        local_ec = 0;

+        uVar5 = 8;

+        local_108 = "Local_GetRecordsForLocalNameEx";

+        local_148 = 1;

+        local_f8 = "FALSE";

+        local_110 = 8;

+        local_100 = 0x1f;

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_cc = 0;

+        local_d8 = &local_140;

+        local_140 = 0x1000000;

+        local_d0 = uVar5;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_138);

+      }

+    }

+    uVar3 = 0x78;

   }

-  return 0;

+  return uVar3;

 }
```

## `NetInfo_Clean`  (modified)

```diff
--- NetInfo_Clean
+++ NetInfo_Clean
@@ -1,150 +1,110 @@
 

-/* WARNING: Instruction at (ram,0x00018001b4f5) overlaps instruction at (ram,0x00018001b4f3)

-    */

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

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

 

-ulonglong NetInfo_Clean(longlong param_1,uint param_2)

+void NetInfo_Clean(longlong param_1,uint param_2)

 

 {

-  byte *pbVar1;

-  undefined8 uVar2;

-  int iVar3;

-  longlong in_RAX;

-  ulonglong uVar4;

-  undefined4 *puVar5;

-  ushort uVar6;

-  undefined4 in_register_00000014;

-  int *unaff_RBX;

-  longlong unaff_RBP;

-  byte unaff_SIL;

-  int iVar7;

+  uint *puVar1;

+  longlong lVar2;

+  bool bVar3;

+  int iVar4;

+  ulonglong uVar5;

+  uint uVar6;

+  longlong lVar7;

   ulonglong uVar8;

-  undefined8 *unaff_R12;

-  longlong unaff_R14;

-  longlong unaff_R15;

-  byte bVar9;

-  char in_ZF;

-  int in_XMM0_Da;

-  int extraout_XMM0_Da;

-  int in_XMM0_Db;

-  int extraout_XMM0_Db;

-  int in_XMM0_Dc;

-  int extraout_XMM0_Dc;

-  int in_XMM0_Dd;

-  int extraout_XMM0_Dd;

-  undefined8 in_stack_00000050;

-  undefined8 in_stack_00000058;

-  int in_stack_00000060;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  pbVar1 = (byte *)(in_RAX + -0x73);

-  *pbVar1 = *pbVar1 >> 5 | *pbVar1 << 3;

-  bVar9 = (char)*pbVar1 < '\0';

-  if (param_1 == 1 || in_ZF != '\0') {

-code_r0x00018001b4e6:

-    *unaff_RBX = *unaff_RBX + (int)in_RAX + (uint)bVar9;

-    unaff_RBX[4] = in_XMM0_Da;

-    unaff_RBX[5] = in_XMM0_Db;

-    unaff_RBX[6] = in_XMM0_Dc;

-    unaff_RBX[7] = in_XMM0_Dd;

-    unaff_RBX[8] = in_XMM0_Da;

-    unaff_RBX[9] = in_XMM0_Db;

-    unaff_RBX[10] = in_XMM0_Dc;

-    unaff_RBX[0xb] = in_XMM0_Dd;

-    *(int *)(unaff_RBP + -0x20) = in_XMM0_Da;

-    *(int *)(unaff_RBP + -0x1c) = in_XMM0_Db;

-    *(int *)(unaff_RBP + -0x18) = in_XMM0_Dc;

-    *(int *)(unaff_RBP + -0x14) = in_XMM0_Dd;

-    RtlInitUnicodeString();

-    iVar3 = RtlGUIDFromString(unaff_RBP + -0x20,unaff_RBP + -0x10);

-    if (-1 < iVar3) goto LAB_0;

-    uVar8 = 0x57;

+                    /* 0x26040  313  NetInfo_Clean */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f892c(0x40b,0x4f,0x18010f550,param_1);

   }

-  else {

-    if (param_1 + -2 == 0 || in_ZF != '\0') {

-      in_RAX = RtlInitUnicodeString(param_1 + -2,CONCAT44(in_register_00000014,param_2));

-      in_XMM0_Da = extraout_XMM0_Da;

-      in_XMM0_Db = extraout_XMM0_Db;

-      in_XMM0_Dc = extraout_XMM0_Dc;

-      in_XMM0_Dd = extraout_XMM0_Dd;

-      goto code_r0x00018001b4e6;

-    }

-LAB_0:

-    in_stack_00000050 = *(undefined8 *)(unaff_RBP + -0x10);

-    in_stack_00000058 = *(undefined8 *)(unaff_RBP + -8);

-    iVar7 = 1;

-    iVar3 = 1;

-    in_stack_00000060 = 1;

-    uVar4 = DnsGetInterfaceSettingsInProc((uint *)&stack0x00000050,&stack0x00000060);

-    uVar8 = uVar4 & 0xffffffff;

-    if ((int)uVar4 == 0) {

-      if ((DAT_1 == 0) || (*(int *)(unaff_RBP + -0x6c) == 0)) {

-        iVar3 = 0;

+  if ((DAT_2 != 0) && (DAT_18013630c == 0)) {

+    iVar4 = FUN_1800ca394(unaff_retaddr);

+    if (iVar4 == 0) {

+      memset(local_98,0,0x80);

+      if (DAT_3 != 0) {

+        FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

       }

-      *unaff_RBX = iVar3;

-      if ((DAT_2 == 0) || (*(int *)(unaff_RBP + -0x78) == 0)) {

-        iVar3 = 0;

+      if (5 < DAT_4) {

+        if (((_DAT_5 & 0x400000000000) == 0) ||

+           ((DAT_6 & 0x400000000000) != DAT_6)) {

+          bVar3 = false;

+        }

+        else {

+          bVar3 = true;

+        }

+        if (bVar3) {

+          local_dc = 0;

+          local_e8 = &local_118;

+          local_cc = 0;

+          local_bc = 0;

+          local_d8 = "NetInfo_Clean";

+          local_c8 = "FALSE";

+          local_118 = 1;

+          local_e0 = 8;

+          local_d0 = 0xe;

+          local_c0 = 6;

+          FUN_180055600(local_b8,(undefined *)local_98);

+          local_9c = 0;

+          local_a8 = &local_110;

+          local_110 = 0x1000000;

+          local_a0 = 8;

+          FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+        }

       }

-      else {

-        iVar3 = 1;

-      }

-      unaff_RBX[1] = iVar3;

-      if (*(int *)(unaff_R14 + 0x1c) == 0) {

-        iVar3 = *(int *)(unaff_RBP + -0x74);

-      }

-      else {

-        iVar3 = *(int *)(unaff_R14 + 0x18);

-      }

-      unaff_RBX[2] = iVar3;

-      if ((DAT_3 == 0) || (*(int *)(unaff_RBP + -0x70) == 0)) {

-        iVar7 = 0;

-      }

-      uVar2 = *(undefined8 *)(unaff_RBP + -0x58);

-      *(undefined8 *)(unaff_RBP + -0x58) = 0;

-      *(undefined8 *)(unaff_RBX + 8) = uVar2;

-      iVar3 = *(int *)(unaff_RBP + -0x30);

-      unaff_RBX[5] = iVar7;

-      unaff_SIL = 8;

-      unaff_RBX[10] = iVar3;

-    }

-    else {

-      unaff_SIL = 8;

-      if ((DAT_4 & 8) != 0) {

-        FUN_1800f658c(0x40b,0x19,0x1801102b8,(int)uVar4);

-      }

+      goto LAB_8;

     }

   }

-  puVar5 = &stack0x00000060;

-  FUN_18001baf4((longlong)puVar5);

-  if ((DAT_4 & unaff_SIL) != 0) {

-    puVar5 = (undefined4 *)0x40b;

-    FUN_1800e64f4(0x40b,0x1a,0x1801102b8,*unaff_RBX);

+  uVar8 = 0;

+  *(uint *)(param_1 + 0x3c) = param_2 & *(uint *)(param_1 + 0x3c) | 0x10000;

+  if (*(int *)(param_1 + 0x44) != 0) {

+    do {

+      lVar7 = uVar8 * 0xa0;

+      lVar2 = *(longlong *)(lVar7 + 0x90 + param_1);

+      if (lVar2 != 0) {

+        *(undefined4 *)(lVar7 + 0xb0 + param_1) = 0;

+        puVar1 = (uint *)(lVar7 + 0xb4 + param_1);

+        *puVar1 = *puVar1 & param_2;

+        uVar6 = 0;

+        if (*(int *)(lVar2 + 4) != 0) {

+          do {

+            uVar5 = (ulonglong)uVar6;

+            uVar6 = uVar6 + 1;

+            puVar1 = (uint *)(uVar5 * 0x40 + 0x48 + lVar2);

+            *puVar1 = *puVar1 & 0xfff00000;

+            *(undefined4 *)(uVar5 * 0x40 + 0x4c + lVar2) = 0xffffffff;

+          } while (uVar6 < *(uint *)(lVar2 + 4));

+        }

+      }

+      uVar6 = (int)uVar8 + 1;

+      uVar8 = (ulonglong)uVar6;

+    } while (uVar6 < *(uint *)(param_1 + 0x44));

   }

-  if ((int)uVar8 == 0) {

-    if ((DAT_4 & unaff_SIL) == 0) {

-      return uVar8;

-    }

-    uVar6 = 0x1f;

-LAB_5:

-    FUN_1800f7614(0x40b,uVar6,0x1801102b8);

+LAB_8:

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f7614(0x40b,0x50,0x18010f550);

   }

-  else {

-    if (*(int *)(unaff_R15 + 0x1c) == 0x83) {

-      uVar4 = FUN_18004bbe8(puVar5,unaff_R12,unaff_R15,unaff_R14,(undefined8 *)unaff_RBX);

-      uVar8 = uVar4 & 0xffffffff;

-      if ((int)uVar4 == 0) {

-        if ((DAT_4 & unaff_SIL) == 0) {

-          return uVar8;

-        }

-        uVar6 = 0x20;

-        goto LAB_5;

-      }

-    }

-    uVar8 = 0;

-    FUN_18005882c((undefined8 *)unaff_RBX,unaff_R14,0);

-  }

-  if ((DAT_4 & unaff_SIL) != 0) {

-    FUN_1800f658c(0x40b,0x21,0x1801102b8,(int)uVar8);

-  }

-  return uVar8;

+  return;

 }
```

## `DnsAsyncRegisterHostAddrs`  (modified)

```diff
--- DnsAsyncRegisterHostAddrs
+++ DnsAsyncRegisterHostAddrs
@@ -1,70 +1,74 @@
 

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

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

 

 ulonglong DnsAsyncRegisterHostAddrs(wchar_t *param_1)

 

 {

-  LPCWSTR pWVar1;

-  uint uVar2;

-  DWORD DVar3;

-  HANDLE hObject;

-  undefined4 extraout_var;

-  LPVOID unaff_RBX;

-  ulonglong uVar4;

-  LPWSTR unaff_RBP;

-  int unaff_EDI;

-  uint in_stack_00000040;

+  bool bVar1;

+  ulonglong uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_168 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800e6c00();

+                    /* 0x96320  34  DnsAsyncRegisterHostAddrs */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_168;

+  if (DAT_1 == 0) {

+    uVar2 = DnsDhcpRegisterHostAddrs(param_1);

   }

-  *(int *)((longlong)unaff_RBX + 0x1c) = unaff_EDI;

-  if (unaff_EDI == 1) {

-    *(ulonglong *)((longlong)unaff_RBX + 0x68) =

-         *(ulonglong *)((longlong)unaff_RBX + 0x68) & (ulonglong)unaff_RBP;

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsAsyncRegisterHostAddrs";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x1a;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0x78;

   }

-  else if (unaff_EDI - 2U < 2) {

-    pWVar1 = *(LPCWSTR *)((longlong)unaff_RBX + 8);

-    if (pWVar1 == (LPCWSTR)0x0) {

-      return 0x57;

-    }

-    uVar4 = 0xffffffffffffffff;

-    do {

-      uVar4 = uVar4 + 1;

-    } while (*(char *)((longlong)pWVar1 + uVar4) != (char)unaff_RBP);

-    in_stack_00000040 = (int)(uVar4 & 0xffff) * 2 + 2;

-    unaff_RBP = FUN_18008a630((ulonglong)in_stack_00000040);

-    if (unaff_RBP == (LPWSTR)0x0) {

-      return 0xe;

-    }

-    uVar2 = FUN_18002c5e0(unaff_RBP,&stack0x00000040,pWVar1,uVar4 & 0xffff,unaff_EDI,1);

-    if (uVar2 == 0) {

-      uVar4 = 0x7b;

-      goto LAB_1;

-    }

-    *(LPWSTR *)((longlong)unaff_RBX + 8) = unaff_RBP;

-    *(LPCWSTR *)((longlong)unaff_RBX + 0x68) = pWVar1;

-  }

-  if (*(longlong *)((longlong)unaff_RBX + 0x40) == 0) {

-    DVar3 = FUN_180093220((longlong)unaff_RBX);

-    return CONCAT44(extraout_var,DVar3);

-  }

-  hObject = CreateThread((LPSECURITY_ATTRIBUTES)0x0,0,FUN_180093220,unaff_RBX,0,

-                         (LPDWORD)&stack0x00000044);

-  if (hObject != (HANDLE)0x0) {

-    CloseHandle(hObject);

-    return 0x3e5;

-  }

-  DVar3 = GetLastError();

-  if ((DAT_2 & 0x80) != 0) {

-    FUN_1800f658c(0x41f,0x74,0x18010fd18,DVar3);

-  }

-  uVar4 = (ulonglong)DVar3;

-  if (DVar3 == 0) {

-    uVar4 = 0xe;

-  }

-LAB_1:

-  DnsApiFree(unaff_RBP);

-  return uVar4;

+  return uVar2;

 }
```

## `NetInfo_Free`  (modified)

```diff
--- NetInfo_Free
+++ NetInfo_Free
@@ -1,158 +1,231 @@
 

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

-

-longlong NetInfo_Free(longlong *param_1)

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

+

+void NetInfo_Free(longlong *param_1)

 

 {

-  longlong *plVar1;

-  longlong lVar2;

-  uint uVar3;

-  uint uVar4;

-  longlong *plVar5;

-  LPVOID pvVar6;

-  uint uVar7;

-  uint uVar8;

-  uint in_EDX;

-  longlong *unaff_RBX;

-  longlong unaff_RBP;

-  ulonglong uVar9;

-  byte in_R9B;

-  int iVar10;

-  longlong unaff_R12;

-  uint unaff_R13D;

-  longlong lVar11;

-  uint uVar12;

-  uint unaff_R14D;

-  uint unaff_R15D;

-  uint uVar13;

-  byte in_CF;

+  byte bVar1;

+  byte bVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  bool bVar5;

+  longlong lVar6;

+  int iVar7;

+  longlong lVar8;

+  byte *pbVar9;

+  byte *pbVar10;

+  undefined1 *puVar11;

+  byte bVar12;

+  ulonglong uVar13;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_168 [8];

+  undefined1 auStackY_160 [24];

+  EVENT_DESCRIPTOR local_130;

+  undefined8 local_120;

+  undefined8 local_118 [2];

+  _EVENT_DATA_DESCRIPTOR local_108;

+  undefined *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  short *local_b8;

+  int local_b0;

+  undefined4 local_ac;

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-  uVar9 = (ulonglong)-(uint)in_CF;

-code_r0x000180029282:

-  uVar13 = (unaff_R15D & 0xff0000) + 0xffff;

-  do {

-    while( true ) {

-      *(uint *)(unaff_RBP + -0x39) = unaff_R13D;

-      uVar12 = unaff_R14D;

-      if (*(uint *)(unaff_R12 + 4) <= unaff_R13D) break;

-      lVar11 = (ulonglong)unaff_R13D * 0x40 + unaff_R12;

-      if (*(short *)(lVar11 + 0x20) == 2) {

-        uVar12 = *(uint *)(lVar11 + 0x24);

-        uVar8 = in_EDX;

-        uVar3 = unaff_R14D;

-        if (uVar12 != 0xffffffff) {

-          iVar10 = *(int *)(lVar11 + 0x44);

-          *(int *)(unaff_RBP + -0x29) = iVar10;

-          *(uint *)(unaff_RBP + -0x25) = in_EDX;

-          if ((in_R9B & 8) != 0) {

-            FUN_1800f9bbc();

-            uVar8 = *(uint *)(unaff_RBP + 0x17);

-            unaff_R13D = *(uint *)(unaff_RBP + -0x39);

-            iVar10 = *(int *)(unaff_RBP + -0x29);

-            in_EDX = *(uint *)(unaff_RBP + -0x25);

-            in_R9B = DAT_0;

+                    /* 0x15f20  317  NetInfo_Free */

+  puVar11 = auStackY_168;

+  local_18 = DAT_0 ^ (ulonglong)auStackY_168;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar7 = FUN_1800ca394(unaff_retaddr), iVar7 != 0)) {

+    if (param_1 != (longlong *)0x0) {

+      while (plVar3 = (longlong *)*param_1, puVar11 = auStackY_168, plVar3 != param_1) {

+        if (((longlong *)plVar3[1] != param_1) ||

+           (lVar8 = *plVar3, *(longlong **)(lVar8 + 8) != plVar3)) {

+          pcVar4 = (code *)swi(0x29);

+          (*pcVar4)(3);

+          puVar11 = auStackY_160;

+          break;

+        }

+        *param_1 = lVar8;

+        *(longlong **)(lVar8 + 8) = param_1;

+        FUN_1800cb9c4(plVar3);

+      }

+      *(undefined8 *)(puVar11 + -8) = 0x18001620c;

+      FUN_1800cb9c4(param_1);

+    }

+  }

+  else {

+    local_98[0] = 0;

+    local_98[1] = 0;

+    local_98[2] = 0;

+    local_98[3] = 0;

+    local_98[4] = 0;

+    local_98[5] = 0;

+    local_98[6] = 0;

+    local_98[7] = 0;

+    local_98[8] = 0;

+    local_98[9] = 0;

+    local_98[10] = 0;

+    local_98[0xb] = 0;

+    local_98[0xc] = 0;

+    local_98[0xd] = 0;

+    local_98[0xe] = 0;

+    local_98[0xf] = 0;

+    local_98[0x10] = 0;

+    local_98[0x11] = 0;

+    local_98[0x12] = 0;

+    local_98[0x13] = 0;

+    local_98[0x14] = 0;

+    local_98[0x15] = 0;

+    local_98[0x16] = 0;

+    local_98[0x17] = 0;

+    local_98[0x18] = 0;

+    local_98[0x19] = 0;

+    local_98[0x1a] = 0;

+    local_98[0x1b] = 0;

+    local_98[0x1c] = 0;

+    local_98[0x1d] = 0;

+    local_98[0x1e] = 0;

+    local_98[0x1f] = 0;

+    local_98[0x20] = 0;

+    local_98[0x21] = 0;

+    local_98[0x22] = 0;

+    local_98[0x23] = 0;

+    local_98[0x24] = 0;

+    local_98[0x25] = 0;

+    local_98[0x26] = 0;

+    local_98[0x27] = 0;

+    local_98[0x28] = 0;

+    local_98[0x29] = 0;

+    local_98[0x2a] = 0;

+    local_98[0x2b] = 0;

+    local_98[0x2c] = 0;

+    local_98[0x2d] = 0;

+    local_98[0x2e] = 0;

+    local_98[0x2f] = 0;

+    local_98[0x30] = 0;

+    local_98[0x31] = 0;

+    local_98[0x32] = 0;

+    local_98[0x33] = 0;

+    local_98[0x34] = 0;

+    local_98[0x35] = 0;

+    local_98[0x36] = 0;

+    local_98[0x37] = 0;

+    local_98[0x38] = 0;

+    local_98[0x39] = 0;

+    local_98[0x3a] = 0;

+    local_98[0x3b] = 0;

+    local_98[0x3c] = 0;

+    local_98[0x3d] = 0;

+    local_98[0x3e] = 0;

+    local_98[0x3f] = 0;

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    puVar11 = auStackY_168;

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar5 = false;

+      }

+      else {

+        bVar5 = true;

+      }

+      puVar11 = auStackY_168;

+      if (bVar5) {

+        local_e8 = &local_120;

+        local_120 = 1;

+        local_e0 = 8;

+        local_d8 = "NetInfo_Free";

+        local_d0 = 0xd;

+        local_c8 = "FALSE";

+        lVar8 = -1;

+        local_c0 = 6;

+        do {

+          lVar6 = lVar8 + 1;

+          lVar8 = lVar8 + 1;

+        } while (local_98[lVar6] != 0);

+        local_b0 = (int)lVar8 * 2 + 2;

+        local_ac = 0;

+        local_b8 = local_98;

+        local_a8 = local_118;

+        local_130.Level = '\x05';

+        local_130.Opcode = '\0';

+        local_130.Task = 0;

+        local_108.Ptr = (ULONGLONG)PTR_DAT_6;

+        local_118[0] = 0x1000000;

+        local_a0 = 8;

+        local_130.Id = 0;

+        local_130.Version = '\0';

+        local_130.Channel = '\v';

+        local_130.Keyword = 0x400000000000;

+        local_108.Size = (ULONG)*(ushort *)PTR_DAT_6;

+        local_f8 = &DAT_7;

+        local_108.Reserved = 2;

+        local_f0 = 0x52;

+        local_ec = 1;

+        puVar11 = auStackY_168;

+        if (DAT_8 == FUN_18004e7b0) {

+          bVar12 = 0;

+          pbVar9 = &DAT_9;

+          do {

+            bVar1 = *pbVar9;

+            pbVar9 = pbVar9 + 1;

+          } while ((char)bVar1 < '\0');

+          do {

+            bVar1 = *pbVar9;

+            pbVar9 = pbVar9 + 1;

+          } while (bVar1 != 0);

+          uVar13 = 0;

+          if (pbVar9 < &DAT_10) {

+            while( true ) {

+              do {

+                pbVar10 = pbVar9;

+                bVar12 = (byte)uVar13;

+                pbVar9 = pbVar10 + 1;

+              } while (*pbVar10 != 0);

+              bVar1 = pbVar10[1];

+              if (-1 < (char)bVar1) break;

+              pbVar9 = pbVar10 + 3;

+              if (-1 < (char)pbVar10[2]) break;

+              bVar2 = *pbVar9;

+              while ((char)bVar2 < '\0') {

+                if (bVar2 != 0x80) goto LAB_11;

+                pbVar10 = pbVar9 + 1;

+                pbVar9 = pbVar9 + 1;

+                bVar2 = *pbVar10;

+              }

+              if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar2 + 0x8f))) break;

+              bVar12 = bVar12 + 1;

+              *(byte *)((longlong)&local_e0 + uVar13 * 0x10 + 5) = bVar2;

+              uVar13 = (ulonglong)bVar12;

+              if (&UNK_12 < pbVar9) break;

+            }

           }

-          if ((iVar10 - 1U < 0x20) &&

-             (uVar3 = uVar12 ^ in_EDX,

-             (uVar3 >> 0x18 | (uVar3 & 0xff0000) >> 8 | (uVar3 & 0xff00) << 8 | uVar3 << 0x18) >>

-             (0x20U - (char)iVar10 & 0x1f) == 0)) {

-            unaff_R12 = *(longlong *)(unaff_RBP + -0x31);

-            uVar12 = 4;

-            break;

-          }

-          uVar4 = 3;

-          uVar7 = 0xffffff;

-          do {

-            uVar3 = unaff_R14D;

-            if ((uVar4 <= unaff_R14D) || (uVar3 = uVar4, (uVar7 & (uVar12 ^ uVar8)) == 0)) break;

-            uVar4 = uVar4 - 1;

-            uVar7 = uVar7 >> 8;

-            uVar3 = unaff_R14D;

-          } while (uVar13 <= uVar7);

-        }

-        unaff_R12 = *(longlong *)(unaff_RBP + -0x31);

-        in_EDX = uVar8;

-        unaff_R14D = uVar3;

-      }

-      unaff_R13D = unaff_R13D + 1;

-    }

-    unaff_R14D = 0;

-    plVar5 = unaff_RBX;

-    plVar1 = *(longlong **)(unaff_RBP + -0x21);

-    do {

-      unaff_RBX = plVar1;

-      if ((in_R9B & 8) != 0) {

-        FUN_1800e40f0();

-      }

-      if (uVar12 == 0) {

-        **(undefined8 **)(unaff_RBP + 0xf) = plVar5;

-        *(longlong **)(unaff_RBP + 0xf) = plVar5;

-LAB_1:

-        plVar5 = *(longlong **)(unaff_RBP + -0x11);

-      }

-      else {

-        if (uVar12 != 4) {

-          **(undefined8 **)(unaff_RBP + -1) = plVar5;

-          *(longlong **)(unaff_RBP + -1) = plVar5;

-          goto LAB_1;

-        }

-        **(undefined8 **)(unaff_RBP + -0x11) = plVar5;

-        *(longlong **)(unaff_RBP + -0x11) = plVar5;

-      }

-      if (unaff_RBX == (longlong *)0x0) {

-        if (*(longlong *)(unaff_RBP + -9) != 0) {

-          *plVar5 = *(longlong *)(unaff_RBP + -9);

-          plVar5 = *(longlong **)(unaff_RBP + -1);

-          *(longlong **)(unaff_RBP + -0x11) = plVar5;

-        }

-        if (*(longlong *)(unaff_RBP + 7) != 0) {

-          *plVar5 = *(longlong *)(unaff_RBP + 7);

-          *(undefined8 *)(unaff_RBP + -0x11) = *(undefined8 *)(unaff_RBP + 0xf);

-        }

-        lVar11 = *(longlong *)(unaff_RBP + -0x19);

-        if ((*(longlong *)(lVar11 + 8) == 0) || ((*(uint *)(lVar11 + 0x14) & 0x2000) == 0)) {

-          lVar2 = *(longlong *)(uVar9 + 8);

-          if ((lVar2 == 0) || ((*(uint *)(uVar9 + 0x14) & 0x2000) == 0)) {

-            uVar13 = *(uint *)(lVar11 + 0x14) >> 3 & 3;

-            pvVar6 = FUN_18002ca60(lVar2,0,uVar13,uVar13);

-            if (pvVar6 == (LPVOID)0x0) {

-              if (*(longlong *)(lVar11 + 8) != 0) {

-                return lVar11;

-              }

-              pvVar6 = *(LPVOID *)(uVar9 + 8);

-              *(uint *)(lVar11 + 0x14) = *(uint *)(lVar11 + 0x14) & 0xffffdfff;

-            }

-            else {

-              *(uint *)(lVar11 + 0x14) = *(uint *)(lVar11 + 0x14) | 0x2000;

-            }

-            *(LPVOID *)(lVar11 + 8) = pvVar6;

+LAB_11:

+          if (bVar12 == 0) {

+            EventWriteTransfer(DAT_13,&local_130,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_108);

+            puVar11 = auStackY_168;

           }

           else {

-            *(uint *)(lVar11 + 0x14) = *(uint *)(lVar11 + 0x14) | 0x2000;

-            *(longlong *)(lVar11 + 8) = lVar2;

-            *(uint *)(uVar9 + 0x14) = *(uint *)(uVar9 + 0x14) & 0xffffdfff;

+            FUN_1800e3380(0x180135218,(undefined8 *)&local_130,7,(longlong)&local_108,bVar12);

+            puVar11 = auStackY_168;

           }

         }

-        return lVar11;

-      }

-      plVar1 = (longlong *)*unaff_RBX;

-      in_EDX = *(uint *)(unaff_RBX + 4);

-      *(longlong **)(unaff_RBP + -0x21) = plVar1;

-      *unaff_RBX = 0;

-      *(uint *)(unaff_RBP + 0x17) = in_EDX;

-      if ((DAT_0 & 8) != 0) {

-        FUN_1800f8e30();

-        in_EDX = *(uint *)(unaff_RBP + 0x17);

-      }

-      plVar5 = unaff_RBX;

-      in_R9B = DAT_0;

-      uVar12 = unaff_R14D;

-    } while (unaff_R12 == 0);

-    unaff_R13D = unaff_R14D;

-    if ((char)in_EDX < '\0') break;

-    uVar13 = 0xff;

-  } while( true );

-  unaff_R15D = -(uint)((in_EDX & 0x40) != 0);

-  goto code_r0x000180029282;

+      }

+    }

+  }

+  *(undefined8 *)(puVar11 + -8) = 0x180016218;

+  return;

 }
```

## `Dns_FindAuthoritativeZoneLib`  (modified)

```diff
--- Dns_FindAuthoritativeZoneLib
+++ Dns_FindAuthoritativeZoneLib
@@ -1,23 +1,69 @@
 

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

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

 

-ulonglong Dns_FindAuthoritativeZoneLib(void)

+undefined8 Dns_FindAuthoritativeZoneLib(void)

 

 {

-  ulonglong uVar1;

-  undefined8 *in_RCX;

-  undefined *in_RDX;

-  longlong unaff_RBP;

-  undefined8 uStack0000000000000078;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *(undefined8 *)(unaff_RBP + -0x48) = 0x15;

-  *(char **)(unaff_RBP + -0x40) = "FALSE";

-  *(undefined8 *)(unaff_RBP + -0x38) = 6;

-  FUN_180055600(in_RCX,in_RDX);

-  uStack0000000000000078 = 0x1000000;

-  *(undefined8 **)(unaff_RBP + -0x20) = &stack0x00000078;

-  *(undefined8 *)(unaff_RBP + -0x18) = 8;

-  uVar1 = FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -0x80));

-  return uVar1;

+                    /* 0x9b6e0  273  Dns_FindAuthoritativeZoneLib */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_FindAuthoritativeZoneLib";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x1d;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

+  return 0x78;

 }
```

## `Dns_WriteDottedNameToPacket`  (modified)

```diff
--- Dns_WriteDottedNameToPacket
+++ Dns_SetRecordsSection
@@ -1,14 +1,66 @@
 

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

+/* WARNING: Removing unreachable block (ram,0x000180068d4e) */

+/* WARNING: Restarted to delay deadcode elimination for space: register */

 

-u_short * Dns_WriteDottedNameToPacket

-                    (u_short *param_1,u_short *param_2,WCHAR *param_3,WCHAR *param_4,ushort param_5,

-                    int param_6)

+ulonglong Dns_SetRecordsSection(longlong *param_1,ushort param_2)

 

 {

-  PEVENT_DATA_DESCRIPTOR in_RAX;

+  ulonglong uVar1;

+  undefined6 in_register_00000012;

+  undefined8 *puVar2;

+  CLIENT_CALL_RETURN CVar3;

+  longlong *plStack0000000000000040;

+  undefined8 *puStack0000000000000048;

+  undefined8 uStack0000000000000050;

+  longlong lStack0000000000000058;

+  undefined8 uStack0000000000000060;

+  ulonglong uStack0000000000000068;

   

-  FUN_1800e3690(0x180135218,(byte *)param_2,0,(byte)param_4,in_RAX);

-  return (u_short *)0x78;

+  puVar2 = (undefined8 *)CONCAT62(in_register_00000012,param_2);

+  uStack0000000000000068 = DAT_0 ^ (ulonglong)&stack0x00000000;

+  uStack0000000000000050 = 0;

+  lStack0000000000000058 = 0;

+  uStack0000000000000060 = 0;

+  if (DAT_1 == 0) {

+    plStack0000000000000040 = param_1;

+    puStack0000000000000048 = puVar2;

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800e51ec(param_1,0xe,0x180111af8,param_1,puVar2);

+    }

+    if (puVar2 == (undefined8 *)0x0) {

+      CVar3.Simple = 0x57;

+    }

+    else {

+      *puVar2 = 0;

+      uVar1 = FUN_18002ddc4(&stack0x00000058);

+      CVar3.Simple = uVar1 & 0xffffffff;

+      if ((int)uVar1 == 0) {

+        CVar3 = NdrClientCall3((MIDL_STUBLESS_PROXY_INFO *)&PTR_PTR_1800ff490,0,(void *)0x0,

+                               uStack0000000000000060,param_1);

+        if ((int)CVar3.Simple == 0) {

+          *puVar2 = uStack0000000000000050;

+        }

+        else if ((DAT_2 & 8) != 0) {

+          FUN_1800f658c(0x40b,0x10,0x180111af8,(int)CVar3.Simple);

+        }

+      }

+      else if ((DAT_2 & 8) != 0) {

+        FUN_1800f658c(0x40b,0xf,0x180111af8,(int)uVar1);

+      }

+    }

+    FUN_18002dd44(&stack0x00000058);

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800f892c(0x40b,0x11,0x180111af8,uStack0000000000000050);

+    }

+    uVar1 = CVar3.Simple & 0xffffffff;

+  }

+  else {

+    if (puVar2 != (undefined8 *)0x0) {

+      *puVar2 = 0;

+    }

+    uVar1 = 0;

+  }

+  return uVar1;

 }
```

## `DnsQueryExW`  (modified)

```diff
--- DnsQueryExW
+++ DnsQueryExA
@@ -1,85 +1,79 @@
 

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

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

 

-DWORD DnsQueryExW(uint *param_1)

+DWORD DnsQueryExA(LPVOID param_1,undefined8 param_2,undefined8 param_3)

 

 {

   bool bVar1;

   DWORD DVar2;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_158 [32];

-  undefined8 in_stack_fffffffffffffec8;

-  undefined4 in_stack_fffffffffffffed4;

+  undefined1 auStackY_148 [32];

+  undefined8 in_stack_fffffffffffffed8;

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x990f0  177  DnsQueryExW */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

+                    /* 0x98db0  175  DnsQueryExA */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

     if ((DAT_2 & 8) != 0) {

-      FUN_1800e7484((ulonglong)(ushort)param_1[4],0x14,0x180111af8,*(wchar_t **)(param_1 + 2),

-                    CONCAT44((int)((ulonglong)in_stack_fffffffffffffec8 >> 0x20),

-                             (uint)(ushort)param_1[4]),

-                    CONCAT44(in_stack_fffffffffffffed4,param_1[5]),*(undefined8 *)(param_1 + 0x10));

+      FUN_1800e7548(param_1,0x12,param_3,(uint)*(ushort *)((longlong)param_1 + 0x10),

+                    CONCAT44((int)((ulonglong)in_stack_fffffffffffffed8 >> 0x20),

+                             *(undefined4 *)((longlong)param_1 + 0x14)),

+                    *(undefined8 *)((longlong)param_1 + 0x40));

     }

-    if (((param_1 == (uint *)0x0) || (param_1[1] != 1)) || (*param_1 < 0x70)) {

-      DVar2 = 0x57;

-    }

-    else {

-      DVar2 = FUN_180091ba4(param_1,1);

-    }

+    DVar2 = FUN_180091ba4(param_1,3);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_3 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_4) {

       if (((_DAT_5 & 0x400000000000) == 0) ||

          ((DAT_6 & 0x400000000000) != DAT_6)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        local_d8 = "DnsQueryExW";

+        local_d8 = "DnsQueryExA";

         local_c8 = "FALSE";

         local_118 = 1;

         local_e0 = 8;

         local_d0 = 0xc;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

         local_a0 = 8;

         FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

       }

     }

     DVar2 = 0x78;

   }

   return DVar2;

 }
```

## `DnsQueryExW`  (modified)

```diff
--- DnsQueryExW
+++ DnsQueryExW
@@ -1,35 +1,85 @@
+

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

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

 

 DWORD DnsQueryExW(uint *param_1)

 

 {

-  DWORD in_EAX;

-  DWORD DVar1;

-  LPVOID unaff_RBX;

-  bool in_ZF;

+  bool bVar1;

+  DWORD DVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_158 [32];

+  undefined8 in_stack_fffffffffffffec8;

+  undefined4 in_stack_fffffffffffffed4;

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  if (in_ZF) {

-    if (unaff_RBX != (LPVOID)0x0) {

-      FUN_18006499c(1);

-      if (*(undefined8 **)((longlong)unaff_RBX + 8) != (undefined8 *)0x0) {

-        Dns_FreeAuthIdentityCredentials(*(undefined8 **)((longlong)unaff_RBX + 8));

-      }

-      if (*(LPVOID *)((longlong)unaff_RBX + 0x10) != (LPVOID)0x0) {

-        FUN_180064a44(*(LPVOID *)((longlong)unaff_RBX + 0x10));

-        *(undefined8 *)((longlong)unaff_RBX + 0x10) = 0;

-      }

-      in_EAX = DnsApiFree(unaff_RBX);

+                    /* 0x990f0  177  DnsQueryExW */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

+  if (DAT_1 == 0) {

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800e7484((ulonglong)(ushort)param_1[4],0x14,0x180111af8,*(wchar_t **)(param_1 + 2),

+                    CONCAT44((int)((ulonglong)in_stack_fffffffffffffec8 >> 0x20),

+                             (uint)(ushort)param_1[4]),

+                    CONCAT44(in_stack_fffffffffffffed4,param_1[5]),*(undefined8 *)(param_1 + 0x10));

+    }

+    if (((param_1 == (uint *)0x0) || (param_1[1] != 1)) || (*param_1 < 0x70)) {

+      DVar2 = 0x57;

+    }

+    else {

+      DVar2 = FUN_180091ba4(param_1,1);

     }

   }

   else {

-    if ((DAT_0 & 8) != 0) {

-      FUN_1800f71b8(0x40b,0x12,0x180110d78,unaff_RBX);

+    memset(local_98,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    in_EAX = SspiFreeAuthIdentity();

-    if ((DAT_0 & 8) != 0) {

-      DVar1 = FUN_1800f7614(0x40b,0x13,0x180110d78);

-      return DVar1;

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        local_d8 = "DnsQueryExW";

+        local_c8 = "FALSE";

+        local_118 = 1;

+        local_e0 = 8;

+        local_d0 = 0xc;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+      }

     }

+    DVar2 = 0x78;

   }

-  return in_EAX;

+  return DVar2;

 }
```

## `DnsCleanupTcpConnections`  (modified)

```diff
--- DnsCleanupTcpConnections
+++ DnsCleanupTcpConnections
@@ -1,34 +1,69 @@
 

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

-/* WARNING: Removing unreachable block (ram,0x000180092041) */

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

 

-ulonglong DnsCleanupTcpConnections(void)

+void DnsCleanupTcpConnections(void)

 

 {

-  ulonglong uVar1;

-  CLIENT_CALL_RETURN CVar2;

-  int unaff_EDI;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  if (unaff_EDI == 0) {

-    CVar2.Simple = 0x57;

-  }

-  else {

-    uVar1 = FUN_18002ddc4((longlong *)&stack0x00000078);

-    CVar2.Simple = uVar1 & 0xffffffff;

-    if ((int)uVar1 == 0) {

-      CVar2 = NdrClientCall3((MIDL_STUBLESS_PROXY_INFO *)&PTR_PTR_1800ff490,0x1e,(void *)0x0);

-      if (((int)CVar2.Simple != 0) && ((DAT_0 & 8) != 0)) {

-        FUN_1800f658c(0x40b,0x85,0x18010fd18,(int)CVar2.Simple);

+                    /* 0x968e0  42  DnsCleanupTcpConnections */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "DnsCleanupTcpConnections";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x19;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    else if ((DAT_0 & 8) != 0) {

-      FUN_1800f658c(0x40b,0x84,0x18010fd18,(int)uVar1);

-    }

   }

-  FUN_18002dd44((longlong *)&stack0x00000078);

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x86,0x18010fd18,(int)CVar2.Simple);

-  }

-  return CVar2.Simple & 0xffffffff;

+  return;

 }
```

## `CombineRecordsInBlob`  (modified)

```diff
--- CombineRecordsInBlob
+++ CombineRecordsInBlob
@@ -1,31 +1,77 @@
 

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

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

 

-uint CombineRecordsInBlob(longlong param_1,undefined8 *param_2)

+void CombineRecordsInBlob(longlong param_1,undefined8 *param_2)

 

 {

-  uint uVar1;

-  int unaff_EBX;

-  LPCWSTR unaff_RDI;

-  uint uStack0000000000000030;

+  bool bVar1;

+  undefined8 *puVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  if ((int)param_2 == 6) {

-    uStack0000000000000030 = 0x208;

-    memset(&stack0x00000040,0,0x208);

-    uVar1 = FUN_18002c5e0((LPWSTR)&stack0x00000040,&stack0x00000030,unaff_RDI,0,3,1);

-    if (uVar1 != 0) {

-      uVar1 = DnsValidateName_W((wchar_t *)&stack0x00000040,unaff_EBX,unaff_RDI);

-      return uVar1;

+                    /* 0x95be0  16  CombineRecordsInBlob */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800f7614(0x40b,0xb,0x180111af8);

+    }

+    puVar2 = FUN_180029ea4(*(undefined8 **)(param_1 + 0x58),*(undefined8 **)(param_1 + 0x60));

+    puVar2 = FUN_180029ea4(*(undefined8 **)(param_1 + 0x48),puVar2);

+    puVar2 = FUN_180029ea4(*(undefined8 **)(param_1 + 0x50),puVar2);

+    *param_2 = puVar2;

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        local_d8 = "CombineRecordsInBlob";

+        local_c8 = "FALSE";

+        local_118 = 1;

+        local_e0 = 8;

+        local_d0 = 0x15;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+      }

     }

   }

-  else {

-    uStack0000000000000030 = 0x104;

-    uVar1 = FUN_18002c5e0((LPWSTR)&stack0x00000040,&stack0x00000030,unaff_RDI,0,3,2);

-    if (uVar1 != 0) {

-      uVar1 = FUN_18002b380((LPCWSTR)&stack0x00000040,unaff_EBX,0,0);

-      return uVar1;

-    }

-  }

-  return 0x7b;

+  return;

 }
```

## `Dns_RecordTableIndexForType`  (modified)

```diff
--- Dns_RecordTableIndexForType
+++ Dns_RecordTableIndexForType
@@ -1,15 +1,26 @@
 

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

+/* Library Function - Single Match

+    Dns_RecordTableIndexForType

+   

+   Library: Visual Studio 2019 Release */

 

 ulonglong Dns_RecordTableIndexForType(ushort param_1)

 

 {

-  LPVOID unaff_R15;

+  ushort uVar1;

+  ulonglong uVar2;

   

-  DnsApiFree(unaff_R15);

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(0x40b,0xf9,0x18010f550,0x57);

+  if (param_1 < 0x35) {

+    return (ulonglong)param_1;

   }

-  return 0x57;

+  uVar2 = 0x35;

+  do {

+    if (*(ushort *)(&DAT_0 + uVar2 * 0x10) == param_1) {

+      return uVar2;

+    }

+    uVar1 = (short)uVar2 + 1;

+    uVar2 = (ulonglong)uVar1;

+  } while (uVar1 < 0x39);

+  return 0;

 }
```

## `Socket_SetMulticastInterface`  (modified)

```diff
--- Socket_SetMulticastInterface
+++ Socket_SetMulticastInterface
@@ -1,225 +1,125 @@
 

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

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

 

 int Socket_SetMulticastInterface(SOCKET param_1,int param_2,int param_3,u_long param_4)

 

 {

-  PCCERT_CONTEXT pCVar1;

+  bool bVar1;

   int iVar2;

-  uint uVar3;

-  uint uVar4;

-  wchar_t *pwVar5;

-  int **ppiVar6;

-  undefined8 uVar7;

-  PCCERT_CONTEXT *ppCVar8;

-  int iVar9;

-  short unaff_BX;

-  wchar_t *unaff_RBP;

-  PCCERT_CONTEXT unaff_RSI;

-  PCCERT_CONTEXT *unaff_RDI;

-  PCCERT_CONTEXT *unaff_R12;

-  int **unaff_R13;

-  short *unaff_R14;

-  int unaff_R15D;

-  bool bVar10;

-  undefined8 in_stack_00000020;

-  undefined4 uVar11;

-  uint in_stack_00000050;

-  PCCERT_CONTEXT in_stack_00000058;

-  int **in_stack_00000060;

-  PCCERT_CONTEXT in_stack_00000068;

-  uint in_stack_00000070;

-  short *in_stack_00000078;

+  int iVar3;

+  int iVar4;

+  SOCKET SVar5;

+  undefined8 uVar6;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_188 [32];

+  u_long local_148 [2];

+  undefined8 local_140;

+  undefined8 local_138 [2];

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  undefined8 local_d8 [2];

+  undefined8 *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  uVar11 = (undefined4)((ulonglong)in_stack_00000020 >> 0x20);

-  if (unaff_R14 != (short *)0x0) {

-    iVar9 = (int)param_1;

-    if (unaff_R15D == 1) {

-      if ((unaff_R13 == (int **)0x0) || (unaff_BX != 0)) goto LAB_0;

-      iVar2 = 1;

-LAB_1:

-      if (iVar2 != 0) {

-LAB_2:

-        bVar10 = DAT_3 == iVar9;

-        in_stack_00000068 = unaff_RDI[0x45];

-        pCVar1 = unaff_RDI[0xb];

-        *(PCCERT_CONTEXT *)(unaff_RBP + -0x40) = pCVar1;

-        if (bVar10) {

-          in_stack_00000070 = 0x80;

-          pwVar5 = unaff_RBP + 0xd0;

+                    /* 0x7b4d0  352  Socket_SetMulticastInterface */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_188;

+  iVar4 = 0;

+  local_148[0] = 0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800e60b4();

+  }

+  if ((DAT_2 != 0) && (DAT_18013630c == 0)) {

+    iVar2 = FUN_1800ca394(unaff_retaddr);

+    if (iVar2 == 0) {

+      memset(local_b8,0,0x80);

+      if (DAT_3 != 0) {

+        FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+      }

+      if (5 < DAT_4) {

+        if (((_DAT_5 & 0x400000000000) == 0) ||

+           ((DAT_6 & 0x400000000000) != DAT_6)) {

+          bVar1 = false;

         }

         else {

-          in_stack_00000070 = 0x41;

-          pwVar5 = unaff_RBP;

+          bVar1 = true;

         }

-        pwVar5 = FUN_18005c69c(pwVar5,&stack0x00000070,unaff_R14);

-        if (pwVar5 != (wchar_t *)0x0) {

-          if (in_stack_00000078 == (short *)0x0) {

-LAB_4:

-            FUN_180041738((longlong)pCVar1);

-            FUN_180052ee8((longlong)pCVar1,(undefined8 *)unaff_R14);

-            *(undefined4 *)((longlong)unaff_RDI + 0x1ac) = 1;

-            *(undefined4 *)&in_stack_00000068[5].field_0x4 = *(undefined4 *)&pCVar1[5].field_0x4;

-            ppiVar6 = unaff_R13;

-            if (unaff_R15D != 1) {

-              ppiVar6 = in_stack_00000060;

-            }

-            in_stack_00000068[3].cbCertEncoded = 1;

-            uVar7 = *(undefined8 *)((longlong)&pCVar1[1].pCertInfo + 4);

-            *(undefined8 *)&in_stack_00000068[1].field_0x14 = *(undefined8 *)&pCVar1[1].field_0x14;

-            *(undefined8 *)((longlong)&in_stack_00000068[1].pCertInfo + 4) = uVar7;

-            uVar7 = *(undefined8 *)&pCVar1[2].field_0x4;

-            *(undefined8 *)((longlong)&in_stack_00000068[1].hCertStore + 4) =

-                 *(undefined8 *)((longlong)&pCVar1[1].hCertStore + 4);

-            *(undefined8 *)&in_stack_00000068[2].field_0x4 = uVar7;

-            uVar7 = *(undefined8 *)&pCVar1[2].field_0x14;

-            *(undefined8 *)((longlong)&in_stack_00000068[2].pbCertEncoded + 4) =

-                 *(undefined8 *)((longlong)&pCVar1[2].pbCertEncoded + 4);

-            *(undefined8 *)&in_stack_00000068[2].field_0x14 = uVar7;

-            uVar7 = *(undefined8 *)((longlong)&pCVar1[2].hCertStore + 4);

-            *(undefined8 *)((longlong)&in_stack_00000068[2].pCertInfo + 4) =

-                 *(undefined8 *)((longlong)&pCVar1[2].pCertInfo + 4);

-            *(undefined8 *)((longlong)&in_stack_00000068[2].hCertStore + 4) = uVar7;

-            in_stack_00000068[3].pbCertEncoded = (BYTE *)ppiVar6;

-            *(int *)((longlong)unaff_RDI + 0xfc) = *(int *)((longlong)unaff_RDI + 0xfc) + 1;

-            if (DAT_5 == (int)unaff_RSI) {

-              if ((unaff_RDI[4][1].cbCertEncoded & 0x80) != 0) {

-                in_stack_00000050 = 0;

-                goto LAB_6;

-              }

-LAB_7:

-              FUN_18005c20c((longlong)unaff_RDI[4],0,unaff_R14);

-              uVar3 = *(uint *)(unaff_RBP + 0x214);

-              pwVar5 = unaff_RBP;

-              if (DAT_3 == 0) {

-                pwVar5 = unaff_RBP + 0xd0;

-              }

-              FUN_1800754c8((longlong)unaff_RDI,(wchar_t *)in_stack_00000068[3].pbCertEncoded,pwVar5

-                            ,unaff_R15D,

-                            CONCAT44(uVar11,*(undefined4 *)

-                                             (*(longlong *)(unaff_RBP + -0x40) + 0x298)),uVar3);

-              if (*unaff_R14 == 2) {

-                uVar4 = (uint)((char)unaff_R14[2] == '\x7f');

-              }

-              else {

-                uVar7 = FUN_180044858(unaff_R14 + 4);

-                uVar4 = (uint)uVar7 & 0xff;

-              }

-              if (uVar4 != 0) {

-                if ((DAT_8 & 8) != 0) {

-                  FUN_1800f658c(0x40b,0x1aa,0x18010da00,uVar3);

-                }

-                uVar3 = 0;

-              }

-              if (DAT_3 == 0) {

-                if (unaff_R15D == 1) {

-                  pwVar5 = unaff_RBP + 0xd0;

-                  goto LAB_9;

-                }

-                pwVar5 = unaff_RBP + 0xd0;

-LAB_10:

-                ppCVar8 = FUN_180078b90(unaff_RDI,pwVar5,unaff_R12,in_stack_00000060,

-                                        unaff_RBP[0x208],uVar3,unaff_RSI);

-                uVar3 = (uint)ppCVar8;

-              }

-              else {

-                pwVar5 = unaff_RBP;

-                if (unaff_R15D != 1) goto LAB_10;

-LAB_9:

-                uVar3 = FUN_180078820((int *)unaff_RDI,unaff_R13,pwVar5,unaff_R12,uVar3,unaff_RSI);

-              }

-              in_stack_00000058 = unaff_RSI;

-              if (uVar3 == 0) {

-                memset(unaff_RBP + 0x90,0,0x80);

-                if (DAT_11 != 0) {

-                  FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 500),0,unaff_RBP + 0x90,0x40);

-                }

-                if (5 < DAT_12) {

-                  if (((_DAT_13 & 0x400000000000) == 0) ||

-                     (bVar10 = true, (DAT_14 & 0x400000000000) != DAT_14)) {

-                    bVar10 = false;

-                  }

-                  if (bVar10) {

-                    unaff_RBP[-0x40] = L'\x01';

-                    unaff_RBP[-0x3f] = L'\0';

-                    unaff_RBP[-0x3e] = L'\0';

-                    unaff_RBP[-0x3d] = L'\0';

-                    *(wchar_t **)(unaff_RBP + -0x28) = unaff_RBP + -0x40;

-                    unaff_RBP[-0x24] = L'\b';

-                    unaff_RBP[-0x23] = L'\0';

-                    unaff_RBP[-0x22] = L'\0';

-                    unaff_RBP[-0x21] = L'\0';

-                    *(char **)(unaff_RBP + -0x20) = "SendSecureQueryToServer";

-                    unaff_RBP[-0x1c] = L'\x18';

-                    unaff_RBP[-0x1b] = L'\0';

-                    unaff_RBP[-0x1a] = L'\0';

-                    unaff_RBP[-0x19] = L'\0';

-                    *(char **)(unaff_RBP + -0x18) = "status != ERROR_SUCCESS";

-                    unaff_RBP[-0x14] = L'\x18';

-                    unaff_RBP[-0x13] = L'\0';

-                    unaff_RBP[-0x12] = L'\0';

-                    unaff_RBP[-0x11] = L'\0';

-                    FUN_180055600((undefined8 *)(unaff_RBP + -0x10),(undefined *)(unaff_RBP + 0x90))

-                    ;

-                    in_stack_00000078 = (short *)0x1000000;

-                    *(short ***)(unaff_RBP + -8) = &stack0x00000078;

-                    unaff_RBP[-4] = L'\b';

-                    unaff_RBP[-3] = L'\0';

-                    unaff_RBP[-2] = L'\0';

-                    unaff_RBP[-1] = L'\0';

-                    FUN_1800e3690(0x180135218,&DAT_15,0,7,

-                                  (PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -0x38));

-                  }

-                }

-              }

-              else if ((uVar3 != 0x2522) && (uVar3 != 0x4c7)) {

-                *(uint *)((longlong)unaff_RDI + 0xc4) = uVar3;

-              }

-            }

-            else {

-              FUN_1800c8538((longlong)unaff_RDI,&stack0x00000050);

-LAB_6:

-              uVar3 = FUN_1800c8bd0(in_stack_00000050,&stack0x00000058);

-              unaff_RSI = in_stack_00000058;

-              if ((uVar3 == 0) || (uVar3 == 0x490)) goto LAB_7;

-            }

-            if (in_stack_00000058 != (PCCERT_CONTEXT)0x0) {

-              CertFreeCertificateContext(in_stack_00000058);

-            }

-            goto LAB_16;

-          }

-          if (DAT_3 == (int)unaff_RSI) {

-            in_stack_00000070 = 0x80;

-            pwVar5 = FUN_18005c69c(unaff_RBP + 0x150,&stack0x00000070,in_stack_00000078);

-            if (pwVar5 != (wchar_t *)0x0) {

-              unaff_R12 = (PCCERT_CONTEXT *)(unaff_RBP + 0x150);

-              goto LAB_4;

-            }

-          }

-          else {

-            in_stack_00000070 = 0x41;

-            pwVar5 = FUN_18005c69c(unaff_RBP + 0x48,&stack0x00000070,in_stack_00000078);

-            if (pwVar5 != (wchar_t *)0x0) {

-              unaff_R12 = (PCCERT_CONTEXT *)(unaff_RBP + 0x48);

-              goto LAB_4;

-            }

-          }

+        if (bVar1) {

+          local_fc = 0;

+          local_108 = &local_140;

+          local_ec = 0;

+          local_dc = 0;

+          local_f8 = "Socket_SetMulticastInterface";

+          local_e8 = "FALSE";

+          local_140 = 1;

+          local_100 = 8;

+          local_f0 = 0x1d;

+          local_e0 = 6;

+          FUN_180055600(local_d8,(undefined *)local_b8);

+          local_bc = 0;

+          local_c8 = local_138;

+          local_138[0] = 0x1000000;

+          local_c0 = 8;

+          FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

         }

       }

-    }

-    else if (unaff_R15D == param_2) {

-LAB_0:

-      iVar2 = iVar9;

-      if ((unaff_R15D != param_2) || (unaff_R13 != (int **)0x0)) goto LAB_1;

-      goto LAB_2;

+      iVar2 = 0x78;

+      goto LAB_8;

     }

   }

-  uVar3 = 0x57;

-LAB_16:

-  if ((DAT_8 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x1ab,0x18010da00,uVar3);

+  if (((param_1 + 1 & 0xfffffffffffffffe) == 0) || (param_4 == 0)) {

+    iVar2 = 0x57;

   }

-  return uVar3;

+  else {

+    iVar2 = 0;

+    if ((param_2 == 2) && (param_3 == 0)) {

+      local_148[0] = htonl(param_4);

+      iVar3 = 0;

+    }

+    else {

+      iVar3 = 0x29;

+      local_148[0] = param_4;

+    }

+    uVar6 = 9;

+    SVar5 = param_1;

+    iVar3 = setsockopt(param_1,iVar3,9,(char *)local_148,4);

+    if (iVar3 == -1) {

+      iVar2 = WSAGetLastError();

+      if ((DAT_1 & 8) != 0) {

+        FUN_1800e6694(SVar5,0x17,uVar6,param_1);

+      }

+    }

+    if (param_3 != 0) {

+      local_148[0] = htonl(param_4);

+      uVar6 = 9;

+      SVar5 = param_1;

+      iVar3 = setsockopt(param_1,0,9,(char *)local_148,4);

+      if (iVar3 == -1) {

+        iVar4 = WSAGetLastError();

+        if ((DAT_1 & 8) != 0) {

+          FUN_1800e6694(SVar5,0x18,uVar6,param_1);

+        }

+      }

+      if (iVar2 != 0) {

+        iVar2 = iVar4;

+      }

+    }

+  }

+LAB_8:

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x19,0x180110260,iVar2);

+  }

+  return iVar2;

 }
```

## `HostsFile_Close`  (modified)

```diff
--- HostsFile_Close
+++ HostsFile_Close
@@ -1,14 +1,72 @@
 

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

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

 

 void HostsFile_Close(undefined8 *param_1)

 

 {

-  ulonglong in_RDX;

-  int in_R8D;

-  undefined4 in_R9D;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  FUN_18002ca60((longlong)param_1,in_RDX,in_R8D,in_R9D);

+                    /* 0x6b280  305  HostsFile_Close */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    FUN_1800daba8(param_1);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "HostsFile_Close";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x10;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

   return;

 }
```

## `BreakRecordsIntoBlob`  (modified)

```diff
--- BreakRecordsIntoBlob
+++ BreakRecordsIntoBlob
@@ -1,47 +1,113 @@
 

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

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

 

 void BreakRecordsIntoBlob(void *param_1,undefined8 *param_2,short param_3)

 

 {

-  char in_AL;

-  wchar_t *unaff_RBX;

-  longlong unaff_RBP;

-  LPCWSTR unaff_RDI;

-  undefined6 in_register_00000082;

-  undefined8 uVar1;

-  undefined4 uVar2;

-  undefined8 in_stack_00000030;

-  undefined8 in_stack_00000038;

-  undefined8 *in_stack_00000060;

-  undefined4 in_stack_00000068;

-  undefined4 in_stack_0000006c;

-  char *in_stack_00000070;

-  undefined4 in_stack_00000078;

-  undefined4 in_stack_0000007c;

+  undefined8 *puVar1;

+  bool bVar2;

+  undefined8 *puVar3;

+  uint uVar4;

+  undefined8 uVar5;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_198 [32];

+  undefined8 local_168 [2];

+  undefined8 local_158;

+  undefined8 *local_150;

+  undefined8 local_148;

+  undefined8 *local_140;

+  undefined8 local_138;

+  undefined8 *local_130;

+  undefined8 local_128;

+  undefined8 local_120;

+  _EVENT_DATA_DESCRIPTOR local_118 [2];

+  undefined8 *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  undefined8 local_c8 [2];

+  undefined8 *local_b8;

+  undefined8 local_b0;

+  short local_a8 [64];

+  ulonglong local_28;

   

-  uVar1 = CONCAT62(in_register_00000082,param_3);

-  if (in_AL != '\0') {

-    in_stack_0000006c = 0;

-    in_stack_00000060 = &stack0x00000030;

-    in_stack_0000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    uVar2 = 8;

-    in_stack_00000030 = 1;

-    in_stack_00000070 = "DnsNameCompareEx_UTF8";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    in_stack_00000068 = 8;

-    in_stack_00000078 = 0x16;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

-    uVar1 = 0;

-    in_stack_00000038 = 0x1000000;

-    FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+                    /* 0x95960  14  BreakRecordsIntoBlob */

+  local_28 = DAT_0 ^ (ulonglong)auStackY_198;

+  uVar5 = 0;

+  if (DAT_1 == 0) {

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800f7614(0x40b,10,0x180111af8);

+    }

+    memset(param_1,0,0x78);

+    puVar3 = local_168;

+    local_150 = &local_158;

+    local_140 = &local_148;

+    local_130 = &local_138;

+    local_168[0] = uVar5;

+    local_158 = uVar5;

+    local_148 = uVar5;

+    local_138 = uVar5;

+    while (param_2 != (undefined8 *)0x0) {

+      puVar1 = (undefined8 *)*param_2;

+      uVar4 = *(uint *)((longlong)param_2 + 0x14) & 3;

+      *param_2 = 0;

+      if (uVar4 < 2) {

+        if ((*(short *)(param_2 + 2) == 5) && (param_3 != 5)) {

+          *local_150 = param_2;

+          local_150 = param_2;

+          param_2 = puVar1;

+        }

+        else {

+          *puVar3 = param_2;

+          puVar3 = param_2;

+          param_2 = puVar1;

+        }

+      }

+      else if (uVar4 == 3) {

+        *local_140 = param_2;

+        local_140 = param_2;

+        param_2 = puVar1;

+      }

+      else {

+        *local_130 = param_2;

+        local_130 = param_2;

+        param_2 = puVar1;

+      }

+    }

+    *(undefined8 *)((longlong)param_1 + 0x48) = local_168[0];

+    *(undefined8 *)((longlong)param_1 + 0x50) = local_158;

+    *(undefined8 *)((longlong)param_1 + 0x58) = local_138;

+    *(undefined8 *)((longlong)param_1 + 0x60) = local_148;

   }

-  FUN_18002b810(unaff_RBX,unaff_RDI,uVar1,2);

+  else {

+    memset(local_a8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         (bVar2 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar2 = false;

+      }

+      if (bVar2) {

+        local_f8 = &local_128;

+        local_128 = 1;

+        local_f0 = 8;

+        local_e8 = "BreakRecordsIntoBlob";

+        local_e0 = 0x15;

+        local_d8 = "FALSE";

+        local_d0 = 6;

+        FUN_180055600(local_c8,(undefined *)local_a8);

+        local_b8 = &local_120;

+        local_120 = 0x1000000;

+        local_b0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_118);

+      }

+    }

+  }

   return;

 }
```

## `Dns_SetRecordsScopeId`  (modified)

```diff
--- Dns_SetRecordsScopeId
+++ Dns_ReadPacketName
@@ -1,72 +1,75 @@
 

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

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

 

-void Dns_SetRecordsScopeId(longlong param_1,int param_2,undefined8 *param_3)

+byte * Dns_ReadPacketName(byte *param_1,short *param_2,ushort *param_3,undefined4 *param_4,

+                         byte *param_5,longlong param_6,byte *param_7)

 

 {

   bool bVar1;

-  undefined4 uVar2;

+  byte *pbVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

+  undefined1 auStackY_158 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x6a410  291  Dns_SetRecordsScopeId */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+                    /* 0x69e40  283  Dns_ReadPacketName */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

   if (DAT_1 == 0) {

-    FUN_1800d3cbc(param_1,param_2,param_3);

+    pbVar2 = FUN_18002c150(param_1,param_2,param_3,param_4,param_5,param_6,param_7,0);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        uVar2 = 8;

+        uVar3 = 8;

         local_118 = 1;

-        local_d8 = "Dns_SetRecordsScopeId";

+        local_d8 = "Dns_ReadPacketName";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x16;

+        local_d0 = 0x13;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar2;

+        local_a0 = uVar3;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

+    pbVar2 = (byte *)0x0;

   }

-  return;

+  return pbVar2;

 }
```

## `DnsUpdateMachinePresence`  (modified)

```diff
--- DnsUpdateMachinePresence
+++ DnsGetPolicyTableInfoPrivate
@@ -1,191 +1,109 @@
 

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

+/* WARNING: Removing unreachable block (ram,0x00018007db3a) */

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

 

-int DnsUpdateMachinePresence(void)

+ulonglong DnsGetPolicyTableInfoPrivate

+                    (wchar_t *param_1,uint param_2,undefined8 *param_3,undefined4 *param_4)

 

 {

-  bool bVar1;

-  char cVar2;

-  int iVar3;

-  int iVar4;

-  int iVar5;

-  wchar_t *pwVar6;

-  char cVar7;

-  uint uVar8;

-  ulonglong uVar9;

-  char cVar10;

-  wchar_t *pwVar11;

-  char cVar12;

-  longlong lVar13;

+  int iVar1;

+  int iVar2;

+  ulonglong uVar3;

+  ulonglong unaff_RSI;

+  bool bVar4;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_1c8 [32];

-  longlong local_150;

-  longlong local_148;

-  uint local_140;

-  undefined8 local_138;

-  undefined8 local_130;

-  _EVENT_DATA_DESCRIPTOR local_128 [2];

-  undefined8 *local_108;

+  undefined1 auStackY_198 [32];

+  undefined8 in_stack_fffffffffffffe88;

+  undefined8 local_158;

+  undefined8 local_150;

+  undefined8 local_148 [2];

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined8 local_110;

+  char *local_108;

   undefined8 local_100;

   char *local_f8;

   undefined8 local_f0;

-  char *local_e8;

-  undefined8 local_e0;

-  undefined8 local_d8 [2];

-  undefined8 *local_c8;

-  undefined8 local_c0;

-  short local_b8 [64];

-  ulonglong local_38;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

+  undefined8 local_d0;

+  short local_c8 [64];

+  ulonglong local_48;

   

-                    /* 0x7e230  236  DnsUpdateMachinePresence */

-  local_38 = DAT_0 ^ (ulonglong)auStackY_1c8;

-  uVar9 = 0;

-  local_150 = 0;

-  cVar12 = '\0';

-  local_148 = 0;

-  local_140 = 0;

-  cVar2 = '\x01';

-  cVar10 = '\x01';

+                    /* 0x7d930  126  DnsGetPolicyTableInfoPrivate */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_198;

+  iVar2 = 0;

+  local_158 = 0;

   if ((DAT_1 & 8) != 0) {

-    FUN_1800f7614(0x40b,0x24,0x18010c2f0);

+    FUN_1800e6914(param_1,0x4d,0x18010c2f0,param_1,

+                  CONCAT44((int)((ulonglong)in_stack_fffffffffffffe88 >> 0x20),param_2),param_3,

+                  param_4);

   }

-  if (((DAT_2 != 0) && (DAT_18013630c == 0)) &&

-     (iVar3 = FUN_1800ca394(unaff_retaddr), iVar3 == 0)) {

-    memset(local_b8,0,0x80);

-    if (DAT_3 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar1 = FUN_1800ca394(unaff_retaddr), iVar1 != 0)) {

+    if (param_3 != (undefined8 *)0x0) {

+      uVar3 = FUN_18000ed74(param_1,param_2,&local_158);

+      iVar2 = (int)uVar3;

+      if (iVar2 != 0) {

+        bVar4 = DAT_3 == 0;

+        *param_3 = 0;

+        if (bVar4) {

+          return unaff_RSI;

+        }

+        goto LAB_4;

+      }

+      *param_3 = local_158;

     }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

-        bVar1 = false;

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

+      if (DAT_5 == 0) {

+        EnterCriticalSection((LPCRITICAL_SECTION)&DAT_6);

       }

-      if (bVar1) {

-        local_108 = &local_130;

-        local_130 = 1;

-        local_100 = 8;

-        local_f8 = "DnsUpdateMachinePresence";

-        local_f0 = 0x19;

-        local_e8 = "FALSE";

-        local_e0 = 6;

-        FUN_180055600(local_d8,(undefined *)local_b8);

-        local_c8 = &local_138;

-        local_138 = 0x1000000;

-        local_c0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

+      LOCK();

+      UNLOCK();

+      *param_4 = DAT_7;

+      param_4[1] = DAT_8;

+      if (1 < DAT_9) {

+        DAT_9 = 0;

+      }

+      bVar4 = DAT_5 == 0;

+      param_4[2] = DAT_9;

+      if (bVar4) {

+        LeaveCriticalSection((LPCRITICAL_SECTION)&DAT_6);

       }

     }

-    return 0x78;

-  }

-  iVar3 = NsiAllocateAndGetTable(1,&DAT_8,7,&local_150);

-  local_138 = CONCAT44(local_138._4_4_,iVar3);

-  cVar7 = cVar2;

-  if (iVar3 == 0) {

-    if (local_140 != 0) {

-      do {

-        lVar13 = uVar9 * 0xf0;

-        cVar7 = '\0';

-        if (*(int *)(lVar13 + 0xa8 + local_148) != 1) {

-          cVar7 = cVar2;

-        }

-        if (*(char *)(lVar13 + 0xa5 + local_148) != '\0') {

-          cVar12 = '\x01';

-        }

-        bVar1 = FUN_1800501b4((undefined8 *)(local_150 + uVar9 * 8));

-        cVar2 = FUN_1800502c8((undefined8 *)(local_150 + uVar9 * 8));

-        if (((bVar1) && (cVar2 == '\0')) && (*(int *)(lVar13 + 0x10 + local_148) != 1)) {

-          cVar10 = '\0';

-        }

-        if ((DAT_1 & 8) != 0) {

-          FUN_1800eca5c((ulonglong)bVar1,0x26,(ulonglong)*(byte *)(lVar13 + 0xa5 + local_148),

-                        *(undefined8 *)(local_150 + uVar9 * 8));

-        }

-        uVar8 = (int)uVar9 + 1;

-        uVar9 = (ulonglong)uVar8;

-        cVar2 = cVar7;

-      } while (uVar8 < local_140);

-      iVar3 = (int)local_138;

-    }

-  }

-  else if ((DAT_1 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x25,0x18010c2f0,iVar3);

-  }

-  uVar9 = 0;

-  NsiFreeTable(local_150,local_148,0,0);

-  local_150 = 0;

-  local_148 = 0;

-  iVar4 = NsiAllocateAndGetTable(1,&DAT_9,7,&local_150);

-  local_130 = CONCAT44(local_130._4_4_,iVar4);

-  if (iVar4 == 0) {

-    cVar2 = cVar7;

-    if (local_140 != 0) {

-      do {

-        lVar13 = uVar9 * 0xf0;

-        cVar7 = '\0';

-        if (*(int *)(lVar13 + 0xa8 + local_148) != 1) {

-          cVar7 = cVar2;

-        }

-        if (*(char *)(lVar13 + 0xa5 + local_148) != '\0') {

-          cVar12 = '\x01';

-        }

-        bVar1 = FUN_1800501b4((undefined8 *)(local_150 + uVar9 * 8));

-        cVar2 = FUN_1800502c8((undefined8 *)(local_150 + uVar9 * 8));

-        if (((bVar1) && (cVar2 == '\0')) && (*(int *)(lVar13 + 0x10 + local_148) != 1)) {

-          cVar10 = '\0';

-        }

-        if ((DAT_1 & 8) != 0) {

-          FUN_1800eca5c((ulonglong)bVar1,0x28,(ulonglong)*(byte *)(lVar13 + 0xa5 + local_148),

-                        *(undefined8 *)(local_150 + uVar9 * 8));

-        }

-        uVar8 = (int)uVar9 + 1;

-        uVar9 = (ulonglong)uVar8;

-        cVar2 = cVar7;

-      } while (uVar8 < local_140);

-      iVar3 = (int)local_138;

-      iVar4 = (int)local_130;

-    }

-LAB_10:

-    if ((DAT_1 & 8) != 0) {

-      pwVar6 = L"in private network";

-      if (cVar10 == '\0') {

-        pwVar6 = L"not in private network";

-      }

-      pwVar11 = L"outside";

-      if (cVar7 == '\0') {

-        pwVar11 = L"inside";

-      }

-      FUN_1800f5ba4(0x40b,0x29,0x18010c2f0,pwVar11,(longlong)pwVar6);

-    }

-  }

-  else if ((DAT_1 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x27,0x18010c2f0,iVar4);

-    goto LAB_10;

-  }

-  NsiFreeTable(local_150,local_148,0,0);

-  local_150 = 0;

-  local_148 = 0;

-  AcquireSRWLockExclusive((PSRWLOCK)&DAT_11);

-  if ((DAT_12 == cVar7) && (DAT_1801366eb == cVar12)) {

-    if (DAT_14 == cVar10) goto LAB_18007e7a3;

   }

   else {

-    DAT_12 = cVar7;

-    DAT_15 = cVar12;

-    FUN_1800ace3c();

-    cVar10 = DAT_14;

+    memset(local_c8,0,0x80);

+    if (DAT_10 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+    }

+    if (5 < DAT_11) {

+      if (((_DAT_12 & 0x400000000000) == 0) ||

+         (bVar4 = true, (DAT_13 & 0x400000000000) != DAT_13)) {

+        bVar4 = false;

+      }

+      if (bVar4) {

+        local_118 = &local_150;

+        local_150 = 1;

+        local_110 = 8;

+        local_108 = "DnsGetPolicyTableInfoPrivate";

+        local_100 = 0x1d;

+        local_f8 = "FALSE";

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_d8 = local_148;

+        local_148[0] = 0x1000000;

+        local_d0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_14,0,7,local_138);

+      }

+    }

+    iVar2 = 0x78;

   }

-  DAT_14 = cVar10;

-  FUN_18007e9c0();

-LAB_13:

-  ReleaseSRWLockExclusive((PSRWLOCK)&DAT_11);

-  iVar5 = 0;

-  if (iVar3 != 0) {

-    iVar5 = iVar3;

+LAB_4:

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x4e,0x18010c2f0,iVar2);

   }

-  if (iVar4 != 0) {

-    iVar5 = iVar4;

-  }

-  return iVar5;

+  return unaff_RSI;

 }
```

## `DnsAddrArrayAddAddr`  (modified)

```diff
--- DnsAddrArrayAddAddr
+++ DnsAddrArrayAddAddr
@@ -1,10 +1,74 @@
 

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

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

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

 

 undefined8 DnsAddrArrayAddAddr(uint *param_1,ushort *param_2,uint param_3,uint param_4)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  undefined8 uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

+  

+                    /* 0x67f70  22  DnsAddrArrayAddAddr */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800104a0(param_1,param_2,param_3,param_4);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsAddrArrayAddAddr";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x14;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0;

+  }

+  return uVar2;

 }
```

## `DnsDhcpRegisterHostAddrs`  (modified)

```diff
--- DnsDhcpRegisterHostAddrs
+++ DnsDhcpRegisterHostAddrs
@@ -1,13 +1,93 @@
+

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

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

 

 ulonglong DnsDhcpRegisterHostAddrs(wchar_t *param_1)

 

 {

-  ushort in_DX;

-  ulonglong unaff_RBX;

-  undefined4 in_R9D;

-  ULONGLONG unaff_R13;

+  bool bVar1;

+  ulonglong uVar2;

+  uint uVar3;

+  uint uVar4;

+  LPCSTR unaff_retaddr;

+  longlong in_stack_00000038;

+  longlong *in_stack_00000040;

+  uint in_stack_00000050;

+  undefined1 auStackY_168 [32];

+  undefined8 local_128;

+  undefined8 local_120;

+  _EVENT_DATA_DESCRIPTOR local_118 [2];

+  undefined8 *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  undefined8 local_c8 [2];

+  undefined8 *local_b8;

+  undefined4 local_b0;

+  undefined4 local_ac;

+  short local_a8 [64];

+  ulonglong local_28;

   

-  FUN_1800f658c((short)param_1,in_DX,unaff_R13,in_R9D);

-  return unaff_RBX & 0xffffffff;

+                    /* 0x97000  68  DnsDhcpRegisterHostAddrs */

+  local_28 = DAT_0 ^ (ulonglong)auStackY_168;

+  if (DAT_1 == 0) {

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800e738c();

+    }

+    uVar3 = in_stack_00000050 | 2;

+    if (in_stack_00000038 == 0) {

+      uVar3 = in_stack_00000050;

+    }

+    uVar4 = uVar3 | 0x100;

+    if ((uVar3 >> 9 & 1) != 0) {

+      uVar4 = uVar3;

+    }

+    if ((in_stack_00000040 != (longlong *)0x0) && (*in_stack_00000040 != 0)) {

+      uVar4 = uVar4 | 0x1000;

+    }

+    uVar2 = FUN_1800570f4(param_1,uVar4);

+    uVar2 = uVar2 & 0xffffffff;

+    FUN_1800570cc(in_stack_00000040);

+  }

+  else {

+    memset(local_a8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_ec = 0;

+        local_f8 = &local_128;

+        local_dc = 0;

+        local_cc = 0;

+        local_e8 = "DnsDhcpRegisterHostAddrs";

+        local_d8 = "FALSE";

+        local_128 = 1;

+        local_f0 = 8;

+        local_e0 = 0x19;

+        local_d0 = 6;

+        FUN_180055600(local_c8,(undefined *)local_a8);

+        local_ac = 0;

+        local_b8 = &local_120;

+        local_120 = 0x1000000;

+        local_b0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_118);

+      }

+    }

+    uVar2 = 0x78;

+  }

+  return uVar2;

 }
```

## `DnsBuildDotHost`  (modified)

```diff
--- DnsBuildDotHost
+++ DnsBuildDotHost
@@ -1,10 +1,74 @@
 

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

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

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

 

-STRSAFE_LPWSTR DnsBuildDotHost(wchar_t *param_1,ushort param_2,undefined8 *param_3)

+wchar_t * DnsBuildDotHost(undefined *param_1,ushort param_2,undefined8 *param_3)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  wchar_t *pwVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

+  

+                    /* 0x96780  37  DnsBuildDotHost */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    pwVar2 = FUN_1800ca7e0(param_1,param_2,param_3);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsBuildDotHost";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x10;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    pwVar2 = (wchar_t *)0x78;

+  }

+  return pwVar2;

 }
```

## `DnsDhcpSrvRegisterHostAddr`  (modified)

```diff
--- DnsDhcpSrvRegisterHostAddr
+++ DnsCreateStringCopy
@@ -1,93 +1,74 @@
 

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

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

 

-ulonglong DnsDhcpSrvRegisterHostAddr(longlong param_1)

+LPVOID DnsCreateStringCopy(void *param_1,uint param_2)

 

 {

   bool bVar1;

-  ulonglong uVar2;

-  uint uVar3;

+  LPVOID pvVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_158 [32];

-  undefined8 local_128;

-  undefined8 local_120;

-  _EVENT_DATA_DESCRIPTOR local_118;

-  undefined8 local_108;

-  undefined8 local_100;

-  undefined8 *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

-  char *local_e8;

-  undefined8 uStack_e0;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

   char *local_d8;

-  undefined8 uStack_d0;

-  undefined8 local_c8;

-  undefined8 uStack_c0;

-  undefined8 *local_b8;

-  ulonglong uStack_b0;

-  undefined4 local_a8;

-  undefined4 local_a4;

-  undefined8 local_a0;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x971f0  72  DnsDhcpSrvRegisterHostAddr */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

+                    /* 0x96ea0  63  DnsCreateStringCopy */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    memset(&local_118,0,0x80);

-    local_f8 = *(undefined8 **)(param_1 + 0x20);

-    local_e8 = *(char **)(param_1 + 0x30);

-    uStack_e0 = *(undefined8 *)(param_1 + 0x38);

-    local_a8 = 0;

-    local_d8 = *(char **)(param_1 + 0x40);

-    uStack_d0 = *(undefined8 *)(param_1 + 0x48);

-    local_a0 = 0;

-    local_a4 = 0;

-    local_f0 = *(undefined4 *)(param_1 + 0x28);

-    local_ec = *(undefined4 *)(param_1 + 0x2c);

-    local_108 = *(undefined8 *)(param_1 + 8);

-    local_100 = *(undefined8 *)(param_1 + 0x18);

-    local_c8 = *(undefined8 *)(param_1 + 0x50);

-    uStack_c0 = *(undefined8 *)(param_1 + 0x58);

-    local_118.Ptr._4_4_ = *(undefined4 *)(param_1 + 4);

-    local_b8 = *(undefined8 **)(param_1 + 0x60);

-    uStack_b0 = *(undefined8 *)(param_1 + 0x68);

-    local_118.Ptr._0_4_ = 0x80;

-    uVar2 = DnsDhcpSrvRegisterHostAddrEx((int *)&local_118);

+    pvVar2 = FUN_1800cbb08(param_1,param_2);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

-        local_ec = 0;

-        local_f8 = &local_128;

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

         uVar3 = 8;

-        local_128 = 1;

-        local_e8 = "DnsDhcpSrvRegisterHostAddr";

-        local_d8 = "FALSE";

-        local_f0 = 8;

-        uStack_e0 = 0x1b;

-        uStack_d0 = 6;

-        FUN_180055600(&local_c8,(undefined *)local_98);

-        local_b8 = &local_120;

-        uStack_b0 = (ulonglong)uVar3;

-        local_120 = 0x1000000;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,&local_118);

+        local_118 = 1;

+        local_d8 = "DnsCreateStringCopy";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x14;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0x78;

+    pvVar2 = (LPVOID)0x0;

   }

-  return uVar2;

+  return pvVar2;

 }
```

## `AdaptiveTimeout_ResetAdaptiveTimeout`  (modified)

```diff
--- AdaptiveTimeout_ResetAdaptiveTimeout
+++ AdaptiveTimeout_ResetAdaptiveTimeout
@@ -1,60 +1,83 @@
 

-/* WARNING: Instruction at (ram,0x00018007b2a1) overlaps instruction at (ram,0x00018007b2a0)

-    */

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

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

 

-undefined8 AdaptiveTimeout_ResetAdaptiveTimeout(void)

+void AdaptiveTimeout_ResetAdaptiveTimeout(void)

 

 {

-  byte bVar1;

-  int in_EAX;

-  byte *pbVar2;

-  byte *pbVar3;

-  byte in_CL;

-  ulonglong uVar4;

-  PCEVENT_DESCRIPTOR in_RDX;

-  longlong unaff_RBP;

-  byte in_R8B;

-  byte in_R9B;

-  byte *in_R10;

-  bool in_ZF;

-  char in_SF;

-  char in_OF;

+  bool bVar1;

+  int iVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  if (in_ZF || in_OF != in_SF) {

-    pbVar3 = (byte *)(ulonglong)(in_EAX + 2);

-    while ((char)in_CL < '\0') {

-      bVar1 = *pbVar3;

-      while ((char)bVar1 < '\0') {

-        if (bVar1 != 0x80) goto LAB_0;

-        pbVar2 = pbVar3 + 1;

-        pbVar3 = pbVar3 + 1;

-        bVar1 = *pbVar2;

+                    /* 0x7eff0  12  AdaptiveTimeout_ResetAdaptiveTimeout */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    EnterCriticalSection((LPCRITICAL_SECTION)&DAT_2);

+    if (DAT_3 != (void *)0x0) {

+      if (DAT_4 != (void *)0x0) {

+        memset(DAT_4,0,0x7d4);

       }

-      if ((in_R8B != 9) || (2 < (byte)(bVar1 + 0x8f))) break;

-      uVar4 = (ulonglong)in_R9B;

-      in_R9B = in_R9B + 1;

-      *(byte *)(unaff_RBP + 0xd + uVar4 * 0x10) = bVar1;

-      if (in_R10 <= pbVar3) break;

-      do {

-        pbVar2 = pbVar3;

-        pbVar3 = pbVar2 + 1;

-      } while (*pbVar2 != 0);

-      bVar1 = pbVar2[1];

-      if (-1 < (char)bVar1) break;

-      in_R8B = bVar1 & 0x7f;

-      pbVar3 = pbVar2 + 3;

-      in_CL = pbVar2[2];

+      memset(DAT_3,0,0x48);

+      DAT_5 = 1000;

     }

-LAB_0:

-    in_RDX = (PCEVENT_DESCRIPTOR)&stack0x00000058;

-    if (in_R9B == 0) {

-      EventWriteTransfer(DAT_1,in_RDX,(LPCGUID)0x0,(LPCGUID)0x0,7,

-                         (PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -0x20));

-      return 0x78;

-    }

+    LeaveCriticalSection((LPCRITICAL_SECTION)&DAT_2);

+    return;

   }

-  FUN_1800e3380(0x180135218,(undefined8 *)in_RDX,7,unaff_RBP + -0x20,in_R9B);

-  return 0x78;

+  memset(local_98,0,0x80);

+  if (DAT_6 != 0) {

+    FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  }

+  if (DAT_7 < 6) {

+    return;

+  }

+  if (((_DAT_8 & 0x400000000000) == 0) ||

+     ((DAT_9 & 0x400000000000) != DAT_9)) {

+    bVar1 = false;

+  }

+  else {

+    bVar1 = true;

+  }

+  if (!bVar1) {

+    return;

+  }

+  local_dc = 0;

+  local_e8 = &local_118;

+  local_cc = 0;

+  local_bc = 0;

+  uVar3 = 8;

+  local_118 = 1;

+  local_d8 = "AdaptiveTimeout_ResetAdaptiveTimeout";

+  local_c8 = "FALSE";

+  local_e0 = 8;

+  local_d0 = 0x25;

+  local_c0 = 6;

+  FUN_180055600(local_b8,(undefined *)local_98);

+  local_9c = 0;

+  local_a8 = &local_110;

+  local_110 = 0x1000000;

+  local_a0 = uVar3;

+  FUN_1800e3690(0x180135218,&DAT_10,0,7,local_108);

+  return;

 }
```

## `DnsGetZtConfig`  (modified)

```diff
--- DnsGetZtConfig
+++ DnsGetZtConfig
@@ -1,13 +1,114 @@
 

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

+/* WARNING: Removing unreachable block (ram,0x00018009e7f8) */

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

 

 ulonglong DnsGetZtConfig(int param_1,uint param_2,undefined8 *param_3)

 

 {

-  ulonglong unaff_RBX;

-  longlong unaff_RBP;

+  bool bVar1;

+  LPVOID pvVar2;

+  ulonglong uVar3;

+  CLIENT_CALL_RETURN CVar4;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_188 [32];

+  undefined8 in_stack_fffffffffffffe98;

+  longlong local_140 [2];

+  LPVOID local_130;

+  uint local_128 [4];

+  _EVENT_DATA_DESCRIPTOR local_118 [2];

+  LPVOID *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  undefined8 local_c8 [2];

+  uint *local_b8;

+  undefined4 local_b0;

+  undefined4 local_ac;

+  short local_a8 [64];

+  ulonglong local_28;

   

-  *(char *)(unaff_RBP + -0xf) = *(char *)(unaff_RBP + -0xf) << ((byte)param_1 & 0x1f);

-  return unaff_RBX;

+                    /* 0x9e5c0  136  DnsGetZtConfig */

+  local_28 = DAT_0 ^ (ulonglong)auStackY_188;

+  local_128[0] = param_2;

+  local_140[0] = 0;

+  local_140[1] = 0;

+  pvVar2 = (LPVOID)0x0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800e4f7c(0x40b,10,0x180111be8,param_1,

+                  CONCAT44((int)((ulonglong)in_stack_fffffffffffffe98 >> 0x20),param_2),param_3);

+  }

+  if ((param_3 != (undefined8 *)0x0) && (*param_3 = 0, param_3 != (undefined8 *)0x0)) {

+    if (DAT_2 != 0) {

+      memset(local_a8,0,0x80);

+      if (DAT_3 != 0) {

+        FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

+      }

+      if (5 < DAT_4) {

+        if (((_DAT_5 & 0x400000000000) == 0) ||

+           ((DAT_6 & 0x400000000000) != DAT_6)) {

+          bVar1 = false;

+        }

+        else {

+          bVar1 = true;

+        }

+        if (bVar1) {

+          local_130 = (LPVOID)0x1;

+          local_f8 = &local_130;

+          local_f0 = 8;

+          local_ec = 0;

+          local_e8 = "DnsGetZtConfig";

+          local_e0 = 0xf;

+          local_dc = 0;

+          local_d8 = "FALSE";

+          local_d0 = 6;

+          local_cc = 0;

+          FUN_180055600(local_c8,(undefined *)local_a8);

+          local_128[0] = 0x1000000;

+          local_128[1] = 0;

+          local_b8 = local_128;

+          local_b0 = 8;

+          local_ac = 0;

+          FUN_1800e3690(0x180135218,&DAT_7,0,7,local_118);

+        }

+      }

+      return 0x78;

+    }

+    if ((param_1 == 1) && (param_2 < 2)) {

+      pvVar2 = FUN_18008a630(0x40);

+      local_130 = pvVar2;

+      if (pvVar2 == (LPVOID)0x0) {

+        CVar4.Simple = 0xe;

+      }

+      else {

+        uVar3 = FUN_18002ddc4(local_140);

+        CVar4.Simple = uVar3 & 0xffffffff;

+        if ((int)uVar3 == 0) {

+          CVar4 = NdrClientCall3((MIDL_STUBLESS_PROXY_INFO *)&PTR_PTR_1800ff490,0x23,(void *)0x0);

+          if ((int)CVar4.Simple == 0) {

+            *param_3 = pvVar2;

+            pvVar2 = (LPVOID)0x0;

+          }

+          else if ((DAT_1 & 8) != 0) {

+            FUN_1800f658c(0x40b,0xc,0x180111be8,(int)CVar4.Simple);

+          }

+        }

+        else if ((DAT_1 & 8) != 0) {

+          FUN_1800f658c(0x40b,0xb,0x180111be8,(int)uVar3);

+        }

+      }

+      goto LAB_8;

+    }

+  }

+  CVar4.Simple = 0x57;

+LAB_8:

+  FUN_18002dd44(local_140);

+  DnsFreeZtConfig(pvVar2);

+  return CVar4.Simple & 0xffffffff;

 }
```

## `DnsConnectionDeletePolicyEntriesPrivate`  (modified)

```diff
--- DnsConnectionDeletePolicyEntriesPrivate
+++ DnsConnectionDeletePolicyEntriesPrivate
@@ -1,25 +1,50 @@
 

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

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

 

-ulong DnsConnectionDeletePolicyEntriesPrivate

-                (DNS_CONNECTION_POLICY_TAG param_1,int param_2,_GUID *param_3,_GUID *param_4)

+undefined8

+DnsConnectionDeletePolicyEntriesPrivate

+          (uint param_1,uint param_2,undefined8 param_3,PSRWLOCK param_4)

 

 {

-  undefined4 in_register_0000000c;

-  undefined8 *puVar1;

-  undefined4 in_register_00000014;

-  undefined *puVar2;

-  longlong *unaff_RBP;

+  int iVar1;

+  undefined8 uVar2;

+  short *_Dst;

+  short *psVar3;

+  short *unaff_retaddr;

+  undefined1 auStackY_108 [32];

+  undefined8 local_c8;

+  short *local_c0;

+  char *local_b8;

+  char *local_b0;

+  undefined8 local_a8 [2];

+  short local_98 [64];

+  ulonglong local_18;

   

-  puVar2 = (undefined *)CONCAT44(in_register_00000014,param_2);

-  puVar1 = (undefined8 *)CONCAT44(in_register_0000000c,param_1);

-                    /* WARNING: Call to offcut address within same function */

-  func_0x00018007e38b();

-  FUN_180055600(puVar1,puVar2);

-  unaff_RBP[-0xe] = 0x1000000;

-  *unaff_RBP = (longlong)(unaff_RBP + -0xe);

-  unaff_RBP[1] = 8;

-  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -0xc));

-  return 0x78;

+                    /* 0x821d0  44  DnsConnectionDeletePolicyEntriesPrivate */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_108;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar1 = FUN_1800ca394((LPCSTR)unaff_retaddr), iVar1 == 0)) {

+    _Dst = local_98;

+    psVar3 = (short *)0x80;

+    memset(_Dst,0,0x80);

+    if (DAT_2 != 0) {

+      psVar3 = local_98;

+      FUN_1800ca1b8((LPCSTR)unaff_retaddr,0,psVar3,0x40);

+      _Dst = unaff_retaddr;

+    }

+    if (((5 < DAT_3) && ((_DAT_180135228 & 0x400000000000) != 0)) &&

+       ((DAT_4 & 0x400000000000) == DAT_4)) {

+      local_c0 = local_98;

+      local_c8 = 0x1000000;

+      local_a8[0] = 1;

+      local_b8 = "FALSE";

+      local_b0 = "DnsConnectionDeletePolicyEntriesPrivate";

+      FUN_18000103c(_Dst,&DAT_5,psVar3,local_a8,&local_b0,&local_b8,&local_c0,&local_c8);

+    }

+    return 0x78;

+  }

+  uVar2 = FUN_1800b6b28((ulonglong)param_1,param_2,param_3,param_4);

+  return uVar2;

 }
```

## `DnsDhcpRegisterHostAddrs`  (modified)

```diff
--- DnsDhcpRegisterHostAddrs
+++ DnsCreateStandardDnsNameCopy
@@ -1,93 +1,74 @@
 

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

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

 

-ulonglong DnsDhcpRegisterHostAddrs(wchar_t *param_1)

+LPVOID DnsCreateStandardDnsNameCopy(LPCWSTR param_1,uint param_2,undefined8 param_3)

 

 {

   bool bVar1;

-  ulonglong uVar2;

-  uint uVar3;

-  uint uVar4;

+  LPVOID pvVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  longlong in_stack_00000038;

-  longlong *in_stack_00000040;

-  uint in_stack_00000050;

-  undefined1 auStackY_168 [32];

-  undefined8 local_128;

-  undefined8 local_120;

-  _EVENT_DATA_DESCRIPTOR local_118 [2];

-  undefined8 *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

-  char *local_e8;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

-  undefined8 local_c8 [2];

-  undefined8 *local_b8;

-  undefined4 local_b0;

-  undefined4 local_ac;

-  short local_a8 [64];

-  ulonglong local_28;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-                    /* 0x97000  68  DnsDhcpRegisterHostAddrs */

-  local_28 = DAT_0 ^ (ulonglong)auStackY_168;

+                    /* 0x96d40  62  DnsCreateStandardDnsNameCopy */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    if ((DAT_2 & 8) != 0) {

-      FUN_1800e738c();

-    }

-    uVar3 = in_stack_00000050 | 2;

-    if (in_stack_00000038 == 0) {

-      uVar3 = in_stack_00000050;

-    }

-    uVar4 = uVar3 | 0x100;

-    if ((uVar3 >> 9 & 1) != 0) {

-      uVar4 = uVar3;

-    }

-    if ((in_stack_00000040 != (longlong *)0x0) && (*in_stack_00000040 != 0)) {

-      uVar4 = uVar4 | 0x1000;

-    }

-    uVar2 = FUN_1800570f4(param_1,uVar4);

-    uVar2 = uVar2 & 0xffffffff;

-    FUN_1800570cc(in_stack_00000040);

+    pvVar2 = FUN_1800cc7e8(param_1,param_2,param_3);

   }

   else {

-    memset(local_a8,0,0x80);

-    if (DAT_3 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         ((DAT_6 & 0x400000000000) != DAT_6)) {

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

-        local_ec = 0;

-        local_f8 = &local_128;

         local_dc = 0;

+        local_e8 = &local_118;

         local_cc = 0;

-        local_e8 = "DnsDhcpRegisterHostAddrs";

-        local_d8 = "FALSE";

-        local_128 = 1;

-        local_f0 = 8;

-        local_e0 = 0x19;

-        local_d0 = 6;

-        FUN_180055600(local_c8,(undefined *)local_a8);

-        local_ac = 0;

-        local_b8 = &local_120;

-        local_120 = 0x1000000;

-        local_b0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_118);

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsCreateStandardDnsNameCopy";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x1d;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0x78;

+    pvVar2 = (LPVOID)0x0;

   }

-  return uVar2;

+  return pvVar2;

 }
```

## `DnsCleanupTcpConnections`  (modified)

```diff
--- DnsCleanupTcpConnections
+++ DnsAsyncRegisterHostAddrs
@@ -1,69 +1,70 @@
 

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

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

 

-void DnsCleanupTcpConnections(void)

+ulonglong DnsAsyncRegisterHostAddrs(wchar_t *param_1)

 

 {

-  bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  LPCWSTR pWVar1;

+  uint uVar2;

+  DWORD DVar3;

+  HANDLE hObject;

+  undefined4 extraout_var;

+  LPVOID unaff_RBX;

+  ulonglong uVar4;

+  LPWSTR unaff_RBP;

+  int unaff_EDI;

+  uint in_stack_00000040;

   

-                    /* 0x968e0  42  DnsCleanupTcpConnections */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 != 0) {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  if ((DAT_0 & 8) != 0) {

+    FUN_1800e6c00();

+  }

+  *(int *)((longlong)unaff_RBX + 0x1c) = unaff_EDI;

+  if (unaff_EDI == 1) {

+    *(ulonglong *)((longlong)unaff_RBX + 0x68) =

+         *(ulonglong *)((longlong)unaff_RBX + 0x68) & (ulonglong)unaff_RBP;

+  }

+  else if (unaff_EDI - 2U < 2) {

+    pWVar1 = *(LPCWSTR *)((longlong)unaff_RBX + 8);

+    if (pWVar1 == (LPCWSTR)0x0) {

+      return 0x57;

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "DnsCleanupTcpConnections";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x19;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

+    uVar4 = 0xffffffffffffffff;

+    do {

+      uVar4 = uVar4 + 1;

+    } while (*(char *)((longlong)pWVar1 + uVar4) != (char)unaff_RBP);

+    in_stack_00000040 = (int)(uVar4 & 0xffff) * 2 + 2;

+    unaff_RBP = FUN_18008a630((ulonglong)in_stack_00000040);

+    if (unaff_RBP == (LPWSTR)0x0) {

+      return 0xe;

     }

+    uVar2 = FUN_18002c5e0(unaff_RBP,&stack0x00000040,pWVar1,uVar4 & 0xffff,unaff_EDI,1);

+    if (uVar2 == 0) {

+      uVar4 = 0x7b;

+      goto LAB_1;

+    }

+    *(LPWSTR *)((longlong)unaff_RBX + 8) = unaff_RBP;

+    *(LPCWSTR *)((longlong)unaff_RBX + 0x68) = pWVar1;

   }

-  return;

+  if (*(longlong *)((longlong)unaff_RBX + 0x40) == 0) {

+    DVar3 = FUN_180093220((longlong)unaff_RBX);

+    return CONCAT44(extraout_var,DVar3);

+  }

+  hObject = CreateThread((LPSECURITY_ATTRIBUTES)0x0,0,FUN_180093220,unaff_RBX,0,

+                         (LPDWORD)&stack0x00000044);

+  if (hObject != (HANDLE)0x0) {

+    CloseHandle(hObject);

+    return 0x3e5;

+  }

+  DVar3 = GetLastError();

+  if ((DAT_2 & 0x80) != 0) {

+    FUN_1800f658c(0x41f,0x74,0x18010fd18,DVar3);

+  }

+  uVar4 = (ulonglong)DVar3;

+  if (DVar3 == 0) {

+    uVar4 = 0xe;

+  }

+LAB_1:

+  DnsApiFree(unaff_RBP);

+  return uVar4;

 }
```

## `Dns_SetRecordDatalength`  (modified)

```diff
--- Dns_SetRecordDatalength
+++ Dns_SetRecordDatalength
@@ -1,55 +1,72 @@
 

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

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

 

-undefined8 Dns_SetRecordDatalength(longlong param_1,ushort param_2)

+void Dns_SetRecordDatalength(longlong param_1,ushort param_2)

 

 {

-  char *pcVar1;

-  bool bVar2;

-  undefined6 in_register_00000012;

-  longlong unaff_RBP;

-  undefined4 uVar3;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  pcVar1 = (char *)(unaff_RBP + 0x48 + CONCAT62(in_register_00000012,param_2));

-  *pcVar1 = *pcVar1 + (char)(param_2 >> 8);

-  FUN_1800ca1b8((LPCSTR)(ulonglong)*(uint *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40);

-  if (5 < DAT_0) {

-    if (((_DAT_1 & 0x400000000000) == 0) ||

-       ((DAT_2 & 0x400000000000) != DAT_2)) {

-      bVar2 = false;

+                    /* 0x9c520  290  Dns_SetRecordDatalength */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    *(ushort *)(param_1 + 8) = param_2 >> 8 | param_2 << 8;

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    else {

-      bVar2 = true;

-    }

-    if (bVar2) {

-      uStack000000000000006c = 0;

-      puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-      uStack000000000000007c = 0;

-      *(undefined4 *)(unaff_RBP + -0x74) = 0;

-      uVar3 = 8;

-      uStack0000000000000030 = 1;

-      pcStack0000000000000070 = "DnsAsyncRegisterInit";

-      *(char **)(unaff_RBP + -0x80) = "FALSE";

-      uStack0000000000000068 = 8;

-      uStack0000000000000078 = 0x15;

-      *(undefined4 *)(unaff_RBP + -0x78) = 6;

-      FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-      *(undefined4 *)(unaff_RBP + -0x54) = 0;

-      *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-      *(undefined4 *)(unaff_RBP + -0x58) = uVar3;

-      uStack0000000000000038 = 0x1000000;

-      FUN_1800e3690(0x180135218,&DAT_3,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_SetRecordDatalength";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x18;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

     }

   }

-  return 0x78;

+  return;

 }
```

## `DnsAllocateRecord`  (modified)

```diff
--- DnsAllocateRecord
+++ CombineRecordsInBlob
@@ -1,46 +1,31 @@
 

-LPVOID DnsAllocateRecord(ushort param_1)

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

+

+uint CombineRecordsInBlob(longlong param_1,undefined8 *param_2)

 

 {

   uint uVar1;

-  u_short uVar2;

-  u_short *puVar3;

-  undefined6 in_register_0000000a;

-  u_short *puVar4;

-  uint *in_RDX;

-  WCHAR *in_R8;

-  u_short in_R9W;

-  u_short in_stack_00000028;

-  int in_stack_00000030;

+  int unaff_EBX;

+  LPCWSTR unaff_RDI;

+  uint uStack0000000000000030;

   

-                    /* 0x91900  252  DnsWriteQuestionToBuffer_W */

-  puVar4 = (u_short *)CONCAT62(in_register_0000000a,param_1);

-  uVar1 = *in_RDX;

-  if (uVar1 < 0x5c0) {

-    *in_RDX = 0x5c0;

+  if ((int)param_2 == 6) {

+    uStack0000000000000030 = 0x208;

+    memset(&stack0x00000040,0,0x208);

+    uVar1 = FUN_18002c5e0((LPWSTR)&stack0x00000040,&stack0x00000030,unaff_RDI,0,3,1);

+    if (uVar1 != 0) {

+      uVar1 = DnsValidateName_W((wchar_t *)&stack0x00000040,unaff_EBX,unaff_RDI);

+      return uVar1;

+    }

   }

   else {

-    puVar4[0] = 0;

-    puVar4[1] = 0;

-    puVar4[2] = 0;

-    puVar4[3] = 0;

-    puVar4[4] = 0;

-    puVar4[5] = 0;

-    puVar3 = FUN_1800d3f10(puVar4 + 6,(u_short *)((longlong)puVar4 + (ulonglong)uVar1),in_R8,

-                           (WCHAR *)0x0,0,1);

-    if (puVar3 != (u_short *)0x0) {

-      uVar2 = htons(in_R9W);

-      *puVar3 = uVar2;

-      puVar3[1] = 0x100;

-      uVar2 = htons(1);

-      puVar4[2] = uVar2;

-      *(byte *)(puVar4 + 1) = in_stack_00000030 != 0 | (byte)puVar4[1] & 0xfe;

-      uVar2 = htons(in_stack_00000028);

-      *puVar4 = uVar2;

-      *in_RDX = ((int)puVar3 - (int)puVar4) + 4;

-      return (LPVOID)0x1;

+    uStack0000000000000030 = 0x104;

+    uVar1 = FUN_18002c5e0((LPWSTR)&stack0x00000040,&stack0x00000030,unaff_RDI,0,3,2);

+    if (uVar1 != 0) {

+      uVar1 = FUN_18002b380((LPCWSTR)&stack0x00000040,unaff_EBX,0,0);

+      return uVar1;

     }

   }

-  return (LPVOID)0x0;

+  return 0x7b;

 }
```

## `NetInfo_IsTcpipConfigChange`  (modified)

```diff
--- NetInfo_IsTcpipConfigChange
+++ NetInfo_IsTcpipConfigChange
@@ -1,15 +1,94 @@
 

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

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

 

 PCNZWCH NetInfo_IsTcpipConfigChange(longlong param_1)

 

 {

-  uint unaff_EBX;

+  bool bVar1;

+  int iVar2;

+  PCNZWCH pWVar3;

+  PCNZWCH pWVar4;

+  PCNZWCH pWVar5;

+  uint uVar6;

+  longlong lVar8;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_168 [32];

+  undefined8 local_138;

+  undefined8 local_130;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  undefined8 local_d8 [2];

+  undefined8 *local_c8;

+  undefined8 local_c0;

+  short local_b8 [64];

+  ulonglong local_38;

+  PCNZWCH pWVar7;

   

-  NetInfo_Free((longlong *)param_1);

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x2f,0x180111c20,unaff_EBX);

+                    /* 0x6ed50  323  NetInfo_IsTcpipConfigChange */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

+  pWVar5 = (PCNZWCH)0x0;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 == 0)) {

+    memset(local_b8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_108 = &local_138;

+        local_138 = 1;

+        local_100 = 8;

+        local_f8 = "NetInfo_IsTcpipConfigChange";

+        local_f0 = 0x1c;

+        local_e8 = "FALSE";

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_c8 = &local_130;

+        local_130 = 0x1000000;

+        local_c0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_128);

+      }

+    }

+    return (PCNZWCH)0x0;

   }

-  return (PCNZWCH)(ulonglong)unaff_EBX;

+  pWVar4 = pWVar5;

+  pWVar3 = pWVar5;

+  if ((param_1 != 0) &&

+     (pWVar4 = (PCNZWCH)0x0, pWVar3 = (PCNZWCH)0x0, pWVar7 = pWVar5, *(int *)(param_1 + 0x44) != 0))

+  {

+    do {

+      lVar8 = (longlong)pWVar7 * 0xa0;

+      if (*(int *)(lVar8 + 0xa4 + param_1) - 0xf3U < 2) {

+        pWVar3 = FUN_1800508ec(*(longlong *)(lVar8 + 0x68 + param_1),0);

+        pWVar4 = FUN_1800508ec(*(longlong *)(lVar8 + 0x68 + param_1),1);

+        iVar2 = FUN_180034b60(pWVar3,*(PCNZWCH *)(lVar8 + 0xe8 + param_1));

+        if ((iVar2 != 0) ||

+           (iVar2 = FUN_180034b60(pWVar4,*(PCNZWCH *)(lVar8 + 0xf0 + param_1)), iVar2 != 0)) {

+          pWVar5 = (PCNZWCH)0x1;

+          goto LAB_7;

+        }

+        DnsApiFree(pWVar3);

+        DnsApiFree(pWVar4);

+      }

+      uVar6 = (int)pWVar7 + 1;

+      pWVar7 = (PCNZWCH)(ulonglong)uVar6;

+    } while (uVar6 < *(uint *)(param_1 + 0x44));

+    pWVar3 = (PCNZWCH)0x0;

+    pWVar4 = (PCNZWCH)0x0;

+  }

+LAB_7:

+  DnsApiFree(pWVar3);

+  DnsApiFree(pWVar4);

+  return pWVar5;

 }
```

## `Dns_InitializeMsgBuf`  (modified)

```diff
--- Dns_InitializeMsgBuf
+++ Dns_AllocateMsgBuf
@@ -1,64 +1,10 @@
 

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

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

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

 

-ulonglong Dns_InitializeMsgBuf(longlong param_1)

+LPVOID Dns_AllocateMsgBuf(ushort param_1)

 

 {

-  bool bVar1;

-  int in_EAX;

-  ulonglong uVar2;

-  int in_EDX;

-  longlong unaff_RBP;

-  undefined4 uVar3;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

-  

-  *(ulonglong *)(unaff_RBP + 0x30) = (ulonglong)(in_EAX + 0xcce5b) ^ (ulonglong)&stack0x00000000;

-  if (DAT_0 == 0) {

-    uVar2 = FUN_1800b50a8(param_1,in_EDX);

-  }

-  else {

-    memset((void *)(unaff_RBP + -0x50),0,0x80);

-    if (DAT_1 != 0) {

-      FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40);

-    }

-    if (5 < DAT_2) {

-      if (((_DAT_3 & 0x400000000000) == 0) ||

-         ((DAT_4 & 0x400000000000) != DAT_4)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        uStack000000000000006c = 0;

-        puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-        uStack000000000000007c = 0;

-        *(undefined4 *)(unaff_RBP + -0x74) = 0;

-        uVar3 = 8;

-        uStack0000000000000030 = 1;

-        pcStack0000000000000070 = "DnsDeRegisterLocal";

-        *(char **)(unaff_RBP + -0x80) = "FALSE";

-        uStack0000000000000068 = 8;

-        uStack0000000000000078 = 0x13;

-        *(undefined4 *)(unaff_RBP + -0x78) = 6;

-        FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-        *(undefined4 *)(unaff_RBP + -0x54) = 0;

-        *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-        *(undefined4 *)(unaff_RBP + -0x58) = uVar3;

-        uStack0000000000000038 = 0x1000000;

-        FUN_1800e3690(0x180135218,&DAT_5,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-      }

-    }

-    uVar2 = 0x78;

-  }

-  return uVar2;

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

+  halt_baddata();

 }
```

## `NetInfo_Copy`  (modified)

```diff
--- NetInfo_Copy
+++ NetInfo_Copy
@@ -1,42 +1,74 @@
 

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

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

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

 

 longlong * NetInfo_Copy(longlong *param_1)

 

 {

-  uint uVar1;

-  DWORD DVar2;

-  char *in_RAX;

-  undefined4 extraout_var;

+  bool bVar1;

+  int iVar2;

   longlong *plVar3;

-  undefined4 *in_RDX;

-  longlong *unaff_RBX;

-  ULONGLONG unaff_R13;

-  int unaff_R15D;

-  int in_stack_00000040;

+  undefined4 uVar4;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  uVar1 = in(0x25);

-  *(char *)(ulonglong)uVar1 = *(char *)(ulonglong)uVar1 + (char)uVar1;

-  DVar2 = FUN_180051ec0((int *)param_1,in_RDX);

-  plVar3 = (longlong *)CONCAT44(extraout_var,DVar2);

-  if ((in_stack_00000040 != unaff_R15D) && ((*(uint *)(unaff_RBX + 0x62) & 0x200) == 0)) {

-    *(DWORD *)((longlong)unaff_RBX + 0x1fc) = DVar2;

-    *(DWORD *)((longlong)unaff_RBX + 0x2cc) = DVar2;

-    LOCK();

-    *(uint *)(unaff_RBX + 0x62) = *(uint *)(unaff_RBX + 0x62) | 0x303;

-    UNLOCK();

-    if (*(int *)((longlong)unaff_RBX + 0x1dc) == unaff_R15D) {

-      plVar3 = (longlong *)(*(code *)unaff_RBX[0x8d])();

+                    /* 0x12360  314  NetInfo_Copy */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 == 0)) {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    else {

-      plVar3 = (longlong *)FUN_18002537c(unaff_RBX);

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar4 = 8;

+        local_118 = 1;

+        local_d8 = "NetInfo_Copy";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0xd;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar4;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

     }

+    return (longlong *)0x0;

   }

-  if ((DAT_0 & 8) != 0) {

-    plVar3 = (longlong *)FUN_1800f658c(0x40b,0x196,unaff_R13,DVar2);

-  }

+  plVar3 = FUN_180015030(param_1,1);

   return plVar3;

 }
```

## `DelaySortDAServerlist`  (modified)

```diff
--- DelaySortDAServerlist
+++ DelaySortDAServerlist
@@ -1,181 +1,77 @@
 

-/* WARNING: Instruction at (ram,0x000180079cd3) overlaps instruction at (ram,0x000180079cd2)

-    */

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

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

 

-ulonglong DelaySortDAServerlist(void)

+void DelaySortDAServerlist(void)

 

 {

-  uint *puVar1;

-  longlong lVar2;

-  bool bVar3;

-  longlong lVar4;

-  byte bVar5;

-  uint uVar6;

-  char *pcVar7;

-  char *in_RAX;

-  short *psVar8;

-  longlong in_RCX;

-  longlong in_RDX;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  uint unaff_ESI;

-  uint unaff_EDI;

-  longlong lVar9;

-  uint in_R8D;

-  longlong in_R9;

-  ulonglong in_R10;

-  uint uVar10;

-  uint unaff_R12D;

-  int unaff_R13D;

-  uint unaff_R14D;

-  uint unaff_R15D;

-  int in_stack_00000040;

-  int in_stack_00000044;

-  uint in_stack_00000048;

-  uint uStack000000000000004c;

-  uint in_stack_00000050;

-  int *in_stack_00000058;

-  longlong in_stack_00000060;

-  uint uStack0000000000000068;

+  bool bVar1;

+  int iVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  bVar5 = (byte)in_RAX;

-  *in_RAX = *in_RAX + bVar5;

-  pcVar7 = (char *)(in_RCX + -0x7d);

-  *pcVar7 = *pcVar7 + bVar5;

-  if (in_RCX != 1 && *pcVar7 != '\0') {

-    pcVar7 = (char *)CONCAT62((int6)((ulonglong)in_RAX >> 0x10),(ushort)bVar5);

-    *pcVar7 = *pcVar7 + bVar5;

-    goto code_r0x000180079cc3;

+                    /* 0x7d7b0  19  DelaySortDAServerlist */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    LOCK();

+    UNLOCK();

+    DAT_2 = 1;

+    return;

   }

-  do {

-    *(uint *)(in_RDX + 0xb4 + unaff_RBX) = in_R8D;

-    if ((in_R9 != 0) && (uVar10 = unaff_EDI, unaff_EDI < *(uint *)(in_R9 + 4))) {

-      do {

-        if (((unaff_R15D & in_R8D) == 0) ||

-           ((*(uint *)((ulonglong)uVar10 * 0x40 + 0x48 + in_R9) & unaff_R15D) == 0)) {

-          puVar1 = (uint *)((ulonglong)uVar10 * 0x40 + 0x48 + in_R9);

-          *puVar1 = *puVar1 & 0xfff0ffff;

-          in_R8D = *(uint *)(in_RDX + 0xb4 + unaff_RBX);

-        }

-        uVar10 = uVar10 + 1;

-      } while (uVar10 < *(uint *)(in_R9 + 4));

-    }

-    do {

-      uVar10 = (int)in_R10 + 1;

-      in_R10 = (ulonglong)uVar10;

-      if (*(uint *)(unaff_RBX + 0x44) <= uVar10) {

-        uStack000000000000004c = unaff_EDI;

-        if (*(uint *)(unaff_RBX + 0x44) == 0) goto LAB_0;

-        goto LAB_1;

-      }

-      in_RDX = in_R10 * 0xa0;

-    } while ((*(uint *)(in_RDX + 0xac + unaff_RBX) & 0x10000000) != 0);

-code_r0x000180079cc3:

-    in_R9 = *(longlong *)(in_RDX + 0x90 + unaff_RBX);

-    in_R8D = *(uint *)(in_RDX + 0xb4 + unaff_RBX) & 0xfffffff0;

-  } while( true );

-LAB_1:

-  do {

-    lVar4 = in_stack_00000060;

-    lVar9 = (ulonglong)uStack000000000000004c * 0xa0 + 0x68 + unaff_RBX;

-    lVar2 = *(longlong *)(lVar9 + 0x28);

-    if ((((lVar2 != 0) && ((*(uint *)(lVar9 + 0x4c) & 0x10001000) == 0)) &&

-        ((*(uint *)(lVar9 + 0x44) & 0x10000000) == 0)) &&

-       ((*(char *)(in_stack_00000060 + 0x28b) == '\0' ||

-        ((*(int *)(lVar9 + 0x3c) != 0x17 && (1 < *(int *)(lVar9 + 0x3c) - 0xf3U)))))) {

-      if ((*(uint *)(lVar9 + 0x44) & 0x6000000) == 0) {

-LAB_2:

-        if (unaff_R12D < unaff_R14D) {

-          do {

-            psVar8 = FUN_18004a56c(lVar9,in_stack_00000044);

-            if (psVar8 == (short *)0x0) goto LAB_3;

-            unaff_ESI = FUN_180047404(in_stack_00000060,unaff_RBX,lVar9,psVar8);

-          } while (unaff_ESI != 0);

-          unaff_R13D = unaff_R13D + 1;

-          unaff_EDI = 0;

-          if ((unaff_R12D == 0) && (*(char *)(in_stack_00000060 + 0x28b) == '\0'))

-          goto LAB_0;

-        }

-        else {

-          uVar10 = 0;

-          unaff_R14D = in_stack_00000048;

-          if (*(int *)(lVar2 + 4) != 0) {

-            do {

-              if ((in_stack_00000044 == 0) &&

-                 (uVar6 = FUN_180056f88(uVar10,*(longlong *)(lVar9 + 0x98),*(uint *)(lVar9 + 0x90)),

-                 uVar6 != 0)) {

-                if ((DAT_4 & 8) != 0) {

-                  FUN_1800e551c(0x40b,0x3e,0x18010da00,

-                                (short *)((ulonglong)uVar10 * 0x40 + 0x20 + lVar2));

-                }

-              }

-              else if (((*(uint *)((ulonglong)uVar10 * 0x40 + 0x48 + lVar2) & 0x20000) == 0) &&

-                      (unaff_ESI = FUN_180047404(lVar4,unaff_RBX,lVar9,

-                                                 (short *)((ulonglong)uVar10 * 0x40 + 0x20 + lVar2))

-                      , unaff_ESI == 0)) {

-                unaff_R13D = unaff_R13D + 1;

-              }

-              uVar10 = uVar10 + 1;

-              unaff_R12D = in_stack_00000050;

-            } while (uVar10 < *(uint *)(lVar2 + 4));

-          }

-        }

-      }

-      else if ((*(uint *)(unaff_RBX + 0x3c) & 0x100) == 0) {

-        if ((unaff_R12D != 0) || ((*(uint *)(lVar9 + 0x4c) & 0x20000) != 0)) goto LAB_2;

-        in_stack_00000040 = 1;

-      }

-    }

-LAB_3:

-    uStack000000000000004c = uStack000000000000004c + 1;

-  } while (uStack000000000000004c < *(uint *)(unaff_RBX + 0x44));

-  if ((in_stack_00000040 == 0) || (unaff_R13D != 0)) {

-    unaff_EDI = 0;

-    if (unaff_ESI == 0x2522) {

-      memset((void *)(unaff_RBP + -0x20),0,0x80);

-      if (DAT_5 != 0) {

-        FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0xa8),0,(short *)(unaff_RBP + -0x20),0x40);

-      }

-      if (5 < DAT_6) {

-        if (((_DAT_7 & 0x400000000000) == 0) ||

-           (bVar3 = true, (DAT_8 & 0x400000000000) != DAT_8)) {

-          bVar3 = false;

-        }

-        unaff_EDI = 0;

-        if (bVar3) {

-          in_stack_00000060 = 1;

-          *(longlong **)(unaff_RBP + -0x70) = &stack0x00000060;

-          *(undefined8 *)(unaff_RBP + -0x68) = 8;

-          *(char **)(unaff_RBP + -0x60) = "sendUdpToNextDnsServers";

-          *(undefined8 *)(unaff_RBP + -0x58) = 0x18;

-          *(char **)(unaff_RBP + -0x50) = "status != DNS_REQUEST_PENDING";

-          *(undefined8 *)(unaff_RBP + -0x48) = 0x1e;

-          FUN_180055600((undefined8 *)(unaff_RBP + -0x40),(undefined *)(unaff_RBP + -0x20));

-          _uStack0000000000000068 = 0x1000000;

-          *(uint **)(unaff_RBP + -0x30) = &stack0x00000068;

-          *(undefined8 *)(unaff_RBP + -0x28) = 8;

-          FUN_1800e3690(0x180135218,&DAT_9,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000070);

-        }

-      }

-    }

-LAB_0:

-    *in_stack_00000058 = unaff_R13D;

-    if ((unaff_R13D == 0) && ((unaff_ESI == 0 || (unaff_EDI = unaff_ESI, unaff_ESI == 0x2522)))) {

-      unaff_EDI = 0x5b4;

-    }

-    if ((DAT_4 & 8) != 0) {

-      FUN_1800f8aec(0x40b,0x40,0x18010da00,unaff_R13D);

-    }

+  memset(local_98,0,0x80);

+  if (DAT_3 != 0) {

+    FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  }

+  if (DAT_4 < 6) {

+    return;

+  }

+  if (((_DAT_5 & 0x400000000000) == 0) ||

+     ((DAT_6 & 0x400000000000) != DAT_6)) {

+    bVar1 = false;

   }

   else {

-    unaff_EDI = FUN_180079b94(in_stack_00000060,unaff_RBX,(short *)0x1,uStack0000000000000068,

-                              in_stack_00000044,in_stack_00000058);

-    if ((DAT_4 & 8) != 0) {

-      FUN_1800f8aec(0x40b,0x3f,0x18010da00,0);

-    }

+    bVar1 = true;

   }

-  return (ulonglong)unaff_EDI;

+  if (!bVar1) {

+    return;

+  }

+  local_dc = 0;

+  local_e8 = &local_118;

+  local_cc = 0;

+  local_bc = 0;

+  uVar3 = 8;

+  local_d8 = "DelaySortDAServerlist";

+  local_118 = 1;

+  local_c8 = "FALSE";

+  local_e0 = 8;

+  local_d0 = 0x16;

+  local_c0 = 6;

+  FUN_180055600(local_b8,(undefined *)local_98);

+  local_9c = 0;

+  local_a8 = &local_110;

+  local_110 = 0x1000000;

+  local_a0 = uVar3;

+  FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+  return;

 }
```

## `DnsSetQueryRetryTimeouts`  (modified)

```diff
--- DnsSetQueryRetryTimeouts
+++ DnsScreenLocalAddrsForRegistration
@@ -1,127 +1,110 @@
 

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

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

 

-ulonglong DnsSetQueryRetryTimeouts(uint *param_1,uint param_2,uint *param_3)

+DWORD DnsScreenLocalAddrsForRegistration

+                (undefined4 *param_1,wchar_t *param_2,uint param_3,wchar_t *param_4)

 

 {

   bool bVar1;

-  int iVar2;

-  ulonglong uVar3;

-  ulonglong uVar4;

-  BYTE *pBVar5;

-  BYTE *lpData;

-  longlong lVar6;

+  DWORD DVar2;

+  int iVar3;

+  SOCKADDR_INET *pSVar4;

+  undefined8 uVar5;

+  undefined8 uVar6;

   undefined4 uVar7;

-  uint uVar8;

+  ulonglong uVar8;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_188 [32];

-  HKEY local_158;

-  undefined8 local_150;

-  undefined8 local_148 [2];

-  _EVENT_DATA_DESCRIPTOR local_138 [2];

-  undefined8 *local_118;

-  undefined4 local_110;

-  undefined4 local_10c;

-  char *local_108;

+  undefined1 auStackY_168 [32];

+  undefined8 local_138;

+  undefined8 local_130;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

   undefined4 local_100;

   undefined4 local_fc;

   char *local_f8;

   undefined4 local_f0;

   undefined4 local_ec;

-  undefined8 local_e8 [2];

-  undefined8 *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  short local_c8 [64];

-  ulonglong local_48;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  undefined8 local_d8 [2];

+  undefined8 *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  short local_b8 [64];

+  ulonglong local_38;

   

-                    /* 0x99f80  222  DnsSetQueryRetryTimeouts */

-  local_48 = DAT_0 ^ (ulonglong)auStackY_188;

-  lpData = (BYTE *)0x0;

-  local_158 = (HKEY)0x0;

+                    /* 0x99bc0  205  DnsScreenLocalAddrsForRegistration */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

+  uVar8 = (ulonglong)param_3;

+  memset(local_128,0,0x40);

   if (DAT_1 == 0) {

-    if ((param_2 == 0) || (param_3 == (uint *)0x0)) {

-      uVar3 = 0x57;

+    if ((DAT_2 & 0x80) != 0) {

+      param_4 = param_2;

+      FUN_1800faec4(0x41f,0x15,0x180111af8,param_2,param_1);

+    }

+    memset(param_1,0,uVar8 * 4);

+    uVar6 = 0;

+    pSVar4 = FUN_180013ce4(0x20,0,0,param_4);

+    if (pSVar4 == (SOCKADDR_INET *)0x0) {

+      DVar2 = GetLastError();

+      if (DVar2 == 0) {

+        DVar2 = 0xe;

+      }

     }

     else {

-      uVar4 = FUN_180069150(param_1,1,&local_158);

-      uVar3 = uVar4 & 0xffffffff;

-      lpData = (BYTE *)0x0;

-      if ((int)uVar4 == 0) {

-        lVar6 = (ulonglong)param_2 * 0xb + 1;

-        lpData = FUN_18008a630((ulonglong)(uint)((int)lVar6 * 2));

-        if (lpData == (BYTE *)0x0) {

-          uVar3 = 0xe;

-        }

-        else {

-          uVar8 = 0;

-          pBVar5 = lpData;

-          if (param_2 != 0) {

-            do {

-              iVar2 = FUN_18008bf5c(pBVar5,lVar6,&DAT_2,(ulonglong)*param_3);

-              if (iVar2 < 1) {

-                uVar3 = 0xd;

-                goto LAB_3;

-              }

-              uVar8 = uVar8 + 1;

-              param_3 = param_3 + 1;

-              lVar6 = lVar6 - (iVar2 + 1);

-              pBVar5 = pBVar5 + (longlong)(iVar2 + 1) * 2;

-            } while (uVar8 < param_2);

+      if (param_3 != 0) {

+        do {

+          uVar5 = FUN_18000ec68(local_128,*(short **)param_2,uVar6,param_4,0);

+          if (((int)uVar5 != 0) &&

+             (iVar3 = FUN_1800a05ec((ushort *)local_128,(longlong)pSVar4), iVar3 != 0)) {

+            *param_1 = 1;

           }

-          if (lVar6 == 0) {

-            uVar3 = 0x50c;

-          }

-          else {

-            uVar8 = RegSetValueExW(local_158,L"DNSQueryTimeoutsMB",0,7,lpData,

-                                   (int)((longlong)(pBVar5 + (2 - (longlong)lpData)) >> 1) * 2);

-            uVar3 = (ulonglong)uVar8;

-          }

-        }

+          param_2 = param_2 + 8;

+          param_1 = param_1 + 1;

+          uVar8 = uVar8 - 1;

+        } while (uVar8 != 0);

       }

-    }

-LAB_3:

-    DnsApiFree(lpData);

-    if (local_158 != (HKEY)0x0) {

-      RegCloseKey(local_158);

+      NetInfo_Free((longlong *)&pSVar4->si_family);

+      DVar2 = 0;

     }

   }

   else {

-    memset(local_c8,0,0x80);

-    if (DAT_4 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+    memset(local_b8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

     }

-    if (5 < DAT_5) {

-      if (((_DAT_6 & 0x400000000000) == 0) ||

-         ((DAT_7 & 0x400000000000) != DAT_7)) {

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

-        local_10c = 0;

-        local_118 = &local_150;

         local_fc = 0;

+        local_108 = &local_138;

         local_ec = 0;

+        local_dc = 0;

         uVar7 = 8;

-        local_150 = 1;

-        local_108 = "DnsSetQueryRetryTimeouts";

-        local_f8 = "FALSE";

-        local_110 = 8;

-        local_100 = 0x19;

-        local_f0 = 6;

-        FUN_180055600(local_e8,(undefined *)local_c8);

-        local_cc = 0;

-        local_d8 = local_148;

-        local_148[0] = 0x1000000;

-        local_d0 = uVar7;

-        FUN_1800e3690(0x180135218,&DAT_8,0,7,local_138);

+        local_138 = 1;

+        local_f8 = "DnsScreenLocalAddrsForRegistration";

+        local_e8 = "FALSE";

+        local_100 = 8;

+        local_f0 = 0x23;

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_bc = 0;

+        local_c8 = &local_130;

+        local_130 = 0x1000000;

+        local_c0 = uVar7;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

       }

     }

-    uVar3 = 0x78;

+    DVar2 = 0x78;

   }

-  return uVar3;

+  return DVar2;

 }
```

## `DnsIpv6AddressToString`  (modified)

```diff
--- DnsIpv6AddressToString
+++ DnsIpv6AddressToString
@@ -1,10 +1,72 @@
 

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

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

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

 

 void DnsIpv6AddressToString(undefined8 param_1,undefined8 param_2)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

+  

+                    /* 0x98120  145  DnsIpv6AddressToString */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    RtlIpv6AddressToStringA(param_2,param_1);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "DnsIpv6AddressToString";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x17;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

+  return;

 }
```

## `Dns_GetRandomXid`  (modified)

```diff
--- Dns_GetRandomXid
+++ Dns_AddRecordsToMessage
@@ -1,48 +1,55 @@
 

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

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

 

-short Dns_GetRandomXid(void)

+DWORD Dns_AddRecordsToMessage(longlong param_1,undefined8 *param_2,int param_3)

 

 {

   bool bVar1;

-  ulonglong in_RDX;

   longlong unaff_RBP;

+  undefined4 in_register_00000084;

   undefined4 uVar2;

   undefined8 uStack0000000000000030;

   undefined8 uStack0000000000000038;

   undefined1 *puStack0000000000000060;

   undefined4 uStack0000000000000068;

   undefined4 uStack000000000000006c;

   char *pcStack0000000000000070;

   undefined4 uStack0000000000000078;

   undefined4 uStack000000000000007c;

   

-  if (((_DAT_0 & (uint)in_RDX) == 0) || ((DAT_180135230 & in_RDX) != DAT_180135230)) {

-    bVar1 = false;

+  memset((void *)param_1,(int)param_2,CONCAT44(in_register_00000084,param_3));

+  if (DAT_0 != 0) {

+    FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40);

   }

-  else {

-    bVar1 = true;

+  if (5 < DAT_1) {

+    if (((_DAT_2 & 0x400000000000) == 0) ||

+       ((DAT_3 & 0x400000000000) != DAT_3)) {

+      bVar1 = false;

+    }

+    else {

+      bVar1 = true;

+    }

+    if (bVar1) {

+      uStack000000000000006c = 0;

+      puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+      uStack000000000000007c = 0;

+      *(undefined4 *)(unaff_RBP + -0x74) = 0;

+      uVar2 = 8;

+      uStack0000000000000030 = 1;

+      pcStack0000000000000070 = "DnsAddrBuildFromDnsRecord";

+      *(char **)(unaff_RBP + -0x80) = "FALSE";

+      uStack0000000000000068 = 8;

+      uStack0000000000000078 = 0x1a;

+      *(undefined4 *)(unaff_RBP + -0x78) = 6;

+      FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+      *(undefined4 *)(unaff_RBP + -0x54) = 0;

+      *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+      *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

+      uStack0000000000000038 = 0x1000000;

+      FUN_1800e3690(0x180135218,&DAT_4,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+    }

   }

-  if (bVar1) {

-    uStack000000000000006c = 0;

-    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-    uStack000000000000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    uVar2 = 8;

-    uStack0000000000000030 = 1;

-    pcStack0000000000000070 = "DnsCheckNrptRules";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    uStack0000000000000068 = 8;

-    uStack0000000000000078 = 0x12;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

-    uStack0000000000000038 = 0x1000000;

-    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  }

-  return 0x78;

+  return 0;

 }
```

## `DnsUpdateMachinePresence`  (modified)

```diff
--- DnsUpdateMachinePresence
+++ DnsUpdateMachinePresence
@@ -1,55 +1,191 @@
 

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

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

 

 int DnsUpdateMachinePresence(void)

 

 {

   bool bVar1;

-  undefined8 in_RAX;

-  char *pcVar2;

-  byte in_CL;

-  longlong unaff_RBP;

-  undefined4 uVar3;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  char cVar2;

+  int iVar3;

+  int iVar4;

+  int iVar5;

+  wchar_t *pwVar6;

+  char cVar7;

+  uint uVar8;

+  ulonglong uVar9;

+  char cVar10;

+  wchar_t *pwVar11;

+  char cVar12;

+  longlong lVar13;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_1c8 [32];

+  longlong local_150;

+  longlong local_148;

+  uint local_140;

+  undefined8 local_138;

+  undefined8 local_130;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  undefined8 local_d8 [2];

+  undefined8 *local_c8;

+  undefined8 local_c0;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  bRam0babfb3d830004fb = (byte)in_RAX >> (in_CL & 0x1f);

-  pcVar2 = (char *)CONCAT71((int7)((ulonglong)in_RAX >> 8),bRam0babfb3d830004fb);

-  cRam0000000180db2c30 = cRam0000000180db2c30 + bRam0babfb3d830004fb;

-  *pcVar2 = *pcVar2 + bRam0babfb3d830004fb;

-  if (((_DAT_0 & 0x400000000000) == 0) ||

-     ((DAT_1 & 0x400000000000) != DAT_1)) {

-    bVar1 = false;

+                    /* 0x7e230  236  DnsUpdateMachinePresence */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_1c8;

+  uVar9 = 0;

+  local_150 = 0;

+  cVar12 = '\0';

+  local_148 = 0;

+  local_140 = 0;

+  cVar2 = '\x01';

+  cVar10 = '\x01';

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f7614(0x40b,0x24,0x18010c2f0);

+  }

+  if (((DAT_2 != 0) && (DAT_18013630c == 0)) &&

+     (iVar3 = FUN_1800ca394(unaff_retaddr), iVar3 == 0)) {

+    memset(local_b8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_108 = &local_130;

+        local_130 = 1;

+        local_100 = 8;

+        local_f8 = "DnsUpdateMachinePresence";

+        local_f0 = 0x19;

+        local_e8 = "FALSE";

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_c8 = &local_138;

+        local_138 = 0x1000000;

+        local_c0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

+      }

+    }

+    return 0x78;

+  }

+  iVar3 = NsiAllocateAndGetTable(1,&DAT_8,7,&local_150);

+  local_138 = CONCAT44(local_138._4_4_,iVar3);

+  cVar7 = cVar2;

+  if (iVar3 == 0) {

+    if (local_140 != 0) {

+      do {

+        lVar13 = uVar9 * 0xf0;

+        cVar7 = '\0';

+        if (*(int *)(lVar13 + 0xa8 + local_148) != 1) {

+          cVar7 = cVar2;

+        }

+        if (*(char *)(lVar13 + 0xa5 + local_148) != '\0') {

+          cVar12 = '\x01';

+        }

+        bVar1 = FUN_1800501b4((undefined8 *)(local_150 + uVar9 * 8));

+        cVar2 = FUN_1800502c8((undefined8 *)(local_150 + uVar9 * 8));

+        if (((bVar1) && (cVar2 == '\0')) && (*(int *)(lVar13 + 0x10 + local_148) != 1)) {

+          cVar10 = '\0';

+        }

+        if ((DAT_1 & 8) != 0) {

+          FUN_1800eca5c((ulonglong)bVar1,0x26,(ulonglong)*(byte *)(lVar13 + 0xa5 + local_148),

+                        *(undefined8 *)(local_150 + uVar9 * 8));

+        }

+        uVar8 = (int)uVar9 + 1;

+        uVar9 = (ulonglong)uVar8;

+        cVar2 = cVar7;

+      } while (uVar8 < local_140);

+      iVar3 = (int)local_138;

+    }

+  }

+  else if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x25,0x18010c2f0,iVar3);

+  }

+  uVar9 = 0;

+  NsiFreeTable(local_150,local_148,0,0);

+  local_150 = 0;

+  local_148 = 0;

+  iVar4 = NsiAllocateAndGetTable(1,&DAT_9,7,&local_150);

+  local_130 = CONCAT44(local_130._4_4_,iVar4);

+  if (iVar4 == 0) {

+    cVar2 = cVar7;

+    if (local_140 != 0) {

+      do {

+        lVar13 = uVar9 * 0xf0;

+        cVar7 = '\0';

+        if (*(int *)(lVar13 + 0xa8 + local_148) != 1) {

+          cVar7 = cVar2;

+        }

+        if (*(char *)(lVar13 + 0xa5 + local_148) != '\0') {

+          cVar12 = '\x01';

+        }

+        bVar1 = FUN_1800501b4((undefined8 *)(local_150 + uVar9 * 8));

+        cVar2 = FUN_1800502c8((undefined8 *)(local_150 + uVar9 * 8));

+        if (((bVar1) && (cVar2 == '\0')) && (*(int *)(lVar13 + 0x10 + local_148) != 1)) {

+          cVar10 = '\0';

+        }

+        if ((DAT_1 & 8) != 0) {

+          FUN_1800eca5c((ulonglong)bVar1,0x28,(ulonglong)*(byte *)(lVar13 + 0xa5 + local_148),

+                        *(undefined8 *)(local_150 + uVar9 * 8));

+        }

+        uVar8 = (int)uVar9 + 1;

+        uVar9 = (ulonglong)uVar8;

+        cVar2 = cVar7;

+      } while (uVar8 < local_140);

+      iVar3 = (int)local_138;

+      iVar4 = (int)local_130;

+    }

+LAB_10:

+    if ((DAT_1 & 8) != 0) {

+      pwVar6 = L"in private network";

+      if (cVar10 == '\0') {

+        pwVar6 = L"not in private network";

+      }

+      pwVar11 = L"outside";

+      if (cVar7 == '\0') {

+        pwVar11 = L"inside";

+      }

+      FUN_1800f5ba4(0x40b,0x29,0x18010c2f0,pwVar11,(longlong)pwVar6);

+    }

+  }

+  else if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x27,0x18010c2f0,iVar4);

+    goto LAB_10;

+  }

+  NsiFreeTable(local_150,local_148,0,0);

+  local_150 = 0;

+  local_148 = 0;

+  AcquireSRWLockExclusive((PSRWLOCK)&DAT_11);

+  if ((DAT_12 == cVar7) && (DAT_1801366eb == cVar12)) {

+    if (DAT_14 == cVar10) goto LAB_18007e7a3;

   }

   else {

-    bVar1 = true;

+    DAT_12 = cVar7;

+    DAT_15 = cVar12;

+    FUN_1800ace3c();

+    cVar10 = DAT_14;

   }

-  if (bVar1) {

-    uStack000000000000006c = 0;

-    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-    uStack000000000000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    uVar3 = 8;

-    uStack0000000000000030 = 1;

-    pcStack0000000000000070 = "Socket_Create";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    uStack0000000000000068 = 8;

-    uStack0000000000000078 = 0xe;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    *(undefined4 *)(unaff_RBP + -0x58) = uVar3;

-    uStack0000000000000038 = 0x1000000;

-    FUN_1800e3690(0x180135218,&DAT_2,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+  DAT_14 = cVar10;

+  FUN_18007e9c0();

+LAB_13:

+  ReleaseSRWLockExclusive((PSRWLOCK)&DAT_11);

+  iVar5 = 0;

+  if (iVar3 != 0) {

+    iVar5 = iVar3;

   }

-  return 0;

+  if (iVar4 != 0) {

+    iVar5 = iVar4;

+  }

+  return iVar5;

 }
```

## `DnsQueryConfig`  (modified)

```diff
--- DnsQueryConfig
+++ DnsQueryConfig
@@ -1,11 +1,267 @@
 

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

-

-uint * DnsQueryConfig(int param_1,uint param_2,HKEY param_3,undefined8 param_4,undefined8 *param_5,

-                     uint *param_6)

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

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

+

+DWORD DnsQueryConfig(int param_1,undefined4 param_2,HKEY param_3,undefined8 param_4,

+                    undefined8 *param_5,uint *param_6)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  DWORD DVar2;

+  uint uVar3;

+  uint *_Src;

+  ulonglong uVar4;

+  HLOCAL _Dst;

+  uint *_Dst_00;

+  int iVar5;

+  undefined4 uVar6;

+  uint uVar7;

+  uint *puVar8;

+  longlong lVar9;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_198 [32];

+  uint *local_158;

+  ulonglong local_150;

+  uint local_148 [2];

+  ulonglong local_140;

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  ulonglong *local_118;

+  undefined8 local_110;

+  char *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  undefined8 local_e8 [2];

+  ulonglong *local_d8;

+  undefined8 local_d0;

+  short local_c8 [64];

+  ulonglong local_48;

+  

+                    /* 0x64fe0  171  DnsQueryConfig */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_198;

+  local_140 = CONCAT44(local_140._4_4_,param_2);

+  puVar8 = (uint *)0x0;

+  DVar2 = 0;

+  local_150 = local_150 & 0xffffffff00000000;

+  uVar3 = 0;

+  local_158 = (uint *)0x0;

+  local_148[0] = 0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800e66fc();

+  }

+  if (param_6 == (uint *)0x0) {

+    return 0x57;

+  }

+  if (param_5 != (undefined8 *)0x0) {

+    local_150 = CONCAT44(local_150._4_4_,*param_6);

+  }

+  uVar7 = 0;

+  if (param_1 < 0x1031) {

+    if (param_1 == 0x1030) goto LAB_2;

+    if (0xb < param_1) {

+      if (param_1 != 0xc) {

+        if (param_1 == 0xd) {

+          iVar5 = 3;

+        }

+        else {

+          if (param_1 != 0xe) {

+            if (param_1 == 0xf) {

+              _Src = FUN_180083220(1,0,0x1031);

+              goto LAB_3;

+            }

+            if (param_1 == 0x10) {

+              uVar6 = 3;

+            }

+            else {

+              if (param_1 != 0x11) {

+                return 0x57;

+              }

+              uVar6 = 2;

+            }

+            _Src = FUN_180083220(uVar6,0,0x1031);

+            goto LAB_4;

+          }

+          iVar5 = 2;

+        }

+        _Src = FUN_180083348(iVar5,0,0x1031);

+        goto LAB_4;

+      }

+      _Src = FUN_180083348(1,0,0x1031);

+LAB_3:

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

+        lVar9 = -1;

+        do {

+          lVar9 = lVar9 + 1;

+        } while (*(short *)((longlong)_Src + lVar9 * 2) != 0);

+        uVar4 = (ulonglong)((int)lVar9 * 2 + 2);

+        _Dst_00 = _Src;

+        local_158 = _Src;

+        goto LAB_5;

+      }

+LAB_6:

+      DVar2 = 0xe;

+LAB_7:

+      *param_6 = 0;

+      return DVar2;

+    }

+    uVar4 = 4;

+    if (param_1 == 0xb) {

+LAB_8:

+      DVar2 = FUN_18004b5f8(local_148,param_1,param_3);

+      if (DVar2 != 0) {

+        if ((DAT_1 & 8) != 0) {

+          FUN_1800f658c(0x40b,0xd,0x18010fc58,DVar2);

+        }

+        goto LAB_7;

+      }

+      _Src = local_148;

+      _Dst_00 = puVar8;

+      DVar2 = 0;

+      local_158 = _Src;

+    }

+    else {

+      if (param_1 == 0) {

+        _Src = FUN_180053a54(1,0);

+        goto LAB_3;

+      }

+      if (param_1 == 1) {

+        iVar5 = 3;

+      }

+      else {

+        if (param_1 != 2) {

+          if (param_1 != 6) {

+            if ((param_1 != 9) && (param_1 != 10)) {

+              return 0x57;

+            }

+            goto LAB_8;

+          }

+          _Src = FUN_180050a3c((PCNZWCH)param_3,0,(undefined *)0x1031);

+          local_158 = _Src;

+          if (_Src == (uint *)0x0) {

+            DVar2 = GetLastError();

+            if (DVar2 == 0) {

+              DVar2 = 0x267c;

+            }

+            goto LAB_7;

+          }

+          uVar4 = (ulonglong)(*_Src * 4 + 4);

+          _Dst_00 = _Src;

+          DVar2 = 0;

+          goto LAB_5;

+        }

+        iVar5 = 2;

+      }

+      _Src = FUN_180053a54(iVar5,0);

+LAB_4:

+      if (_Src == (uint *)0x0) goto LAB_6;

+      lVar9 = -1;

+      do {

+        lVar9 = lVar9 + 1;

+      } while (*(char *)((longlong)_Src + lVar9) != '\0');

+      uVar4 = (ulonglong)((int)lVar9 + 1);

+      _Dst_00 = _Src;

+      local_158 = _Src;

+    }

+  }

+  else {

+    if ((param_1 != 0x1031) && (param_1 != 0x1032)) {

+      return 0x57;

+    }

+    if (DAT_9 != 0) {

+      memset(local_c8,0,0x80);

+      if (DAT_10 != 0) {

+        FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+      }

+      if (DAT_11 < 6) {

+        return 0x57;

+      }

+      if (((_DAT_12 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_13 & 0x400000000000) != DAT_13)) {

+        bVar1 = false;

+      }

+      if (!bVar1) {

+        return 0x57;

+      }

+      local_118 = &local_140;

+      local_140 = 1;

+      local_110 = 8;

+      local_108 = "DnsQueryConfig";

+      local_100 = 0xf;

+      local_f8 = "FALSE";

+      local_f0 = 6;

+      FUN_180055600(local_e8,(undefined *)local_c8);

+      local_d8 = &local_150;

+      local_150 = 0x1000000;

+      local_d0 = 8;

+      FUN_1800e3690(0x180135218,&DAT_14,0,7,local_138);

+      return 0x57;

+    }

+LAB_2:

+    if (param_1 == 0x1031) {

+      uVar7 = 2;

+    }

+    else if (param_1 == 0x1032) {

+      uVar7 = 0x17;

+    }

+    uVar4 = FUN_180050b0c((PCNZWCH)param_3,uVar7,0x1031,(wchar_t *)&local_158);

+    _Dst_00 = local_158;

+    DVar2 = (DWORD)uVar4;

+    if (DVar2 != 0) goto LAB_15;

+    _Src = local_158;

+    uVar3 = FUN_1800472a0((longlong)local_158);

+    uVar4 = (ulonglong)uVar3;

+  }

+LAB_5:

+  uVar3 = (uint)uVar4;

+  puVar8 = _Dst_00;

+  if (param_5 != (undefined8 *)0x0) {

+    if ((local_140 & 1) == 0) {

+      if ((local_140 & 2) == 0) {

+        if ((uint)local_150 < uVar3) {

+          DVar2 = 0xea;

+        }

+        else {

+          memcpy(param_5,_Src,uVar4);

+        }

+        goto LAB_15;

+      }

+      if (7 < (uint)local_150) {

+        if (_Dst_00 == (uint *)0x0) {

+          _Dst_00 = FUN_18008a630(uVar4);

+          if (_Dst_00 == (uint *)0x0) {

+            DVar2 = 0xe;

+            goto LAB_16;

+          }

+          DVar2 = 0;

+          memcpy(_Dst_00,local_158,uVar4);

+        }

+        *param_5 = _Dst_00;

+LAB_16:

+        *param_6 = uVar3;

+        return DVar2;

+      }

+    }

+    else if (7 < (uint)local_150) {

+      _Dst = LocalAlloc(0,uVar4);

+      if (_Dst == (HLOCAL)0x0) {

+        DVar2 = 0xe;

+      }

+      else {

+        DVar2 = 0;

+        memcpy(_Dst,local_158,uVar4);

+        *param_5 = _Dst;

+      }

+      goto LAB_15;

+    }

+    DVar2 = 0xea;

+    uVar3 = 8;

+  }

+LAB_15:

+  *param_6 = uVar3;

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

+    DnsApiFree(puVar8);

+    return DVar2;

+  }

+  return DVar2;

 }
```

## `DnsAsyncRegisterHostAddrs`  (modified)

```diff
--- DnsAsyncRegisterHostAddrs
+++ DnsApiHeapReset
@@ -1,74 +1,69 @@
 

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

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

 

-ulonglong DnsAsyncRegisterHostAddrs(wchar_t *param_1)

+void DnsApiHeapReset(void)

 

 {

   bool bVar1;

-  ulonglong uVar2;

-  undefined4 uVar3;

+  undefined4 uVar2;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_168 [32];

+  undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x96320  34  DnsAsyncRegisterHostAddrs */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_168;

-  if (DAT_1 == 0) {

-    uVar2 = DnsDhcpRegisterHostAddrs(param_1);

-  }

-  else {

+                    /* 0x96060  30  DnsApiHeapReset */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        uVar3 = 8;

+        uVar2 = 8;

         local_118 = 1;

-        local_d8 = "DnsAsyncRegisterHostAddrs";

+        local_d8 = "DnsApiHeapReset";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x1a;

+        local_d0 = 0x10;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar3;

+        local_a0 = uVar2;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0x78;

   }

-  return uVar2;

+  return;

 }
```

## `NetInfo_GetAdapterByInterfaceIndex`  (modified)

```diff
--- NetInfo_GetAdapterByInterfaceIndex
+++ NetInfo_GetAdapterByInterfaceIndex
@@ -1,13 +1,84 @@
 

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

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

 

 longlong NetInfo_GetAdapterByInterfaceIndex(longlong param_1,int param_2)

 

 {

-  ulonglong unaff_RBX;

-  undefined4 in_R9D;

+  bool bVar1;

+  int iVar2;

+  longlong lVar3;

+  DWORD dwErrCode;

+  uint uVar4;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-  FUN_1800f658c((short)unaff_RBX,(ushort)param_2,0x18010fd98,in_R9D);

-  return unaff_RBX & 0xffffffff;

+                    /* 0x56d90  319  NetInfo_GetAdapterByInterfaceIndex */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  uVar4 = 0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f7f58(0x40b,0x52,0x18010f550,param_1);

+  }

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    if ((param_1 != 0) && (param_2 != 0)) {

+      if (*(uint *)(param_1 + 0x44) == 0) {

+        return 0;

+      }

+      lVar3 = param_1 + 0x68;

+      do {

+        if (*(int *)(lVar3 + 0x30) == param_2) {

+          return lVar3;

+        }

+        uVar4 = uVar4 + 1;

+        lVar3 = lVar3 + 0xa0;

+      } while (uVar4 < *(uint *)(param_1 + 0x44));

+      return 0;

+    }

+    dwErrCode = 0x57;

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_e8 = &local_118;

+        local_118 = 1;

+        local_e0 = 8;

+        local_d8 = "NetInfo_GetAdapterByInterfaceIndex";

+        local_d0 = 0x23;

+        local_c8 = "FALSE";

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+      }

+    }

+    dwErrCode = 0x78;

+  }

+  SetLastError(dwErrCode);

+  return 0;

 }
```

## `DnsDeRegisterLocal`  (modified)

```diff
--- DnsDeRegisterLocal
+++ DnsDeRegisterLocal
@@ -1,69 +1,74 @@
 

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

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

 

-long DnsDeRegisterLocal(longlong param_1,ulong param_2)

+ulonglong DnsDeRegisterLocal(longlong param_1,int param_2)

 

 {

-  int iVar1;

-  int extraout_EAX;

-  undefined8 uVar2;

-  uint unaff_EBX;

-  longlong *unaff_RBP;

-  longlong *unaff_RSI;

-  longlong *unaff_RDI;

-  int in_R8D;

-  longlong *plVar3;

-  wchar_t *in_R9;

-  int unaff_R15D;

-  ushort in_stack_00000020;

-  longlong in_stack_00000060;

-  longlong *in_stack_00000080;

-  uint in_stack_00000088;

+  bool bVar1;

+  ulonglong uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  uVar2 = FUN_1800ca504(unaff_RDI,param_2,in_R8D,(int)in_R9,in_stack_00000020);

-  if ((int)uVar2 == 0) {

-    if (unaff_RBP != (longlong *)0x0) {

-      in_R9 = (wchar_t *)0x0;

-      uVar2 = FUN_1800ca504(unaff_RBP,0,0,0,(ushort)unaff_R15D);

-      if ((int)uVar2 != 0) goto LAB_0;

+                    /* 0x68650  64  DnsDeRegisterLocal */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800b50a8(param_1,param_2);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    if ((unaff_RSI == (longlong *)0x0) ||

-       (((unaff_RDI == (longlong *)0x0 ||

-         (uVar2 = FUN_180017670((PCNZWCH)unaff_RSI[1],(PCNZWCH)unaff_RDI[1]), (int)uVar2 != 0)) &&

-        ((unaff_RBP == (longlong *)0x0 ||

-         (uVar2 = FUN_180017670((PCNZWCH)unaff_RSI[1],(PCNZWCH)unaff_RBP[1]), (int)uVar2 != 0))))))

-    {

-      if (DAT_1 == unaff_R15D) {

-        if ((unaff_EBX & 0x1ff) == 0) {

-          unaff_EBX = unaff_EBX | _DAT_2;

-        }

-        if ((DAT_3 == unaff_R15D) && (in_stack_00000060 != 0)) {

-          unaff_EBX = unaff_EBX | 0x200;

-        }

-      }

-      plVar3 = unaff_RDI;

-      unaff_RDI = FUN_180089b2c(unaff_RBP,unaff_RSI,unaff_RDI);

-      if (DAT_3 == unaff_R15D) {

-        in_stack_00000080 = unaff_RDI;

-        in_stack_00000088 = unaff_EBX;

-        FUN_18007c6a0((wchar_t *)&stack0x00000080,unaff_RSI,plVar3,in_R9);

-        iVar1 = extraout_EAX;

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

       }

       else {

-        iVar1 = FUN_180094520();

+        bVar1 = true;

       }

-      goto LAB_4;

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsDeRegisterLocal";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x13;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

     }

+    uVar2 = 0x78;

   }

-LAB_0:

-  iVar1 = 0x57;

-  FUN_18002a140(unaff_RSI);

-LAB_4:

-  FUN_18002a140(unaff_RDI);

-  if ((DAT_5 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x18,0x180110d78,iVar1);

-  }

-  return iVar1;

+  return uVar2;

 }
```

## `Send_OpenTcpConnectionAndSend`  (modified)

```diff
--- Send_OpenTcpConnectionAndSend
+++ NetInfo_Build
@@ -1,19 +1,71 @@
 

-ulonglong Send_OpenTcpConnectionAndSend(longlong param_1,ushort *param_2)

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

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

+

+void * NetInfo_Build(uint param_1,undefined4 *param_2,undefined8 param_3,wchar_t *param_4)

 

 {

-  code *pcVar1;

-  ulonglong uVar2;

-  int in_EAX;

-  undefined4 in_register_00000004;

-  char unaff_BL;

+  byte *pbVar1;

+  byte bVar2;

+  byte *in_RAX;

+  int *piVar3;

+  void *pvVar4;

+  undefined4 in_register_0000000c;

+  char *unaff_RBX;

   longlong unaff_RBP;

+  char *unaff_RDI;

+  undefined4 uVar5;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-  *(int *)CONCAT44(in_register_00000004,in_EAX) =

-       *(int *)CONCAT44(in_register_00000004,in_EAX) + in_EAX;

-  *(char *)(unaff_RBP + -0x3d) = *(char *)(unaff_RBP + -0x3d) + unaff_BL;

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

-  uVar2 = (*pcVar1)();

-  return uVar2;

+  piVar3 = (int *)CONCAT71((int7)((ulonglong)in_RAX >> 8),(byte)in_RAX | *in_RAX);

+  *unaff_RDI = *unaff_RDI + (byte)param_1;

+  *piVar3 = *piVar3 + (int)piVar3;

+  *unaff_RBX = *unaff_RBX + (char)((ulonglong)param_2 >> 8);

+  pbVar1 = (byte *)((longlong)piVar3 + -0x73);

+  bVar2 = (byte)param_1 & 7;

+  *pbVar1 = *pbVar1 >> bVar2 | *pbVar1 << 8 - bVar2;

+  pvVar4 = memset((void *)CONCAT44(in_register_0000000c,param_1),(int)param_2,

+                  CONCAT71((int7)((ulonglong)param_3 >> 8),0x41));

+  if (DAT_0 != 0) {

+    pvVar4 = (void *)FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40

+                                  );

+  }

+  if (5 < DAT_1) {

+    if (((_DAT_2 & 0x400000000000) == 0) ||

+       (pvVar4 = (void *)((ulonglong)DAT_3 & 0x400000000000), pvVar4 != DAT_3)) {

+      pvVar4 = (void *)((ulonglong)pvVar4 & 0xffffffffffffff00);

+    }

+    else {

+      pvVar4 = (void *)CONCAT71((int7)((ulonglong)pvVar4 >> 8),1);

+    }

+    if ((char)pvVar4 != '\0') {

+      uStack000000000000006c = 0;

+      puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+      uStack000000000000007c = 0;

+      *(undefined4 *)(unaff_RBP + -0x74) = 0;

+      uVar5 = 8;

+      uStack0000000000000030 = 1;

+      pcStack0000000000000070 = "DnsCleanupTcpConnections";

+      *(char **)(unaff_RBP + -0x80) = "FALSE";

+      uStack0000000000000068 = 8;

+      uStack0000000000000078 = 0x19;

+      *(undefined4 *)(unaff_RBP + -0x78) = 6;

+      FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+      *(undefined4 *)(unaff_RBP + -0x54) = 0;

+      *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+      *(undefined4 *)(unaff_RBP + -0x58) = uVar5;

+      uStack0000000000000038 = 0x1000000;

+      pvVar4 = (void *)FUN_1800e3690(0x180135218,&DAT_4,0,7,

+                                     (PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+    }

+  }

+  return pvVar4;

 }
```

## `AdaptiveTimeout_ClearInterfaceSpecificConfiguration`  (modified)

```diff
--- AdaptiveTimeout_ClearInterfaceSpecificConfiguration
+++ AdaptiveTimeout_ClearInterfaceSpecificConfiguration
@@ -1,24 +1,89 @@
 

-int AdaptiveTimeout_ClearInterfaceSpecificConfiguration(void)

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

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

+

+void AdaptiveTimeout_ClearInterfaceSpecificConfiguration(void)

 

 {

-  int iVar1;

-  ushort in_DX;

-  LPVOID unaff_RBP;

-  longlong unaff_RDI;

-  undefined8 *unaff_R14;

-  undefined8 in_stack_00000048;

+  longlong *plVar1;

+  undefined8 *puVar2;

+  bool bVar3;

+  undefined8 *puVar4;

+  int iVar5;

+  undefined4 uVar6;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  iVar1 = FUN_18008a30c((undefined4 *)unaff_R14,in_DX,&stack0x00000048);

-  if (iVar1 == 0) {

-    *(uint *)(unaff_RDI + 0x14) = *(uint *)(unaff_RDI + 0x14) | 0x4000;

-    *unaff_R14 = in_stack_00000048;

+                    /* 0x62400  11  AdaptiveTimeout_ClearInterfaceSpecificConfiguration */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar5 = FUN_1800ca394(unaff_retaddr), iVar5 != 0)) {

+    EnterCriticalSection((LPCRITICAL_SECTION)&DAT_2);

+    while (puVar4 = DAT_3, DAT_3 != (undefined8 *)0x0) {

+      puVar2 = (undefined8 *)*DAT_3;

+      plVar1 = DAT_3 + 2;

+      DAT_3 = puVar2;

+      if (*plVar1 != 0) {

+        FUN_1800ae054(plVar1);

+      }

+      DnsApiFree((LPVOID)puVar4[1]);

+      DnsApiFree(puVar4);

+    }

+    LeaveCriticalSection((LPCRITICAL_SECTION)&DAT_2);

+    return;

   }

-  FUN_18008a3b8((LPVOID)0x0);

-  FUN_18008a3b8(unaff_RBP);

-  if ((iVar1 != 0) && ((DAT_0 & 8) != 0)) {

-    FUN_1800f658c(0x40b,0xd,0x180117f70,iVar1);

+  memset(local_98,0,0x80);

+  if (DAT_4 != 0) {

+    FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

   }

-  return iVar1;

+  if (DAT_5 < 6) {

+    return;

+  }

+  if (((_DAT_6 & 0x400000000000) == 0) ||

+     ((DAT_7 & 0x400000000000) != DAT_7)) {

+    bVar3 = false;

+  }

+  else {

+    bVar3 = true;

+  }

+  if (!bVar3) {

+    return;

+  }

+  local_dc = 0;

+  local_e8 = &local_118;

+  local_cc = 0;

+  local_bc = 0;

+  uVar6 = 8;

+  local_118 = 1;

+  local_d8 = "AdaptiveTimeout_ClearInterfaceSpecificConfiguration";

+  local_c8 = "FALSE";

+  local_e0 = 8;

+  local_d0 = 0x34;

+  local_c0 = 6;

+  FUN_180055600(local_b8,(undefined *)local_98);

+  local_9c = 0;

+  local_a8 = &local_110;

+  local_110 = 0x1000000;

+  local_a0 = uVar6;

+  FUN_1800e3690(0x180135218,&DAT_8,0,7,local_108);

+  return;

 }
```

## `Send_AndRecvUdpWithParam`  (modified)

```diff
--- Send_AndRecvUdpWithParam
+++ Send_AndRecvUdpWithParam
@@ -1,20 +1,74 @@
 

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

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

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

 

 uint Send_AndRecvUdpWithParam(byte *param_1)

 

 {

-  int *piVar1;

-  char in_AL;

-  undefined7 in_register_00000001;

-  char *unaff_RDI;

+  bool bVar1;

+  uint uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  piVar1 = (int *)(CONCAT71(in_register_00000001,in_AL) + -0x39);

-  *piVar1 = *piVar1 + -1;

-  *(char *)CONCAT71(in_register_00000001,in_AL) =

-       *(char *)CONCAT71(in_register_00000001,in_AL) + in_AL;

-  *unaff_RDI = *unaff_RDI + (char)param_1;

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

-  halt_baddata();

+                    /* 0x6bc50  337  Send_AndRecvUdpWithParam */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800a8cc0(param_1);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "Send_AndRecvUdpWithParam";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x19;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0x78;

+  }

+  return uVar2;

 }
```

## `NetInfo_BuildEx`  (modified)

```diff
--- NetInfo_BuildEx
+++ NetInfo_BuildEx
@@ -1,13 +1,412 @@
+

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

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

 

 int NetInfo_BuildEx(uint param_1,undefined4 *param_2,wchar_t *param_3,wchar_t *param_4)

 

 {

-  char *in_RAX;

-  byte *unaff_RDI;

-  int in_stack_00000040;

+  longlong lVar1;

+  byte bVar2;

+  byte bVar3;

+  undefined1 auVar4 [16];

+  bool bVar5;

+  int iVar6;

+  LSTATUS LVar7;

+  longlong lVar8;

+  byte *pbVar9;

+  byte *pbVar10;

+  ulonglong uVar11;

+  LPVOID pvVar12;

+  ULONGLONG UVar13;

+  SOCKADDR_INET *pSVar14;

+  ushort uVar15;

+  SOCKADDR_INET *pSVar16;

+  uint uVar17;

+  SOCKADDR_INET *pSVar18;

+  LPVOID *ppvVar19;

+  byte bVar20;

+  wchar_t *pwVar21;

+  SOCKADDR_INET *pSVar22;

+  SOCKADDR_INET *pSVar23;

+  LPCSTR unaff_retaddr;

+  int local_res18;

+  undefined1 auStackY_1f8 [32];

+  wchar_t *local_1b0;

+  LPVOID local_1a8;

+  EVENT_DESCRIPTOR local_1a0;

+  undefined1 local_190 [24];

+  undefined8 uStack_178;

+  int local_170;

+  int local_16c;

+  undefined8 local_168;

+  undefined8 local_160;

+  SOCKADDR_INET local_158;

+  _EVENT_DATA_DESCRIPTOR local_138;

+  undefined *local_128;

+  undefined4 local_120;

+  undefined4 local_11c;

+  undefined8 *local_118;

+  undefined8 local_110;

+  char *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  undefined8 *local_e8;

+  int local_e0;

+  undefined4 local_dc;

+  undefined8 *local_d8;

+  undefined8 local_d0;

+  undefined8 local_c8;

+  undefined8 uStack_c0;

+  undefined8 local_b8;

+  undefined8 uStack_b0;

+  undefined8 local_a8;

+  undefined8 uStack_a0;

+  undefined8 local_98;

+  undefined8 uStack_90;

+  undefined8 local_88;

+  undefined8 uStack_80;

+  undefined8 local_78;

+  undefined8 uStack_70;

+  undefined8 local_68;

+  undefined8 uStack_60;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  ulonglong local_48;

   

-  *unaff_RDI = *unaff_RDI | (byte)param_1;

-  *in_RAX = *in_RAX + (char)in_RAX;

-  return in_stack_00000040;

+                    /* 0x13550  312  NetInfo_BuildEx */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_1f8;

+  pSVar14 = (SOCKADDR_INET *)0x0;

+  pwVar21 = (wchar_t *)(ulonglong)param_1;

+  local_1a8 = (LPVOID)0x0;

+  local_1b0 = (wchar_t *)0x0;

+  local_158._16_8_ = 0;

+  local_158._0_8_ = 0;

+  local_158.Ipv4.sin_zero[0] = '\0';

+  local_158.Ipv4.sin_zero[1] = '\0';

+  local_158.Ipv4.sin_zero[2] = '\0';

+  local_158.Ipv4.sin_zero[3] = '\0';

+  local_158.Ipv4.sin_zero[4] = '\0';

+  local_158.Ipv4.sin_zero[5] = '\0';

+  local_158.Ipv4.sin_zero[6] = '\0';

+  local_158.Ipv4.sin_zero[7] = '\0';

+  pSVar18 = (SOCKADDR_INET *)0x0;

+  local_16c = 0;

+  pSVar16 = (SOCKADDR_INET *)0x0;

+  local_170 = 0;

+  local_190._0_8_ = (void *)0x0;

+  local_190[8] = '\0';

+  local_190[9] = '\0';

+  local_190[10] = '\0';

+  local_190[0xb] = '\0';

+  local_190[0xc] = '\0';

+  local_190[0xd] = '\0';

+  local_190[0xe] = '\0';

+  local_190[0xf] = '\0';

+  pSVar22 = (SOCKADDR_INET *)0x0;

+  local_190._16_8_ = 0;

+  uStack_178 = 0;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar6 = FUN_1800ca394(unaff_retaddr), iVar6 != 0)) {

+    if (DAT_2 != 0) {

+      FUN_1800a12e0((wchar_t *)0x0,(ulonglong)pwVar21,param_2,param_3);

+      return local_res18;

+    }

+    if ((DAT_3 & 8) != 0) {

+      FUN_1800f658c(0x40b,0x147,0x18010f550,param_1);

+      param_4 = pwVar21;

+    }

+    if (param_3 != (wchar_t *)0x0) {

+      param_3[0] = L'\0';

+      param_3[1] = L'\0';

+      param_3[2] = L'\0';

+      param_3[3] = L'\0';

+    }

+    if (param_2 != (undefined4 *)0x0) {

+      *param_2 = 0;

+    }

+    if (param_3 == (wchar_t *)0x0) {

+      iVar6 = 0x57;

+    }

+    else if (param_2 == (undefined4 *)0x0) {

+      iVar6 = 0x57;

+    }

+    else {

+      pSVar18 = &local_158;

+      LVar7 = FUN_180046c18((PHKEY)&local_158);

+      if (LVar7 == 0) {

+        pSVar14 = &local_158;

+        pSVar22 = (SOCKADDR_INET *)local_190;

+        LVar7 = FUN_180074abc((HKEY *)pSVar14,(undefined8 *)local_190);

+        if (LVar7 == 0) {

+          ppvVar19 = &local_1a8;

+          iVar6 = FUN_18004cda0(pSVar14,(param_1 & 0x1000000 | 0x6630000) >> 0xf,ppvVar19);

+          if (iVar6 == 0) {

+            uVar17 = 0;

+            for (pvVar12 = local_1a8; pvVar12 != (LPVOID)0x0;

+                pvVar12 = *(LPVOID *)((longlong)pvVar12 + 8)) {

+              *(undefined8 *)((longlong)pvVar12 + 0x38) = 0;

+              uVar17 = uVar17 + 1;

+              *(undefined8 *)((longlong)pvVar12 + 0x30) = 0;

+              *(undefined8 *)((longlong)pvVar12 + 0x1b8) = 0;

+            }

+            pvVar12 = local_1a8;

+            uVar11 = FUN_18001bf40((longlong)local_1a8,&local_1b0);

+            iVar6 = (int)uVar11;

+            if (iVar6 == 0) {

+              iVar6 = FUN_18004bc48(pvVar12,local_1b0,ppvVar19,param_4);

+              if (iVar6 == 0) {

+                pSVar16 = FUN_180015d7c(uVar17);

+                if (pSVar16 == (SOCKADDR_INET *)0x0) {

+                  iVar6 = 0xe;

+                }

+                else {

+                  FUN_1800500a4((uint *)&pSVar16[2].si_family);

+                  for (pwVar21 = local_1b0; pwVar21 != (wchar_t *)0x0;

+                      pwVar21 = *(wchar_t **)pwVar21) {

+                    uVar11 = FUN_18006d3f8((longlong)local_190,(longlong)pwVar21,(uint *)local_1b0,

+                                           (longlong)pSVar16,&local_170,param_2,&local_16c,

+                                           (uint *)0x0);

+                    if ((int)uVar11 != 0) {

+                      *(uint *)(pSVar16 + 2) = *(uint *)(pSVar16 + 2) | 0x4000000;

+                    }

+                  }

+                  if ((DAT_4 & 0x10000000) != 0) {

+                    if ((DAT_3 & 8) != 0) {

+                      FUN_1800f7614(0x40b,0x14e,0x18010f550);

+                    }

+                    if (((*(byte *)(pSVar16 + 2) & 0x20) != 0) &&

+                       (uVar11 = 0, *(int *)((longlong)pSVar16 + 0x44) != 0)) {

+                      do {

+                        uVar17 = *(uint *)(uVar11 * 0xa0 + 0xac + (longlong)pSVar16);

+                        if ((uVar17 >> 9 & 1) != 0) {

+                          *(uint *)(uVar11 * 0xa0 + 0xac + (longlong)pSVar16) = uVar17 | 0x20;

+                        }

+                        uVar17 = (int)uVar11 + 1;

+                        uVar11 = (ulonglong)uVar17;

+                      } while (uVar17 < *(uint *)((longlong)pSVar16 + 0x44));

+                    }

+                  }

+                  iVar6 = FUN_180045480(pSVar16,local_16c);

+                  if (iVar6 == 0) {

+                    if ((*(int *)((longlong)pSVar16 + 0x44) == 0) ||

+                       (iVar6 = FUN_1800190b4((longlong *)&local_158.si_family,(longlong *)local_190

+                                              ,(undefined *)pSVar16), iVar6 == 0)) {

+                      if ((void *)local_190._0_8_ != (void *)0x0) {

+                        pvVar12 = FUN_180016e10((void *)local_190._0_8_);

+                        *(LPVOID *)((longlong)&(pSVar16->Ipv6).sin6_addr.u + 8) = pvVar12;

+                        if (pvVar12 == (LPVOID)0x0) {

+                          iVar6 = 0xe;

+                          goto LAB_5;

+                        }

+                        iVar6 = 0;

+                      }

+                      if ((CHAR  [8])local_190._8_8_ != (CHAR  [8])0x0) {

+                        pvVar12 = FUN_180016e10((void *)local_190._8_8_);

+                        *(LPVOID *)&(pSVar16->Ipv6).field4_0x18 = pvVar12;

+                        if (pvVar12 == (LPVOID)0x0) {

+                          iVar6 = 0xe;

+                          goto LAB_5;

+                        }

+                        iVar6 = 0;

+                      }

+                      UVar13 = GetTickCount64();

+                      auVar4._8_8_ = 0;

+                      auVar4._0_8_ = UVar13;

+                      lVar8 = SUB168(ZEXT816(0x624dd2f1a9fbe77) * auVar4,8);

+                      *(int *)((longlong)pSVar16 + 0x2c) = (int)((UVar13 - lVar8 >> 1) + lVar8 >> 9)

+                      ;

+                      NetInfo_ResetServerPriorities((longlong *)&pSVar16->si_family,0);

+                      FUN_180054860((longlong)pSVar16);

+                      if ((param_1 >> 0x18 & 1) != 0) {

+                        local_170 = 0;

+                      }

+                      *(int *)((longlong)pSVar16 + 0x28) = local_170;

+                      FUN_180045e9c("New Netinfo:",(longlong)pSVar16);

+                      *(SOCKADDR_INET **)param_3 = pSVar16;

+                      pSVar16 = (SOCKADDR_INET *)0x0;

+                    }

+                    else if ((DAT_3 & 8) != 0) {

+                      uVar15 = 0x150;

+                      goto LAB_6;

+                    }

+                  }

+                  else if ((DAT_3 & 8) != 0) {

+                    uVar15 = 0x14f;

+                    goto LAB_6;

+                  }

+                }

+              }

+              else if ((DAT_3 & 8) != 0) {

+                uVar15 = 0x14d;

+                goto LAB_6;

+              }

+            }

+            else if ((DAT_3 & 8) != 0) {

+              uVar15 = 0x14c;

+LAB_6:

+              FUN_1800f658c(0x40b,uVar15,0x18010f550,iVar6);

+            }

+          }

+        }

+        else {

+          if ((DAT_3 & 8) != 0) {

+            FUN_1800f658c(0x40b,0x14a,0x18010f550,LVar7);

+          }

+          iVar6 = 0x267c;

+          pSVar14 = pSVar16;

+          pSVar23 = pSVar22;

+          if ((DAT_3 & 8) == 0) goto LAB_180013c44;

+          FUN_1800f658c(0x40b,0x14b,0x18010f550,0x267c);

+        }

+      }

+      else {

+        if ((DAT_3 & 8) != 0) {

+          FUN_1800f7614(0x40b,0x148,0x18010f550);

+        }

+        iVar6 = 0x267c;

+        pSVar23 = pSVar14;

+        if ((DAT_3 & 8) == 0) goto LAB_180013c44;

+        FUN_1800f658c(0x40b,0x149,0x18010f550,0x267c);

+      }

+    }

+  }

+  else {

+    local_c8 = 0;

+    uStack_c0 = 0;

+    local_b8 = 0;

+    uStack_b0 = 0;

+    local_a8 = 0;

+    uStack_a0 = 0;

+    local_98 = 0;

+    uStack_90 = 0;

+    local_88 = 0;

+    uStack_80 = 0;

+    local_78 = 0;

+    uStack_70 = 0;

+    local_68 = 0;

+    uStack_60 = 0;

+    local_58 = 0;

+    uStack_50 = 0;

+    if (DAT_8 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,(short *)&local_c8,0x40);

+    }

+    if (5 < DAT_9) {

+      if (((_DAT_10 & 0x400000000000) == 0) ||

+         ((DAT_11 & 0x400000000000) != DAT_11)) {

+        bVar5 = false;

+      }

+      else {

+        bVar5 = true;

+      }

+      if (bVar5) {

+        local_168 = 1;

+        local_118 = &local_168;

+        local_110 = 8;

+        local_108 = "NetInfo_BuildEx";

+        local_f8 = "FALSE";

+        lVar8 = -1;

+        local_100 = 0x10;

+        local_f0 = 6;

+        do {

+          lVar1 = lVar8 * 2;

+          lVar8 = lVar8 + 1;

+        } while (*(short *)((longlong)&local_c8 + lVar1 + 2) != 0);

+        local_dc = 0;

+        local_e0 = (int)lVar8 * 2 + 2;

+        local_e8 = &local_c8;

+        local_d8 = &local_160;

+        local_1a0.Level = '\x05';

+        local_1a0.Opcode = '\0';

+        local_1a0.Task = 0;

+        local_138.Ptr = (ULONGLONG)PTR_DAT_12;

+        local_160 = 0x1000000;

+        local_d0 = 8;

+        local_1a0.Id = 0;

+        local_1a0.Version = '\0';

+        local_1a0.Channel = '\v';

+        local_1a0.Keyword = 0x400000000000;

+        local_138.Size = (uint)*(ushort *)PTR_DAT_12;

+        local_128 = &DAT_13;

+        local_138.Reserved = 2;

+        local_120 = 0x52;

+        local_11c = 1;

+        if (DAT_14 == FUN_18004e7b0) {

+          bVar20 = 0;

+          pbVar9 = &DAT_15;

+          do {

+            bVar2 = *pbVar9;

+            pbVar9 = pbVar9 + 1;

+          } while ((char)bVar2 < '\0');

+          do {

+            bVar2 = *pbVar9;

+            pbVar9 = pbVar9 + 1;

+          } while (bVar2 != 0);

+          uVar11 = 0;

+          if (pbVar9 < &DAT_16) {

+            while( true ) {

+              do {

+                pbVar10 = pbVar9;

+                bVar20 = (byte)uVar11;

+                pbVar9 = pbVar10 + 1;

+              } while (*pbVar10 != 0);

+              bVar2 = pbVar10[1];

+              if (-1 < (char)bVar2) break;

+              pbVar9 = pbVar10 + 3;

+              if (-1 < (char)pbVar10[2]) break;

+              bVar3 = *pbVar9;

+              while ((char)bVar3 < '\0') {

+                if (bVar3 != 0x80) goto LAB_17;

+                pbVar10 = pbVar9 + 1;

+                pbVar9 = pbVar9 + 1;

+                bVar3 = *pbVar10;

+              }

+              if (((bVar2 & 0x7f) != 9) || (2 < (byte)(bVar3 + 0x8f))) break;

+              bVar20 = bVar20 + 1;

+              *(byte *)((longlong)&local_110 + uVar11 * 0x10 + 5) = bVar3;

+              uVar11 = (ulonglong)bVar20;

+              if (&UNK_18 < pbVar9) break;

+            }

+          }

+LAB_17:

+          if (bVar20 != 0) {

+            FUN_1800e3380(0x180135218,(undefined8 *)&local_1a0,7,(longlong)&local_138,bVar20);

+            iVar6 = 0x78;

+            pSVar16 = pSVar14;

+            pSVar18 = pSVar14;

+            pSVar22 = pSVar14;

+            goto LAB_5;

+          }

+          EventWriteTransfer(DAT_19,&local_1a0,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_138);

+        }

+      }

+    }

+    iVar6 = 0x78;

+  }

+LAB_5:

+  pSVar14 = pSVar16;

+  pSVar23 = pSVar22;

+  if ((DAT_3 & 8) != 0) {

+    FUN_1800f71b8(0x40b,0x17,0x1801102b8,pSVar22);

+  }

+LAB_7:

+  if (pSVar23 != (SOCKADDR_INET *)0x0) {

+    if (*(LPVOID *)pSVar23 != (LPVOID)0x0) {

+      DnsApiFree(*(LPVOID *)pSVar23);

+    }

+    if (*(LPVOID *)(pSVar23->Ipv4).sin_zero != (LPVOID)0x0) {

+      DnsApiFree(*(LPVOID *)(pSVar23->Ipv4).sin_zero);

+    }

+  }

+  if (local_1a8 != (LPVOID)0x0) {

+    DnsApiFree(local_1a8);

+  }

+  FUN_18001b998((undefined8 *)local_1b0);

+  FUN_18004dd88((undefined8 *)pSVar18);

+  NetInfo_Free((longlong *)&pSVar14->si_family);

+  if ((DAT_3 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x151,0x18010f550,iVar6);

+  }

+  return local_res18;

 }
```

## `Socket_SetMulticastLoopBack`  (modified)

```diff
--- Socket_SetMulticastLoopBack
+++ Socket_SetMulticastLoopBack
@@ -1,10 +1,80 @@
 

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

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

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

 

 int Socket_SetMulticastLoopBack(undefined8 param_1,undefined8 param_2,undefined4 param_3)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  int iVar2;

+  undefined8 uVar3;

+  undefined4 *puVar4;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_178 [32];

+  undefined4 local_120 [2];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

+  

+                    /* 0x7b7d0  353  Socket_SetMulticastLoopBack */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_178;

+  local_120[0] = param_3;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800ec408();

+  }

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    puVar4 = local_120;

+    uVar3 = param_1;

+    iVar2 = WSAIoctl(param_1,0x88000009,puVar4,4);

+    if (iVar2 == -1) {

+      iVar2 = WSAGetLastError();

+      if ((DAT_1 & 8) != 0) {

+        FUN_1800e6694(uVar3,0x1d,puVar4,param_1);

+      }

+    }

+    else {

+      iVar2 = 0;

+    }

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_e8 = &local_118;

+        local_118 = 1;

+        local_e0 = 8;

+        local_d8 = "Socket_SetMulticastLoopBack";

+        local_d0 = 0x1c;

+        local_c8 = "FALSE";

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+      }

+    }

+    iVar2 = 0x78;

+  }

+  return iVar2;

 }
```

## `NetInfo_Build`  (modified)

```diff
--- NetInfo_Build
+++ NetInfo_Build
@@ -1,71 +1,79 @@
 

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

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

 

-void * NetInfo_Build(uint param_1,undefined4 *param_2,undefined8 param_3,wchar_t *param_4)

+undefined8 NetInfo_Build(uint param_1,undefined4 *param_2,undefined8 param_3,wchar_t *param_4)

 

 {

-  byte *pbVar1;

-  byte bVar2;

-  byte *in_RAX;

-  int *piVar3;

-  void *pvVar4;

-  undefined4 in_register_0000000c;

-  char *unaff_RBX;

-  longlong unaff_RBP;

-  char *unaff_RDI;

-  undefined4 uVar5;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  bool bVar1;

+  DWORD dwErrCode;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_158 [32];

+  undefined8 local_128;

+  undefined8 local_120;

+  undefined8 local_118 [2];

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  piVar3 = (int *)CONCAT71((int7)((ulonglong)in_RAX >> 8),(byte)in_RAX | *in_RAX);

-  *unaff_RDI = *unaff_RDI + (byte)param_1;

-  *piVar3 = *piVar3 + (int)piVar3;

-  *unaff_RBX = *unaff_RBX + (char)((ulonglong)param_2 >> 8);

-  pbVar1 = (byte *)((longlong)piVar3 + -0x73);

-  bVar2 = (byte)param_1 & 7;

-  *pbVar1 = *pbVar1 >> bVar2 | *pbVar1 << 8 - bVar2;

-  pvVar4 = memset((void *)CONCAT44(in_register_0000000c,param_1),(int)param_2,

-                  CONCAT71((int7)((ulonglong)param_3 >> 8),0x41));

-  if (DAT_0 != 0) {

-    pvVar4 = (void *)FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40

-                                  );

-  }

-  if (5 < DAT_1) {

-    if (((_DAT_2 & 0x400000000000) == 0) ||

-       (pvVar4 = (void *)((ulonglong)DAT_3 & 0x400000000000), pvVar4 != DAT_3)) {

-      pvVar4 = (void *)((ulonglong)pvVar4 & 0xffffffffffffff00);

-    }

-    else {

-      pvVar4 = (void *)CONCAT71((int7)((ulonglong)pvVar4 >> 8),1);

-    }

-    if ((char)pvVar4 != '\0') {

-      uStack000000000000006c = 0;

-      puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-      uStack000000000000007c = 0;

-      *(undefined4 *)(unaff_RBP + -0x74) = 0;

-      uVar5 = 8;

-      uStack0000000000000030 = 1;

-      pcStack0000000000000070 = "DnsCleanupTcpConnections";

-      *(char **)(unaff_RBP + -0x80) = "FALSE";

-      uStack0000000000000068 = 8;

-      uStack0000000000000078 = 0x19;

-      *(undefined4 *)(unaff_RBP + -0x78) = 6;

-      FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-      *(undefined4 *)(unaff_RBP + -0x54) = 0;

-      *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-      *(undefined4 *)(unaff_RBP + -0x58) = uVar5;

-      uStack0000000000000038 = 0x1000000;

-      pvVar4 = (void *)FUN_1800e3690(0x180135218,&DAT_4,0,7,

-                                     (PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+                    /* 0x9caa0  311  NetInfo_Build */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

+  local_128 = 0;

+  if (DAT_1 == 0) {

+    NetInfo_BuildEx(param_1,param_2,(wchar_t *)&local_128,param_4);

+    if (dwErrCode != 0) {

+      SetLastError(dwErrCode);

     }

   }

-  return pvVar4;

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_120;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_120 = 1;

+        local_d8 = "NetInfo_Build";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0xe;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = local_118;

+        local_118[0] = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    local_128 = 0;

+  }

+  return local_128;

 }
```

## `Dns_CreateSocketEx`  (modified)

```diff
--- Dns_CreateSocketEx
+++ Dns_CreateMulticastSocket
@@ -1,85 +1,69 @@
 

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

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

 

-SOCKET Dns_CreateSocketEx(int param_1,int param_2,int param_3,short param_4,undefined4 param_5)

+undefined8 Dns_CreateMulticastSocket(void)

 

 {

   bool bVar1;

-  SOCKET SVar2;

-  undefined2 *puVar3;

-  undefined4 uVar4;

+  undefined4 uVar2;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_1b8 [32];

-  undefined8 local_188;

-  undefined8 local_180;

-  undefined2 local_178 [32];

-  _EVENT_DATA_DESCRIPTOR local_138 [2];

-  undefined8 *local_118;

-  undefined4 local_110;

-  undefined4 local_10c;

-  char *local_108;

-  undefined4 local_100;

-  undefined4 local_fc;

-  char *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

-  undefined8 local_e8 [2];

-  undefined8 *local_d8;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

-  short local_c8 [64];

-  ulonglong local_48;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-                    /* 0x9b520  271  Dns_CreateSocketEx */

-  local_48 = DAT_0 ^ (ulonglong)auStackY_1b8;

-  memset(local_178,0,0x40);

-  puVar3 = (undefined2 *)0x0;

-  if (DAT_1 == 0) {

-    if (param_3 != 0) {

-      puVar3 = local_178;

-      FUN_180018a6c(local_178,param_3,0);

-    }

-    SVar2 = Socket_Create(param_1,param_2,puVar3,param_4,param_5);

-    if (SVar2 == 0) {

-      SVar2 = 0xffffffffffffffff;

-    }

-  }

-  else {

-    memset(local_c8,0,0x80);

+                    /* 0x9b240  269  Dns_CreateMulticastSocket */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    memset(local_98,0,0x80);

     if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

-        local_10c = 0;

-        local_118 = &local_188;

-        local_fc = 0;

-        local_ec = 0;

-        uVar4 = 8;

-        local_188 = 1;

-        local_108 = "Dns_CreateSocketEx";

-        local_f8 = "FALSE";

-        local_110 = 8;

-        local_100 = 0x13;

-        local_f0 = 6;

-        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_dc = 0;

+        local_e8 = &local_118;

         local_cc = 0;

-        local_d8 = &local_180;

-        local_180 = 0x1000000;

-        local_d0 = uVar4;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_138);

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_CreateMulticastSocket";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x1a;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    SVar2 = 0xffffffffffffffff;

   }

-  return SVar2;

+  return 0xffffffffffffffff;

 }
```

## `Dns_PingAdapterServers`  (modified)

```diff
--- Dns_PingAdapterServers
+++ Dns_InitializeMsgRemoteSockaddr
@@ -1,74 +1,60 @@
 

+/* WARNING: Instruction at (ram,0x000180095b31) overlaps instruction at (ram,0x000180095b30)

+    */

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

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

 

-undefined8 Dns_PingAdapterServers(void)

+void Dns_InitializeMsgRemoteSockaddr(longlong param_1,undefined4 param_2)

 

 {

-  bool bVar1;

-  undefined8 uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  uint uVar1;

+  undefined4 in_register_00000014;

+  undefined8 *puVar2;

+  undefined8 *unaff_RBX;

+  undefined8 *puVar3;

+  longlong unaff_RSI;

+  undefined8 unaff_RDI;

+  short unaff_R14W;

+  undefined8 in_stack_00000030;

+  undefined8 *in_stack_00000038;

+  undefined8 in_stack_00000040;

+  undefined8 *in_stack_00000048;

+  undefined8 in_stack_00000050;

+  undefined8 *in_stack_00000058;

+  undefined8 in_stack_00000060;

+  undefined8 *in_stack_00000068;

   

-                    /* 0x9be40  282  Dns_PingAdapterServers */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = 1;

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  puVar2 = (undefined8 *)CONCAT44(in_register_00000014,param_2);

+  do {

+    puVar3 = unaff_RBX;

+    *in_stack_00000058 = puVar3;

+    while( true ) {

+      while( true ) {

+        unaff_RBX = puVar2;

+        if (unaff_RBX == (undefined8 *)0x0) {

+          *(undefined8 *)(unaff_RSI + 0x48) = in_stack_00000030;

+          *(undefined8 *)(unaff_RSI + 0x50) = in_stack_00000040;

+          *(undefined8 *)(unaff_RSI + 0x58) = in_stack_00000060;

+          *(undefined8 *)(unaff_RSI + 0x60) = in_stack_00000050;

+          return;

+        }

+        puVar2 = (undefined8 *)*unaff_RBX;

+        uVar1 = *(uint *)((longlong)unaff_RBX + 0x14) & 3;

+        *unaff_RBX = unaff_RDI;

+        if (1 < uVar1) break;

+        if ((*(short *)(unaff_RBX + 2) == (short)param_1) && (unaff_R14W != (short)param_1)) {

+          *in_stack_00000048 = unaff_RBX;

+          in_stack_00000048 = unaff_RBX;

+        }

+        else {

+          *in_stack_00000038 = unaff_RBX;

+          in_stack_00000038 = unaff_RBX;

+        }

+      }

+      in_stack_00000058 = puVar3;

+      if (uVar1 == 3) break;

+      *in_stack_00000068 = unaff_RBX;

+      in_stack_00000068 = unaff_RBX;

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_PingAdapterServers";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x17;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0;

-  }

-  return uVar2;

+  } while( true );

 }
```

## `Send_MessagePrivateEx`  (modified)

```diff
--- Send_MessagePrivateEx
+++ Send_MessagePrivateEx
@@ -1,68 +1,154 @@
 

-int Send_MessagePrivateEx(longlong param_1,short *param_2,int param_3,undefined4 param_4)

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

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

+

+int Send_MessagePrivateEx(longlong param_1,short *param_2,undefined4 param_3,undefined4 param_4)

 

 {

-  undefined8 uVar1;

-  longlong lVar2;

-  longlong unaff_RBX;

-  char *unaff_RBP;

-  longlong unaff_RDI;

-  undefined4 in_register_00000084;

-  char *pcVar3;

-  int unaff_R14D;

+  ushort *puVar1;

+  byte bVar2;

+  uint uVar3;

   bool bVar4;

+  bool bVar5;

+  undefined1 uVar6;

+  ushort uVar7;

+  int iVar8;

+  undefined8 uVar9;

+  longlong lVar10;

+  u_short uVar11;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_198 [32];

+  undefined8 local_150;

+  undefined8 local_148 [2];

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined8 local_110;

+  char *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

+  undefined8 local_d0;

+  short local_c8 [64];

+  ulonglong local_48;

   

-  FUN_18004cd00((int *)(ulonglong)*(uint *)(unaff_RDI + 0x1f0));

-  *(undefined8 *)(unaff_RBX + 0x1f0) = *(undefined8 *)(unaff_RDI + 0x1f0);

-  *(undefined8 *)(unaff_RBX + 0xe8) = *(undefined8 *)(*(longlong *)(unaff_RDI + 0x1f0) + 8);

-  *(undefined8 *)(unaff_RBX + 0xf0) = *(undefined8 *)(*(longlong *)(unaff_RDI + 0x1f0) + 8);

-  *(undefined8 *)(unaff_RBX + 0xf8) = *(undefined8 *)(*(longlong *)(unaff_RDI + 0x1f0) + 8);

-  *(undefined2 *)(unaff_RBX + 0x100) = *(undefined2 *)(*(longlong *)(unaff_RDI + 0x1f0) + 0x48);

-  bVar4 = DAT_0 != 0;

-  *(ulonglong *)(unaff_RBX + 0x108) =

-       *(ulonglong *)(*(longlong *)(unaff_RDI + 0x1f0) + 0x40) | 0x100;

-  *(undefined8 *)(unaff_RBX + 600) = *(undefined8 *)(unaff_RDI + 600);

-  *(undefined4 *)(unaff_RBX + 0x1a4) = *(undefined4 *)(*(longlong *)(unaff_RDI + 0x1f0) + 0x4c);

-  *(undefined4 *)(unaff_RBX + 0x188) = *(undefined4 *)(unaff_RDI + 0x188);

-  *(undefined4 *)(unaff_RBX + 0x148) = *(undefined4 *)(unaff_RDI + 0x148);

-  *(undefined4 *)(unaff_RBX + 0x158) = *(undefined4 *)(unaff_RDI + 0x158);

-  *(undefined2 *)(unaff_RBX + 0xdc0) = *(undefined2 *)(unaff_RDI + 0xdc0);

-  if (bVar4) {

-    *(undefined4 *)(unaff_RBX + 0xdc8) = *(undefined4 *)(unaff_RDI + 0xdc8);

-  }

-  lVar2 = *(longlong *)(*(longlong *)(unaff_RDI + 0x1f0) + 0x80);

-  if (((*(byte *)(lVar2 + 0x310) & 1) != 0) && ((*(byte *)(lVar2 + 0x2d8) & 1) != 0)) {

-    if (((*(byte *)(unaff_RDI + 0x310) & 2) == 0) || ((*(byte *)(unaff_RDI + 0x388) & 4) == 0)) {

-      if ((DAT_1 & 8) != 0) {

-        FUN_1800f8b4c(lVar2,0x1a9,CONCAT44(in_register_00000084,param_3),unaff_RBP,unaff_RBX,

-                      unaff_RDI);

-      }

-      *(ulonglong *)(unaff_RBX + 0x108) = *(ulonglong *)(unaff_RBX + 0x108) | 0x400;

+                    /* 0x476b0  339  Send_MessagePrivateEx */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_198;

+  local_148[0] = CONCAT44(local_148[0]._4_4_,param_4);

+  local_150 = CONCAT44(local_150._4_4_,param_3);

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar8 = FUN_1800ca394(unaff_retaddr), iVar8 != 0)) {

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800fae1c();

+    }

+    puVar1 = (ushort *)(param_1 + 700);

+    *(byte *)(param_1 + 0x2bf) = *(byte *)(param_1 + 0x2bf) & 0xbf;

+    if (param_2 != (short *)0x0) {

+      FUN_180052ee8(param_1,(undefined8 *)param_2);

+    }

+    FUN_180037390(param_1,(short *)(param_1 + 0x3c));

+    uVar3 = *(uint *)(param_1 + 0x2a0);

+    if ((DAT_3 != 0) || (bVar4 = true, *(char *)(param_1 + 0x28c) != '\0')) {

+      bVar4 = false;

+    }

+    bVar2 = *(byte *)(param_1 + 0x2be);

+    if ((param_2 == (short *)0x0) || (uVar9 = FUN_180079400(param_2), (int)uVar9 == 0)) {

+      bVar5 = false;

     }

     else {

-      if ((DAT_1 & 8) != 0) {

-        FUN_1800f8b4c(lVar2,0x1a8,CONCAT44(in_register_00000084,param_3),unaff_RBP,unaff_RBX,

-                      unaff_RDI);

+      bVar5 = true;

+    }

+    if (((((int)local_150 != 0) || (bVar4)) || ((bVar2 & 0x78) == 0x28)) || (bVar5)) {

+      bVar4 = true;

+    }

+    else {

+      bVar4 = false;

+    }

+    lVar10 = *(longlong *)(param_1 + 600);

+    if (((*(longlong *)(param_1 + 0x2b0) == 0) || ((uVar3 & 0x1000000) != 0)) || (!bVar4)) {

+      bVar4 = false;

+    }

+    else {

+      if ((DAT_2 & 8) != 0) {

+        FUN_1800f7614(0x40b,0x4c,0x18010da00);

       }

-      *(ulonglong *)(unaff_RBX + 0x108) = *(ulonglong *)(unaff_RBX + 0x108) | 0x400000000000;

+      lVar10 = *(longlong *)(param_1 + 0x2b0);

+      *(short *)(param_1 + 0x2c6) = *(short *)(param_1 + 0x2c6) + -1;

+      bVar4 = true;

     }

-    *(ulonglong *)(unaff_RBX + 0x108) =

-         (ulonglong)*(uint *)(unaff_RDI + 0x108) & 0x80000000 | *(ulonglong *)(unaff_RBX + 0x108);

+    uVar11 = (short)lVar10 - (short)puVar1;

+    if ((*(longlong *)(param_1 + 0x2b0) == 0) || (lVar10 == *(longlong *)(param_1 + 0x2b0))) {

+      uVar6 = 0;

+    }

+    else {

+      uVar6 = 1;

+    }

+    *(undefined1 *)(param_1 + 0x291) = uVar6;

+    *(u_short *)(param_1 + 0x2ba) = uVar11;

+    FUN_180020960("Sending packet",param_1);

+    *puVar1 = *puVar1 >> 8 | *puVar1 << 8;

+    *(ushort *)(param_1 + 0x2c0) =

+         *(ushort *)(param_1 + 0x2c0) >> 8 | *(ushort *)(param_1 + 0x2c0) << 8;

+    *(ushort *)(param_1 + 0x2c2) =

+         *(ushort *)(param_1 + 0x2c2) >> 8 | *(ushort *)(param_1 + 0x2c2) << 8;

+    *(ushort *)(param_1 + 0x2c4) =

+         *(ushort *)(param_1 + 0x2c4) >> 8 | *(ushort *)(param_1 + 0x2c4) << 8;

+    *(ushort *)(param_1 + 0x2c6) =

+         *(ushort *)(param_1 + 0x2c6) >> 8 | *(ushort *)(param_1 + 0x2c6) << 8;

+    if (*(char *)(param_1 + 0x288) == '\0') {

+      iVar8 = FUN_18007842c(param_1,puVar1,uVar11,(u_long)local_148[0]);

+    }

+    else {

+      iVar8 = FUN_18008a408(param_1,uVar11);

+    }

+    *puVar1 = *puVar1 >> 8 | *puVar1 << 8;

+    *(ushort *)(param_1 + 0x2c0) =

+         *(ushort *)(param_1 + 0x2c0) >> 8 | *(ushort *)(param_1 + 0x2c0) << 8;

+    *(ushort *)(param_1 + 0x2c2) =

+         *(ushort *)(param_1 + 0x2c2) >> 8 | *(ushort *)(param_1 + 0x2c2) << 8;

+    *(ushort *)(param_1 + 0x2c4) =

+         *(ushort *)(param_1 + 0x2c4) >> 8 | *(ushort *)(param_1 + 0x2c4) << 8;

+    uVar7 = *(ushort *)(param_1 + 0x2c6) >> 8 | *(ushort *)(param_1 + 0x2c6) << 8;

+    *(ushort *)(param_1 + 0x2c6) = uVar7;

+    if (bVar4) {

+      *(ushort *)(param_1 + 0x2c6) = uVar7 + 1;

+    }

+    FUN_180021014(param_1,iVar8);

+    if (iVar8 != 0) {

+      *(undefined1 *)(param_1 + 0x292) = 0;

+    }

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800f892c(0x40b,0x4d,0x18010da00,param_1);

+    }

   }

-  uVar1 = *(undefined8 *)(unaff_RDI + 0xd88);

-  *(undefined8 *)(unaff_RBX + 0xd88) = uVar1;

-  FUN_18007519c(uVar1);

-  *(undefined8 *)(unaff_RBX + 0x400) = *(undefined8 *)(unaff_RDI + 0x400);

-  *(undefined4 *)(unaff_RBX + 0x1fc) = *(undefined4 *)(unaff_RDI + 0x1fc);

-  lVar2 = unaff_RBX;

-  FUN_180071848(unaff_RBX);

-  if ((DAT_1 & 8) != 0) {

-    pcVar3 = "multicast";

-    if (unaff_R14D == 0) {

-      pcVar3 = unaff_RBP;

+  else {

+    memset(local_c8,0,0x80);

+    if (DAT_4 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

     }

-    FUN_1800f8b4c(lVar2,0x1aa,CONCAT44(in_register_00000084,param_3),pcVar3,unaff_RBX,unaff_RDI);

+    if (5 < DAT_5) {

+      if (((_DAT_6 & 0x400000000000) == 0) ||

+         (bVar4 = true, (DAT_7 & 0x400000000000) != DAT_7)) {

+        bVar4 = false;

+      }

+      if (bVar4) {

+        local_118 = local_148;

+        local_148[0] = 1;

+        local_110 = 8;

+        local_108 = "Send_MessagePrivateEx";

+        local_100 = 0x16;

+        local_f8 = "FALSE";

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_d8 = &local_150;

+        local_150 = 0x1000000;

+        local_d0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_8,0,7,local_138);

+      }

+    }

+    iVar8 = 0x78;

   }

-  return (int)unaff_RBX;

+  return iVar8;

 }
```

## `DnsGetZtTrustedCa`  (modified)

```diff
--- DnsGetZtTrustedCa
+++ DnsGetZtRules
@@ -1,51 +1,12 @@
 

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

 

-ulonglong DnsGetZtTrustedCa(int param_1,longlong param_2,uint param_3,undefined8 *param_4)

+ulonglong DnsGetZtRules(int param_1,longlong param_2,uint param_3,undefined4 *param_4,

+                       undefined8 *param_5)

 

 {

-  uint in_EAX;

-  uint uVar1;

-  uint7 uVar3;

-  ulonglong uVar2;

-  longlong unaff_RBP;

-  undefined4 uVar4;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  ulonglong in_RAX;

   

-  uVar1 = in_EAX & (uint)param_2;

-  uVar3 = (uint7)(uint3)(uVar1 >> 8);

-  if (uVar1 == DAT_0) {

-    uVar2 = CONCAT71(uVar3,1);

-  }

-  else {

-    uVar2 = (ulonglong)uVar3 << 8;

-  }

-  if ((char)uVar2 != '\0') {

-    uStack000000000000006c = 0;

-    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-    uStack000000000000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    uVar4 = 8;

-    uStack0000000000000030 = 1;

-    pcStack0000000000000070 = "DnsIsStatusRcode";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    uStack0000000000000068 = 8;

-    uStack0000000000000078 = 0x11;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    *(undefined4 *)(unaff_RBP + -0x58) = uVar4;

-    uStack0000000000000038 = 0x1000000;

-    uVar2 = FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  }

-  return uVar2 & 0xffffffffffffff00;

+  return in_RAX;

 }
```

## `DnsUpdateCaptivePortalPresence`  (modified)

```diff
--- DnsUpdateCaptivePortalPresence
+++ DnsUpdateCaptivePortalPresence
@@ -1,193 +1,78 @@
 

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

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

 

-uint DnsUpdateCaptivePortalPresence(undefined4 param_1)

+void DnsUpdateCaptivePortalPresence(undefined4 param_1)

 

 {

-  int iVar1;

-  longlong lVar2;

-  bool bVar3;

-  uint uVar4;

-  ulonglong uVar5;

-  _CERT_EXTENSION *p_Var6;

-  int *piVar7;

-  undefined4 in_register_0000000c;

-  int *piVar8;

-  _CERT_EXTENSION *p_Var9;

-  ushort uVar10;

-  int *in_RDX;

-  _CERT_EXTENSION *in_R8;

-  DWORD DVar11;

-  undefined4 uVar12;

-  undefined4 uVar13;

-  undefined1 auStackY_1d8 [32];

-  RPC_ASYNC_EVENT RStack_168;

-  uint uStack_164;

-  FILETIME FStack_158;

-  undefined8 uStack_150;

-  _CERT_EXTENSION *p_Stack_148;

-  undefined *puStack_140;

-  uint uStack_138;

-  int iStack_134;

-  LARGE_INTEGER LStack_130;

-  undefined4 uStack_128;

-  undefined4 uStack_124;

-  undefined4 uStack_118;

-  int iStack_110;

-  int aiStack_c8 [28];

-  ulonglong uStack_58;

+  bool bVar1;

+  int iVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-                    /* 0x664b0  174  DnsQueryEx */

-  piVar8 = (int *)CONCAT44(in_register_0000000c,param_1);

-  uStack_58 = DAT_0 ^ (ulonglong)auStackY_1d8;

-  p_Stack_148 = in_R8;

-  memset(&uStack_128,0,0x60);

-  p_Var9 = (_CERT_EXTENSION *)0x0;

-  uStack_164 = 0;

-  RStack_168 = RpcCallComplete;

-  memset(aiStack_c8,0,0x70);

-  LStack_130.QuadPart = 0;

-  FStack_158.dwLowDateTime = 0;

-  FStack_158.dwHighDateTime = 0;

-  uStack_150 = 0;

-  puStack_140 = (undefined *)0x0;

-  bVar3 = false;

-  uStack_138 = 0;

-  iStack_134 = 0;

-  QueryPerformanceCounter(&LStack_130);

-  uVar4 = FUN_180048df8(piVar8,in_RDX);

-  if (uVar4 != 0) {

-    if ((DAT_2 & 8) == 0) goto LAB_1800667de;

-    uVar10 = 0x6d;

-LAB_3:

-    FUN_1800f658c(0x40b,uVar10,0x18010fd18,uVar4);

-    goto LAB_1;

+                    /* 0x672a0  235  DnsUpdateCaptivePortalPresence */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x1e,0x18010fd98,param_1);

   }

-  uStack_124 = 0x60;

-  iVar1 = piVar8[10];

-  uStack_128 = 0x80000001;

-  if (iVar1 != 0) {

-    uStack_118 = 0xc;

-    iStack_110 = iVar1;

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    AcquireSRWLockExclusive((PSRWLOCK)&DAT_3);

+    DAT_4 = param_1;

+    ReleaseSRWLockExclusive((PSRWLOCK)&DAT_3);

+    return;

   }

-  if (*piVar8 == 2) {

-    uStack_164 = piVar8[0x10];

-    RStack_168 = piVar8[0x11];

+  memset(local_98,0,0x80);

+  if (DAT_5 != 0) {

+    FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

   }

-  *(undefined8 *)(in_RDX + 2) = *(undefined8 *)(piVar8 + 6);

-  if (*piVar8 == 3) {

-    puStack_140 = *(undefined **)(piVar8 + 0x14);

-    uStack_138 = piVar8[0x12];

+  if (DAT_6 < 6) {

+    return;

   }

-  if ((puStack_140 == (undefined *)0x0) && (uStack_138 == 0)) {

-    uVar5 = FUN_180066830(&uStack_138,&puStack_140,&iStack_134);

-    uVar4 = (uint)uVar5;

-    if (uVar4 != 0) {

-      if ((DAT_2 & 8) == 0) goto LAB_1800667de;

-      uVar10 = 0x6e;

-      goto LAB_3;

-    }

-    if (iStack_134 != 0) {

-      *(ulonglong *)(in_RDX + 2) = *(ulonglong *)(in_RDX + 2) | 0x200000000000000;

-    }

-    bVar3 = true;

-  }

-  p_Var6 = p_Var9;

-  if (*(LPVOID *)(piVar8 + 8) == (LPVOID)0x0) {

-LAB_4:

-    lVar2 = *(longlong *)(piVar8 + 0xc);

-    DVar11 = 0;

-    uVar12 = 0;

-    uVar13 = 0;

-    if (lVar2 != 0) {

-      FStack_158.dwLowDateTime = 1;

-      uStack_150._0_4_ = (undefined4)lVar2;

-      uStack_150._4_4_ = (undefined4)((ulonglong)lVar2 >> 0x20);

-      DVar11 = FStack_158.dwHighDateTime;

-      uVar12 = (undefined4)uStack_150;

-      uVar13 = uStack_150._4_4_;

-      uStack_150 = lVar2;

-    }

-    piVar7 = in_RDX;

-    if (*in_RDX == -1) {

-LAB_5:

-      ((LARGE_INTEGER *)(piVar7 + 0x12))->s = (_struct_19)LStack_130;

-      FStack_158.dwHighDateTime = DVar11;

-      FStack_158.dwLowDateTime = (uint)(lVar2 != 0);

-      uStack_150 = CONCAT44(uVar13,uVar12);

-      uVar4 = FUN_18002e8a0(*(_CERT_EXTENSION **)(piVar8 + 2),*(ushort *)(piVar8 + 4),

-                            (PCERT_EXTENSION)(in_RDX + 2),p_Var6,uStack_164,RStack_168,&FStack_158,

-                            *(undefined8 *)(piVar8 + 0xe),

-                            (int *)(-(ulonglong)(iVar1 != 0) & (ulonglong)&uStack_128),uStack_138,

-                            puStack_140,0,(BYTE *)piVar7,p_Stack_148);

-      if (uVar4 != 0x2522) {

-        if (in_RDX != piVar7) {

-          in_RDX[0] = 0;

-          in_RDX[1] = 0;

-          in_RDX[2] = 0;

-          in_RDX[3] = 0;

-          in_RDX[4] = 0;

-          in_RDX[5] = 0;

-          in_RDX[6] = 0;

-          in_RDX[7] = 0;

-          *in_RDX = *piVar7;

-          in_RDX[1] = piVar7[1];

-          *(undefined8 *)(in_RDX + 2) = *(undefined8 *)(piVar7 + 2);

-          *(undefined8 *)(in_RDX + 4) = *(undefined8 *)(piVar7 + 4);

-        }

-        if (piVar7[0xc] != 0) {

-          DnsApiFree(piVar7);

-        }

-      }

-    }

-    else {

-      if (lVar2 == 0) {

-        piVar7 = aiStack_c8;

-        aiStack_c8[0] = *in_RDX;

-        goto LAB_5;

-      }

-      piVar7 = FUN_18008a630(0x70);

-      if (piVar7 != (int *)0x0) {

-        *piVar7 = *in_RDX;

-        piVar7[1] = in_RDX[1];

-        *(undefined8 *)(piVar7 + 2) = *(undefined8 *)(in_RDX + 2);

-        *(undefined8 *)(piVar7 + 4) = *(undefined8 *)(in_RDX + 4);

-        *(int **)(piVar7 + 10) = in_RDX;

-        piVar7[0xc] = 1;

-        goto LAB_5;

-      }

-      uVar4 = 0xe;

-    }

-    if (p_Var6 != (_CERT_EXTENSION *)0x0) {

-      DnsApiFree(p_Var6);

-    }

+  if (((_DAT_7 & 0x400000000000) == 0) ||

+     ((DAT_8 & 0x400000000000) != DAT_8)) {

+    bVar1 = false;

   }

   else {

-    p_Var6 = (_CERT_EXTENSION *)FUN_180042b90(*(LPVOID *)(piVar8 + 8),0,0);

-    if (p_Var6 != (_CERT_EXTENSION *)0x0) {

-      if (*(uint *)((longlong)&p_Var6->pszObjId + 4) != 0) {

-        do {

-          if (*(short *)&p_Var6[(longlong)p_Var9 * 2 + 1].pszObjId == 2) {

-            *(uint *)&p_Var6[(longlong)p_Var9 * 2 + 2].pszObjId = 0x10;

-          }

-          else if (*(short *)&p_Var6[(longlong)p_Var9 * 2 + 1].pszObjId == 0x17) {

-            *(uint *)&p_Var6[(longlong)p_Var9 * 2 + 2].pszObjId = 0x1c;

-          }

-          uVar4 = (int)p_Var9 + 1;

-          p_Var9 = (_CERT_EXTENSION *)(ulonglong)uVar4;

-        } while (uVar4 < *(uint *)((longlong)&p_Var6->pszObjId + 4));

-      }

-      goto LAB_4;

-    }

-    uVar4 = 0xe;

+    bVar1 = true;

   }

-  if (bVar3) {

-    DnsFreeCustomServers(&uStack_138,&puStack_140);

+  if (!bVar1) {

+    return;

   }

-LAB_1:

-  if (uVar4 != 0x2522) {

-    FUN_18002d708(LStack_130.s.LowPart,3,uVar4);

-  }

-  return uVar4;

+  local_dc = 0;

+  local_e8 = &local_118;

+  local_cc = 0;

+  local_bc = 0;

+  local_d8 = "DnsUpdateCaptivePortalPresence";

+  local_c8 = "FALSE";

+  local_118 = 1;

+  local_e0 = 8;

+  local_d0 = 0x1f;

+  local_c0 = 6;

+  FUN_180055600(local_b8,(undefined *)local_98);

+  local_9c = 0;

+  local_a8 = &local_110;

+  local_110 = 0x1000000;

+  local_a0 = 8;

+  FUN_1800e3690(0x180135218,&DAT_9,0,7,local_108);

+  return;

 }
```

## `DnsDhcpSrvRegisterInit`  (modified)

```diff
--- DnsDhcpSrvRegisterInit
+++ DnsDhcpSrvRegisterHostAddr
@@ -1,58 +1,10 @@
 

-DWORD DnsDhcpSrvRegisterInit(longlong *param_1,uint param_2)

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

+

+ulonglong DnsDhcpSrvRegisterHostAddr(longlong param_1)

 

 {

-  DWORD DVar1;

-  undefined8 uVar2;

-  int *unaff_RBX;

-  bool in_ZF;

-  undefined8 uStack0000000000000040;

-  undefined8 uStack0000000000000048;

-  

-  if (!in_ZF) {

-    FUN_1800f71b8(0x40b,0x23,0x18010fd18,unaff_RBX);

-  }

-  uStack0000000000000040 = *(undefined8 *)(unaff_RBX + 0x44);

-  uStack0000000000000048 = *(undefined8 *)(unaff_RBX + 0x46);

-  uVar2 = FUN_1800ca6a0((int *)&stack0x00000040);

-  DVar1 = (DWORD)uVar2;

-  if (DVar1 == 0) {

-    FUN_180021fa0(*(wchar_t **)(unaff_RBX + 0x38),(uint)*(ushort *)(unaff_RBX + 0x40),

-                  *(undefined8 *)(unaff_RBX + 0x42),

-                  *(undefined4 *)(*(longlong *)(unaff_RBX + 0x4a) + 4),

-                  *(undefined8 **)(*(longlong *)(unaff_RBX + 0x4a) + 0x10));

-    if ((DAT_0 & 8) != 0) {

-      FUN_1800e6e70();

-    }

-    if (unaff_RBX[0x44] == 1) {

-      FUN_180062648(*(undefined8 **)(unaff_RBX + 0x4a),*(undefined **)(unaff_RBX + 0x46),

-                    *(undefined8 *)(unaff_RBX + 0x48));

-    }

-    else {

-      FUN_1800c155c((undefined4 *)*(undefined8 **)(unaff_RBX + 0x4a),

-                    *(undefined **)(unaff_RBX + 0x46),*(undefined8 *)(unaff_RBX + 0x48));

-    }

-    unaff_RBX[0x4a] = 0;

-    unaff_RBX[0x4b] = 0;

-    if (*(HANDLE *)(unaff_RBX + 0x124) != (HANDLE)0x0) {

-      SetEvent(*(HANDLE *)(unaff_RBX + 0x124));

-    }

-    if (*(LPVOID *)(unaff_RBX + 0x102) != (LPVOID)0x0) {

-      DnsApiFree(*(LPVOID *)(unaff_RBX + 0x102));

-      unaff_RBX[0x102] = 0;

-      unaff_RBX[0x103] = 0;

-    }

-    DVar1 = DeRefQueryBlobEx(unaff_RBX,"InProc_ProcessQueryCallback",0x59d,2);

-  }

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

-    if ((DAT_0 & 8) != 0) {

-      FUN_1800e6df4();

-    }

-    DVar1 = SetEvent(*(HANDLE *)(unaff_RBX + 0x124));

-  }

-  if ((DAT_0 & 8) != 0) {

-    DVar1 = FUN_1800f7614(0x40b,0x26,0x18010fd18);

-  }

-  return DVar1;

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

+  halt_baddata();

 }
```

## `Dns_UpdateLibEx`  (modified)

```diff
--- Dns_UpdateLibEx
+++ Dns_SkipToRecord
@@ -1,41 +1,21 @@
 

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

-

-undefined8 Dns_UpdateLibEx(void)

+byte * Dns_SkipToRecord(longlong param_1,byte *param_2,int param_3)

 

 {

-  uint in_EAX;

-  uint in_EDX;

-  longlong unaff_RBP;

-  undefined4 uVar1;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  int *piVar1;

+  byte *pbVar2;

+  code *pcVar3;

+  char in_AL;

+  undefined7 in_register_00000001;

+  undefined4 in_register_00000084;

+  byte in_R9B;

   

-  if ((in_EAX & in_EDX) == DAT_0) {

-    uStack000000000000006c = 0;

-    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-    uStack000000000000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    uVar1 = 8;

-    uStack0000000000000030 = 1;

-    pcStack0000000000000070 = "DnsBuildDotHost";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    uStack0000000000000068 = 8;

-    uStack0000000000000078 = 0x10;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

-    uStack0000000000000038 = 0x1000000;

-    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  }

-  return 0x78;

+  piVar1 = (int *)(CONCAT71(in_register_00000001,in_AL + '\x10') + -0x75);

+  *piVar1 = *piVar1 + -1;

+  pbVar2 = (byte *)(CONCAT44(in_register_00000084,param_3) + 0x33);

+  *pbVar2 = *pbVar2 ^ in_R9B;

+  pcVar3 = (code *)swi(3);

+  pbVar2 = (byte *)(*pcVar3)();

+  return pbVar2;

 }
```

## `Dns_SetRecordsTtl`  (modified)

```diff
--- Dns_SetRecordsTtl
+++ Dns_SetRecordsTtl
@@ -1,10 +1,74 @@
 

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

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

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

 

 void Dns_SetRecordsTtl(undefined8 *param_1,undefined4 param_2)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

+  

+                    /* 0x6a6f0  293  Dns_SetRecordsTtl */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    for (; param_1 != (undefined8 *)0x0; param_1 = (undefined8 *)*param_1) {

+      *(undefined4 *)(param_1 + 3) = param_2;

+    }

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_SetRecordsTtl";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x12;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

+  return;

 }
```

## `DnsFreeZtRules`  (modified)

```diff
--- DnsFreeZtRules
+++ DnsFreeZtRules
@@ -1,27 +1,72 @@
 

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

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

 

-undefined8 DnsFreeZtRules(uint param_1,void *param_2)

+void DnsFreeZtRules(uint param_1,LPVOID param_2)

 

 {

-  char *pcVar1;

-  undefined1 uVar2;

-  undefined7 uVar3;

-  char *in_RAX;

-  longlong unaff_RBP;

-  undefined1 *unaff_RSI;

-  undefined4 in_R9D;

-  undefined8 uStack0000000000000030;

+  bool bVar1;

+  ulonglong uVar2;

+  LPVOID pvVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  uVar3 = (undefined7)((ulonglong)in_RAX >> 8);

-  uVar2 = *unaff_RSI;

-  pcVar1 = (char *)(CONCAT71(uVar3,uVar2) + -0x73);

-  *pcVar1 = *pcVar1 + (char)param_1;

-  *(ulonglong *)(unaff_RBP + -0x60) = CONCAT71(uVar3,uVar2) & 0xffffffffffffff38;

-  *(undefined4 *)(unaff_RBP + -0x58) = in_R9D;

-  uStack0000000000000030 = 0x1000000;

-  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000038);

-  return 0x78;

+                    /* 0x9dcd0  103  DnsFreeZtRules */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    if (param_2 != (LPVOID)0x0) {

+      if (param_1 != 0) {

+        uVar2 = (ulonglong)param_1;

+        pvVar3 = param_2;

+        do {

+          FUN_1800d434c((longlong)pvVar3);

+          pvVar3 = (LPVOID)((longlong)pvVar3 + 0x30);

+          uVar2 = uVar2 - 1;

+        } while (uVar2 != 0);

+      }

+      DnsApiFree(param_2);

+    }

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_e8 = &local_118;

+        local_118 = 1;

+        local_e0 = 8;

+        local_d8 = "DnsFreeZtRules";

+        local_d0 = 0xf;

+        local_c8 = "FALSE";

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

+  return;

 }
```

## `DnsApiRealloc`  (modified)

```diff
--- DnsApiRealloc
+++ DnsApiRealloc
@@ -1,12 +1,73 @@
 

-undefined4 DnsApiRealloc(LPVOID param_1,ulonglong param_2)

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

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

+

+void DnsApiRealloc(LPVOID param_1,ulonglong param_2)

 

 {

-  undefined4 unaff_EBX;

-  undefined4 *unaff_RSI;

-  undefined4 unaff_EDI;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *unaff_RSI = unaff_EBX;

-  return unaff_EDI;

+                    /* 0x91a00  32  DnsApiRealloc */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "DnsApiRealloc";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0xe;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

+  if (DAT_7 == (HANDLE)0x0) {

+    DAT_7 = GetProcessHeap();

+  }

+  HeapReAlloc(DAT_7,0,param_1,param_2 & 0xffffffff);

+  return;

 }
```

## `Dns_SkipToRecord`  (modified)

```diff
--- Dns_SkipToRecord
+++ Dns_SkipToRecord
@@ -1,21 +1,74 @@
+

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

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

 

 byte * Dns_SkipToRecord(longlong param_1,byte *param_2,int param_3)

 

 {

-  int *piVar1;

+  bool bVar1;

   byte *pbVar2;

-  code *pcVar3;

-  char in_AL;

-  undefined7 in_register_00000001;

-  undefined4 in_register_00000084;

-  byte in_R9B;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  piVar1 = (int *)(CONCAT71(in_register_00000001,in_AL + '\x10') + -0x75);

-  *piVar1 = *piVar1 + -1;

-  pbVar2 = (byte *)(CONCAT44(in_register_00000084,param_3) + 0x33);

-  *pbVar2 = *pbVar2 ^ in_R9B;

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

-  pbVar2 = (byte *)(*pcVar3)();

+                    /* 0x9c680  295  Dns_SkipToRecord */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    pbVar2 = FUN_1800d3e24(param_1,param_2,param_3);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_SkipToRecord";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x11;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    pbVar2 = (byte *)0x0;

+  }

   return pbVar2;

 }
```

## `Send_AndRecvUdpWithParam`  (modified)

```diff
--- Send_AndRecvUdpWithParam
+++ HostsFile_Close
@@ -1,74 +1,14 @@
 

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

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

 

-uint Send_AndRecvUdpWithParam(byte *param_1)

+void HostsFile_Close(undefined8 *param_1)

 

 {

-  bool bVar1;

-  uint uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  ulonglong in_RDX;

+  int in_R8D;

+  undefined4 in_R9D;

   

-                    /* 0x6bc50  337  Send_AndRecvUdpWithParam */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = FUN_1800a8cc0(param_1);

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "Send_AndRecvUdpWithParam";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x19;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0x78;

-  }

-  return uVar2;

+  FUN_18002ca60((longlong)param_1,in_RDX,in_R8D,in_R9D);

+  return;

 }
```

## `Dns_ParsePacketRecord`  (modified)

```diff
--- Dns_ParsePacketRecord
+++ Dns_ParsePacketRecord
@@ -1,17 +1,74 @@
 

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

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

 

 undefined8 Dns_ParsePacketRecord(byte *param_1,byte *param_2,undefined8 *param_3)

 

 {

-  longlong unaff_RBP;

-  undefined4 in_R9D;

-  undefined8 uStack0000000000000038;

+  bool bVar1;

+  undefined8 uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *(undefined4 *)(unaff_RBP + -0x58) = in_R9D;

-  uStack0000000000000038 = 0x1000000;

-  FUN_1800e3690(0x180135218,param_2,0,7,

-                (PEVENT_DATA_DESCRIPTOR)((ulonglong)&stack0x00000040 & 0xffffffff));

-  return 0;

+                    /* 0x9bce0  281  Dns_ParsePacketRecord */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800d39d8(param_1,param_2,param_3);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_ParsePacketRecord";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x16;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0;

+  }

+  return uVar2;

 }
```

## `Local_GetRecordsForLocalName`  (modified)

```diff
--- Local_GetRecordsForLocalName
+++ HostsFile_Open
@@ -1,18 +1,30 @@
 

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

 

-uint Local_GetRecordsForLocalName(longlong param_1,ushort param_2)

+undefined8 HostsFile_Open(longlong *param_1,undefined *param_2,undefined8 param_3,char *param_4)

 

 {

-  undefined6 in_register_00000012;

   longlong unaff_RBP;

-  undefined4 in_R9D;

+  undefined4 uVar1;

+  undefined8 uStack0000000000000030;

   undefined8 uStack0000000000000038;

+  undefined4 uStack0000000000000068;

+  undefined8 uStack0000000000000070;

+  undefined4 uStack0000000000000078;

   

-  *(undefined4 *)(unaff_RBP + -0x58) = in_R9D;

+  uVar1 = SUB84(param_4,0);

+  uStack0000000000000030 = 1;

+  uStack0000000000000070 = 0x80111540;

+  *(char **)(unaff_RBP + -0x80) = "FALSE";

+  uStack0000000000000078 = 0x18;

+  *(undefined4 *)(unaff_RBP + -0x78) = 6;

+  uStack0000000000000068 = uVar1;

+  FUN_180055600(param_1,param_2);

+  *(undefined4 *)(unaff_RBP + -0x54) = 0;

+  *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+  *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

   uStack0000000000000038 = 0x1000000;

-  FUN_1800e3690(0x180135218,(byte *)CONCAT62(in_register_00000012,param_2),0,7,

-                (PEVENT_DATA_DESCRIPTOR)((ulonglong)&stack0x00000040 & 0xffffffff));

+  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

   return 0x78;

 }
```

## `DnsGetApplicationIdentifier`  (modified)

```diff
--- DnsGetApplicationIdentifier
+++ DnsGetApplicationIdentifier
@@ -1,141 +1,203 @@
 

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

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

 

-ulonglong DnsGetApplicationIdentifier(ushort **param_1,void *param_2,DWORD *param_3)

+ulonglong DnsGetApplicationIdentifier(undefined8 *param_1,void *param_2,DWORD *param_3)

 

 {

-  longlong *plVar1;

-  bool bVar2;

-  char in_AL;

-  uint uVar3;

-  uint extraout_EAX;

-  uint extraout_EAX_00;

-  uint extraout_EAX_01;

-  ulonglong uVar4;

-  undefined8 uVar5;

-  uint unaff_EBX;

-  ulonglong uVar6;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  ushort **unaff_RDI;

-  undefined8 uVar7;

-  wchar_t *in_R9;

-  int unaff_R12D;

-  longlong unaff_R13;

-  undefined1 *puVar8;

-  uint *unaff_R14;

-  uint *unaff_R15;

-  undefined8 in_stack_00000050;

-  undefined8 in_stack_00000058;

-  longlong in_stack_00000060;

-  int iStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  ushort **ppuStack0000000000000070;

-  ushort *puStack0000000000000078;

+  byte bVar1;

+  byte bVar2;

+  bool bVar3;

+  longlong lVar4;

+  longlong lVar5;

+  byte *pbVar6;

+  byte *pbVar7;

+  ulonglong uVar8;

+  byte bVar9;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_168 [32];

+  EVENT_DESCRIPTOR local_130;

+  undefined8 local_120;

+  undefined8 local_118 [2];

+  _EVENT_DATA_DESCRIPTOR local_108;

+  undefined *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  short *local_b8;

+  int local_b0;

+  undefined4 local_ac;

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-  if (in_AL == '\0') {

-    if ((unaff_EBX & 0x1ff) == 0) {

-      unaff_EBX = unaff_EBX | _DAT_0;

-    }

-    if ((unaff_R12D == 0) && (unaff_R13 != 0)) {

-      unaff_EBX = unaff_EBX | 0x200;

-    }

-  }

-  puStack0000000000000078 = unaff_RDI[1];

-  puVar8 = (undefined1 *)&stack0x00000070;

-  *(undefined2 *)(unaff_RBP + -0x80) = *(undefined2 *)(unaff_RDI + 2);

-  ppuStack0000000000000070 = unaff_RDI;

-  if (unaff_ESI != 0) {

-    ppuStack0000000000000070 = param_1;

-  }

-  *(short *)(unaff_RBP + -0x7e) = (short)param_1;

-  *(undefined4 *)(unaff_RBP + -0x7c) = 0xe;

-  if (*(short *)(unaff_RDI + 2) == 5) {

-    _iStack0000000000000068 = (longlong *)CONCAT44(uStack000000000000006c,1);

+                    /* 0x689a0  108  DnsGetApplicationIdentifier */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_168;

+  if (DAT_1 == 0) {

+    uVar8 = FUN_1800d6460(param_1,param_2,param_3);

   }

   else {

-    _iStack0000000000000068 = (longlong *)CONCAT44(uStack000000000000006c,(int)param_1);

-    memset((void *)(unaff_RBP + -0x30),0,0x58);

-    puVar8 = (undefined1 *)(unaff_RBP + -0x30);

-    *(ushort **)(unaff_RBP + -0x28) = unaff_RDI[1];

-    *(ushort ****)(unaff_RBP + -0x30) = &stack0x00000070;

-    *(undefined4 *)(unaff_RBP + -0x20) = 5;

-    *(undefined4 *)(unaff_RBP + -0x1c) = 0xd;

-  }

-  if (unaff_R12D == 0) {

-    uVar5 = 0;

-    uVar7 = 0xe8;

-    memset((void *)(unaff_RBP + 0x30),0,0xe8);

-    *(undefined8 *)(unaff_RBP + 0x68) = in_stack_00000058;

-    *(undefined8 *)(unaff_RBP + 0x48) = in_stack_00000050;

-    *(undefined1 **)(unaff_RBP + 0x30) = puVar8;

-    *(uint *)(unaff_RBP + 0x38) = unaff_EBX;

-    *(uint **)(unaff_RBP + 0x60) = unaff_R14;

-    FUN_18007c6a0((wchar_t *)(unaff_RBP + 0x30),uVar5,uVar7,in_R9);

-    uVar3 = extraout_EAX;

-  }

-  else {

-    uVar3 = FUN_180094520();

-  }

-  uVar6 = (ulonglong)uVar3;

-  if (((iStack0000000000000068 != 0) && (unaff_ESI == 0)) && (uVar3 == 0)) {

-    _iStack0000000000000068 = (longlong *)0x0;

-    if (unaff_R14 != (uint *)0x0) {

-      unaff_R15 = FUN_18002fe64(unaff_R14);

+    local_98[0] = 0;

+    local_98[1] = 0;

+    local_98[2] = 0;

+    local_98[3] = 0;

+    local_98[4] = 0;

+    local_98[5] = 0;

+    local_98[6] = 0;

+    local_98[7] = 0;

+    local_98[8] = 0;

+    local_98[9] = 0;

+    local_98[10] = 0;

+    local_98[0xb] = 0;

+    local_98[0xc] = 0;

+    local_98[0xd] = 0;

+    local_98[0xe] = 0;

+    local_98[0xf] = 0;

+    local_98[0x10] = 0;

+    local_98[0x11] = 0;

+    local_98[0x12] = 0;

+    local_98[0x13] = 0;

+    local_98[0x14] = 0;

+    local_98[0x15] = 0;

+    local_98[0x16] = 0;

+    local_98[0x17] = 0;

+    local_98[0x18] = 0;

+    local_98[0x19] = 0;

+    local_98[0x1a] = 0;

+    local_98[0x1b] = 0;

+    local_98[0x1c] = 0;

+    local_98[0x1d] = 0;

+    local_98[0x1e] = 0;

+    local_98[0x1f] = 0;

+    local_98[0x20] = 0;

+    local_98[0x21] = 0;

+    local_98[0x22] = 0;

+    local_98[0x23] = 0;

+    local_98[0x24] = 0;

+    local_98[0x25] = 0;

+    local_98[0x26] = 0;

+    local_98[0x27] = 0;

+    local_98[0x28] = 0;

+    local_98[0x29] = 0;

+    local_98[0x2a] = 0;

+    local_98[0x2b] = 0;

+    local_98[0x2c] = 0;

+    local_98[0x2d] = 0;

+    local_98[0x2e] = 0;

+    local_98[0x2f] = 0;

+    local_98[0x30] = 0;

+    local_98[0x31] = 0;

+    local_98[0x32] = 0;

+    local_98[0x33] = 0;

+    local_98[0x34] = 0;

+    local_98[0x35] = 0;

+    local_98[0x36] = 0;

+    local_98[0x37] = 0;

+    local_98[0x38] = 0;

+    local_98[0x39] = 0;

+    local_98[0x3a] = 0;

+    local_98[0x3b] = 0;

+    local_98[0x3c] = 0;

+    local_98[0x3d] = 0;

+    local_98[0x3e] = 0;

+    local_98[0x3f] = 0;

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    if (DAT_1 == 0) {

-      FUN_180092c9c((_CERT_EXTENSION *)unaff_RDI[1],5,(LPSTR)0x8,(longlong)unaff_R15,

-                    (undefined8 *)&stack0x00000068);

-      uVar3 = extraout_EAX_00;

-    }

-    else {

-      uVar3 = FUN_1800a5270((longlong)unaff_RDI[1],5,8,unaff_R15,(undefined8 *)&stack0x00000068);

-    }

-    uVar6 = (ulonglong)uVar3;

-    bVar2 = false;

-    if (uVar3 == 0) {

-      uVar4 = FUN_1800cd4d8((longlong)unaff_RDI,(longlong)_iStack0000000000000068);

-      bVar2 = false;

-      if ((int)uVar4 != 0) {

-        bVar2 = true;

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar3 = false;

+      }

+      else {

+        bVar3 = true;

+      }

+      if (bVar3) {

+        local_e8 = &local_120;

+        local_120 = 1;

+        local_e0 = 8;

+        local_d8 = "DnsGetApplicationIdentifier";

+        local_d0 = 0x1c;

+        local_c8 = "FALSE";

+        lVar5 = -1;

+        local_c0 = 6;

+        do {

+          lVar4 = lVar5 + 1;

+          lVar5 = lVar5 + 1;

+        } while (local_98[lVar4] != 0);

+        local_b0 = (int)lVar5 * 2 + 2;

+        local_ac = 0;

+        local_b8 = local_98;

+        local_a8 = local_118;

+        local_130.Level = '\x05';

+        local_130.Opcode = '\0';

+        local_130.Task = 0;

+        local_108.Ptr = (ULONGLONG)PTR_DAT_6;

+        local_118[0] = 0x1000000;

+        local_a0 = 8;

+        local_130.Id = 0;

+        local_130.Version = '\0';

+        local_130.Channel = '\v';

+        local_130.Keyword = 0x400000000000;

+        local_108.Size = (ULONG)*(ushort *)PTR_DAT_6;

+        local_f8 = &DAT_7;

+        local_108.Reserved = 2;

+        local_f0 = 0x52;

+        local_ec = 1;

+        if (DAT_8 == FUN_18004e7b0) {

+          bVar9 = 0;

+          pbVar6 = &DAT_9;

+          do {

+            bVar1 = *pbVar6;

+            pbVar6 = pbVar6 + 1;

+          } while ((char)bVar1 < '\0');

+          do {

+            bVar1 = *pbVar6;

+            pbVar6 = pbVar6 + 1;

+          } while (bVar1 != 0);

+          uVar8 = 0;

+          if (pbVar6 < &DAT_10) {

+            while( true ) {

+              do {

+                pbVar7 = pbVar6;

+                bVar9 = (byte)uVar8;

+                pbVar6 = pbVar7 + 1;

+              } while (*pbVar7 != 0);

+              bVar1 = pbVar7[1];

+              if (-1 < (char)bVar1) break;

+              pbVar6 = pbVar7 + 3;

+              if (-1 < (char)pbVar7[2]) break;

+              bVar2 = *pbVar6;

+              while ((char)bVar2 < '\0') {

+                if (bVar2 != 0x80) goto LAB_11;

+                pbVar7 = pbVar6 + 1;

+                pbVar6 = pbVar6 + 1;

+                bVar2 = *pbVar7;

+              }

+              if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar2 + 0x8f))) break;

+              bVar9 = bVar9 + 1;

+              *(byte *)((longlong)&local_e0 + uVar8 * 0x10 + 5) = bVar2;

+              uVar8 = (ulonglong)bVar9;

+              if (&UNK_12 < pbVar6) break;

+            }

+          }

+LAB_11:

+          if (bVar9 != 0) {

+            FUN_1800e3380(0x180135218,(undefined8 *)&local_130,7,(longlong)&local_108,bVar9);

+            return 0x78;

+          }

+          EventWriteTransfer(DAT_13,&local_130,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_108);

+        }

       }

     }

-    FUN_18002a140(_iStack0000000000000068);

-    _iStack0000000000000068 = (longlong *)0x0;

-    if (!bVar2) {

-      if (DAT_1 == 0) {

-        FUN_180092c9c((_CERT_EXTENSION *)unaff_RDI[1],0xff,(LPSTR)0x8,(longlong)unaff_R15,

-                      (undefined8 *)&stack0x00000068);

-        uVar3 = extraout_EAX_01;

-      }

-      else {

-        uVar3 = FUN_1800a5270((longlong)unaff_RDI[1],0xff,8,unaff_R15,(undefined8 *)&stack0x00000068

-                             );

-      }

-      if (uVar3 == 0) {

-        uVar6 = 0;

-        for (plVar1 = _iStack0000000000000068; plVar1 != (longlong *)0x0;

-            plVar1 = (longlong *)*plVar1) {

-          if ((*(short *)(in_stack_00000060 + 0x10) != (short)plVar1[2]) &&

-             (uVar5 = FUN_180017670((PCNZWCH)unaff_RDI[1],(PCNZWCH)plVar1[1]), (int)uVar5 != 0)) {

-            uVar6 = 0x232f;

-            break;

-          }

-        }

-      }

-      else {

-        uVar6 = 0;

-      }

-      FUN_18002a140(_iStack0000000000000068);

-      _iStack0000000000000068 = (longlong *)0x0;

-    }

+    uVar8 = 0x78;

   }

-  FUN_18002a140((longlong *)unaff_RDI);

-  DnsApiFree(unaff_R15);

-  if ((DAT_2 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x16,0x180110d78,(int)uVar6);

-  }

-  return uVar6;

+  return uVar8;

 }
```

## `CreateSendBlob`  (modified)

```diff
--- CreateSendBlob
+++ CreateSendBlob
@@ -1,60 +1,73 @@
 

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

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

 

-int CreateSendBlob(undefined8 *param_1,undefined8 param_2,undefined *param_3)

+undefined4 CreateSendBlob(undefined8 *param_1,undefined8 param_2,undefined *param_3)

 

 {

-  int iVar1;

-  ulonglong uVar2;

-  LPCRITICAL_SECTION p_Var3;

-  undefined2 unaff_BX;

-  longlong unaff_RBP;

-  LPVOID unaff_RSI;

-  int unaff_EDI;

-  undefined4 in_R9D;

-  wchar_t *unaff_R12;

-  undefined4 *unaff_R13;

-  uint *unaff_R14;

-  longlong unaff_R15;

-  bool bVar4;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  uVar2 = FUN_1800609f4(unaff_RSI,unaff_R12,*(ushort *)(unaff_RBP + -0x61),in_R9D,

-                        *(undefined4 *)(unaff_RBP + 0x77),*(undefined4 *)(unaff_RBP + 0x7f),

-                        *(undefined4 *)(unaff_RBP + 0x9f),*(undefined8 *)(unaff_RBP + -0x51),

-                        unaff_BX,*(undefined8 *)(unaff_RBP + -0x59),param_3,unaff_R15 + 0x20,

-                        unaff_R15 + 0x38,(ulonglong)(unaff_EDI + 0x40));

-  iVar1 = (int)uVar2;

-  if (iVar1 == 0) {

-    if ((DAT_0 & 8) != 0) {

-      FUN_1800f71b8(0x40b,0x30,0x18010fd18,unaff_RSI);

-    }

-    bVar4 = DAT_1 == 0;

-    p_Var3 = (LPCRITICAL_SECTION)&DAT_2;

-    *unaff_R13 = 0x2522;

-    if (bVar4) {

-      p_Var3 = (LPCRITICAL_SECTION)&DAT_3;

-    }

-    EnterCriticalSection(p_Var3);

-    if ((*(int *)((longlong)unaff_RSI + 0x74) == 0) && (unaff_R14 != (uint *)0x0)) {

-      LOCK();

-      *unaff_R14 = *unaff_R14 | 1;

-      UNLOCK();

-    }

-    if (DAT_1 == 0) {

-      p_Var3 = (LPCRITICAL_SECTION)&DAT_3;

-    }

-    else {

-      p_Var3 = (LPCRITICAL_SECTION)&DAT_2;

-    }

-    LeaveCriticalSection(p_Var3);

+                    /* 0x67e10  17  CreateSendBlob */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800a9814(param_1,param_2,param_3);

   }

   else {

-    if ((DAT_0 & 8) != 0) {

-      FUN_1800f658c(0x40b,0x2f,0x18010fd18,iVar1);

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    FUN_18005e04c(unaff_RSI);

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "CreateSendBlob";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0xf;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0x78;

   }

-  FUN_18005e04c(unaff_RSI);

-  return iVar1;

+  return uVar2;

 }
```

## `Reg_ReadUpdateInfo`  (modified)

```diff
--- Reg_ReadUpdateInfo
+++ Reg_ReadUpdateInfo
@@ -1,50 +1,149 @@
 

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

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

 

 LSTATUS Reg_ReadUpdateInfo(wchar_t *param_1,undefined8 *param_2,undefined *param_3)

 

 {

-  longlong *plVar1;

-  longlong lVar2;

-  longlong *plVar3;

-  ulonglong uVar4;

-  longlong *unaff_RBX;

-  undefined *unaff_RSI;

-  int in_R9D;

-  int unaff_R12D;

-  longlong *plVar5;

-  LSTATUS LVar6;

-  ulonglong unaff_R15;

-  int in_stack_00000030;

+  LPCWSTR pWVar1;

+  bool bVar2;

+  bool bVar3;

+  int iVar4;

+  LSTATUS LVar5;

+  ulonglong uVar6;

+  undefined8 *puVar7;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_1f8 [32];

+  undefined8 local_1b8;

+  undefined8 uStack_1b0;

+  undefined8 local_1a8;

+  undefined8 uStack_1a0;

+  HKEY local_198;

+  undefined8 uStack_190;

+  HKEY local_188;

+  undefined8 local_180;

+  undefined8 local_178;

+  undefined8 local_170;

+  undefined8 uStack_168;

+  undefined8 local_160;

+  undefined8 uStack_158;

+  undefined8 local_150;

+  undefined8 uStack_148;

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined8 local_110;

+  char *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

+  undefined8 local_d0;

+  short local_c8 [64];

+  ulonglong local_48;

   

-  AddRefQueryBlobEx((int *)((ulonglong)unaff_RBX & 0xffffffff),(undefined *)param_2,param_3,in_R9D);

-  lVar2 = unaff_RBX[0x3e];

-  EnterCriticalSection((LPCRITICAL_SECTION)(lVar2 + 0x18));

-  plVar5 = unaff_RBX + 0x11;

-  do {

-    LVar6 = (LSTATUS)unaff_R15;

-    if ((*(byte *)(lVar2 + 0x10) & 0x40) != 0) break;

-    plVar1 = plVar5 + -0x11;

-    plVar3 = (longlong *)*plVar5;

-    if ((in_stack_00000030 == 0) || (plVar1 != unaff_RBX)) {

-      if ((unaff_R12D == 0) && (*(uint *)(plVar5 + 0x2e) < *(uint *)(unaff_RBX + 0x3f))) break;

-      if ((*(uint *)(plVar5 + 0x51) & 0x1300) == 0) {

-        AddRefQueryBlobEx((int *)plVar1,unaff_RSI,0x359f,0xc);

-        LeaveCriticalSection((LPCRITICAL_SECTION)(lVar2 + 0x18));

-        uVar4 = FUN_180052344((int *)plVar1);

-        unaff_R15 = uVar4 & 0xffffffff;

-        if (((int)uVar4 != 0) && ((DAT_0 & 8) != 0)) {

-          FUN_1800f8aec(0x40b,0x1a5,0x18010c5a0,(int)plVar5[0x2e]);

+                    /* 0x74c30  335  Reg_ReadUpdateInfo */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_1f8;

+  local_188 = (HKEY)0x0;

+  bVar2 = false;

+  local_198 = (HKEY)0x0;

+  uStack_190 = 0;

+  local_1b8 = 0;

+  uStack_1b0 = 0;

+  local_1a8 = 0;

+  uStack_1a0 = 0;

+  local_170 = 0;

+  uStack_168 = 0;

+  local_160 = 0;

+  uStack_158 = 0;

+  local_150 = 0;

+  uStack_148 = 0;

+  if ((DAT_1 & 8) != 0) {

+    param_3 = &DAT_2;

+    FUN_1800f849c(0x40b,0x23,0x1801102b8,param_1,param_2);

+  }

+  if (((DAT_3 == 0) || (DAT_18013630c != 0)) ||

+     (iVar4 = FUN_1800ca394(unaff_retaddr), iVar4 != 0)) {

+    *param_2 = 0;

+    param_2[1] = 0;

+    param_2[2] = 0;

+    LVar5 = FUN_180046c18(&local_198);

+    if (LVar5 == 0) {

+      puVar7 = &local_1b8;

+      LVar5 = FUN_180074abc(&local_198,puVar7);

+      bVar3 = bVar2;

+      if (LVar5 == 0) {

+        bVar2 = true;

+        uVar6 = FUN_180059a5c(param_1,puVar7,param_3,(longlong)&local_1b8,&local_170);

+        LVar5 = (LSTATUS)uVar6;

+        if (LVar5 == 0) {

+          pWVar1 = (LPCWSTR)(param_2 + 1);

+          if (DAT_4 == 0) {

+            FUN_1800c963c(&local_198,(HKEY)0x0,(LPCWSTR)0x0,6,7,0,pWVar1);

+          }

+          else {

+            FUN_1800c93e4(&local_198,(HKEY)0x0,param_3,6,7,(undefined8 *)pWVar1);

+          }

+          if ((*(int **)pWVar1 != (int *)0x0) && (**(int **)pWVar1 == 0)) {

+            RegDeleteKeyExW(local_188,L"AlternateComputerNames",0,0);

+            DnsApiFree(*(LPVOID *)pWVar1);

+            pWVar1[0] = L'\0';

+            pWVar1[1] = L'\0';

+            pWVar1[2] = L'\0';

+            pWVar1[3] = L'\0';

+          }

+          *param_2 = local_1b8;

+          *(undefined4 *)(param_2 + 2) = local_170._4_4_;

+          *(undefined4 *)((longlong)param_2 + 0x14) = (undefined4)uStack_168;

+          local_1b8 = 0;

+          bVar3 = bVar2;

         }

-        DeRefQueryBlobEx((int *)plVar1,unaff_RSI,0x35ab,0xc);

-        EnterCriticalSection((LPCRITICAL_SECTION)(lVar2 + 0x18));

+        else {

+          bVar3 = false;

+          if ((DAT_1 & 8) != 0) {

+            FUN_1800f5ac4(0x40b,0x24,0x1801102b8,param_1);

+          }

+        }

+      }

+      FUN_18004dd88(&local_198);

+      if (bVar2) {

+        FUN_180053544(&local_1b8);

+      }

+      if (bVar3) {

+        FUN_180052b88((longlong)&local_170);

+      }

+      if ((DAT_1 & 8) != 0) {

+        FUN_1800e4cec();

       }

     }

-    LVar6 = (LSTATUS)unaff_R15;

-    plVar5 = plVar3;

-  } while (plVar3 != unaff_RBX + 0x11);

-  LeaveCriticalSection((LPCRITICAL_SECTION)(lVar2 + 0x18));

-  DeRefQueryBlobEx((int *)unaff_RBX,unaff_RSI,0x35b6,0xc);

-  return LVar6;

+  }

+  else {

+    memset(local_c8,0,0x80);

+    if (DAT_5 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+    }

+    if (5 < DAT_6) {

+      if (((_DAT_7 & 0x400000000000) == 0) ||

+         (bVar2 = true, (DAT_8 & 0x400000000000) != DAT_8)) {

+        bVar2 = false;

+      }

+      if (bVar2) {

+        local_118 = &local_180;

+        local_180 = 1;

+        local_110 = 8;

+        local_108 = "Reg_ReadUpdateInfo";

+        local_100 = 0x13;

+        local_f8 = "FALSE";

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_d8 = &local_178;

+        local_178 = 0x1000000;

+        local_d0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_9,0,7,local_138);

+      }

+    }

+    LVar5 = 0x78;

+  }

+  return LVar5;

 }
```

## `DnsResetQueryRetryTimeouts`  (modified)

```diff
--- DnsResetQueryRetryTimeouts
+++ DnsResetQueryRetryTimeouts
@@ -1,12 +1,81 @@
 

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

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

 

 ulonglong DnsResetQueryRetryTimeouts(uint *param_1)

 

 {

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x1a,0x180110d78,0x57);

+  bool bVar1;

+  uint uVar2;

+  ulonglong uVar3;

+  ulonglong uVar4;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_158 [32];

+  HKEY local_128;

+  undefined8 local_120;

+  undefined8 local_118 [2];

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

+  

+                    /* 0x99a00  202  DnsResetQueryRetryTimeouts */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

+  local_128 = (HKEY)0x0;

+  if (DAT_1 == 0) {

+    uVar4 = FUN_180069150(param_1,0,&local_128);

+    uVar3 = uVar4 & 0xffffffff;

+    if ((int)uVar4 == 2) {

+      uVar3 = 0;

+    }

+    else {

+      if ((int)uVar4 == 0) {

+        uVar2 = RegDeleteValueW(local_128,L"DNSQueryTimeoutsMB");

+        uVar3 = (ulonglong)uVar2;

+        if (uVar2 == 2) {

+          uVar3 = 0;

+        }

+      }

+      if (local_128 != (HKEY)0x0) {

+        RegCloseKey(local_128);

+      }

+    }

   }

-  return 0x57;

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_e8 = &local_120;

+        local_120 = 1;

+        local_e0 = 8;

+        local_d8 = "DnsResetQueryRetryTimeouts";

+        local_d0 = 0x1b;

+        local_c8 = "FALSE";

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_a8 = local_118;

+        local_118[0] = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar3 = 0x78;

+  }

+  return uVar3;

 }
```

## `AddRefQueryBlobEx`  (modified)

```diff
--- AddRefQueryBlobEx
+++ AddRefQueryBlobEx
@@ -1,66 +1,224 @@
 

-/* WARNING: Instruction at (ram,0x00018001ba14) overlaps instruction at (ram,0x00018001ba13)

-    */

-

-void AddRefQueryBlobEx(int *param_1,char *param_2,LPVOID param_3,int param_4)

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

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

+

+void AddRefQueryBlobEx(int *param_1,undefined *param_2,undefined8 param_3,int param_4)

 

 {

-  char *pcVar1;

-  int *piVar2;

-  LPVOID pvVar3;

-  undefined4 *in_RAX;

-  LPVOID unaff_RBX;

-  LPVOID lpMem;

-  undefined8 *unaff_RBP;

-  undefined8 *unaff_RDI;

-  undefined8 *lpMem_00;

+  short *psVar1;

+  byte bVar2;

+  byte bVar3;

+  bool bVar4;

+  longlong lVar5;

+  int iVar6;

+  longlong lVar7;

+  byte *pbVar8;

+  byte *pbVar9;

+  undefined8 uVar10;

+  byte bVar11;

+  ulonglong uVar12;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_198 [32];

+  undefined8 in_stack_fffffffffffffe90;

+  undefined4 uVar13;

+  EVENT_DESCRIPTOR local_150;

+  undefined8 local_140;

+  undefined8 local_138 [2];

+  _EVENT_DATA_DESCRIPTOR local_128;

+  undefined *local_118;

+  undefined4 local_110;

+  undefined4 local_10c;

+  undefined8 *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  short *local_d8;

+  int local_d0;

+  undefined4 local_cc;

+  undefined8 *local_c8;

+  undefined8 local_c0;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  do {

-    *in_RAX = *in_RAX;

-    pcVar1 = (char *)((longlong)unaff_RBX + (longlong)param_1 * 4 + -0x3d);

-    *pcVar1 = *pcVar1 + (char)param_1;

-    HeapFree(in_RAX,0,param_3);

-    do {

-      lpMem = (LPVOID)unaff_RDI[0x47];

-      while (lpMem != (LPVOID)0x0) {

-        pvVar3 = *(LPVOID *)((longlong)lpMem + 8);

-        if (DAT_0 == (undefined4 *)0x0) {

-          DAT_0 = GetProcessHeap();

+                    /* 0x265d0  13  AddRefQueryBlobEx */

+  uVar13 = (undefined4)((ulonglong)in_stack_fffffffffffffe90 >> 0x20);

+  local_38 = DAT_0 ^ (ulonglong)auStackY_198;

+  uVar10 = param_3;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar6 = FUN_1800ca394(unaff_retaddr), iVar6 != 0)) {

+    if (param_1 != (int *)0x0) {

+      LOCK();

+      iVar6 = *param_1;

+      *param_1 = *param_1 + 1;

+      UNLOCK();

+      LOCK();

+      psVar1 = (short *)((longlong)param_1 + (longlong)param_4 * 2 + 4);

+      *psVar1 = *psVar1 + 1;

+      UNLOCK();

+      if ((DAT_2 & 4) != 0) {

+        FUN_1800f7628((ulonglong)(iVar6 + 1),0xe,uVar10,param_4,param_2,

+                      CONCAT44(uVar13,(int)param_3),param_1);

+      }

+    }

+  }

+  else {

+    local_b8[0] = 0;

+    local_b8[1] = 0;

+    local_b8[2] = 0;

+    local_b8[3] = 0;

+    local_b8[4] = 0;

+    local_b8[5] = 0;

+    local_b8[6] = 0;

+    local_b8[7] = 0;

+    local_b8[8] = 0;

+    local_b8[9] = 0;

+    local_b8[10] = 0;

+    local_b8[0xb] = 0;

+    local_b8[0xc] = 0;

+    local_b8[0xd] = 0;

+    local_b8[0xe] = 0;

+    local_b8[0xf] = 0;

+    local_b8[0x10] = 0;

+    local_b8[0x11] = 0;

+    local_b8[0x12] = 0;

+    local_b8[0x13] = 0;

+    local_b8[0x14] = 0;

+    local_b8[0x15] = 0;

+    local_b8[0x16] = 0;

+    local_b8[0x17] = 0;

+    local_b8[0x18] = 0;

+    local_b8[0x19] = 0;

+    local_b8[0x1a] = 0;

+    local_b8[0x1b] = 0;

+    local_b8[0x1c] = 0;

+    local_b8[0x1d] = 0;

+    local_b8[0x1e] = 0;

+    local_b8[0x1f] = 0;

+    local_b8[0x20] = 0;

+    local_b8[0x21] = 0;

+    local_b8[0x22] = 0;

+    local_b8[0x23] = 0;

+    local_b8[0x24] = 0;

+    local_b8[0x25] = 0;

+    local_b8[0x26] = 0;

+    local_b8[0x27] = 0;

+    local_b8[0x28] = 0;

+    local_b8[0x29] = 0;

+    local_b8[0x2a] = 0;

+    local_b8[0x2b] = 0;

+    local_b8[0x2c] = 0;

+    local_b8[0x2d] = 0;

+    local_b8[0x2e] = 0;

+    local_b8[0x2f] = 0;

+    local_b8[0x30] = 0;

+    local_b8[0x31] = 0;

+    local_b8[0x32] = 0;

+    local_b8[0x33] = 0;

+    local_b8[0x34] = 0;

+    local_b8[0x35] = 0;

+    local_b8[0x36] = 0;

+    local_b8[0x37] = 0;

+    local_b8[0x38] = 0;

+    local_b8[0x39] = 0;

+    local_b8[0x3a] = 0;

+    local_b8[0x3b] = 0;

+    local_b8[0x3c] = 0;

+    local_b8[0x3d] = 0;

+    local_b8[0x3e] = 0;

+    local_b8[0x3f] = 0;

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar4 = false;

+      }

+      else {

+        bVar4 = true;

+      }

+      if (bVar4) {

+        local_108 = &local_140;

+        local_100 = 8;

+        local_f0 = 0x12;

+        local_f8 = "AddRefQueryBlobEx";

+        local_140 = 1;

+        local_e8 = "FALSE";

+        bVar11 = 0;

+        lVar7 = -1;

+        local_e0 = 6;

+        do {

+          lVar5 = lVar7 + 1;

+          lVar7 = lVar7 + 1;

+        } while (local_b8[lVar5] != 0);

+        local_d0 = (int)lVar7 * 2 + 2;

+        local_cc = 0;

+        local_d8 = local_b8;

+        local_c8 = local_138;

+        local_150.Level = '\x05';

+        local_150.Opcode = '\0';

+        local_150.Task = 0;

+        local_128.Ptr = (ULONGLONG)PTR_DAT_7;

+        local_138[0] = 0x1000000;

+        local_c0 = 8;

+        local_150.Id = 0;

+        local_150.Version = '\0';

+        local_150.Channel = '\v';

+        local_150.Keyword = 0x400000000000;

+        local_128.Size = (ULONG)*(ushort *)PTR_DAT_7;

+        local_118 = &DAT_8;

+        local_10c = 1;

+        local_128.Reserved = 2;

+        local_110 = 0x52;

+        if (DAT_9 == FUN_18004e7b0) {

+          pbVar8 = &DAT_10;

+          do {

+            bVar2 = *pbVar8;

+            pbVar8 = pbVar8 + 1;

+          } while ((char)bVar2 < '\0');

+          do {

+            bVar2 = *pbVar8;

+            pbVar8 = pbVar8 + 1;

+          } while (bVar2 != 0);

+          uVar12 = 0;

+          if (pbVar8 < &DAT_11) {

+            while( true ) {

+              do {

+                pbVar9 = pbVar8;

+                bVar11 = (byte)uVar12;

+                pbVar8 = pbVar9 + 1;

+              } while (*pbVar9 != 0);

+              bVar2 = pbVar9[1];

+              if (-1 < (char)bVar2) break;

+              pbVar8 = pbVar9 + 3;

+              if (-1 < (char)pbVar9[2]) break;

+              bVar3 = *pbVar8;

+              while ((char)bVar3 < '\0') {

+                if (bVar3 != 0x80) goto LAB_12;

+                pbVar9 = pbVar8 + 1;

+                pbVar8 = pbVar8 + 1;

+                bVar3 = *pbVar9;

+              }

+              if (((bVar2 & 0x7f) != 9) || (2 < (byte)(bVar3 + 0x8f))) break;

+              bVar11 = bVar11 + 1;

+              *(byte *)((longlong)&local_100 + uVar12 * 0x10 + 5) = bVar3;

+              uVar12 = (ulonglong)bVar11;

+              if (&UNK_13 < pbVar8) break;

+            }

+          }

+LAB_12:

+          if (bVar11 == 0) {

+            EventWriteTransfer(DAT_14,&local_150,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_128);

+          }

+          else {

+            FUN_1800e3380(0x180135218,(undefined8 *)&local_150,7,(longlong)&local_128,bVar11);

+          }

         }

-        HeapFree(DAT_0,0,lpMem);

-        lpMem = pvVar3;

-      }

-      FUN_18001be00((undefined8 *)unaff_RDI[0x48]);

-      lpMem_00 = unaff_RDI;

-      do {

-        unaff_RDI = unaff_RBP;

-        if (DAT_0 == (undefined4 *)0x0) {

-          DAT_0 = GetProcessHeap();

-        }

-        HeapFree(DAT_0,0,lpMem_00);

-        if (unaff_RDI == (undefined8 *)0x0) {

-          return;

-        }

-        unaff_RBP = (undefined8 *)*unaff_RDI;

-        func_0x00018001baf4(unaff_RDI + 0x21);

-        func_0x00018001baf4(unaff_RDI + 0x30);

-        param_1 = (int *)unaff_RDI[0x3f];

-        in_RAX = DAT_0;

-        while (DAT_0 = in_RAX, param_1 != (int *)0x0) {

-          piVar2 = *(int **)param_1;

-          DnsApiFree(param_1);

-          param_1 = piVar2;

-          in_RAX = DAT_0;

-        }

-        lpMem_00 = unaff_RDI;

-      } while (*(int *)((longlong)unaff_RDI + 0x1c) == 0x83);

-      unaff_RBX = (LPVOID)unaff_RDI[0x46];

-    } while (unaff_RBX == (LPVOID)0x0);

-    param_3 = unaff_RBX;

-    if (in_RAX == (undefined4 *)0x0) {

-      in_RAX = GetProcessHeap();

-      DAT_0 = in_RAX;

+      }

     }

-  } while( true );

+  }

+  return;

 }
```

## `Dns_CreateMulticastSocket`  (modified)

```diff
--- Dns_CreateMulticastSocket
+++ Dns_CloseConnection
@@ -1,69 +1,70 @@
 

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

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

 

-undefined8 Dns_CreateMulticastSocket(void)

+void Dns_CloseConnection(SOCKET param_1)

 

 {

   bool bVar1;

   undefined4 uVar2;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x9b240  269  Dns_CreateMulticastSocket */

+                    /* 0x9af60  267  Dns_CloseConnection */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 != 0) {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

         uVar2 = 8;

         local_118 = 1;

-        local_d8 = "Dns_CreateMulticastSocket";

+        local_d8 = "Dns_CloseConnection";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x1a;

+        local_d0 = 0x14;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

         local_a0 = uVar2;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

   }

-  return 0xffffffffffffffff;

+  Socket_CloseEx(param_1,1);

+  return;

 }
```

## `DnsApiHeapReset`  (modified)

```diff
--- DnsApiHeapReset
+++ BreakRecordsIntoBlob
@@ -1,69 +1,47 @@
 

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

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

 

-void DnsApiHeapReset(void)

+void BreakRecordsIntoBlob(void *param_1,undefined8 *param_2,short param_3)

 

 {

-  bool bVar1;

+  char in_AL;

+  wchar_t *unaff_RBX;

+  longlong unaff_RBP;

+  LPCWSTR unaff_RDI;

+  undefined6 in_register_00000082;

+  undefined8 uVar1;

   undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined8 in_stack_00000030;

+  undefined8 in_stack_00000038;

+  undefined8 *in_stack_00000060;

+  undefined4 in_stack_00000068;

+  undefined4 in_stack_0000006c;

+  char *in_stack_00000070;

+  undefined4 in_stack_00000078;

+  undefined4 in_stack_0000007c;

   

-                    /* 0x96060  30  DnsApiHeapReset */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 != 0) {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "DnsApiHeapReset";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x10;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

+  uVar1 = CONCAT62(in_register_00000082,param_3);

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

+    in_stack_0000006c = 0;

+    in_stack_00000060 = &stack0x00000030;

+    in_stack_0000007c = 0;

+    *(undefined4 *)(unaff_RBP + -0x74) = 0;

+    uVar2 = 8;

+    in_stack_00000030 = 1;

+    in_stack_00000070 = "DnsNameCompareEx_UTF8";

+    *(char **)(unaff_RBP + -0x80) = "FALSE";

+    in_stack_00000068 = 8;

+    in_stack_00000078 = 0x16;

+    *(undefined4 *)(unaff_RBP + -0x78) = 6;

+    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+    *(undefined4 *)(unaff_RBP + -0x54) = 0;

+    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+    *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

+    uVar1 = 0;

+    in_stack_00000038 = 0x1000000;

+    FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

   }

+  FUN_18002b810(unaff_RBX,unaff_RDI,uVar1,2);

   return;

 }
```

## `FlushDnsPolicyUnreachableStatus`  (modified)

```diff
--- FlushDnsPolicyUnreachableStatus
+++ FlushDnsPolicyUnreachableStatus
@@ -1,13 +1,78 @@
 

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

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

 

-undefined4 FlushDnsPolicyUnreachableStatus(void)

+void FlushDnsPolicyUnreachableStatus(void)

 

 {

-  undefined1 *unaff_RDI;

-  undefined4 unaff_R14D;

+  bool bVar1;

+  int iVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *unaff_RDI = 0;

-  return unaff_R14D;

+                    /* 0x7e800  303  FlushDnsPolicyUnreachableStatus */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f7614(0x40b,0x2b,0x18010c2f0);

+  }

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    AcquireSRWLockExclusive((PSRWLOCK)&DAT_3);

+    FUN_1800ace3c();

+    ReleaseSRWLockExclusive((PSRWLOCK)&DAT_3);

+    return;

+  }

+  memset(local_98,0,0x80);

+  if (DAT_4 != 0) {

+    FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  }

+  if (DAT_5 < 6) {

+    return;

+  }

+  if (((_DAT_6 & 0x400000000000) == 0) ||

+     ((DAT_7 & 0x400000000000) != DAT_7)) {

+    bVar1 = false;

+  }

+  else {

+    bVar1 = true;

+  }

+  if (!bVar1) {

+    return;

+  }

+  local_dc = 0;

+  local_e8 = &local_118;

+  local_cc = 0;

+  local_bc = 0;

+  local_d8 = "FlushDnsPolicyUnreachableStatus";

+  local_c8 = "FALSE";

+  local_118 = 1;

+  local_e0 = 8;

+  local_d0 = 0x20;

+  local_c0 = 6;

+  FUN_180055600(local_b8,(undefined *)local_98);

+  local_9c = 0;

+  local_a8 = &local_110;

+  local_110 = 0x1000000;

+  local_a0 = 8;

+  FUN_1800e3690(0x180135218,&DAT_8,0,7,local_108);

+  return;

 }
```

## `NetInfo_UpdateDnsInterfaceConfigChange`  (modified)

```diff
--- NetInfo_UpdateDnsInterfaceConfigChange
+++ NetInfo_GetAdapterByName
@@ -1,91 +1,84 @@
 

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

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

 

-undefined4 NetInfo_UpdateDnsInterfaceConfigChange(longlong param_1)

+longlong NetInfo_GetAdapterByName(longlong param_1,PCNZWCH param_2)

 

 {

   bool bVar1;

   int iVar2;

-  undefined4 uVar3;

-  undefined8 uVar4;

-  undefined4 uVar5;

-  uint uVar6;

-  ulonglong uVar7;

+  DWORD dwErrCode;

+  ulonglong uVar3;

+  uint uVar4;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_158 [32];

-  undefined8 local_128;

-  undefined8 local_120;

-  _EVENT_DATA_DESCRIPTOR local_118 [2];

-  undefined8 *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

+  undefined1 auStackY_168 [32];

+  undefined8 local_138;

+  undefined8 local_130;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

   char *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  undefined8 local_c8 [2];

-  undefined8 *local_b8;

-  undefined4 local_b0;

-  undefined4 local_ac;

-  short local_a8 [64];

-  ulonglong local_28;

+  undefined8 local_e0;

+  undefined8 local_d8 [2];

+  undefined8 *local_c8;

+  undefined8 local_c0;

+  short local_b8 [64];

+  ulonglong local_38;

   

-                    /* 0x6f210  325  NetInfo_UpdateDnsInterfaceConfigChange */

-  local_28 = DAT_0 ^ (ulonglong)auStackY_158;

-  uVar5 = 0;

-  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+                    /* 0x6eb50  320  NetInfo_GetAdapterByName */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

+  uVar3 = 0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f71b8(0x40b,0x54,0x18010f550,param_1);

+  }

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

      (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

-    uVar3 = uVar5;

-    if ((param_1 != 0) && (uVar7 = 0, uVar3 = 0, *(int *)(param_1 + 0x44) != 0)) {

+    if ((param_1 != 0) && (param_2 != (PCNZWCH)0x0)) {

+      if (*(int *)(param_1 + 0x44) == 0) {

+        return 0;

+      }

       do {

-        uVar4 = FUN_18001a5a8((longlong *)(uVar7 * 0xa0 + 0x68 + param_1));

-        if ((int)uVar4 != 0) {

-          uVar5 = 1;

+        iVar2 = FUN_180034b60(*(PCNZWCH *)(uVar3 * 0xa0 + 0x68 + param_1),param_2);

+        if (iVar2 == 0) {

+          return param_1 + 0x68 + uVar3 * 0xa0;

         }

-        uVar6 = (int)uVar7 + 1;

-        uVar7 = (ulonglong)uVar6;

-        uVar3 = uVar5;

-      } while (uVar6 < *(uint *)(param_1 + 0x44));

+        uVar4 = (int)uVar3 + 1;

+        uVar3 = (ulonglong)uVar4;

+      } while (uVar4 < *(uint *)(param_1 + 0x44));

+      return 0;

     }

+    dwErrCode = 0x57;

   }

   else {

-    memset(local_a8,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

+    memset(local_b8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

         bVar1 = false;

       }

-      else {

-        bVar1 = true;

-      }

       if (bVar1) {

-        local_ec = 0;

-        local_f8 = &local_128;

-        local_dc = 0;

-        local_cc = 0;

-        uVar5 = 8;

-        local_128 = 1;

-        local_e8 = "NetInfo_UpdateDnsInterfaceConfigChange";

-        local_d8 = "FALSE";

-        local_f0 = 8;

-        local_e0 = 0x27;

-        local_d0 = 6;

-        FUN_180055600(local_c8,(undefined *)local_a8);

-        local_ac = 0;

-        local_b8 = &local_120;

-        local_120 = 0x1000000;

-        local_b0 = uVar5;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_118);

+        local_108 = &local_138;

+        local_138 = 1;

+        local_100 = 8;

+        local_f8 = "NetInfo_GetAdapterByName";

+        local_f0 = 0x19;

+        local_e8 = "FALSE";

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_c8 = &local_130;

+        local_130 = 0x1000000;

+        local_c0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

       }

     }

-    uVar3 = 0;

+    dwErrCode = 0x78;

   }

-  return uVar3;

+  SetLastError(dwErrCode);

+  return 0;

 }
```

## `DnsConnectionSetPolicyEntriesPrivate`  (modified)

```diff
--- DnsConnectionSetPolicyEntriesPrivate
+++ DnsConnectionSetPolicyEntriesPrivate
@@ -1,157 +1,48 @@
 

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

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

 

-ulong DnsConnectionSetPolicyEntriesPrivate

-                (DNS_CONNECTION_POLICY_TAG param_1,_DNS_CONNECTION_POLICY_ENTRY_LIST *param_2,

-                _GUID *param_3,_GUID *param_4)

+undefined8 DnsConnectionSetPolicyEntriesPrivate(uint param_1,longlong *param_2,int param_3)

 

 {

-  bool bVar1;

-  char cVar2;

-  ulong uVar3;

-  ulong uVar4;

-  char *in_RAX;

-  wchar_t *pwVar5;

-  char cVar6;

-  char unaff_BL;

-  longlong unaff_RBP;

-  uint uVar7;

-  ulonglong uVar8;

-  char unaff_DIL;

-  wchar_t *pwVar9;

-  char unaff_R12B;

-  ulong unaff_R13D;

-  undefined4 unaff_R14D;

-  longlong lVar10;

-  ulonglong unaff_R15;

-  ulonglong in_stack_00000020;

-  undefined4 uVar11;

-  uint uStack0000000000000040;

-  ulonglong uStack0000000000000048;

-  uint uStack0000000000000050;

-  longlong lStack0000000000000058;

-  undefined1 uStack0000000000000060;

-  ulonglong in_stack_00000078;

+  int iVar1;

+  undefined8 uVar2;

+  short *_Dst;

+  short *psVar3;

+  short *unaff_retaddr;

+  undefined1 auStackY_118 [32];

+  undefined8 local_d8;

+  short *local_d0;

+  char *local_c8;

+  char *local_c0;

+  undefined8 local_b8 [2];

+  short local_a8 [64];

+  ulonglong local_28;

   

-  uVar11 = (undefined4)(in_stack_00000020 >> 0x20);

-  *in_RAX = *in_RAX + (char)in_RAX;

-  uVar8 = unaff_R15 & 0xffffffff;

-  cVar6 = unaff_BL;

-  if ((uint)unaff_R15 < *(uint *)(unaff_RBP + -0x78)) {

-    do {

-      lVar10 = uVar8 * 0xf0;

-      cVar6 = '\0';

-      if (*(int *)(lVar10 + 0xa8 + *(longlong *)(unaff_RBP + -0x80)) != 1) {

-        cVar6 = unaff_BL;

-      }

-      if (*(char *)(lVar10 + 0xa5 + *(longlong *)(unaff_RBP + -0x80)) != '\0') {

-        unaff_R12B = '\x01';

-      }

-      bVar1 = FUN_1800501b4((undefined8 *)(in_stack_00000078 + uVar8 * 8));

-      cVar2 = FUN_1800502c8((undefined8 *)(in_stack_00000078 + uVar8 * 8));

-      if (((bVar1) && (cVar2 == '\0')) &&

-         (*(int *)(lVar10 + 0x10 + *(longlong *)(unaff_RBP + -0x80)) != 1)) {

-        unaff_DIL = '\0';

-      }

-      if ((DAT_0 & 8) != 0) {

-        in_stack_00000020 = in_stack_00000020 & 0xffffffff00000000;

-        FUN_1800eca5c((ulonglong)bVar1,0x26,

-                      (ulonglong)*(byte *)(lVar10 + 0xa5 + *(longlong *)(unaff_RBP + -0x80)),

-                      *(undefined8 *)(in_stack_00000078 + uVar8 * 8));

-      }

-      uVar11 = (undefined4)(in_stack_00000020 >> 0x20);

-      unaff_R14D = 1;

-      uVar7 = (int)uVar8 + 1;

-      uVar8 = (ulonglong)uVar7;

-      unaff_BL = cVar6;

-    } while (uVar7 < *(uint *)(unaff_RBP + -0x78));

-    unaff_R13D = *(ulong *)(unaff_RBP + -0x70);

-    unaff_R15 = 0;

+                    /* 0x82320  57  DnsConnectionSetPolicyEntriesPrivate */

+  local_28 = DAT_0 ^ (ulonglong)auStackY_118;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar1 = FUN_1800ca394((LPCSTR)unaff_retaddr), iVar1 == 0)) {

+    _Dst = local_a8;

+    psVar3 = (short *)0x80;

+    memset(_Dst,0,0x80);

+    if (DAT_2 != 0) {

+      psVar3 = local_a8;

+      FUN_1800ca1b8((LPCSTR)unaff_retaddr,0,psVar3,0x40);

+      _Dst = unaff_retaddr;

+    }

+    if (((5 < DAT_3) && ((_DAT_180135228 & 0x400000000000) != 0)) &&

+       ((DAT_4 & 0x400000000000) == DAT_4)) {

+      local_d0 = local_a8;

+      local_d8 = 0x1000000;

+      local_b8[0] = 1;

+      local_c8 = "FALSE";

+      local_c0 = "DnsConnectionSetPolicyEntriesPrivate";

+      FUN_18000103c(_Dst,&DAT_5,psVar3,local_b8,&local_c0,&local_c8,&local_d0,&local_d8);

+    }

+    return 0x78;

   }

-  NsiFreeTable(in_stack_00000078,*(undefined8 *)(unaff_RBP + -0x80),0,0);

-  uStack0000000000000060 = (undefined1)unaff_R15;

-  lStack0000000000000058 = unaff_RBP + -0x78;

-  uVar7 = (uint)unaff_R15;

-  *(ulonglong *)(unaff_RBP + -0x80) = unaff_R15;

-  uStack0000000000000040 = uVar7;

-  uStack0000000000000048 = unaff_R15;

-  uStack0000000000000050 = uVar7;

-  in_stack_00000078 = unaff_R15;

-  uVar3 = NsiAllocateAndGetTable(unaff_R14D,&DAT_1,7,&stack0x00000078,CONCAT44(uVar11,8));

-  *(ulong *)(unaff_RBP + -0x68) = uVar3;

-  if (uVar3 == 0) {

-    uVar8 = unaff_R15 & 0xffffffff;

-    if (uVar7 < *(uint *)(unaff_RBP + -0x78)) {

-      cVar2 = cVar6;

-      do {

-        lVar10 = uVar8 * 0xf0;

-        cVar6 = '\0';

-        if (*(int *)(lVar10 + 0xa8 + *(longlong *)(unaff_RBP + -0x80)) != 1) {

-          cVar6 = cVar2;

-        }

-        if (*(char *)(lVar10 + 0xa5 + *(longlong *)(unaff_RBP + -0x80)) != '\0') {

-          unaff_R12B = '\x01';

-        }

-        bVar1 = FUN_1800501b4((undefined8 *)(in_stack_00000078 + uVar8 * 8));

-        cVar2 = FUN_1800502c8((undefined8 *)(in_stack_00000078 + uVar8 * 8));

-        if (((bVar1) && (cVar2 == '\0')) &&

-           (*(int *)(lVar10 + 0x10 + *(longlong *)(unaff_RBP + -0x80)) != 1)) {

-          unaff_DIL = '\0';

-        }

-        if ((DAT_0 & 8) != 0) {

-          FUN_1800eca5c((ulonglong)bVar1,0x28,

-                        (ulonglong)*(byte *)(lVar10 + 0xa5 + *(longlong *)(unaff_RBP + -0x80)),

-                        *(undefined8 *)(in_stack_00000078 + uVar8 * 8));

-        }

-        uVar7 = (int)uVar8 + 1;

-        uVar8 = (ulonglong)uVar7;

-        cVar2 = cVar6;

-      } while (uVar7 < *(uint *)(unaff_RBP + -0x78));

-      uVar3 = *(ulong *)(unaff_RBP + -0x68);

-      unaff_R15 = 0;

-      unaff_R13D = *(ulong *)(unaff_RBP + -0x70);

-    }

-LAB_2:

-    if ((DAT_0 & 8) != 0) {

-      pwVar5 = L"in private network";

-      if (unaff_DIL == '\0') {

-        pwVar5 = L"not in private network";

-      }

-      pwVar9 = L"outside";

-      if (cVar6 == '\0') {

-        pwVar9 = L"inside";

-      }

-      FUN_1800f5ba4(0x40b,0x29,0x18010c2f0,pwVar9,(longlong)pwVar5);

-    }

-  }

-  else if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x27,0x18010c2f0,uVar3);

-    goto LAB_2;

-  }

-  NsiFreeTable(in_stack_00000078,*(undefined8 *)(unaff_RBP + -0x80),0,0);

-  *(ulonglong *)(unaff_RBP + -0x80) = unaff_R15;

-  in_stack_00000078 = unaff_R15;

-  AcquireSRWLockExclusive((PSRWLOCK)&DAT_3);

-  if ((DAT_4 == cVar6) && (DAT_1801366eb == unaff_R12B)) {

-    if (DAT_6 == unaff_DIL) goto LAB_18007e7a3;

-  }

-  else {

-    DAT_4 = cVar6;

-    DAT_7 = unaff_R12B;

-    FUN_1800ace3c();

-    unaff_DIL = DAT_6;

-  }

-  DAT_6 = unaff_DIL;

-  FUN_18007e9c0();

-LAB_5:

-  ReleaseSRWLockExclusive((PSRWLOCK)&DAT_3);

-  uVar4 = (ulong)unaff_R15;

-  if (unaff_R13D != 0) {

-    uVar4 = unaff_R13D;

-  }

-  if (uVar3 != 0) {

-    uVar4 = uVar3;

-  }

-  return uVar4;

+  uVar2 = FUN_1800b6bdc((ulonglong)param_1,param_2,param_3);

+  return uVar2;

 }
```

## `Query_InProcSetCompletion`  (modified)

```diff
--- Query_InProcSetCompletion
+++ Query_InProcSetCompletion
@@ -1,38 +1,104 @@
 

-undefined8 Query_InProcSetCompletion(longlong param_1)

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

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

+

+void Query_InProcSetCompletion(longlong param_1)

 

 {

-  undefined8 uVar1;

-  LPCRITICAL_SECTION p_Var2;

-  int unaff_EBX;

+  uint uVar1;

+  uint *puVar2;

+  int iVar3;

+  uint uVar4;

+  LPCRITICAL_SECTION p_Var5;

+  bool bVar6;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  FUN_1800f7614(0x402,0xb,0x18010ce50);

-  DAT_0 = GetDefaultCompartmentId();

-  if (DAT_1 == unaff_EBX) {

-    FUN_1800586e8();

-  }

-  uVar1 = FUN_18000a1b0();

-  if ((int)uVar1 == 0) {

-    if (DAT_2 == unaff_EBX) {

-      p_Var2 = (LPCRITICAL_SECTION)&DAT_3;

+                    /* 0x669b0  330  Query_InProcSetCompletion */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar3 = FUN_1800ca394(unaff_retaddr), iVar3 != 0)) {

+    uVar4 = *(uint *)(param_1 + 0x310);

+    do {

+      LOCK();

+      uVar1 = *(uint *)(param_1 + 0x310);

+      bVar6 = uVar4 == uVar1;

+      if (bVar6) {

+        *(uint *)(param_1 + 0x310) = uVar4 | 0x800;

+        uVar1 = uVar4;

+      }

+      uVar4 = uVar1;

+      UNLOCK();

+    } while (!bVar6);

+    if (((uVar4 & 0x800) != 0) && ((DAT_2 & 8) != 0)) {

+      FUN_1800f71b8(0x40b,0x27,0x18010fd18,param_1);

     }

-    else {

-      p_Var2 = (LPCRITICAL_SECTION)&DAT_4;

+    puVar2 = *(uint **)(param_1 + 0x130);

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

+      p_Var5 = (LPCRITICAL_SECTION)&DAT_3;

+      if (DAT_4 == 0) {

+        p_Var5 = (LPCRITICAL_SECTION)&DAT_5;

+      }

+      EnterCriticalSection(p_Var5);

+      *puVar2 = *puVar2 & 0xfffffffe;

+      p_Var5 = (LPCRITICAL_SECTION)&DAT_3;

+      if (DAT_4 == 0) {

+        p_Var5 = (LPCRITICAL_SECTION)&DAT_5;

+      }

+      LeaveCriticalSection(p_Var5);

     }

-    LeaveCriticalSection(p_Var2);

-    uVar1 = 1;

   }

   else {

-    if ((DAT_5 & 8) != 0) {

-      FUN_1800f658c(0x40b,0xc,0x18010ce50,(int)uVar1);

+    memset(local_98,0,0x80);

+    if (DAT_6 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    p_Var2 = (LPCRITICAL_SECTION)&DAT_4;

-    if (DAT_2 == unaff_EBX) {

-      p_Var2 = (LPCRITICAL_SECTION)&DAT_3;

+    if (5 < DAT_7) {

+      if (((_DAT_8 & 0x400000000000) == 0) ||

+         ((DAT_9 & 0x400000000000) != DAT_9)) {

+        bVar6 = false;

+      }

+      else {

+        bVar6 = true;

+      }

+      if (bVar6) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        local_d8 = "Query_InProcSetCompletion";

+        local_c8 = "FALSE";

+        local_118 = 1;

+        local_e0 = 8;

+        local_d0 = 0x1a;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_10,0,7,local_108);

+      }

     }

-    LeaveCriticalSection(p_Var2);

-    uVar1 = 0;

   }

-  return uVar1;

+  return;

 }
```

## `WriteDnsNrptRulesToRegistry`  (modified)

```diff
--- WriteDnsNrptRulesToRegistry
+++ WriteDnsNrptRulesToRegistry
@@ -1,92 +1,74 @@
 

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

-/* WARNING: This function may have set the stack pointer */

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

 

-uint WriteDnsNrptRulesToRegistry(uint param_1,undefined8 *param_2,longlong param_3,int param_4)

+uint WriteDnsNrptRulesToRegistry(uint param_1,undefined8 *param_2,longlong param_3,wchar_t *param_4)

 

 {

-  char *pcVar1;

-  byte bVar2;

-  byte bVar3;

-  undefined *puVar4;

-  char *in_RAX;

-  byte *pbVar5;

-  byte *pbVar6;

-  undefined4 in_register_0000000c;

-  longlong unaff_RBP;

-  byte bVar7;

-  ulonglong uVar8;

+  bool bVar1;

+  uint uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  pcVar1 = (char *)(CONCAT44(in_register_0000000c,param_1) * 5 + 0x45);

-  *pcVar1 = *pcVar1 + (char)in_RAX;

-  *(ulonglong *)(unaff_RBP + -0x50) = (ulonglong)((int)unaff_RBP - 0x30);

-  *(undefined8 *)(unaff_RBP + -0x40) = 0x48b845d9;

-  puVar4 = PTR_DAT_0;

-  uRam0000000048b845c5 = 5;

-  puRam0000000048b845e9 = PTR_DAT_0;

-  uRam0000000048b845d9 = 0x1000000;

-  *(undefined8 *)(unaff_RBP + -0x38) = 8;

-  uRam0000000048b845c1 = 0xb000000;

-  uRam0000000048b845f1 = (uint)*(ushort *)puVar4;

-  puRam0000000048b845f9 = &DAT_1;

-  uRam0000000048b845f5 = 2;

-  uRam0000000048b84601 = 0x52;

-  uRam0000000048b84605 = 1;

-  uRam0000000048b845b9 = 0x75c6;

-  puRam0000000048b845c9 = param_2;

-  if (DAT_2 == FUN_18004e7b0) {

-    bVar7 = 0;

-    pbVar5 = &DAT_3;

-    do {

-      bVar2 = *pbVar5;

-      pbVar5 = pbVar5 + 1;

-    } while ((char)bVar2 < '\0');

-    do {

-      bVar2 = *pbVar5;

-      pbVar5 = pbVar5 + 1;

-    } while (bVar2 != 0);

-    uVar8 = 0;

-    if (pbVar5 < &DAT_4) {

-      while( true ) {

-        do {

-          pbVar6 = pbVar5;

-          bVar7 = (byte)uVar8;

-          pbVar5 = pbVar6 + 1;

-        } while (*pbVar6 != 0);

-        bVar2 = pbVar6[1];

-        if (-1 < (char)bVar2) break;

-        pbVar5 = pbVar6 + 3;

-        if (-1 < (char)pbVar6[2]) break;

-        bVar3 = *pbVar5;

-        while ((char)bVar3 < '\0') {

-          if (bVar3 != 0x80) goto LAB_5;

-          pbVar6 = pbVar5 + 1;

-          pbVar5 = pbVar5 + 1;

-          bVar3 = *pbVar6;

-        }

-        if (((bVar2 & 0x7f) != 9) || (2 < (byte)(bVar3 + 0x8f))) break;

-        bVar7 = bVar7 + 1;

-        *(byte *)(unaff_RBP + -0x73 + uVar8 * 0x10) = bVar3;

-        uVar8 = (ulonglong)bVar7;

-        if (&UNK_6 < pbVar5) break;

+                    /* 0x6c4a0  361  WriteDnsNrptRulesToRegistry */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800acae8(param_1,param_2,param_3,param_4);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "WriteDnsNrptRulesToRegistry";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x1c;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-LAB_5:

-    if (bVar7 == 0) {

-      uRam0000000048b845b1 = 0x48b845e9;

-      uRam0000000048b845a9 = 7;

-      uRam0000000048b84581 = 0x18006a3de;

-      EventWriteTransfer(DAT_7,(PCEVENT_DESCRIPTOR)0x48b845c1,(LPCGUID)0x0,(LPCGUID)0x0,7,

-                         (PEVENT_DATA_DESCRIPTOR)0x48b845e9);

-    }

-    else {

-      uRam0000000048b845a9 = CONCAT31(uRam0000000048b845a9._1_3_,bVar7);

-      uRam0000000048b84581 = 0x18006a3b4;

-      FUN_1800e3380(0x180135218,(undefined8 *)0x48b845c1,7,0x48b845e9,bVar7);

-    }

+    uVar2 = 0x78;

   }

-  uRam0000000048b84581 = 0x18006a3f8;

-  return 0;

+  return uVar2;

 }
```

## `DnsIpv6StringToAddress`  (modified)

```diff
--- DnsIpv6StringToAddress
+++ DnsIpv6StringToAddress
@@ -1,92 +1,74 @@
 

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

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

 

-ulonglong DnsIpv6StringToAddress(_CERT_EXTENSION *param_1,LPCWSTR param_2,uint param_3)

+undefined8 DnsIpv6StringToAddress(undefined8 param_1,LPCWSTR param_2,uint param_3)

 

 {

-  longlong *plVar1;

-  DWORD DVar2;

-  uint uVar3;

-  BYTE *in_RAX;

-  longlong *plVar4;

-  longlong *plVar5;

-  undefined8 uVar6;

-  longlong unaff_RBP;

-  longlong *plVar7;

-  longlong unaff_RDI;

-  undefined4 in_register_00000084;

-  _CERT_EXTENSION *in_R9;

-  longlong unaff_R13;

-  short unaff_R15W;

-  _CERT_EXTENSION *in_stack_00000068;

+  bool bVar1;

+  undefined8 uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  uVar3 = (uint)unaff_R13;

-  DVar2 = FUN_18002e8a0(param_1,(ushort)unaff_RDI,

-                        (PCERT_EXTENSION)CONCAT44(in_register_00000084,param_3),in_R9,uVar3,uVar3,

-                        (FILETIME *)&stack0x00000070,unaff_R13,(int *)unaff_R13,uVar3,

-                        (undefined *)unaff_R13,(short)unaff_R13,in_RAX,in_stack_00000068);

-  plVar7 = (longlong *)(unaff_RDI + 0x20);

-  *(undefined4 *)(unaff_RDI + 0x14) = *(undefined4 *)(unaff_RBP + -0x38);

-  plVar1 = (longlong *)(unaff_RDI + 0x30);

-  plVar5 = *(longlong **)(unaff_RBP + -0x30);

-  *(DWORD *)(unaff_RDI + 0x18) = DVar2;

-  uVar6 = *(undefined8 *)(unaff_RBP + -0x28);

-  *plVar7 = unaff_R13;

-  *(longlong *)(unaff_RDI + 0x28) = unaff_R13;

-  *plVar1 = unaff_R13;

-  *(longlong *)(unaff_RDI + 0x38) = unaff_R13;

-  *(undefined8 *)(unaff_RDI + 0x60) = uVar6;

-  if (plVar5 != (longlong *)0x0) {

-    *(longlong *)(unaff_RBP + -0x78) = unaff_RBP + -0x80;

-    *(longlong *)(unaff_RBP + -0x68) = unaff_RBP + -0x70;

-    *(longlong *)(unaff_RBP + -0x48) = unaff_RBP + -0x50;

-    *(longlong *)(unaff_RBP + -0x58) = unaff_RBP + -0x60;

-    do {

-      plVar4 = (longlong *)*plVar5;

-      uVar3 = *(uint *)((longlong)plVar5 + 0x14) & 3;

-      *plVar5 = unaff_R13;

-      if (uVar3 < 2) {

-        if (((short)plVar5[2] == 5) && (unaff_R15W != 5)) {

-          **(undefined8 **)(unaff_RBP + -0x68) = plVar5;

-          *(longlong **)(unaff_RBP + -0x68) = plVar5;

-        }

-        else {

-          **(undefined8 **)(unaff_RBP + -0x78) = plVar5;

-          *(longlong **)(unaff_RBP + -0x78) = plVar5;

-        }

-      }

-      else if (uVar3 == 3) {

-        **(undefined8 **)(unaff_RBP + -0x48) = plVar5;

-        *(longlong **)(unaff_RBP + -0x48) = plVar5;

+                    /* 0x98290  146  DnsIpv6StringToAddress */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800cbd50(param_1,param_2,param_3);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

       }

       else {

-        **(undefined8 **)(unaff_RBP + -0x58) = plVar5;

-        *(longlong **)(unaff_RBP + -0x58) = plVar5;

+        bVar1 = true;

       }

-      plVar5 = plVar4;

-    } while (plVar4 != (longlong *)0x0);

-    *plVar7 = *(longlong *)(unaff_RBP + -0x80);

-    *(undefined8 *)(unaff_RDI + 0x28) = *(undefined8 *)(unaff_RBP + -0x70);

-    *(undefined8 *)(unaff_RDI + 0x38) = *(undefined8 *)(unaff_RBP + -0x60);

-    *plVar1 = *(longlong *)(unaff_RBP + -0x50);

-    if (*(int *)(unaff_RDI + 0x1c) == 1) goto LAB_0;

-    uVar6 = 0;

-    for (; plVar7 <= plVar1; plVar7 = plVar7 + 1) {

-      plVar5 = (longlong *)*plVar7;

-      plVar4 = FUN_18002fb20(plVar5,uVar6,1,*(int *)(unaff_RDI + 0x1c));

-      *plVar7 = (longlong)plVar4;

-      FUN_18002a140(plVar5);

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsIpv6StringToAddress";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x17;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

     }

+    uVar2 = 0;

   }

-  if (*(int *)(unaff_RDI + 0x1c) != 1) {

-    DnsApiFree(*(LPVOID *)(unaff_RDI + 8));

-    *(undefined8 *)(unaff_RDI + 8) = *(undefined8 *)(unaff_RDI + 0x68);

-    *(longlong *)(unaff_RDI + 0x68) = unaff_R13;

-  }

-LAB_0:

-  if (*(HANDLE *)(unaff_RDI + 0x40) != (HANDLE)0x0) {

-    SetEvent(*(HANDLE *)(unaff_RDI + 0x40));

-  }

-  return (ulonglong)DVar2;

+  return uVar2;

 }
```

## `DnsIpv6StringToAddress`  (modified)

```diff
--- DnsIpv6StringToAddress
+++ DnsGetPrimaryDomainName_A
@@ -1,74 +1,75 @@
 

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

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

 

-undefined8 DnsIpv6StringToAddress(undefined8 param_1,LPCWSTR param_2,uint param_3)

+uint * DnsGetPrimaryDomainName_A(void)

 

 {

   bool bVar1;

-  undefined8 uVar2;

+  uint *puVar2;

   undefined4 uVar3;

+  wchar_t *in_R9;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x98290  146  DnsIpv6StringToAddress */

+                    /* 0x97fb0  127  DnsGetPrimaryDomainName_A */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    uVar2 = FUN_1800cbd50(param_1,param_2,param_3);

+    puVar2 = DnsQueryConfigAllocEx(1,(HKEY)0x0,0,in_R9);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

         uVar3 = 8;

         local_118 = 1;

-        local_d8 = "DnsIpv6StringToAddress";

+        local_d8 = "DnsGetPrimaryDomainName_A";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x17;

+        local_d0 = 0x1a;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

         local_a0 = uVar3;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0;

+    puVar2 = (uint *)0x0;

   }

-  return uVar2;

+  return puVar2;

 }
```

## `HostsFile_Close`  (modified)

```diff
--- HostsFile_Close
+++ Dns_SkipPacketName
@@ -1,72 +1,103 @@
 

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

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

 

-void HostsFile_Close(undefined8 *param_1)

+byte * Dns_SkipPacketName(byte *param_1,byte *param_2)

 

 {

-  bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  char in_AL;

+  char cVar1;

+  uint uVar2;

+  int iVar3;

+  uint extraout_EAX;

+  byte *pbVar4;

+  ulonglong uVar5;

+  LPCWSTR pvData;

+  char *pcVar6;

+  longlong unaff_RBP;

+  undefined8 *in_R8;

+  HKEY unaff_R12;

+  undefined8 *unaff_R15;

+  uint uStack0000000000000040;

+  undefined8 uStack0000000000000050;

+  undefined8 uStack0000000000000058;

   

-                    /* 0x6b280  305  HostsFile_Close */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    FUN_1800daba8(param_1);

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  uVar2 = (uint)unaff_R12;

+  pvData = (LPCWSTR)((ulonglong)unaff_R12 & 0xffffffff);

+  pcVar6 = (char *)((ulonglong)unaff_R12 & 0xffffffff);

+  uStack0000000000000040 = uVar2;

+  if (in_AL == '\0') {

+    if ((param_2 == (byte *)0x0) || (unaff_R15 == (undefined8 *)0x0)) {

+      pbVar4 = (byte *)0x57;

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

+    else {

+      *in_R8 = unaff_R12;

+      *(uint *)param_2 = uVar2;

+      uVar5 = FUN_180069150((uint *)param_1,0,(PHKEY)&stack0x00000048);

+      pbVar4 = (byte *)(uVar5 & 0xffffffff);

+      if ((int)uVar5 == 0) {

+        uVar2 = RegGetValueW(unaff_R12,(LPCWSTR)0x0,L"DNSQueryTimeoutsMB",0x20,(LPDWORD)unaff_R12,

+                             unaff_R12,&stack0x00000040);

+        pbVar4 = (byte *)(ulonglong)uVar2;

+        if ((uVar2 == 0) && (4 < uStack0000000000000040)) {

+          pvData = FUN_18008a630((ulonglong)uStack0000000000000040);

+          pcVar6 = FUN_18008a630((ulonglong)(uStack0000000000000040 >> 1));

+          if ((pvData == (LPCWSTR)0x0) || (pcVar6 == (char *)0x0)) {

+            pbVar4 = (byte *)0xe;

+          }

+          else {

+            uVar2 = RegGetValueW(unaff_R12,(LPCWSTR)0x0,L"DNSQueryTimeoutsMB",0x20,

+                                 (LPDWORD)unaff_R12,pvData,&stack0x00000040);

+            pbVar4 = (byte *)(ulonglong)uVar2;

+            if ((uVar2 == 0) && (2 < uStack0000000000000040)) {

+              iVar3 = FUN_1800304d8(pvData,uStack0000000000000040 >> 1,pcVar6,

+                                    uStack0000000000000040 >> 1);

+              if (iVar3 == 0) {

+                uVar2 = GetLastError();

+              }

+              else {

+                FUN_1800589bc(pcVar6,0,unaff_R15,(uint *)param_2);

+                uVar2 = extraout_EAX;

+              }

+              pbVar4 = (byte *)(ulonglong)uVar2;

+            }

+          }

+        }

       }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "HostsFile_Close";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x10;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      DnsApiFree(pcVar6);

+      DnsApiFree(pvData);

+      if (unaff_R12 != (HKEY)0x0) {

+        RegCloseKey(unaff_R12);

       }

     }

   }

-  return;

+  else {

+    memset((void *)(unaff_RBP + -0x30),0,0x80);

+    if (DAT_0 != uVar2) {

+      FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x98),0,(short *)(unaff_RBP + -0x30),uVar2 + 0x40);

+    }

+    if (5 < DAT_1) {

+      if (((_DAT_2 & 0x400000000000) == 0) ||

+         (cVar1 = '\x01', (DAT_3 & 0x400000000000) != DAT_3)) {

+        cVar1 = (char)unaff_R12;

+      }

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

+        uStack0000000000000050 = 1;

+        *(undefined8 **)(unaff_RBP + -0x80) = &stack0x00000050;

+        *(undefined8 *)(unaff_RBP + -0x78) = 8;

+        *(char **)(unaff_RBP + -0x70) = "DnsGetQueryRetryTimeouts";

+        *(undefined8 *)(unaff_RBP + -0x68) = 0x19;

+        *(char **)(unaff_RBP + -0x60) = "FALSE";

+        *(undefined8 *)(unaff_RBP + -0x58) = 6;

+        FUN_180055600((undefined8 *)(unaff_RBP + -0x50),(undefined *)(unaff_RBP + -0x30));

+        uStack0000000000000058 = 0x1000000;

+        *(undefined8 **)(unaff_RBP + -0x40) = &stack0x00000058;

+        *(undefined8 *)(unaff_RBP + -0x38) = 8;

+        FUN_1800e3690(0x180135218,&DAT_4,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

+      }

+    }

+    pbVar4 = (byte *)0x78;

+  }

+  return pbVar4;

 }
```

## `DnsFlushResolverCacheEntry_UTF8`  (modified)

```diff
--- DnsFlushResolverCacheEntry_UTF8
+++ DnsFlushResolverCacheEntry_UTF8
@@ -1,135 +1,70 @@
 

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

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

 

-undefined4 DnsFlushResolverCacheEntry_UTF8(LPCWSTR param_1)

+void DnsFlushResolverCacheEntry_UTF8(LPCWSTR param_1)

 

 {

-  undefined4 extraout_EAX;

-  undefined4 extraout_EAX_00;

-  undefined8 *puVar1;

-  undefined8 *puVar2;

-  longlong in_RDX;

-  int iVar3;

-  undefined4 uVar4;

-  longlong in_R8;

-  int in_R9D;

-  uint uVar5;

-  undefined4 *puVar6;

-  bool bVar7;

-  int in_stack_00000040;

-  undefined8 *in_stack_00000048;

-  undefined1 auStackY_200 [32];

-  undefined8 in_stack_fffffffffffffe20;

-  longlong lVar8;

-  undefined4 uVar9;

-  undefined4 in_stack_fffffffffffffe2c;

-  undefined1 *puStack_1b0;

-  undefined8 uStack_1a8;

-  undefined4 uStack_1a0;

-  undefined8 uStack_19c;

-  undefined4 uStack_150;

-  undefined4 uStack_14c;

-  undefined4 uStack_140;

-  undefined8 uStack_f0;

-  undefined8 uStack_e8;

-  undefined4 uStack_e0;

-  undefined8 uStack_dc;

-  undefined1 auStack_90 [8];

-  undefined8 local_88;

-  undefined4 local_80;

-  undefined8 uStack_7c;

-  ulonglong local_30;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  local_30 = DAT_0 ^ (ulonglong)auStackY_200;

-  memset(&puStack_1b0,0,0x58);

-  memset(auStack_90,0,0x58);

-  memset(&uStack_f0,0,0x58);

-  memset(&uStack_150,0,0x60);

-  puVar6 = (undefined4 *)0x0;

-  if (in_R8 != 0) {

-    uStack_150 = 0x80000001;

-    puVar6 = &uStack_150;

-    uStack_14c = 0x60;

-    uStack_140 = 10;

+                    /* 0x936e0  87  DnsFlushResolverCacheEntry_UTF8 */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "DnsFlushResolverCacheEntry_UTF8";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x20;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

   }

-  uVar9 = 1;

-  puVar1 = FUN_180019d78(in_RDX,0,param_1,0,in_stack_fffffffffffffe20,1);

-  if (puVar1 == (undefined8 *)0x0) {

-    return 0xe;

-  }

-  puVar2 = FUN_18002c5c0((ushort)in_stack_00000040 + 8);

-  if (puVar2 == (undefined8 *)0x0) {

-    uVar9 = 0xe;

-    puVar2 = (undefined8 *)0x0;

-  }

-  else {

-    uVar4 = (undefined4)((ulonglong)puVar2 >> 0x20);

-    if (in_R9D == 0) {

-      puVar2 = (undefined8 *)0x0;

-    }

-    else {

-      if ((in_stack_00000048 != (undefined8 *)0x0) && (in_stack_00000040 != 0)) {

-        uVar9 = 9;

-        FUN_18008ff24((longlong)puVar2,puVar1[1],0x31,(ushort)in_stack_00000040,0,9,

-                      in_stack_00000048);

-        if (DAT_1 == 0) {

-          lVar8 = 0;

-          uVar5 = 0x200;

-        }

-        else {

-          uVar5 = 0;

-          lVar8 = DAT_2;

-        }

-        iVar3 = FUN_180067470((undefined8 *)0x0,puVar1,puVar2,uVar5,lVar8,

-                              CONCAT44(in_stack_fffffffffffffe2c,uVar9),puVar6,0,1);

-        uStack_1a8 = puVar1[1];

-        bVar7 = DAT_1 == 0;

-        uStack_1a0 = 1;

-        uStack_19c = 0xd;

-        local_88 = puVar1[1];

-        local_80 = 0x1c;

-        uStack_7c = 0xd;

-        *(longlong *)CONCAT44(uVar4,iVar3) = (longlong)&puStack_1b0;

-        puStack_1b0 = auStack_90;

-        uStack_e8 = puVar1[1];

-        uStack_e0 = 0xff;

-        uStack_dc = 10;

-        if (bVar7) {

-          lVar8 = 0;

-          uVar5 = 0x200;

-        }

-        else {

-          uVar5 = 0;

-          lVar8 = DAT_2;

-        }

-        iVar3 = FUN_180067470((undefined8 *)0x0,&uStack_f0,(longlong *)CONCAT44(uVar4,iVar3),uVar5,

-                              lVar8,CONCAT44(in_stack_fffffffffffffe2c,uVar9),puVar6,0,1);

-        puVar2 = (undefined8 *)CONCAT44(uVar4,iVar3);

-        uVar9 = extraout_EAX;

-        goto LAB_3;

-      }

-      puVar2[1] = puVar1[1];

-      *(undefined4 *)(puVar2 + 2) = 0x31;

-      *(undefined8 *)((longlong)puVar2 + 0x14) = 0xd;

-    }

-    if (DAT_1 == 0) {

-      uVar5 = 0x200;

-      lVar8 = 0;

-    }

-    else {

-      uVar5 = 0;

-      lVar8 = DAT_2;

-    }

-    iVar3 = FUN_180067470((undefined8 *)0x0,puVar1,puVar2,uVar5,lVar8,

-                          CONCAT44(in_stack_fffffffffffffe2c,uVar9),puVar6,0,1);

-    puVar2 = (undefined8 *)CONCAT44(uVar4,iVar3);

-    uVar9 = extraout_EAX_00;

-  }

-LAB_3:

-  FUN_18002d2d0(puVar1);

-  if (puVar2 != (undefined8 *)0x0) {

-    FUN_18002d2d0(puVar2);

-  }

-  return uVar9;

+  FUN_18005e520(param_1,2);

+  return;

 }
```

## `Dns_SkipPacketName`  (modified)

```diff
--- Dns_SkipPacketName
+++ Dns_SetRecordsScopeId
@@ -1,103 +1,47 @@
 

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

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

 

-byte * Dns_SkipPacketName(byte *param_1,byte *param_2)

+undefined8 Dns_SetRecordsScopeId(longlong param_1,int param_2,undefined8 *param_3)

 

 {

-  char in_AL;

-  char cVar1;

-  uint uVar2;

-  int iVar3;

-  uint extraout_EAX;

-  byte *pbVar4;

-  ulonglong uVar5;

-  LPCWSTR pvData;

-  char *pcVar6;

+  byte bVar1;

+  byte *pbVar2;

+  byte *in_RAX;

+  ulonglong uVar3;

   longlong unaff_RBP;

-  undefined8 *in_R8;

-  HKEY unaff_R12;

-  undefined8 *unaff_R15;

-  uint uStack0000000000000040;

-  undefined8 uStack0000000000000050;

-  undefined8 uStack0000000000000058;

+  byte in_R9B;

+  byte *in_R10;

   

-  uVar2 = (uint)unaff_R12;

-  pvData = (LPCWSTR)((ulonglong)unaff_R12 & 0xffffffff);

-  pcVar6 = (char *)((ulonglong)unaff_R12 & 0xffffffff);

-  uStack0000000000000040 = uVar2;

-  if (in_AL == '\0') {

-    if ((param_2 == (byte *)0x0) || (unaff_R15 == (undefined8 *)0x0)) {

-      pbVar4 = (byte *)0x57;

-    }

-    else {

-      *in_R8 = unaff_R12;

-      *(uint *)param_2 = uVar2;

-      uVar5 = FUN_180069150((uint *)param_1,0,(PHKEY)&stack0x00000048);

-      pbVar4 = (byte *)(uVar5 & 0xffffffff);

-      if ((int)uVar5 == 0) {

-        uVar2 = RegGetValueW(unaff_R12,(LPCWSTR)0x0,L"DNSQueryTimeoutsMB",0x20,(LPDWORD)unaff_R12,

-                             unaff_R12,&stack0x00000040);

-        pbVar4 = (byte *)(ulonglong)uVar2;

-        if ((uVar2 == 0) && (4 < uStack0000000000000040)) {

-          pvData = FUN_18008a630((ulonglong)uStack0000000000000040);

-          pcVar6 = FUN_18008a630((ulonglong)(uStack0000000000000040 >> 1));

-          if ((pvData == (LPCWSTR)0x0) || (pcVar6 == (char *)0x0)) {

-            pbVar4 = (byte *)0xe;

-          }

-          else {

-            uVar2 = RegGetValueW(unaff_R12,(LPCWSTR)0x0,L"DNSQueryTimeoutsMB",0x20,

-                                 (LPDWORD)unaff_R12,pvData,&stack0x00000040);

-            pbVar4 = (byte *)(ulonglong)uVar2;

-            if ((uVar2 == 0) && (2 < uStack0000000000000040)) {

-              iVar3 = FUN_1800304d8(pvData,uStack0000000000000040 >> 1,pcVar6,

-                                    uStack0000000000000040 >> 1);

-              if (iVar3 == 0) {

-                uVar2 = GetLastError();

-              }

-              else {

-                FUN_1800589bc(pcVar6,0,unaff_R15,(uint *)param_2);

-                uVar2 = extraout_EAX;

-              }

-              pbVar4 = (byte *)(ulonglong)uVar2;

-            }

-          }

-        }

-      }

-      DnsApiFree(pcVar6);

-      DnsApiFree(pvData);

-      if (unaff_R12 != (HKEY)0x0) {

-        RegCloseKey(unaff_R12);

-      }

+  while (((char)param_3 == '\t' && ((byte)((char)param_2 + 0x8fU) < 3))) {

+    uVar3 = (ulonglong)in_R9B;

+    in_R9B = in_R9B + 1;

+    *(char *)(unaff_RBP + -0x73 + uVar3 * 0x10) = (char)param_2;

+    if (in_R10 <= in_RAX) break;

+    do {

+      pbVar2 = in_RAX;

+      in_RAX = pbVar2 + 1;

+    } while (*pbVar2 != 0);

+    bVar1 = pbVar2[1];

+    if (-1 < (char)bVar1) break;

+    param_3 = (undefined8 *)(ulonglong)(bVar1 & 0x7f);

+    in_RAX = pbVar2 + 3;

+    if (-1 < (char)pbVar2[2]) break;

+    bVar1 = *in_RAX;

+    while (param_2 = (int)bVar1, (char)bVar1 < '\0') {

+      if (bVar1 != 0x80) goto LAB_0;

+      pbVar2 = in_RAX + 1;

+      in_RAX = in_RAX + 1;

+      bVar1 = *pbVar2;

     }

   }

+LAB_0:

+  if (in_R9B == 0) {

+    EventWriteTransfer(DAT_1,(PCEVENT_DESCRIPTOR)&stack0x00000038,(LPCGUID)0x0,(LPCGUID)0x0,

+                       7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

+  }

   else {

-    memset((void *)(unaff_RBP + -0x30),0,0x80);

-    if (DAT_0 != uVar2) {

-      FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x98),0,(short *)(unaff_RBP + -0x30),uVar2 + 0x40);

-    }

-    if (5 < DAT_1) {

-      if (((_DAT_2 & 0x400000000000) == 0) ||

-         (cVar1 = '\x01', (DAT_3 & 0x400000000000) != DAT_3)) {

-        cVar1 = (char)unaff_R12;

-      }

-      if (cVar1 != '\0') {

-        uStack0000000000000050 = 1;

-        *(undefined8 **)(unaff_RBP + -0x80) = &stack0x00000050;

-        *(undefined8 *)(unaff_RBP + -0x78) = 8;

-        *(char **)(unaff_RBP + -0x70) = "DnsGetQueryRetryTimeouts";

-        *(undefined8 *)(unaff_RBP + -0x68) = 0x19;

-        *(char **)(unaff_RBP + -0x60) = "FALSE";

-        *(undefined8 *)(unaff_RBP + -0x58) = 6;

-        FUN_180055600((undefined8 *)(unaff_RBP + -0x50),(undefined *)(unaff_RBP + -0x30));

-        uStack0000000000000058 = 0x1000000;

-        *(undefined8 **)(unaff_RBP + -0x40) = &stack0x00000058;

-        *(undefined8 *)(unaff_RBP + -0x38) = 8;

-        FUN_1800e3690(0x180135218,&DAT_4,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

-      }

-    }

-    pbVar4 = (byte *)0x78;

+    FUN_1800e3380(0x180135218,(undefined8 *)&stack0x00000038,7,(longlong)&stack0x00000060,in_R9B);

   }

-  return pbVar4;

+  return 0x78;

 }
```

## `DnsCheckNrptRuleIntegrity`  (modified)

```diff
--- DnsCheckNrptRuleIntegrity
+++ DnsAddrArrayAddAddr
@@ -1,28 +1,10 @@
 

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

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

 

-ulonglong DnsCheckNrptRuleIntegrity(int *param_1)

+undefined8 DnsAddrArrayAddAddr(uint *param_1,ushort *param_2,uint param_3,uint param_4)

 

 {

-  ulonglong in_RAX;

-  byte *pbVar1;

-  ulonglong uVar2;

-  undefined *in_RDX;

-  longlong unaff_RBP;

-  undefined8 uStack0000000000000038;

-  undefined4 uStack0000000000000078;

-  

-  pbVar1 = (byte *)(in_RAX & 0xffffffffffffff68);

-  *pbVar1 = *pbVar1 | (byte)pbVar1;

-  *pbVar1 = *pbVar1 + (byte)pbVar1;

-  uStack0000000000000078 = 0x1f;

-  *(undefined4 *)(unaff_RBP + -0x78) = 6;

-  FUN_180055600((undefined8 *)param_1,in_RDX);

-  *(undefined4 *)(unaff_RBP + -0x54) = 0;

-  *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-  uStack0000000000000038 = 0x1000000;

-  *(undefined4 *)(unaff_RBP + -0x58) = 8;

-  uVar2 = FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  return uVar2;

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

+  halt_baddata();

 }
```

## `Update_ReplaceAddressRecordsW`  (modified)

```diff
--- Update_ReplaceAddressRecordsW
+++ Update_ReplaceAddressRecordsW
@@ -1,61 +1,78 @@
 

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

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

 

 undefined4

 Update_ReplaceAddressRecordsW

           (undefined8 *param_1,uint param_2,longlong param_3,uint *param_4,undefined8 param_5)

 

 {

-  undefined1 uVar1;

-  undefined8 in_RAX;

-  longlong *plVar3;

-  undefined4 in_register_00000014;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  LPCRITICAL_SECTION unaff_RDI;

-  longlong *in_stack_00000030;

-  longlong *in_stack_00000040;

-  undefined8 uStack0000000000000050;

-  undefined8 uStack0000000000000058;

-  uint *puVar2;

+  bool bVar1;

+  int iVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_178 [32];

+  undefined8 local_148;

+  undefined8 local_140;

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined4 local_110;

+  undefined4 local_10c;

+  char *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  short local_c8 [64];

+  ulonglong local_48;

   

-  uVar1 = in(0x9d);

-  puVar2 = (uint *)CONCAT71((int7)((ulonglong)in_RAX >> 8),uVar1);

-  *puVar2 = *puVar2 | (uint)puVar2;

-  *(uint **)(unaff_RBP + -0x60) = puVar2;

-  uStack0000000000000050 = 1;

-  *(undefined4 *)(unaff_RBP + -0x78) = 8;

-  *(undefined4 *)(unaff_RBP + -0x68) = 0x14;

-  *(undefined4 *)(unaff_RBP + -0x58) = 0x12;

-  FUN_180055600(param_1,(undefined *)CONCAT44(in_register_00000014,param_2));

-  *(undefined4 *)(unaff_RBP + -0x34) = 0;

-  *(undefined8 **)(unaff_RBP + -0x40) = &stack0x00000058;

-  uStack0000000000000058 = 0x1000000;

-  *(undefined4 *)(unaff_RBP + -0x38) = 8;

-  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

-  FUN_180060174((longlong *)(unaff_RBX + 0x240),(longlong *)&stack0x00000030);

-  FUN_180060174((longlong *)(unaff_RBX + 0x260),(longlong *)&stack0x00000030);

-  FUN_180060174((longlong *)(unaff_RBX + 0x250),(longlong *)&stack0x00000040);

-  FUN_180060174((longlong *)(unaff_RBX + 0x270),(longlong *)&stack0x00000040);

-  *(undefined4 *)(unaff_RBX + 0x290) = 0;

-  LeaveCriticalSection(unaff_RDI);

-  while ((longlong **)in_stack_00000030 != &stack0x00000030) {

-    if ((DAT_1 & 8) != 0) {

-      FUN_1800f7614(0x40b,0xfb,0x18010da00);

+                    /* 0x7ca20  358  Update_ReplaceAddressRecordsW */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_178;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 == 0)) {

+    memset(local_c8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

     }

-    FUN_1800a6b48(in_stack_00000030);

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_10c = 0;

+        local_118 = &local_148;

+        local_fc = 0;

+        local_ec = 0;

+        uVar3 = 8;

+        local_148 = 1;

+        local_108 = "Update_ReplaceAddressRecordsW";

+        local_f8 = "FALSE";

+        local_110 = 8;

+        local_100 = 0x1e;

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_cc = 0;

+        local_d8 = &local_140;

+        local_140 = 0x1000000;

+        local_d0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_138);

+      }

+    }

+    return 0x78;

   }

-  while( true ) {

-    plVar3 = (longlong *)&stack0x00000040;

-    if (in_stack_00000040 == plVar3) break;

-    if ((DAT_1 & 8) != 0) {

-      FUN_1800f7614(0x40b,0xfc,0x18010da00);

-    }

-    FUN_1800a6b48(in_stack_00000040);

+  if (DAT_7 != 0) {

+    param_2 = param_2 | 0x20000;

   }

-  if ((DAT_1 & 8) != 0) {

-    plVar3 = (longlong *)FUN_1800f7614(0x40b,0xfd,0x18010da00);

-  }

-  return (int)plVar3;

+  uVar3 = FUN_18007d2a4(param_1,param_2,param_3,param_4,param_5);

+  return uVar3;

 }
```

## `DnsDeRegisterLocal`  (modified)

```diff
--- DnsDeRegisterLocal
+++ CreateSendBlob
@@ -1,74 +1,60 @@
 

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

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

 

-ulonglong DnsDeRegisterLocal(longlong param_1,int param_2)

+int CreateSendBlob(undefined8 *param_1,undefined8 param_2,undefined *param_3)

 

 {

-  bool bVar1;

+  int iVar1;

   ulonglong uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  LPCRITICAL_SECTION p_Var3;

+  undefined2 unaff_BX;

+  longlong unaff_RBP;

+  LPVOID unaff_RSI;

+  int unaff_EDI;

+  undefined4 in_R9D;

+  wchar_t *unaff_R12;

+  undefined4 *unaff_R13;

+  uint *unaff_R14;

+  longlong unaff_R15;

+  bool bVar4;

   

-                    /* 0x68650  64  DnsDeRegisterLocal */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = FUN_1800b50a8(param_1,param_2);

+  uVar2 = FUN_1800609f4(unaff_RSI,unaff_R12,*(ushort *)(unaff_RBP + -0x61),in_R9D,

+                        *(undefined4 *)(unaff_RBP + 0x77),*(undefined4 *)(unaff_RBP + 0x7f),

+                        *(undefined4 *)(unaff_RBP + 0x9f),*(undefined8 *)(unaff_RBP + -0x51),

+                        unaff_BX,*(undefined8 *)(unaff_RBP + -0x59),param_3,unaff_R15 + 0x20,

+                        unaff_R15 + 0x38,(ulonglong)(unaff_EDI + 0x40));

+  iVar1 = (int)uVar2;

+  if (iVar1 == 0) {

+    if ((DAT_0 & 8) != 0) {

+      FUN_1800f71b8(0x40b,0x30,0x18010fd18,unaff_RSI);

+    }

+    bVar4 = DAT_1 == 0;

+    p_Var3 = (LPCRITICAL_SECTION)&DAT_2;

+    *unaff_R13 = 0x2522;

+    if (bVar4) {

+      p_Var3 = (LPCRITICAL_SECTION)&DAT_3;

+    }

+    EnterCriticalSection(p_Var3);

+    if ((*(int *)((longlong)unaff_RSI + 0x74) == 0) && (unaff_R14 != (uint *)0x0)) {

+      LOCK();

+      *unaff_R14 = *unaff_R14 | 1;

+      UNLOCK();

+    }

+    if (DAT_1 == 0) {

+      p_Var3 = (LPCRITICAL_SECTION)&DAT_3;

+    }

+    else {

+      p_Var3 = (LPCRITICAL_SECTION)&DAT_2;

+    }

+    LeaveCriticalSection(p_Var3);

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    if ((DAT_0 & 8) != 0) {

+      FUN_1800f658c(0x40b,0x2f,0x18010fd18,iVar1);

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsDeRegisterLocal";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x13;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0x78;

+    FUN_18005e04c(unaff_RSI);

   }

-  return uVar2;

+  FUN_18005e04c(unaff_RSI);

+  return iVar1;

 }
```

## `Dns_CloseSocket`  (modified)

```diff
--- Dns_CloseSocket
+++ Dns_CloseSocket
@@ -1,67 +1,70 @@
 

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

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

 

-undefined4 Dns_CloseSocket(SOCKET param_1)

+void Dns_CloseSocket(SOCKET param_1)

 

 {

-  undefined8 uVar1;

-  undefined8 uVar2;

-  undefined8 uVar3;

-  undefined8 uVar4;

-  int in_EDX;

-  undefined4 unaff_EBX;

-  longlong unaff_RBP;

-  undefined4 *unaff_RDI;

-  undefined4 in_XMM0_Da;

-  undefined4 in_XMM0_Db;

-  undefined4 in_XMM0_Dc;

-  undefined4 in_XMM0_Dd;

-  undefined4 in_XMM1_Da;

-  undefined4 in_XMM1_Db;

-  undefined4 in_XMM1_Dc;

-  undefined4 in_XMM1_Dd;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *unaff_RDI = in_XMM0_Da;

-  unaff_RDI[1] = in_XMM0_Db;

-  unaff_RDI[2] = in_XMM0_Dc;

-  unaff_RDI[3] = in_XMM0_Dd;

-  uVar1 = *(undefined8 *)(unaff_RBP + -0x19);

-  uVar2 = *(undefined8 *)(unaff_RBP + -0x11);

-  unaff_RDI[4] = in_XMM1_Da;

-  unaff_RDI[5] = in_XMM1_Db;

-  unaff_RDI[6] = in_XMM1_Dc;

-  unaff_RDI[7] = in_XMM1_Dd;

-  uVar3 = *(undefined8 *)(unaff_RBP + -9);

-  uVar4 = *(undefined8 *)(unaff_RBP + -1);

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

-  *(undefined8 *)(unaff_RDI + 10) = uVar2;

-  uVar1 = *(undefined8 *)(unaff_RBP + 7);

-  uVar2 = *(undefined8 *)(unaff_RBP + 0xf);

-  *(undefined8 *)(unaff_RDI + 0xc) = uVar3;

-  *(undefined8 *)(unaff_RDI + 0xe) = uVar4;

-  uVar3 = *(undefined8 *)(unaff_RBP + 0x17);

-  uVar4 = *(undefined8 *)(unaff_RBP + 0x1f);

-  *(undefined8 *)(unaff_RDI + 0x10) = uVar1;

-  *(undefined8 *)(unaff_RDI + 0x12) = uVar2;

-  uVar1 = *(undefined8 *)(unaff_RBP + 0x27);

-  uVar2 = *(undefined8 *)(unaff_RBP + 0x2f);

-  *(undefined8 *)(unaff_RDI + 0x14) = uVar3;

-  *(undefined8 *)(unaff_RDI + 0x16) = uVar4;

-  *(undefined8 *)(unaff_RDI + 0x18) = uVar1;

-  *(undefined8 *)(unaff_RDI + 0x1a) = uVar2;

-  memset((void *)param_1,in_EDX,(ulonglong)(in_EDX + 0x70));

-  DnsFreeNrptRule(unaff_RBP + -0x39);

-  if (*(HKEY *)(unaff_RBP + -0x49) != (HKEY)0x0) {

-    RegCloseKey(*(HKEY *)(unaff_RBP + -0x49));

-    *(undefined8 *)(unaff_RBP + -0x49) = 0;

+                    /* 0x9b0d0  268  Dns_CloseSocket */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Dns_CloseSocket";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x10;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

   }

-  if (*(HKEY *)(unaff_RBP + -0x41) != (HKEY)0x0) {

-    RegCloseKey(*(HKEY *)(unaff_RBP + -0x41));

-    *(undefined8 *)(unaff_RBP + -0x41) = 0;

-  }

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x23,0x180110e58,unaff_EBX);

-  }

-  return unaff_EBX;

+  Socket_CloseEx(param_1,0);

+  return;

 }
```

## `Socket_SetMulticastLoopBack`  (modified)

```diff
--- Socket_SetMulticastLoopBack
+++ Socket_JoinMulticast
@@ -1,80 +1,120 @@
 

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

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

 

-int Socket_SetMulticastLoopBack(undefined8 param_1,undefined8 param_2,undefined4 param_3)

+int Socket_JoinMulticast(SOCKET param_1,uint param_2,short *param_3,int param_4,int param_5)

 

 {

   bool bVar1;

   int iVar2;

-  undefined8 uVar3;

-  undefined4 *puVar4;

+  u_long uVar3;

+  SOCKET SVar4;

+  undefined8 uVar5;

+  char *optval;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_178 [32];

-  undefined4 local_120 [2];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined8 local_e0;

-  char *local_d8;

-  undefined8 local_d0;

-  char *local_c8;

-  undefined8 local_c0;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined8 local_a0;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined1 auStackY_198 [32];

+  int optlen;

+  undefined8 local_158;

+  undefined8 local_150;

+  undefined4 local_148;

+  undefined4 uStack_144;

+  undefined4 uStack_140;

+  undefined4 uStack_13c;

+  uint local_138;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  undefined8 local_d8 [2];

+  undefined8 *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  short local_b8 [64];

+  ulonglong local_38;

   

-                    /* 0x7b7d0  353  Socket_SetMulticastLoopBack */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_178;

-  local_120[0] = param_3;

+                    /* 0x7ad60  350  Socket_JoinMulticast */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_198;

   if ((DAT_1 & 8) != 0) {

-    FUN_1800ec408();

+    FUN_1800ec588();

   }

   if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

      (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

-    puVar4 = local_120;

-    uVar3 = param_1;

-    iVar2 = WSAIoctl(param_1,0x88000009,puVar4,4);

-    if (iVar2 == -1) {

-      iVar2 = WSAGetLastError();

-      if ((DAT_1 & 8) != 0) {

-        FUN_1800e6694(uVar3,0x1d,puVar4,param_1);

+    if ((param_1 - 1 < 0xfffffffffffffffe) && ((param_4 != 0 || (param_5 != 0)))) {

+      if (*param_3 == 2) {

+        local_158 = CONCAT44(local_158._4_4_,*(undefined4 *)(param_3 + 2));

+        uVar3 = htonl(param_2 & 0xffff);

+        optlen = 8;

+        optval = (char *)&local_158;

+        local_158 = CONCAT44(uVar3,(undefined4)local_158);

+        iVar2 = 0;

+      }

+      else {

+        local_148 = *(undefined4 *)(param_3 + 4);

+        uStack_144 = *(undefined4 *)(param_3 + 6);

+        uStack_140 = *(undefined4 *)(param_3 + 8);

+        uStack_13c = *(undefined4 *)(param_3 + 10);

+        local_138 = param_2 & 0xffff;

+        optval = (char *)&local_148;

+        optlen = 0x14;

+        iVar2 = 0x29;

+      }

+      uVar5 = 0xc;

+      SVar4 = param_1;

+      iVar2 = setsockopt(param_1,iVar2,0xc,optval,optlen);

+      if (iVar2 == -1) {

+        iVar2 = WSAGetLastError();

+        if ((DAT_1 & 8) != 0) {

+          FUN_1800e6694(SVar4,0x1b,uVar5,param_1);

+        }

+      }

+      else {

+        iVar2 = 0;

       }

     }

     else {

-      iVar2 = 0;

+      iVar2 = 0x57;

     }

   }

   else {

-    memset(local_98,0,0x80);

+    memset(local_b8,0,0x80);

     if (DAT_3 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

     }

     if (5 < DAT_4) {

       if (((_DAT_5 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

         bVar1 = false;

       }

+      else {

+        bVar1 = true;

+      }

       if (bVar1) {

-        local_e8 = &local_118;

-        local_118 = 1;

-        local_e0 = 8;

-        local_d8 = "Socket_SetMulticastLoopBack";

-        local_d0 = 0x1c;

-        local_c8 = "FALSE";

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+        local_fc = 0;

+        local_108 = &local_158;

+        local_ec = 0;

+        local_dc = 0;

+        local_f8 = "Socket_JoinMulticast";

+        local_e8 = "FALSE";

+        local_158 = 1;

+        local_100 = 8;

+        local_f0 = 0x15;

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_bc = 0;

+        local_c8 = &local_150;

+        local_150 = 0x1000000;

+        local_c0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

       }

     }

     iVar2 = 0x78;

   }

   return iVar2;

 }
```

## `DnsApiOnNetworkChange`  (modified)

```diff
--- DnsApiOnNetworkChange
+++ DnsApiOnNetworkChange
@@ -1,82 +1,91 @@
 

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

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

 

-DWORD DnsApiOnNetworkChange(ulonglong param_1,ulonglong param_2,undefined *param_3)

+undefined4 DnsApiOnNetworkChange(LPCSTR param_1,ulonglong param_2,undefined *param_3)

 

 {

-  DWORD *pDVar1;

-  NET_IF_COMPARTMENT_ID NVar2;

-  BYTE *pBVar3;

-  DWORD DVar4;

-  int iVar5;

-  undefined4 uVar6;

-  undefined4 extraout_EAX;

-  SOCKADDR_INET *pSVar7;

-  uint uVar8;

-  PCERT_INFO unaff_RBX;

-  PCERT_INFO p_Var9;

-  SOCKADDR_INET *in_stack_00000030;

+  bool bVar1;

+  int iVar2;

+  LPCSTR pCVar3;

+  undefined4 uVar4;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-  p_Var9 = unaff_RBX;

-  FUN_1800f71b8(0x40b,0x16b,0x18010c5a0,unaff_RBX);

-  DVar4 = FUN_18007d664();

-  if (DVar4 != 0) goto LAB_0;

-  if (unaff_RBX[4].rgExtension != (PCERT_EXTENSION)0x0) {

-    DVar4 = FUN_1800149b4((wchar_t *)unaff_RBX[4].rgExtension,1,DAT_1,(wchar_t *)0x0,

-                          &stack0x00000030);

-    if (DVar4 != 0) goto LAB_0;

-    pBVar3 = unaff_RBX[1].Issuer.pbData;

-    if (((ulonglong)pBVar3 >> 0x1d & 1) == 0) {

-      pDVar1 = &unaff_RBX[1].SubjectUniqueId.cUnusedBits;

-      *pDVar1 = *pDVar1 | 1;

+                    /* 0x74fa0  31  DnsApiOnNetworkChange */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  uVar4 = 0;

+  pCVar3 = param_1;

+  if ((DAT_1 & 8) != 0) {

+    param_2 = 0x15;

+    param_3 = &DAT_2;

+    FUN_1800f7164(param_1,0x15,0x1801101d8,param_1);

+  }

+  if ((DAT_3 != 0) && (DAT_18013630c == 0)) {

+    pCVar3 = unaff_retaddr;

+    iVar2 = FUN_1800ca394(unaff_retaddr);

+    if (iVar2 == 0) {

+      memset(local_98,0,0x80);

+      if (DAT_4 != 0) {

+        FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+      }

+      if (5 < DAT_5) {

+        if (((_DAT_6 & 0x400000000000) == 0) ||

+           (bVar1 = true, (DAT_7 & 0x400000000000) != DAT_7)) {

+          bVar1 = false;

+        }

+        if (bVar1) {

+          local_e8 = &local_118;

+          local_118 = 1;

+          local_e0 = 8;

+          local_d8 = "DnsApiOnNetworkChange";

+          local_d0 = 0x16;

+          local_c8 = "FALSE";

+          local_c0 = 6;

+          FUN_180055600(local_b8,(undefined *)local_98);

+          local_a8 = &local_110;

+          local_110 = 0x1000000;

+          local_a0 = 8;

+          FUN_1800e3690(0x180135218,&DAT_8,0,7,local_108);

+        }

+      }

+      uVar4 = 0x78;

+      goto LAB_9;

     }

-    unaff_RBX[1].Issuer.pbData = (BYTE *)((ulonglong)pBVar3 | 0x2000000000000);

-    goto LAB_2;

   }

-  iVar5 = FUN_18006e19c();

-  if (iVar5 != 0) {

-    DVar4 = GetLastError();

-    goto LAB_0;

+  if (((ulonglong)param_1 & 0xf) != 0) {

+    FUN_18000960c(pCVar3,param_2,param_3);

   }

-  if ((DAT_3 == 0) && (*(int *)&unaff_RBX[1].field_0xc4 == 0)) {

-    uVar8 = 800;

-    uVar6 = 1;

+  if (((ulonglong)param_1 & 7) != 0) {

+    FUN_180055938(0,param_2,param_3);

+    LOCK();

+    DAT_10 = DAT_10 + 1;

+    UNLOCK();

   }

-  else {

-    uVar8 = 0x120;

-    uVar6 = 0;

+  if ((char)param_1 < '\0') {

+    FUN_180055938(1,param_2,param_3);

+    FUN_18005b6c4();

   }

-  NVar2 = *(NET_IF_COMPARTMENT_ID *)&unaff_RBX[1].SubjectUniqueId.field_0x14;

-  *(undefined4 *)((longlong)&unaff_RBX[2].Issuer.pbData + 4) = uVar6;

-  in_stack_00000030 = FUN_180013ce4(uVar8,NVar2,0,(wchar_t *)p_Var9);

-  if (in_stack_00000030 == (SOCKADDR_INET *)0x0) {

-LAB_4:

-    in_stack_00000030 = (SOCKADDR_INET *)0x0;

-    DVar4 = 0x267c;

-LAB_0:

-    NetInfo_Free((longlong *)&in_stack_00000030->si_family);

-    return DVar4;

+  FUN_180057e0c();

+  FUN_180058c38();

+LAB_9:

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x16,0x1801101d8,uVar4);

   }

-  if ((*(int *)&unaff_RBX[1].rgExtension != 0) && (*(int *)&unaff_RBX[1].field_0xc4 == 0)) {

-    pSVar7 = (SOCKADDR_INET *)

-             NetInfo_CopyNetworkIndex

-                       ((longlong *)&in_stack_00000030->si_family,

-                        *(int *)((longlong)&unaff_RBX[1].rgExtension + 4));

-    NetInfo_Free((longlong *)&in_stack_00000030->si_family);

-    if (pSVar7 == (SOCKADDR_INET *)0x0) goto LAB_4;

-    *(undefined4 *)((longlong)&unaff_RBX[2].Issuer.pbData + 4) = 0;

-    in_stack_00000030 = pSVar7;

-  }

-  unaff_RBX[3].SubjectUniqueId.cbData = 1;

-  unaff_RBX[2].NotBefore.dwLowDateTime = (uint)(DAT_5 != 0);

-LAB_2:

-  unaff_RBX[4].rgExtension = (PCERT_EXTENSION)0x0;

-  unaff_RBX[5].SignatureAlgorithm.Parameters.pbData = (BYTE *)0x0;

-  *(undefined8 *)&unaff_RBX[5].Issuer = 0;

-  *(code **)&unaff_RBX[5].SignatureAlgorithm.Parameters = FUN_180010e30;

-  *(SOCKADDR_INET **)&unaff_RBX[4].cExtension = in_stack_00000030;

-  DnsUpdateMachinePresence();

-  Query_Main(unaff_RBX);

-  return extraout_EAX;

+  return uVar4;

 }
```

## `Socket_ClearMessageSockets`  (modified)

```diff
--- Socket_ClearMessageSockets
+++ Socket_ClearMessageSockets
@@ -1,15 +1,77 @@
 

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

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

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

 

 void Socket_ClearMessageSockets(longlong param_1)

 

 {

-  int *in_RAX;

-  longlong unaff_RBP;

+  bool bVar1;

+  int iVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *in_RAX = *in_RAX + (int)in_RAX;

-  *(char *)(unaff_RBP + -0x75) = *(char *)(unaff_RBP + -0x75) + (char)in_RAX;

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

-  halt_baddata();

+                    /* 0x41820  344  Socket_ClearMessageSockets */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    *(undefined8 *)(param_1 + 0xd8) = 0;

+    *(undefined8 *)(param_1 + 0x10) = 0;

+    *(undefined8 *)(param_1 + 0x18) = 0;

+    return;

+  }

+  memset(local_98,0,0x80);

+  if (DAT_2 != 0) {

+    FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  }

+  if (DAT_3 < 6) {

+    return;

+  }

+  if (((_DAT_4 & 0x400000000000) == 0) ||

+     ((DAT_5 & 0x400000000000) != DAT_5)) {

+    bVar1 = false;

+  }

+  else {

+    bVar1 = true;

+  }

+  if (!bVar1) {

+    return;

+  }

+  local_dc = 0;

+  local_e8 = &local_118;

+  local_cc = 0;

+  local_bc = 0;

+  uVar3 = 8;

+  local_118 = 1;

+  local_d8 = "Socket_ClearMessageSockets";

+  local_c8 = "FALSE";

+  local_e0 = 8;

+  local_d0 = 0x1b;

+  local_c0 = 6;

+  FUN_180055600(local_b8,(undefined *)local_98);

+  local_9c = 0;

+  local_a8 = &local_110;

+  local_110 = 0x1000000;

+  local_a0 = uVar3;

+  FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+  return;

 }
```

## `DnsFreeZtRules`  (modified)

```diff
--- DnsFreeZtRules
+++ DnsFreeZtClientCertConfig
@@ -1,72 +1,75 @@
 

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

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

 

-void DnsFreeZtRules(uint param_1,LPVOID param_2)

+void DnsFreeZtClientCertConfig(LPVOID param_1)

 

 {

   bool bVar1;

-  ulonglong uVar2;

-  LPVOID pvVar3;

+  undefined4 uVar2;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

-  undefined8 local_e0;

+  undefined4 local_e0;

+  undefined4 local_dc;

   char *local_d8;

-  undefined8 local_d0;

+  undefined4 local_d0;

+  undefined4 local_cc;

   char *local_c8;

-  undefined8 local_c0;

+  undefined4 local_c0;

+  undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

-  undefined8 local_a0;

+  undefined4 local_a0;

+  undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x9dcd0  103  DnsFreeZtRules */

+                    /* 0x9d9f0  101  DnsFreeZtClientCertConfig */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    if (param_2 != (LPVOID)0x0) {

-      if (param_1 != 0) {

-        uVar2 = (ulonglong)param_1;

-        pvVar3 = param_2;

-        do {

-          FUN_1800d434c((longlong)pvVar3);

-          pvVar3 = (LPVOID)((longlong)pvVar3 + 0x30);

-          uVar2 = uVar2 - 1;

-        } while (uVar2 != 0);

-      }

-      DnsApiFree(param_2);

+    if (param_1 != (LPVOID)0x0) {

+      FUN_1800d42b0((longlong)param_1);

+      DnsApiFree(param_1);

     }

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

+      else {

+        bVar1 = true;

+      }

       if (bVar1) {

+        local_dc = 0;

         local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

         local_118 = 1;

+        local_d8 = "DnsFreeZtClientCertConfig";

+        local_c8 = "FALSE";

         local_e0 = 8;

-        local_d8 = "DnsFreeZtRules";

-        local_d0 = 0xf;

-        local_c8 = "FALSE";

+        local_d0 = 0x1a;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = 8;

+        local_a0 = uVar2;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

   }

   return;

 }
```

## `DnsFreeZtConfig`  (modified)

```diff
--- DnsFreeZtConfig
+++ DnsFreeZtConfig
@@ -1,75 +1,72 @@
 

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

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

 

-DWORD DnsFreeZtConfig(void *param_1)

+void DnsFreeZtConfig(LPVOID param_1)

 

 {

   bool bVar1;

-  DWORD DVar2;

-  uint in_EDX;

-  undefined4 uVar3;

+  undefined4 uVar2;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

-  undefined8 uStack_118;

-  undefined8 uStack_110;

-  _EVENT_DATA_DESCRIPTOR a_Stack_108 [2];

-  undefined8 *puStack_e8;

-  undefined4 uStack_e0;

-  undefined4 uStack_dc;

-  char *pcStack_d8;

-  undefined4 uStack_d0;

-  undefined4 uStack_cc;

-  char *pcStack_c8;

-  undefined4 uStack_c0;

-  undefined4 uStack_bc;

-  undefined8 auStack_b8 [2];

-  undefined8 *puStack_a8;

-  undefined4 uStack_a0;

-  undefined4 uStack_9c;

-  short asStack_98 [64];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x975a0  76  DnsDhcpSrvRegisterInit */

+                    /* 0x9db70  102  DnsFreeZtConfig */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    DVar2 = DnsDhcpSrvRegisterInitEx(param_1,in_EDX,0);

+    DnsApiFree(param_1);

   }

   else {

-    memset(asStack_98,0,0x80);

+    memset(local_98,0,0x80);

     if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,asStack_98,0x40);

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

-        uStack_dc = 0;

-        puStack_e8 = &uStack_118;

-        uStack_cc = 0;

-        uStack_bc = 0;

-        uVar3 = 8;

-        uStack_118 = 1;

-        pcStack_d8 = "DnsDhcpSrvRegisterInit";

-        pcStack_c8 = "FALSE";

-        uStack_e0 = 8;

-        uStack_d0 = 0x17;

-        uStack_c0 = 6;

-        FUN_180055600(auStack_b8,(undefined *)asStack_98);

-        uStack_9c = 0;

-        puStack_a8 = &uStack_110;

-        uStack_110 = 0x1000000;

-        uStack_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,a_Stack_108);

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "DnsFreeZtConfig";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x10;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    DVar2 = 0x78;

   }

-  return DVar2;

+  return;

 }
```

## `DnsFreeZtTrustedCa`  (modified)

```diff
--- DnsFreeZtTrustedCa
+++ DnsFreeZtRules
@@ -1,48 +1,27 @@
 

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

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

 

-undefined8 DnsFreeZtTrustedCa(void *param_1)

+undefined8 DnsFreeZtRules(uint param_1,void *param_2)

 

 {

-  bool bVar1;

-  ulonglong in_RDX;

+  char *pcVar1;

+  undefined1 uVar2;

+  undefined7 uVar3;

+  char *in_RAX;

   longlong unaff_RBP;

-  undefined4 uVar2;

+  undefined1 *unaff_RSI;

+  undefined4 in_R9D;

   undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

   

-  if (((_DAT_0 & (uint)in_RDX) == 0) || ((DAT_180135230 & in_RDX) != DAT_180135230)) {

-    bVar1 = false;

-  }

-  else {

-    bVar1 = true;

-  }

-  if (bVar1) {

-    uStack000000000000006c = 0;

-    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-    uStack000000000000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    uVar2 = 8;

-    uStack0000000000000030 = 1;

-    pcStack0000000000000070 = "DnsDowncaseDnsNameLabel";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    uStack0000000000000068 = 8;

-    uStack0000000000000078 = 0x18;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

-    uStack0000000000000038 = 0x1000000;

-    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  }

-  return 0;

+  *in_RAX = *in_RAX + (char)in_RAX;

+  uVar3 = (undefined7)((ulonglong)in_RAX >> 8);

+  uVar2 = *unaff_RSI;

+  pcVar1 = (char *)(CONCAT71(uVar3,uVar2) + -0x73);

+  *pcVar1 = *pcVar1 + (char)param_1;

+  *(ulonglong *)(unaff_RBP + -0x60) = CONCAT71(uVar3,uVar2) & 0xffffffffffffff38;

+  *(undefined4 *)(unaff_RBP + -0x58) = in_R9D;

+  uStack0000000000000030 = 0x1000000;

+  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000038);

+  return 0x78;

 }
```

## `DnsGetZtConfig`  (modified)

```diff
--- DnsGetZtConfig
+++ DnsFreeZtTrustedServers
@@ -1,114 +1,72 @@
 

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

-/* WARNING: Removing unreachable block (ram,0x00018009e7f8) */

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

 

-ulonglong DnsGetZtConfig(int param_1,uint param_2,undefined8 *param_3)

+void DnsFreeZtTrustedServers(uint param_1,LPVOID param_2)

 

 {

   bool bVar1;

-  LPVOID pvVar2;

-  ulonglong uVar3;

-  CLIENT_CALL_RETURN CVar4;

+  ulonglong uVar2;

+  LPVOID pvVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_188 [32];

-  undefined8 in_stack_fffffffffffffe98;

-  longlong local_140 [2];

-  LPVOID local_130;

-  uint local_128 [4];

-  _EVENT_DATA_DESCRIPTOR local_118 [2];

-  LPVOID *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

-  char *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined8 local_e0;

   char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  undefined8 local_c8 [2];

-  uint *local_b8;

-  undefined4 local_b0;

-  undefined4 local_ac;

-  short local_a8 [64];

-  ulonglong local_28;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-                    /* 0x9e5c0  136  DnsGetZtConfig */

-  local_28 = DAT_0 ^ (ulonglong)auStackY_188;

-  local_128[0] = param_2;

-  local_140[0] = 0;

-  local_140[1] = 0;

-  pvVar2 = (LPVOID)0x0;

-  if ((DAT_1 & 8) != 0) {

-    FUN_1800e4f7c(0x40b,10,0x180111be8,param_1,

-                  CONCAT44((int)((ulonglong)in_stack_fffffffffffffe98 >> 0x20),param_2),param_3);

-  }

-  if ((param_3 != (undefined8 *)0x0) && (*param_3 = 0, param_3 != (undefined8 *)0x0)) {

-    if (DAT_2 != 0) {

-      memset(local_a8,0,0x80);

-      if (DAT_3 != 0) {

-        FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

+                    /* 0x9e100  106  DnsFreeZtTrustedServers */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    if (param_2 != (LPVOID)0x0) {

+      if (param_1 != 0) {

+        uVar2 = (ulonglong)param_1;

+        pvVar3 = param_2;

+        do {

+          FUN_1800d4390((longlong)pvVar3);

+          pvVar3 = (LPVOID)((longlong)pvVar3 + 0x40);

+          uVar2 = uVar2 - 1;

+        } while (uVar2 != 0);

       }

-      if (5 < DAT_4) {

-        if (((_DAT_5 & 0x400000000000) == 0) ||

-           ((DAT_6 & 0x400000000000) != DAT_6)) {

-          bVar1 = false;

-        }

-        else {

-          bVar1 = true;

-        }

-        if (bVar1) {

-          local_130 = (LPVOID)0x1;

-          local_f8 = &local_130;

-          local_f0 = 8;

-          local_ec = 0;

-          local_e8 = "DnsGetZtConfig";

-          local_e0 = 0xf;

-          local_dc = 0;

-          local_d8 = "FALSE";

-          local_d0 = 6;

-          local_cc = 0;

-          FUN_180055600(local_c8,(undefined *)local_a8);

-          local_128[0] = 0x1000000;

-          local_128[1] = 0;

-          local_b8 = local_128;

-          local_b0 = 8;

-          local_ac = 0;

-          FUN_1800e3690(0x180135218,&DAT_7,0,7,local_118);

-        }

-      }

-      return 0x78;

-    }

-    if ((param_1 == 1) && (param_2 < 2)) {

-      pvVar2 = FUN_18008a630(0x40);

-      local_130 = pvVar2;

-      if (pvVar2 == (LPVOID)0x0) {

-        CVar4.Simple = 0xe;

-      }

-      else {

-        uVar3 = FUN_18002ddc4(local_140);

-        CVar4.Simple = uVar3 & 0xffffffff;

-        if ((int)uVar3 == 0) {

-          CVar4 = NdrClientCall3((MIDL_STUBLESS_PROXY_INFO *)&PTR_PTR_1800ff490,0x23,(void *)0x0);

-          if ((int)CVar4.Simple == 0) {

-            *param_3 = pvVar2;

-            pvVar2 = (LPVOID)0x0;

-          }

-          else if ((DAT_1 & 8) != 0) {

-            FUN_1800f658c(0x40b,0xc,0x180111be8,(int)CVar4.Simple);

-          }

-        }

-        else if ((DAT_1 & 8) != 0) {

-          FUN_1800f658c(0x40b,0xb,0x180111be8,(int)uVar3);

-        }

-      }

-      goto LAB_8;

+      DnsApiFree(param_2);

     }

   }

-  CVar4.Simple = 0x57;

-LAB_8:

-  FUN_18002dd44(local_140);

-  DnsFreeZtConfig(pvVar2);

-  return CVar4.Simple & 0xffffffff;

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_e8 = &local_118;

+        local_118 = 1;

+        local_e0 = 8;

+        local_d8 = "DnsFreeZtTrustedServers";

+        local_d0 = 0x18;

+        local_c8 = "FALSE";

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

+  return;

 }
```

## `DnsGetDomainName`  (modified)

```diff
--- DnsGetDomainName
+++ DnsGetBufferLengthForStringCopy
@@ -1,71 +1,75 @@
 

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

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

 

-ulonglong DnsGetDomainName(char *param_1)

+uint DnsGetBufferLengthForStringCopy(LPCWSTR param_1,ulonglong param_2,int param_3,int param_4)

 

 {

-  char cVar1;

-  ulonglong uVar2;

-  bool bVar3;

+  bool bVar1;

+  uint uVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

-  undefined8 local_e0;

+  undefined4 local_e0;

+  undefined4 local_dc;

   char *local_d8;

-  undefined8 local_d0;

+  undefined4 local_d0;

+  undefined4 local_cc;

   char *local_c8;

-  undefined8 local_c0;

+  undefined4 local_c0;

+  undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

-  undefined8 local_a0;

+  undefined4 local_a0;

+  undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x97cd0  118  DnsGetDomainName */

+                    /* 0x979d0  110  DnsGetBufferLengthForStringCopy */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    cVar1 = *param_1;

-    do {

-      if (cVar1 == '\0') {

-        return 0;

-      }

-      param_1 = param_1 + 1;

-      bVar3 = cVar1 != '.';

-      cVar1 = *param_1;

-    } while (bVar3);

-    uVar2 = -(ulonglong)(*param_1 != '\0') & (ulonglong)param_1;

+    uVar2 = FUN_1800505a0(param_1,param_2,2 - (uint)(param_3 != 0),2 - (uint)(param_4 != 0));

+    uVar2 = uVar2 & 0xffff;

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         (bVar3 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar3 = false;

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

       }

-      if (bVar3) {

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

         local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

         local_118 = 1;

+        local_d8 = "DnsGetBufferLengthForStringCopy";

+        local_c8 = "FALSE";

         local_e0 = 8;

-        local_d8 = "DnsGetDomainName";

-        local_d0 = 0x11;

-        local_c8 = "FALSE";

+        local_d0 = 0x20;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = 8;

+        local_a0 = uVar3;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

     uVar2 = 0;

   }

   return uVar2;

 }
```

## `DnsGetDdrInfoInternal`  (modified)

```diff
--- DnsGetDdrInfoInternal
+++ DnsGetDdrInfoInternal
@@ -1,7 +1,149 @@
 

-ulonglong DnsGetDdrInfoInternal(_GUID *param_1,ulong param_2,_GUID *param_3,_GUID *param_4)

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

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

+

+ulonglong DnsGetDdrInfoInternal(short *param_1,int param_2,undefined8 *param_3)

 

 {

-  return 0x180136530;

+  int iVar1;

+  undefined8 uVar2;

+  ulonglong uVar3;

+  short *_Dst;

+  int *piVar4;

+  uint uVar6;

+  int *piVar7;

+  short *psVar9;

+  short *unaff_retaddr;

+  undefined1 auStackY_168 [32];

+  undefined8 in_stack_fffffffffffffeb8;

+  undefined8 local_120;

+  short *local_118;

+  char *local_110;

+  char *local_108;

+  undefined8 local_100;

+  int *local_f8;

+  int *local_f0;

+  undefined *local_e8;

+  int local_e0;

+  undefined4 local_dc;

+  short local_d8 [16];

+  short local_b8 [64];

+  ulonglong local_38;

+  int *piVar5;

+  int *piVar8;

+  

+                    /* 0xc56a0  116  DnsGetDdrInfoInternal */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

+  local_dc = 0;

+  piVar8 = (int *)0x0;

+  piVar7 = (int *)0x0;

+  piVar5 = (int *)0x0;

+  piVar4 = (int *)0x0;

+  local_d8[8] = 0;

+  local_d8[9] = 0;

+  local_d8[10] = 0;

+  local_d8[0xb] = 0;

+  local_e0 = 0;

+  local_e8 = &DAT_1;

+  local_f8 = (int *)0x0;

+  local_f0 = (int *)0x0;

+  local_d8[0] = 0;

+  local_d8[1] = 0;

+  local_d8[2] = 0;

+  local_d8[3] = 0;

+  local_d8[4] = 0;

+  local_d8[5] = 0;

+  local_d8[6] = 0;

+  local_d8[7] = 0;

+  if ((DAT_2 & 8) != 0) {

+    FUN_1800f098c(param_1,0x35,param_3,param_1,

+                  CONCAT44((int)((ulonglong)in_stack_fffffffffffffeb8 >> 0x20),param_2),param_3);

+  }

+  if (((DAT_3 == 0) || (DAT_18013630c != 0)) ||

+     (iVar1 = FUN_1800ca394((LPCSTR)unaff_retaddr), iVar1 != 0)) {

+    if (param_3 == (undefined8 *)0x0) {

+      uVar6 = 0x80070057;

+      piVar4 = piVar5;

+      piVar7 = piVar8;

+    }

+    else {

+      FUN_180002fe0((undefined1 *)param_3);

+      if (param_1 == (short *)0x0) {

+        uVar6 = 0x80070057;

+        piVar4 = piVar5;

+        piVar7 = piVar8;

+      }

+      else {

+        uVar2 = FUN_180048598(param_1,local_d8);

+        uVar6 = (uint)uVar2;

+        if (0 < (int)uVar6) {

+          uVar6 = uVar6 & 0xffff | 0x80070000;

+        }

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

+          uVar3 = FUN_180060800((undefined8 *)local_d8,param_2,&local_f8);

+          uVar6 = (uint)uVar3;

+          piVar7 = local_f8;

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

+            FUN_180057f94(&local_e8);

+            uVar6 = FUN_1800c3fb8();

+            piVar7 = local_f8;

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

+              uVar2 = FUN_18006095c(DAT_4,(longlong)local_f8,&local_f0);

+              uVar6 = (uint)uVar2;

+              piVar4 = local_f0;

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

+                FUN_1800583dc(&local_e8);

+                piVar4 = local_f0;

+                if (local_f0 == (int *)0x0) {

+                  uVar6 = 0x80070490;

+                }

+                else {

+                  uVar6 = FUN_1800c61b4((longlong)local_f0,param_3);

+                }

+              }

+            }

+          }

+        }

+      }

+    }

+  }

+  else {

+    _Dst = local_b8;

+    psVar9 = (short *)0x80;

+    memset(_Dst,0,0x80);

+    if (DAT_5 != 0) {

+      psVar9 = local_b8;

+      FUN_1800ca1b8((LPCSTR)unaff_retaddr,0,psVar9,0x40);

+      _Dst = unaff_retaddr;

+    }

+    if (((5 < DAT_6) && ((_DAT_180135228 & 0x400000000000) != 0)) &&

+       ((DAT_7 & 0x400000000000) == DAT_7)) {

+      local_118 = local_b8;

+      local_120 = 0x1000000;

+      local_100 = 1;

+      local_110 = "FALSE";

+      local_108 = "DnsGetDdrInfoInternal";

+      FUN_18000103c(_Dst,&DAT_8,psVar9,&local_100,&local_108,&local_110,&local_118,

+                    &local_120);

+    }

+    uVar6 = 0x80070078;

+    piVar4 = piVar5;

+    piVar7 = piVar8;

+  }

+  if ((DAT_2 & 8) != 0) {

+    FUN_18001aa00(uVar6);

+    FUN_1800f8aec(0x40b,0x36,0x180114878,uVar6);

+  }

+  uVar3 = FUN_18001aa00(uVar6);

+  if (local_e0 != 0) {

+    FUN_1800583dc(&local_e8);

+  }

+  if (piVar4 != (int *)0x0) {

+    FUN_180060914(piVar4);

+  }

+  if (piVar7 != (int *)0x0) {

+    FUN_180060914(piVar7);

+  }

+  return uVar3 & 0xffffffff;

 }
```

## `DnsGetLastFailedUpdateInfo`  (modified)

```diff
--- DnsGetLastFailedUpdateInfo
+++ DnsGetDnsServerList
@@ -1,75 +1,77 @@
 

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

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

 

-void DnsGetLastFailedUpdateInfo(undefined8 *param_1)

+uint DnsGetDnsServerList(undefined8 *param_1,undefined8 param_2,undefined *param_3)

 

 {

   bool bVar1;

-  undefined4 uVar2;

+  uint *puVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x97e50  121  DnsGetLastFailedUpdateInfo */

+                    /* 0x97b50  117  DnsGetDnsServerList */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    *param_1 = 0;

-    param_1[1] = 0;

-    param_1[2] = 0;

-    param_1[3] = 0;

+    puVar2 = FUN_180050a3c((PCNZWCH)0x0,param_2,param_3);

+    *param_1 = puVar2;

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

+      return *puVar2;

+    }

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        uVar2 = 8;

+        uVar3 = 8;

         local_118 = 1;

-        local_d8 = "DnsGetLastFailedUpdateInfo";

+        local_d8 = "DnsGetDnsServerList";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x1b;

+        local_d0 = 0x14;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar2;

+        local_a0 = uVar3;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

   }

-  return;

+  return 0;

 }
```

## `DnsGetPrimaryDomainName_A`  (modified)

```diff
--- DnsGetPrimaryDomainName_A
+++ DnsGetDomainName
@@ -1,75 +1,71 @@
 

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

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

 

-uint * DnsGetPrimaryDomainName_A(void)

+ulonglong DnsGetDomainName(char *param_1)

 

 {

-  bool bVar1;

-  uint *puVar2;

-  undefined4 uVar3;

-  wchar_t *in_R9;

+  char cVar1;

+  ulonglong uVar2;

+  bool bVar3;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

+  undefined8 local_e0;

   char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

+  undefined8 local_d0;

   char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

+  undefined8 local_c0;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

+  undefined8 local_a0;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x97fb0  127  DnsGetPrimaryDomainName_A */

+                    /* 0x97cd0  118  DnsGetDomainName */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    puVar2 = DnsQueryConfigAllocEx(1,(HKEY)0x0,0,in_R9);

+    cVar1 = *param_1;

+    do {

+      if (cVar1 == '\0') {

+        return 0;

+      }

+      param_1 = param_1 + 1;

+      bVar3 = cVar1 != '.';

+      cVar1 = *param_1;

+    } while (bVar3);

+    uVar2 = -(ulonglong)(*param_1 != '\0') & (ulonglong)param_1;

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

+         (bVar3 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar3 = false;

       }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

+      if (bVar3) {

         local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

         local_118 = 1;

-        local_d8 = "DnsGetPrimaryDomainName_A";

+        local_e0 = 8;

+        local_d8 = "DnsGetDomainName";

+        local_d0 = 0x11;

         local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x1a;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar3;

+        local_a0 = 8;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    puVar2 = (uint *)0x0;

+    uVar2 = 0;

   }

-  return puVar2;

+  return uVar2;

 }
```

## `DnsGetInterfaceSettingsInProc`  (modified)

```diff
--- DnsGetInterfaceSettingsInProc
+++ DnsGetInterfaceSettingsInProc
@@ -1,10 +1,299 @@
 

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

-

-ulonglong DnsGetInterfaceSettingsInProc(longlong param_1,int *param_2)

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

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

+

+ulonglong DnsGetInterfaceSettingsInProc(uint *param_1,int *param_2)

 

 {

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

-  halt_baddata();

+  byte bVar1;

+  byte bVar2;

+  bool bVar3;

+  longlong lVar4;

+  HANDLE pvVar5;

+  int iVar6;

+  uint extraout_EAX;

+  uint extraout_EAX_00;

+  DWORD DVar7;

+  uint uVar8;

+  longlong lVar9;

+  byte *pbVar10;

+  byte *pbVar11;

+  wchar_t *_Dst;

+  uint uVar12;

+  ulonglong uVar13;

+  HANDLE pvVar14;

+  byte bVar15;

+  ulonglong uVar16;

+  HANDLE hSemaphore;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_688 [32];

+  EVENT_DESCRIPTOR local_610;

+  undefined8 local_600;

+  undefined8 local_5f8 [2];

+  _EVENT_DATA_DESCRIPTOR local_5e8;

+  undefined *local_5d8;

+  undefined4 local_5d0;

+  undefined4 local_5cc;

+  undefined8 *local_5c8;

+  undefined8 local_5c0;

+  char *local_5b8;

+  undefined8 local_5b0;

+  char *local_5a8;

+  undefined8 local_5a0;

+  short *local_598;

+  int local_590;

+  undefined4 local_58c;

+  undefined8 *local_588;

+  undefined8 local_580;

+  short local_578 [64];

+  undefined1 local_4f8 [160];

+  wchar_t local_458 [264];

+  wchar_t local_248 [264];

+  ulonglong local_38;

+  

+                    /* 0x1c250  120  DnsGetInterfaceSettingsInProc */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_688;

+  memset(local_4f8,0,0xa0);

+  memset(local_248,0,0x20a);

+  _Dst = local_458;

+  memset(_Dst,0,0x20a);

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f9044(_Dst,0x19,0x180110018,param_1);

+  }

+  if (((DAT_2 != 0) && (DAT_18013630c == 0)) &&

+     (iVar6 = FUN_1800ca394(unaff_retaddr), iVar6 == 0)) {

+    local_578[0] = 0;

+    local_578[1] = 0;

+    local_578[2] = 0;

+    local_578[3] = 0;

+    local_578[4] = 0;

+    local_578[5] = 0;

+    local_578[6] = 0;

+    local_578[7] = 0;

+    local_578[8] = 0;

+    local_578[9] = 0;

+    local_578[10] = 0;

+    local_578[0xb] = 0;

+    local_578[0xc] = 0;

+    local_578[0xd] = 0;

+    local_578[0xe] = 0;

+    local_578[0xf] = 0;

+    local_578[0x10] = 0;

+    local_578[0x11] = 0;

+    local_578[0x12] = 0;

+    local_578[0x13] = 0;

+    local_578[0x14] = 0;

+    local_578[0x15] = 0;

+    local_578[0x16] = 0;

+    local_578[0x17] = 0;

+    local_578[0x18] = 0;

+    local_578[0x19] = 0;

+    local_578[0x1a] = 0;

+    local_578[0x1b] = 0;

+    local_578[0x1c] = 0;

+    local_578[0x1d] = 0;

+    local_578[0x1e] = 0;

+    local_578[0x1f] = 0;

+    local_578[0x20] = 0;

+    local_578[0x21] = 0;

+    local_578[0x22] = 0;

+    local_578[0x23] = 0;

+    local_578[0x24] = 0;

+    local_578[0x25] = 0;

+    local_578[0x26] = 0;

+    local_578[0x27] = 0;

+    local_578[0x28] = 0;

+    local_578[0x29] = 0;

+    local_578[0x2a] = 0;

+    local_578[0x2b] = 0;

+    local_578[0x2c] = 0;

+    local_578[0x2d] = 0;

+    local_578[0x2e] = 0;

+    local_578[0x2f] = 0;

+    local_578[0x30] = 0;

+    local_578[0x31] = 0;

+    local_578[0x32] = 0;

+    local_578[0x33] = 0;

+    local_578[0x34] = 0;

+    local_578[0x35] = 0;

+    local_578[0x36] = 0;

+    local_578[0x37] = 0;

+    local_578[0x38] = 0;

+    local_578[0x39] = 0;

+    local_578[0x3a] = 0;

+    local_578[0x3b] = 0;

+    local_578[0x3c] = 0;

+    local_578[0x3d] = 0;

+    local_578[0x3e] = 0;

+    local_578[0x3f] = 0;

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_578,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar3 = false;

+      }

+      else {

+        bVar3 = true;

+      }

+      if (bVar3) {

+        local_5c8 = &local_600;

+        local_600 = 1;

+        local_5c0 = 8;

+        local_5b8 = "DnsGetInterfaceSettingsInProc";

+        local_5b0 = 0x1e;

+        local_5a8 = "FALSE";

+        lVar9 = -1;

+        local_5a0 = 6;

+        do {

+          lVar4 = lVar9 + 1;

+          lVar9 = lVar9 + 1;

+        } while (local_578[lVar4] != 0);

+        local_590 = (int)lVar9 * 2 + 2;

+        local_58c = 0;

+        local_598 = local_578;

+        local_588 = local_5f8;

+        local_610.Level = '\x05';

+        local_610.Opcode = '\0';

+        local_610.Task = 0;

+        local_5e8.Ptr = (ULONGLONG)PTR_DAT_7;

+        local_5f8[0] = 0x1000000;

+        local_580 = 8;

+        local_610.Id = 0;

+        local_610.Version = '\0';

+        local_610.Channel = '\v';

+        local_610.Keyword = 0x400000000000;

+        local_5e8.Size = (ULONG)*(ushort *)PTR_DAT_7;

+        local_5d8 = &DAT_8;

+        local_5e8.Reserved = 2;

+        local_5d0 = 0x52;

+        local_5cc = 1;

+        if (DAT_9 == FUN_18004e7b0) {

+          bVar15 = 0;

+          pbVar10 = &DAT_10;

+          do {

+            bVar1 = *pbVar10;

+            pbVar10 = pbVar10 + 1;

+          } while ((char)bVar1 < '\0');

+          do {

+            bVar1 = *pbVar10;

+            pbVar10 = pbVar10 + 1;

+          } while (bVar1 != 0);

+          uVar13 = 0;

+          if (pbVar10 < &DAT_11) {

+            while( true ) {

+              do {

+                pbVar11 = pbVar10;

+                bVar15 = (byte)uVar13;

+                pbVar10 = pbVar11 + 1;

+              } while (*pbVar11 != 0);

+              bVar1 = pbVar11[1];

+              if (-1 < (char)bVar1) break;

+              pbVar10 = pbVar11 + 3;

+              if (-1 < (char)pbVar11[2]) break;

+              bVar2 = *pbVar10;

+              while ((char)bVar2 < '\0') {

+                if (bVar2 != 0x80) goto LAB_12;

+                pbVar11 = pbVar10 + 1;

+                pbVar10 = pbVar10 + 1;

+                bVar2 = *pbVar11;

+              }

+              if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar2 + 0x8f))) break;

+              bVar15 = bVar15 + 1;

+              *(byte *)((longlong)&local_5c0 + uVar13 * 0x10 + 5) = bVar2;

+              uVar13 = (ulonglong)bVar15;

+              if (&UNK_13 < pbVar10) break;

+            }

+          }

+LAB_12:

+          if (bVar15 != 0) {

+            FUN_1800e3380(0x180135218,(undefined8 *)&local_610,7,(longlong)&local_5e8,bVar15);

+            uVar13 = 0x78;

+            goto LAB_14;

+          }

+          EventWriteTransfer(DAT_15,&local_610,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_5e8);

+        }

+      }

+    }

+    uVar13 = 0x78;

+    goto LAB_14;

+  }

+  if ((param_2 == (int *)0x0) || (*param_2 != 1)) {

+    uVar13 = 0x57;

+    goto LAB_14;

+  }

+  if ((param_1 == (uint *)0x0) ||

+     (iVar6 = FUN_18008bf5c(local_4f8,0x50,L"{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",

+                            (ulonglong)*param_1), iVar6 == -1)) {

+    uVar13 = 8;

+    if ((DAT_1 & 8) != 0) {

+      FUN_1800f7614(0x40b,0x1a,0x180110018);

+    }

+    goto LAB_14;

+  }

+  pvVar14 = (HANDLE)0x0;

+  FUN_180030be0(local_248,0x105,(longlong *)0x0,(ulonglong *)0x0,0,L"\\%s");

+  if ((int)extraout_EAX < 0) {

+    if ((DAT_1 & 8) != 0) {

+      FUN_1800f658c(0x40b,0x1b,0x180110018,extraout_EAX);

+    }

+    uVar13 = FUN_18001aa00(extraout_EAX);

+    uVar13 = uVar13 & 0xffffffff;

+    goto LAB_14;

+  }

+  uVar16 = 0;

+  FUN_180030be0(local_458,0x105,(longlong *)0x0,(ulonglong *)0x0,0,L"\\%s\\%s");

+  pvVar5 = DAT_16;

+  if ((int)extraout_EAX_00 < 0) {

+    if ((DAT_1 & 8) != 0) {

+      FUN_1800f658c(0x40b,0x1c,0x180110018,extraout_EAX_00);

+    }

+    uVar13 = FUN_18001aa00(extraout_EAX_00);

+    uVar13 = uVar13 & 0xffffffff;

+    goto LAB_14;

+  }

+  hSemaphore = pvVar14;

+  if (DAT_17 == 0) {

+LAB_18:

+    do {

+      uVar12 = (int)pvVar14 + 1;

+      if ((DAT_1 & 8) != 0) {

+        uVar16 = (ulonglong)uVar12;

+        FUN_1800f658c(0x40b,0x18,0x180110018,uVar12);

+      }

+      uVar8 = FUN_1800a2084((longlong)local_248,local_458,(longlong)param_2,uVar16);

+      uVar13 = (ulonglong)uVar8;

+    } while ((uVar8 != 0) && (pvVar14 = (HANDLE)(ulonglong)uVar12, uVar12 < 3));

+    if (hSemaphore != (HANDLE)0x0) {

+      ReleaseSemaphore(hSemaphore,1,(LPLONG)0x0);

+    }

+    if (uVar8 == 0) {

+      if ((DAT_1 & 8) != 0) {

+        FUN_1800f7208();

+      }

+      goto LAB_14;

+    }

+  }

+  else {

+    if (DAT_16 == (HANDLE)0x0) {

+      uVar13 = 0x57;

+    }

+    else {

+      DVar7 = WaitForSingleObject(DAT_16,0xffffffff);

+      hSemaphore = pvVar5;

+      if (DVar7 == 0) goto LAB_18;

+      uVar13 = 0x2df;

+    }

+    uVar8 = (uint)uVar13;

+  }

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x1d,0x180110018,uVar8);

+  }

+LAB_14:

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x1f,0x180110018,(int)uVar13);

+  }

+  return uVar13;

 }
```

## `DnsIpv6AddressToString`  (modified)

```diff
--- DnsIpv6AddressToString
+++ DnsGetLastFailedUpdateInfo
@@ -1,72 +1,75 @@
 

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

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

 

-void DnsIpv6AddressToString(undefined8 param_1,undefined8 param_2)

+void DnsGetLastFailedUpdateInfo(undefined8 *param_1)

 

 {

   bool bVar1;

   undefined4 uVar2;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x98120  145  DnsIpv6AddressToString */

+                    /* 0x97e50  121  DnsGetLastFailedUpdateInfo */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    RtlIpv6AddressToStringA(param_2,param_1);

+    *param_1 = 0;

+    param_1[1] = 0;

+    param_1[2] = 0;

+    param_1[3] = 0;

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

         uVar2 = 8;

         local_118 = 1;

-        local_d8 = "DnsIpv6AddressToString";

+        local_d8 = "DnsGetLastFailedUpdateInfo";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x17;

+        local_d0 = 0x1b;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

         local_a0 = uVar2;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

   }

   return;

 }
```

## `FlushDnsPolicyUnreachableStatus`  (modified)

```diff
--- FlushDnsPolicyUnreachableStatus
+++ DnsGetProxyInfoPrivate
@@ -1,78 +1,193 @@
 

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

+/* WARNING: Removing unreachable block (ram,0x00018007dd89) */

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

 

-void FlushDnsPolicyUnreachableStatus(void)

+DWORD DnsGetProxyInfoPrivate(wchar_t *param_1,longlong param_2,longlong param_3,undefined4 *param_4)

 

 {

-  bool bVar1;

-  int iVar2;

+  uint uVar1;

+  bool bVar2;

+  bool bVar3;

+  int iVar4;

+  DWORD DVar5;

+  undefined7 extraout_var;

+  wchar_t *pwVar6;

+  undefined7 extraout_var_00;

+  undefined7 extraout_var_01;

+  undefined7 extraout_var_02;

+  int *piVar7;

+  void *pvVar8;

+  LPVOID pvVar9;

+  uint uVar10;

+  int *piVar11;

+  DWORD unaff_EDI;

+  undefined *puVar12;

+  undefined4 *puVar13;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined1 auStackY_3c8 [32];

+  int *local_398;

+  undefined4 *local_390;

+  SOCKADDR_INET local_388 [2];

+  _EVENT_DATA_DESCRIPTOR local_348 [2];

+  int **local_328;

+  undefined8 local_320;

+  char *local_318;

+  undefined8 local_310;

+  char *local_308;

+  undefined8 local_300;

+  undefined8 local_2f8 [2];

+  undefined4 **local_2e8;

+  undefined8 local_2e0;

+  short local_2d8 [64];

+  wchar_t local_258 [256];

+  ulonglong local_58;

   

-                    /* 0x7e800  303  FlushDnsPolicyUnreachableStatus */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if ((DAT_1 & 8) != 0) {

-    FUN_1800f7614(0x40b,0x2b,0x18010c2f0);

+                    /* 0x7dbd0  128  DnsGetProxyInfoPrivate */

+  local_58 = DAT_0 ^ (ulonglong)auStackY_3c8;

+  local_398 = (int *)0x0;

+  bVar3 = false;

+  puVar13 = param_4;

+  local_390 = param_4;

+  memset(local_388,0,0x40);

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar4 = FUN_1800ca394(unaff_retaddr), iVar4 == 0)) {

+    memset(local_2d8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_2d8,0x40);

+    }

+    if (DAT_3 < 6) {

+      return unaff_EDI;

+    }

+    if (((_DAT_4 & 0x400000000000) == 0) ||

+       (bVar3 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+      bVar3 = false;

+    }

+    if (!bVar3) {

+      return unaff_EDI;

+    }

+    local_328 = &local_398;

+    local_398 = (int *)0x1;

+    local_320 = 8;

+    local_318 = "DnsGetProxyInfoPrivate";

+    local_310 = 0x17;

+    local_308 = "FALSE";

+    local_300 = 6;

+    FUN_180055600(local_2f8,(undefined *)local_2d8);

+    local_2e8 = &local_390;

+    local_390 = (undefined4 *)0x1000000;

+    local_2e0 = 8;

+    FUN_1800e3690(0x180135218,&DAT_6,0,7,local_348);

+    return unaff_EDI;

   }

-  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

-     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

-    AcquireSRWLockExclusive((PSRWLOCK)&DAT_3);

-    FUN_1800ace3c();

-    ReleaseSRWLockExclusive((PSRWLOCK)&DAT_3);

-    return;

+  if (param_2 == 0) {

+    return unaff_EDI;

   }

-  memset(local_98,0,0x80);

-  if (DAT_4 != 0) {

-    FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-  }

-  if (DAT_5 < 6) {

-    return;

-  }

-  if (((_DAT_6 & 0x400000000000) == 0) ||

-     ((DAT_7 & 0x400000000000) != DAT_7)) {

-    bVar1 = false;

+  *(undefined8 *)(param_2 + 8) = 0;

+  *param_4 = 1;

+  uVar1 = DAT_7;

+  LOCK();

+  UNLOCK();

+  uVar10 = DAT_7 & 2;

+  if ((uVar10 == 0) && (pwVar6 = (wchar_t *)0x0, bVar2 = false, DAT_8 == '\0')) {

+LAB_9:

+    piVar11 = local_398;

+    if ((uVar10 == 0) && (DAT_8 == '\0')) {

+      if ((uVar1 & 1) == 0) {

+        *local_390 = 0;

+      }

+    }

+    else if (DAT_10 == 0) {

+      if ((!bVar2) &&

+         (bVar3 = FUN_1800472d0(pwVar6), piVar11 = local_398,

+         (int)CONCAT71(extraout_var_02,bVar3) != 0)) {

+        *(undefined4 *)(param_2 + 4) = 0;

+        goto LAB_11;

+      }

+    }

+    else if ((DAT_12 & 8) != 0) {

+      FUN_1800f7614(0x40b,0x4c,0x18010c2f0);

+      piVar11 = local_398;

+    }

+LAB_13:

+    *(undefined4 *)(param_2 + 4) = 1;

   }

   else {

-    bVar1 = true;

+    puVar12 = (undefined *)0x0;

+    bVar2 = FUN_180018834(&local_388[0].si_family,param_1,0,puVar13,0);

+    if ((int)CONCAT71(extraout_var,bVar2) == 0) {

+LAB_14:

+      DVar5 = FUN_18000d16c(param_1,0,(ulonglong *)&local_398);

+      piVar11 = local_398;

+      if (DVar5 != 0) {

+        pwVar6 = param_1;

+        bVar2 = bVar3;

+        if (DVar5 != 0x10d8) goto LAB_15;

+        goto LAB_9;

+      }

+      if (local_398 != (int *)0x0) {

+        *(undefined8 *)(param_2 + 8) = 0;

+        iVar4 = FUN_180063708((longlong)local_398);

+        *(int *)(param_2 + 4) = iVar4;

+        if (iVar4 == 3) goto LAB_13;

+        if ((*(byte *)(piVar11 + 0x10) & 0xc) != 0) {

+          if ((bVar3) &&

+             (bVar3 = FUN_1800d696c(local_388), (int)CONCAT71(extraout_var_00,bVar3) != 0)) {

+            *(undefined4 *)(param_2 + 4) = 0;

+          }

+          bVar3 = FUN_1800472d0(param_1);

+          if ((int)CONCAT71(extraout_var_01,bVar3) != 0) {

+            *(undefined4 *)(param_2 + 4) = 0;

+            goto LAB_11;

+          }

+        }

+        if ((*(int *)(param_2 + 4) == 2) &&

+           (pvVar8 = (void *)FUN_1800acdec((longlong)piVar11), pvVar8 != (void *)0x0)) {

+          pvVar9 = FUN_180016e10(pvVar8);

+          *(LPVOID *)(param_2 + 8) = pvVar9;

+          if (pvVar9 == (LPVOID)0x0) {

+            DVar5 = GetLastError();

+            goto LAB_16;

+          }

+        }

+      }

+    }

+    else {

+      bVar3 = true;

+      pwVar6 = FUN_1800898e0(local_258,(short *)&local_388[0].si_family,puVar12,(ulonglong)puVar13);

+      if (pwVar6 != (wchar_t *)0x0) {

+        param_1 = local_258;

+        goto LAB_14;

+      }

+      DVar5 = GetLastError();

+      piVar11 = local_398;

+LAB_16:

+      if (DVar5 != 0) goto LAB_15;

+    }

   }

-  if (!bVar1) {

-    return;

+LAB_11:

+  if (param_3 != 0) {

+    *(undefined4 *)(param_3 + 4) = 3;

+    piVar7 = (int *)FUN_18000d044();

+    if (piVar7 != (int *)0x0) {

+      iVar4 = FUN_180063708((longlong)piVar7);

+      *(undefined8 *)(param_3 + 8) = 0;

+      *(int *)(param_3 + 4) = iVar4;

+      if (iVar4 == 2) {

+        pvVar8 = (void *)FUN_1800acdec((longlong)piVar7);

+        pvVar9 = FUN_180016e10(pvVar8);

+        *(LPVOID *)(param_3 + 8) = pvVar9;

+        if (pvVar9 == (LPVOID)0x0) {

+          GetLastError();

+        }

+      }

+      FUN_18000e028(piVar7);

+    }

   }

-  local_dc = 0;

-  local_e8 = &local_118;

-  local_cc = 0;

-  local_bc = 0;

-  local_d8 = "FlushDnsPolicyUnreachableStatus";

-  local_c8 = "FALSE";

-  local_118 = 1;

-  local_e0 = 8;

-  local_d0 = 0x20;

-  local_c0 = 6;

-  FUN_180055600(local_b8,(undefined *)local_98);

-  local_9c = 0;

-  local_a8 = &local_110;

-  local_110 = 0x1000000;

-  local_a0 = 8;

-  FUN_1800e3690(0x180135218,&DAT_8,0,7,local_108);

-  return;

+LAB_15:

+  if (piVar11 != (int *)0x0) {

+    FUN_18000e028(piVar11);

+  }

+  return unaff_EDI;

 }
```

## `DnsStringCopyAllocateEx`  (modified)

```diff
--- DnsStringCopyAllocateEx
+++ DnsGetApplicationIdentifier
@@ -1,74 +1,141 @@
 

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

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

 

-LPVOID DnsStringCopyAllocateEx(longlong param_1,ulonglong param_2,int param_3,int param_4)

+ulonglong DnsGetApplicationIdentifier(ushort **param_1,void *param_2,DWORD *param_3)

 

 {

-  bool bVar1;

-  LPVOID pvVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  longlong *plVar1;

+  bool bVar2;

+  char in_AL;

+  uint uVar3;

+  uint extraout_EAX;

+  uint extraout_EAX_00;

+  uint extraout_EAX_01;

+  ulonglong uVar4;

+  undefined8 uVar5;

+  uint unaff_EBX;

+  ulonglong uVar6;

+  longlong unaff_RBP;

+  int unaff_ESI;

+  ushort **unaff_RDI;

+  undefined8 uVar7;

+  wchar_t *in_R9;

+  int unaff_R12D;

+  longlong unaff_R13;

+  undefined1 *puVar8;

+  uint *unaff_R14;

+  uint *unaff_R15;

+  undefined8 in_stack_00000050;

+  undefined8 in_stack_00000058;

+  longlong in_stack_00000060;

+  int iStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  ushort **ppuStack0000000000000070;

+  ushort *puStack0000000000000078;

   

-                    /* 0x69470  230  DnsStringCopyAllocateEx */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    pvVar2 = FUN_18002ca60(param_1,param_2,2 - (uint)(param_3 != 0),2 - (uint)(param_4 != 0));

+  if (in_AL == '\0') {

+    if ((unaff_EBX & 0x1ff) == 0) {

+      unaff_EBX = unaff_EBX | _DAT_0;

+    }

+    if ((unaff_R12D == 0) && (unaff_R13 != 0)) {

+      unaff_EBX = unaff_EBX | 0x200;

+    }

+  }

+  puStack0000000000000078 = unaff_RDI[1];

+  puVar8 = (undefined1 *)&stack0x00000070;

+  *(undefined2 *)(unaff_RBP + -0x80) = *(undefined2 *)(unaff_RDI + 2);

+  ppuStack0000000000000070 = unaff_RDI;

+  if (unaff_ESI != 0) {

+    ppuStack0000000000000070 = param_1;

+  }

+  *(short *)(unaff_RBP + -0x7e) = (short)param_1;

+  *(undefined4 *)(unaff_RBP + -0x7c) = 0xe;

+  if (*(short *)(unaff_RDI + 2) == 5) {

+    _iStack0000000000000068 = (longlong *)CONCAT44(uStack000000000000006c,1);

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    _iStack0000000000000068 = (longlong *)CONCAT44(uStack000000000000006c,(int)param_1);

+    memset((void *)(unaff_RBP + -0x30),0,0x58);

+    puVar8 = (undefined1 *)(unaff_RBP + -0x30);

+    *(ushort **)(unaff_RBP + -0x28) = unaff_RDI[1];

+    *(ushort ****)(unaff_RBP + -0x30) = &stack0x00000070;

+    *(undefined4 *)(unaff_RBP + -0x20) = 5;

+    *(undefined4 *)(unaff_RBP + -0x1c) = 0xd;

+  }

+  if (unaff_R12D == 0) {

+    uVar5 = 0;

+    uVar7 = 0xe8;

+    memset((void *)(unaff_RBP + 0x30),0,0xe8);

+    *(undefined8 *)(unaff_RBP + 0x68) = in_stack_00000058;

+    *(undefined8 *)(unaff_RBP + 0x48) = in_stack_00000050;

+    *(undefined1 **)(unaff_RBP + 0x30) = puVar8;

+    *(uint *)(unaff_RBP + 0x38) = unaff_EBX;

+    *(uint **)(unaff_RBP + 0x60) = unaff_R14;

+    FUN_18007c6a0((wchar_t *)(unaff_RBP + 0x30),uVar5,uVar7,in_R9);

+    uVar3 = extraout_EAX;

+  }

+  else {

+    uVar3 = FUN_180094520();

+  }

+  uVar6 = (ulonglong)uVar3;

+  if (((iStack0000000000000068 != 0) && (unaff_ESI == 0)) && (uVar3 == 0)) {

+    _iStack0000000000000068 = (longlong *)0x0;

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

+      unaff_R15 = FUN_18002fe64(unaff_R14);

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

+    if (DAT_1 == 0) {

+      FUN_180092c9c((_CERT_EXTENSION *)unaff_RDI[1],5,(LPSTR)0x8,(longlong)unaff_R15,

+                    (undefined8 *)&stack0x00000068);

+      uVar3 = extraout_EAX_00;

+    }

+    else {

+      uVar3 = FUN_1800a5270((longlong)unaff_RDI[1],5,8,unaff_R15,(undefined8 *)&stack0x00000068);

+    }

+    uVar6 = (ulonglong)uVar3;

+    bVar2 = false;

+    if (uVar3 == 0) {

+      uVar4 = FUN_1800cd4d8((longlong)unaff_RDI,(longlong)_iStack0000000000000068);

+      bVar2 = false;

+      if ((int)uVar4 != 0) {

+        bVar2 = true;

+      }

+    }

+    FUN_18002a140(_iStack0000000000000068);

+    _iStack0000000000000068 = (longlong *)0x0;

+    if (!bVar2) {

+      if (DAT_1 == 0) {

+        FUN_180092c9c((_CERT_EXTENSION *)unaff_RDI[1],0xff,(LPSTR)0x8,(longlong)unaff_R15,

+                      (undefined8 *)&stack0x00000068);

+        uVar3 = extraout_EAX_01;

       }

       else {

-        bVar1 = true;

+        uVar3 = FUN_1800a5270((longlong)unaff_RDI[1],0xff,8,unaff_R15,(undefined8 *)&stack0x00000068

+                             );

       }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsStringCopyAllocateEx";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x18;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      if (uVar3 == 0) {

+        uVar6 = 0;

+        for (plVar1 = _iStack0000000000000068; plVar1 != (longlong *)0x0;

+            plVar1 = (longlong *)*plVar1) {

+          if ((*(short *)(in_stack_00000060 + 0x10) != (short)plVar1[2]) &&

+             (uVar5 = FUN_180017670((PCNZWCH)unaff_RDI[1],(PCNZWCH)plVar1[1]), (int)uVar5 != 0)) {

+            uVar6 = 0x232f;

+            break;

+          }

+        }

       }

+      else {

+        uVar6 = 0;

+      }

+      FUN_18002a140(_iStack0000000000000068);

+      _iStack0000000000000068 = (longlong *)0x0;

     }

-    pvVar2 = (LPVOID)0x0;

   }

-  return pvVar2;

+  FUN_18002a140((longlong *)unaff_RDI);

+  DnsApiFree(unaff_R15);

+  if ((DAT_2 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x16,0x180110d78,(int)uVar6);

+  }

+  return uVar6;

 }
```

## `DnsGetZtClientCertConfig`  (modified)

```diff
--- DnsGetZtClientCertConfig
+++ DnsFreeZtTrustedCa
@@ -1,81 +1,48 @@
 

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

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

 

-ulonglong DnsGetZtClientCertConfig(int param_1,int param_2,uint param_3,undefined8 *param_4)

+undefined8 DnsFreeZtTrustedCa(void *param_1)

 

 {

   bool bVar1;

-  uint *puVar2;

-  undefined4 in_register_0000000c;

-  undefined4 in_register_00000014;

-  undefined4 in_register_00000084;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 uStack_118;

-  undefined8 uStack_110;

-  _EVENT_DATA_DESCRIPTOR a_Stack_108 [2];

-  undefined8 *puStack_e8;

-  undefined4 uStack_e0;

-  undefined4 uStack_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 uStack_cc;

-  char *local_c8;

-  undefined4 uStack_c0;

-  undefined4 uStack_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 uStack_9c;

-  short local_98 [64];

-  ulonglong uStack_18;

+  ulonglong in_RDX;

+  longlong unaff_RBP;

+  undefined4 uVar2;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-                    /* 0x97b50  117  DnsGetDnsServerList */

-  uStack_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    puVar2 = FUN_180050a3c((PCNZWCH)0x0,CONCAT44(in_register_00000014,param_2),

-                           (undefined *)CONCAT44(in_register_00000084,param_3));

-    *(uint **)CONCAT44(in_register_0000000c,param_1) = puVar2;

-    if (puVar2 != (uint *)0x0) {

-      return (ulonglong)*puVar2;

-    }

+  if (((_DAT_0 & (uint)in_RDX) == 0) || ((DAT_180135230 & in_RDX) != DAT_180135230)) {

+    bVar1 = false;

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        uStack_dc = 0;

-        puStack_e8 = &uStack_118;

-        uStack_cc = 0;

-        uStack_bc = 0;

-        uVar3 = 8;

-        uStack_118 = 1;

-        local_d8 = "DnsGetDnsServerList";

-        local_c8 = "FALSE";

-        uStack_e0 = 8;

-        local_d0 = 0x14;

-        uStack_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        uStack_9c = 0;

-        local_a8 = &uStack_110;

-        uStack_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,a_Stack_108);

-      }

-    }

+    bVar1 = true;

+  }

+  if (bVar1) {

+    uStack000000000000006c = 0;

+    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+    uStack000000000000007c = 0;

+    *(undefined4 *)(unaff_RBP + -0x74) = 0;

+    uVar2 = 8;

+    uStack0000000000000030 = 1;

+    pcStack0000000000000070 = "DnsDowncaseDnsNameLabel";

+    *(char **)(unaff_RBP + -0x80) = "FALSE";

+    uStack0000000000000068 = 8;

+    uStack0000000000000078 = 0x18;

+    *(undefined4 *)(unaff_RBP + -0x78) = 6;

+    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+    *(undefined4 *)(unaff_RBP + -0x54) = 0;

+    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+    *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

+    uStack0000000000000038 = 0x1000000;

+    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

   }

   return 0;

 }
```

## `DnsGetZtTrustedServers`  (modified)

```diff
--- DnsGetZtTrustedServers
+++ DnsGetZtTrustedServers
@@ -1,42 +1,103 @@
 

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

+/* WARNING: Removing unreachable block (ram,0x00018009f50c) */

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

 

 ulonglong DnsGetZtTrustedServers

                     (int param_1,longlong param_2,uint param_3,undefined4 *param_4,

                     undefined8 *param_5)

 

 {

-  uint in_EAX;

-  longlong unaff_RBP;

-  undefined4 uVar1;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  bool bVar1;

+  ulonglong uVar2;

+  CLIENT_CALL_RETURN CVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_1b8 [32];

+  longlong local_150 [3];

+  uint local_138 [4];

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  uint *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  undefined8 local_d8 [2];

+  longlong *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  if ((in_EAX & (uint)param_2) == DAT_0) {

-    uStack000000000000006c = 0;

-    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-    uStack000000000000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    uVar1 = 8;

-    uStack0000000000000030 = 1;

-    pcStack0000000000000070 = "DnsMapRcodeToStatus";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    uStack0000000000000068 = 8;

-    uStack0000000000000078 = 0x14;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

-    uStack0000000000000038 = 0x1000000;

-    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+                    /* 0x9f2e0  141  DnsGetZtTrustedServers */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_1b8;

+  local_138[0] = param_3;

+  local_150[0] = 0;

+  local_150[1] = 0;

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

+    *param_4 = 0;

   }

-  return 0x78;

+  if (param_5 != (undefined8 *)0x0) {

+    *param_5 = 0;

+  }

+  if ((param_4 != (undefined4 *)0x0) && (param_5 != (undefined8 *)0x0)) {

+    if (DAT_1 != 0) {

+      memset(local_b8,0,0x80);

+      if (DAT_2 != 0) {

+        FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+      }

+      if (5 < DAT_3) {

+        if (((_DAT_4 & 0x400000000000) == 0) ||

+           ((DAT_5 & 0x400000000000) != DAT_5)) {

+          bVar1 = false;

+        }

+        else {

+          bVar1 = true;

+        }

+        if (bVar1) {

+          local_138[0] = 1;

+          local_138[1] = 0;

+          local_108 = local_138;

+          local_100 = 8;

+          local_fc = 0;

+          local_f8 = "DnsGetZtTrustedServers";

+          local_f0 = 0x17;

+          local_ec = 0;

+          local_e8 = "FALSE";

+          local_e0 = 6;

+          local_dc = 0;

+          FUN_180055600(local_d8,(undefined *)local_b8);

+          local_150[2] = 0x1000000;

+          local_c8 = local_150 + 2;

+          local_c0 = 8;

+          local_bc = 0;

+          FUN_1800e3690(0x180135218,&DAT_6,0,7,local_128);

+        }

+      }

+      return 0x78;

+    }

+    if (((param_1 == 1) && (param_2 == 0)) && (param_3 < 2)) {

+      uVar2 = FUN_18002ddc4(local_150);

+      CVar3.Simple = uVar2 & 0xffffffff;

+      if ((int)uVar2 == 0) {

+        local_150[2] = local_150[2] & 0xffffffff00000000;

+        CVar3 = NdrClientCall3((MIDL_STUBLESS_PROXY_INFO *)&PTR_PTR_1800ff490,0x24,(void *)0x0);

+        if (((int)CVar3.Simple != 0) && ((DAT_7 & 8) != 0)) {

+          FUN_1800f658c(0x40b,0x12,0x180111be8,(int)CVar3.Simple);

+        }

+      }

+      else if ((DAT_7 & 8) != 0) {

+        FUN_1800f658c(0x40b,0x11,0x180111be8,(int)uVar2);

+      }

+      goto LAB_8;

+    }

+  }

+  CVar3.Simple = 0x57;

+LAB_8:

+  FUN_18002dd44(local_150);

+  return CVar3.Simple & 0xffffffff;

 }
```

## `DnsIsStringCountValidForTextType`  (modified)

```diff
--- DnsIsStringCountValidForTextType
+++ DnsIpv6StringToAddress
@@ -1,73 +1,92 @@
 

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

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

 

-bool DnsIsStringCountValidForTextType(short param_1,short param_2)

+ulonglong DnsIpv6StringToAddress(_CERT_EXTENSION *param_1,LPCWSTR param_2,uint param_3)

 

 {

-  bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  longlong *plVar1;

+  DWORD DVar2;

+  uint uVar3;

+  BYTE *in_RAX;

+  longlong *plVar4;

+  longlong *plVar5;

+  undefined8 uVar6;

+  longlong unaff_RBP;

+  longlong *plVar7;

+  longlong unaff_RDI;

+  undefined4 in_register_00000084;

+  _CERT_EXTENSION *in_R9;

+  longlong unaff_R13;

+  short unaff_R15W;

+  _CERT_EXTENSION *in_stack_00000068;

   

-                    /* 0x98820  151  DnsIsStringCountValidForTextType */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    bVar1 = Dns_IsStringCountValidForTextType(param_1,param_2);

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

+  uVar3 = (uint)unaff_R13;

+  DVar2 = FUN_18002e8a0(param_1,(ushort)unaff_RDI,

+                        (PCERT_EXTENSION)CONCAT44(in_register_00000084,param_3),in_R9,uVar3,uVar3,

+                        (FILETIME *)&stack0x00000070,unaff_R13,(int *)unaff_R13,uVar3,

+                        (undefined *)unaff_R13,(short)unaff_R13,in_RAX,in_stack_00000068);

+  plVar7 = (longlong *)(unaff_RDI + 0x20);

+  *(undefined4 *)(unaff_RDI + 0x14) = *(undefined4 *)(unaff_RBP + -0x38);

+  plVar1 = (longlong *)(unaff_RDI + 0x30);

+  plVar5 = *(longlong **)(unaff_RBP + -0x30);

+  *(DWORD *)(unaff_RDI + 0x18) = DVar2;

+  uVar6 = *(undefined8 *)(unaff_RBP + -0x28);

+  *plVar7 = unaff_R13;

+  *(longlong *)(unaff_RDI + 0x28) = unaff_R13;

+  *plVar1 = unaff_R13;

+  *(longlong *)(unaff_RDI + 0x38) = unaff_R13;

+  *(undefined8 *)(unaff_RDI + 0x60) = uVar6;

+  if (plVar5 != (longlong *)0x0) {

+    *(longlong *)(unaff_RBP + -0x78) = unaff_RBP + -0x80;

+    *(longlong *)(unaff_RBP + -0x68) = unaff_RBP + -0x70;

+    *(longlong *)(unaff_RBP + -0x48) = unaff_RBP + -0x50;

+    *(longlong *)(unaff_RBP + -0x58) = unaff_RBP + -0x60;

+    do {

+      plVar4 = (longlong *)*plVar5;

+      uVar3 = *(uint *)((longlong)plVar5 + 0x14) & 3;

+      *plVar5 = unaff_R13;

+      if (uVar3 < 2) {

+        if (((short)plVar5[2] == 5) && (unaff_R15W != 5)) {

+          **(undefined8 **)(unaff_RBP + -0x68) = plVar5;

+          *(longlong **)(unaff_RBP + -0x68) = plVar5;

+        }

+        else {

+          **(undefined8 **)(unaff_RBP + -0x78) = plVar5;

+          *(longlong **)(unaff_RBP + -0x78) = plVar5;

+        }

+      }

+      else if (uVar3 == 3) {

+        **(undefined8 **)(unaff_RBP + -0x48) = plVar5;

+        *(longlong **)(unaff_RBP + -0x48) = plVar5;

       }

       else {

-        bVar1 = true;

+        **(undefined8 **)(unaff_RBP + -0x58) = plVar5;

+        *(longlong **)(unaff_RBP + -0x58) = plVar5;

       }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "DnsIsStringCountValidForTextType";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x21;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

+      plVar5 = plVar4;

+    } while (plVar4 != (longlong *)0x0);

+    *plVar7 = *(longlong *)(unaff_RBP + -0x80);

+    *(undefined8 *)(unaff_RDI + 0x28) = *(undefined8 *)(unaff_RBP + -0x70);

+    *(undefined8 *)(unaff_RDI + 0x38) = *(undefined8 *)(unaff_RBP + -0x60);

+    *plVar1 = *(longlong *)(unaff_RBP + -0x50);

+    if (*(int *)(unaff_RDI + 0x1c) == 1) goto LAB_0;

+    uVar6 = 0;

+    for (; plVar7 <= plVar1; plVar7 = plVar7 + 1) {

+      plVar5 = (longlong *)*plVar7;

+      plVar4 = FUN_18002fb20(plVar5,uVar6,1,*(int *)(unaff_RDI + 0x1c));

+      *plVar7 = (longlong)plVar4;

+      FUN_18002a140(plVar5);

     }

-    bVar1 = false;

   }

-  return bVar1;

+  if (*(int *)(unaff_RDI + 0x1c) != 1) {

+    DnsApiFree(*(LPVOID *)(unaff_RDI + 8));

+    *(undefined8 *)(unaff_RDI + 8) = *(undefined8 *)(unaff_RDI + 0x68);

+    *(longlong *)(unaff_RDI + 0x68) = unaff_R13;

+  }

+LAB_0:

+  if (*(HANDLE *)(unaff_RDI + 0x40) != (HANDLE)0x0) {

+    SetEvent(*(HANDLE *)(unaff_RDI + 0x40));

+  }

+  return (ulonglong)DVar2;

 }
```

## `DnsIsStatusRcode`  (modified)

```diff
--- DnsIsStatusRcode
+++ DnsIpv6AddressToString
@@ -1,77 +1,10 @@
 

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

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

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

 

-ulonglong DnsIsStatusRcode(int param_1)

+void DnsIpv6AddressToString(undefined8 param_1,undefined8 param_2)

 

 {

-  uint uVar1;

-  void *pvVar2;

-  ulonglong uVar3;

-  undefined4 extraout_var;

-  undefined4 uVar4;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

-  

-                    /* 0x986c0  150  DnsIsStatusRcode */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar1 = FUN_18005c1f0(param_1);

-    uVar3 = CONCAT44(extraout_var,uVar1);

-  }

-  else {

-    pvVar2 = memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      pvVar2 = (void *)FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         (pvVar2 = (void *)((ulonglong)DAT_5 & 0x400000000000), pvVar2 != DAT_5)) {

-        pvVar2 = (void *)((ulonglong)pvVar2 & 0xffffffffffffff00);

-      }

-      else {

-        pvVar2 = (void *)CONCAT71((int7)((ulonglong)pvVar2 >> 8),1);

-      }

-      if ((char)pvVar2 != '\0') {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar4 = 8;

-        local_118 = 1;

-        local_d8 = "DnsIsStatusRcode";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x11;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar4;

-        pvVar2 = (void *)FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar3 = (ulonglong)pvVar2 & 0xffffffffffffff00;

-  }

-  return uVar3;

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

+  halt_baddata();

 }
```

## `DnsLogEvent`  (modified)

```diff
--- DnsLogEvent
+++ DnsLogEvent
@@ -1,38 +1,113 @@
 

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

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

 

-undefined8 DnsLogEvent(undefined8 param_1,uint param_2,longlong *param_3,undefined4 param_4)

+void DnsLogEvent(undefined8 param_1,uint param_2,longlong *param_3,undefined4 param_4)

 

 {

-  char cVar1;

-  int in_EAX;

-  uint uVar2;

-  longlong unaff_RBP;

-  char unaff_DIL;

-  undefined8 uStack0000000000000048;

-  undefined8 uStack0000000000000050;

+  bool bVar1;

+  char cVar2;

+  int iVar3;

+  longlong lVar4;

+  int *piVar5;

+  ushort uVar6;

+  uint uVar7;

+  ulonglong uVar8;

+  LPCSTR unaff_retaddr;

+  undefined4 local_res20 [2];

+  undefined1 auStackY_2a8 [32];

+  undefined8 local_278;

+  undefined8 local_270;

+  _EVENT_DATA_DESCRIPTOR local_268 [2];

+  undefined8 *local_248;

+  undefined8 local_240;

+  char *local_238;

+  undefined8 local_230;

+  char *local_228;

+  undefined8 local_220;

+  undefined8 local_218 [2];

+  undefined8 *local_208;

+  undefined8 local_200;

+  longlong local_1f8;

+  int local_1f0 [78];

+  short local_b8 [64];

+  ulonglong local_38;

   

-  uVar2 = in_EAX + 0xc2860f;

-  *(char *)(ulonglong)uVar2 = *(char *)(ulonglong)uVar2 + (char)uVar2;

-  if (((_DAT_0 & 0x400000000000) == 0) ||

-     (cVar1 = '\x01', (DAT_1 & 0x400000000000) != DAT_1)) {

-    cVar1 = unaff_DIL;

+                    /* 0x75720  152  DnsLogEvent */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_2a8;

+  uVar8 = (ulonglong)param_2;

+  local_res20[0] = param_4;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar3 = FUN_1800ca394(unaff_retaddr), iVar3 == 0)) {

+    memset(local_b8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (DAT_3 < 6) {

+      return;

+    }

+    if (((_DAT_4 & 0x400000000000) == 0) ||

+       (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+      bVar1 = false;

+    }

+    if (!bVar1) {

+      return;

+    }

+    local_248 = &local_278;

+    local_278 = 1;

+    local_240 = 8;

+    local_238 = "DnsLogEvent";

+    local_230 = 0xc;

+    local_228 = "FALSE";

+    local_220 = 6;

+    FUN_180055600(local_218,(undefined *)local_b8);

+    local_208 = &local_270;

+    local_270 = 0x1000000;

+    local_200 = 8;

+    FUN_1800e3690(0x180135218,&DAT_6,0,7,local_268);

+    return;

   }

-  if (cVar1 != '\0') {

-    uStack0000000000000050 = 1;

-    *(undefined8 **)(unaff_RBP + -0x80) = &stack0x00000050;

-    *(char **)(unaff_RBP + -0x70) = "Query_Main";

-    *(char **)(unaff_RBP + -0x60) = "FALSE";

-    *(undefined8 *)(unaff_RBP + -0x78) = 8;

-    *(undefined8 *)(unaff_RBP + -0x68) = 0xb;

-    *(undefined8 *)(unaff_RBP + -0x58) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x50),(undefined *)(unaff_RBP + -0x30));

-    uStack0000000000000048 = 0x1000000;

-    *(undefined8 **)(unaff_RBP + -0x40) = &stack0x00000048;

-    *(undefined8 *)(unaff_RBP + -0x38) = 8;

-    FUN_1800e3690(0x180135218,&DAT_2,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

+  if (param_2 < 0x14) {

+    cVar2 = EtwEventEnabled(DAT_7,param_1);

+    if (cVar2 == '\0') {

+      return;

+    }

+    uVar7 = 0;

+    if (param_2 != 0) {

+      piVar5 = local_1f0 + 1;

+      do {

+        lVar4 = -1;

+        do {

+          lVar4 = lVar4 + 1;

+        } while (*(short *)(*param_3 + lVar4 * 2) != 0);

+        *(longlong *)(piVar5 + -3) = *param_3;

+        piVar5[-1] = (int)lVar4 * 2 + 2;

+        param_3 = param_3 + 1;

+        *piVar5 = 0;

+        piVar5 = piVar5 + 4;

+        uVar8 = uVar8 - 1;

+        uVar7 = param_2;

+      } while (uVar8 != 0);

+    }

+    (&local_1f8)[(ulonglong)uVar7 * 2] = (longlong)local_res20;

+    (local_1f0 + (ulonglong)uVar7 * 4)[0] = 4;

+    (local_1f0 + (ulonglong)uVar7 * 4)[1] = 0;

+    param_2 = EtwEventWrite(DAT_7,param_1,param_2 + 1,&local_1f8);

+    if (param_2 == 0) {

+      return;

+    }

+    if ((DAT_8 & 8) == 0) {

+      return;

+    }

+    uVar6 = 0x29;

   }

-  return 0x78;

+  else {

+    if ((DAT_8 & 8) == 0) {

+      return;

+    }

+    uVar6 = 0x28;

+  }

+  FUN_1800f658c(0x40b,uVar6,0x18010fdd0,param_2);

+  return;

 }
```

## `DnsMapRcodeToStatus`  (modified)

```diff
--- DnsMapRcodeToStatus
+++ DnsMapRcodeToStatus
@@ -1,20 +1,74 @@
 

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

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

 

 uint DnsMapRcodeToStatus(byte param_1)

 

 {

-  uint uVar1;

-  PEVENT_DATA_DESCRIPTOR in_RAX;

-  byte *in_RDX;

-  LPCWSTR unaff_RBX;

-  byte in_R9B;

-  undefined8 uStack0000000000000038;

+  bool bVar1;

+  uint uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *(char *)&in_RAX->Ptr = (char)in_RAX->Ptr + (char)in_RAX;

-  uStack0000000000000038 = 0x1000000;

-  FUN_1800e3690(0x180135218,in_RDX,0,in_R9B,in_RAX);

-  uVar1 = FUN_18005e520(unaff_RBX,2);

-  return uVar1;

+                    /* 0x98980  153  DnsMapRcodeToStatus */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800416e0((uint)param_1);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsMapRcodeToStatus";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x14;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    uVar2 = 0x78;

+  }

+  return uVar2;

 }
```

## `DnsMapRcodeToStatus`  (modified)

```diff
--- DnsMapRcodeToStatus
+++ DnsIsStatusRcode
@@ -1,74 +1,77 @@
 

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

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

 

-uint DnsMapRcodeToStatus(byte param_1)

+ulonglong DnsIsStatusRcode(int param_1)

 

 {

-  bool bVar1;

-  uint uVar2;

-  undefined4 uVar3;

+  uint uVar1;

+  void *pvVar2;

+  ulonglong uVar3;

+  undefined4 extraout_var;

+  undefined4 uVar4;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x98980  153  DnsMapRcodeToStatus */

+                    /* 0x986c0  150  DnsIsStatusRcode */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    uVar2 = FUN_1800416e0((uint)param_1);

+    uVar1 = FUN_18005c1f0(param_1);

+    uVar3 = CONCAT44(extraout_var,uVar1);

   }

   else {

-    memset(local_98,0,0x80);

+    pvVar2 = memset(local_98,0,0x80);

     if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+      pvVar2 = (void *)FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

+         (pvVar2 = (void *)((ulonglong)DAT_5 & 0x400000000000), pvVar2 != DAT_5)) {

+        pvVar2 = (void *)((ulonglong)pvVar2 & 0xffffffffffffff00);

       }

       else {

-        bVar1 = true;

+        pvVar2 = (void *)CONCAT71((int7)((ulonglong)pvVar2 >> 8),1);

       }

-      if (bVar1) {

+      if ((char)pvVar2 != '\0') {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        uVar3 = 8;

+        uVar4 = 8;

         local_118 = 1;

-        local_d8 = "DnsMapRcodeToStatus";

+        local_d8 = "DnsIsStatusRcode";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x14;

+        local_d0 = 0x11;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+        local_a0 = uVar4;

+        pvVar2 = (void *)FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0x78;

+    uVar3 = (ulonglong)pvVar2 & 0xffffffffffffff00;

   }

-  return uVar2;

+  return uVar3;

 }
```

## `DnsQueryExA`  (modified)

```diff
--- DnsQueryExA
+++ DnsNameCopyAllocate
@@ -1,79 +1,74 @@
 

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

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

 

-DWORD DnsQueryExA(LPVOID param_1,undefined8 param_2,undefined8 param_3)

+LPVOID DnsNameCopyAllocate(longlong param_1,ulonglong param_2,int param_3,undefined4 param_4)

 

 {

   bool bVar1;

-  DWORD DVar2;

+  LPVOID pvVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

-  undefined8 in_stack_fffffffffffffed8;

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x98db0  175  DnsQueryExA */

+                    /* 0x98af0  164  DnsNameCopyAllocate */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    if ((DAT_2 & 8) != 0) {

-      FUN_1800e7548(param_1,0x12,param_3,(uint)*(ushort *)((longlong)param_1 + 0x10),

-                    CONCAT44((int)((ulonglong)in_stack_fffffffffffffed8 >> 0x20),

-                             *(undefined4 *)((longlong)param_1 + 0x14)),

-                    *(undefined8 *)((longlong)param_1 + 0x40));

-    }

-    DVar2 = FUN_180091ba4(param_1,3);

+    pvVar2 = FUN_18002ca60(param_1,param_2,param_3,param_4);

   }

   else {

     memset(local_98,0,0x80);

-    if (DAT_3 != 0) {

+    if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         ((DAT_6 & 0x400000000000) != DAT_6)) {

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        local_d8 = "DnsQueryExA";

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsNameCopyAllocate";

         local_c8 = "FALSE";

-        local_118 = 1;

         local_e0 = 8;

-        local_d0 = 0xc;

+        local_d0 = 0x14;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    DVar2 = 0x78;

+    pvVar2 = (LPVOID)0x0;

   }

-  return DVar2;

+  return pvVar2;

 }
```

## `DnsNotifyProxyConfigChangePrivate`  (modified)

```diff
--- DnsNotifyProxyConfigChangePrivate
+++ DelaySortDAServerlist
@@ -1,18 +1,181 @@
 

+/* WARNING: Instruction at (ram,0x000180079cd3) overlaps instruction at (ram,0x000180079cd2)

+    */

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

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

 

-void DnsNotifyProxyConfigChangePrivate(void)

+ulonglong DelaySortDAServerlist(void)

 

 {

-  SOCKET in_RCX;

+  uint *puVar1;

+  longlong lVar2;

+  bool bVar3;

+  longlong lVar4;

+  byte bVar5;

+  uint uVar6;

+  char *pcVar7;

+  char *in_RAX;

+  short *psVar8;

+  longlong in_RCX;

+  longlong in_RDX;

+  longlong unaff_RBX;

+  longlong unaff_RBP;

+  uint unaff_ESI;

+  uint unaff_EDI;

+  longlong lVar9;

+  uint in_R8D;

+  longlong in_R9;

+  ulonglong in_R10;

+  uint uVar10;

+  uint unaff_R12D;

+  int unaff_R13D;

+  uint unaff_R14D;

+  uint unaff_R15D;

+  int in_stack_00000040;

+  int in_stack_00000044;

+  uint in_stack_00000048;

+  uint uStack000000000000004c;

+  uint in_stack_00000050;

+  int *in_stack_00000058;

+  longlong in_stack_00000060;

+  uint uStack0000000000000068;

   

-  closesocket(in_RCX);

-  if ((DAT_0 == 0) || (DAT_18013630c == 0)) {

-    FUN_18001aa80();

+  bVar5 = (byte)in_RAX;

+  *in_RAX = *in_RAX + bVar5;

+  pcVar7 = (char *)(in_RCX + -0x7d);

+  *pcVar7 = *pcVar7 + bVar5;

+  if (in_RCX != 1 && *pcVar7 != '\0') {

+    pcVar7 = (char *)CONCAT62((int6)((ulonglong)in_RAX >> 0x10),(ushort)bVar5);

+    *pcVar7 = *pcVar7 + bVar5;

+    goto code_r0x000180079cc3;

   }

-  if ((DAT_1 & 8) != 0) {

-    FUN_1800f7614(0x40b,0x24,0x180110260);

+  do {

+    *(uint *)(in_RDX + 0xb4 + unaff_RBX) = in_R8D;

+    if ((in_R9 != 0) && (uVar10 = unaff_EDI, unaff_EDI < *(uint *)(in_R9 + 4))) {

+      do {

+        if (((unaff_R15D & in_R8D) == 0) ||

+           ((*(uint *)((ulonglong)uVar10 * 0x40 + 0x48 + in_R9) & unaff_R15D) == 0)) {

+          puVar1 = (uint *)((ulonglong)uVar10 * 0x40 + 0x48 + in_R9);

+          *puVar1 = *puVar1 & 0xfff0ffff;

+          in_R8D = *(uint *)(in_RDX + 0xb4 + unaff_RBX);

+        }

+        uVar10 = uVar10 + 1;

+      } while (uVar10 < *(uint *)(in_R9 + 4));

+    }

+    do {

+      uVar10 = (int)in_R10 + 1;

+      in_R10 = (ulonglong)uVar10;

+      if (*(uint *)(unaff_RBX + 0x44) <= uVar10) {

+        uStack000000000000004c = unaff_EDI;

+        if (*(uint *)(unaff_RBX + 0x44) == 0) goto LAB_0;

+        goto LAB_1;

+      }

+      in_RDX = in_R10 * 0xa0;

+    } while ((*(uint *)(in_RDX + 0xac + unaff_RBX) & 0x10000000) != 0);

+code_r0x000180079cc3:

+    in_R9 = *(longlong *)(in_RDX + 0x90 + unaff_RBX);

+    in_R8D = *(uint *)(in_RDX + 0xb4 + unaff_RBX) & 0xfffffff0;

+  } while( true );

+LAB_1:

+  do {

+    lVar4 = in_stack_00000060;

+    lVar9 = (ulonglong)uStack000000000000004c * 0xa0 + 0x68 + unaff_RBX;

+    lVar2 = *(longlong *)(lVar9 + 0x28);

+    if ((((lVar2 != 0) && ((*(uint *)(lVar9 + 0x4c) & 0x10001000) == 0)) &&

+        ((*(uint *)(lVar9 + 0x44) & 0x10000000) == 0)) &&

+       ((*(char *)(in_stack_00000060 + 0x28b) == '\0' ||

+        ((*(int *)(lVar9 + 0x3c) != 0x17 && (1 < *(int *)(lVar9 + 0x3c) - 0xf3U)))))) {

+      if ((*(uint *)(lVar9 + 0x44) & 0x6000000) == 0) {

+LAB_2:

+        if (unaff_R12D < unaff_R14D) {

+          do {

+            psVar8 = FUN_18004a56c(lVar9,in_stack_00000044);

+            if (psVar8 == (short *)0x0) goto LAB_3;

+            unaff_ESI = FUN_180047404(in_stack_00000060,unaff_RBX,lVar9,psVar8);

+          } while (unaff_ESI != 0);

+          unaff_R13D = unaff_R13D + 1;

+          unaff_EDI = 0;

+          if ((unaff_R12D == 0) && (*(char *)(in_stack_00000060 + 0x28b) == '\0'))

+          goto LAB_0;

+        }

+        else {

+          uVar10 = 0;

+          unaff_R14D = in_stack_00000048;

+          if (*(int *)(lVar2 + 4) != 0) {

+            do {

+              if ((in_stack_00000044 == 0) &&

+                 (uVar6 = FUN_180056f88(uVar10,*(longlong *)(lVar9 + 0x98),*(uint *)(lVar9 + 0x90)),

+                 uVar6 != 0)) {

+                if ((DAT_4 & 8) != 0) {

+                  FUN_1800e551c(0x40b,0x3e,0x18010da00,

+                                (short *)((ulonglong)uVar10 * 0x40 + 0x20 + lVar2));

+                }

+              }

+              else if (((*(uint *)((ulonglong)uVar10 * 0x40 + 0x48 + lVar2) & 0x20000) == 0) &&

+                      (unaff_ESI = FUN_180047404(lVar4,unaff_RBX,lVar9,

+                                                 (short *)((ulonglong)uVar10 * 0x40 + 0x20 + lVar2))

+                      , unaff_ESI == 0)) {

+                unaff_R13D = unaff_R13D + 1;

+              }

+              uVar10 = uVar10 + 1;

+              unaff_R12D = in_stack_00000050;

+            } while (uVar10 < *(uint *)(lVar2 + 4));

+          }

+        }

+      }

+      else if ((*(uint *)(unaff_RBX + 0x3c) & 0x100) == 0) {

+        if ((unaff_R12D != 0) || ((*(uint *)(lVar9 + 0x4c) & 0x20000) != 0)) goto LAB_2;

+        in_stack_00000040 = 1;

+      }

+    }

+LAB_3:

+    uStack000000000000004c = uStack000000000000004c + 1;

+  } while (uStack000000000000004c < *(uint *)(unaff_RBX + 0x44));

+  if ((in_stack_00000040 == 0) || (unaff_R13D != 0)) {

+    unaff_EDI = 0;

+    if (unaff_ESI == 0x2522) {

+      memset((void *)(unaff_RBP + -0x20),0,0x80);

+      if (DAT_5 != 0) {

+        FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0xa8),0,(short *)(unaff_RBP + -0x20),0x40);

+      }

+      if (5 < DAT_6) {

+        if (((_DAT_7 & 0x400000000000) == 0) ||

+           (bVar3 = true, (DAT_8 & 0x400000000000) != DAT_8)) {

+          bVar3 = false;

+        }

+        unaff_EDI = 0;

+        if (bVar3) {

+          in_stack_00000060 = 1;

+          *(longlong **)(unaff_RBP + -0x70) = &stack0x00000060;

+          *(undefined8 *)(unaff_RBP + -0x68) = 8;

+          *(char **)(unaff_RBP + -0x60) = "sendUdpToNextDnsServers";

+          *(undefined8 *)(unaff_RBP + -0x58) = 0x18;

+          *(char **)(unaff_RBP + -0x50) = "status != DNS_REQUEST_PENDING";

+          *(undefined8 *)(unaff_RBP + -0x48) = 0x1e;

+          FUN_180055600((undefined8 *)(unaff_RBP + -0x40),(undefined *)(unaff_RBP + -0x20));

+          _uStack0000000000000068 = 0x1000000;

+          *(uint **)(unaff_RBP + -0x30) = &stack0x00000068;

+          *(undefined8 *)(unaff_RBP + -0x28) = 8;

+          FUN_1800e3690(0x180135218,&DAT_9,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000070);

+        }

+      }

+    }

+LAB_0:

+    *in_stack_00000058 = unaff_R13D;

+    if ((unaff_R13D == 0) && ((unaff_ESI == 0 || (unaff_EDI = unaff_ESI, unaff_ESI == 0x2522)))) {

+      unaff_EDI = 0x5b4;

+    }

+    if ((DAT_4 & 8) != 0) {

+      FUN_1800f8aec(0x40b,0x40,0x18010da00,unaff_R13D);

+    }

   }

-  return;

+  else {

+    unaff_EDI = FUN_180079b94(in_stack_00000060,unaff_RBX,(short *)0x1,uStack0000000000000068,

+                              in_stack_00000044,in_stack_00000058);

+    if ((DAT_4 & 8) != 0) {

+      FUN_1800f8aec(0x40b,0x3f,0x18010da00,0);

+    }

+  }

+  return (ulonglong)unaff_EDI;

 }
```

## `DnsQueryExUTF8`  (modified)

```diff
--- DnsQueryExUTF8
+++ DnsMapRcodeToStatus
@@ -1,79 +1,20 @@
 

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

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

 

-DWORD DnsQueryExUTF8(LPVOID param_1,undefined8 param_2,undefined8 param_3)

+uint DnsMapRcodeToStatus(byte param_1)

 

 {

-  bool bVar1;

-  DWORD DVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 in_stack_fffffffffffffed8;

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  uint uVar1;

+  PEVENT_DATA_DESCRIPTOR in_RAX;

+  byte *in_RDX;

+  LPCWSTR unaff_RBX;

+  byte in_R9B;

+  undefined8 uStack0000000000000038;

   

-                    /* 0x98f50  176  DnsQueryExUTF8 */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    if ((DAT_2 & 8) != 0) {

-      FUN_1800e7548(param_1,0x13,param_3,(uint)*(ushort *)((longlong)param_1 + 0x10),

-                    CONCAT44((int)((ulonglong)in_stack_fffffffffffffed8 >> 0x20),

-                             *(undefined4 *)((longlong)param_1 + 0x14)),

-                    *(undefined8 *)((longlong)param_1 + 0x40));

-    }

-    DVar2 = FUN_180091ba4(param_1,2);

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_3 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         ((DAT_6 & 0x400000000000) != DAT_6)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        local_d8 = "DnsQueryExUTF8";

-        local_c8 = "FALSE";

-        local_118 = 1;

-        local_e0 = 8;

-        local_d0 = 0xf;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

-      }

-    }

-    DVar2 = 0x78;

-  }

-  return DVar2;

+  *(char *)&in_RAX->Ptr = (char)in_RAX->Ptr + (char)in_RAX;

+  uStack0000000000000038 = 0x1000000;

+  FUN_1800e3690(0x180135218,in_RDX,0,in_R9B,in_RAX);

+  uVar1 = FUN_18005e520(unaff_RBX,2);

+  return uVar1;

 }
```

## `Query_Main`  (modified)

```diff
--- Query_Main
+++ Query_Main
@@ -1,59 +1,207 @@
 

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

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

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

 

 DWORD Query_Main(PCERT_INFO param_1)

 

 {

-  undefined4 uVar1;

-  bool bVar2;

-  uint uVar3;

-  char *in_RAX;

-  undefined8 in_RDX;

-  char *unaff_RBX;

-  longlong unaff_RBP;

-  undefined4 *unaff_RDI;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

-  DWORD in_stack_00000160;

+  short sVar1;

+  uint uVar2;

+  BYTE *pBVar3;

+  longlong *plVar4;

+  bool bVar5;

+  bool bVar6;

+  PCERT_INFO p_Var7;

+  int iVar8;

+  uint uVar9;

+  DWORD DVar10;

+  int *piVar11;

+  uint uVar12;

+  PCERT_INFO p_Var13;

+  PCERT_INFO p_Var14;

+  PCERT_INFO p_Var15;

+  LPCSTR unaff_retaddr;

+  DWORD local_res8;

+  undefined1 auStackY_188 [32];

+  longlong local_150;

+  int local_148 [2];

+  ulonglong local_140 [3];

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  ulonglong *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  undefined8 local_d8 [2];

+  ulonglong *local_c8;

+  undefined8 local_c0;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  *unaff_RBX = *unaff_RBX + (char)((ulonglong)in_RDX >> 8);

-  uVar1 = in((short)in_RDX);

-  *unaff_RDI = uVar1;

-  uVar3 = (int)CONCAT71((int7)((ulonglong)in_RAX >> 8),uRam000c50c63d830005) + 0x160860f;

-  *(char *)(ulonglong)uVar3 = *(char *)(ulonglong)uVar3 + (char)uVar3;

-  if (((_DAT_0 & 0x400000000000) == 0) ||

-     ((DAT_1 & 0x400000000000) != DAT_1)) {

-    bVar2 = false;

+                    /* 0x72ad0  331  Query_Main */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_188;

+  pBVar3 = param_1[1].Issuer.pbData;

+  p_Var15 = (PCERT_INFO)0x0;

+  local_150 = 0;

+  bVar5 = false;

+  local_148[0] = 0;

+  local_140[0] = local_140[0] & 0xffffffff00000000;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar8 = FUN_1800ca394(unaff_retaddr), iVar8 == 0)) {

+    memset(local_b8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (DAT_3 < 6) {

+      return local_res8;

+    }

+    if (((_DAT_4 & 0x400000000000) == 0) ||

+       (bVar5 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+      bVar5 = false;

+    }

+    if (!bVar5) {

+      return local_res8;

+    }

+    local_108 = local_140 + 1;

+    local_140[1] = 1;

+    local_f8 = "Query_Main";

+    local_e8 = "FALSE";

+    local_100 = 8;

+    local_f0 = 0xb;

+    local_e0 = 6;

+    FUN_180055600(local_d8,(undefined *)local_b8);

+    local_c8 = local_140;

+    local_140[0] = 0x1000000;

+    local_c0 = 8;

+    FUN_1800e3690(0x180135218,&DAT_6,0,7,local_128);

+    return local_res8;

+  }

+  if ((DAT_7 & 8) != 0) {

+    FUN_1800f71b8(0x40b,0x1d2,0x18010c5a0,param_1);

+  }

+  if (((ulonglong)pBVar3 >> 0xe & 1) != 0) {

+    if (((ulonglong)pBVar3 >> 9 & 1) != 0) {

+LAB_8:

+      *(undefined4 *)((longlong)&param_1[2].Subject.pbData + 4) = 0x57;

+      return local_res8;

+    }

+    sVar1 = (short)param_1[1].Issuer.cbData;

+    if (sVar1 == 1) {

+      return local_res8;

+    }

+    if (sVar1 != 0x1c) goto LAB_8;

+  }

+  FUN_180071848((longlong)param_1);

+  AddRefQueryBlobEx((int *)param_1,"Query_Main",0x3d16,0xd);

+  uVar9 = FUN_18000b804(*(wchar_t **)&param_1[1].SignatureAlgorithm.Parameters);

+  if ((uVar9 >> 0x18 & 1) == 0) {

+    uVar2 = *(uint *)&param_1[5].SerialNumber.pbData;

+    uVar12 = uVar9 | 1;

+    if (((ulonglong)pBVar3 & 0x1000) == 0) {

+      uVar12 = uVar9;

+    }

+    *(uint *)&param_1[2].field_0x4 = uVar12;

+    if ((uVar2 == 0) ||

+       (uVar9 = FUN_180071090(*(longlong *)&param_1[0x10].SubjectPublicKeyInfo.PublicKey.cUnusedBits

+                              ,uVar2,(uint *)param_1[5].SignatureAlgorithm.pszObjId,

+                              (uint)((ulonglong)param_1[1].Issuer.pbData >> 0x39) & 1,

+                              *(int *)&param_1[1].field_0xc4,(longlong *)&param_1[4].cExtension),

+       uVar9 == 0)) {

+      DVar10 = 0;

+      plVar4 = *(longlong **)&param_1[4].cExtension;

+      bVar6 = false;

+      if (((plVar4 != (longlong *)0x0) && (*(int *)((longlong)plVar4 + 0x44) == 0)) &&

+         ((longlong *)*plVar4 == plVar4)) {

+        *(undefined4 *)((longlong)&param_1[2].Issuer.pbData + 4) = 0;

+      }

+      p_Var14 = p_Var15;

+      if (*(int *)((longlong)&param_1[2].Issuer.pbData + 4) == 0) {

+LAB_9:

+        p_Var13 = param_1;

+        FUN_180022180(*(longlong *)&param_1[4].cExtension,(longlong)param_1,0);

+        FUN_180025aa8(param_1);

+        if (local_148[0] != 0) {

+          p_Var15 = (PCERT_INFO)&p_Var14[-1].NotAfter;

+          p_Var7 = p_Var14 + 4;

+          p_Var14 = *(PCERT_INFO *)p_Var14;

+          p_Var13 = p_Var15;

+          FUN_180022180((longlong)(p_Var7->Issuer).pbData,(longlong)p_Var15,param_1);

+          FUN_180025aa8(p_Var15);

+        }

+        if (*(int *)((longlong)&param_1[2].Issuer.pbData + 4) != 0) {

+          bVar5 = true;

+          iVar8 = FUN_1800529a0((longlong)param_1);

+          if (iVar8 == 0) {

+            EnterCriticalSection((LPCRITICAL_SECTION)(local_150 + 0x18));

+            if (((p_Var15 == (PCERT_INFO)0x0) ||

+                (iVar8 = FUN_1800529a0((longlong)p_Var15), iVar8 == 0)) && ((int)local_140[0] != 0))

+            {

+              bVar6 = false;

+              DVar10 = FUN_180055a64((longlong)param_1,(longlong *)p_Var14);

+              p_Var13 = p_Var14;

+              if (DVar10 == 0) {

+                bVar5 = false;

+              }

+            }

+            LeaveCriticalSection((LPCRITICAL_SECTION)(local_150 + 0x18));

+          }

+        }

+        if (bVar6) {

+          FUN_18004ec70((longlong)param_1,p_Var13,local_148[0]);

+        }

+        if (bVar5) {

+LAB_10:

+          if (*(int *)((longlong)&param_1[2].Issuer.pbData + 4) != 0) {

+            EnterCriticalSection((LPCRITICAL_SECTION)(local_150 + 0x18));

+            *(uint *)(local_150 + 0x10) = *(uint *)(local_150 + 0x10) | 2;

+            LeaveCriticalSection((LPCRITICAL_SECTION)(local_150 + 0x18));

+            FUN_18002537c((longlong *)param_1);

+            DVar10 = 0x2522;

+            goto LAB_11;

+          }

+        }

+      }

+      else {

+        if ((DAT_7 & 8) != 0) {

+          FUN_1800f71b8(0x40b,0x1d4,0x18010c5a0,param_1);

+        }

+        piVar11 = FUN_18002cb78((int *)param_1,&local_150);

+        DVar10 = (DWORD)piVar11;

+        if (DVar10 == 0) {

+          DVar10 = FUN_180049ba4((int *)param_1,local_148,(undefined4 *)local_140);

+          if (DVar10 == 0) {

+            p_Var14 = *(PCERT_INFO *)&(param_1->SubjectPublicKeyInfo).PublicKey.cUnusedBits;

+            bVar6 = true;

+            goto LAB_9;

+          }

+          if ((DAT_7 & 8) != 0) {

+            FUN_1800f658c(0x40b,0x1d5,0x18010c5a0,DVar10);

+          }

+          goto LAB_10;

+        }

+      }

+    }

+    else {

+      DVar10 = 0x267c;

+    }

   }

   else {

-    bVar2 = true;

-  }

-  if (bVar2) {

-    uStack000000000000006c = 0;

-    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-    uStack000000000000007c = 0;

-    *(undefined4 *)(unaff_RBP + -0x74) = 0;

-    pcStack0000000000000070 = "DnsNetworkInformation_CreateFromPrivate";

-    *(char **)(unaff_RBP + -0x80) = "FALSE";

-    uStack0000000000000030 = 1;

-    uStack0000000000000068 = 8;

-    uStack0000000000000078 = 0x28;

-    *(undefined4 *)(unaff_RBP + -0x78) = 6;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-    *(undefined4 *)(unaff_RBP + -0x54) = 0;

-    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-    uStack0000000000000038 = 0x1000000;

-    *(undefined4 *)(unaff_RBP + -0x58) = 8;

-    FUN_1800e3690(0x180135218,&DAT_2,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

-  }

-  return in_stack_00000160;

+    DVar10 = 0x232b;

+    if ((DAT_7 & 8) != 0) {

+      FUN_1800e4ab4(0x40b,0x1d3,0x18010c5a0,0x232b,

+                    *(wchar_t **)&param_1[1].SignatureAlgorithm.Parameters);

+    }

+  }

+  DeRefQueryBlobEx((int *)param_1,"Query_Main",0x3de3,0xd);

+  if (DVar10 == 0) {

+    DVar10 = 0x2522;

+  }

+LAB_11:

+  if ((DAT_7 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x1d6,0x18010c5a0,DVar10);

+  }

+  return local_res8;

 }
```

## `DnsWriteReverseNameStringForIpAddress`  (modified)

```diff
--- DnsWriteReverseNameStringForIpAddress
+++ DnsWriteReverseNameStringForIpAddress
@@ -1,60 +1,74 @@
 

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

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

 

-ulonglong DnsWriteReverseNameStringForIpAddress(char *param_1,uint param_2)

+undefined8 DnsWriteReverseNameStringForIpAddress(char *param_1,uint param_2)

 

 {

-  uint uVar1;

-  ulonglong uVar2;

-  longlong unaff_RBP;

-  DWORD unaff_ESI;

-  DWORD unaff_R12D;

-  undefined4 unaff_R14D;

-  DWORD unaff_R15D;

-  uint in_stack_00000058;

-  undefined4 in_stack_0000005c;

-  HKEY in_stack_00000060;

-  undefined8 *in_stack_00000068;

-  undefined4 uStack0000000000000070;

+  bool bVar1;

+  undefined8 uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  uStack0000000000000070 = unaff_R14D;

-  uVar1 = RegSetValueExW((HKEY)(ulonglong)in_stack_00000058,L"IPSECCARestriction",0,unaff_R15D,

-                         (BYTE *)&stack0x00000070,2);

-  uVar2 = (ulonglong)uVar1;

-  if (uVar1 == 0) {

-    uStack0000000000000070 = 2;

-    uVar1 = RegSetValueExW((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058),L"Version",0,

-                           unaff_R12D,(BYTE *)&stack0x00000070,unaff_R12D);

-    uVar2 = (ulonglong)uVar1;

-    if (uVar1 == 0) {

-      uStack0000000000000070 = 0x10;

-      uVar1 = RegSetValueExW((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058),L"ConfigOptions",0,

-                             unaff_R12D,(BYTE *)&stack0x00000070,unaff_R12D);

-      uVar2 = (ulonglong)uVar1;

-      if (uVar1 == 0) {

-        uStack0000000000000070 = unaff_R14D;

-        uVar1 = RegSetValueExW((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058),L"IDNConfig",0,

-                               unaff_R12D,(BYTE *)&stack0x00000070,unaff_R12D);

-        uVar2 = (ulonglong)uVar1;

-        if (uVar1 == 0) {

-          DnsNotifyResolver(0,0);

-          unaff_R15D = unaff_ESI;

-        }

+                    /* 0x9ab40  253  DnsWriteReverseNameStringForIpAddress */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_1800cbc58(param_1,param_2);

+  }

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsWriteReverseNameStringForIpAddress";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x26;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-  }

-  if (in_stack_00000068 != (undefined8 *)0x0) {

-    DnsFreePolicyConfig(in_stack_00000068);

-  }

-  if ((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058) != (HKEY)0x0) {

-    RegCloseKey((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058));

-  }

-  if (unaff_R15D != 0) {

-    RegDeleteKeyExW(in_stack_00000060,(LPCWSTR)(unaff_RBP + -0x60),0,0);

-  }

-  if (in_stack_00000060 != (HKEY)0x0) {

-    RegCloseKey(in_stack_00000060);

+    uVar2 = 0;

   }

   return uVar2;

 }
```

## `DnsRecordBuild_UTF8`  (modified)

```diff
--- DnsRecordBuild_UTF8
+++ DnsQueryExUTF8
@@ -1,75 +1,79 @@
 

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

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

 

-LPVOID DnsRecordBuild_UTF8(longlong param_1,longlong param_2,ushort param_3,int param_4,byte param_5

-                          ,int param_6,undefined8 param_7)

+DWORD DnsQueryExUTF8(LPVOID param_1,undefined8 param_2,undefined8 param_3)

 

 {

   bool bVar1;

-  LPVOID pvVar2;

-  undefined4 uVar3;

+  DWORD DVar2;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_158 [32];

+  undefined1 auStackY_148 [32];

+  undefined8 in_stack_fffffffffffffed8;

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x992c0  183  DnsRecordBuild_UTF8 */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

+                    /* 0x98f50  176  DnsQueryExUTF8 */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    pvVar2 = FUN_1800d055c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);

+    if ((DAT_2 & 8) != 0) {

+      FUN_1800e7548(param_1,0x13,param_3,(uint)*(ushort *)((longlong)param_1 + 0x10),

+                    CONCAT44((int)((ulonglong)in_stack_fffffffffffffed8 >> 0x20),

+                             *(undefined4 *)((longlong)param_1 + 0x14)),

+                    *(undefined8 *)((longlong)param_1 + 0x40));

+    }

+    DVar2 = FUN_180091ba4(param_1,2);

   }

   else {

     memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

+    if (DAT_3 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        uVar3 = 8;

+        local_d8 = "DnsQueryExUTF8";

+        local_c8 = "FALSE";

         local_118 = 1;

-        local_d8 = "DnsRecordBuild_UTF8";

-        local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x14;

+        local_d0 = 0xf;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

       }

     }

-    pvVar2 = (LPVOID)0x0;

+    DVar2 = 0x78;

   }

-  return pvVar2;

+  return DVar2;

 }
```

## `DnsRecordTypeForName`  (modified)

```diff
--- DnsRecordTypeForName
+++ DnsRecordBuild_UTF8
@@ -1,61 +1,75 @@
 

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

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

 

-uint DnsRecordTypeForName(void *param_1,uint param_2)

+LPVOID DnsRecordBuild_UTF8(longlong param_1,longlong param_2,ushort param_3,int param_4,byte param_5

+                          ,int param_6,undefined8 param_7)

 

 {

   bool bVar1;

-  uint uVar2;

+  LPVOID pvVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

+  undefined1 auStackY_158 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

-  undefined8 local_e0;

+  undefined4 local_e0;

+  undefined4 local_dc;

   char *local_d8;

-  undefined8 local_d0;

+  undefined4 local_d0;

+  undefined4 local_cc;

   char *local_c8;

-  undefined8 local_c0;

+  undefined4 local_c0;

+  undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

-  undefined8 local_a0;

+  undefined4 local_a0;

+  undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x995d0  194  DnsRecordTypeForName */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+                    /* 0x992c0  183  DnsRecordBuild_UTF8 */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

   if (DAT_1 == 0) {

-    uVar2 = FUN_1800cf51c(param_1,param_2);

+    pvVar2 = FUN_1800d055c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

+      else {

+        bVar1 = true;

+      }

       if (bVar1) {

+        local_dc = 0;

         local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

         local_118 = 1;

+        local_d8 = "DnsRecordBuild_UTF8";

+        local_c8 = "FALSE";

         local_e0 = 8;

-        local_d8 = "DnsRecordTypeForName";

-        local_d0 = 0x15;

-        local_c8 = "FALSE";

+        local_d0 = 0x14;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = 8;

+        local_a0 = uVar3;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0;

+    pvVar2 = (LPVOID)0x0;

   }

-  return uVar2;

+  return pvVar2;

 }
```

## `DnsRegisterLocal`  (modified)

```diff
--- DnsRegisterLocal
+++ DnsQueryExW
@@ -1,74 +1,35 @@
 

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

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

-

-ulonglong DnsRegisterLocal(undefined8 *param_1,undefined8 *param_2,int param_3,undefined4 param_4)

+DWORD DnsQueryExW(uint *param_1)

 

 {

-  bool bVar1;

-  ulonglong uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  DWORD in_EAX;

+  DWORD DVar1;

+  LPVOID unaff_RBX;

+  bool in_ZF;

   

-                    /* 0x99730  195  DnsRegisterLocal */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = FUN_1800b5120(param_1,param_2,param_3,param_4,0,0);

+  if (in_ZF) {

+    if (unaff_RBX != (LPVOID)0x0) {

+      FUN_18006499c(1);

+      if (*(undefined8 **)((longlong)unaff_RBX + 8) != (undefined8 *)0x0) {

+        Dns_FreeAuthIdentityCredentials(*(undefined8 **)((longlong)unaff_RBX + 8));

+      }

+      if (*(LPVOID *)((longlong)unaff_RBX + 0x10) != (LPVOID)0x0) {

+        FUN_180064a44(*(LPVOID *)((longlong)unaff_RBX + 0x10));

+        *(undefined8 *)((longlong)unaff_RBX + 0x10) = 0;

+      }

+      in_EAX = DnsApiFree(unaff_RBX);

+    }

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    if ((DAT_0 & 8) != 0) {

+      FUN_1800f71b8(0x40b,0x12,0x180110d78,unaff_RBX);

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsRegisterLocal";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x11;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

+    in_EAX = SspiFreeAuthIdentity();

+    if ((DAT_0 & 8) != 0) {

+      DVar1 = FUN_1800f7614(0x40b,0x13,0x180110d78);

+      return DVar1;

     }

-    uVar2 = 0x78;

   }

-  return uVar2;

+  return in_EAX;

 }
```

## `DnsRemoveRegistrations`  (modified)

```diff
--- DnsRemoveRegistrations
+++ DnsRecordTypeForName
@@ -1,74 +1,61 @@
 

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

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

 

-ulonglong DnsRemoveRegistrations(void)

+uint DnsRecordTypeForName(void *param_1,uint param_2)

 

 {

   bool bVar1;

-  ulonglong uVar2;

-  undefined4 uVar3;

+  uint uVar2;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

+  undefined8 local_e0;

   char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

+  undefined8 local_d0;

   char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

+  undefined8 local_c0;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

+  undefined8 local_a0;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x998a0  198  DnsRemoveRegistrations */

+                    /* 0x995d0  194  DnsRecordTypeForName */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    uVar2 = DnsDhcpRemoveRegistrations();

+    uVar2 = FUN_1800cf51c(param_1,param_2);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

+         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

-      else {

-        bVar1 = true;

-      }

       if (bVar1) {

-        local_dc = 0;

         local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

         local_118 = 1;

-        local_d8 = "DnsRemoveRegistrations";

+        local_e0 = 8;

+        local_d8 = "DnsRecordTypeForName";

+        local_d0 = 0x15;

         local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x17;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar3;

+        local_a0 = 8;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0x78;

+    uVar2 = 0;

   }

   return uVar2;

 }
```

## `DnsResetQueryRetryTimeouts`  (modified)

```diff
--- DnsResetQueryRetryTimeouts
+++ DnsRegisterLocal
@@ -1,81 +1,74 @@
 

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

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

 

-ulonglong DnsResetQueryRetryTimeouts(uint *param_1)

+ulonglong DnsRegisterLocal(undefined8 *param_1,undefined8 *param_2,int param_3,undefined4 param_4)

 

 {

   bool bVar1;

-  uint uVar2;

-  ulonglong uVar3;

-  ulonglong uVar4;

+  ulonglong uVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_158 [32];

-  HKEY local_128;

-  undefined8 local_120;

-  undefined8 local_118 [2];

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

-  undefined8 local_e0;

+  undefined4 local_e0;

+  undefined4 local_dc;

   char *local_d8;

-  undefined8 local_d0;

+  undefined4 local_d0;

+  undefined4 local_cc;

   char *local_c8;

-  undefined8 local_c0;

+  undefined4 local_c0;

+  undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

-  undefined8 local_a0;

+  undefined4 local_a0;

+  undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x99a00  202  DnsResetQueryRetryTimeouts */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

-  local_128 = (HKEY)0x0;

+                    /* 0x99730  195  DnsRegisterLocal */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    uVar4 = FUN_180069150(param_1,0,&local_128);

-    uVar3 = uVar4 & 0xffffffff;

-    if ((int)uVar4 == 2) {

-      uVar3 = 0;

-    }

-    else {

-      if ((int)uVar4 == 0) {

-        uVar2 = RegDeleteValueW(local_128,L"DNSQueryTimeoutsMB");

-        uVar3 = (ulonglong)uVar2;

-        if (uVar2 == 2) {

-          uVar3 = 0;

-        }

-      }

-      if (local_128 != (HKEY)0x0) {

-        RegCloseKey(local_128);

-      }

-    }

+    uVar2 = FUN_1800b5120(param_1,param_2,param_3,param_4,0,0);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

+      else {

+        bVar1 = true;

+      }

       if (bVar1) {

-        local_e8 = &local_120;

-        local_120 = 1;

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsRegisterLocal";

+        local_c8 = "FALSE";

         local_e0 = 8;

-        local_d8 = "DnsResetQueryRetryTimeouts";

-        local_d0 = 0x1b;

-        local_c8 = "FALSE";

+        local_d0 = 0x11;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

-        local_a8 = local_118;

-        local_118[0] = 0x1000000;

-        local_a0 = 8;

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar3 = 0x78;

+    uVar2 = 0x78;

   }

-  return uVar3;

+  return uVar2;

 }
```

## `DnsScreenLocalAddrsForRegistration`  (modified)

```diff
--- DnsScreenLocalAddrsForRegistration
+++ DnsRemoveRegistrations
@@ -1,110 +1,74 @@
 

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

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

 

-DWORD DnsScreenLocalAddrsForRegistration

-                (undefined4 *param_1,wchar_t *param_2,uint param_3,wchar_t *param_4)

+ulonglong DnsRemoveRegistrations(void)

 

 {

   bool bVar1;

-  DWORD DVar2;

-  int iVar3;

-  SOCKADDR_INET *pSVar4;

-  undefined8 uVar5;

-  undefined8 uVar6;

-  undefined4 uVar7;

-  ulonglong uVar8;

+  ulonglong uVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_168 [32];

-  undefined8 local_138;

-  undefined8 local_130;

-  _EVENT_DATA_DESCRIPTOR local_128 [2];

-  undefined8 *local_108;

-  undefined4 local_100;

-  undefined4 local_fc;

-  char *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

-  char *local_e8;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

-  undefined8 local_d8 [2];

-  undefined8 *local_c8;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

-  short local_b8 [64];

-  ulonglong local_38;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-                    /* 0x99bc0  205  DnsScreenLocalAddrsForRegistration */

-  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

-  uVar8 = (ulonglong)param_3;

-  memset(local_128,0,0x40);

+                    /* 0x998a0  198  DnsRemoveRegistrations */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    if ((DAT_2 & 0x80) != 0) {

-      param_4 = param_2;

-      FUN_1800faec4(0x41f,0x15,0x180111af8,param_2,param_1);

-    }

-    memset(param_1,0,uVar8 * 4);

-    uVar6 = 0;

-    pSVar4 = FUN_180013ce4(0x20,0,0,param_4);

-    if (pSVar4 == (SOCKADDR_INET *)0x0) {

-      DVar2 = GetLastError();

-      if (DVar2 == 0) {

-        DVar2 = 0xe;

-      }

-    }

-    else {

-      if (param_3 != 0) {

-        do {

-          uVar5 = FUN_18000ec68(local_128,*(short **)param_2,uVar6,param_4,0);

-          if (((int)uVar5 != 0) &&

-             (iVar3 = FUN_1800a05ec((ushort *)local_128,(longlong)pSVar4), iVar3 != 0)) {

-            *param_1 = 1;

-          }

-          param_2 = param_2 + 8;

-          param_1 = param_1 + 1;

-          uVar8 = uVar8 - 1;

-        } while (uVar8 != 0);

-      }

-      NetInfo_Free((longlong *)&pSVar4->si_family);

-      DVar2 = 0;

-    }

+    uVar2 = DnsDhcpRemoveRegistrations();

   }

   else {

-    memset(local_b8,0,0x80);

-    if (DAT_3 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         ((DAT_6 & 0x400000000000) != DAT_6)) {

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

-        local_fc = 0;

-        local_108 = &local_138;

-        local_ec = 0;

         local_dc = 0;

-        uVar7 = 8;

-        local_138 = 1;

-        local_f8 = "DnsScreenLocalAddrsForRegistration";

-        local_e8 = "FALSE";

-        local_100 = 8;

-        local_f0 = 0x23;

-        local_e0 = 6;

-        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_e8 = &local_118;

+        local_cc = 0;

         local_bc = 0;

-        local_c8 = &local_130;

-        local_130 = 0x1000000;

-        local_c0 = uVar7;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsRemoveRegistrations";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x17;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    DVar2 = 0x78;

+    uVar2 = 0x78;

   }

-  return DVar2;

+  return uVar2;

 }
```

## `DnsCreateStringCopy`  (modified)

```diff
--- DnsCreateStringCopy
+++ DnsCleanupTcpConnections
@@ -1,74 +1,34 @@
 

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

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

+/* WARNING: Removing unreachable block (ram,0x000180092041) */

 

-LPVOID DnsCreateStringCopy(void *param_1,uint param_2)

+ulonglong DnsCleanupTcpConnections(void)

 

 {

-  bool bVar1;

-  LPVOID pvVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  ulonglong uVar1;

+  CLIENT_CALL_RETURN CVar2;

+  int unaff_EDI;

   

-                    /* 0x96ea0  63  DnsCreateStringCopy */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    pvVar2 = FUN_1800cbb08(param_1,param_2);

+  if (unaff_EDI == 0) {

+    CVar2.Simple = 0x57;

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsCreateStringCopy";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x14;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+    uVar1 = FUN_18002ddc4((longlong *)&stack0x00000078);

+    CVar2.Simple = uVar1 & 0xffffffff;

+    if ((int)uVar1 == 0) {

+      CVar2 = NdrClientCall3((MIDL_STUBLESS_PROXY_INFO *)&PTR_PTR_1800ff490,0x1e,(void *)0x0);

+      if (((int)CVar2.Simple != 0) && ((DAT_0 & 8) != 0)) {

+        FUN_1800f658c(0x40b,0x85,0x18010fd18,(int)CVar2.Simple);

       }

     }

-    pvVar2 = (LPVOID)0x0;

+    else if ((DAT_0 & 8) != 0) {

+      FUN_1800f658c(0x40b,0x84,0x18010fd18,(int)uVar1);

+    }

   }

-  return pvVar2;

+  FUN_18002dd44((longlong *)&stack0x00000078);

+  if ((DAT_0 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x86,0x18010fd18,(int)CVar2.Simple);

+  }

+  return CVar2.Simple & 0xffffffff;

 }
```

## `DnsDhcpSrvRegisterHostName`  (modified)

```diff
--- DnsDhcpSrvRegisterHostName
+++ DnsDhcpRegisterHostAddrs
@@ -1,72 +1,13 @@
 

-ulonglong DnsDhcpSrvRegisterHostName

-                    (undefined8 *param_1,undefined8 param_2,undefined4 param_3,undefined4 param_4,

-                    undefined8 param_5,undefined8 param_6,void *param_7,uint param_8)

+ulonglong DnsDhcpRegisterHostAddrs(wchar_t *param_1)

 

 {

-  uint uVar1;

-  ulonglong in_RAX;

-  undefined8 uVar2;

-  PCERT_INFO unaff_RBX;

-  BYTE *unaff_RBP;

-  BYTE *unaff_RSI;

-  ulonglong uVar3;

-  undefined4 in_register_00000084;

-  undefined4 in_register_0000008c;

-  FILETIME *unaff_R14;

-  uint *unaff_R15;

-  DWORD in_XMM0_Da;

-  DWORD in_XMM0_Db;

-  DWORD in_XMM0_Dc;

-  DWORD in_XMM0_Dd;

-  FILETIME FStackX_20;

-  undefined4 in_stack_00000078;

-  undefined4 in_stack_00000080;

-  undefined4 in_stack_00000088;

-  undefined4 in_stack_00000090;

-  undefined8 in_stack_000000a0;

+  ushort in_DX;

+  ulonglong unaff_RBX;

+  undefined4 in_R9D;

+  ULONGLONG unaff_R13;

   

-  unaff_RBX[4].rgExtension = (PCERT_EXTENSION)(in_RAX & 0xffffffffffffff70);

-  *(undefined4 *)&unaff_RBX[1].SubjectUniqueId.field_0x14 = in_stack_00000090;

-  *(undefined4 *)&unaff_RBX[1].field_0xc4 = in_stack_00000078;

-  *(undefined8 *)&unaff_RBX[1].Subject = in_stack_000000a0;

-  unaff_RBX[5].Subject.pbData = (BYTE *)FUN_180092b40;

-  *(BYTE **)&unaff_RBX[1].IssuerUniqueId.cUnusedBits = unaff_RBP + 0x10;

-  *(undefined4 *)&unaff_RBX[1].rgExtension = in_stack_00000080;

-  *(undefined4 *)((longlong)&unaff_RBX[1].rgExtension + 4) = in_stack_00000088;

-  unaff_RBX[1].NotBefore.dwLowDateTime = in_XMM0_Da;

-  unaff_RBX[1].NotBefore.dwHighDateTime = in_XMM0_Db;

-  unaff_RBX[1].NotAfter.dwLowDateTime = in_XMM0_Dc;

-  unaff_RBX[1].NotAfter.dwHighDateTime = in_XMM0_Dd;

-  unaff_RBX[1].Subject.pbData = unaff_RBP;

-  unaff_RBX[5].SubjectPublicKeyInfo.PublicKey.pbData = unaff_RSI;

-  *(uint **)&unaff_RBX[1].IssuerUniqueId = unaff_R15;

-  if ((*unaff_R15 >> 9 & 1) != 0) {

-    *(BYTE **)&unaff_RBX[1].SubjectUniqueId = unaff_RBP + 0x18;

-  }

-  uVar1 = FUN_180072480(unaff_RBX,param_2,CONCAT44(in_register_00000084,param_3),

-                        (PCERT_INFO)CONCAT44(in_register_0000008c,param_4));

-  uVar3 = (ulonglong)uVar1;

-  if (uVar1 == 0x2522) {

-    FStackX_20 = unaff_RBX[1].NotBefore;

-    uVar2 = FUN_1800ca6a0((int *)&FStackX_20);

-    if ((int)uVar2 != 0) {

-      WaitForSingleObject(unaff_RSI,0xffffffff);

-      uVar1 = *(uint *)((longlong)&unaff_RBX[2].Subject.pbData + 4);

-      uVar3 = (ulonglong)uVar1;

-      if (uVar1 != 0x2522) goto LAB_0;

-    }

-    FStackX_20 = *unaff_R14;

-    uVar2 = FUN_1800ca6a0((int *)&FStackX_20);

-    if ((int)uVar2 == 0) {

-      return uVar3;

-    }

-  }

-  else {

-    *(uint *)(unaff_RBP + 4) = uVar1;

-  }

-LAB_0:

-  DeRefQueryBlobEx((int *)unaff_RBX,"InProc_InitiateQuery",0x6ec,2);

-  return uVar3;

+  FUN_1800f658c((short)param_1,in_DX,unaff_R13,in_R9D);

+  return unaff_RBX & 0xffffffff;

 }
```

## `Socket_CloseEx`  (modified)

```diff
--- Socket_CloseEx
+++ TcpIoCompletionCb
@@ -1,178 +1,207 @@
 

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

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

 

-uint Socket_CloseEx(SOCKET param_1,int param_2)

+ulonglong TcpIoCompletionCb(undefined8 param_1,longlong *param_2,longlong *param_3,uint param_4,

+                           longlong *param_5)

 

 {

-  byte bVar1;

-  bool bVar2;

-  char cVar3;

-  int in_EAX;

-  uint uVar4;

-  uint uVar5;

-  int iVar6;

-  undefined8 uVar7;

-  ushort uVar8;

-  byte *unaff_RBX;

+  char cVar1;

+  char cVar2;

+  uint uVar3;

+  longlong *plVar4;

+  uint *puVar5;

+  undefined8 uVar6;

+  ulonglong uVar7;

+  longlong lVar8;

+  ushort *puVar9;

+  uint uVar10;

+  ulonglong unaff_RBX;

   longlong unaff_RBP;

-  uint unaff_EDI;

-  char in_R9B;

-  int unaff_R12D;

-  longlong unaff_R13;

-  char unaff_R14B;

-  longlong unaff_R15;

-  char in_stack_00000040;

-  undefined4 *in_stack_00000048;

-  undefined8 in_stack_00000050;

-  undefined8 in_stack_00000058;

+  uint unaff_ESI;

+  longlong lVar11;

+  longlong unaff_RDI;

+  ulonglong uVar12;

+  ulonglong unaff_R12;

+  int iVar13;

+  size_t unaff_R13;

+  ulonglong *unaff_R14;

+  int unaff_R15D;

+  ushort *puVar14;

+  int in_stack_00000040;

+  int in_stack_00000044;

+  undefined8 *in_stack_00000048;

+  int iStack0000000000000050;

+  undefined4 uStack0000000000000054;

+  uint *in_stack_00000058;

+  undefined8 in_stack_00000060;

+  undefined8 in_stack_00000068;

   

-  uVar4 = in_EAX + 0xc0860f;

-  *(char *)(ulonglong)uVar4 = *(char *)(ulonglong)uVar4 + (char)uVar4;

-  if (((_DAT_0 & 0x400000000000) == 0) ||

-     (cVar3 = '\x01', (DAT_1 & 0x400000000000) != DAT_1)) {

-    cVar3 = in_R9B;

-  }

-  if (cVar3 != '\0') {

-    in_stack_00000058 = 1;

-    *(undefined8 **)(unaff_RBP + -0x80) = &stack0x00000058;

-    *(undefined8 *)(unaff_RBP + -0x78) = 8;

-    *(char **)(unaff_RBP + -0x70) = "Recv_SecureComplete";

-    *(undefined8 *)(unaff_RBP + -0x68) = 0x14;

-    *(char **)(unaff_RBP + -0x60) = "pRecvMsg->MessageHead.Xid == pSendMsg->MessageHead.Xid";

-    *(undefined8 *)(unaff_RBP + -0x58) = 0x37;

-    FUN_180055600((undefined8 *)(unaff_RBP + -0x50),(undefined *)(unaff_RBP + -0x30));

-    in_stack_00000050 = 0x1000000;

-    *(undefined8 **)(unaff_RBP + -0x40) = &stack0x00000050;

-    *(undefined8 *)(unaff_RBP + -0x38) = 8;

-    FUN_1800e3690(0x180135218,&DAT_2,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

-  }

-  if (*(ushort *)(unaff_R13 + 700) == *(ushort *)(unaff_R15 + 700)) {

-    uVar7 = FUN_18003b8d0(unaff_R13,unaff_R15);

-    if ((int)uVar7 != 0) {

-      bVar1 = *(byte *)(unaff_R13 + 0x2bf);

-      uVar4 = bVar1 & 0xf;

-      if ((DAT_3 & 8) != 0) {

-        FUN_1800f892c(0x40b,0x126,0x18010da00,unaff_RBX);

-      }

-      if (*(short *)(unaff_R13 + 0x2c0) != 0) {

-        FUN_18001d430(unaff_R15,unaff_R13);

-      }

-      if ((bVar1 & 0xf) == 0) {

-        if ((*(short *)(unaff_R13 + 0x2c2) == 0) && (unaff_R14B != '(')) {

-          bVar1 = *(byte *)(unaff_R13 + 0x2be);

-          uVar4 = uVar4 + 2;

-          if (((byte)uVar4 & bVar1) == 0) {

-            if ((bVar1 & 4) != 0) {

-LAB_4:

-              if ((DAT_3 & 8) != 0) {

-                uVar8 = 0x128;

-                goto LAB_5;

+  FUN_1800ca1b8((LPCSTR)(ulonglong)((int)unaff_RBP - 0x40),0,(short *)(unaff_RBP + -0x20),param_4);

+  cVar1 = (char)unaff_RBX;

+  if (5 < DAT_0) {

+    if (((_DAT_1 & unaff_R12) == 0) ||

+       (cVar2 = '\x01', (DAT_2 & unaff_R12) != DAT_2)) {

+      cVar2 = cVar1;

+    }

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

+      in_stack_00000058 = (uint *)0x1;

+      *(uint ***)(unaff_RBP + -0x70) = &stack0x00000058;

+      *(undefined8 *)(unaff_RBP + -0x68) = 8;

+      *(char **)(unaff_RBP + -0x60) = "DnsGetNonSecureServersFromNetinfo";

+      *(undefined8 *)(unaff_RBP + -0x58) = 0x22;

+      *(char **)(unaff_RBP + -0x50) = "pNetInfo != NULL";

+      *(undefined8 *)(unaff_RBP + -0x48) = 0x11;

+      FUN_180055600((undefined8 *)(unaff_RBP + -0x40),(undefined *)(unaff_RBP + -0x20));

+      _iStack0000000000000050 = 0x1000000;

+      *(int **)(unaff_RBP + -0x30) = &stack0x00000050;

+      *(undefined8 *)(unaff_RBP + -0x28) = 8;

+      FUN_1800e3690(0x180135218,&DAT_3,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000070);

+    }

+  }

+  *unaff_R14 = unaff_RBX;

+  uVar10 = (uint)unaff_RBX;

+  if (uVar10 < *(uint *)(unaff_RDI + 0x44)) {

+    uVar12 = (ulonglong)*(uint *)(unaff_RDI + 0x44);

+    plVar4 = (longlong *)(unaff_RDI + 0x90);

+    do {

+      if ((((uint)DAT_4 != uVar10) || (unaff_R15D == 0)) ||

+         (uVar3 = 1, (int)plVar4[1] == unaff_R15D)) {

+        uVar3 = uVar10;

+      }

+      if ((*plVar4 != 0) && (uVar3 == 0)) {

+        unaff_ESI = unaff_ESI + *(int *)(*plVar4 + 4);

+      }

+      plVar4 = plVar4 + 0x14;

+      uVar12 = uVar12 - 1;

+    } while (uVar12 != 0);

+  }

+  puVar5 = FUN_180016230(unaff_ESI);

+  in_stack_00000058 = puVar5;

+  if (puVar5 == (uint *)0x0) {

+    unaff_RBX = 0xe;

+  }

+  else {

+    if (*puVar5 != unaff_ESI) {

+      memset((void *)(unaff_RBP + -0x20),0,unaff_R13);

+      if (DAT_5 != uVar10) {

+        FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0xa8),0,(short *)(unaff_RBP + -0x20),0x40);

+      }

+      if (5 < DAT_0) {

+        if (((_DAT_1 & unaff_R12) == 0) ||

+           (cVar2 = '\x01', (DAT_2 & unaff_R12) != DAT_2)) {

+          cVar2 = cVar1;

+        }

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

+          _iStack0000000000000050 = 1;

+          *(int **)(unaff_RBP + -0x70) = &stack0x00000050;

+          *(undefined8 *)(unaff_RBP + -0x68) = 8;

+          *(char **)(unaff_RBP + -0x60) = "DnsGetNonSecureServersFromNetinfo";

+          *(undefined8 *)(unaff_RBP + -0x58) = 0x22;

+          *(char **)(unaff_RBP + -0x50) = "pArray->MaxCount == cServers";

+          *(undefined8 *)(unaff_RBP + -0x48) = 0x1d;

+          FUN_180055600((undefined8 *)(unaff_RBP + -0x40),(undefined *)(unaff_RBP + -0x20));

+          in_stack_00000060 = 0x1000000;

+          *(undefined8 **)(unaff_RBP + -0x30) = &stack0x00000060;

+          *(undefined8 *)(unaff_RBP + -0x28) = 8;

+          FUN_1800e3690(0x180135218,&DAT_6,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000070);

+        }

+      }

+    }

+    uVar12 = unaff_RBX & 0xffffffff;

+    _iStack0000000000000050 = CONCAT44(uStack0000000000000054,uVar10);

+    if (uVar10 < *(uint *)(unaff_RDI + 0x44)) {

+      do {

+        iVar13 = (int)uVar12;

+        lVar11 = uVar12 * 0xa0;

+        uVar3 = uVar10;

+        if ((((uint)DAT_4 == uVar10) && (unaff_R15D != 0)) &&

+           (*(int *)(unaff_RDI + 0x98 + lVar11) != unaff_R15D)) {

+          uVar3 = 1;

+        }

+        lVar8 = *(longlong *)(lVar11 + 0x90 + unaff_RDI);

+        if ((lVar8 == 0) || (uVar3 != 0)) {

+          if ((DAT_7 & 8) != 0) {

+            FUN_1800ebb24();

+          }

+        }

+        else {

+          uVar12 = unaff_RBX & 0xffffffff;

+          if (uVar10 < *(uint *)(lVar8 + 4)) {

+            do {

+              puVar14 = (ushort *)(lVar8 + 0x20 + uVar12 * 0x40);

+              if ((in_stack_00000040 == 0) &&

+                 (uVar3 = FUN_180056f88((int)uVar12,*(longlong *)(lVar11 + 0x100 + unaff_RDI),

+                                        *(uint *)(lVar11 + 0xf8 + unaff_RDI)), uVar3 != 0)) {

+                if ((DAT_7 & 8) != 0) {

+                  FUN_1800e551c(0x40b,0x144,0x18010da00,(short *)puVar14);

+                }

               }

-              goto LAB_6;

-            }

-            if (*(char *)(unaff_R13 + 0x2bf) < '\0') {

-              if ((bVar1 & 1) != 0) goto LAB_4;

-              if ((DAT_3 & 8) != 0) {

-                FUN_1800e551c(0x40b,0x12a,0x18010da00,(short *)(unaff_R15 + 0x3c));

+              else {

+                if ((DAT_7 & 8) != 0) {

+                  FUN_1800e551c(0x40b,0x145,0x18010da00,(short *)puVar14);

+                }

+                uVar6 = FUN_1800104a0(puVar5,puVar14,0,0);

+                if ((int)uVar6 == 0) {

+                  memset((void *)(unaff_RBP + -0x20),0,0x80);

+                  if (DAT_5 != uVar10) {

+                    FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0xa8),0,(short *)(unaff_RBP + -0x20),0x40)

+                    ;

+                  }

+                  if (5 < DAT_0) {

+                    if (((_DAT_1 & 0x400000000000) == 0) ||

+                       (cVar2 = '\x01', (DAT_2 & 0x400000000000) != DAT_2)) {

+                      cVar2 = cVar1;

+                    }

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

+                      in_stack_00000060 = 1;

+                      *(undefined8 **)(unaff_RBP + -0x70) = &stack0x00000060;

+                      *(undefined8 *)(unaff_RBP + -0x68) = 8;

+                      *(char **)(unaff_RBP + -0x60) = "DnsGetNonSecureServersFromNetinfo";

+                      *(undefined8 *)(unaff_RBP + -0x58) = 0x22;

+                      *(undefined **)(unaff_RBP + -0x50) = &DAT_8;

+                      *(undefined8 *)(unaff_RBP + -0x48) = 5;

+                      FUN_180055600((undefined8 *)(unaff_RBP + -0x40),

+                                    (undefined *)(unaff_RBP + -0x20));

+                      in_stack_00000068 = 0x1000000;

+                      *(undefined8 **)(unaff_RBP + -0x30) = &stack0x00000068;

+                      *(undefined8 *)(unaff_RBP + -0x28) = 8;

+                      FUN_1800e3690(0x180135218,&DAT_9,0,7,

+                                    (PEVENT_DATA_DESCRIPTOR)&stack0x00000070);

+                    }

+                  }

+                }

+                puVar9 = puVar14;

+                uVar7 = FUN_180044828((short *)puVar14);

+                uVar3 = uVar10;

+                if ((int)uVar7 == 0) {

+                  uVar3 = *(uint *)(lVar11 + 0x98 + unaff_RDI);

+                }

+                if ((DAT_7 & 8) != 0) {

+                  FUN_1800e80f4(puVar9,0x146,0x18010da00,uVar3,(short *)puVar14);

+                }

+                in_stack_00000058[(ulonglong)(in_stack_00000058[1] - 1) * 0x10 + 0x11] = uVar3;

+                puVar5 = in_stack_00000058;

               }

-              uVar5 = 0x251e;

-            }

-            else {

-              if ((DAT_3 & 8) != 0) {

-                FUN_1800e551c(0x40b,0x129,0x18010da00,(short *)(unaff_R15 + 0x3c));

-              }

-              uVar5 = 0x2536;

-            }

+              lVar8 = *(longlong *)(lVar11 + 0x90 + unaff_RDI);

+              uVar3 = (int)uVar12 + 1;

+              uVar12 = (ulonglong)uVar3;

+            } while (uVar3 < *(uint *)(lVar8 + 4));

+            unaff_R15D = in_stack_00000044;

+            iVar13 = iStack0000000000000050;

           }

-          else {

-            if ((DAT_3 & 8) != 0) {

-              uVar8 = 0x127;

-LAB_5:

-              FUN_1800e551c(0x40b,uVar8,0x18010da00,(short *)(unaff_R15 + 0x3c));

-            }

-LAB_6:

-            uVar5 = 0x251d;

-            uVar4 = 0xfff;

-          }

-          if ((DAT_3 & 8) != 0) {

-            FUN_1800f8aec(0x40b,299,0x18010da00,uVar4);

-          }

-          goto LAB_7;

-        }

-        if (unaff_R12D != 0) {

-          FUN_18007707c((longlong)unaff_RBX,0);

-        }

-        *(int *)(unaff_RBX + 0x100) = *(int *)(unaff_RBX + 0x100) + 1;

-      }

-      else {

-        uVar5 = FUN_1800416e0(uVar4);

-LAB_7:

-        if (unaff_R12D != 0) {

-          FUN_18007707c((longlong)unaff_RBX,uVar5);

-        }

-        if (*(uint *)(unaff_RBX + 0x120) < uVar4) {

-          *(uint *)(unaff_RBX + 0x120) = uVar4;

-        }

-        if (unaff_R12D == 0) {

-          if ((DAT_8 == 0) ||

-             ((iVar6 = FUN_1800a7904((longlong)unaff_RBX), iVar6 != 0 &&

-              (iVar6 = FUN_1800aa624((longlong)unaff_RBX,unaff_R15), iVar6 == 0))))

-          goto LAB_9;

-LAB_10:

-          unaff_EDI = 0;

-          if ((DAT_3 & 8) != 0) {

-            FUN_1800f7614(0x40b,300,0x18010da00);

-          }

-          if ((in_stack_00000040 != '(') || (uVar4 = *(uint *)(unaff_RBX + 0x120), uVar4 < 5))

-          goto LAB_11;

-          if ((DAT_3 & 8) == 0) goto LAB_180076ebe;

-          uVar8 = 0x12e;

-        }

-        else {

-          if ((DAT_8 == 0) ||

-             (((iVar6 = FUN_1800a7818((longlong)unaff_RBX), iVar6 != 0 &&

-               (iVar6 = FUN_1800a9fb4((longlong)unaff_RBX,unaff_R15), iVar6 == 0)) &&

-              (iVar6 = FUN_1800aa624((longlong)unaff_RBX,unaff_R15), iVar6 == 0)))) {

-            bVar2 = true;

-          }

-          else {

-            bVar2 = false;

-          }

-          if (!bVar2) goto LAB_10;

-LAB_9:

-          unaff_EDI = 0x232b;

-          if ((uVar5 != 0x232b) && (uVar5 != 0x251d)) goto LAB_10;

-          if ((in_stack_00000040 != '(') && (*(int *)(unaff_RBX + 0x120) != 0xfff)) {

-            unaff_RBX[0x120] = 3;

-            unaff_RBX[0x121] = 0;

-            unaff_RBX[0x122] = 0;

-            unaff_RBX[0x123] = 0;

-          }

-          if ((DAT_3 & 8) == 0) goto LAB_180076ebe;

-          uVar4 = *(uint *)(unaff_RBX + 0x120);

-          uVar8 = 0x12d;

-        }

-        FUN_1800f658c(0x40b,uVar8,0x18010da00,uVar4);

-      }

-LAB_12:

-      *in_stack_00000048 = 1;

-      goto LAB_11;

-    }

-    if (*(short *)(unaff_R13 + 0x2c0) != 0) {

-      FUN_1800a6580(unaff_R15,unaff_R13);

-    }

-  }

-  else if ((DAT_3 & 8) != 0) {

-    FUN_1800f8aec(0x40b,0x125,0x18010da00,(uint)*(ushort *)(unaff_R15 + 700));

-  }

-  unaff_EDI = 0x251e;

-LAB_11:

-  FUN_1800213e0(unaff_RBX,unaff_EDI,(short *)(unaff_R13 + 0x3c));

-  *(uint *)(unaff_RBX + 0xc4) = unaff_EDI;

-  if ((DAT_3 & 8) != 0) {

-    FUN_1800f8aec(0x40b,0x12f,0x18010da00,unaff_EDI);

-  }

-  return unaff_EDI;

+        }

+        uVar3 = iVar13 + 1;

+        uVar12 = (ulonglong)uVar3;

+        _iStack0000000000000050 = CONCAT44(uStack0000000000000054,uVar3);

+      } while (uVar3 < *(uint *)(unaff_RDI + 0x44));

+    }

+    *in_stack_00000048 = puVar5;

+  }

+  DnsApiFree((LPVOID)0x0);

+  if ((DAT_7 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x147,0x18010da00,(int)unaff_RBX);

+  }

+  return unaff_RBX & 0xffffffff;

 }
```

## `NetInfo_GetAdapterByName`  (modified)

```diff
--- NetInfo_GetAdapterByName
+++ IpHelp_GetZtdnsAddrsAndProperties
@@ -1,84 +1,128 @@
 

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

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

 

-longlong NetInfo_GetAdapterByName(longlong param_1,PCNZWCH param_2)

+uint IpHelp_GetZtdnsAddrsAndProperties

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

 

 {

-  bool bVar1;

-  int iVar2;

-  DWORD dwErrCode;

-  ulonglong uVar3;

-  uint uVar4;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_168 [32];

-  undefined8 local_138;

-  undefined8 local_130;

-  _EVENT_DATA_DESCRIPTOR local_128 [2];

-  undefined8 *local_108;

-  undefined8 local_100;

-  char *local_f8;

-  undefined8 local_f0;

-  char *local_e8;

-  undefined8 local_e0;

-  undefined8 local_d8 [2];

-  undefined8 *local_c8;

-  undefined8 local_c0;

-  short local_b8 [64];

-  ulonglong local_38;

+  longlong lVar1;

+  byte bVar2;

+  byte bVar3;

+  bool bVar4;

+  undefined *puVar5;

+  longlong lVar6;

+  byte *pbVar7;

+  byte *pbVar8;

+  longlong unaff_RBP;

+  byte bVar9;

+  ulonglong uVar10;

+  undefined4 uStack0000000000000040;

+  USHORT UStack0000000000000048;

+  UCHAR UStack000000000000004a;

+  UCHAR UStack000000000000004b;

+  UCHAR UStack000000000000004c;

+  UCHAR UStack000000000000004d;

+  USHORT UStack000000000000004e;

+  ULONGLONG UStack0000000000000050;

+  undefined8 uStack0000000000000058;

+  undefined8 uStack0000000000000060;

+  undefined *puStack0000000000000070;

+  uint uStack0000000000000078;

+  ULONG UStack000000000000007c;

   

-                    /* 0x6eb50  320  NetInfo_GetAdapterByName */

-  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

-  uVar3 = 0;

-  if ((DAT_1 & 8) != 0) {

-    FUN_1800f71b8(0x40b,0x54,0x18010f550,param_1);

-  }

-  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

-     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

-    if ((param_1 != 0) && (param_2 != (PCNZWCH)0x0)) {

-      if (*(int *)(param_1 + 0x44) == 0) {

-        return 0;

-      }

+  FUN_1800ca1b8((LPCSTR)param_1,(int)param_2,(short *)param_3,(uint)param_4);

+  if (5 < DAT_0) {

+    if (((_DAT_1 & 0x400000000000) == 0) ||

+       ((DAT_2 & 0x400000000000) != DAT_2)) {

+      bVar4 = false;

+    }

+    else {

+      bVar4 = true;

+    }

+    if (bVar4) {

+      uStack0000000000000058 = 1;

+      *(undefined8 **)(unaff_RBP + -0x70) = &stack0x00000058;

+      *(undefined8 *)(unaff_RBP + -0x68) = 8;

+      *(char **)(unaff_RBP + -0x60) = "Reg_GetValueEx";

+      *(undefined8 *)(unaff_RBP + -0x58) = 0xf;

+      *(char **)(unaff_RBP + -0x50) = "FALSE";

+      lVar6 = -1;

+      *(undefined8 *)(unaff_RBP + -0x48) = 6;

       do {

-        iVar2 = FUN_180034b60(*(PCNZWCH *)(uVar3 * 0xa0 + 0x68 + param_1),param_2);

-        if (iVar2 == 0) {

-          return param_1 + 0x68 + uVar3 * 0xa0;

+        lVar1 = lVar6 * 2;

+        lVar6 = lVar6 + 1;

+      } while (*(short *)(unaff_RBP + -0x1e + lVar1) != 0);

+      *(undefined4 *)(unaff_RBP + -0x34) = 0;

+      *(int *)(unaff_RBP + -0x38) = (int)lVar6 * 2 + 2;

+      *(longlong *)(unaff_RBP + -0x40) = unaff_RBP + -0x20;

+      *(undefined8 **)(unaff_RBP + -0x30) = &stack0x00000060;

+      puVar5 = PTR_DAT_3;

+      UStack000000000000004c = '\x05';

+      UStack000000000000004d = '\0';

+      UStack000000000000004e = 0;

+      puStack0000000000000070 = PTR_DAT_3;

+      uStack0000000000000060 = 0x1000000;

+      *(undefined8 *)(unaff_RBP + -0x28) = 8;

+      UStack0000000000000048 = 0;

+      UStack000000000000004a = '\0';

+      UStack000000000000004b = '\v';

+      UStack0000000000000050 = 0x400000000000;

+      uStack0000000000000078 = (uint)*(ushort *)puVar5;

+      *(undefined **)(unaff_RBP + -0x80) = &DAT_4;

+      UStack000000000000007c = 2;

+      *(undefined4 *)(unaff_RBP + -0x78) = 0x52;

+      *(undefined4 *)(unaff_RBP + -0x74) = 1;

+      uStack0000000000000040 = 0x75c6;

+      if (DAT_5 == FUN_18004e7b0) {

+        bVar9 = 0;

+        pbVar7 = &DAT_6;

+        do {

+          bVar2 = *pbVar7;

+          pbVar7 = pbVar7 + 1;

+        } while ((char)bVar2 < '\0');

+        do {

+          bVar2 = *pbVar7;

+          pbVar7 = pbVar7 + 1;

+        } while (bVar2 != 0);

+        uVar10 = 0;

+        if (pbVar7 < &DAT_7) {

+          while( true ) {

+            do {

+              pbVar8 = pbVar7;

+              bVar9 = (byte)uVar10;

+              pbVar7 = pbVar8 + 1;

+            } while (*pbVar8 != 0);

+            bVar2 = pbVar8[1];

+            if (-1 < (char)bVar2) break;

+            pbVar7 = pbVar8 + 3;

+            if (-1 < (char)pbVar8[2]) break;

+            bVar3 = *pbVar7;

+            while ((char)bVar3 < '\0') {

+              if (bVar3 != 0x80) goto LAB_8;

+              pbVar8 = pbVar7 + 1;

+              pbVar7 = pbVar7 + 1;

+              bVar3 = *pbVar8;

+            }

+            if (((bVar2 & 0x7f) != 9) || (2 < (byte)(bVar3 + 0x8f))) break;

+            bVar9 = bVar9 + 1;

+            *(byte *)(unaff_RBP + -99 + uVar10 * 0x10) = bVar3;

+            uVar10 = (ulonglong)bVar9;

+            if (&UNK_9 < pbVar7) break;

+          }

         }

-        uVar4 = (int)uVar3 + 1;

-        uVar3 = (ulonglong)uVar4;

-      } while (uVar4 < *(uint *)(param_1 + 0x44));

-      return 0;

-    }

-    dwErrCode = 0x57;

-  }

-  else {

-    memset(local_b8,0,0x80);

-    if (DAT_3 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

-    }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

-        bVar1 = false;

-      }

-      if (bVar1) {

-        local_108 = &local_138;

-        local_138 = 1;

-        local_100 = 8;

-        local_f8 = "NetInfo_GetAdapterByName";

-        local_f0 = 0x19;

-        local_e8 = "FALSE";

-        local_e0 = 6;

-        FUN_180055600(local_d8,(undefined *)local_b8);

-        local_c8 = &local_130;

-        local_130 = 0x1000000;

-        local_c0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

+LAB_8:

+        if (bVar9 == 0) {

+          EventWriteTransfer(DAT_10,(PCEVENT_DESCRIPTOR)&stack0x00000048,(LPCGUID)0x0,

+                             (LPCGUID)0x0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000070);

+        }

+        else {

+          FUN_1800e3380(0x180135218,(undefined8 *)&stack0x00000048,7,(longlong)&stack0x00000070,

+                        bVar9);

+        }

       }

     }

-    dwErrCode = 0x78;

   }

-  SetLastError(dwErrCode);

-  return 0;

+  return 0x78;

 }
```

## `DnsSplitDotHost`  (modified)

```diff
--- DnsSplitDotHost
+++ DnsResetQueryRetryTimeouts
@@ -1,74 +1,12 @@
 

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

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

 

-int DnsSplitDotHost(wchar_t *param_1,undefined8 *param_2,undefined2 *param_3)

+ulonglong DnsResetQueryRetryTimeouts(uint *param_1)

 

 {

-  bool bVar1;

-  int iVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

-  

-                    /* 0x9a1f0  226  DnsSplitDotHost */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    iVar2 = FUN_1800cb158(param_1,param_2,param_3);

+  if ((DAT_0 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x1a,0x180110d78,0x57);

   }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsSplitDotHost";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x10;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    iVar2 = 0x78;

-  }

-  return iVar2;

+  return 0x57;

 }
```

## `DnsUpdate`  (modified)

```diff
--- DnsUpdate
+++ DnsSplitDotHost
@@ -1,74 +1,74 @@
 

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

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

 

-undefined8 DnsUpdate(void)

+int DnsSplitDotHost(wchar_t *param_1,undefined8 *param_2,undefined2 *param_3)

 

 {

   bool bVar1;

-  undefined8 uVar2;

+  int iVar2;

   undefined4 uVar3;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x9a4b0  234  DnsUpdate */

+                    /* 0x9a1f0  226  DnsSplitDotHost */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    uVar2 = 0x57;

+    iVar2 = FUN_1800cb158(param_1,param_2,param_3);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

         uVar3 = 8;

         local_118 = 1;

-        local_d8 = "DnsUpdate";

+        local_d8 = "DnsSplitDotHost";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 10;

+        local_d0 = 0x10;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

         local_a0 = uVar3;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0x78;

+    iVar2 = 0x78;

   }

-  return uVar2;

+  return iVar2;

 }
```

## `DnsUtf8ToUnicode`  (modified)

```diff
--- DnsUtf8ToUnicode
+++ DnsSetQueryRetryTimeouts
@@ -1,72 +1,32 @@
 

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

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

 

-int DnsUtf8ToUnicode(LPCSTR param_1,int param_2,LPWSTR param_3,int param_4)

+ulonglong DnsSetQueryRetryTimeouts(uint *param_1,uint param_2,uint *param_3)

 

 {

-  bool bVar1;

-  int iVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  uint uVar1;

+  ulonglong in_RAX;

+  undefined4 in_register_00000014;

+  uint unaff_EBX;

+  LPVOID unaff_RSI;

+  LPCWSTR unaff_RDI;

+  ulonglong uVar2;

+  int in_stack_00000028;

   

-                    /* 0x9a610  240  DnsUtf8ToUnicode */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    iVar2 = MultiByteToWideChar(0xfde9,8,param_1,param_2,param_3,param_4);

+  uVar1 = FUN_18002c5e0((LPWSTR)(in_RAX & 0xffffffffffffff30),

+                        (uint *)CONCAT44(in_register_00000014,param_2),unaff_RDI,

+                        (ulonglong)unaff_EBX,3,in_stack_00000028);

+  if (uVar1 == 0) {

+    uVar2 = 0x7b;

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    uVar1 = func_0x000180094900();

+    uVar2 = (ulonglong)uVar1;

+    if (unaff_RSI == (LPVOID)0x0) {

+      return uVar2;

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        local_d8 = "DnsUtf8ToUnicode";

-        local_c8 = "FALSE";

-        local_118 = 1;

-        local_e0 = 8;

-        local_d0 = 0x11;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    iVar2 = 0;

   }

-  return iVar2;

+  DnsApiFree(unaff_RSI);

+  return uVar2;

 }
```

## `DnsValidateNameOrIp_TempW`  (modified)

```diff
--- DnsValidateNameOrIp_TempW
+++ DnsUpdate
@@ -1,112 +1,74 @@
 

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

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

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

 

-undefined4 DnsValidateNameOrIp_TempW(wchar_t *param_1,uint param_2,longlong *param_3)

+undefined8 DnsUpdate(void)

 

 {

   bool bVar1;

-  int iVar2;

-  uint uVar3;

-  uint uVar4;

+  undefined8 uVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_188 [32];

-  longlong local_158 [8];

-  _EVENT_DATA_DESCRIPTOR local_118 [2];

-  longlong *local_f8;

-  undefined8 local_f0;

-  char *local_e8;

-  undefined8 local_e0;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

   char *local_d8;

-  undefined8 local_d0;

-  undefined8 local_c8 [2];

-  longlong *local_b8;

-  undefined8 local_b0;

-  short local_a8 [64];

-  ulonglong local_28;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-                    /* 0x9a790  241  DnsValidateNameOrIp_TempW */

-  local_28 = DAT_0 ^ (ulonglong)auStackY_188;

+                    /* 0x9a4b0  234  DnsUpdate */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    uVar4 = 0xffffffff;

-    if (param_2 != 0) {

-      uVar4 = param_2;

-    }

-    if ((uVar4 & 3) != 0) {

-      local_158[0] = 0;

-      local_158[3] = 0;

-      local_158[2] = 4;

-      param_3 = local_158 + 2;

-      local_158[4] = 0;

-      local_158[5] = 0;

-      local_158[6] = 0;

-      local_158[7] = 0;

-      iVar2 = GetAddrInfoW(0,0,param_3,local_158);

-      if (iVar2 == 0) {

-        iVar2 = *(int *)(local_158[0] + 4);

-        FreeAddrInfoW();

-        if (iVar2 == 0x17) {

-          if ((uVar4 & 1) == 0) {

-            return 0;

-          }

-          return 1;

-        }

-        if (iVar2 != 2) {

-          return 0;

-        }

-        if ((uVar4 & 2) == 0) {

-          return 0;

-        }

-        return 2;

-      }

-    }

-    if ((uVar4 & 0x200) != 0) {

-      uVar3 = DnsValidateName_W(param_1,3,param_3);

-      if (uVar3 == 0) {

-        return 0x200;

-      }

-      if (uVar3 == 0x2554) {

-        return 0x200;

-      }

-    }

-    if ((uVar4 & 0x100) != 0) {

-      uVar4 = DnsValidateName_W(param_1,3,param_3);

-      if (uVar4 == 0) {

-        return 0x100;

-      }

-      if (uVar4 == 0x2554) {

-        return 0x100;

-      }

-      return 0;

-    }

+    uVar2 = 0x57;

   }

   else {

-    memset(local_a8,0,0x80);

+    memset(local_98,0,0x80);

     if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

+      else {

+        bVar1 = true;

+      }

       if (bVar1) {

-        local_f8 = local_158;

-        local_158[0] = 1;

-        local_f0 = 8;

-        local_e8 = "DnsValidateNameOrIp_TempW";

-        local_e0 = 0x1a;

-        local_d8 = "FALSE";

-        local_d0 = 6;

-        FUN_180055600(local_c8,(undefined *)local_a8);

-        local_b8 = local_158 + 1;

-        local_158[1] = 0x1000000;

-        local_b0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_118);

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsUpdate";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 10;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

+    uVar2 = 0x78;

   }

-  return 0;

+  return uVar2;

 }
```

## `DnsTraceServerConfig`  (modified)

```diff
--- DnsTraceServerConfig
+++ DnsTraceServerConfig
@@ -1,87 +1,143 @@
 

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

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

 

-DWORD DnsTraceServerConfig

-                (SOCKADDR_INET *param_1,wchar_t *param_2,undefined *param_3,SOCKADDR_INET *param_4)

+void DnsTraceServerConfig

+               (SOCKADDR_INET *param_1,wchar_t *param_2,short *param_3,SOCKADDR_INET *param_4)

 

 {

-  PCERT_INFO p_Var1;

-  DWORD DVar2;

-  int iVar3;

-  int iVar4;

-  uint *in_RAX;

-  int *piVar5;

-  PCERT_INFO p_Var6;

-  PCERT_INFO p_Var7;

-  PCERT_INFO unaff_RBX;

-  int unaff_ESI;

-  FILETIME *unaff_R13;

-  int in_stack_00000030;

-  longlong in_stack_00000038;

-  int in_stack_00000040;

-  int in_stack_00000048;

+  bool bVar1;

+  int iVar2;

+  SOCKADDR_INET *pSVar3;

+  wchar_t *pwVar4;

+  short *psVar5;

+  SOCKADDR_INET *pSVar6;

+  SOCKADDR_INET *unaff_retaddr;

+  undefined1 auStackY_158 [32];

+  undefined8 local_128;

+  undefined8 local_120;

+  _EVENT_DATA_DESCRIPTOR local_118 [2];

+  undefined8 *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  undefined8 local_c8 [2];

+  undefined8 *local_b8;

+  undefined8 local_b0;

+  short local_a8 [64];

+  ulonglong local_28;

   

-  *in_RAX = *in_RAX | (uint)in_RAX;

-  FUN_1800f71b8(0x40b,(ushort)param_2,(ULONGLONG)param_3,unaff_RBX);

-  piVar5 = FUN_18002cb78((int *)unaff_RBX,&stack0x00000038);

-  DVar2 = (DWORD)piVar5;

-  if (DVar2 == 0) {

-    DVar2 = FUN_180049ba4((int *)unaff_RBX,&stack0x00000040,&stack0x00000048);

-    if (DVar2 == 0) {

-      p_Var7 = *(PCERT_INFO *)&(unaff_RBX->SubjectPublicKeyInfo).PublicKey.cUnusedBits;

-      p_Var6 = unaff_RBX;

-      FUN_180022180(*(longlong *)&unaff_RBX[4].cExtension,(longlong)unaff_RBX,0);

-      FUN_180025aa8(unaff_RBX);

-      if (in_stack_00000040 != (int)unaff_R13) {

-        unaff_R13 = &p_Var7[-1].NotAfter;

-        p_Var1 = p_Var7 + 4;

-        p_Var7 = *(PCERT_INFO *)p_Var7;

-        p_Var6 = (PCERT_INFO)unaff_R13;

-        FUN_180022180((longlong)(p_Var1->Issuer).pbData,(longlong)unaff_R13,unaff_RBX);

-        FUN_180025aa8((PCERT_INFO)unaff_R13);

+                    /* 0x759a0  232  DnsTraceServerConfig */

+  local_28 = DAT_0 ^ (ulonglong)auStackY_158;

+  pSVar3 = param_1;

+  pwVar4 = param_2;

+  psVar5 = param_3;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (pSVar3 = unaff_retaddr, iVar2 = FUN_1800ca394((LPCSTR)&unaff_retaddr->si_family), iVar2 == 0))

+  {

+    memset(local_a8,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8((LPCSTR)&unaff_retaddr->si_family,0,local_a8,0x40);

+    }

+    if (DAT_3 < 6) {

+      return;

+    }

+    if (((_DAT_4 & 0x400000000000) == 0) ||

+       (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+      bVar1 = false;

+    }

+    if (!bVar1) {

+      return;

+    }

+    local_f8 = &local_128;

+    local_128 = 1;

+    local_f0 = 8;

+    local_e8 = "DnsTraceServerConfig";

+    local_e0 = 0x15;

+    local_d8 = "FALSE";

+    local_d0 = 6;

+    FUN_180055600(local_c8,(undefined *)local_a8);

+    local_b8 = &local_120;

+    local_120 = 0x1000000;

+    local_b0 = 8;

+    FUN_1800e3690(0x180135218,&DAT_6,0,7,local_118);

+    return;

+  }

+  if ((DAT_7 & 8) != 0) {

+    pwVar4 = (wchar_t *)0x1f;

+    psVar5 = (short *)&DAT_8;

+    param_4 = param_1;

+    FUN_1800f7d84(pSVar3,0x1f,0x18010fdd0,param_1);

+  }

+  if (((int)param_3 != 0) && (DAT_9 == 0)) {

+    pwVar4 = (wchar_t *)0x0;

+    psVar5 = (short *)0x80;

+    memset(local_a8,0,0x80);

+    if (DAT_2 != 0) {

+      psVar5 = local_a8;

+      param_4 = (SOCKADDR_INET *)0x40;

+      pwVar4 = (wchar_t *)0x0;

+      FUN_1800ca1b8((LPCSTR)&unaff_retaddr->si_family,0,psVar5,0x40);

+    }

+    if (5 < DAT_3) {

+      pwVar4 = (wchar_t *)0x400000000000;

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

       }

-      if ((*(int *)((longlong)&unaff_RBX[2].Issuer.pbData + 4) != 0) &&

-         (iVar3 = FUN_1800529a0((longlong)unaff_RBX), in_stack_00000030 = unaff_ESI, iVar3 == 0)) {

-        EnterCriticalSection((LPCRITICAL_SECTION)(in_stack_00000038 + 0x18));

-        iVar3 = unaff_ESI;

-        if (((unaff_R13 == (FILETIME *)0x0) ||

-            (iVar4 = FUN_1800529a0((longlong)unaff_R13), iVar4 == 0)) && (in_stack_00000048 != 0)) {

-          DVar2 = FUN_180055a64((longlong)unaff_RBX,(longlong *)p_Var7);

-          p_Var6 = p_Var7;

-          iVar3 = 0;

-          if (DVar2 == 0) {

-            in_stack_00000030 = 0;

-          }

-        }

-        unaff_ESI = iVar3;

-        LeaveCriticalSection((LPCRITICAL_SECTION)(in_stack_00000038 + 0x18));

+      if (bVar1) {

+        local_f8 = &local_120;

+        local_120 = 1;

+        local_f0 = 8;

+        local_e8 = "DnsTraceServerConfig";

+        local_e0 = 0x15;

+        local_d8 = "!fIsCache || g_DnsIsCache";

+        local_d0 = 0x1a;

+        FUN_180055600(local_c8,(undefined *)local_a8);

+        local_b8 = &local_128;

+        local_128 = 0x1000000;

+        pwVar4 = L"ԋ";

+        local_b0 = 8;

+        param_4 = (SOCKADDR_INET *)0x7;

+        psVar5 = (short *)0x0;

+        FUN_1800e3690(0x180135218,&DAT_10,0,7,local_118);

       }

-      if (unaff_ESI != 0) {

-        FUN_18004ec70((longlong)unaff_RBX,p_Var6,in_stack_00000040);

-      }

-      if (in_stack_00000030 == 0) goto LAB_0;

-    }

-    else if ((DAT_1 & 8) != 0) {

-      FUN_1800f658c(0x40b,0x1d5,0x18010c5a0,DVar2);

-    }

-    if (*(int *)((longlong)&unaff_RBX[2].Issuer.pbData + 4) != 0) {

-      EnterCriticalSection((LPCRITICAL_SECTION)(in_stack_00000038 + 0x18));

-      *(uint *)(in_stack_00000038 + 0x10) = *(uint *)(in_stack_00000038 + 0x10) | 2;

-      LeaveCriticalSection((LPCRITICAL_SECTION)(in_stack_00000038 + 0x18));

-      FUN_18002537c((longlong *)unaff_RBX);

-      DVar2 = 0x2522;

-      goto LAB_2;

     }

   }

-LAB_0:

-  DeRefQueryBlobEx((int *)unaff_RBX,"Query_Main",0x3de3,0xd);

-  if (DVar2 == 0) {

-    DVar2 = 0x2522;

+  pSVar3 = (SOCKADDR_INET *)0x0;

+  if (param_1 == (SOCKADDR_INET *)0x0) {

+    psVar5 = (short *)0x0;

+    pwVar4 = (wchar_t *)0x0;

+    param_1 = FUN_180013ce4(0,0,0,(wchar_t *)&param_4->si_family);

+    pSVar3 = param_1;

+    pSVar6 = (SOCKADDR_INET *)0x0;

+    if (param_1 == (SOCKADDR_INET *)0x0) goto LAB_11;

   }

-LAB_2:

-  if ((DAT_1 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x1d6,0x18010c5a0,DVar2);

+  FUN_18004c5f8((longlong)param_1);

+  pSVar6 = pSVar3;

+  if ((int)param_2 != 0) {

+    AcquireSRWLockExclusive((PSRWLOCK)&DAT_12);

+    if (DAT_13 != 0) {

+      FUN_18001ff1c((longlong)param_1,pwVar4,psVar5,(short *)&param_4->si_family);

+    }

+    ReleaseSRWLockExclusive((PSRWLOCK)&DAT_12);

+    if ((DAT_7 & 8) != 0) {

+      if (DAT_14 == 0) {

+        EnterCriticalSection((LPCRITICAL_SECTION)&DAT_15);

+      }

+      FUN_18007d50c(1,pwVar4);

+      if (DAT_14 == 0) {

+        LeaveCriticalSection((LPCRITICAL_SECTION)&DAT_15);

+      }

+    }

   }

-  return DVar2;

+LAB_11:

+  NetInfo_Free((longlong *)&pSVar6->si_family);

+  if ((DAT_7 & 8) != 0) {

+    FUN_1800f7614(0x40b,0x20,0x18010fdd0);

+  }

+  return;

 }
```

## `DnsUpdateTest_A`  (modified)

```diff
--- DnsUpdateTest_A
+++ DnsUpdateTest_A
@@ -1,26 +1,85 @@
 

-int DnsUpdateTest_A(wchar_t *param_1,char *param_2,uint param_3,wchar_t *param_4)

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

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

+

+int DnsUpdateTest_A(longlong param_1,undefined *param_2,uint param_3,wchar_t *param_4)

 

 {

-  char *pcVar1;

-  undefined1 *puVar2;

-  int in_EAX;

-  undefined4 in_register_00000004;

-  char cVar3;

-  undefined7 uVar4;

-  undefined4 unaff_EDI;

-  undefined4 unaff_0000003c;

+  bool bVar1;

+  int iVar2;

+  wchar_t *pwVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_178 [32];

+  undefined8 local_148;

+  undefined8 local_140;

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined4 local_110;

+  undefined4 local_10c;

+  char *local_108;

+  undefined4 local_100;

+  undefined4 local_fc;

+  char *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  short local_c8 [64];

+  ulonglong local_48;

   

-  uVar4 = (undefined7)((ulonglong)param_1 >> 8);

-  cVar3 = (char)param_1 + *(char *)CONCAT44(unaff_0000003c,unaff_EDI);

-  *(int *)CONCAT44(in_register_00000004,in_EAX) =

-       *(int *)CONCAT44(in_register_00000004,in_EAX) + in_EAX;

-  pcVar1 = (char *)(CONCAT71(uVar4,cVar3) + -0x7f);

-  *pcVar1 = *pcVar1 + (char)in_EAX;

-  puVar2 = (undefined1 *)(CONCAT71(uVar4,cVar3) + CONCAT44(in_register_00000004,in_EAX));

-  *puVar2 = *puVar2;

-  pcVar1 = (char *)(CONCAT44(in_register_00000004,in_EAX) + -0x75);

-  *pcVar1 = *pcVar1 + cVar3;

-  return in_EAX;

+                    /* 0x93ff0  237  DnsUpdateTest_A */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_178;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f5c44(0x40b,0x1b,0x180110d78,param_2);

+  }

+  if (DAT_2 != 0) {

+    memset(local_c8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_10c = 0;

+        local_118 = &local_148;

+        local_fc = 0;

+        local_ec = 0;

+        local_108 = "DnsUpdateTest_A";

+        local_f8 = "FALSE";

+        local_148 = 1;

+        local_110 = 8;

+        local_100 = 0x10;

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_cc = 0;

+        local_d8 = &local_140;

+        local_140 = 0x1000000;

+        local_d0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_138);

+      }

+    }

+  }

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

+    iVar2 = 0x57;

+  }

+  else {

+    pwVar3 = FUN_18002ca60((longlong)param_2,0,2,1);

+    if (pwVar3 == (wchar_t *)0x0) {

+      iVar2 = 0x7b;

+    }

+    else {

+      iVar2 = DnsUpdateTest_W(param_1,pwVar3,param_3,param_4);

+      DnsApiFree(pwVar3);

+    }

+  }

+  return iVar2;

 }
```

## `DnsUpdateTest_UTF8`  (modified)

```diff
--- DnsUpdateTest_UTF8
+++ DnsUpdateRpc
@@ -1,28 +1,122 @@
 

-int DnsUpdateTest_UTF8(wchar_t *param_1,char *param_2,uint param_3,wchar_t *param_4)

+int DnsUpdateRpc(undefined8 param_1,undefined4 param_2,ULONGLONG param_3,wchar_t *param_4,

+                longlong param_5)

 

 {

-  undefined8 uVar1;

-  short sVar2;

+  undefined1 auVar1 [16];

+  undefined1 auVar2 [16];

+  undefined1 auVar3 [16];

+  DWORD DVar4;

+  byte *in_RAX;

+  ULONGLONG UVar5;

+  ulonglong uVar6;

+  ulonglong uVar7;

+  longlong lVar8;

+  short *unaff_RBX;

+  int unaff_EBP;

+  undefined8 unaff_RSI;

+  int iVar9;

+  undefined4 uVar10;

+  int iVar11;

+  int unaff_R12D;

+  undefined8 *unaff_R13;

+  wchar_t *unaff_R14;

+  longlong unaff_R15;

+  uint in_stack_00000090;

+  int in_stack_000000a0;

   

-  if ((int)param_1 != 0) {

-    sVar2 = (short)param_3;

-    if (sVar2 == 1) {

-      *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)param_2;

+  *in_RAX = *in_RAX | (byte)in_RAX;

+  FUN_1800f7614(0x40b,(ushort)param_2,param_3);

+  DVar4 = FUN_18008f060(unaff_RBX,unaff_R14,in_stack_000000a0,&stack0x00000090,unaff_R15,unaff_R12D,

+                        unaff_EBP,unaff_R13);

+  if ((DAT_0 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x49,0x180110b80,DVar4);

+  }

+  iVar11 = (int)unaff_RSI;

+  if (DVar4 == 0) {

+    if (in_stack_00000090 != 0) {

+      UVar5 = GetTickCount64();

+      unaff_RBX[0x28] = 1;

+      unaff_RBX[0x29] = 0;

+      auVar1._8_8_ = 0;

+      auVar1._0_8_ = UVar5;

+      lVar8 = SUB168(ZEXT816(0x624dd2f1a9fbe77) * auVar1,8);

+      iVar9 = (int)((UVar5 - lVar8 >> 1) + lVar8 >> 9);

+      if (*(uint *)(unaff_RBX + 0x2e) < DAT_1) {

+        *(uint *)(unaff_RBX + 0x4c) = in_stack_00000090;

+        *(int *)(unaff_RBX + 0x4e) = iVar11;

+        if ((in_stack_00000090 != 0x5b4) && (in_stack_00000090 != 0x232a)) {

+          if (in_stack_00000090 != 0x232b) goto LAB_2;

+          if (*(int *)(unaff_RBX + 0x2a) != 2) {

+            return 0;

+          }

+        }

+LAB_3:

+        iVar9 = iVar9 + 300;

+LAB_4:

+        uVar6 = FUN_18008d858(unaff_RBX,lVar8,iVar9);

+        return (int)uVar6;

+      }

+LAB_2:

+      uVar10 = 1;

+      uVar6 = 0;

+      uVar7 = (ulonglong)in_stack_00000090;

+      goto LAB_5;

     }

-    else if (sVar2 == 0x1c) {

-      uVar1 = *(undefined8 *)(param_2 + 8);

-      *(undefined8 *)(param_1 + 0x10) = *(undefined8 *)param_2;

-      *(undefined8 *)(param_1 + 0x14) = uVar1;

+    uVar10 = 0;

+    uVar6 = 0;

+  }

+  else {

+    uVar6 = (ulonglong)in_stack_00000090;

+    if (in_stack_00000090 != 0) {

+      if (((DVar4 != 0x232a) && (DVar4 != 0x2552)) && (DVar4 != 0x5b4)) {

+        iVar11 = -1;

+LAB_6:

+        FUN_18008dc44(unaff_RBX,uVar6,(ulonglong)DVar4,iVar11);

+        return DVar4;

+      }

+      *(uint *)(unaff_RBX + 0x4c) = in_stack_00000090;

+      *(DWORD *)(unaff_RBX + 0x4e) = DVar4;

+      if (((DVar4 == 0x5b4) || (DVar4 == 0x232a)) || (DVar4 == 0x2552)) {

+        unaff_RSI = 300;

+      }

+      if ((DAT_1 < 2) || (DAT_1 <= *(uint *)(unaff_RBX + 0x2e))) {

+        iVar11 = (-(uint)(in_stack_00000090 != 0) & 2) - 1;

+        goto LAB_6;

+      }

+      UVar5 = GetTickCount64();

+      auVar3._8_8_ = 0;

+      auVar3._0_8_ = UVar5;

+      lVar8 = SUB168(ZEXT816(0x624dd2f1a9fbe77) * auVar3,8);

+      iVar9 = (int)(lVar8 + (UVar5 - lVar8 >> 1) >> 9) + (int)unaff_RSI;

+      goto LAB_4;

     }

-    else if (sVar2 == 5) {

-      *(char **)(param_1 + 0x10) = param_2;

+    UVar5 = GetTickCount64();

+    *(undefined8 *)(unaff_RBX + 0x26) = unaff_RSI;

+    auVar2._8_8_ = 0;

+    auVar2._0_8_ = UVar5;

+    lVar8 = SUB168(ZEXT816(0x624dd2f1a9fbe77) * auVar2,8);

+    iVar9 = (int)((UVar5 - lVar8 >> 1) + lVar8 >> 9);

+    if (*(uint *)(unaff_RBX + 0x2e) < DAT_1) {

+      *(DWORD *)(unaff_RBX + 0x4e) = DVar4;

+      *(int *)(unaff_RBX + 0x4c) = iVar11;

+      if (DVar4 != 0x5b4) {

+        if (DVar4 == 0x232a) {

+          iVar9 = iVar9 + 300;

+          goto LAB_4;

+        }

+        iVar11 = -1;

+        uVar6 = 0;

+        goto LAB_6;

+      }

+      goto LAB_3;

     }

-    else if (sVar2 == 0x31) {

-      *(uint *)(param_1 + 0x10) = (uint)param_4 & 0xffff;

-      memcpy(param_1 + 0x12,param_2,(ulonglong)param_4 & 0xffff);

-    }

+    uVar10 = 0xffffffff;

+    uVar6 = (ulonglong)DVar4;

   }

-  return 0;

+  uVar7 = 0;

+LAB_5:

+  FUN_18008dc44(unaff_RBX,uVar7,uVar6,uVar10);

+  return iVar11;

 }
```

## `DnsValidateUtf8Byte`  (modified)

```diff
--- DnsValidateUtf8Byte
+++ DnsUtf8ToUnicode
@@ -1,74 +1,72 @@
 

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

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

 

-undefined8 DnsValidateUtf8Byte(byte param_1,int *param_2)

+int DnsUtf8ToUnicode(LPCSTR param_1,int param_2,LPWSTR param_3,int param_4)

 

 {

   bool bVar1;

-  undefined8 uVar2;

-  undefined4 uVar3;

+  int iVar2;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x9a9e0  250  DnsValidateUtf8Byte */

+                    /* 0x9a610  240  DnsUtf8ToUnicode */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    uVar2 = FUN_18005d9f4(param_1,param_2);

+    iVar2 = MultiByteToWideChar(0xfde9,8,param_1,param_2,param_3,param_4);

   }

   else {

     memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        uVar3 = 8;

+        local_d8 = "DnsUtf8ToUnicode";

+        local_c8 = "FALSE";

         local_118 = 1;

-        local_d8 = "DnsValidateUtf8Byte";

-        local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x14;

+        local_d0 = 0x11;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar3;

+        local_a0 = 8;

         FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar2 = 0;

+    iVar2 = 0;

   }

-  return uVar2;

+  return iVar2;

 }
```

## `DnsWriteReverseNameStringForIpAddress`  (modified)

```diff
--- DnsWriteReverseNameStringForIpAddress
+++ DnsValidateNameOrIp_TempW
@@ -1,74 +1,112 @@
 

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

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

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

 

-undefined8 DnsWriteReverseNameStringForIpAddress(char *param_1,uint param_2)

+undefined4 DnsValidateNameOrIp_TempW(wchar_t *param_1,uint param_2,longlong *param_3)

 

 {

   bool bVar1;

-  undefined8 uVar2;

-  undefined4 uVar3;

+  int iVar2;

+  uint uVar3;

+  uint uVar4;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

+  undefined1 auStackY_188 [32];

+  longlong local_158 [8];

+  _EVENT_DATA_DESCRIPTOR local_118 [2];

+  longlong *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

   char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined8 local_d0;

+  undefined8 local_c8 [2];

+  longlong *local_b8;

+  undefined8 local_b0;

+  short local_a8 [64];

+  ulonglong local_28;

   

-                    /* 0x9ab40  253  DnsWriteReverseNameStringForIpAddress */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+                    /* 0x9a790  241  DnsValidateNameOrIp_TempW */

+  local_28 = DAT_0 ^ (ulonglong)auStackY_188;

   if (DAT_1 == 0) {

-    uVar2 = FUN_1800cbc58(param_1,param_2);

+    uVar4 = 0xffffffff;

+    if (param_2 != 0) {

+      uVar4 = param_2;

+    }

+    if ((uVar4 & 3) != 0) {

+      local_158[0] = 0;

+      local_158[3] = 0;

+      local_158[2] = 4;

+      param_3 = local_158 + 2;

+      local_158[4] = 0;

+      local_158[5] = 0;

+      local_158[6] = 0;

+      local_158[7] = 0;

+      iVar2 = GetAddrInfoW(0,0,param_3,local_158);

+      if (iVar2 == 0) {

+        iVar2 = *(int *)(local_158[0] + 4);

+        FreeAddrInfoW();

+        if (iVar2 == 0x17) {

+          if ((uVar4 & 1) == 0) {

+            return 0;

+          }

+          return 1;

+        }

+        if (iVar2 != 2) {

+          return 0;

+        }

+        if ((uVar4 & 2) == 0) {

+          return 0;

+        }

+        return 2;

+      }

+    }

+    if ((uVar4 & 0x200) != 0) {

+      uVar3 = DnsValidateName_W(param_1,3,param_3);

+      if (uVar3 == 0) {

+        return 0x200;

+      }

+      if (uVar3 == 0x2554) {

+        return 0x200;

+      }

+    }

+    if ((uVar4 & 0x100) != 0) {

+      uVar4 = DnsValidateName_W(param_1,3,param_3);

+      if (uVar4 == 0) {

+        return 0x100;

+      }

+      if (uVar4 == 0x2554) {

+        return 0x100;

+      }

+      return 0;

+    }

   }

   else {

-    memset(local_98,0,0x80);

+    memset(local_a8,0,0x80);

     if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

+         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

-      else {

-        bVar1 = true;

-      }

       if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsWriteReverseNameStringForIpAddress";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x26;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+        local_f8 = local_158;

+        local_158[0] = 1;

+        local_f0 = 8;

+        local_e8 = "DnsValidateNameOrIp_TempW";

+        local_e0 = 0x1a;

+        local_d8 = "FALSE";

+        local_d0 = 6;

+        FUN_180055600(local_c8,(undefined *)local_a8);

+        local_b8 = local_158 + 1;

+        local_158[1] = 0x1000000;

+        local_b0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_118);

       }

     }

-    uVar2 = 0;

   }

-  return uVar2;

+  return 0;

 }
```

## `HostsFile_Open`  (modified)

```diff
--- HostsFile_Open
+++ Dns_WriteDottedNameToPacket
@@ -1,74 +1,14 @@
 

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

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

 

-undefined8 HostsFile_Open(longlong *param_1,undefined8 param_2,undefined8 param_3,char *param_4)

+u_short * Dns_WriteDottedNameToPacket

+                    (u_short *param_1,u_short *param_2,WCHAR *param_3,WCHAR *param_4,ushort param_5,

+                    int param_6)

 

 {

-  bool bVar1;

-  undefined8 uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  PEVENT_DATA_DESCRIPTOR in_RAX;

   

-                    /* 0x6b3e0  306  HostsFile_Open */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = FUN_1800dabf8(param_1,param_2,param_3,param_4);

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "HostsFile_Open";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0xf;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0;

-  }

-  return uVar2;

+  FUN_1800e3690(0x180135218,(byte *)param_2,0,(byte)param_4,in_RAX);

+  return (u_short *)0x78;

 }
```

## `DnsValidateUtf8Byte`  (modified)

```diff
--- DnsValidateUtf8Byte
+++ DnsValidateUtf8Byte
@@ -1,80 +1,74 @@
 

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

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

 

-ulonglong DnsValidateUtf8Byte(byte param_1,int *param_2)

+undefined8 DnsValidateUtf8Byte(byte param_1,int *param_2)

 

 {

   bool bVar1;

-  uint uVar2;

-  undefined7 extraout_var;

-  longlong unaff_RBP;

-  DWORD unaff_ESI;

-  DWORD DVar3;

-  DWORD unaff_EDI;

-  undefined8 in_R9;

-  DWORD unaff_R12D;

-  LPSECURITY_ATTRIBUTES unaff_R14;

-  DWORD unaff_R15D;

-  undefined4 in_stack_00000028;

-  undefined4 in_stack_0000002c;

-  HKEY in_stack_00000058;

-  HKEY in_stack_00000060;

-  undefined8 *in_stack_00000068;

-  DWORD in_stack_00000070;

+  undefined8 uVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  bVar1 = FUN_18003b200((uint *)(unaff_RBP + -0x78),(undefined2 *)(ulonglong)((int)unaff_RBP - 0x60)

-                       );

-  DVar3 = unaff_ESI;

-  if ((int)CONCAT71(extraout_var,bVar1) == 0) {

-    uVar2 = 8;

+                    /* 0x9a9e0  250  DnsValidateUtf8Byte */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    uVar2 = FUN_18005d9f4(param_1,param_2);

   }

   else {

-    uVar2 = FUN_18000a2b0(L"Dnscache",(undefined8 *)L"SYSTEM\\CurrentControlSet\\Services\\Dnscache"

-                          ,0x18010c0c8,in_R9,0xf003f,CONCAT44(in_stack_0000002c,in_stack_00000028),

-                          unaff_R15D,&stack0x00000060);

-    if ((((uVar2 == 0) &&

-         (uVar2 = RegCreateKeyExW(in_stack_00000060,(LPCWSTR)(unaff_RBP + -0x60),0,(LPWSTR)0x0,

-                                  unaff_R15D,0xf003f,unaff_R14,&stack0x00000058,&unaff_R14->nLength)

-         , uVar2 == 0)) &&

-        (in_stack_00000070 = unaff_R15D,

-        uVar2 = RegSetValueExW(in_stack_00000058,L"Volatile",0,unaff_R12D,(BYTE *)&stack0x00000070,

-                               unaff_R12D), DVar3 = unaff_R15D, uVar2 == 0)) &&

-       (uVar2 = RegSetValueExW(in_stack_00000058,L"Name",0,7,(BYTE *)(unaff_RBP + 0x40),unaff_EDI),

-       uVar2 == 0)) {

-      in_stack_00000070 = (DWORD)unaff_R14;

-      uVar2 = RegSetValueExW(in_stack_00000058,L"IPSECCARestriction",0,unaff_R15D,

-                             (BYTE *)&stack0x00000070,2);

-      if (uVar2 == 0) {

-        in_stack_00000070 = 2;

-        uVar2 = RegSetValueExW(in_stack_00000058,L"Version",0,unaff_R12D,(BYTE *)&stack0x00000070,

-                               unaff_R12D);

-        if (uVar2 == 0) {

-          in_stack_00000070 = 0x10;

-          uVar2 = RegSetValueExW(in_stack_00000058,L"ConfigOptions",0,unaff_R12D,

-                                 (BYTE *)&stack0x00000070,unaff_R12D);

-          if ((uVar2 == 0) &&

-             (in_stack_00000070 = (DWORD)unaff_R14,

-             uVar2 = RegSetValueExW(in_stack_00000058,L"IDNConfig",0,unaff_R12D,

-                                    (BYTE *)&stack0x00000070,unaff_R12D), uVar2 == 0)) {

-            DnsNotifyResolver(0,0);

-            DVar3 = unaff_ESI;

-          }

-        }

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsValidateUtf8Byte";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x14;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

+    uVar2 = 0;

   }

-  if (in_stack_00000068 != (undefined8 *)0x0) {

-    DnsFreePolicyConfig(in_stack_00000068);

-  }

-  if (in_stack_00000058 != (HKEY)0x0) {

-    RegCloseKey(in_stack_00000058);

-  }

-  if (DVar3 != 0) {

-    RegDeleteKeyExW(in_stack_00000060,(LPCWSTR)(unaff_RBP + -0x60),0,0);

-  }

-  if (in_stack_00000060 != (HKEY)0x0) {

-    RegCloseKey(in_stack_00000060);

-  }

-  return (ulonglong)uVar2;

+  return uVar2;

 }
```

## `Dns_CloseConnection`  (modified)

```diff
--- Dns_CloseConnection
+++ DnsValidateUtf8Byte
@@ -1,70 +1,80 @@
 

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

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

 

-void Dns_CloseConnection(SOCKET param_1)

+ulonglong DnsValidateUtf8Byte(byte param_1,int *param_2)

 

 {

   bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  uint uVar2;

+  undefined7 extraout_var;

+  longlong unaff_RBP;

+  DWORD unaff_ESI;

+  DWORD DVar3;

+  DWORD unaff_EDI;

+  undefined8 in_R9;

+  DWORD unaff_R12D;

+  LPSECURITY_ATTRIBUTES unaff_R14;

+  DWORD unaff_R15D;

+  undefined4 in_stack_00000028;

+  undefined4 in_stack_0000002c;

+  HKEY in_stack_00000058;

+  HKEY in_stack_00000060;

+  undefined8 *in_stack_00000068;

+  DWORD in_stack_00000070;

   

-                    /* 0x9af60  267  Dns_CloseConnection */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 != 0) {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_CloseConnection";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x14;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+  bVar1 = FUN_18003b200((uint *)(unaff_RBP + -0x78),(undefined2 *)(ulonglong)((int)unaff_RBP - 0x60)

+                       );

+  DVar3 = unaff_ESI;

+  if ((int)CONCAT71(extraout_var,bVar1) == 0) {

+    uVar2 = 8;

+  }

+  else {

+    uVar2 = FUN_18000a2b0(L"Dnscache",(undefined8 *)L"SYSTEM\\CurrentControlSet\\Services\\Dnscache"

+                          ,0x18010c0c8,in_R9,0xf003f,CONCAT44(in_stack_0000002c,in_stack_00000028),

+                          unaff_R15D,&stack0x00000060);

+    if ((((uVar2 == 0) &&

+         (uVar2 = RegCreateKeyExW(in_stack_00000060,(LPCWSTR)(unaff_RBP + -0x60),0,(LPWSTR)0x0,

+                                  unaff_R15D,0xf003f,unaff_R14,&stack0x00000058,&unaff_R14->nLength)

+         , uVar2 == 0)) &&

+        (in_stack_00000070 = unaff_R15D,

+        uVar2 = RegSetValueExW(in_stack_00000058,L"Volatile",0,unaff_R12D,(BYTE *)&stack0x00000070,

+                               unaff_R12D), DVar3 = unaff_R15D, uVar2 == 0)) &&

+       (uVar2 = RegSetValueExW(in_stack_00000058,L"Name",0,7,(BYTE *)(unaff_RBP + 0x40),unaff_EDI),

+       uVar2 == 0)) {

+      in_stack_00000070 = (DWORD)unaff_R14;

+      uVar2 = RegSetValueExW(in_stack_00000058,L"IPSECCARestriction",0,unaff_R15D,

+                             (BYTE *)&stack0x00000070,2);

+      if (uVar2 == 0) {

+        in_stack_00000070 = 2;

+        uVar2 = RegSetValueExW(in_stack_00000058,L"Version",0,unaff_R12D,(BYTE *)&stack0x00000070,

+                               unaff_R12D);

+        if (uVar2 == 0) {

+          in_stack_00000070 = 0x10;

+          uVar2 = RegSetValueExW(in_stack_00000058,L"ConfigOptions",0,unaff_R12D,

+                                 (BYTE *)&stack0x00000070,unaff_R12D);

+          if ((uVar2 == 0) &&

+             (in_stack_00000070 = (DWORD)unaff_R14,

+             uVar2 = RegSetValueExW(in_stack_00000058,L"IDNConfig",0,unaff_R12D,

+                                    (BYTE *)&stack0x00000070,unaff_R12D), uVar2 == 0)) {

+            DnsNotifyResolver(0,0);

+            DVar3 = unaff_ESI;

+          }

+        }

       }

     }

   }

-  Socket_CloseEx(param_1,1);

-  return;

+  if (in_stack_00000068 != (undefined8 *)0x0) {

+    DnsFreePolicyConfig(in_stack_00000068);

+  }

+  if (in_stack_00000058 != (HKEY)0x0) {

+    RegCloseKey(in_stack_00000058);

+  }

+  if (DVar3 != 0) {

+    RegDeleteKeyExW(in_stack_00000060,(LPCWSTR)(unaff_RBP + -0x60),0,0);

+  }

+  if (in_stack_00000060 != (HKEY)0x0) {

+    RegCloseKey(in_stack_00000060);

+  }

+  return (ulonglong)uVar2;

 }
```

## `Dns_CloseSocket`  (modified)

```diff
--- Dns_CloseSocket
+++ DnsWriteReverseNameStringForIpAddress
@@ -1,70 +1,60 @@
 

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

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

 

-void Dns_CloseSocket(SOCKET param_1)

+ulonglong DnsWriteReverseNameStringForIpAddress(char *param_1,uint param_2)

 

 {

-  bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  uint uVar1;

+  ulonglong uVar2;

+  longlong unaff_RBP;

+  DWORD unaff_ESI;

+  DWORD unaff_R12D;

+  undefined4 unaff_R14D;

+  DWORD unaff_R15D;

+  uint in_stack_00000058;

+  undefined4 in_stack_0000005c;

+  HKEY in_stack_00000060;

+  undefined8 *in_stack_00000068;

+  undefined4 uStack0000000000000070;

   

-                    /* 0x9b0d0  268  Dns_CloseSocket */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 != 0) {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_CloseSocket";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x10;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+  uStack0000000000000070 = unaff_R14D;

+  uVar1 = RegSetValueExW((HKEY)(ulonglong)in_stack_00000058,L"IPSECCARestriction",0,unaff_R15D,

+                         (BYTE *)&stack0x00000070,2);

+  uVar2 = (ulonglong)uVar1;

+  if (uVar1 == 0) {

+    uStack0000000000000070 = 2;

+    uVar1 = RegSetValueExW((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058),L"Version",0,

+                           unaff_R12D,(BYTE *)&stack0x00000070,unaff_R12D);

+    uVar2 = (ulonglong)uVar1;

+    if (uVar1 == 0) {

+      uStack0000000000000070 = 0x10;

+      uVar1 = RegSetValueExW((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058),L"ConfigOptions",0,

+                             unaff_R12D,(BYTE *)&stack0x00000070,unaff_R12D);

+      uVar2 = (ulonglong)uVar1;

+      if (uVar1 == 0) {

+        uStack0000000000000070 = unaff_R14D;

+        uVar1 = RegSetValueExW((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058),L"IDNConfig",0,

+                               unaff_R12D,(BYTE *)&stack0x00000070,unaff_R12D);

+        uVar2 = (ulonglong)uVar1;

+        if (uVar1 == 0) {

+          DnsNotifyResolver(0,0);

+          unaff_R15D = unaff_ESI;

+        }

       }

     }

   }

-  Socket_CloseEx(param_1,0);

-  return;

+  if (in_stack_00000068 != (undefined8 *)0x0) {

+    DnsFreePolicyConfig(in_stack_00000068);

+  }

+  if ((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058) != (HKEY)0x0) {

+    RegCloseKey((HKEY)CONCAT44(in_stack_0000005c,in_stack_00000058));

+  }

+  if (unaff_R15D != 0) {

+    RegDeleteKeyExW(in_stack_00000060,(LPCWSTR)(unaff_RBP + -0x60),0,0);

+  }

+  if (in_stack_00000060 != (HKEY)0x0) {

+    RegCloseKey(in_stack_00000060);

+  }

+  return uVar2;

 }
```

## `Dns_FindAuthoritativeZoneLib`  (modified)

```diff
--- Dns_FindAuthoritativeZoneLib
+++ Dns_CloseSocket
@@ -1,69 +1,67 @@
 

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

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

 

-undefined8 Dns_FindAuthoritativeZoneLib(void)

+undefined4 Dns_CloseSocket(SOCKET param_1)

 

 {

-  bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined8 uVar1;

+  undefined8 uVar2;

+  undefined8 uVar3;

+  undefined8 uVar4;

+  int in_EDX;

+  undefined4 unaff_EBX;

+  longlong unaff_RBP;

+  undefined4 *unaff_RDI;

+  undefined4 in_XMM0_Da;

+  undefined4 in_XMM0_Db;

+  undefined4 in_XMM0_Dc;

+  undefined4 in_XMM0_Dd;

+  undefined4 in_XMM1_Da;

+  undefined4 in_XMM1_Db;

+  undefined4 in_XMM1_Dc;

+  undefined4 in_XMM1_Dd;

   

-                    /* 0x9b6e0  273  Dns_FindAuthoritativeZoneLib */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 != 0) {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_FindAuthoritativeZoneLib";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x1d;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

+  *unaff_RDI = in_XMM0_Da;

+  unaff_RDI[1] = in_XMM0_Db;

+  unaff_RDI[2] = in_XMM0_Dc;

+  unaff_RDI[3] = in_XMM0_Dd;

+  uVar1 = *(undefined8 *)(unaff_RBP + -0x19);

+  uVar2 = *(undefined8 *)(unaff_RBP + -0x11);

+  unaff_RDI[4] = in_XMM1_Da;

+  unaff_RDI[5] = in_XMM1_Db;

+  unaff_RDI[6] = in_XMM1_Dc;

+  unaff_RDI[7] = in_XMM1_Dd;

+  uVar3 = *(undefined8 *)(unaff_RBP + -9);

+  uVar4 = *(undefined8 *)(unaff_RBP + -1);

+  *(undefined8 *)(unaff_RDI + 8) = uVar1;

+  *(undefined8 *)(unaff_RDI + 10) = uVar2;

+  uVar1 = *(undefined8 *)(unaff_RBP + 7);

+  uVar2 = *(undefined8 *)(unaff_RBP + 0xf);

+  *(undefined8 *)(unaff_RDI + 0xc) = uVar3;

+  *(undefined8 *)(unaff_RDI + 0xe) = uVar4;

+  uVar3 = *(undefined8 *)(unaff_RBP + 0x17);

+  uVar4 = *(undefined8 *)(unaff_RBP + 0x1f);

+  *(undefined8 *)(unaff_RDI + 0x10) = uVar1;

+  *(undefined8 *)(unaff_RDI + 0x12) = uVar2;

+  uVar1 = *(undefined8 *)(unaff_RBP + 0x27);

+  uVar2 = *(undefined8 *)(unaff_RBP + 0x2f);

+  *(undefined8 *)(unaff_RDI + 0x14) = uVar3;

+  *(undefined8 *)(unaff_RDI + 0x16) = uVar4;

+  *(undefined8 *)(unaff_RDI + 0x18) = uVar1;

+  *(undefined8 *)(unaff_RDI + 0x1a) = uVar2;

+  memset((void *)param_1,in_EDX,(ulonglong)(in_EDX + 0x70));

+  DnsFreeNrptRule(unaff_RBP + -0x39);

+  if (*(HKEY *)(unaff_RBP + -0x49) != (HKEY)0x0) {

+    RegCloseKey(*(HKEY *)(unaff_RBP + -0x49));

+    *(undefined8 *)(unaff_RBP + -0x49) = 0;

   }

-  return 0x78;

+  if (*(HKEY *)(unaff_RBP + -0x41) != (HKEY)0x0) {

+    RegCloseKey(*(HKEY *)(unaff_RBP + -0x41));

+    *(undefined8 *)(unaff_RBP + -0x41) = 0;

+  }

+  if ((DAT_0 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x23,0x180110e58,unaff_EBX);

+  }

+  return unaff_EBX;

 }
```

## `Dns_ReadPacketName`  (modified)

```diff
--- Dns_ReadPacketName
+++ DnsStringCopyAllocateEx
@@ -1,75 +1,40 @@
 

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

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

 

-byte * Dns_ReadPacketName(byte *param_1,short *param_2,ushort *param_3,undefined4 *param_4,

-                         byte *param_5,longlong param_6,byte *param_7)

+LPVOID DnsStringCopyAllocateEx(longlong param_1,ulonglong param_2,int param_3,int param_4)

 

 {

-  bool bVar1;

-  byte *pbVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_158 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  uint in_EAX;

+  longlong unaff_RBP;

+  undefined4 uVar1;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-                    /* 0x69e40  283  Dns_ReadPacketName */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

-  if (DAT_1 == 0) {

-    pbVar2 = FUN_18002c150(param_1,param_2,param_3,param_4,param_5,param_6,param_7,0);

+  if ((in_EAX & (uint)param_2) == DAT_0) {

+    uStack000000000000006c = 0;

+    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+    uStack000000000000007c = 0;

+    *(undefined4 *)(unaff_RBP + -0x74) = 0;

+    uVar1 = 8;

+    uStack0000000000000030 = 1;

+    pcStack0000000000000070 = "DnsAddrArrayCreate";

+    *(char **)(unaff_RBP + -0x80) = "FALSE";

+    uStack0000000000000068 = 8;

+    uStack0000000000000078 = 0x13;

+    *(undefined4 *)(unaff_RBP + -0x78) = 6;

+    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+    *(undefined4 *)(unaff_RBP + -0x54) = 0;

+    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+    *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

+    uStack0000000000000038 = 0x1000000;

+    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

   }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_ReadPacketName";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x13;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    pbVar2 = (byte *)0x0;

-  }

-  return pbVar2;

+  return (LPVOID)0x0;

 }
```

## `Dns_ParsePacketRecord`  (modified)

```diff
--- Dns_ParsePacketRecord
+++ Dns_FindAuthoritativeZoneLib
@@ -1,74 +1,23 @@
 

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

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

 

-undefined8 Dns_ParsePacketRecord(byte *param_1,byte *param_2,undefined8 *param_3)

+ulonglong Dns_FindAuthoritativeZoneLib(void)

 

 {

-  bool bVar1;

-  undefined8 uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  ulonglong uVar1;

+  undefined8 *in_RCX;

+  undefined *in_RDX;

+  longlong unaff_RBP;

+  undefined8 uStack0000000000000078;

   

-                    /* 0x9bce0  281  Dns_ParsePacketRecord */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = FUN_1800d39d8(param_1,param_2,param_3);

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_ParsePacketRecord";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x16;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0;

-  }

-  return uVar2;

+  *(undefined8 *)(unaff_RBP + -0x48) = 0x15;

+  *(char **)(unaff_RBP + -0x40) = "FALSE";

+  *(undefined8 *)(unaff_RBP + -0x38) = 6;

+  FUN_180055600(in_RCX,in_RDX);

+  uStack0000000000000078 = 0x1000000;

+  *(undefined8 **)(unaff_RBP + -0x20) = &stack0x00000078;

+  *(undefined8 *)(unaff_RBP + -0x18) = 8;

+  uVar1 = FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -0x80));

+  return uVar1;

 }
```

## `Dns_SetRecordsSection`  (modified)

```diff
--- Dns_SetRecordsSection
+++ Dns_GetRandomXid
@@ -1,79 +1,48 @@
 

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

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

 

-void Dns_SetRecordsSection(longlong *param_1,uint param_2)

+short Dns_GetRandomXid(void)

 

 {

   bool bVar1;

+  ulonglong in_RDX;

+  longlong unaff_RBP;

   undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-                    /* 0x6a570  292  Dns_SetRecordsSection */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    if (param_1 != (longlong *)0x0) {

-      do {

-        *(uint *)((longlong)param_1 + 0x14) =

-             *(uint *)((longlong)param_1 + 0x14) ^

-             (param_2 & 0xffff ^ *(uint *)((longlong)param_1 + 0x14)) & 3;

-        param_1 = (longlong *)*param_1;

-      } while (param_1 != (longlong *)0x0);

-    }

+  if (((_DAT_0 & (uint)in_RDX) == 0) || ((DAT_180135230 & in_RDX) != DAT_180135230)) {

+    bVar1 = false;

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_SetRecordsSection";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x16;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

+    bVar1 = true;

   }

-  return;

+  if (bVar1) {

+    uStack000000000000006c = 0;

+    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+    uStack000000000000007c = 0;

+    *(undefined4 *)(unaff_RBP + -0x74) = 0;

+    uVar2 = 8;

+    uStack0000000000000030 = 1;

+    pcStack0000000000000070 = "DnsCheckNrptRules";

+    *(char **)(unaff_RBP + -0x80) = "FALSE";

+    uStack0000000000000068 = 8;

+    uStack0000000000000078 = 0x12;

+    *(undefined4 *)(unaff_RBP + -0x78) = 6;

+    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+    *(undefined4 *)(unaff_RBP + -0x54) = 0;

+    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+    *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

+    uStack0000000000000038 = 0x1000000;

+    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+  }

+  return 0x78;

 }
```

## `Dns_SetRecordsTtl`  (modified)

```diff
--- Dns_SetRecordsTtl
+++ Dns_InitializeMsgBuf
@@ -1,74 +1,64 @@
 

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

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

 

-void Dns_SetRecordsTtl(undefined8 *param_1,undefined4 param_2)

+ulonglong Dns_InitializeMsgBuf(longlong param_1)

 

 {

   bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  int in_EAX;

+  ulonglong uVar2;

+  int in_EDX;

+  longlong unaff_RBP;

+  undefined4 uVar3;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-                    /* 0x6a6f0  293  Dns_SetRecordsTtl */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    for (; param_1 != (undefined8 *)0x0; param_1 = (undefined8 *)*param_1) {

-      *(undefined4 *)(param_1 + 3) = param_2;

-    }

+  *(ulonglong *)(unaff_RBP + 0x30) = (ulonglong)(in_EAX + 0xcce5b) ^ (ulonglong)&stack0x00000000;

+  if (DAT_0 == 0) {

+    uVar2 = FUN_1800b50a8(param_1,in_EDX);

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    memset((void *)(unaff_RBP + -0x50),0,0x80);

+    if (DAT_1 != 0) {

+      FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40);

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

+    if (5 < DAT_2) {

+      if (((_DAT_3 & 0x400000000000) == 0) ||

+         ((DAT_4 & 0x400000000000) != DAT_4)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_SetRecordsTtl";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x12;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+        uStack000000000000006c = 0;

+        puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+        uStack000000000000007c = 0;

+        *(undefined4 *)(unaff_RBP + -0x74) = 0;

+        uVar3 = 8;

+        uStack0000000000000030 = 1;

+        pcStack0000000000000070 = "DnsDeRegisterLocal";

+        *(char **)(unaff_RBP + -0x80) = "FALSE";

+        uStack0000000000000068 = 8;

+        uStack0000000000000078 = 0x13;

+        *(undefined4 *)(unaff_RBP + -0x78) = 6;

+        FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+        *(undefined4 *)(unaff_RBP + -0x54) = 0;

+        *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+        *(undefined4 *)(unaff_RBP + -0x58) = uVar3;

+        uStack0000000000000038 = 0x1000000;

+        FUN_1800e3690(0x180135218,&DAT_5,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

       }

     }

+    uVar2 = 0x78;

   }

-  return;

+  return uVar2;

 }
```

## `Dns_SetRecordDatalength`  (modified)

```diff
--- Dns_SetRecordDatalength
+++ Dns_PingAdapterServers
@@ -1,72 +1,36 @@
 

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

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

 

-void Dns_SetRecordDatalength(longlong param_1,ushort param_2)

+undefined8 Dns_PingAdapterServers(void)

 

 {

-  bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  ulonglong in_RAX;

+  longlong unaff_RBP;

+  undefined4 uVar1;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  ulonglong uStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-                    /* 0x9c520  290  Dns_SetRecordDatalength */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    *(ushort *)(param_1 + 8) = param_2 >> 8 | param_2 << 8;

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_SetRecordDatalength";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x18;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-  }

-  return;

+  uStack0000000000000060 = in_RAX & 0xffffffffffffff30;

+  uStack000000000000007c = 0;

+  *(undefined4 *)(unaff_RBP + -0x74) = 0;

+  uVar1 = 8;

+  uStack0000000000000030 = 1;

+  pcStack0000000000000070 = "DnsAllocateRecord";

+  *(char **)(unaff_RBP + -0x80) = "FALSE";

+  uStack0000000000000068 = 8;

+  uStack0000000000000078 = 0x12;

+  *(undefined4 *)(unaff_RBP + -0x78) = 6;

+  FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+  *(undefined4 *)(unaff_RBP + -0x54) = 0;

+  *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+  *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

+  uStack0000000000000038 = 0x1000000;

+  FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+  return 0;

 }
```

## `Dns_SkipToRecord`  (modified)

```diff
--- Dns_SkipToRecord
+++ Dns_SendEx
@@ -1,74 +1,81 @@
 

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

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

 

-byte * Dns_SkipToRecord(longlong param_1,byte *param_2,int param_3)

+int Dns_SendEx(longlong param_1,int param_2,undefined4 param_3)

 

 {

   bool bVar1;

-  byte *pbVar2;

+  int iVar2;

   undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

+  undefined1 auStackY_198 [32];

+  undefined8 local_168;

+  undefined8 local_160;

+  undefined2 local_158 [32];

+  _EVENT_DATA_DESCRIPTOR local_118 [2];

+  undefined8 *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  char *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined8 local_c8 [2];

+  undefined8 *local_b8;

+  undefined4 local_b0;

+  undefined4 local_ac;

+  short local_a8 [64];

+  ulonglong local_28;

   

-                    /* 0x9c680  295  Dns_SkipToRecord */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+                    /* 0x9c370  289  Dns_SendEx */

+  local_28 = DAT_0 ^ (ulonglong)auStackY_198;

+  memset(local_158,0,0x40);

   if (DAT_1 == 0) {

-    pbVar2 = FUN_1800d3e24(param_1,param_2,param_3);

+    if (param_2 != 0) {

+      FUN_180018a6c(local_158,param_2,0);

+    }

+    iVar2 = Send_MessagePrivateEx

+                      (param_1,(short *)(-(ulonglong)(param_2 != 0) & (ulonglong)local_158),param_3,

+                       0);

   }

   else {

-    memset(local_98,0,0x80);

+    memset(local_a8,0,0x80);

     if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

+        local_ec = 0;

+        local_f8 = &local_168;

         local_dc = 0;

-        local_e8 = &local_118;

         local_cc = 0;

-        local_bc = 0;

         uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "Dns_SkipToRecord";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x11;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+        local_168 = 1;

+        local_e8 = "Dns_SendEx";

+        local_d8 = "FALSE";

+        local_f0 = 8;

+        local_e0 = 0xb;

+        local_d0 = 6;

+        FUN_180055600(local_c8,(undefined *)local_a8);

+        local_ac = 0;

+        local_b8 = &local_160;

+        local_160 = 0x1000000;

+        local_b0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_118);

       }

     }

-    pbVar2 = (byte *)0x0;

+    iVar2 = 0x78;

   }

-  return pbVar2;

+  return iVar2;

 }
```

## `Dns_SendEx`  (modified)

```diff
--- Dns_SendEx
+++ Dns_ParsePacketRecord
@@ -1,81 +1,17 @@
 

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

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

 

-int Dns_SendEx(longlong param_1,int param_2,undefined4 param_3)

+undefined8 Dns_ParsePacketRecord(byte *param_1,byte *param_2,undefined8 *param_3)

 

 {

-  bool bVar1;

-  int iVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_198 [32];

-  undefined8 local_168;

-  undefined8 local_160;

-  undefined2 local_158 [32];

-  _EVENT_DATA_DESCRIPTOR local_118 [2];

-  undefined8 *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

-  char *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  undefined8 local_c8 [2];

-  undefined8 *local_b8;

-  undefined4 local_b0;

-  undefined4 local_ac;

-  short local_a8 [64];

-  ulonglong local_28;

+  longlong unaff_RBP;

+  undefined4 in_R9D;

+  undefined8 uStack0000000000000038;

   

-                    /* 0x9c370  289  Dns_SendEx */

-  local_28 = DAT_0 ^ (ulonglong)auStackY_198;

-  memset(local_158,0,0x40);

-  if (DAT_1 == 0) {

-    if (param_2 != 0) {

-      FUN_180018a6c(local_158,param_2,0);

-    }

-    iVar2 = Send_MessagePrivateEx

-                      (param_1,(short *)(-(ulonglong)(param_2 != 0) & (ulonglong)local_158),param_3,

-                       0);

-  }

-  else {

-    memset(local_a8,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_a8,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_ec = 0;

-        local_f8 = &local_168;

-        local_dc = 0;

-        local_cc = 0;

-        uVar3 = 8;

-        local_168 = 1;

-        local_e8 = "Dns_SendEx";

-        local_d8 = "FALSE";

-        local_f0 = 8;

-        local_e0 = 0xb;

-        local_d0 = 6;

-        FUN_180055600(local_c8,(undefined *)local_a8);

-        local_ac = 0;

-        local_b8 = &local_160;

-        local_160 = 0x1000000;

-        local_b0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_118);

-      }

-    }

-    iVar2 = 0x78;

-  }

-  return iVar2;

+  *(undefined4 *)(unaff_RBP + -0x58) = in_R9D;

+  uStack0000000000000038 = 0x1000000;

+  FUN_1800e3690(0x180135218,param_2,0,7,

+                (PEVENT_DATA_DESCRIPTOR)((ulonglong)&stack0x00000040 & 0xffffffff));

+  return 0;

 }
```

## `NetInfo_Build`  (modified)

```diff
--- NetInfo_Build
+++ Dns_SetRecordDatalength
@@ -1,79 +1,55 @@
 

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

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

 

-undefined8 NetInfo_Build(uint param_1,undefined4 *param_2,undefined8 param_3,wchar_t *param_4)

+undefined8 Dns_SetRecordDatalength(longlong param_1,ushort param_2)

 

 {

-  bool bVar1;

-  DWORD dwErrCode;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_158 [32];

-  undefined8 local_128;

-  undefined8 local_120;

-  undefined8 local_118 [2];

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  char *pcVar1;

+  bool bVar2;

+  undefined6 in_register_00000012;

+  longlong unaff_RBP;

+  undefined4 uVar3;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-                    /* 0x9caa0  311  NetInfo_Build */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_158;

-  local_128 = 0;

-  if (DAT_1 == 0) {

-    NetInfo_BuildEx(param_1,param_2,(wchar_t *)&local_128,param_4);

-    if (dwErrCode != 0) {

-      SetLastError(dwErrCode);

+  pcVar1 = (char *)(unaff_RBP + 0x48 + CONCAT62(in_register_00000012,param_2));

+  *pcVar1 = *pcVar1 + (char)(param_2 >> 8);

+  FUN_1800ca1b8((LPCSTR)(ulonglong)*(uint *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40);

+  if (5 < DAT_0) {

+    if (((_DAT_1 & 0x400000000000) == 0) ||

+       ((DAT_2 & 0x400000000000) != DAT_2)) {

+      bVar2 = false;

+    }

+    else {

+      bVar2 = true;

+    }

+    if (bVar2) {

+      uStack000000000000006c = 0;

+      puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+      uStack000000000000007c = 0;

+      *(undefined4 *)(unaff_RBP + -0x74) = 0;

+      uVar3 = 8;

+      uStack0000000000000030 = 1;

+      pcStack0000000000000070 = "DnsAsyncRegisterInit";

+      *(char **)(unaff_RBP + -0x80) = "FALSE";

+      uStack0000000000000068 = 8;

+      uStack0000000000000078 = 0x15;

+      *(undefined4 *)(unaff_RBP + -0x78) = 6;

+      FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+      *(undefined4 *)(unaff_RBP + -0x54) = 0;

+      *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+      *(undefined4 *)(unaff_RBP + -0x58) = uVar3;

+      uStack0000000000000038 = 0x1000000;

+      FUN_1800e3690(0x180135218,&DAT_3,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

     }

   }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_120;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_120 = 1;

-        local_d8 = "NetInfo_Build";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0xe;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = local_118;

-        local_118[0] = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    local_128 = 0;

-  }

-  return local_128;

+  return 0x78;

 }
```

## `Dns_WriteQuestionToMessage`  (modified)

```diff
--- Dns_WriteQuestionToMessage
+++ Dns_SetRecordsTtl
@@ -1,65 +1,10 @@
 

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

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

 

-u_short * Dns_WriteQuestionToMessage(longlong param_1,WCHAR *param_2,u_short param_3,int param_4)

+void Dns_SetRecordsTtl(undefined8 *param_1,undefined4 param_2)

 

 {

-  bool bVar1;

-  int iVar2;

-  uint uVar3;

-  LSTATUS LVar4;

-  char *in_RAX;

-  u_short *puVar5;

-  undefined7 extraout_var;

-  undefined4 extraout_var_00;

-  undefined4 extraout_var_01;

-  undefined6 in_register_00000082;

-  PHKEY phkResult;

-  

-  phkResult = (PHKEY)CONCAT62(in_register_00000082,param_3);

-  *in_RAX = *in_RAX + (char)in_RAX;

-  memset(&stack0x00000310,0,0x208);

-  memset(&stack0x00000050,0,0xa2);

-  memset(&stack0x00000100,0,0x208);

-  if (DAT_0 == 0) {

-    if ((phkResult == (PHKEY)0x0) || (param_1 == 0)) {

-      puVar5 = (u_short *)0x57;

-    }

-    else {

-      *phkResult = (HKEY)0x0;

-      bVar1 = FUN_18003b200((uint *)param_1,(undefined2 *)&stack0x00000050);

-      if ((int)CONCAT71(extraout_var,bVar1) == 0) {

-        puVar5 = (u_short *)0xe;

-      }

-      else {

-        iVar2 = FUN_180060cec((wchar_t *)&stack0x00000310,0x208,L"%s\\%s",

-                              L"InterfaceSpecificParameters");

-        if (iVar2 < 0) {

-          puVar5 = (u_short *)0x50c;

-        }

-        else {

-          uVar3 = FUN_1800034d0(L"Dnscache",(uint *)L"SYSTEM\\CurrentControlSet\\Services\\Dnscache"

-                                ,(longlong)&stack0x00000310,(uint *)&stack0x00000100,0x208);

-          if ((int)uVar3 < 0) {

-            puVar5 = (u_short *)FUN_18001aa00(uVar3);

-          }

-          else if ((int)param_2 == 0) {

-            LVar4 = RegOpenKeyExW((HKEY)0xffffffff80000002,(LPCWSTR)&stack0x00000100,0,0x20019,

-                                  phkResult);

-            puVar5 = (u_short *)CONCAT44(extraout_var_01,LVar4);

-          }

-          else {

-            LVar4 = RegCreateKeyExW((HKEY)0xffffffff80000002,(LPCWSTR)&stack0x00000100,0,(LPWSTR)0x0

-                                    ,0,0xf003f,(LPSECURITY_ATTRIBUTES)0x0,phkResult,(LPDWORD)0x0);

-            puVar5 = (u_short *)CONCAT44(extraout_var_00,LVar4);

-          }

-        }

-      }

-    }

-  }

-  else {

-    puVar5 = (u_short *)0x78;

-  }

-  return puVar5;

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

+  halt_baddata();

 }
```

## `DeRefQueryBlobEx`  (modified)

```diff
--- DeRefQueryBlobEx
+++ NetInfo_Free
@@ -1,80 +1,158 @@
 

-void DeRefQueryBlobEx(int *param_1,char *param_2,undefined8 param_3,int param_4)

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

+

+longlong NetInfo_Free(longlong *param_1)

 

 {

-  undefined8 *puVar1;

-  LPVOID pvVar2;

-  uint *in_RAX;

-  longlong unaff_RBX;

-  uint *puVar3;

-  uint unaff_EBP;

+  longlong *plVar1;

+  longlong lVar2;

+  uint uVar3;

   uint uVar4;

-  int *piVar5;

-  uint uVar6;

-  ulonglong uVar7;

+  longlong *plVar5;

+  LPVOID pvVar6;

+  uint uVar7;

+  uint uVar8;

+  uint in_EDX;

+  longlong *unaff_RBX;

+  longlong unaff_RBP;

+  ulonglong uVar9;

+  byte in_R9B;

+  int iVar10;

+  longlong unaff_R12;

+  uint unaff_R13D;

+  longlong lVar11;

+  uint uVar12;

+  uint unaff_R14D;

+  uint unaff_R15D;

+  uint uVar13;

+  byte in_CF;

   

-  puVar1 = (undefined8 *)(unaff_RBX + 0x58);

-  if (in_RAX != (uint *)0x0) {

-    unaff_EBP = *in_RAX;

-    *in_RAX = 0;

-  }

-  if (puVar1 != (undefined8 *)0x0) {

-    pvVar2 = (LPVOID)*puVar1;

-    *puVar1 = 0;

-    if (pvVar2 != (LPVOID)0x0) {

-      uVar7 = 0;

-      if (unaff_EBP != 0) {

-        piVar5 = (int *)((longlong)pvVar2 + 8);

-        do {

-          if (*piVar5 == 1) {

-            FUN_18003b1c0((undefined8 *)((longlong)pvVar2 + uVar7 * 0x18 + 0x10));

+  uVar9 = (ulonglong)-(uint)in_CF;

+code_r0x000180029282:

+  uVar13 = (unaff_R15D & 0xff0000) + 0xffff;

+  do {

+    while( true ) {

+      *(uint *)(unaff_RBP + -0x39) = unaff_R13D;

+      uVar12 = unaff_R14D;

+      if (*(uint *)(unaff_R12 + 4) <= unaff_R13D) break;

+      lVar11 = (ulonglong)unaff_R13D * 0x40 + unaff_R12;

+      if (*(short *)(lVar11 + 0x20) == 2) {

+        uVar12 = *(uint *)(lVar11 + 0x24);

+        uVar8 = in_EDX;

+        uVar3 = unaff_R14D;

+        if (uVar12 != 0xffffffff) {

+          iVar10 = *(int *)(lVar11 + 0x44);

+          *(int *)(unaff_RBP + -0x29) = iVar10;

+          *(uint *)(unaff_RBP + -0x25) = in_EDX;

+          if ((in_R9B & 8) != 0) {

+            FUN_1800f9bbc();

+            uVar8 = *(uint *)(unaff_RBP + 0x17);

+            unaff_R13D = *(uint *)(unaff_RBP + -0x39);

+            iVar10 = *(int *)(unaff_RBP + -0x29);

+            in_EDX = *(uint *)(unaff_RBP + -0x25);

+            in_R9B = DAT_0;

           }

-          else if (*piVar5 == 2) {

-            FUN_18003b1c0((undefined8 *)((longlong)pvVar2 + uVar7 * 0x18 + 0x10));

+          if ((iVar10 - 1U < 0x20) &&

+             (uVar3 = uVar12 ^ in_EDX,

+             (uVar3 >> 0x18 | (uVar3 & 0xff0000) >> 8 | (uVar3 & 0xff00) << 8 | uVar3 << 0x18) >>

+             (0x20U - (char)iVar10 & 0x1f) == 0)) {

+            unaff_R12 = *(longlong *)(unaff_RBP + -0x31);

+            uVar12 = 4;

+            break;

           }

-          uVar4 = (int)uVar7 + 1;

-          uVar7 = (ulonglong)uVar4;

-          piVar5 = piVar5 + 6;

-        } while (uVar4 < unaff_EBP);

+          uVar4 = 3;

+          uVar7 = 0xffffff;

+          do {

+            uVar3 = unaff_R14D;

+            if ((uVar4 <= unaff_R14D) || (uVar3 = uVar4, (uVar7 & (uVar12 ^ uVar8)) == 0)) break;

+            uVar4 = uVar4 - 1;

+            uVar7 = uVar7 >> 8;

+            uVar3 = unaff_R14D;

+          } while (uVar13 <= uVar7);

+        }

+        unaff_R12 = *(longlong *)(unaff_RBP + -0x31);

+        in_EDX = uVar8;

+        unaff_R14D = uVar3;

       }

-      if (DAT_0 == (HANDLE)0x0) {

-        DAT_0 = GetProcessHeap();

+      unaff_R13D = unaff_R13D + 1;

+    }

+    unaff_R14D = 0;

+    plVar5 = unaff_RBX;

+    plVar1 = *(longlong **)(unaff_RBP + -0x21);

+    do {

+      unaff_RBX = plVar1;

+      if ((in_R9B & 8) != 0) {

+        FUN_1800e40f0();

       }

-      HeapFree(DAT_0,0,pvVar2);

-    }

-  }

-  uVar4 = 0;

-  puVar1 = (undefined8 *)(unaff_RBX + 0x68);

-  puVar3 = (uint *)(unaff_RBX + 0x60);

-  if (puVar3 != (uint *)0x0) {

-    uVar4 = *puVar3;

-    *puVar3 = 0;

-  }

-  if (puVar1 != (undefined8 *)0x0) {

-    pvVar2 = (LPVOID)*puVar1;

-    *puVar1 = 0;

-    if (pvVar2 != (LPVOID)0x0) {

-      uVar7 = 0;

-      if (uVar4 != 0) {

-        piVar5 = (int *)((longlong)pvVar2 + 8);

-        do {

-          if (*piVar5 == 1) {

-            FUN_18003b1c0((undefined8 *)((longlong)pvVar2 + uVar7 * 0x18 + 0x10));

+      if (uVar12 == 0) {

+        **(undefined8 **)(unaff_RBP + 0xf) = plVar5;

+        *(longlong **)(unaff_RBP + 0xf) = plVar5;

+LAB_1:

+        plVar5 = *(longlong **)(unaff_RBP + -0x11);

+      }

+      else {

+        if (uVar12 != 4) {

+          **(undefined8 **)(unaff_RBP + -1) = plVar5;

+          *(longlong **)(unaff_RBP + -1) = plVar5;

+          goto LAB_1;

+        }

+        **(undefined8 **)(unaff_RBP + -0x11) = plVar5;

+        *(longlong **)(unaff_RBP + -0x11) = plVar5;

+      }

+      if (unaff_RBX == (longlong *)0x0) {

+        if (*(longlong *)(unaff_RBP + -9) != 0) {

+          *plVar5 = *(longlong *)(unaff_RBP + -9);

+          plVar5 = *(longlong **)(unaff_RBP + -1);

+          *(longlong **)(unaff_RBP + -0x11) = plVar5;

+        }

+        if (*(longlong *)(unaff_RBP + 7) != 0) {

+          *plVar5 = *(longlong *)(unaff_RBP + 7);

+          *(undefined8 *)(unaff_RBP + -0x11) = *(undefined8 *)(unaff_RBP + 0xf);

+        }

+        lVar11 = *(longlong *)(unaff_RBP + -0x19);

+        if ((*(longlong *)(lVar11 + 8) == 0) || ((*(uint *)(lVar11 + 0x14) & 0x2000) == 0)) {

+          lVar2 = *(longlong *)(uVar9 + 8);

+          if ((lVar2 == 0) || ((*(uint *)(uVar9 + 0x14) & 0x2000) == 0)) {

+            uVar13 = *(uint *)(lVar11 + 0x14) >> 3 & 3;

+            pvVar6 = FUN_18002ca60(lVar2,0,uVar13,uVar13);

+            if (pvVar6 == (LPVOID)0x0) {

+              if (*(longlong *)(lVar11 + 8) != 0) {

+                return lVar11;

+              }

+              pvVar6 = *(LPVOID *)(uVar9 + 8);

+              *(uint *)(lVar11 + 0x14) = *(uint *)(lVar11 + 0x14) & 0xffffdfff;

+            }

+            else {

+              *(uint *)(lVar11 + 0x14) = *(uint *)(lVar11 + 0x14) | 0x2000;

+            }

+            *(LPVOID *)(lVar11 + 8) = pvVar6;

           }

-          else if (*piVar5 == 2) {

-            FUN_18003b1c0((undefined8 *)((longlong)pvVar2 + uVar7 * 0x18 + 0x10));

+          else {

+            *(uint *)(lVar11 + 0x14) = *(uint *)(lVar11 + 0x14) | 0x2000;

+            *(longlong *)(lVar11 + 8) = lVar2;

+            *(uint *)(uVar9 + 0x14) = *(uint *)(uVar9 + 0x14) & 0xffffdfff;

           }

-          uVar6 = (int)uVar7 + 1;

-          uVar7 = (ulonglong)uVar6;

-          piVar5 = piVar5 + 6;

-        } while (uVar6 < uVar4);

+        }

+        return lVar11;

       }

-      if (DAT_0 == (HANDLE)0x0) {

-        DAT_0 = GetProcessHeap();

+      plVar1 = (longlong *)*unaff_RBX;

+      in_EDX = *(uint *)(unaff_RBX + 4);

+      *(longlong **)(unaff_RBP + -0x21) = plVar1;

+      *unaff_RBX = 0;

+      *(uint *)(unaff_RBP + 0x17) = in_EDX;

+      if ((DAT_0 & 8) != 0) {

+        FUN_1800f8e30();

+        in_EDX = *(uint *)(unaff_RBP + 0x17);

       }

-      HeapFree(DAT_0,0,pvVar2);

-    }

-  }

-  return;

+      plVar5 = unaff_RBX;

+      in_R9B = DAT_0;

+      uVar12 = unaff_R14D;

+    } while (unaff_R12 == 0);

+    unaff_R13D = unaff_R14D;

+    if ((char)in_EDX < '\0') break;

+    uVar13 = 0xff;

+  } while( true );

+  unaff_R15D = -(uint)((in_EDX & 0x40) != 0);

+  goto code_r0x000180029282;

 }
```

## `QueryDirectEx`  (modified)

```diff
--- QueryDirectEx
+++ Dns_UpdateLibEx
@@ -1,12 +1,41 @@
 

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

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

 

-int QueryDirectEx(longlong *param_1,longlong *param_2,void *param_3,int param_4,WCHAR *param_5,

-                 ushort param_6,undefined8 *param_7,uint param_8,undefined8 param_9)

+undefined8 Dns_UpdateLibEx(void)

 

 {

-  in((short)param_2);

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

-  halt_baddata();

+  uint in_EAX;

+  uint in_EDX;

+  longlong unaff_RBP;

+  undefined4 uVar1;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

+  

+  if ((in_EAX & in_EDX) == DAT_0) {

+    uStack000000000000006c = 0;

+    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+    uStack000000000000007c = 0;

+    *(undefined4 *)(unaff_RBP + -0x74) = 0;

+    uVar1 = 8;

+    uStack0000000000000030 = 1;

+    pcStack0000000000000070 = "DnsBuildDotHost";

+    *(char **)(unaff_RBP + -0x80) = "FALSE";

+    uStack0000000000000068 = 8;

+    uStack0000000000000078 = 0x10;

+    *(undefined4 *)(unaff_RBP + -0x78) = 6;

+    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+    *(undefined4 *)(unaff_RBP + -0x54) = 0;

+    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+    *(undefined4 *)(unaff_RBP + -0x58) = uVar1;

+    uStack0000000000000038 = 0x1000000;

+    FUN_1800e3690(0x180135218,&DAT_1,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+  }

+  return 0x78;

 }
```

## `Socket_SetTtl`  (modified)

```diff
--- Socket_SetTtl
+++ Socket_RecvFrom
@@ -1,209 +1,181 @@
 

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

+/* WARNING: Variable defined which should be unmapped: param_9 */

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

 

-int Socket_SetTtl(SOCKET param_1,int param_2,undefined4 param_3,int param_4,int param_5)

+int Socket_RecvFrom(longlong *param_1,int param_2,undefined8 param_3,undefined4 param_4,

+                   undefined4 *param_5,void *param_6,int *param_7,void *param_8,int *param_9,

+                   undefined4 *param_10)

 

 {

-  longlong lVar1;

-  PTP_TIMER p_Var2;

-  code *pcVar3;

-  undefined8 uVar4;

-  bool bVar5;

-  uint uVar6;

-  ulonglong uVar7;

-  longlong lVar8;

-  int *piVar9;

-  longlong *plVar10;

-  undefined4 in_register_00000014;

-  longlong *plVar11;

-  undefined4 *puVar12;

-  undefined1 *puVar13;

-  longlong lVar14;

-  ulonglong uVar15;

-  undefined4 in_register_00000084;

-  short *psVar16;

-  int iVar17;

-  longlong lVar18;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_188 [8];

-  undefined1 auStackY_180 [24];

-  undefined8 uStack_150;

-  undefined8 auStack_148 [2];

-  _EVENT_DATA_DESCRIPTOR a_Stack_138 [2];

-  undefined8 *puStack_118;

-  undefined8 uStack_110;

-  char *pcStack_108;

-  undefined8 uStack_100;

-  char *pcStack_f8;

-  undefined8 uStack_f0;

-  undefined8 auStack_e8 [2];

-  undefined8 *puStack_d8;

-  undefined8 uStack_d0;

-  short local_c8 [64];

-  ulonglong local_48;

+  undefined8 *puVar1;

+  undefined4 *puVar2;

+  char cVar3;

+  undefined4 uVar4;

+  undefined4 uVar5;

+  undefined4 uVar6;

+  int iVar7;

+  ulonglong uVar8;

+  longlong lVar9;

+  longlong *unaff_RBX;

+  longlong *unaff_RBP;

+  longlong unaff_RSI;

+  longlong unaff_RDI;

+  int iVar10;

+  longlong unaff_R12;

+  int iVar11;

+  int *unaff_R13;

+  longlong unaff_R14;

+  longlong unaff_R15;

+  undefined4 uVar12;

+  PEVENT_DATA_DESCRIPTOR in_stack_00000018;

+  short sStack0000000000000058;

+  undefined4 uStack000000000000005c;

+  undefined8 in_stack_00000060;

+  undefined8 in_stack_00000068;

+  undefined8 in_stack_00000070;

   

-  psVar16 = (short *)CONCAT44(in_register_00000084,param_3);

-  piVar9 = (int *)CONCAT44(in_register_00000014,param_2);

-  puVar13 = auStackY_188;

-  local_48 = DAT_0 ^ (ulonglong)auStackY_188;

-  lVar14 = 0;

-  if ((DAT_1 & 8) != 0) {

-    psVar16 = (short *)&DAT_2;

-    FUN_1800f9070(0x40b,0x1f,0x18010da00,param_1,piVar9);

-  }

-  if ((((param_1 == 0) || (piVar9 == (int *)0x0)) || (*(longlong *)(piVar9 + 0x16) == 0)) ||

-     (lVar1 = *(longlong *)(piVar9 + 0x8a), lVar1 == 0)) {

-    uVar15 = 0x57;

-    puVar13 = auStackY_188;

-    lVar18 = lVar14;

-  }

-  else {

-    lVar14 = *(longlong *)(piVar9 + 0x16);

-    lVar18 = 1;

-    iVar17 = 1;

-    bVar5 = true;

-    *(undefined1 *)(lVar14 + 0x288) = 1;

-    EnterCriticalSection((LPCRITICAL_SECTION)(lVar14 + 0x210));

-    FUN_180052ee8(lVar14,(undefined8 *)(param_1 + 0xbc));

-    uVar4 = *(undefined8 *)(lVar14 + 0x44);

-    *(undefined8 *)(lVar1 + 0x3c) = *(undefined8 *)(lVar14 + 0x3c);

-    *(undefined8 *)(lVar1 + 0x44) = uVar4;

-    uVar4 = *(undefined8 *)(lVar14 + 0x54);

-    *(undefined8 *)(lVar1 + 0x4c) = *(undefined8 *)(lVar14 + 0x4c);

-    *(undefined8 *)(lVar1 + 0x54) = uVar4;

-    uVar4 = *(undefined8 *)(lVar14 + 100);

-    *(undefined8 *)(lVar1 + 0x5c) = *(undefined8 *)(lVar14 + 0x5c);

-    *(undefined8 *)(lVar1 + 100) = uVar4;

-    uVar4 = *(undefined8 *)(lVar14 + 0x74);

-    *(undefined8 *)(lVar1 + 0x6c) = *(undefined8 *)(lVar14 + 0x6c);

-    *(undefined8 *)(lVar1 + 0x74) = uVar4;

-    if ((*(longlong *)(lVar1 + 0x80) != 0) || (*(int *)(lVar1 + 0x88) != 0)) {

-      psVar16 = (short *)0x80;

-      memset(local_c8,0,0x80);

-      if (DAT_3 != 0) {

-        psVar16 = local_c8;

-        FUN_1800ca1b8(unaff_retaddr,0,psVar16,0x40);

+  do {

+    memset(param_1,param_2,0x80);

+    iVar10 = (int)unaff_R12;

+    if (DAT_0 != iVar10) {

+      FUN_1800ca1b8((LPCSTR)unaff_RBP[0x21],0,(short *)(unaff_RBP + 10),0x40);

+    }

+    if (5 < DAT_1) {

+      if (((_DAT_2 & 0x400000000000) == 0) ||

+         (cVar3 = (char)unaff_R13, (DAT_3 & 0x400000000000) != DAT_3)) {

+        cVar3 = (char)unaff_R12;

       }

-      if (5 < DAT_4) {

-        if (((_DAT_5 & 0x400000000000) == 0) ||

-           ((DAT_6 & 0x400000000000) != DAT_6)) {

-          bVar5 = false;

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

+        *unaff_RBP = (longlong)&param_9;

+        unaff_RBP[1] = unaff_R15;

+        unaff_RBP[2] = (longlong)"SendDohQueryToNetinfoServers";

+        unaff_RBP[3] = 0x1d;

+        unaff_RBP[4] = (longlong)"(pDohSettings->Flags & DNS_DOH_SERVER_SETTINGS_ENABLE_DDR) != 0";

+        unaff_RBP[5] = 0x40;

+        param_9 = unaff_R13;

+        FUN_180055600(unaff_RBP + 6,(undefined *)(unaff_RBP + 10));

+        param_8 = (void *)0x1000000;

+        unaff_RBP[8] = (longlong)&param_8;

+        in_stack_00000018 = (PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -4);

+        unaff_RBP[9] = unaff_R15;

+        FUN_1800e3690(0x180135218,&DAT_4,0,7,in_stack_00000018);

+      }

+    }

+    do {

+      if ((DAT_5 & (byte)unaff_R15) != 0) {

+        FUN_1800e551c(0x40b,0x1c7,0x18010da00,*(short **)(unaff_RSI + unaff_R14 * 8));

+      }

+      lVar9 = (ulonglong)*(uint *)((longlong)unaff_RBX + 0x84) * 0x1c;

+      puVar1 = (undefined8 *)(lVar9 + 0x14 + (longlong)unaff_RBX);

+      _sStack0000000000000058 = *puVar1;

+      in_stack_00000060 = puVar1[1];

+      in_stack_00000068 = *(undefined8 *)(lVar9 + 0x24 + (longlong)unaff_RBX);

+      in_stack_00000070 =

+           CONCAT44(in_stack_00000070._4_4_,*(undefined4 *)(lVar9 + 0x2c + (longlong)unaff_RBX));

+      iVar11 = (int)unaff_R13;

+      *(int *)((longlong)unaff_RBX + 0x84) = *(int *)((longlong)unaff_RBX + 0x84) + iVar11;

+      puVar2 = *(undefined4 **)(unaff_RSI + unaff_R14 * 8);

+      uVar8 = CONCAT71((int7)((ulonglong)unaff_R12 >> 8),

+                       *(int *)((longlong)unaff_RBX + 0x84) == (int)unaff_RBX[2]);

+      *(int *)(unaff_RSI + 0x14 + unaff_R14 * 8) = (int)uVar8;

+      uVar12 = *puVar2;

+      uVar4 = puVar2[1];

+      uVar5 = puVar2[2];

+      uVar6 = puVar2[3];

+      *(undefined4 *)(unaff_RBP + -0xc) = uVar12;

+      *(undefined4 *)((longlong)unaff_RBP + -0x5c) = uVar4;

+      *(undefined4 *)(unaff_RBP + -0xb) = uVar5;

+      *(undefined4 *)((longlong)unaff_RBP + -0x54) = uVar6;

+      unaff_RBP[-10] = *(longlong *)(puVar2 + 4);

+      *(undefined4 *)(unaff_RBP + -9) = puVar2[6];

+      if ((DAT_5 & 8) != 0) {

+        in_stack_00000018 =

+             (PEVENT_DATA_DESCRIPTOR)

+             CONCAT44((int)((ulonglong)in_stack_00000018 >> 0x20),

+                      *(undefined4 *)((longlong)unaff_RBX + 0x84));

+        uVar12 = FUN_1800eb270(uVar8 & 0xffffffff,0x1c8,0x18010da00,(int)unaff_RBX[2],

+                               in_stack_00000018,&stack0x00000058);

+      }

+LAB_6:

+      _sStack0000000000000058 = CONCAT22((short)unaff_R12,sStack0000000000000058);

+      in_stack_00000018 =

+           (PEVENT_DATA_DESCRIPTOR)

+           CONCAT62((int6)((ulonglong)in_stack_00000018 >> 0x10),(short)unaff_R12);

+      iVar7 = func_0x000180077ad8(uVar12,(ulonglong)unaff_R13 & 0xffffffff,*unaff_RBX,0,

+                                  in_stack_00000018,&stack0x00000058);

+      if ((iVar7 == 0x2522) || (iVar7 == 0x4c7)) {

+LAB_7:

+        if ((DAT_5 & 8) != 0) {

+          FUN_1800f658c(0x40b,0x1ca,0x18010da00,iVar7);

         }

-        if (bVar5) {

-          puStack_118 = &uStack_150;

-          uStack_150 = 1;

-          uStack_110 = 8;

-          pcStack_108 = "SendTcpMessage";

-          uStack_100 = 0xf;

-          pcStack_f8 = "pRecvMsg->RemoteSecureTemplate == NULL && !pRecvMsg->RemoteIsSecure";

-          uStack_f0 = 0x44;

-          FUN_180055600(auStack_e8,(undefined *)local_c8);

-          puStack_d8 = auStack_148;

-          auStack_148[0] = 0x1000000;

-          uStack_d0 = 8;

-          psVar16 = (short *)0x0;

-          FUN_1800e3690(0x180135218,&DAT_7,0,7,a_Stack_138);

+        return iVar7;

+      }

+      unaff_R15 = 8;

+      while( true ) {

+        uVar8 = (ulonglong)*(uint *)(unaff_RDI + 0x138);

+        if ((uint)param_7 <= *(uint *)(unaff_RDI + 0x138)) goto LAB_7;

+        unaff_R14 = uVar8 * 3;

+        if (*(int *)(unaff_RSI + 0x14 + uVar8 * 0x18) == iVar10) break;

+        if ((DAT_5 & 8) != 0) {

+          FUN_1800e551c(0x40b,0x1c6,0x18010da00,*(short **)(unaff_RSI + uVar8 * 0x18));

+        }

+        *(int *)(unaff_RDI + 0x138) = *(int *)(unaff_RDI + 0x138) + iVar11;

+      }

+      unaff_RBX = *(longlong **)(unaff_RSI + 8 + uVar8 * 0x18);

+      if (*unaff_RBX == unaff_R12) {

+        memset(unaff_RBP + 10,0,0x80);

+        if (DAT_0 != iVar10) {

+          FUN_1800ca1b8((LPCSTR)unaff_RBP[0x21],0,(short *)(unaff_RBP + 10),0x40);

+        }

+        if (5 < DAT_1) {

+          if (((_DAT_2 & 0x400000000000) == 0) ||

+             (cVar3 = (char)unaff_R13, (DAT_3 & 0x400000000000) != DAT_3)) {

+            cVar3 = (char)unaff_R12;

+          }

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

+            *unaff_RBP = (longlong)&param_9;

+            unaff_RBP[1] = 8;

+            unaff_RBP[2] = (longlong)"SendDohQueryToNetinfoServers";

+            unaff_RBP[3] = 0x1d;

+            unaff_RBP[4] = (longlong)"pDohSettings->Template != NULL";

+            unaff_RBP[5] = 0x1f;

+            param_9 = unaff_R13;

+            FUN_180055600(unaff_RBP + 6,(undefined *)(unaff_RBP + 10));

+            param_8 = (void *)0x1000000;

+            unaff_RBP[8] = (longlong)&param_8;

+            in_stack_00000018 = (PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -4);

+            unaff_RBP[9] = 8;

+            FUN_1800e3690(0x180135218,&DAT_8,0,7,in_stack_00000018);

+          }

         }

       }

-    }

-    uVar7 = FUN_18004d0fc(lVar14);

-    uVar15 = uVar7 & 0xffffffff;

-    if ((int)uVar7 == 0) {

-      EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x10160));

-      if (*(int *)(param_1 + 0xa4) == 0) {

-        FUN_18003eed8(piVar9);

-        lVar8 = param_1 + 0x10;

-        plVar11 = *(longlong **)(param_1 + 0x18);

-        plVar10 = (longlong *)(piVar9 + 0x18);

-        if (*plVar11 != lVar8) {

-          plVar10 = (longlong *)0x3;

-          pcVar3 = (code *)swi(0x29);

-          lVar8 = (*pcVar3)();

-          puVar13 = auStackY_180;

+      if ((int)unaff_RBX[2] == iVar10) {

+        puVar1 = *(undefined8 **)(unaff_RSI + uVar8 * 0x18);

+        *(int *)(unaff_RSI + 0x14 + uVar8 * 0x18) = iVar11;

+        _sStack0000000000000058 = *puVar1;

+        in_stack_00000060 = puVar1[1];

+        in_stack_00000068 = puVar1[2];

+        in_stack_00000070 = puVar1[3];

+        uVar12 = *(undefined4 *)(puVar1 + 4);

+        uVar4 = *(undefined4 *)((longlong)puVar1 + 0x24);

+        uVar5 = *(undefined4 *)(puVar1 + 5);

+        uVar6 = *(undefined4 *)((longlong)puVar1 + 0x2c);

+        *(undefined4 *)(unaff_RBP + -0x10) = uVar12;

+        *(undefined4 *)((longlong)unaff_RBP + -0x7c) = uVar4;

+        *(undefined4 *)(unaff_RBP + -0xf) = uVar5;

+        *(undefined4 *)((longlong)unaff_RBP + -0x74) = uVar6;

+        lVar9 = puVar1[7];

+        unaff_RBP[-0xe] = puVar1[6];

+        unaff_RBP[-0xd] = lVar9;

+        if ((DAT_5 & 8) != 0) {

+          uVar12 = FUN_1800e551c(0x40b,0x1c9,0x18010da00,&stack0x00000058);

         }

-        *plVar10 = lVar8;

-        plVar10[1] = (longlong)plVar11;

-        *plVar11 = (longlong)plVar10;

-        *(longlong **)(lVar8 + 8) = plVar10;

-        *(int *)(param_1 + 0x10158) = *(int *)(param_1 + 0x10158) + 1;

-        LOCK();

-        *(int *)(param_1 + 0x1015c) = *(int *)(param_1 + 0x1015c) + 1;

-        UNLOCK();

-        *(SOCKET *)(piVar9 + 0x1c) = param_1;

-        bVar5 = true;

-        if ((DAT_1 & 8) != 0) {

-          *(SOCKET *)(puVar13 + 0x20) = param_1;

-          psVar16 = (short *)&DAT_2;

-          *(undefined8 *)(puVar13 + -8) = 0x1800782f0;

-          FUN_1800f9070(0x40b,0x21,0x18010da00,piVar9,*(undefined8 *)(puVar13 + 0x20));

-        }

-        uVar6 = *(uint *)(lVar1 + 0x270);

-        puVar12 = (undefined4 *)(ulonglong)uVar6;

-        p_Var2 = *(PTP_TIMER *)(lVar14 + 0x200);

-        *(undefined8 *)(puVar13 + -8) = 0x180078303;

-        FUN_18004b4bc(p_Var2,uVar6);

-        if (*(int *)(param_1 + 0xa8) == 0) {

-          *(undefined4 *)(param_1 + 0xa8) = 1;

-          puVar12 = *(undefined4 **)(lVar14 + 0xd0);

-          *(undefined8 *)(puVar13 + -8) = 0x180078322;

-          uVar7 = FUN_180036420((PVOID)param_1,puVar12);

-          uVar6 = (uint)uVar7;

-        }

-        else {

-          *(undefined8 *)(puVar13 + -8) = 0x180078358;

-          uVar7 = FUN_180036dc4(param_1);

-          uVar6 = (uint)uVar7;

-        }

-        uVar15 = (ulonglong)uVar6;

-        if (uVar6 != 0x3e5) {

-          *(undefined8 *)(puVar13 + -8) = 0x180078333;

-          piVar9 = (int *)FUN_180088c10((longlong)piVar9);

-          *(undefined8 *)(puVar13 + -8) = 0x180078344;

-          LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x10160));

-          *(undefined8 *)(puVar13 + -8) = 0x180078351;

-          FUN_180040858(piVar9,puVar12,(undefined *)psVar16);

-          goto LAB_8;

-        }

-        *(uint *)(lVar14 + 0x208) = *(uint *)(lVar14 + 0x208) | 0x80;

+        goto LAB_6;

       }

-      else {

-        uVar15 = 0x2749;

-        puVar13 = auStackY_188;

-      }

-    }

-    else {

-      puVar13 = auStackY_188;

-      if ((DAT_1 & 8) != 0) {

-        psVar16 = (short *)&DAT_2;

-        FUN_1800f658c(0x40b,0x20,0x18010da00,(int)uVar7);

-        puVar13 = auStackY_188;

-      }

-    }

-  }

-  iVar17 = (int)lVar18;

-  bVar5 = false;

-  if (*(int *)(puVar13 + 0x30) != 0) {

-    *(undefined8 *)(puVar13 + -8) = 0x18007839f;

-    LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x10160));

-  }

-LAB_8:

-  if (iVar17 != 0) {

-    *(undefined8 *)(puVar13 + -8) = 0x1800783b7;

-    LeaveCriticalSection((LPCRITICAL_SECTION)(lVar14 + 0x210));

-  }

-  if (bVar5) {

-    p_Var2 = *(PTP_TIMER *)(lVar14 + 0x200);

-    *(undefined8 *)(puVar13 + -8) = 0x1800783cf;

-    FUN_18003d20c(p_Var2,0);

-    *(undefined8 *)(puVar13 + -8) = 0x1800783d9;

-    FUN_1800361ec((longlong *)param_1,uVar15,(undefined *)psVar16);

-  }

-  if ((DAT_1 & 8) != 0) {

-    *(undefined8 *)(puVar13 + -8) = 0x1800783fb;

-    FUN_1800f658c(0x40b,0x22,0x18010da00,(int)uVar15);

-  }

-  *(undefined8 *)(puVar13 + -8) = 0x180078409;

-  return (int)uVar15;

+    } while ((*(byte *)(unaff_RBX + 1) & 0x10) != 0);

+    param_2 = 0;

+    param_1 = unaff_RBP + 10;

+  } while( true );

 }
```

## `Query_Cancel`  (modified)

```diff
--- Query_Cancel
+++ Query_Cancel
@@ -1,19 +1,103 @@
 

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

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

 

 ulonglong Query_Cancel(longlong *param_1,int param_2,undefined4 param_3)

 

 {

-  ulonglong in_RAX;

-  undefined4 unaff_ESI;

-  ulonglong unaff_R14;

-  undefined4 unaff_R15D;

-  longlong in_stack_00000048;

+  longlong *plVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  bool bVar4;

+  int iVar5;

+  ulonglong uVar6;

+  ulonglong uVar7;

+  longlong *plVar8;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_168 [32];

+  undefined8 local_138;

+  undefined8 local_130;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  undefined8 local_d8 [2];

+  undefined8 *local_c8;

+  undefined8 local_c0;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  *(undefined4 *)((in_RAX & 0xffffffffffffff40) + 0x60) = unaff_ESI;

-  *(undefined4 *)((in_RAX & 0xffffffffffffff40) + 0x5c) = unaff_R15D;

-  *(undefined4 *)(in_stack_00000048 + 0x50) = unaff_ESI;

-  *(undefined4 *)(in_stack_00000048 + 0x4c) = unaff_R15D;

-  return unaff_R14 & 0xffffffff;

+                    /* 0x71fd0  329  Query_Cancel */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

+  uVar6 = 0;

+  local_138 = CONCAT44(local_138._4_4_,param_3);

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f7f58(0x40b,0x1a4,0x18010c5a0,param_1);

+  }

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar5 = FUN_1800ca394(unaff_retaddr), iVar5 != 0)) {

+    if ((*(int *)((longlong)param_1 + 0x1dc) == 0) || (param_1[0x3e] == 0)) {

+      uVar6 = FUN_180052344((int *)param_1);

+    }

+    else {

+      AddRefQueryBlobEx((int *)param_1,"Query_Cancel",0x3573,0xc);

+      lVar2 = param_1[0x3e];

+      EnterCriticalSection((LPCRITICAL_SECTION)(lVar2 + 0x18));

+      plVar8 = param_1 + 0x11;

+      do {

+        if ((*(byte *)(lVar2 + 0x10) & 0x40) != 0) break;

+        plVar1 = plVar8 + -0x11;

+        plVar3 = (longlong *)*plVar8;

+        if (((int)local_138 == 0) || (plVar1 != param_1)) {

+          if ((param_2 == 0) && (*(uint *)(plVar8 + 0x2e) < *(uint *)(param_1 + 0x3f))) break;

+          if ((*(uint *)(plVar8 + 0x51) & 0x1300) == 0) {

+            AddRefQueryBlobEx((int *)plVar1,"Query_Cancel",0x359f,0xc);

+            LeaveCriticalSection((LPCRITICAL_SECTION)(lVar2 + 0x18));

+            uVar7 = FUN_180052344((int *)plVar1);

+            uVar6 = uVar7 & 0xffffffff;

+            if (((int)uVar7 != 0) && ((DAT_1 & 8) != 0)) {

+              FUN_1800f8aec(0x40b,0x1a5,0x18010c5a0,(int)plVar8[0x2e]);

+            }

+            DeRefQueryBlobEx((int *)plVar1,"Query_Cancel",0x35ab,0xc);

+            EnterCriticalSection((LPCRITICAL_SECTION)(lVar2 + 0x18));

+          }

+        }

+        plVar8 = plVar3;

+      } while (plVar3 != param_1 + 0x11);

+      LeaveCriticalSection((LPCRITICAL_SECTION)(lVar2 + 0x18));

+      DeRefQueryBlobEx((int *)param_1,"Query_Cancel",0x35b6,0xc);

+    }

+  }

+  else {

+    memset(local_b8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         (bVar4 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar4 = false;

+      }

+      if (bVar4) {

+        local_108 = &local_138;

+        local_138 = 1;

+        local_100 = 8;

+        local_e8 = "FALSE";

+        local_f8 = "Query_Cancel";

+        local_f0 = 0xd;

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_c8 = &local_130;

+        local_130 = 0x1000000;

+        local_c0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

+      }

+    }

+    uVar6 = 0x78;

+  }

+  return uVar6;

 }
```

## `WriteDnsNrptRulesToRegistry`  (modified)

```diff
--- WriteDnsNrptRulesToRegistry
+++ Send_AndRecvUdpWithParam
@@ -1,74 +1,20 @@
 

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

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

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

 

-uint WriteDnsNrptRulesToRegistry(uint param_1,undefined8 *param_2,longlong param_3,wchar_t *param_4)

+uint Send_AndRecvUdpWithParam(byte *param_1)

 

 {

-  bool bVar1;

-  uint uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  int *piVar1;

+  char in_AL;

+  undefined7 in_register_00000001;

+  char *unaff_RDI;

   

-                    /* 0x6c4a0  361  WriteDnsNrptRulesToRegistry */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = FUN_1800acae8(param_1,param_2,param_3,param_4);

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "WriteDnsNrptRulesToRegistry";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x1c;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0x78;

-  }

-  return uVar2;

+  piVar1 = (int *)(CONCAT71(in_register_00000001,in_AL) + -0x39);

+  *piVar1 = *piVar1 + -1;

+  *(char *)CONCAT71(in_register_00000001,in_AL) =

+       *(char *)CONCAT71(in_register_00000001,in_AL) + in_AL;

+  *unaff_RDI = *unaff_RDI + (char)param_1;

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

+  halt_baddata();

 }
```

## `DnsFreeConfigStructure`  (modified)

```diff
--- DnsFreeConfigStructure
+++ DnsCheckNrptRuleIntegrity
@@ -1,22 +1,28 @@
 

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

 

-undefined4 DnsFreeConfigStructure(uint *param_1,int param_2)

+ulonglong DnsCheckNrptRuleIntegrity(int *param_1)

 

 {

-  undefined4 extraout_EAX;

-  char *in_RAX;

-  undefined4 in_register_00000014;

-  longlong *unaff_RDI;

-  undefined8 in_R8;

-  wchar_t *in_R9;

+  ulonglong in_RAX;

+  byte *pbVar1;

+  ulonglong uVar2;

+  undefined *in_RDX;

+  longlong unaff_RBP;

+  undefined8 uStack0000000000000038;

+  undefined4 uStack0000000000000078;

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  FUN_18007c6a0((wchar_t *)param_1,CONCAT44(in_register_00000014,param_2),in_R8,in_R9);

-  FUN_18002a140(unaff_RDI);

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x18,0x180110d78,extraout_EAX);

-  }

-  return extraout_EAX;

+  pbVar1 = (byte *)(in_RAX & 0xffffffffffffff68);

+  *pbVar1 = *pbVar1 | (byte)pbVar1;

+  *pbVar1 = *pbVar1 + (byte)pbVar1;

+  uStack0000000000000078 = 0x1f;

+  *(undefined4 *)(unaff_RBP + -0x78) = 6;

+  FUN_180055600((undefined8 *)param_1,in_RDX);

+  *(undefined4 *)(unaff_RBP + -0x54) = 0;

+  *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+  uStack0000000000000038 = 0x1000000;

+  *(undefined4 *)(unaff_RBP + -0x58) = 8;

+  uVar2 = FUN_1800e3690(0x180135218,&DAT_0,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+  return uVar2;

 }
```

## `Socket_CleanupWinsock`  (modified)

```diff
--- Socket_CleanupWinsock
+++ Socket_CleanupWinsock
@@ -1,81 +1,69 @@
 

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

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

 

-ulonglong Socket_CleanupWinsock(void)

+void Socket_CleanupWinsock(void)

 

 {

-  longlong lVar1;

-  longlong *plVar2;

-  bool bVar3;

-  ulonglong uVar4;

-  uint in_ECX;

-  uint uVar5;

-  uint uVar6;

-  longlong unaff_RBP;

-  bool in_ZF;

-  undefined8 uStack0000000000000040;

-  undefined8 uStack0000000000000048;

-  undefined1 *puStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  bool bVar1;

+  undefined4 uVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  lVar1 = *(longlong *)(unaff_RBP + 0xa0);

-  plVar2 = *(longlong **)(unaff_RBP + 0xa8);

-  if (in_ZF) {

-    uVar6 = *(uint *)(unaff_RBP + 0xb8);

-    if ((DAT_0 & 8) != 0) {

-      FUN_1800e738c();

+                    /* 0x9d3e0  343  Socket_CleanupWinsock */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 != 0) {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    uVar5 = uVar6 | 2;

-    if (lVar1 == 0) {

-      uVar5 = uVar6;

-    }

-    uVar6 = uVar5 | 0x100;

-    if ((uVar5 >> 9 & 1) != 0) {

-      uVar6 = uVar5;

-    }

-    if ((plVar2 != (longlong *)0x0) && (*plVar2 != 0)) {

-      uVar6 = uVar6 | 0x1000;

-    }

-    uVar4 = FUN_1800570f4((wchar_t *)(ulonglong)in_ECX,uVar6);

-    uVar4 = uVar4 & 0xffffffff;

-    FUN_1800570cc(plVar2);

-  }

-  else {

-    memset((void *)(unaff_RBP + -0x40),0,0x80);

-    if (DAT_1 != 0) {

-      FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x68),0,(short *)(unaff_RBP + -0x40),0x40);

-    }

-    if (5 < DAT_2) {

-      if (((_DAT_3 & 0x400000000000) == 0) ||

-         ((DAT_4 & 0x400000000000) != DAT_4)) {

-        bVar3 = false;

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

       }

       else {

-        bVar3 = true;

+        bVar1 = true;

       }

-      if (bVar3) {

-        uStack000000000000007c = 0;

-        puStack0000000000000070 = (undefined1 *)&stack0x00000040;

-        *(undefined4 *)(unaff_RBP + -0x74) = 0;

-        *(undefined4 *)(unaff_RBP + -100) = 0;

-        *(char **)(unaff_RBP + -0x80) = "DnsDhcpRegisterHostAddrs";

-        *(char **)(unaff_RBP + -0x70) = "FALSE";

-        uStack0000000000000040 = 1;

-        uStack0000000000000078 = 8;

-        *(undefined4 *)(unaff_RBP + -0x78) = 0x19;

-        *(undefined4 *)(unaff_RBP + -0x68) = 6;

-        FUN_180055600((undefined8 *)(unaff_RBP + -0x60),(undefined *)(unaff_RBP + -0x40));

-        *(undefined4 *)(unaff_RBP + -0x44) = 0;

-        *(undefined8 **)(unaff_RBP + -0x50) = &stack0x00000048;

-        uStack0000000000000048 = 0x1000000;

-        *(undefined4 *)(unaff_RBP + -0x48) = 8;

-        FUN_1800e3690(0x180135218,&DAT_5,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000050);

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar2 = 8;

+        local_118 = 1;

+        local_d8 = "Socket_CleanupWinsock";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x16;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar2;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar4 = 0x78;

   }

-  return uVar4;

+  return;

 }
```

## `DnsCreateStandardDnsNameCopy`  (modified)

```diff
--- DnsCreateStandardDnsNameCopy
+++ DnsBuildDotHost
@@ -1,74 +1,10 @@
 

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

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

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

 

-LPVOID DnsCreateStandardDnsNameCopy(LPCWSTR param_1,uint param_2,undefined8 param_3)

+STRSAFE_LPWSTR DnsBuildDotHost(wchar_t *param_1,ushort param_2,undefined8 *param_3)

 

 {

-  bool bVar1;

-  LPVOID pvVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

-  

-                    /* 0x96d40  62  DnsCreateStandardDnsNameCopy */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    pvVar2 = FUN_1800cc7e8(param_1,param_2,param_3);

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsCreateStandardDnsNameCopy";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x1d;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    pvVar2 = (LPVOID)0x0;

-  }

-  return pvVar2;

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

+  halt_baddata();

 }
```

## `DnsAddrArrayCreate`  (modified)

```diff
--- DnsAddrArrayCreate
+++ DnsAddrArrayCreate
@@ -1,58 +1,74 @@
 

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

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

 

 uint * DnsAddrArrayCreate(uint param_1)

 

 {

-  undefined8 *puVar1;

-  undefined8 *puVar2;

-  void *pvVar3;

-  undefined8 uVar4;

-  LPVOID pvVar5;

-  LPVOID pvVar6;

-  uint unaff_EBX;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  longlong lVar7;

-  uint *unaff_R12;

-  uint uVar8;

-  uint unaff_R14D;

-  undefined8 *unaff_R15;

+  bool bVar1;

+  uint *puVar2;

+  undefined4 uVar3;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-  pvVar5 = FUN_18008a630((ulonglong)(uint)(unaff_ESI * 0x38));

-  if (pvVar5 == (LPVOID)0x0) {

-LAB_0:

-    unaff_EBX = 0xe;

+                    /* 0x680d0  24  DnsAddrArrayCreate */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    puVar2 = FUN_180016230(param_1);

   }

   else {

-    uVar8 = unaff_EBX;

-    if (unaff_R14D != 0) {

-      do {

-        lVar7 = (ulonglong)uVar8 * 0x38;

-        if (((*(int *)(lVar7 + unaff_RBP) == 2) || (*(int *)(lVar7 + unaff_RBP) == 3)) &&

-           (pvVar3 = *(void **)(lVar7 + 0x10 + unaff_RBP), pvVar3 != (void *)0x0)) {

-          pvVar6 = FUN_180016e10(pvVar3);

-          *(LPVOID *)(lVar7 + 0x10 + (longlong)pvVar5) = pvVar6;

-          if (pvVar6 == (LPVOID)0x0) goto LAB_0;

-        }

-        puVar1 = (undefined8 *)(lVar7 + 0x18 + unaff_RBP);

-        uVar4 = puVar1[1];

-        uVar8 = uVar8 + 1;

-        puVar2 = (undefined8 *)(lVar7 + 0x18 + (longlong)pvVar5);

-        *puVar2 = *puVar1;

-        puVar2[1] = uVar4;

-        *(undefined8 *)(lVar7 + 0x28 + (longlong)pvVar5) = *(undefined8 *)(lVar7 + 0x28 + unaff_RBP)

-        ;

-        *(undefined4 *)(lVar7 + 0x30 + (longlong)pvVar5) = *(undefined4 *)(lVar7 + 0x30 + unaff_RBP)

-        ;

-        *(undefined4 *)(lVar7 + (longlong)pvVar5) = *(undefined4 *)(lVar7 + unaff_RBP);

-        *(undefined8 *)(lVar7 + 8 + (longlong)pvVar5) = *(undefined8 *)(lVar7 + 8 + unaff_RBP);

-      } while (uVar8 < unaff_R14D);

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    *unaff_R12 = unaff_R14D;

-    *unaff_R15 = pvVar5;

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      else {

+        bVar1 = true;

+      }

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "DnsAddrArrayCreate";

+        local_c8 = "FALSE";

+        local_e0 = 8;

+        local_d0 = 0x13;

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+    puVar2 = (uint *)0x0;

   }

-  DnsFreeCustomServers((uint *)&stack0x00000028,(undefined8 *)&stack0x00000020);

-  return (uint *)(ulonglong)unaff_EBX;

+  return puVar2;

 }
```

## `NetInfo_ResetServerPriorities`  (modified)

```diff
--- NetInfo_ResetServerPriorities
+++ NetInfo_GetAdapterByAddress
@@ -1,33 +1,55 @@
 

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

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

 

-undefined4 NetInfo_ResetServerPriorities(longlong *param_1,int param_2)

+longlong NetInfo_GetAdapterByAddress(longlong param_1,short *param_2,uint param_3)

 

 {

-  int *in_RAX;

-  undefined4 unaff_EBX;

+  bool bVar1;

   longlong unaff_RBP;

-  byte unaff_R12B;

-  undefined8 *unaff_R14;

-  undefined8 *unaff_R15;

+  undefined4 in_register_00000084;

+  undefined4 uVar2;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-  *in_RAX = *in_RAX + (int)in_RAX;

-  *(char *)in_RAX = (char)*in_RAX + (char)in_RAX;

-  if (unaff_R15 == (undefined8 *)0x0) {

-    FUN_18002a140(*(longlong **)(unaff_RBP + -0x28));

+  memset((void *)param_1,(int)param_2,CONCAT44(in_register_00000084,param_3));

+  if (DAT_0 != 0) {

+    FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40);

   }

-  else {

-    *unaff_R15 = *(undefined8 *)(unaff_RBP + -0x28);

+  if (5 < DAT_1) {

+    if (((_DAT_2 & 0x400000000000) == 0) ||

+       ((DAT_3 & 0x400000000000) != DAT_3)) {

+      bVar1 = false;

+    }

+    else {

+      bVar1 = true;

+    }

+    if (bVar1) {

+      uStack000000000000006c = 0;

+      puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+      uStack000000000000007c = 0;

+      *(undefined4 *)(unaff_RBP + -0x74) = 0;

+      uVar2 = 8;

+      uStack0000000000000030 = 1;

+      pcStack0000000000000070 = "WriteDnsNrptRulesToRegistry";

+      *(char **)(unaff_RBP + -0x80) = "FALSE";

+      uStack0000000000000068 = 8;

+      uStack0000000000000078 = 0x1c;

+      *(undefined4 *)(unaff_RBP + -0x78) = 6;

+      FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+      *(undefined4 *)(unaff_RBP + -0x54) = 0;

+      *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+      *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

+      uStack0000000000000038 = 0x1000000;

+      FUN_1800e3690(0x180135218,&DAT_4,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+    }

   }

-  if (unaff_R14 == (undefined8 *)0x0) {

-    FUN_18002a140(*(longlong **)(unaff_RBP + -0x20));

-  }

-  else {

-    *unaff_R14 = *(undefined8 *)(unaff_RBP + -0x20);

-  }

-  if ((DAT_0 & unaff_R12B) != 0) {

-    FUN_1800f7614(0x40b,0x2d,0x180111c20);

-  }

-  return unaff_EBX;

+  return 0x78;

 }
```

## `NetInfo_IsAddrConfig`  (modified)

```diff
--- NetInfo_IsAddrConfig
+++ NetInfo_IsAddrConfig
@@ -1,34 +1,69 @@
 

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

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

 

 uint NetInfo_IsAddrConfig(longlong param_1,short param_2)

 

 {

-  undefined1 *puVar1;

-  longlong in_RAX;

-  uint uVar2;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  ULONGLONG unaff_RSI;

-  undefined4 in_R9D;

-  undefined8 unaff_R12;

-  undefined2 unaff_R14W;

+  bool bVar1;

+  int iVar2;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-  *(char *)(unaff_RBP + -0x74eb8a25) =

-       *(char *)(unaff_RBP + -0x74eb8a25) + ((byte)in_RAX | (byte)*(undefined4 *)(in_RAX * 2));

-  *(byte *)(param_1 + -0x46) = *(byte *)(param_1 + -0x46) | (byte)((ushort)param_2 >> 8);

-  puVar1 = (undefined1 *)(unaff_RBX + -0x31 + param_1 * 4);

-  *puVar1 = *puVar1;

-  FUN_1800f658c(unaff_R14W,param_2,unaff_RSI,in_R9D);

-  func_0x0001800300ac(*(undefined8 *)(unaff_RBP + -0x31));

-  *(undefined8 *)(unaff_RBP + -0x31) = unaff_R12;

-  QueryPerformanceCounter((LARGE_INTEGER *)(unaff_RBP + -0x29));

-  uVar2 = (uint)unaff_RBX;

-  FUN_18002e5ac((int)*(undefined8 *)(unaff_RBP + -0x29) - (int)*(undefined8 *)(unaff_RBP + -0x21),2,

-                uVar2);

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(unaff_R14W,0x6c,unaff_RSI,uVar2);

+                    /* 0xf630  321  NetInfo_IsAddrConfig */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    if (param_1 != 0) {

+      if (param_2 == 1) {

+        return *(uint *)(param_1 + 0x38) & 0x20;

+      }

+      if (param_2 == 0x1c) {

+        return (uint)((*(uint *)(param_1 + 0x38) & 0x8000200) != 0);

+      }

+      return 1;

+    }

   }

-  return uVar2;

+  else {

+    memset(local_98,0,0x80);

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_e8 = &local_118;

+        local_118 = 1;

+        local_e0 = 8;

+        local_d8 = "NetInfo_IsAddrConfig";

+        local_d0 = 0x15;

+        local_c8 = "FALSE";

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+      }

+    }

+  }

+  return 0;

 }
```

## `Socket_CloseMessageSockets`  (modified)

```diff
--- Socket_CloseMessageSockets
+++ Reg_GetValueEx
@@ -1,34 +1,10 @@
 

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

-

-void Socket_CloseMessageSockets(void)

+uint Reg_GetValueEx(HKEY *param_1,HKEY param_2,LPCWSTR param_3,uint param_4,DWORD param_5,

+                   uint param_6,LPCWSTR param_7)

 

 {

-  byte *pbVar1;

-  int in_EAX;

-  undefined4 in_register_00000004;

-  byte in_CL;

-  undefined1 in_CH;

-  undefined6 in_register_0000000a;

-  char in_DH;

-  char *unaff_RBX;

-  char *unaff_RDI;

-  longlong in_R9;

+  uint in_EAX;

   

-  unaff_RBX[CONCAT62(in_register_0000000a,CONCAT11(in_CH,in_CL)) * 4 + -99] =

-       unaff_RBX[CONCAT62(in_register_0000000a,CONCAT11(in_CH,in_CL)) * 4 + -99] + in_CL;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + (char)in_EAX;

-  *unaff_RDI = *unaff_RDI + in_CL;

-  *(int *)CONCAT44(in_register_00000004,in_EAX) =

-       *(int *)CONCAT44(in_register_00000004,in_EAX) + in_EAX;

-  *unaff_RBX = *unaff_RBX + in_DH;

-  pbVar1 = (byte *)(CONCAT44(in_register_00000004,in_EAX) + -0x73);

-  *pbVar1 = *pbVar1 >> (in_CL & 7) | *pbVar1 << 8 - (in_CL & 7);

-  *(undefined1 *)(in_R9 + -0x48) = *(undefined1 *)(in_R9 + -0x48);

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + (char)in_EAX;

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

-  halt_baddata();

+  return in_EAX;

 }
```

## `Socket_RecvFrom`  (modified)

```diff
--- Socket_RecvFrom
+++ Socket_RecvFrom
@@ -1,181 +1,287 @@
 

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

-/* WARNING: Variable defined which should be unmapped: param_9 */

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

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

 

-int Socket_RecvFrom(longlong *param_1,int param_2,undefined8 param_3,undefined4 param_4,

-                   undefined4 *param_5,void *param_6,int *param_7,void *param_8,int *param_9,

-                   undefined4 *param_10)

+ulonglong Socket_RecvFrom(undefined8 param_1,undefined4 param_2,undefined8 param_3,

+                         undefined4 param_4,undefined4 *param_5,void *param_6,int *param_7,

+                         void *param_8,int *param_9,undefined4 *param_10)

 

 {

-  undefined8 *puVar1;

-  undefined4 *puVar2;

-  char cVar3;

-  undefined4 uVar4;

-  undefined4 uVar5;

-  undefined4 uVar6;

-  int iVar7;

-  ulonglong uVar8;

+  byte bVar1;

+  byte bVar2;

+  undefined8 uVar3;

+  bool bVar4;

+  longlong lVar5;

+  undefined1 *puVar6;

+  uint uVar7;

+  int iVar8;

   longlong lVar9;

-  longlong *unaff_RBX;

-  longlong *unaff_RBP;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  int iVar10;

-  longlong unaff_R12;

-  int iVar11;

-  int *unaff_R13;

-  longlong unaff_R14;

-  longlong unaff_R15;

-  undefined4 uVar12;

-  PEVENT_DATA_DESCRIPTOR in_stack_00000018;

-  short sStack0000000000000058;

-  undefined4 uStack000000000000005c;

-  undefined8 in_stack_00000060;

-  undefined8 in_stack_00000068;

-  undefined8 in_stack_00000070;

+  byte *pbVar10;

+  byte *pbVar11;

+  ulonglong uVar12;

+  byte bVar13;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_238 [32];

+  EVENT_DESCRIPTOR local_1e0;

+  code *local_1d0;

+  undefined4 local_1c8;

+  undefined4 local_1c4;

+  undefined8 local_1c0;

+  void *local_1b8;

+  int local_1b0;

+  undefined4 local_1ac;

+  undefined4 *local_1a8;

+  undefined4 local_1a0;

+  undefined4 local_19c;

+  uint local_198;

+  undefined4 local_194;

+  undefined1 *local_190;

+  undefined4 local_188;

+  undefined4 local_184;

+  uint local_180 [2];

+  undefined4 local_178;

+  undefined4 local_174;

+  undefined4 local_170;

+  undefined4 local_16c;

+  int *local_168;

+  undefined8 local_160;

+  _EVENT_DATA_DESCRIPTOR local_158;

+  undefined *local_148;

+  undefined4 local_140;

+  undefined4 local_13c;

+  int **local_138;

+  undefined8 local_130;

+  char *local_128;

+  undefined8 local_120;

+  char *local_118;

+  undefined8 local_110;

+  short *local_108;

+  int local_100;

+  undefined4 local_fc;

+  undefined8 *local_f8;

+  undefined8 local_f0;

+  short local_e8 [64];

+  undefined1 local_68 [40];

+  ulonglong local_40;

   

-  do {

-    memset(param_1,param_2,0x80);

-    iVar10 = (int)unaff_R12;

-    if (DAT_0 != iVar10) {

-      FUN_1800ca1b8((LPCSTR)unaff_RBP[0x21],0,(short *)(unaff_RBP + 10),0x40);

+                    /* 0x7aff0  351  Socket_RecvFrom */

+  local_40 = DAT_0 ^ (ulonglong)auStackY_238;

+  local_168 = param_9;

+  local_160 = CONCAT44(local_160._4_4_,param_2);

+  local_1c4 = 0;

+  local_1ac = 0;

+  local_19c = 0;

+  local_194 = 0;

+  local_184 = 0;

+  local_180[0] = 0;

+  local_1d0 = (code *)0x0;

+  local_178 = 0xf689d7c8;

+  local_174 = 0x436b6f1f;

+  local_170 = 0x4fe5538a;

+  local_16c = 0x22c351e3;

+  if (((DAT_1 == 0) || (DAT_18013630c != 0)) ||

+     (iVar8 = FUN_1800ca394(unaff_retaddr), iVar8 != 0)) {

+    iVar8 = WSAIoctl(param_1,0xc8000006,&local_178,0x10);

+    if (iVar8 != -1) {

+      local_1a8 = &local_1c8;

+      local_1b0 = *param_7;

+      local_190 = local_68;

+      local_188 = *param_5;

+      local_1a0 = 1;

+      local_1b8 = param_6;

+      local_198 = 0x28;

+      local_1c8 = param_4;

+      local_1c0 = param_3;

+      iVar8 = (*local_1d0)(param_1,&local_1b8,local_180,0);

+      uVar7 = local_180[0];

+      puVar6 = local_190;

+      if (iVar8 != -1) {

+        *param_7 = local_1b0;

+        *param_5 = local_188;

+        *param_10 = 0;

+        if ((0xf < local_198) && (local_190 != (undefined1 *)0x0)) {

+          if ((int)local_160 == 2) {

+            *param_10 = *(undefined4 *)(local_190 + 0x14);

+            iVar8 = *param_7;

+            *local_168 = iVar8;

+            memcpy(param_8,param_6,(longlong)iVar8);

+            *(undefined4 *)((longlong)param_8 + 4) = *(undefined4 *)(puVar6 + 0x10);

+            return (ulonglong)uVar7;

+          }

+          *param_10 = *(undefined4 *)(local_190 + 0x20);

+          iVar8 = *param_7;

+          *local_168 = iVar8;

+          memcpy(param_8,param_6,(longlong)iVar8);

+          uVar3 = *(undefined8 *)(puVar6 + 0x18);

+          *(undefined8 *)((longlong)param_8 + 8) = *(undefined8 *)(puVar6 + 0x10);

+          *(undefined8 *)((longlong)param_8 + 0x10) = uVar3;

+          return (ulonglong)uVar7;

+        }

+        if ((DAT_2 & 0x10) != 0) {

+          FUN_1800f71b8(0x404,0x35,0x180110260,param_1);

+        }

+        return (ulonglong)uVar7;

+      }

     }

-    if (5 < DAT_1) {

-      if (((_DAT_2 & 0x400000000000) == 0) ||

-         (cVar3 = (char)unaff_R13, (DAT_3 & 0x400000000000) != DAT_3)) {

-        cVar3 = (char)unaff_R12;

-      }

-      if (cVar3 != '\0') {

-        *unaff_RBP = (longlong)&param_9;

-        unaff_RBP[1] = unaff_R15;

-        unaff_RBP[2] = (longlong)"SendDohQueryToNetinfoServers";

-        unaff_RBP[3] = 0x1d;

-        unaff_RBP[4] = (longlong)"(pDohSettings->Flags & DNS_DOH_SERVER_SETTINGS_ENABLE_DDR) != 0";

-        unaff_RBP[5] = 0x40;

-        param_9 = unaff_R13;

-        FUN_180055600(unaff_RBP + 6,(undefined *)(unaff_RBP + 10));

-        param_8 = (void *)0x1000000;

-        unaff_RBP[8] = (longlong)&param_8;

-        in_stack_00000018 = (PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -4);

-        unaff_RBP[9] = unaff_R15;

-        FUN_1800e3690(0x180135218,&DAT_4,0,7,in_stack_00000018);

-      }

+    uVar12 = 0xffffffffffffffff;

+  }

+  else {

+    local_e8[0] = 0;

+    local_e8[1] = 0;

+    local_e8[2] = 0;

+    local_e8[3] = 0;

+    local_e8[4] = 0;

+    local_e8[5] = 0;

+    local_e8[6] = 0;

+    local_e8[7] = 0;

+    local_e8[8] = 0;

+    local_e8[9] = 0;

+    local_e8[10] = 0;

+    local_e8[0xb] = 0;

+    local_e8[0xc] = 0;

+    local_e8[0xd] = 0;

+    local_e8[0xe] = 0;

+    local_e8[0xf] = 0;

+    local_e8[0x10] = 0;

+    local_e8[0x11] = 0;

+    local_e8[0x12] = 0;

+    local_e8[0x13] = 0;

+    local_e8[0x14] = 0;

+    local_e8[0x15] = 0;

+    local_e8[0x16] = 0;

+    local_e8[0x17] = 0;

+    local_e8[0x18] = 0;

+    local_e8[0x19] = 0;

+    local_e8[0x1a] = 0;

+    local_e8[0x1b] = 0;

+    local_e8[0x1c] = 0;

+    local_e8[0x1d] = 0;

+    local_e8[0x1e] = 0;

+    local_e8[0x1f] = 0;

+    local_e8[0x20] = 0;

+    local_e8[0x21] = 0;

+    local_e8[0x22] = 0;

+    local_e8[0x23] = 0;

+    local_e8[0x24] = 0;

+    local_e8[0x25] = 0;

+    local_e8[0x26] = 0;

+    local_e8[0x27] = 0;

+    local_e8[0x28] = 0;

+    local_e8[0x29] = 0;

+    local_e8[0x2a] = 0;

+    local_e8[0x2b] = 0;

+    local_e8[0x2c] = 0;

+    local_e8[0x2d] = 0;

+    local_e8[0x2e] = 0;

+    local_e8[0x2f] = 0;

+    local_e8[0x30] = 0;

+    local_e8[0x31] = 0;

+    local_e8[0x32] = 0;

+    local_e8[0x33] = 0;

+    local_e8[0x34] = 0;

+    local_e8[0x35] = 0;

+    local_e8[0x36] = 0;

+    local_e8[0x37] = 0;

+    local_e8[0x38] = 0;

+    local_e8[0x39] = 0;

+    local_e8[0x3a] = 0;

+    local_e8[0x3b] = 0;

+    local_e8[0x3c] = 0;

+    local_e8[0x3d] = 0;

+    local_e8[0x3e] = 0;

+    local_e8[0x3f] = 0;

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_e8,0x40);

     }

-    do {

-      if ((DAT_5 & (byte)unaff_R15) != 0) {

-        FUN_1800e551c(0x40b,0x1c7,0x18010da00,*(short **)(unaff_RSI + unaff_R14 * 8));

-      }

-      lVar9 = (ulonglong)*(uint *)((longlong)unaff_RBX + 0x84) * 0x1c;

-      puVar1 = (undefined8 *)(lVar9 + 0x14 + (longlong)unaff_RBX);

-      _sStack0000000000000058 = *puVar1;

-      in_stack_00000060 = puVar1[1];

-      in_stack_00000068 = *(undefined8 *)(lVar9 + 0x24 + (longlong)unaff_RBX);

-      in_stack_00000070 =

-           CONCAT44(in_stack_00000070._4_4_,*(undefined4 *)(lVar9 + 0x2c + (longlong)unaff_RBX));

-      iVar11 = (int)unaff_R13;

-      *(int *)((longlong)unaff_RBX + 0x84) = *(int *)((longlong)unaff_RBX + 0x84) + iVar11;

-      puVar2 = *(undefined4 **)(unaff_RSI + unaff_R14 * 8);

-      uVar8 = CONCAT71((int7)((ulonglong)unaff_R12 >> 8),

-                       *(int *)((longlong)unaff_RBX + 0x84) == (int)unaff_RBX[2]);

-      *(int *)(unaff_RSI + 0x14 + unaff_R14 * 8) = (int)uVar8;

-      uVar12 = *puVar2;

-      uVar4 = puVar2[1];

-      uVar5 = puVar2[2];

-      uVar6 = puVar2[3];

-      *(undefined4 *)(unaff_RBP + -0xc) = uVar12;

-      *(undefined4 *)((longlong)unaff_RBP + -0x5c) = uVar4;

-      *(undefined4 *)(unaff_RBP + -0xb) = uVar5;

-      *(undefined4 *)((longlong)unaff_RBP + -0x54) = uVar6;

-      unaff_RBP[-10] = *(longlong *)(puVar2 + 4);

-      *(undefined4 *)(unaff_RBP + -9) = puVar2[6];

-      if ((DAT_5 & 8) != 0) {

-        in_stack_00000018 =

-             (PEVENT_DATA_DESCRIPTOR)

-             CONCAT44((int)((ulonglong)in_stack_00000018 >> 0x20),

-                      *(undefined4 *)((longlong)unaff_RBX + 0x84));

-        uVar12 = FUN_1800eb270(uVar8 & 0xffffffff,0x1c8,0x18010da00,(int)unaff_RBX[2],

-                               in_stack_00000018,&stack0x00000058);

-      }

-LAB_6:

-      _sStack0000000000000058 = CONCAT22((short)unaff_R12,sStack0000000000000058);

-      in_stack_00000018 =

-           (PEVENT_DATA_DESCRIPTOR)

-           CONCAT62((int6)((ulonglong)in_stack_00000018 >> 0x10),(short)unaff_R12);

-      iVar7 = func_0x000180077ad8(uVar12,(ulonglong)unaff_R13 & 0xffffffff,*unaff_RBX,0,

-                                  in_stack_00000018,&stack0x00000058);

-      if ((iVar7 == 0x2522) || (iVar7 == 0x4c7)) {

-LAB_7:

-        if ((DAT_5 & 8) != 0) {

-          FUN_1800f658c(0x40b,0x1ca,0x18010da00,iVar7);

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar4 = false;

+      }

+      else {

+        bVar4 = true;

+      }

+      if (bVar4) {

+        local_138 = &local_168;

+        local_168 = (int *)0x1;

+        local_130 = 8;

+        local_128 = "Socket_RecvFrom";

+        local_120 = 0x10;

+        local_118 = "FALSE";

+        lVar9 = -1;

+        local_110 = 6;

+        do {

+          lVar5 = lVar9 + 1;

+          lVar9 = lVar9 + 1;

+        } while (local_e8[lVar5] != 0);

+        local_100 = (int)lVar9 * 2 + 2;

+        local_fc = 0;

+        local_108 = local_e8;

+        local_f8 = &local_160;

+        local_1e0.Level = '\x05';

+        local_1e0.Opcode = '\0';

+        local_1e0.Task = 0;

+        local_158.Ptr = (ULONGLONG)PTR_DAT_7;

+        local_160 = 0x1000000;

+        local_f0 = 8;

+        local_1e0.Id = 0;

+        local_1e0.Version = '\0';

+        local_1e0.Channel = '\v';

+        local_1e0.Keyword = 0x400000000000;

+        local_158.Size = (ULONG)*(ushort *)PTR_DAT_7;

+        local_148 = &DAT_8;

+        local_158.Reserved = 2;

+        local_140 = 0x52;

+        local_13c = 1;

+        if (DAT_9 == FUN_18004e7b0) {

+          bVar13 = 0;

+          pbVar10 = &DAT_10;

+          do {

+            bVar1 = *pbVar10;

+            pbVar10 = pbVar10 + 1;

+          } while ((char)bVar1 < '\0');

+          do {

+            bVar1 = *pbVar10;

+            pbVar10 = pbVar10 + 1;

+          } while (bVar1 != 0);

+          uVar12 = 0;

+          if (pbVar10 < &DAT_11) {

+            while( true ) {

+              do {

+                pbVar11 = pbVar10;

+                bVar13 = (byte)uVar12;

+                pbVar10 = pbVar11 + 1;

+              } while (*pbVar11 != 0);

+              bVar1 = pbVar11[1];

+              if (-1 < (char)bVar1) break;

+              pbVar10 = pbVar11 + 3;

+              if (-1 < (char)pbVar11[2]) break;

+              bVar2 = *pbVar10;

+              while ((char)bVar2 < '\0') {

+                if (bVar2 != 0x80) goto LAB_12;

+                pbVar11 = pbVar10 + 1;

+                pbVar10 = pbVar10 + 1;

+                bVar2 = *pbVar11;

+              }

+              if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar2 + 0x8f))) break;

+              bVar13 = bVar13 + 1;

+              *(byte *)((longlong)&local_130 + uVar12 * 0x10 + 5) = bVar2;

+              uVar12 = (ulonglong)bVar13;

+              if (&UNK_13 < pbVar10) break;

+            }

+          }

+LAB_12:

+          if (bVar13 != 0) {

+            FUN_1800e3380(0x180135218,(undefined8 *)&local_1e0,7,(longlong)&local_158,bVar13);

+            return 0x78;

+          }

+          EventWriteTransfer(DAT_14,&local_1e0,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_158);

         }

-        return iVar7;

-      }

-      unaff_R15 = 8;

-      while( true ) {

-        uVar8 = (ulonglong)*(uint *)(unaff_RDI + 0x138);

-        if ((uint)param_7 <= *(uint *)(unaff_RDI + 0x138)) goto LAB_7;

-        unaff_R14 = uVar8 * 3;

-        if (*(int *)(unaff_RSI + 0x14 + uVar8 * 0x18) == iVar10) break;

-        if ((DAT_5 & 8) != 0) {

-          FUN_1800e551c(0x40b,0x1c6,0x18010da00,*(short **)(unaff_RSI + uVar8 * 0x18));

-        }

-        *(int *)(unaff_RDI + 0x138) = *(int *)(unaff_RDI + 0x138) + iVar11;

-      }

-      unaff_RBX = *(longlong **)(unaff_RSI + 8 + uVar8 * 0x18);

-      if (*unaff_RBX == unaff_R12) {

-        memset(unaff_RBP + 10,0,0x80);

-        if (DAT_0 != iVar10) {

-          FUN_1800ca1b8((LPCSTR)unaff_RBP[0x21],0,(short *)(unaff_RBP + 10),0x40);

-        }

-        if (5 < DAT_1) {

-          if (((_DAT_2 & 0x400000000000) == 0) ||

-             (cVar3 = (char)unaff_R13, (DAT_3 & 0x400000000000) != DAT_3)) {

-            cVar3 = (char)unaff_R12;

-          }

-          if (cVar3 != '\0') {

-            *unaff_RBP = (longlong)&param_9;

-            unaff_RBP[1] = 8;

-            unaff_RBP[2] = (longlong)"SendDohQueryToNetinfoServers";

-            unaff_RBP[3] = 0x1d;

-            unaff_RBP[4] = (longlong)"pDohSettings->Template != NULL";

-            unaff_RBP[5] = 0x1f;

-            param_9 = unaff_R13;

-            FUN_180055600(unaff_RBP + 6,(undefined *)(unaff_RBP + 10));

-            param_8 = (void *)0x1000000;

-            unaff_RBP[8] = (longlong)&param_8;

-            in_stack_00000018 = (PEVENT_DATA_DESCRIPTOR)(unaff_RBP + -4);

-            unaff_RBP[9] = 8;

-            FUN_1800e3690(0x180135218,&DAT_8,0,7,in_stack_00000018);

-          }

-        }

-      }

-      if ((int)unaff_RBX[2] == iVar10) {

-        puVar1 = *(undefined8 **)(unaff_RSI + uVar8 * 0x18);

-        *(int *)(unaff_RSI + 0x14 + uVar8 * 0x18) = iVar11;

-        _sStack0000000000000058 = *puVar1;

-        in_stack_00000060 = puVar1[1];

-        in_stack_00000068 = puVar1[2];

-        in_stack_00000070 = puVar1[3];

-        uVar12 = *(undefined4 *)(puVar1 + 4);

-        uVar4 = *(undefined4 *)((longlong)puVar1 + 0x24);

-        uVar5 = *(undefined4 *)(puVar1 + 5);

-        uVar6 = *(undefined4 *)((longlong)puVar1 + 0x2c);

-        *(undefined4 *)(unaff_RBP + -0x10) = uVar12;

-        *(undefined4 *)((longlong)unaff_RBP + -0x7c) = uVar4;

-        *(undefined4 *)(unaff_RBP + -0xf) = uVar5;

-        *(undefined4 *)((longlong)unaff_RBP + -0x74) = uVar6;

-        lVar9 = puVar1[7];

-        unaff_RBP[-0xe] = puVar1[6];

-        unaff_RBP[-0xd] = lVar9;

-        if ((DAT_5 & 8) != 0) {

-          uVar12 = FUN_1800e551c(0x40b,0x1c9,0x18010da00,&stack0x00000058);

-        }

-        goto LAB_6;

-      }

-    } while ((*(byte *)(unaff_RBX + 1) & 0x10) != 0);

-    param_2 = 0;

-    param_1 = unaff_RBP + 10;

-  } while( true );

+      }

+    }

+    uVar12 = 0x78;

+  }

+  return uVar12;

 }
```

## `DnsAsyncRegisterInit`  (modified)

```diff
--- DnsAsyncRegisterInit
+++ DnsAllocateRecord
@@ -1,74 +1,46 @@
 

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

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

-

-uint DnsAsyncRegisterInit(void)

+LPVOID DnsAllocateRecord(ushort param_1)

 

 {

-  bool bVar1;

-  uint uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  uint uVar1;

+  u_short uVar2;

+  u_short *puVar3;

+  undefined6 in_register_0000000a;

+  u_short *puVar4;

+  uint *in_RDX;

+  WCHAR *in_R8;

+  u_short in_R9W;

+  u_short in_stack_00000028;

+  int in_stack_00000030;

   

-                    /* 0x964c0  35  DnsAsyncRegisterInit */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = DnsDhcpRegisterInit();

+                    /* 0x91900  252  DnsWriteQuestionToBuffer_W */

+  puVar4 = (u_short *)CONCAT62(in_register_0000000a,param_1);

+  uVar1 = *in_RDX;

+  if (uVar1 < 0x5c0) {

+    *in_RDX = 0x5c0;

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    puVar4[0] = 0;

+    puVar4[1] = 0;

+    puVar4[2] = 0;

+    puVar4[3] = 0;

+    puVar4[4] = 0;

+    puVar4[5] = 0;

+    puVar3 = FUN_1800d3f10(puVar4 + 6,(u_short *)((longlong)puVar4 + (ulonglong)uVar1),in_R8,

+                           (WCHAR *)0x0,0,1);

+    if (puVar3 != (u_short *)0x0) {

+      uVar2 = htons(in_R9W);

+      *puVar3 = uVar2;

+      puVar3[1] = 0x100;

+      uVar2 = htons(1);

+      puVar4[2] = uVar2;

+      *(byte *)(puVar4 + 1) = in_stack_00000030 != 0 | (byte)puVar4[1] & 0xfe;

+      uVar2 = htons(in_stack_00000028);

+      *puVar4 = uVar2;

+      *in_RDX = ((int)puVar3 - (int)puVar4) + 4;

+      return (LPVOID)0x1;

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsAsyncRegisterInit";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x15;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0x78;

   }

-  return uVar2;

+  return (LPVOID)0x0;

 }
```

## `DnsGetDnsServerList`  (modified)

```diff
--- DnsGetDnsServerList
+++ DnsDhcpSrvRegisterInit
@@ -1,77 +1,58 @@
 

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

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

-

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

+DWORD DnsDhcpSrvRegisterInit(longlong *param_1,uint param_2)

 

 {

-  bool bVar1;

-  uint *puVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  DWORD DVar1;

+  undefined8 uVar2;

+  int *unaff_RBX;

+  bool in_ZF;

+  undefined8 uStack0000000000000040;

+  undefined8 uStack0000000000000048;

   

-                    /* 0x97b50  117  DnsGetDnsServerList */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    puVar2 = FUN_180050a3c((PCNZWCH)0x0,param_2,param_3);

-    *param_1 = puVar2;

-    if (puVar2 != (uint *)0x0) {

-      return *puVar2;

+  if (!in_ZF) {

+    FUN_1800f71b8(0x40b,0x23,0x18010fd18,unaff_RBX);

+  }

+  uStack0000000000000040 = *(undefined8 *)(unaff_RBX + 0x44);

+  uStack0000000000000048 = *(undefined8 *)(unaff_RBX + 0x46);

+  uVar2 = FUN_1800ca6a0((int *)&stack0x00000040);

+  DVar1 = (DWORD)uVar2;

+  if (DVar1 == 0) {

+    FUN_180021fa0(*(wchar_t **)(unaff_RBX + 0x38),(uint)*(ushort *)(unaff_RBX + 0x40),

+                  *(undefined8 *)(unaff_RBX + 0x42),

+                  *(undefined4 *)(*(longlong *)(unaff_RBX + 0x4a) + 4),

+                  *(undefined8 **)(*(longlong *)(unaff_RBX + 0x4a) + 0x10));

+    if ((DAT_0 & 8) != 0) {

+      FUN_1800e6e70();

     }

+    if (unaff_RBX[0x44] == 1) {

+      FUN_180062648(*(undefined8 **)(unaff_RBX + 0x4a),*(undefined **)(unaff_RBX + 0x46),

+                    *(undefined8 *)(unaff_RBX + 0x48));

+    }

+    else {

+      FUN_1800c155c((undefined4 *)*(undefined8 **)(unaff_RBX + 0x4a),

+                    *(undefined **)(unaff_RBX + 0x46),*(undefined8 *)(unaff_RBX + 0x48));

+    }

+    unaff_RBX[0x4a] = 0;

+    unaff_RBX[0x4b] = 0;

+    if (*(HANDLE *)(unaff_RBX + 0x124) != (HANDLE)0x0) {

+      SetEvent(*(HANDLE *)(unaff_RBX + 0x124));

+    }

+    if (*(LPVOID *)(unaff_RBX + 0x102) != (LPVOID)0x0) {

+      DnsApiFree(*(LPVOID *)(unaff_RBX + 0x102));

+      unaff_RBX[0x102] = 0;

+      unaff_RBX[0x103] = 0;

+    }

+    DVar1 = DeRefQueryBlobEx(unaff_RBX,"InProc_ProcessQueryCallback",0x59d,2);

   }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  else if (*(longlong *)(unaff_RBX + 0x124) != 0) {

+    if ((DAT_0 & 8) != 0) {

+      FUN_1800e6df4();

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsGetDnsServerList";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x14;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

+    DVar1 = SetEvent(*(HANDLE *)(unaff_RBX + 0x124));

   }

-  return 0;

+  if ((DAT_0 & 8) != 0) {

+    DVar1 = FUN_1800f7614(0x40b,0x26,0x18010fd18);

+  }

+  return DVar1;

 }
```

## `DnsGetBufferLengthForStringCopy`  (modified)

```diff
--- DnsGetBufferLengthForStringCopy
+++ DnsDhcpSrvRegisterHostName
@@ -1,75 +1,72 @@
 

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

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

-

-uint DnsGetBufferLengthForStringCopy(LPCWSTR param_1,ulonglong param_2,int param_3,int param_4)

+ulonglong DnsDhcpSrvRegisterHostName

+                    (undefined8 *param_1,undefined8 param_2,undefined4 param_3,undefined4 param_4,

+                    undefined8 param_5,undefined8 param_6,void *param_7,uint param_8)

 

 {

-  bool bVar1;

-  uint uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  uint uVar1;

+  ulonglong in_RAX;

+  undefined8 uVar2;

+  PCERT_INFO unaff_RBX;

+  BYTE *unaff_RBP;

+  BYTE *unaff_RSI;

+  ulonglong uVar3;

+  undefined4 in_register_00000084;

+  undefined4 in_register_0000008c;

+  FILETIME *unaff_R14;

+  uint *unaff_R15;

+  DWORD in_XMM0_Da;

+  DWORD in_XMM0_Db;

+  DWORD in_XMM0_Dc;

+  DWORD in_XMM0_Dd;

+  FILETIME FStackX_20;

+  undefined4 in_stack_00000078;

+  undefined4 in_stack_00000080;

+  undefined4 in_stack_00000088;

+  undefined4 in_stack_00000090;

+  undefined8 in_stack_000000a0;

   

-                    /* 0x979d0  110  DnsGetBufferLengthForStringCopy */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = FUN_1800505a0(param_1,param_2,2 - (uint)(param_3 != 0),2 - (uint)(param_4 != 0));

-    uVar2 = uVar2 & 0xffff;

+  unaff_RBX[4].rgExtension = (PCERT_EXTENSION)(in_RAX & 0xffffffffffffff70);

+  *(undefined4 *)&unaff_RBX[1].SubjectUniqueId.field_0x14 = in_stack_00000090;

+  *(undefined4 *)&unaff_RBX[1].field_0xc4 = in_stack_00000078;

+  *(undefined8 *)&unaff_RBX[1].Subject = in_stack_000000a0;

+  unaff_RBX[5].Subject.pbData = (BYTE *)FUN_180092b40;

+  *(BYTE **)&unaff_RBX[1].IssuerUniqueId.cUnusedBits = unaff_RBP + 0x10;

+  *(undefined4 *)&unaff_RBX[1].rgExtension = in_stack_00000080;

+  *(undefined4 *)((longlong)&unaff_RBX[1].rgExtension + 4) = in_stack_00000088;

+  unaff_RBX[1].NotBefore.dwLowDateTime = in_XMM0_Da;

+  unaff_RBX[1].NotBefore.dwHighDateTime = in_XMM0_Db;

+  unaff_RBX[1].NotAfter.dwLowDateTime = in_XMM0_Dc;

+  unaff_RBX[1].NotAfter.dwHighDateTime = in_XMM0_Dd;

+  unaff_RBX[1].Subject.pbData = unaff_RBP;

+  unaff_RBX[5].SubjectPublicKeyInfo.PublicKey.pbData = unaff_RSI;

+  *(uint **)&unaff_RBX[1].IssuerUniqueId = unaff_R15;

+  if ((*unaff_R15 >> 9 & 1) != 0) {

+    *(BYTE **)&unaff_RBX[1].SubjectUniqueId = unaff_RBP + 0x18;

+  }

+  uVar1 = FUN_180072480(unaff_RBX,param_2,CONCAT44(in_register_00000084,param_3),

+                        (PCERT_INFO)CONCAT44(in_register_0000008c,param_4));

+  uVar3 = (ulonglong)uVar1;

+  if (uVar1 == 0x2522) {

+    FStackX_20 = unaff_RBX[1].NotBefore;

+    uVar2 = FUN_1800ca6a0((int *)&FStackX_20);

+    if ((int)uVar2 != 0) {

+      WaitForSingleObject(unaff_RSI,0xffffffff);

+      uVar1 = *(uint *)((longlong)&unaff_RBX[2].Subject.pbData + 4);

+      uVar3 = (ulonglong)uVar1;

+      if (uVar1 != 0x2522) goto LAB_0;

+    }

+    FStackX_20 = *unaff_R14;

+    uVar2 = FUN_1800ca6a0((int *)&FStackX_20);

+    if ((int)uVar2 == 0) {

+      return uVar3;

+    }

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "DnsGetBufferLengthForStringCopy";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x20;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0;

+    *(uint *)(unaff_RBP + 4) = uVar1;

   }

-  return uVar2;

+LAB_0:

+  DeRefQueryBlobEx((int *)unaff_RBX,"InProc_InitiateQuery",0x6ec,2);

+  return uVar3;

 }
```

## `Coalesce_UpdateNetVersion`  (modified)

```diff
--- Coalesce_UpdateNetVersion
+++ DnsUpdateMachinePresence
@@ -1,62 +1,55 @@
 

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

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

 

-int Coalesce_UpdateNetVersion(void)

+int DnsUpdateMachinePresence(void)

 

 {

-  int *piVar1;

-  int iVar2;

-  longlong in_RAX;

-  char in_CL;

-  SOCKET SVar3;

-  short *unaff_RBX;

-  int unaff_ESI;

-  SOCKET unaff_RDI;

-  longlong in_R8;

-  undefined8 uVar4;

-  char *optval;

-  int unaff_R14D;

-  u_long unaff_R15D;

-  int optlen;

-  undefined4 in_stack_00000040;

-  u_long in_stack_00000044;

-  undefined8 in_stack_00000050;

-  undefined8 in_stack_00000058;

+  bool bVar1;

+  undefined8 in_RAX;

+  char *pcVar2;

+  byte in_CL;

+  longlong unaff_RBP;

+  undefined4 uVar3;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined1 *puStack0000000000000060;

+  undefined4 uStack0000000000000068;

+  undefined4 uStack000000000000006c;

+  char *pcStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-  *(char *)(in_RAX + -0x73) = *(char *)(in_RAX + -0x73) + in_CL;

-  piVar1 = (int *)(in_R8 + -0x7d);

-  *piVar1 = *piVar1 + -1;

-  if ((*piVar1 == 0) && ((unaff_R14D != 0 || (unaff_ESI != 0)))) {

-    if (*unaff_RBX == 2) {

-      in_stack_00000040 = *(undefined4 *)(unaff_RBX + 2);

-      in_stack_00000044 = htonl(unaff_R15D);

-      optlen = 8;

-      optval = (char *)&stack0x00000040;

-      iVar2 = 0;

-    }

-    else {

-      in_stack_00000050 = *(undefined8 *)(unaff_RBX + 4);

-      in_stack_00000058 = *(undefined8 *)(unaff_RBX + 8);

-      optval = (char *)&stack0x00000050;

-      optlen = 0x14;

-      iVar2 = 0x29;

-    }

-    uVar4 = 0xc;

-    SVar3 = unaff_RDI;

-    iVar2 = setsockopt(unaff_RDI,iVar2,0xc,optval,optlen);

-    if (iVar2 == -1) {

-      iVar2 = WSAGetLastError();

-      if ((DAT_0 & 8) != 0) {

-        FUN_1800e6694(SVar3,0x1b,uVar4,unaff_RDI);

-      }

-    }

-    else {

-      iVar2 = 0;

-    }

+  bRam0babfb3d830004fb = (byte)in_RAX >> (in_CL & 0x1f);

+  pcVar2 = (char *)CONCAT71((int7)((ulonglong)in_RAX >> 8),bRam0babfb3d830004fb);

+  cRam0000000180db2c30 = cRam0000000180db2c30 + bRam0babfb3d830004fb;

+  *pcVar2 = *pcVar2 + bRam0babfb3d830004fb;

+  if (((_DAT_0 & 0x400000000000) == 0) ||

+     ((DAT_1 & 0x400000000000) != DAT_1)) {

+    bVar1 = false;

   }

   else {

-    iVar2 = 0x57;

+    bVar1 = true;

   }

-  return iVar2;

+  if (bVar1) {

+    uStack000000000000006c = 0;

+    puStack0000000000000060 = (undefined1 *)&stack0x00000030;

+    uStack000000000000007c = 0;

+    *(undefined4 *)(unaff_RBP + -0x74) = 0;

+    uVar3 = 8;

+    uStack0000000000000030 = 1;

+    pcStack0000000000000070 = "Socket_Create";

+    *(char **)(unaff_RBP + -0x80) = "FALSE";

+    uStack0000000000000068 = 8;

+    uStack0000000000000078 = 0xe;

+    *(undefined4 *)(unaff_RBP + -0x78) = 6;

+    FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

+    *(undefined4 *)(unaff_RBP + -0x54) = 0;

+    *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

+    *(undefined4 *)(unaff_RBP + -0x58) = uVar3;

+    uStack0000000000000038 = 0x1000000;

+    FUN_1800e3690(0x180135218,&DAT_2,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+  }

+  return 0;

 }
```

## `HostsFile_ReadLine`  (modified)

```diff
--- HostsFile_ReadLine
+++ Dns_WriteQuestionToMessage
@@ -1,74 +1,65 @@
 

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

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

 

-undefined8 HostsFile_ReadLine(longlong *param_1,wchar_t *param_2,LPCWSTR param_3,wchar_t *param_4)

+u_short * Dns_WriteQuestionToMessage(longlong param_1,WCHAR *param_2,u_short param_3,int param_4)

 

 {

   bool bVar1;

-  undefined8 uVar2;

-  undefined4 uVar3;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  int iVar2;

+  uint uVar3;

+  LSTATUS LVar4;

+  char *in_RAX;

+  u_short *puVar5;

+  undefined7 extraout_var;

+  undefined4 extraout_var_00;

+  undefined4 extraout_var_01;

+  undefined6 in_register_00000082;

+  PHKEY phkResult;

   

-                    /* 0x6b540  307  HostsFile_ReadLine */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    uVar2 = FUN_1800dae3c(param_1,param_2,param_3,param_4);

+  phkResult = (PHKEY)CONCAT62(in_register_00000082,param_3);

+  *in_RAX = *in_RAX + (char)in_RAX;

+  memset(&stack0x00000310,0,0x208);

+  memset(&stack0x00000050,0,0xa2);

+  memset(&stack0x00000100,0,0x208);

+  if (DAT_0 == 0) {

+    if ((phkResult == (PHKEY)0x0) || (param_1 == 0)) {

+      puVar5 = (u_short *)0x57;

+    }

+    else {

+      *phkResult = (HKEY)0x0;

+      bVar1 = FUN_18003b200((uint *)param_1,(undefined2 *)&stack0x00000050);

+      if ((int)CONCAT71(extraout_var,bVar1) == 0) {

+        puVar5 = (u_short *)0xe;

+      }

+      else {

+        iVar2 = FUN_180060cec((wchar_t *)&stack0x00000310,0x208,L"%s\\%s",

+                              L"InterfaceSpecificParameters");

+        if (iVar2 < 0) {

+          puVar5 = (u_short *)0x50c;

+        }

+        else {

+          uVar3 = FUN_1800034d0(L"Dnscache",(uint *)L"SYSTEM\\CurrentControlSet\\Services\\Dnscache"

+                                ,(longlong)&stack0x00000310,(uint *)&stack0x00000100,0x208);

+          if ((int)uVar3 < 0) {

+            puVar5 = (u_short *)FUN_18001aa00(uVar3);

+          }

+          else if ((int)param_2 == 0) {

+            LVar4 = RegOpenKeyExW((HKEY)0xffffffff80000002,(LPCWSTR)&stack0x00000100,0,0x20019,

+                                  phkResult);

+            puVar5 = (u_short *)CONCAT44(extraout_var_01,LVar4);

+          }

+          else {

+            LVar4 = RegCreateKeyExW((HKEY)0xffffffff80000002,(LPCWSTR)&stack0x00000100,0,(LPWSTR)0x0

+                                    ,0,0xf003f,(LPSECURITY_ATTRIBUTES)0x0,phkResult,(LPDWORD)0x0);

+            puVar5 = (u_short *)CONCAT44(extraout_var_00,LVar4);

+          }

+        }

+      }

+    }

   }

   else {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar3 = 8;

-        local_118 = 1;

-        local_d8 = "HostsFile_ReadLine";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x13;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar3;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-    uVar2 = 0;

+    puVar5 = (u_short *)0x78;

   }

-  return uVar2;

+  return puVar5;

 }
```

## `Util_IsIp6Running`  (modified)

```diff
--- Util_IsIp6Running
+++ Socket_CleanupWinsock
@@ -1,87 +1,81 @@
 

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

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

 

-int Util_IsIp6Running(void)

+ulonglong Socket_CleanupWinsock(void)

 

 {

-  bool bVar1;

-  int iVar2;

-  int iVar3;

-  undefined7 extraout_var;

-  undefined4 uVar4;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  longlong lVar1;

+  longlong *plVar2;

+  bool bVar3;

+  ulonglong uVar4;

+  uint in_ECX;

+  uint uVar5;

+  uint uVar6;

+  longlong unaff_RBP;

+  bool in_ZF;

+  undefined8 uStack0000000000000040;

+  undefined8 uStack0000000000000048;

+  undefined1 *puStack0000000000000070;

+  undefined4 uStack0000000000000078;

+  undefined4 uStack000000000000007c;

   

-                    /* 0x9d870  359  Util_IsIp6Running */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    iVar3 = DAT_2;

-    if (DAT_2 == 0) {

-      bVar1 = FUN_1800a02c0(0x17);

-      iVar2 = (int)CONCAT71(extraout_var,bVar1);

-      iVar3 = DAT_2;

-      if (iVar2 != 0) {

-        LOCK();

-        UNLOCK();

-        iVar3 = iVar2;

-        DAT_2 = iVar2;

+  lVar1 = *(longlong *)(unaff_RBP + 0xa0);

+  plVar2 = *(longlong **)(unaff_RBP + 0xa8);

+  if (in_ZF) {

+    uVar6 = *(uint *)(unaff_RBP + 0xb8);

+    if ((DAT_0 & 8) != 0) {

+      FUN_1800e738c();

+    }

+    uVar5 = uVar6 | 2;

+    if (lVar1 == 0) {

+      uVar5 = uVar6;

+    }

+    uVar6 = uVar5 | 0x100;

+    if ((uVar5 >> 9 & 1) != 0) {

+      uVar6 = uVar5;

+    }

+    if ((plVar2 != (longlong *)0x0) && (*plVar2 != 0)) {

+      uVar6 = uVar6 | 0x1000;

+    }

+    uVar4 = FUN_1800570f4((wchar_t *)(ulonglong)in_ECX,uVar6);

+    uVar4 = uVar4 & 0xffffffff;

+    FUN_1800570cc(plVar2);

+  }

+  else {

+    memset((void *)(unaff_RBP + -0x40),0,0x80);

+    if (DAT_1 != 0) {

+      FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x68),0,(short *)(unaff_RBP + -0x40),0x40);

+    }

+    if (5 < DAT_2) {

+      if (((_DAT_3 & 0x400000000000) == 0) ||

+         ((DAT_4 & 0x400000000000) != DAT_4)) {

+        bVar3 = false;

+      }

+      else {

+        bVar3 = true;

+      }

+      if (bVar3) {

+        uStack000000000000007c = 0;

+        puStack0000000000000070 = (undefined1 *)&stack0x00000040;

+        *(undefined4 *)(unaff_RBP + -0x74) = 0;

+        *(undefined4 *)(unaff_RBP + -100) = 0;

+        *(char **)(unaff_RBP + -0x80) = "DnsDhcpRegisterHostAddrs";

+        *(char **)(unaff_RBP + -0x70) = "FALSE";

+        uStack0000000000000040 = 1;

+        uStack0000000000000078 = 8;

+        *(undefined4 *)(unaff_RBP + -0x78) = 0x19;

+        *(undefined4 *)(unaff_RBP + -0x68) = 6;

+        FUN_180055600((undefined8 *)(unaff_RBP + -0x60),(undefined *)(unaff_RBP + -0x40));

+        *(undefined4 *)(unaff_RBP + -0x44) = 0;

+        *(undefined8 **)(unaff_RBP + -0x50) = &stack0x00000048;

+        uStack0000000000000048 = 0x1000000;

+        *(undefined4 *)(unaff_RBP + -0x48) = 8;

+        FUN_1800e3690(0x180135218,&DAT_5,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000050);

       }

     }

+    uVar4 = 0x78;

   }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_3 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         ((DAT_6 & 0x400000000000) != DAT_6)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar4 = 8;

-        local_118 = 1;

-        local_d8 = "Util_IsIp6Running";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x12;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar4;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

-      }

-    }

-    iVar3 = 0;

-  }

-  return iVar3;

+  return uVar4;

 }
```

## `NetInfo_GetAdapterByAddress`  (modified)

```diff
--- NetInfo_GetAdapterByAddress
+++ NetInfo_GetAdapterByAddress
@@ -1,55 +1,88 @@
 

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

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

 

 longlong NetInfo_GetAdapterByAddress(longlong param_1,short *param_2,uint param_3)

 

 {

-  bool bVar1;

-  longlong unaff_RBP;

-  undefined4 in_register_00000084;

-  undefined4 uVar2;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined1 *puStack0000000000000060;

-  undefined4 uStack0000000000000068;

-  undefined4 uStack000000000000006c;

-  char *pcStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  uint uVar1;

+  bool bVar2;

+  int iVar3;

+  undefined8 uVar4;

+  DWORD dwErrCode;

+  uint uVar5;

+  longlong lVar6;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_178 [32];

+  undefined8 local_148;

+  undefined8 local_140;

+  _EVENT_DATA_DESCRIPTOR local_138 [2];

+  undefined8 *local_118;

+  undefined8 local_110;

+  char *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  undefined8 local_e8 [2];

+  undefined8 *local_d8;

+  undefined8 local_d0;

+  short local_c8 [64];

+  ulonglong local_48;

   

-  memset((void *)param_1,(int)param_2,CONCAT44(in_register_00000084,param_3));

-  if (DAT_0 != 0) {

-    FUN_1800ca1b8(*(LPCSTR *)(unaff_RBP + 0x48),0,(short *)(unaff_RBP + -0x50),0x40);

+                    /* 0x6e950  318  NetInfo_GetAdapterByAddress */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_178;

+  uVar5 = 0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800faec4(0x40b,0x53,0x18010f550,param_1,param_2);

   }

-  if (5 < DAT_1) {

-    if (((_DAT_2 & 0x400000000000) == 0) ||

-       ((DAT_3 & 0x400000000000) != DAT_3)) {

-      bVar1 = false;

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar3 = FUN_1800ca394(unaff_retaddr), iVar3 != 0)) {

+    if ((param_1 != 0) && (param_2 != (short *)0x0)) {

+      uVar1 = *(uint *)(param_1 + 0x44);

+      if (uVar1 == 0) {

+        return 0;

+      }

+      lVar6 = param_1 + 0x68;

+      do {

+        uVar4 = FUN_180010528(*(longlong *)(lVar6 + 0x20),param_2,param_3);

+        if ((int)uVar4 != 0) {

+          return lVar6;

+        }

+        uVar5 = uVar5 + 1;

+        lVar6 = lVar6 + 0xa0;

+      } while (uVar5 < uVar1);

+      return 0;

     }

-    else {

-      bVar1 = true;

+    dwErrCode = 0x57;

+  }

+  else {

+    memset(local_c8,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

     }

-    if (bVar1) {

-      uStack000000000000006c = 0;

-      puStack0000000000000060 = (undefined1 *)&stack0x00000030;

-      uStack000000000000007c = 0;

-      *(undefined4 *)(unaff_RBP + -0x74) = 0;

-      uVar2 = 8;

-      uStack0000000000000030 = 1;

-      pcStack0000000000000070 = "WriteDnsNrptRulesToRegistry";

-      *(char **)(unaff_RBP + -0x80) = "FALSE";

-      uStack0000000000000068 = 8;

-      uStack0000000000000078 = 0x1c;

-      *(undefined4 *)(unaff_RBP + -0x78) = 6;

-      FUN_180055600((undefined8 *)(unaff_RBP + -0x70),(undefined *)(unaff_RBP + -0x50));

-      *(undefined4 *)(unaff_RBP + -0x54) = 0;

-      *(undefined8 **)(unaff_RBP + -0x60) = &stack0x00000038;

-      *(undefined4 *)(unaff_RBP + -0x58) = uVar2;

-      uStack0000000000000038 = 0x1000000;

-      FUN_1800e3690(0x180135218,&DAT_4,0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000040);

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         (bVar2 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar2 = false;

+      }

+      if (bVar2) {

+        local_118 = &local_148;

+        local_148 = 1;

+        local_110 = 8;

+        local_108 = "NetInfo_GetAdapterByAddress";

+        local_100 = 0x1c;

+        local_f8 = "FALSE";

+        local_f0 = 6;

+        FUN_180055600(local_e8,(undefined *)local_c8);

+        local_d8 = &local_140;

+        local_140 = 0x1000000;

+        local_d0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_138);

+      }

     }

+    dwErrCode = 0x78;

   }

-  return 0x78;

+  SetLastError(dwErrCode);

+  return 0;

 }
```

## `Util_IsRunningOnXboxOne`  (modified)

```diff
--- Util_IsRunningOnXboxOne
+++ Socket_CloseMessageSockets
@@ -1,161 +1,34 @@
 

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

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

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

 

-bool Util_IsRunningOnXboxOne(void)

+void Socket_CloseMessageSockets(void)

 

 {

-  longlong lVar1;

-  byte bVar2;

-  byte bVar3;

-  undefined *puVar4;

-  undefined1 uVar5;

+  byte *pbVar1;

   int in_EAX;

-  longlong lVar6;

-  byte *pbVar7;

-  byte *pbVar8;

-  byte *in_RCX;

-  byte *in_RDX;

-  undefined8 *unaff_RBP;

-  longlong in_R8;

-  byte bVar9;

-  ulonglong uVar10;

-  bool bVar11;

-  undefined4 uStack0000000000000030;

-  USHORT UStack0000000000000038;

-  UCHAR UStack000000000000003a;

-  UCHAR UStack000000000000003b;

-  UCHAR UStack000000000000003c;

-  UCHAR UStack000000000000003d;

-  USHORT UStack000000000000003e;

-  ULONGLONG UStack0000000000000040;

-  undefined8 uStack0000000000000048;

-  undefined8 uStack0000000000000050;

-  undefined *puStack0000000000000060;

-  uint uStack0000000000000068;

-  ULONG UStack000000000000006c;

-  undefined *puStack0000000000000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

+  undefined4 in_register_00000004;

+  byte in_CL;

+  undefined1 in_CH;

+  undefined6 in_register_0000000a;

+  char in_DH;

+  char *unaff_RBX;

+  char *unaff_RDI;

+  longlong in_R9;

   

-  unaff_RBP[10] = (ulonglong)(in_EAX + 0xcb35b) ^ (ulonglong)&stack0x00000000;

-  if (DAT_0 == 0) {

-    pbVar7 = FUN_1800d3b8c(in_RCX,in_RDX,in_R8);

-    uVar5 = SUB81(pbVar7,0);

-  }

-  else {

-    bVar11 = DAT_1 != 0;

-    unaff_RBP[-6] = 0;

-    unaff_RBP[-5] = 0;

-    unaff_RBP[-4] = 0;

-    unaff_RBP[-3] = 0;

-    unaff_RBP[-2] = 0;

-    unaff_RBP[-1] = 0;

-    *unaff_RBP = 0;

-    unaff_RBP[1] = 0;

-    unaff_RBP[2] = 0;

-    unaff_RBP[3] = 0;

-    unaff_RBP[4] = 0;

-    unaff_RBP[5] = 0;

-    unaff_RBP[6] = 0;

-    unaff_RBP[7] = 0;

-    unaff_RBP[8] = 0;

-    unaff_RBP[9] = 0;

-    if (bVar11) {

-      FUN_1800ca1b8((LPCSTR)unaff_RBP[0xd],0,(short *)(unaff_RBP + -6),0x40);

-    }

-    if (5 < DAT_2) {

-      if (((_DAT_3 & 0x400000000000) == 0) ||

-         ((DAT_4 & 0x400000000000) != DAT_4)) {

-        bVar11 = false;

-      }

-      else {

-        bVar11 = true;

-      }

-      if (bVar11) {

-        uStack0000000000000048 = 1;

-        unaff_RBP[-0x10] = &stack0x00000048;

-        unaff_RBP[-0xf] = 8;

-        unaff_RBP[-0xe] = "Dns_ReadRecordStructureFromPacket";

-        unaff_RBP[-0xd] = 0x22;

-        unaff_RBP[-0xc] = "FALSE";

-        lVar6 = -1;

-        unaff_RBP[-0xb] = 6;

-        do {

-          lVar1 = lVar6 * 2;

-          lVar6 = lVar6 + 1;

-        } while (*(short *)((longlong)unaff_RBP + lVar1 + -0x2e) != 0);

-        *(undefined4 *)((longlong)unaff_RBP + -0x44) = 0;

-        *(int *)(unaff_RBP + -9) = (int)lVar6 * 2 + 2;

-        unaff_RBP[-10] = unaff_RBP + -6;

-        unaff_RBP[-8] = &stack0x00000050;

-        puVar4 = PTR_DAT_5;

-        UStack000000000000003c = '\x05';

-        UStack000000000000003d = '\0';

-        UStack000000000000003e = 0;

-        puStack0000000000000060 = PTR_DAT_5;

-        uStack0000000000000050 = 0x1000000;

-        unaff_RBP[-7] = 8;

-        UStack0000000000000038 = 0;

-        UStack000000000000003a = '\0';

-        UStack000000000000003b = '\v';

-        UStack0000000000000040 = 0x400000000000;

-        uStack0000000000000068 = (uint)*(ushort *)puVar4;

-        puStack0000000000000070 = &DAT_6;

-        UStack000000000000006c = 2;

-        uStack0000000000000078 = 0x52;

-        uStack000000000000007c = 1;

-        uStack0000000000000030 = 0x75c6;

-        if (DAT_7 == FUN_18004e7b0) {

-          bVar9 = 0;

-          pbVar7 = &DAT_8;

-          do {

-            bVar2 = *pbVar7;

-            pbVar7 = pbVar7 + 1;

-          } while ((char)bVar2 < '\0');

-          do {

-            bVar2 = *pbVar7;

-            pbVar7 = pbVar7 + 1;

-          } while (bVar2 != 0);

-          uVar10 = 0;

-          if (pbVar7 < &DAT_9) {

-            while( true ) {

-              do {

-                pbVar8 = pbVar7;

-                bVar9 = (byte)uVar10;

-                pbVar7 = pbVar8 + 1;

-              } while (*pbVar8 != 0);

-              bVar2 = pbVar8[1];

-              if (-1 < (char)bVar2) break;

-              pbVar7 = pbVar8 + 3;

-              if (-1 < (char)pbVar8[2]) break;

-              bVar3 = *pbVar7;

-              while ((char)bVar3 < '\0') {

-                if (bVar3 != 0x80) goto LAB_10;

-                pbVar8 = pbVar7 + 1;

-                pbVar7 = pbVar7 + 1;

-                bVar3 = *pbVar8;

-              }

-              if (((bVar2 & 0x7f) != 9) || (2 < (byte)(bVar3 + 0x8f))) break;

-              bVar9 = bVar9 + 1;

-              *(byte *)((longlong)unaff_RBP + uVar10 * 0x10 + -0x73) = bVar3;

-              uVar10 = (ulonglong)bVar9;

-              if (&UNK_11 < pbVar7) break;

-            }

-          }

-LAB_10:

-          if (bVar9 != 0) {

-            FUN_1800e3380(0x180135218,(undefined8 *)&stack0x00000038,7,(longlong)&stack0x00000060,

-                          bVar9);

-            return false;

-          }

-          EventWriteTransfer(DAT_12,(PCEVENT_DESCRIPTOR)&stack0x00000038,(LPCGUID)0x0,

-                             (LPCGUID)0x0,7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

-        }

-      }

-    }

-    uVar5 = 0;

-  }

-  return (bool)uVar5;

+  unaff_RBX[CONCAT62(in_register_0000000a,CONCAT11(in_CH,in_CL)) * 4 + -99] =

+       unaff_RBX[CONCAT62(in_register_0000000a,CONCAT11(in_CH,in_CL)) * 4 + -99] + in_CL;

+  *(char *)CONCAT44(in_register_00000004,in_EAX) =

+       *(char *)CONCAT44(in_register_00000004,in_EAX) + (char)in_EAX;

+  *unaff_RDI = *unaff_RDI + in_CL;

+  *(int *)CONCAT44(in_register_00000004,in_EAX) =

+       *(int *)CONCAT44(in_register_00000004,in_EAX) + in_EAX;

+  *unaff_RBX = *unaff_RBX + in_DH;

+  pbVar1 = (byte *)(CONCAT44(in_register_00000004,in_EAX) + -0x73);

+  *pbVar1 = *pbVar1 >> (in_CL & 7) | *pbVar1 << 8 - (in_CL & 7);

+  *(undefined1 *)(in_R9 + -0x48) = *(undefined1 *)(in_R9 + -0x48);

+  *(char *)CONCAT44(in_register_00000004,in_EAX) =

+       *(char *)CONCAT44(in_register_00000004,in_EAX) + (char)in_EAX;

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

+  halt_baddata();

 }
```

## `DnsGetApplicationIdentifier`  (modified)

```diff
--- DnsGetApplicationIdentifier
+++ DnsAddrArrayCreate
@@ -1,203 +1,58 @@
 

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

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

 

-ulonglong DnsGetApplicationIdentifier(undefined8 *param_1,void *param_2,DWORD *param_3)

+uint * DnsAddrArrayCreate(uint param_1)

 

 {

-  byte bVar1;

-  byte bVar2;

-  bool bVar3;

-  longlong lVar4;

-  longlong lVar5;

-  byte *pbVar6;

-  byte *pbVar7;

-  ulonglong uVar8;

-  byte bVar9;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_168 [32];

-  EVENT_DESCRIPTOR local_130;

-  undefined8 local_120;

-  undefined8 local_118 [2];

-  _EVENT_DATA_DESCRIPTOR local_108;

-  undefined *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

-  undefined8 *local_e8;

-  undefined8 local_e0;

-  char *local_d8;

-  undefined8 local_d0;

-  char *local_c8;

-  undefined8 local_c0;

-  short *local_b8;

-  int local_b0;

-  undefined4 local_ac;

-  undefined8 *local_a8;

-  undefined8 local_a0;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined8 *puVar1;

+  undefined8 *puVar2;

+  void *pvVar3;

+  undefined8 uVar4;

+  LPVOID pvVar5;

+  LPVOID pvVar6;

+  uint unaff_EBX;

+  longlong unaff_RBP;

+  int unaff_ESI;

+  longlong lVar7;

+  uint *unaff_R12;

+  uint uVar8;

+  uint unaff_R14D;

+  undefined8 *unaff_R15;

   

-                    /* 0x689a0  108  DnsGetApplicationIdentifier */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_168;

-  if (DAT_1 == 0) {

-    uVar8 = FUN_1800d6460(param_1,param_2,param_3);

+  pvVar5 = FUN_18008a630((ulonglong)(uint)(unaff_ESI * 0x38));

+  if (pvVar5 == (LPVOID)0x0) {

+LAB_0:

+    unaff_EBX = 0xe;

   }

   else {

-    local_98[0] = 0;

-    local_98[1] = 0;

-    local_98[2] = 0;

-    local_98[3] = 0;

-    local_98[4] = 0;

-    local_98[5] = 0;

-    local_98[6] = 0;

-    local_98[7] = 0;

-    local_98[8] = 0;

-    local_98[9] = 0;

-    local_98[10] = 0;

-    local_98[0xb] = 0;

-    local_98[0xc] = 0;

-    local_98[0xd] = 0;

-    local_98[0xe] = 0;

-    local_98[0xf] = 0;

-    local_98[0x10] = 0;

-    local_98[0x11] = 0;

-    local_98[0x12] = 0;

-    local_98[0x13] = 0;

-    local_98[0x14] = 0;

-    local_98[0x15] = 0;

-    local_98[0x16] = 0;

-    local_98[0x17] = 0;

-    local_98[0x18] = 0;

-    local_98[0x19] = 0;

-    local_98[0x1a] = 0;

-    local_98[0x1b] = 0;

-    local_98[0x1c] = 0;

-    local_98[0x1d] = 0;

-    local_98[0x1e] = 0;

-    local_98[0x1f] = 0;

-    local_98[0x20] = 0;

-    local_98[0x21] = 0;

-    local_98[0x22] = 0;

-    local_98[0x23] = 0;

-    local_98[0x24] = 0;

-    local_98[0x25] = 0;

-    local_98[0x26] = 0;

-    local_98[0x27] = 0;

-    local_98[0x28] = 0;

-    local_98[0x29] = 0;

-    local_98[0x2a] = 0;

-    local_98[0x2b] = 0;

-    local_98[0x2c] = 0;

-    local_98[0x2d] = 0;

-    local_98[0x2e] = 0;

-    local_98[0x2f] = 0;

-    local_98[0x30] = 0;

-    local_98[0x31] = 0;

-    local_98[0x32] = 0;

-    local_98[0x33] = 0;

-    local_98[0x34] = 0;

-    local_98[0x35] = 0;

-    local_98[0x36] = 0;

-    local_98[0x37] = 0;

-    local_98[0x38] = 0;

-    local_98[0x39] = 0;

-    local_98[0x3a] = 0;

-    local_98[0x3b] = 0;

-    local_98[0x3c] = 0;

-    local_98[0x3d] = 0;

-    local_98[0x3e] = 0;

-    local_98[0x3f] = 0;

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    uVar8 = unaff_EBX;

+    if (unaff_R14D != 0) {

+      do {

+        lVar7 = (ulonglong)uVar8 * 0x38;

+        if (((*(int *)(lVar7 + unaff_RBP) == 2) || (*(int *)(lVar7 + unaff_RBP) == 3)) &&

+           (pvVar3 = *(void **)(lVar7 + 0x10 + unaff_RBP), pvVar3 != (void *)0x0)) {

+          pvVar6 = FUN_180016e10(pvVar3);

+          *(LPVOID *)(lVar7 + 0x10 + (longlong)pvVar5) = pvVar6;

+          if (pvVar6 == (LPVOID)0x0) goto LAB_0;

+        }

+        puVar1 = (undefined8 *)(lVar7 + 0x18 + unaff_RBP);

+        uVar4 = puVar1[1];

+        uVar8 = uVar8 + 1;

+        puVar2 = (undefined8 *)(lVar7 + 0x18 + (longlong)pvVar5);

+        *puVar2 = *puVar1;

+        puVar2[1] = uVar4;

+        *(undefined8 *)(lVar7 + 0x28 + (longlong)pvVar5) = *(undefined8 *)(lVar7 + 0x28 + unaff_RBP)

+        ;

+        *(undefined4 *)(lVar7 + 0x30 + (longlong)pvVar5) = *(undefined4 *)(lVar7 + 0x30 + unaff_RBP)

+        ;

+        *(undefined4 *)(lVar7 + (longlong)pvVar5) = *(undefined4 *)(lVar7 + unaff_RBP);

+        *(undefined8 *)(lVar7 + 8 + (longlong)pvVar5) = *(undefined8 *)(lVar7 + 8 + unaff_RBP);

+      } while (uVar8 < unaff_R14D);

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar3 = false;

-      }

-      else {

-        bVar3 = true;

-      }

-      if (bVar3) {

-        local_e8 = &local_120;

-        local_120 = 1;

-        local_e0 = 8;

-        local_d8 = "DnsGetApplicationIdentifier";

-        local_d0 = 0x1c;

-        local_c8 = "FALSE";

-        lVar5 = -1;

-        local_c0 = 6;

-        do {

-          lVar4 = lVar5 + 1;

-          lVar5 = lVar5 + 1;

-        } while (local_98[lVar4] != 0);

-        local_b0 = (int)lVar5 * 2 + 2;

-        local_ac = 0;

-        local_b8 = local_98;

-        local_a8 = local_118;

-        local_130.Level = '\x05';

-        local_130.Opcode = '\0';

-        local_130.Task = 0;

-        local_108.Ptr = (ULONGLONG)PTR_DAT_6;

-        local_118[0] = 0x1000000;

-        local_a0 = 8;

-        local_130.Id = 0;

-        local_130.Version = '\0';

-        local_130.Channel = '\v';

-        local_130.Keyword = 0x400000000000;

-        local_108.Size = (ULONG)*(ushort *)PTR_DAT_6;

-        local_f8 = &DAT_7;

-        local_108.Reserved = 2;

-        local_f0 = 0x52;

-        local_ec = 1;

-        if (DAT_8 == FUN_18004e7b0) {

-          bVar9 = 0;

-          pbVar6 = &DAT_9;

-          do {

-            bVar1 = *pbVar6;

-            pbVar6 = pbVar6 + 1;

-          } while ((char)bVar1 < '\0');

-          do {

-            bVar1 = *pbVar6;

-            pbVar6 = pbVar6 + 1;

-          } while (bVar1 != 0);

-          uVar8 = 0;

-          if (pbVar6 < &DAT_10) {

-            while( true ) {

-              do {

-                pbVar7 = pbVar6;

-                bVar9 = (byte)uVar8;

-                pbVar6 = pbVar7 + 1;

-              } while (*pbVar7 != 0);

-              bVar1 = pbVar7[1];

-              if (-1 < (char)bVar1) break;

-              pbVar6 = pbVar7 + 3;

-              if (-1 < (char)pbVar7[2]) break;

-              bVar2 = *pbVar6;

-              while ((char)bVar2 < '\0') {

-                if (bVar2 != 0x80) goto LAB_11;

-                pbVar7 = pbVar6 + 1;

-                pbVar6 = pbVar6 + 1;

-                bVar2 = *pbVar7;

-              }

-              if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar2 + 0x8f))) break;

-              bVar9 = bVar9 + 1;

-              *(byte *)((longlong)&local_e0 + uVar8 * 0x10 + 5) = bVar2;

-              uVar8 = (ulonglong)bVar9;

-              if (&UNK_12 < pbVar6) break;

-            }

-          }

-LAB_11:

-          if (bVar9 != 0) {

-            FUN_1800e3380(0x180135218,(undefined8 *)&local_130,7,(longlong)&local_108,bVar9);

-            return 0x78;

-          }

-          EventWriteTransfer(DAT_13,&local_130,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_108);

-        }

-      }

-    }

-    uVar8 = 0x78;

+    *unaff_R12 = unaff_R14D;

+    *unaff_R15 = pvVar5;

   }

-  return uVar8;

+  DnsFreeCustomServers((uint *)&stack0x00000028,(undefined8 *)&stack0x00000020);

+  return (uint *)(ulonglong)unaff_EBX;

 }
```

## `Reg_GetValueEx`  (modified)

```diff
--- Reg_GetValueEx
+++ Reg_GetValueEx
@@ -1,10 +1,205 @@
+

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

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

 

 uint Reg_GetValueEx(HKEY *param_1,HKEY param_2,LPCWSTR param_3,uint param_4,DWORD param_5,

                    uint param_6,LPCWSTR param_7)

 

 {

-  uint in_EAX;

+  byte bVar1;

+  byte bVar2;

+  bool bVar3;

+  longlong lVar4;

+  uint uVar5;

+  longlong lVar6;

+  byte *pbVar7;

+  byte *pbVar8;

+  byte bVar9;

+  ulonglong uVar10;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_178 [32];

+  EVENT_DESCRIPTOR local_130;

+  undefined8 local_120;

+  undefined8 local_118 [2];

+  _EVENT_DATA_DESCRIPTOR local_108;

+  undefined *local_f8;

+  undefined4 local_f0;

+  undefined4 local_ec;

+  undefined8 *local_e8;

+  undefined8 local_e0;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

+  undefined8 local_c0;

+  short *local_b8;

+  int local_b0;

+  undefined4 local_ac;

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-  return in_EAX;

+                    /* 0x6b970  333  Reg_GetValueEx */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_178;

+  if (DAT_1 == 0) {

+    uVar5 = FUN_1800c963c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);

+  }

+  else {

+    local_98[0] = 0;

+    local_98[1] = 0;

+    local_98[2] = 0;

+    local_98[3] = 0;

+    local_98[4] = 0;

+    local_98[5] = 0;

+    local_98[6] = 0;

+    local_98[7] = 0;

+    local_98[8] = 0;

+    local_98[9] = 0;

+    local_98[10] = 0;

+    local_98[0xb] = 0;

+    local_98[0xc] = 0;

+    local_98[0xd] = 0;

+    local_98[0xe] = 0;

+    local_98[0xf] = 0;

+    local_98[0x10] = 0;

+    local_98[0x11] = 0;

+    local_98[0x12] = 0;

+    local_98[0x13] = 0;

+    local_98[0x14] = 0;

+    local_98[0x15] = 0;

+    local_98[0x16] = 0;

+    local_98[0x17] = 0;

+    local_98[0x18] = 0;

+    local_98[0x19] = 0;

+    local_98[0x1a] = 0;

+    local_98[0x1b] = 0;

+    local_98[0x1c] = 0;

+    local_98[0x1d] = 0;

+    local_98[0x1e] = 0;

+    local_98[0x1f] = 0;

+    local_98[0x20] = 0;

+    local_98[0x21] = 0;

+    local_98[0x22] = 0;

+    local_98[0x23] = 0;

+    local_98[0x24] = 0;

+    local_98[0x25] = 0;

+    local_98[0x26] = 0;

+    local_98[0x27] = 0;

+    local_98[0x28] = 0;

+    local_98[0x29] = 0;

+    local_98[0x2a] = 0;

+    local_98[0x2b] = 0;

+    local_98[0x2c] = 0;

+    local_98[0x2d] = 0;

+    local_98[0x2e] = 0;

+    local_98[0x2f] = 0;

+    local_98[0x30] = 0;

+    local_98[0x31] = 0;

+    local_98[0x32] = 0;

+    local_98[0x33] = 0;

+    local_98[0x34] = 0;

+    local_98[0x35] = 0;

+    local_98[0x36] = 0;

+    local_98[0x37] = 0;

+    local_98[0x38] = 0;

+    local_98[0x39] = 0;

+    local_98[0x3a] = 0;

+    local_98[0x3b] = 0;

+    local_98[0x3c] = 0;

+    local_98[0x3d] = 0;

+    local_98[0x3e] = 0;

+    local_98[0x3f] = 0;

+    if (DAT_2 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+    }

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

+        bVar3 = false;

+      }

+      else {

+        bVar3 = true;

+      }

+      if (bVar3) {

+        local_e8 = &local_120;

+        local_120 = 1;

+        local_e0 = 8;

+        local_d8 = "Reg_GetValueEx";

+        local_d0 = 0xf;

+        local_c8 = "FALSE";

+        lVar6 = -1;

+        local_c0 = 6;

+        do {

+          lVar4 = lVar6 + 1;

+          lVar6 = lVar6 + 1;

+        } while (local_98[lVar4] != 0);

+        local_b0 = (int)lVar6 * 2 + 2;

+        local_ac = 0;

+        local_b8 = local_98;

+        local_a8 = local_118;

+        local_130.Level = '\x05';

+        local_130.Opcode = '\0';

+        local_130.Task = 0;

+        local_108.Ptr = (ULONGLONG)PTR_DAT_6;

+        local_118[0] = 0x1000000;

+        local_a0 = 8;

+        local_130.Id = 0;

+        local_130.Version = '\0';

+        local_130.Channel = '\v';

+        local_130.Keyword = 0x400000000000;

+        local_108.Size = (ULONG)*(ushort *)PTR_DAT_6;

+        local_f8 = &DAT_7;

+        local_108.Reserved = 2;

+        local_f0 = 0x52;

+        local_ec = 1;

+        if (DAT_8 == FUN_18004e7b0) {

+          bVar9 = 0;

+          pbVar7 = &DAT_9;

+          do {

+            bVar1 = *pbVar7;

+            pbVar7 = pbVar7 + 1;

+          } while ((char)bVar1 < '\0');

+          do {

+            bVar1 = *pbVar7;

+            pbVar7 = pbVar7 + 1;

+          } while (bVar1 != 0);

+          uVar10 = 0;

+          if (pbVar7 < &DAT_10) {

+            while( true ) {

+              do {

+                pbVar8 = pbVar7;

+                bVar9 = (byte)uVar10;

+                pbVar7 = pbVar8 + 1;

+              } while (*pbVar8 != 0);

+              bVar1 = pbVar8[1];

+              if (-1 < (char)bVar1) break;

+              pbVar7 = pbVar8 + 3;

+              if (-1 < (char)pbVar8[2]) break;

+              bVar2 = *pbVar7;

+              while ((char)bVar2 < '\0') {

+                if (bVar2 != 0x80) goto LAB_11;

+                pbVar8 = pbVar7 + 1;

+                pbVar7 = pbVar7 + 1;

+                bVar2 = *pbVar8;

+              }

+              if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar2 + 0x8f))) break;

+              bVar9 = bVar9 + 1;

+              *(byte *)((longlong)&local_e0 + uVar10 * 0x10 + 5) = bVar2;

+              uVar10 = (ulonglong)bVar9;

+              if (&UNK_12 < pbVar7) break;

+            }

+          }

+LAB_11:

+          if (bVar9 != 0) {

+            FUN_1800e3380(0x180135218,(undefined8 *)&local_130,7,(longlong)&local_108,bVar9);

+            return 0x78;

+          }

+          EventWriteTransfer(DAT_13,&local_130,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_108);

+        }

+      }

+    }

+    uVar5 = 0x78;

+  }

+  return uVar5;

 }
```

## `Reg_ReadUpdateInfo`  (modified)

```diff
--- Reg_ReadUpdateInfo
+++ Reg_FreeUpdateInfo
@@ -1,149 +1,86 @@
 

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

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

 

-LSTATUS Reg_ReadUpdateInfo(wchar_t *param_1,undefined8 *param_2,undefined *param_3)

+void Reg_FreeUpdateInfo(undefined8 *param_1,int param_2)

 

 {

-  LPCWSTR pWVar1;

-  bool bVar2;

-  bool bVar3;

-  int iVar4;

-  LSTATUS LVar5;

-  ulonglong uVar6;

-  undefined8 *puVar7;

+  bool bVar1;

+  int iVar2;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_1f8 [32];

-  undefined8 local_1b8;

-  undefined8 uStack_1b0;

-  undefined8 local_1a8;

-  undefined8 uStack_1a0;

-  HKEY local_198;

-  undefined8 uStack_190;

-  HKEY local_188;

-  undefined8 local_180;

-  undefined8 local_178;

-  undefined8 local_170;

-  undefined8 uStack_168;

-  undefined8 local_160;

-  undefined8 uStack_158;

-  undefined8 local_150;

-  undefined8 uStack_148;

-  _EVENT_DATA_DESCRIPTOR local_138 [2];

-  undefined8 *local_118;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

   undefined8 local_110;

-  char *local_108;

-  undefined8 local_100;

-  char *local_f8;

-  undefined8 local_f0;

-  undefined8 local_e8 [2];

-  undefined8 *local_d8;

-  undefined8 local_d0;

-  short local_c8 [64];

-  ulonglong local_48;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

+  undefined4 local_e0;

+  undefined4 local_dc;

+  char *local_d8;

+  undefined4 local_d0;

+  undefined4 local_cc;

+  char *local_c8;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  short local_98 [64];

+  ulonglong local_18;

   

-                    /* 0x74c30  335  Reg_ReadUpdateInfo */

-  local_48 = DAT_0 ^ (ulonglong)auStackY_1f8;

-  local_188 = (HKEY)0x0;

-  bVar2 = false;

-  local_198 = (HKEY)0x0;

-  uStack_190 = 0;

-  local_1b8 = 0;

-  uStack_1b0 = 0;

-  local_1a8 = 0;

-  uStack_1a0 = 0;

-  local_170 = 0;

-  uStack_168 = 0;

-  local_160 = 0;

-  uStack_158 = 0;

-  local_150 = 0;

-  uStack_148 = 0;

+                    /* 0x74750  332  Reg_FreeUpdateInfo */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if ((DAT_1 & 8) != 0) {

-    param_3 = &DAT_2;

-    FUN_1800f849c(0x40b,0x23,0x1801102b8,param_1,param_2);

+    FUN_1800f71b8(0x40b,0x26,0x1801102b8,param_1);

   }

-  if (((DAT_3 == 0) || (DAT_18013630c != 0)) ||

-     (iVar4 = FUN_1800ca394(unaff_retaddr), iVar4 != 0)) {

-    *param_2 = 0;

-    param_2[1] = 0;

-    param_2[2] = 0;

-    LVar5 = FUN_180046c18(&local_198);

-    if (LVar5 == 0) {

-      puVar7 = &local_1b8;

-      LVar5 = FUN_180074abc(&local_198,puVar7);

-      bVar3 = bVar2;

-      if (LVar5 == 0) {

-        bVar2 = true;

-        uVar6 = FUN_180059a5c(param_1,puVar7,param_3,(longlong)&local_1b8,&local_170);

-        LVar5 = (LSTATUS)uVar6;

-        if (LVar5 == 0) {

-          pWVar1 = (LPCWSTR)(param_2 + 1);

-          if (DAT_4 == 0) {

-            FUN_1800c963c(&local_198,(HKEY)0x0,(LPCWSTR)0x0,6,7,0,pWVar1);

-          }

-          else {

-            FUN_1800c93e4(&local_198,(HKEY)0x0,param_3,6,7,(undefined8 *)pWVar1);

-          }

-          if ((*(int **)pWVar1 != (int *)0x0) && (**(int **)pWVar1 == 0)) {

-            RegDeleteKeyExW(local_188,L"AlternateComputerNames",0,0);

-            DnsApiFree(*(LPVOID *)pWVar1);

-            pWVar1[0] = L'\0';

-            pWVar1[1] = L'\0';

-            pWVar1[2] = L'\0';

-            pWVar1[3] = L'\0';

-          }

-          *param_2 = local_1b8;

-          *(undefined4 *)(param_2 + 2) = local_170._4_4_;

-          *(undefined4 *)((longlong)param_2 + 0x14) = (undefined4)uStack_168;

-          local_1b8 = 0;

-          bVar3 = bVar2;

-        }

-        else {

-          bVar3 = false;

-          if ((DAT_1 & 8) != 0) {

-            FUN_1800f5ac4(0x40b,0x24,0x1801102b8,param_1);

-          }

-        }

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    if (param_1 != (undefined8 *)0x0) {

+      if ((LPVOID)*param_1 != (LPVOID)0x0) {

+        DnsApiFree((LPVOID)*param_1);

       }

-      FUN_18004dd88(&local_198);

-      if (bVar2) {

-        FUN_180053544(&local_1b8);

+      if ((LPVOID)param_1[1] != (LPVOID)0x0) {

+        DnsApiFree((LPVOID)param_1[1]);

       }

-      if (bVar3) {

-        FUN_180052b88((longlong)&local_170);

-      }

-      if ((DAT_1 & 8) != 0) {

-        FUN_1800e4cec();

+      if (param_2 != 0) {

+        DnsApiFree(param_1);

       }

     }

+    return;

+  }

+  memset(local_98,0,0x80);

+  if (DAT_3 != 0) {

+    FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

+  }

+  if (DAT_4 < 6) {

+    return;

+  }

+  if (((_DAT_5 & 0x400000000000) == 0) ||

+     ((DAT_6 & 0x400000000000) != DAT_6)) {

+    bVar1 = false;

   }

   else {

-    memset(local_c8,0,0x80);

-    if (DAT_5 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

-    }

-    if (5 < DAT_6) {

-      if (((_DAT_7 & 0x400000000000) == 0) ||

-         (bVar2 = true, (DAT_8 & 0x400000000000) != DAT_8)) {

-        bVar2 = false;

-      }

-      if (bVar2) {

-        local_118 = &local_180;

-        local_180 = 1;

-        local_110 = 8;

-        local_108 = "Reg_ReadUpdateInfo";

-        local_100 = 0x13;

-        local_f8 = "FALSE";

-        local_f0 = 6;

-        FUN_180055600(local_e8,(undefined *)local_c8);

-        local_d8 = &local_178;

-        local_178 = 0x1000000;

-        local_d0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_9,0,7,local_138);

-      }

-    }

-    LVar5 = 0x78;

+    bVar1 = true;

   }

-  return LVar5;

+  if (!bVar1) {

+    return;

+  }

+  local_dc = 0;

+  local_e8 = &local_118;

+  local_cc = 0;

+  local_bc = 0;

+  local_d8 = "Reg_FreeUpdateInfo";

+  local_c8 = "FALSE";

+  local_118 = 1;

+  local_e0 = 8;

+  local_d0 = 0x13;

+  local_c0 = 6;

+  FUN_180055600(local_b8,(undefined *)local_98);

+  local_9c = 0;

+  local_a8 = &local_110;

+  local_110 = 0x1000000;

+  local_a0 = 8;

+  FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

+  return;

 }
```

## `Faz_AreServerListsInSameNameSpace`  (modified)

```diff
--- Faz_AreServerListsInSameNameSpace
+++ Faz_AreServerListsInSameNameSpace
@@ -1,48 +1,98 @@
 

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

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

 

 ulonglong Faz_AreServerListsInSameNameSpace

                     (_CERT_EXTENSION *param_1,longlong param_2,longlong param_3)

 

 {

-  byte bVar1;

-  byte *pbVar2;

-  byte *in_RAX;

-  ulonglong uVar3;

-  longlong unaff_RBP;

-  byte in_R9B;

-  byte *in_R10;

+  bool bVar1;

+  int iVar2;

+  undefined8 uVar3;

+  wchar_t *pwVar4;

+  ulonglong uVar5;

+  ulonglong uVar6;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_188 [32];

+  longlong *local_148;

+  longlong *local_140;

+  undefined8 local_138;

+  undefined8 local_130;

+  _EVENT_DATA_DESCRIPTOR local_128 [2];

+  undefined8 *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  char *local_e8;

+  undefined8 local_e0;

+  undefined8 local_d8 [2];

+  undefined8 *local_c8;

+  undefined8 local_c0;

+  short local_b8 [64];

+  ulonglong local_38;

   

-  while ((char)param_2 == -0x80) {

-    pbVar2 = in_RAX + 1;

-    in_RAX = in_RAX + 1;

-    bVar1 = *pbVar2;

-    while (param_2 = (longlong)bVar1, -1 < (char)bVar1) {

-      if (((char)param_3 != '\t') || (2 < (byte)(bVar1 + 0x8f))) goto LAB_0;

-      uVar3 = (ulonglong)in_R9B;

-      in_R9B = in_R9B + 1;

-      *(byte *)(unaff_RBP + -0x73 + uVar3 * 0x10) = bVar1;

-      if (in_R10 <= in_RAX) goto LAB_0;

-      do {

-        pbVar2 = in_RAX;

-        in_RAX = pbVar2 + 1;

-      } while (*pbVar2 != 0);

-      bVar1 = pbVar2[1];

-      if (-1 < (char)bVar1) goto LAB_0;

-      param_3 = (longlong)(bVar1 & 0x7f);

-      in_RAX = pbVar2 + 3;

-      if (-1 < (char)pbVar2[2]) goto LAB_0;

-      bVar1 = *in_RAX;

+                    /* 0x6c600  302  Faz_AreServerListsInSameNameSpace */

+  local_38 = DAT_0 ^ (ulonglong)auStackY_188;

+  uVar5 = 0;

+  local_148 = (longlong *)0x0;

+  local_140 = (longlong *)0x0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f7614(0x40b,0x2e,0x180111c20);

+  }

+  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

+    if (((param_2 != 0) && (param_3 != 0)) && (param_1 != (_CERT_EXTENSION *)0x0)) {

+      uVar3 = FUN_18006451c(param_2,param_3);

+      if ((int)uVar3 != 0) {

+        return 1;

+      }

+      uVar6 = uVar5;

+      if (DAT_3 != 0) {

+        uVar6 = 0x20000000000000;

+      }

+      pwVar4 = FUN_180062d10(param_1,uVar6 | 8,param_2,0,(ulonglong *)&local_148);

+      if (((int)pwVar4 == 0) &&

+         (pwVar4 = FUN_180062d10(param_1,uVar6 | 8,param_3,0,(ulonglong *)&local_140),

+         (int)pwVar4 == 0)) {

+        uVar5 = FUN_18006c894(param_2,(longlong)local_148,(longlong *)0x0,param_3,

+                              (longlong)local_140,(longlong *)0x0,1);

+        uVar5 = uVar5 & 0xffffffff;

+      }

+      NetInfo_Free(local_148);

+      NetInfo_Free(local_140);

+      if ((DAT_1 & 8) == 0) {

+        return uVar5;

+      }

+      FUN_1800f658c(0x40b,0x2f,0x180111c20,(int)uVar5);

+      return uVar5;

     }

   }

-LAB_0:

-  if (in_R9B == 0) {

-    EventWriteTransfer(DAT_1,(PCEVENT_DESCRIPTOR)&stack0x00000038,(LPCGUID)0x0,(LPCGUID)0x0,

-                       7,(PEVENT_DATA_DESCRIPTOR)&stack0x00000060);

-  }

   else {

-    FUN_1800e3380(0x180135218,(undefined8 *)&stack0x00000038,7,(longlong)&stack0x00000060,in_R9B);

+    memset(local_b8,0,0x80);

+    if (DAT_4 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    }

+    if (5 < DAT_5) {

+      if (((_DAT_6 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_7 & 0x400000000000) != DAT_7)) {

+        bVar1 = false;

+      }

+      if (bVar1) {

+        local_108 = &local_138;

+        local_138 = 1;

+        local_100 = 8;

+        local_f8 = "Faz_AreServerListsInSameNameSpace";

+        local_f0 = 0x22;

+        local_e8 = "FALSE";

+        local_e0 = 6;

+        FUN_180055600(local_d8,(undefined *)local_b8);

+        local_c8 = &local_130;

+        local_130 = 0x1000000;

+        local_c0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_8,0,7,local_128);

+      }

+    }

   }

   return 0;

 }
```

## `Reg_GetValueEx`  (modified)

```diff
--- Reg_GetValueEx
+++ HostsFile_ReadLine
@@ -1,205 +1,74 @@
 

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

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

 

-uint Reg_GetValueEx(HKEY *param_1,HKEY param_2,LPCWSTR param_3,uint param_4,DWORD param_5,

-                   uint param_6,LPCWSTR param_7)

+undefined8 HostsFile_ReadLine(longlong *param_1,wchar_t *param_2,LPCWSTR param_3,wchar_t *param_4)

 

 {

-  byte bVar1;

-  byte bVar2;

-  bool bVar3;

-  longlong lVar4;

-  uint uVar5;

-  longlong lVar6;

-  byte *pbVar7;

-  byte *pbVar8;

-  byte bVar9;

-  ulonglong uVar10;

+  bool bVar1;

+  undefined8 uVar2;

+  undefined4 uVar3;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_178 [32];

-  EVENT_DESCRIPTOR local_130;

-  undefined8 local_120;

-  undefined8 local_118 [2];

-  _EVENT_DATA_DESCRIPTOR local_108;

-  undefined *local_f8;

-  undefined4 local_f0;

-  undefined4 local_ec;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

-  undefined8 local_e0;

+  undefined4 local_e0;

+  undefined4 local_dc;

   char *local_d8;

-  undefined8 local_d0;

+  undefined4 local_d0;

+  undefined4 local_cc;

   char *local_c8;

-  undefined8 local_c0;

-  short *local_b8;

-  int local_b0;

-  undefined4 local_ac;

+  undefined4 local_c0;

+  undefined4 local_bc;

+  undefined8 local_b8 [2];

   undefined8 *local_a8;

-  undefined8 local_a0;

+  undefined4 local_a0;

+  undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x6b970  333  Reg_GetValueEx */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_178;

+                    /* 0x6b540  307  HostsFile_ReadLine */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    uVar5 = FUN_1800c963c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);

+    uVar2 = FUN_1800dae3c(param_1,param_2,param_3,param_4);

   }

   else {

-    local_98[0] = 0;

-    local_98[1] = 0;

-    local_98[2] = 0;

-    local_98[3] = 0;

-    local_98[4] = 0;

-    local_98[5] = 0;

-    local_98[6] = 0;

-    local_98[7] = 0;

-    local_98[8] = 0;

-    local_98[9] = 0;

-    local_98[10] = 0;

-    local_98[0xb] = 0;

-    local_98[0xc] = 0;

-    local_98[0xd] = 0;

-    local_98[0xe] = 0;

-    local_98[0xf] = 0;

-    local_98[0x10] = 0;

-    local_98[0x11] = 0;

-    local_98[0x12] = 0;

-    local_98[0x13] = 0;

-    local_98[0x14] = 0;

-    local_98[0x15] = 0;

-    local_98[0x16] = 0;

-    local_98[0x17] = 0;

-    local_98[0x18] = 0;

-    local_98[0x19] = 0;

-    local_98[0x1a] = 0;

-    local_98[0x1b] = 0;

-    local_98[0x1c] = 0;

-    local_98[0x1d] = 0;

-    local_98[0x1e] = 0;

-    local_98[0x1f] = 0;

-    local_98[0x20] = 0;

-    local_98[0x21] = 0;

-    local_98[0x22] = 0;

-    local_98[0x23] = 0;

-    local_98[0x24] = 0;

-    local_98[0x25] = 0;

-    local_98[0x26] = 0;

-    local_98[0x27] = 0;

-    local_98[0x28] = 0;

-    local_98[0x29] = 0;

-    local_98[0x2a] = 0;

-    local_98[0x2b] = 0;

-    local_98[0x2c] = 0;

-    local_98[0x2d] = 0;

-    local_98[0x2e] = 0;

-    local_98[0x2f] = 0;

-    local_98[0x30] = 0;

-    local_98[0x31] = 0;

-    local_98[0x32] = 0;

-    local_98[0x33] = 0;

-    local_98[0x34] = 0;

-    local_98[0x35] = 0;

-    local_98[0x36] = 0;

-    local_98[0x37] = 0;

-    local_98[0x38] = 0;

-    local_98[0x39] = 0;

-    local_98[0x3a] = 0;

-    local_98[0x3b] = 0;

-    local_98[0x3c] = 0;

-    local_98[0x3d] = 0;

-    local_98[0x3e] = 0;

-    local_98[0x3f] = 0;

+    memset(local_98,0,0x80);

     if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

     if (5 < DAT_3) {

       if (((_DAT_4 & 0x400000000000) == 0) ||

          ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar3 = false;

+        bVar1 = false;

       }

       else {

-        bVar3 = true;

+        bVar1 = true;

       }

-      if (bVar3) {

-        local_e8 = &local_120;

-        local_120 = 1;

+      if (bVar1) {

+        local_dc = 0;

+        local_e8 = &local_118;

+        local_cc = 0;

+        local_bc = 0;

+        uVar3 = 8;

+        local_118 = 1;

+        local_d8 = "HostsFile_ReadLine";

+        local_c8 = "FALSE";

         local_e0 = 8;

-        local_d8 = "Reg_GetValueEx";

-        local_d0 = 0xf;

-        local_c8 = "FALSE";

-        lVar6 = -1;

+        local_d0 = 0x13;

         local_c0 = 6;

-        do {

-          lVar4 = lVar6 + 1;

-          lVar6 = lVar6 + 1;

-        } while (local_98[lVar4] != 0);

-        local_b0 = (int)lVar6 * 2 + 2;

-        local_ac = 0;

-        local_b8 = local_98;

-        local_a8 = local_118;

-        local_130.Level = '\x05';

-        local_130.Opcode = '\0';

-        local_130.Task = 0;

-        local_108.Ptr = (ULONGLONG)PTR_DAT_6;

-        local_118[0] = 0x1000000;

-        local_a0 = 8;

-        local_130.Id = 0;

-        local_130.Version = '\0';

-        local_130.Channel = '\v';

-        local_130.Keyword = 0x400000000000;

-        local_108.Size = (ULONG)*(ushort *)PTR_DAT_6;

-        local_f8 = &DAT_7;

-        local_108.Reserved = 2;

-        local_f0 = 0x52;

-        local_ec = 1;

-        if (DAT_8 == FUN_18004e7b0) {

-          bVar9 = 0;

-          pbVar7 = &DAT_9;

-          do {

-            bVar1 = *pbVar7;

-            pbVar7 = pbVar7 + 1;

-          } while ((char)bVar1 < '\0');

-          do {

-            bVar1 = *pbVar7;

-            pbVar7 = pbVar7 + 1;

-          } while (bVar1 != 0);

-          uVar10 = 0;

-          if (pbVar7 < &DAT_10) {

-            while( true ) {

-              do {

-                pbVar8 = pbVar7;

-                bVar9 = (byte)uVar10;

-                pbVar7 = pbVar8 + 1;

-              } while (*pbVar8 != 0);

-              bVar1 = pbVar8[1];

-              if (-1 < (char)bVar1) break;

-              pbVar7 = pbVar8 + 3;

-              if (-1 < (char)pbVar8[2]) break;

-              bVar2 = *pbVar7;

-              while ((char)bVar2 < '\0') {

-                if (bVar2 != 0x80) goto LAB_11;

-                pbVar8 = pbVar7 + 1;

-                pbVar7 = pbVar7 + 1;

-                bVar2 = *pbVar8;

-              }

-              if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar2 + 0x8f))) break;

-              bVar9 = bVar9 + 1;

-              *(byte *)((longlong)&local_e0 + uVar10 * 0x10 + 5) = bVar2;

-              uVar10 = (ulonglong)bVar9;

-              if (&UNK_12 < pbVar7) break;

-            }

-          }

-LAB_11:

-          if (bVar9 != 0) {

-            FUN_1800e3380(0x180135218,(undefined8 *)&local_130,7,(longlong)&local_108,bVar9);

-            return 0x78;

-          }

-          EventWriteTransfer(DAT_13,&local_130,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_108);

-        }

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_9c = 0;

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = uVar3;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

       }

     }

-    uVar5 = 0x78;

+    uVar2 = 0;

   }

-  return uVar5;

+  return uVar2;

 }
```

## `DnsFreeZtConfig`  (modified)

```diff
--- DnsFreeZtConfig
+++ Util_IsIp6Running
@@ -1,72 +1,87 @@
 

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

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

 

-void DnsFreeZtConfig(LPVOID param_1)

+int Util_IsIp6Running(void)

 

 {

   bool bVar1;

-  undefined4 uVar2;

+  int iVar2;

+  int iVar3;

+  undefined7 extraout_var;

+  undefined4 uVar4;

   LPCSTR unaff_retaddr;

   undefined1 auStackY_148 [32];

   undefined8 local_118;

   undefined8 local_110;

   _EVENT_DATA_DESCRIPTOR local_108 [2];

   undefined8 *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   char *local_d8;

   undefined4 local_d0;

   undefined4 local_cc;

   char *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   undefined8 local_b8 [2];

   undefined8 *local_a8;

   undefined4 local_a0;

   undefined4 local_9c;

   short local_98 [64];

   ulonglong local_18;

   

-                    /* 0x9db70  102  DnsFreeZtConfig */

+                    /* 0x9d870  359  Util_IsIp6Running */

   local_18 = DAT_0 ^ (ulonglong)auStackY_148;

   if (DAT_1 == 0) {

-    DnsApiFree(param_1);

+    iVar3 = DAT_2;

+    if (DAT_2 == 0) {

+      bVar1 = FUN_1800a02c0(0x17);

+      iVar2 = (int)CONCAT71(extraout_var,bVar1);

+      iVar3 = DAT_2;

+      if (iVar2 != 0) {

+        LOCK();

+        UNLOCK();

+        iVar3 = iVar2;

+        DAT_2 = iVar2;

+      }

+    }

   }

   else {

     memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

+    if (DAT_3 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_dc = 0;

         local_e8 = &local_118;

         local_cc = 0;

         local_bc = 0;

-        uVar2 = 8;

+        uVar4 = 8;

         local_118 = 1;

-        local_d8 = "DnsFreeZtConfig";

+        local_d8 = "Util_IsIp6Running";

         local_c8 = "FALSE";

         local_e0 = 8;

-        local_d0 = 0x10;

+        local_d0 = 0x12;

         local_c0 = 6;

         FUN_180055600(local_b8,(undefined *)local_98);

         local_9c = 0;

         local_a8 = &local_110;

         local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

+        local_a0 = uVar4;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

       }

     }

+    iVar3 = 0;

   }

-  return;

+  return iVar3;

 }
```

## `NetInfo_UpdateNetworkProperties`  (modified)

```diff
--- NetInfo_UpdateNetworkProperties
+++ NetInfo_IsTcpipConfigChange
@@ -1,14 +1,15 @@
 

-ulonglong NetInfo_UpdateNetworkProperties

-                    (int param_1,int param_2,int param_3,longlong *param_4,longlong param_5,

-                    longlong *param_6,undefined4 *param_7)

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

+

+PCNZWCH NetInfo_IsTcpipConfigChange(longlong param_1)

 

 {

-  code *pcVar1;

-  ulonglong uVar2;

+  uint unaff_EBX;

   

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

-  uVar2 = (*pcVar1)();

-  return uVar2;

+  NetInfo_Free((longlong *)param_1);

+  if ((DAT_0 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x2f,0x180111c20,unaff_EBX);

+  }

+  return (PCNZWCH)(ulonglong)unaff_EBX;

 }
```

## `NetInfo_UpdateServerReachability`  (modified)

```diff
--- NetInfo_UpdateServerReachability
+++ NetInfo_ResetServerPriorities
@@ -1,150 +1,33 @@
 

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

 

-undefined4

-NetInfo_UpdateServerReachability(SOCKADDR_INET *param_1,PCNZWCH param_2,undefined1 *param_3)

+undefined4 NetInfo_ResetServerPriorities(longlong *param_1,int param_2)

 

 {

-  longlong lVar1;

-  bool bVar2;

-  uint uVar3;

-  undefined7 extraout_var;

-  undefined8 uVar4;

-  undefined1 *puVar5;

-  void *pvVar6;

-  undefined8 *puVar7;

-  undefined2 uVar8;

-  ushort uVar9;

-  ushort *puVar10;

-  code *pcVar11;

-  undefined8 uVar12;

-  code *in_R9;

-  code *pcVar13;

-  undefined1 auStackY_a8 [32];

-  ushort local_78 [2];

-  int iStack_74;

-  int aiStack_70 [14];

-  ulonglong local_38;

+  int *in_RAX;

+  undefined4 unaff_EBX;

+  longlong unaff_RBP;

+  byte unaff_R12B;

+  undefined8 *unaff_R14;

+  undefined8 *unaff_R15;

   

-  local_38 = DAT_0 ^ (ulonglong)auStackY_a8;

-  pcVar13 = in_R9;

-  memset(local_78,0,0x40);

-  pcVar11 = *(code **)((longlong)param_1 + 0xf0);

-  puVar5 = (undefined1 *)0x0;

-  lVar1 = *(longlong *)((longlong)param_1 + 0x400);

-  if ((DAT_1 & 0x80) != 0) {

-    pcVar13 = pcVar11;

-    FUN_1800f5ac4(0x41f,10,0x18010cf00,(wchar_t *)pcVar11);

+  *in_RAX = *in_RAX + (int)in_RAX;

+  *(char *)in_RAX = (char)*in_RAX + (char)in_RAX;

+  if (unaff_R15 == (undefined8 *)0x0) {

+    FUN_18002a140(*(longlong **)(unaff_RBP + -0x28));

   }

-  *(undefined4 *)((longlong)param_1 + 0x20c) = 0;

-  *(undefined8 *)((longlong)param_1 + 0x3f8) = 0;

-  if (pcVar11 == (code *)0x0) {

-    return 0x232b;

+  else {

+    *unaff_R15 = *(undefined8 *)(unaff_RBP + -0x28);

   }

-  uVar12 = 0;

-  bVar2 = FUN_180018834(local_78,(wchar_t *)pcVar11,0,pcVar13,1);

-  if ((int)CONCAT71(extraout_var,bVar2) == 0) {

-    if ((DAT_1 & 0x80) == 0) {

-      return 0x232b;

-    }

-    uVar9 = (short)CONCAT71(extraout_var,bVar2) + 0xb;

-    uVar8 = 0x41f;

-    goto LAB_2;

+  if (unaff_R14 == (undefined8 *)0x0) {

+    FUN_18002a140(*(longlong **)(unaff_RBP + -0x20));

   }

-  if (-1 < *(int *)((longlong)param_1 + 0x108)) {

-    puVar10 = (ushort *)0x0;

-    if ((*(uint *)(lVar1 + 0x38) & 0x110) != 0x110) {

-      if ((*(byte *)(lVar1 + 0x38) & 0x10) == 0) {

-        if ((*(uint *)(lVar1 + 0x38) & 0x100) == 0) goto LAB_3;

-        puVar10 = (ushort *)0x17;

-      }

-      else {

-        puVar10 = (ushort *)0x2;

-      }

-    }

-    uVar3 = FUN_180010b48(local_78,(uint)puVar10);

-    if (uVar3 != 0) {

-      if ((DAT_4 & 0x80) != 0) {

-        puVar10 = (ushort *)0xc;

-LAB_5:

-        FUN_1800f7614(0x40f,(ushort)puVar10,0x18010cf00);

-      }

-LAB_6:

-      pcVar11 = *(code **)(lVar1 + 0x18);

-      if (pcVar11 == (code *)0x0) {

-        pcVar11 = (code *)L"localhost";

-      }

-      else if ((((ulonglong)in_R9 & 0x40) == 0) &&

-              (((pcVar13 = *(code **)(lVar1 + 0x10), pcVar13 != (code *)0x0 ||

-                ((puVar5 != (undefined1 *)0x0 &&

-                 (pcVar13 = *(code **)(puVar5 + 8), pcVar13 != (code *)0x0)))) &&

-               (pvVar6 = FUN_18000c320((code *)((longlong)param_1 + 0xad0),puVar10,

-                                       (wchar_t *)pcVar11,pcVar13), pvVar6 != (void *)0x0)))) {

-        pcVar11 = (code *)((longlong)param_1 + 0xad0);

-      }

-      puVar7 = FUN_18005040c((short *)local_78,(LPCWSTR)pcVar11,

-                             (undefined *)(ulonglong)DAT_7,(ulonglong)pcVar13);

-      if (puVar7 != (undefined8 *)0x0) {

-        if ((DAT_4 & 0x80) != 0) {

-          FUN_1800e78c0();

-        }

-        *(undefined8 **)((longlong)param_1 + 0x3f8) = puVar7;

-        return 0;

-      }

-      if ((DAT_1 & 0x80) == 0) {

-        return 0x232b;

-      }

-      uVar9 = 0xf;

-      uVar8 = 0x41f;

-      goto LAB_2;

-    }

-    if (((uint)puVar10 == 0) || ((uint)puVar10 == (uint)local_78[0])) {

-      if (local_78[0] == 0x17) {

-        uVar4 = FUN_180057de8(aiStack_70);

-        uVar3 = (uint)uVar4;

-      }

-      else {

-        if (local_78[0] != 2) goto LAB_3;

-        uVar3 = (uint)(iStack_74 == 0);

-      }

-      if (uVar3 != 0) {

-        if ((DAT_4 & 0x80) != 0) {

-          puVar10 = (ushort *)0xd;

-          goto LAB_5;

-        }

-        goto LAB_6;

-      }

-    }

+  else {

+    *unaff_R14 = *(undefined8 *)(unaff_RBP + -0x20);

   }

-LAB_3:

-  if (((param_2 != (PCNZWCH)0x0) && (param_3 == (undefined1 *)0x0)) &&

-     (param_3 = (undefined1 *)NetInfo_GetAdapterByName(lVar1,param_2), param_3 == (undefined1 *)0x0)

-     ) {

-    return 0x232b;

+  if ((DAT_0 & unaff_R12B) != 0) {

+    FUN_1800f7614(0x40b,0x2d,0x180111c20);

   }

-  *(undefined4 *)(lVar1 + 0x40) = 0;

-  puVar5 = (undefined1 *)FUN_180053a0c(lVar1);

-  while (puVar5 != (undefined1 *)0x0) {

-    if ((param_3 == (undefined1 *)0x0) || (param_3 == puVar5)) {

-      puVar10 = local_78;

-      if (DAT_8 == 0) {

-        pcVar13 = (code *)(-(ulonglong)(DAT_9 != 0) & 0x1800a0690);

-      }

-      else {

-        pcVar13 = FUN_1800a0690;

-      }

-      uVar4 = FUN_1800106f8(*(longlong *)(puVar5 + 0x20),(short *)puVar10,uVar12,pcVar13);

-      if ((int)uVar4 != 0) goto LAB_6;

-    }

-    puVar5 = (undefined1 *)FUN_180053a0c(lVar1);

-  }

-  if ((DAT_4 & 0x80) == 0) {

-    return 0x232b;

-  }

-  uVar9 = 0xe;

-  uVar8 = 0x40f;

-LAB_2:

-  FUN_1800f5ac4(uVar8,uVar9,0x18010cf00,(wchar_t *)pcVar11);

-  return 0x232b;

+  return unaff_EBX;

 }
```

## `Reg_ReadGlobalsEx`  (modified)

```diff
--- Reg_ReadGlobalsEx
+++ Reg_ReadGlobalsEx
@@ -1,10 +1,299 @@
 

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

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

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

 

 int Reg_ReadGlobalsEx(uint param_1,HKEY *param_2)

 

 {

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

-  halt_baddata();

+  byte bVar1;

+  byte bVar2;

+  uint *puVar3;

+  longlong lVar4;

+  bool bVar5;

+  int iVar6;

+  int extraout_EAX;

+  longlong lVar7;

+  byte *pbVar8;

+  byte *pbVar9;

+  undefined7 extraout_var;

+  ulonglong uVar10;

+  LPCRITICAL_SECTION p_Var11;

+  wchar_t *pwVar12;

+  uint uVar13;

+  undefined *puVar14;

+  byte bVar15;

+  undefined4 *puVar16;

+  longlong *plVar17;

+  LPCSTR unaff_retaddr;

+  undefined1 auStackY_1a8 [32];

+  uint local_178 [2];

+  EVENT_DESCRIPTOR local_170;

+  undefined8 local_160;

+  undefined8 local_158;

+  HKEY local_150;

+  undefined8 uStack_148;

+  undefined8 local_140;

+  _EVENT_DATA_DESCRIPTOR local_138;

+  undefined *local_128;

+  undefined4 local_120;

+  undefined4 local_11c;

+  undefined8 *local_118;

+  undefined8 local_110;

+  char *local_108;

+  undefined8 local_100;

+  char *local_f8;

+  undefined8 local_f0;

+  short *local_e8;

+  int local_e0;

+  undefined4 local_dc;

+  undefined8 *local_d8;

+  undefined8 local_d0;

+  short local_c8 [64];

+  ulonglong local_48;

+  

+                    /* 0x14280  334  Reg_ReadGlobalsEx */

+  local_48 = DAT_0 ^ (ulonglong)auStackY_1a8;

+  local_150 = (HKEY)0x0;

+  uStack_148 = 0;

+  local_140 = 0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f82f0(0x40b,0x12,0x1801102b8,param_1,param_2);

+  }

+  if (((DAT_2 != 0) && (DAT_18013630c == 0)) &&

+     (iVar6 = FUN_1800ca394(unaff_retaddr), iVar6 == 0)) {

+    local_c8[0] = 0;

+    local_c8[1] = 0;

+    local_c8[2] = 0;

+    local_c8[3] = 0;

+    local_c8[4] = 0;

+    local_c8[5] = 0;

+    local_c8[6] = 0;

+    local_c8[7] = 0;

+    local_c8[8] = 0;

+    local_c8[9] = 0;

+    local_c8[10] = 0;

+    local_c8[0xb] = 0;

+    local_c8[0xc] = 0;

+    local_c8[0xd] = 0;

+    local_c8[0xe] = 0;

+    local_c8[0xf] = 0;

+    local_c8[0x10] = 0;

+    local_c8[0x11] = 0;

+    local_c8[0x12] = 0;

+    local_c8[0x13] = 0;

+    local_c8[0x14] = 0;

+    local_c8[0x15] = 0;

+    local_c8[0x16] = 0;

+    local_c8[0x17] = 0;

+    local_c8[0x18] = 0;

+    local_c8[0x19] = 0;

+    local_c8[0x1a] = 0;

+    local_c8[0x1b] = 0;

+    local_c8[0x1c] = 0;

+    local_c8[0x1d] = 0;

+    local_c8[0x1e] = 0;

+    local_c8[0x1f] = 0;

+    local_c8[0x20] = 0;

+    local_c8[0x21] = 0;

+    local_c8[0x22] = 0;

+    local_c8[0x23] = 0;

+    local_c8[0x24] = 0;

+    local_c8[0x25] = 0;

+    local_c8[0x26] = 0;

+    local_c8[0x27] = 0;

+    local_c8[0x28] = 0;

+    local_c8[0x29] = 0;

+    local_c8[0x2a] = 0;

+    local_c8[0x2b] = 0;

+    local_c8[0x2c] = 0;

+    local_c8[0x2d] = 0;

+    local_c8[0x2e] = 0;

+    local_c8[0x2f] = 0;

+    local_c8[0x30] = 0;

+    local_c8[0x31] = 0;

+    local_c8[0x32] = 0;

+    local_c8[0x33] = 0;

+    local_c8[0x34] = 0;

+    local_c8[0x35] = 0;

+    local_c8[0x36] = 0;

+    local_c8[0x37] = 0;

+    local_c8[0x38] = 0;

+    local_c8[0x39] = 0;

+    local_c8[0x3a] = 0;

+    local_c8[0x3b] = 0;

+    local_c8[0x3c] = 0;

+    local_c8[0x3d] = 0;

+    local_c8[0x3e] = 0;

+    local_c8[0x3f] = 0;

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_c8,0x40);

+    }

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         ((DAT_6 & 0x400000000000) != DAT_6)) {

+        bVar5 = false;

+      }

+      else {

+        bVar5 = true;

+      }

+      if (bVar5) {

+        local_118 = &local_160;

+        local_160 = 1;

+        local_110 = 8;

+        local_108 = "Reg_ReadGlobalsEx";

+        local_100 = 0x12;

+        local_f8 = "FALSE";

+        lVar7 = -1;

+        local_f0 = 6;

+        do {

+          lVar4 = lVar7 + 1;

+          lVar7 = lVar7 + 1;

+        } while (local_c8[lVar4] != 0);

+        local_e0 = (int)lVar7 * 2 + 2;

+        local_dc = 0;

+        local_e8 = local_c8;

+        local_d8 = &local_158;

+        local_170.Level = '\x05';

+        local_170.Opcode = '\0';

+        local_170.Task = 0;

+        local_138.Ptr = (ULONGLONG)PTR_DAT_7;

+        local_158 = 0x1000000;

+        local_d0 = 8;

+        local_170.Id = 0;

+        local_170.Version = '\0';

+        local_170.Channel = '\v';

+        local_170.Keyword = 0x400000000000;

+        local_138.Size = (ULONG)*(ushort *)PTR_DAT_7;

+        local_128 = &DAT_8;

+        local_138.Reserved = 2;

+        local_120 = 0x52;

+        local_11c = 1;

+        local_178[0] = 0x75c6;

+        if (DAT_9 == FUN_18004e7b0) {

+          bVar15 = 0;

+          pbVar8 = &DAT_10;

+          do {

+            bVar1 = *pbVar8;

+            pbVar8 = pbVar8 + 1;

+          } while ((char)bVar1 < '\0');

+          do {

+            bVar1 = *pbVar8;

+            pbVar8 = pbVar8 + 1;

+          } while (bVar1 != 0);

+          uVar10 = 0;

+          if (pbVar8 < &DAT_11) {

+            while( true ) {

+              do {

+                pbVar9 = pbVar8;

+                bVar15 = (byte)uVar10;

+                pbVar8 = pbVar9 + 1;

+              } while (*pbVar9 != 0);

+              bVar1 = pbVar9[1];

+              if (-1 < (char)bVar1) break;

+              pbVar8 = pbVar9 + 3;

+              if (-1 < (char)pbVar9[2]) break;

+              bVar2 = *pbVar8;

+              while ((char)bVar2 < '\0') {

+                if (bVar2 != 0x80) goto LAB_12;

+                pbVar9 = pbVar8 + 1;

+                pbVar8 = pbVar8 + 1;

+                bVar2 = *pbVar9;

+              }

+              if (((bVar1 & 0x7f) != 9) || (2 < (byte)(bVar2 + 0x8f))) break;

+              bVar15 = bVar15 + 1;

+              *(byte *)((longlong)&local_110 + uVar10 * 0x10 + 5) = bVar2;

+              uVar10 = (ulonglong)bVar15;

+              if (&UNK_13 < pbVar8) break;

+            }

+          }

+LAB_12:

+          if (bVar15 != 0) {

+            FUN_1800e3380(0x180135218,(undefined8 *)&local_170,7,(longlong)&local_138,bVar15);

+            return 0x78;

+          }

+          EventWriteTransfer(DAT_14,&local_170,(LPCGUID)0x0,(LPCGUID)0x0,7,&local_138);

+        }

+      }

+    }

+    return 0x78;

+  }

+  iVar6 = DAT_15;

+  p_Var11 = (LPCRITICAL_SECTION)&DAT_16;

+  if (DAT_17 == 0) {

+    p_Var11 = (LPCRITICAL_SECTION)&DAT_18;

+  }

+  EnterCriticalSection(p_Var11);

+  if ((iVar6 == 0) && ((DAT_15 = 1, (param_1 & 2) == 0 || (DAT_180136304 == 0)))) {

+    if (DAT_19 == 0) {

+      FUN_180074930();

+    }

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

+      param_2 = &local_150;

+      iVar6 = FUN_180046c18(&local_150);

+      if (iVar6 != 0) goto LAB_20;

+    }

+    pwVar12 = (wchar_t *)0x0;

+    puVar14 = (undefined *)0x1c8;

+    puVar16 = &DAT_21;

+    memset(&DAT_21,0,0x1c8);

+    bVar5 = FUN_1800d47bc();

+    DAT_22 = (undefined4)CONCAT71(extraout_var,bVar5);

+    plVar17 = &DAT_23;

+    uVar13 = 0;

+    do {

+      puVar3 = (uint *)*plVar17;

+      local_178[0] = 0;

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

+        if (puVar3 == (uint *)0xffffffffffffffff) break;

+        puVar14 = (undefined *)0x0;

+        pwVar12 = (wchar_t *)0x0;

+        uVar13 = FUN_180082f60(param_2,(HKEY)0x0,(HKEY)0x0,uVar13,local_178);

+        *puVar3 = local_178[0];

+        if (extraout_EAX == 0) {

+          *puVar16 = 1;

+        }

+      }

+      uVar13 = uVar13 + 1;

+      plVar17 = plVar17 + 1;

+      puVar16 = puVar16 + 1;

+    } while (uVar13 < 0x72);

+    if (((DAT_19 == 0) && (DAT_180137374 == 0)) && (DAT_1801356dc != 0)) {

+      _DAT_24 = 0x15180;

+    }

+    FUN_1800467e4(param_2,(int *)pwVar12,puVar14);

+    if (param_2 == &local_150) {

+      FUN_18004dd88(param_2);

+    }

+    if ((param_1 & 4) == 0) {

+      if ((param_1 & 1) != 0) {

+        uVar10 = FUN_18007d50c(1,pwVar12);

+        iVar6 = (int)uVar10;

+        goto joined_r0x00018001471c;

+      }

+    }

+    else {

+      uVar10 = FUN_18007d50c(2,pwVar12);

+      iVar6 = (int)uVar10;

+joined_r0x00018001471c:

+      if (iVar6 != 0) goto LAB_20;

+      AcquireSRWLockShared((PSRWLOCK)&DAT_25);

+      FUN_18007e9c0();

+      ReleaseSRWLockShared((PSRWLOCK)&DAT_25);

+    }

+    if (DAT_26 != 0) {

+      _DAT_27 = 0;

+    }

+    FUN_1800351c0();

+  }

+  iVar6 = 0;

+LAB_20:

+  p_Var11 = (LPCRITICAL_SECTION)&DAT_16;

+  DAT_15 = 0;

+  DAT_28 = 1;

+  if (DAT_17 == 0) {

+    p_Var11 = (LPCRITICAL_SECTION)&DAT_18;

+  }

+  LeaveCriticalSection(p_Var11);

+  return iVar6;

 }
```

## `Trace_Reset`  (modified)

```diff
--- Trace_Reset
+++ Local_GetRecordsForLocalName
@@ -1,61 +1,18 @@
 

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

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

 

-void Trace_Reset(void)

+uint Local_GetRecordsForLocalName(longlong param_1,ushort param_2)

 

 {

-  bool bVar1;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined8 local_e0;

-  char *local_d8;

-  undefined8 local_d0;

-  char *local_c8;

-  undefined8 local_c0;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined8 local_a0;

-  short local_98 [64];

-  ulonglong local_18;

+  undefined6 in_register_00000012;

+  longlong unaff_RBP;

+  undefined4 in_R9D;

+  undefined8 uStack0000000000000038;

   

-                    /* 0x6c1e0  357  Trace_Reset */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 == 0) {

-    LOCK();

-    DAT_2 = 0;

-    UNLOCK();

-  }

-  else {

-    memset(local_98,0,0x80);

-    if (DAT_3 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

-        bVar1 = false;

-      }

-      if (bVar1) {

-        local_e8 = &local_118;

-        local_118 = 1;

-        local_e0 = 8;

-        local_d8 = "Trace_Reset";

-        local_d0 = 0xc;

-        local_c8 = "FALSE";

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

-      }

-    }

-  }

-  return;

+  *(undefined4 *)(unaff_RBP + -0x58) = in_R9D;

+  uStack0000000000000038 = 0x1000000;

+  FUN_1800e3690(0x180135218,(byte *)CONCAT62(in_register_00000012,param_2),0,7,

+                (PEVENT_DATA_DESCRIPTOR)((ulonglong)&stack0x00000040 & 0xffffffff));

+  return 0x78;

 }
```

## `Socket_CleanupWinsock`  (modified)

```diff
--- Socket_CleanupWinsock
+++ QueryDirectEx
@@ -1,69 +1,12 @@
 

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

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

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

 

-void Socket_CleanupWinsock(void)

+int QueryDirectEx(longlong *param_1,longlong *param_2,void *param_3,int param_4,WCHAR *param_5,

+                 ushort param_6,undefined8 *param_7,uint param_8,undefined8 param_9)

 

 {

-  bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

-  

-                    /* 0x9d3e0  343  Socket_CleanupWinsock */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 != 0) {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "Socket_CleanupWinsock";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x16;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-  }

-  return;

+  in((short)param_2);

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

+  halt_baddata();

 }
```

## `Socket_CreateMulticast`  (modified)

```diff
--- Socket_CreateMulticast
+++ Send_OpenTcpConnectionAndSend
@@ -1,70 +1,19 @@
 

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

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

-

-undefined8 Socket_CreateMulticast(void)

+ulonglong Send_OpenTcpConnectionAndSend(longlong param_1,ushort *param_2)

 

 {

-  bool bVar1;

-  undefined4 uVar2;

-  LPCSTR unaff_retaddr;

-  undefined1 auStackY_148 [32];

-  undefined8 local_118;

-  undefined8 local_110;

-  _EVENT_DATA_DESCRIPTOR local_108 [2];

-  undefined8 *local_e8;

-  undefined4 local_e0;

-  undefined4 local_dc;

-  char *local_d8;

-  undefined4 local_d0;

-  undefined4 local_cc;

-  char *local_c8;

-  undefined4 local_c0;

-  undefined4 local_bc;

-  undefined8 local_b8 [2];

-  undefined8 *local_a8;

-  undefined4 local_a0;

-  undefined4 local_9c;

-  short local_98 [64];

-  ulonglong local_18;

+  code *pcVar1;

+  ulonglong uVar2;

+  int in_EAX;

+  undefined4 in_register_00000004;

+  char unaff_BL;

+  longlong unaff_RBP;

   

-                    /* 0x9d540  348  Socket_CreateMulticast */

-  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

-  if (DAT_1 != 0) {

-    memset(local_98,0,0x80);

-    if (DAT_2 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

-    }

-    if (5 < DAT_3) {

-      if (((_DAT_4 & 0x400000000000) == 0) ||

-         ((DAT_5 & 0x400000000000) != DAT_5)) {

-        bVar1 = false;

-      }

-      else {

-        bVar1 = true;

-      }

-      if (bVar1) {

-        local_dc = 0;

-        local_e8 = &local_118;

-        local_cc = 0;

-        local_bc = 0;

-        uVar2 = 8;

-        local_118 = 1;

-        local_d8 = "Socket_CreateMulticast";

-        local_c8 = "FALSE";

-        local_e0 = 8;

-        local_d0 = 0x17;

-        local_c0 = 6;

-        FUN_180055600(local_b8,(undefined *)local_98);

-        local_9c = 0;

-        local_a8 = &local_110;

-        local_110 = 0x1000000;

-        local_a0 = uVar2;

-        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_108);

-      }

-    }

-  }

-  SetLastError(0x267b);

-  return 0;

+  *(int *)CONCAT44(in_register_00000004,in_EAX) =

+       *(int *)CONCAT44(in_register_00000004,in_EAX) + in_EAX;

+  *(char *)(unaff_RBP + -0x3d) = *(char *)(unaff_RBP + -0x3d) + unaff_BL;

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

+  uVar2 = (*pcVar1)();

+  return uVar2;

 }
```

## `Socket_JoinMulticast`  (modified)

```diff
--- Socket_JoinMulticast
+++ Socket_Create
@@ -1,120 +1,76 @@
 

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

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

 

-int Socket_JoinMulticast(SOCKET param_1,uint param_2,short *param_3,int param_4,int param_5)

+SOCKET Socket_Create(int param_1,int param_2,void *param_3,short param_4,undefined4 param_5)

 

 {

   bool bVar1;

   int iVar2;

-  u_long uVar3;

-  SOCKET SVar4;

-  undefined8 uVar5;

-  char *optval;

+  SOCKET SVar3;

+  undefined4 uVar4;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_198 [32];

-  int optlen;

-  undefined8 local_158;

-  undefined8 local_150;

-  undefined4 local_148;

-  undefined4 uStack_144;

-  undefined4 uStack_140;

-  undefined4 uStack_13c;

-  uint local_138;

+  undefined1 auStackY_168 [32];

+  undefined8 in_stack_fffffffffffffeb8;

+  undefined8 local_138;

+  undefined8 local_130;

   _EVENT_DATA_DESCRIPTOR local_128 [2];

   undefined8 *local_108;

   undefined4 local_100;

   undefined4 local_fc;

   char *local_f8;

   undefined4 local_f0;

   undefined4 local_ec;

   char *local_e8;

   undefined4 local_e0;

   undefined4 local_dc;

   undefined8 local_d8 [2];

   undefined8 *local_c8;

   undefined4 local_c0;

   undefined4 local_bc;

   short local_b8 [64];

   ulonglong local_38;

   

-                    /* 0x7ad60  350  Socket_JoinMulticast */

-  local_38 = DAT_0 ^ (ulonglong)auStackY_198;

-  if ((DAT_1 & 8) != 0) {

-    FUN_1800ec588();

-  }

-  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

-     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

-    if ((param_1 - 1 < 0xfffffffffffffffe) && ((param_4 != 0 || (param_5 != 0)))) {

-      if (*param_3 == 2) {

-        local_158 = CONCAT44(local_158._4_4_,*(undefined4 *)(param_3 + 2));

-        uVar3 = htonl(param_2 & 0xffff);

-        optlen = 8;

-        optval = (char *)&local_158;

-        local_158 = CONCAT44(uVar3,(undefined4)local_158);

-        iVar2 = 0;

-      }

-      else {

-        local_148 = *(undefined4 *)(param_3 + 4);

-        uStack_144 = *(undefined4 *)(param_3 + 6);

-        uStack_140 = *(undefined4 *)(param_3 + 8);

-        uStack_13c = *(undefined4 *)(param_3 + 10);

-        local_138 = param_2 & 0xffff;

-        optval = (char *)&local_148;

-        optlen = 0x14;

-        iVar2 = 0x29;

-      }

-      uVar5 = 0xc;

-      SVar4 = param_1;

-      iVar2 = setsockopt(param_1,iVar2,0xc,optval,optlen);

-      if (iVar2 == -1) {

-        iVar2 = WSAGetLastError();

-        if ((DAT_1 & 8) != 0) {

-          FUN_1800e6694(SVar4,0x1b,uVar5,param_1);

-        }

-      }

-      else {

-        iVar2 = 0;

-      }

-    }

-    else {

-      iVar2 = 0x57;

-    }

-  }

-  else {

+                    /* 0x7a590  347  Socket_Create */

+  uVar4 = (undefined4)((ulonglong)in_stack_fffffffffffffeb8 >> 0x20);

+  local_38 = DAT_0 ^ (ulonglong)auStackY_168;

+  if (((DAT_1 != 0) && (DAT_18013630c == 0)) &&

+     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 == 0)) {

     memset(local_b8,0,0x80);

-    if (DAT_3 != 0) {

+    if (DAT_2 != 0) {

       FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

     }

-    if (5 < DAT_4) {

-      if (((_DAT_5 & 0x400000000000) == 0) ||

-         ((DAT_6 & 0x400000000000) != DAT_6)) {

+    if (5 < DAT_3) {

+      if (((_DAT_4 & 0x400000000000) == 0) ||

+         ((DAT_5 & 0x400000000000) != DAT_5)) {

         bVar1 = false;

       }

       else {

         bVar1 = true;

       }

       if (bVar1) {

         local_fc = 0;

-        local_108 = &local_158;

+        local_108 = &local_138;

         local_ec = 0;

         local_dc = 0;

-        local_f8 = "Socket_JoinMulticast";

+        uVar4 = 8;

+        local_138 = 1;

+        local_f8 = "Socket_Create";

         local_e8 = "FALSE";

-        local_158 = 1;

         local_100 = 8;

-        local_f0 = 0x15;

+        local_f0 = 0xe;

         local_e0 = 6;

         FUN_180055600(local_d8,(undefined *)local_b8);

         local_bc = 0;

-        local_c8 = &local_150;

-        local_150 = 0x1000000;

-        local_c0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_128);

+        local_c8 = &local_130;

+        local_130 = 0x1000000;

+        local_c0 = uVar4;

+        FUN_1800e3690(0x180135218,&DAT_6,0,7,local_128);

       }

     }

-    iVar2 = 0x78;

+    return 0;

   }

-  return iVar2;

+  SVar3 = FUN_180036884(param_1,param_2,param_3,param_4,CONCAT44(uVar4,param_5),0);

+  return SVar3;

 }
```

## `Faz_AreServerListsInSameNameSpace`  (modified)

```diff
--- Faz_AreServerListsInSameNameSpace
+++ Trace_Reset
@@ -1,98 +1,61 @@
 

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

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

 

-ulonglong Faz_AreServerListsInSameNameSpace

-                    (_CERT_EXTENSION *param_1,longlong param_2,longlong param_3)

+void Trace_Reset(void)

 

 {

   bool bVar1;

-  int iVar2;

-  undefined8 uVar3;

-  wchar_t *pwVar4;

-  ulonglong uVar5;

-  ulonglong uVar6;

   LPCSTR unaff_retaddr;

-  undefined1 auStackY_188 [32];

-  longlong *local_148;

-  longlong *local_140;

-  undefined8 local_138;

-  undefined8 local_130;

-  _EVENT_DATA_DESCRIPTOR local_128 [2];

-  undefined8 *local_108;

-  undefined8 local_100;

-  char *local_f8;

-  undefined8 local_f0;

-  char *local_e8;

+  undefined1 auStackY_148 [32];

+  undefined8 local_118;

+  undefined8 local_110;

+  _EVENT_DATA_DESCRIPTOR local_108 [2];

+  undefined8 *local_e8;

   undefined8 local_e0;

-  undefined8 local_d8 [2];

-  undefined8 *local_c8;

+  char *local_d8;

+  undefined8 local_d0;

+  char *local_c8;

   undefined8 local_c0;

-  short local_b8 [64];

-  ulonglong local_38;

+  undefined8 local_b8 [2];

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  short local_98 [64];

+  ulonglong local_18;

   

-                    /* 0x6c600  302  Faz_AreServerListsInSameNameSpace */

-  local_38 = DAT_0 ^ (ulonglong)auStackY_188;

-  uVar5 = 0;

-  local_148 = (longlong *)0x0;

-  local_140 = (longlong *)0x0;

-  if ((DAT_1 & 8) != 0) {

-    FUN_1800f7614(0x40b,0x2e,0x180111c20);

-  }

-  if (((DAT_2 == 0) || (DAT_18013630c != 0)) ||

-     (iVar2 = FUN_1800ca394(unaff_retaddr), iVar2 != 0)) {

-    if (((param_2 != 0) && (param_3 != 0)) && (param_1 != (_CERT_EXTENSION *)0x0)) {

-      uVar3 = FUN_18006451c(param_2,param_3);

-      if ((int)uVar3 != 0) {

-        return 1;

-      }

-      uVar6 = uVar5;

-      if (DAT_3 != 0) {

-        uVar6 = 0x20000000000000;

-      }

-      pwVar4 = FUN_180062d10(param_1,uVar6 | 8,param_2,0,(ulonglong *)&local_148);

-      if (((int)pwVar4 == 0) &&

-         (pwVar4 = FUN_180062d10(param_1,uVar6 | 8,param_3,0,(ulonglong *)&local_140),

-         (int)pwVar4 == 0)) {

-        uVar5 = FUN_18006c894(param_2,(longlong)local_148,(longlong *)0x0,param_3,

-                              (longlong)local_140,(longlong *)0x0,1);

-        uVar5 = uVar5 & 0xffffffff;

-      }

-      NetInfo_Free(local_148);

-      NetInfo_Free(local_140);

-      if ((DAT_1 & 8) == 0) {

-        return uVar5;

-      }

-      FUN_1800f658c(0x40b,0x2f,0x180111c20,(int)uVar5);

-      return uVar5;

-    }

+                    /* 0x6c1e0  357  Trace_Reset */

+  local_18 = DAT_0 ^ (ulonglong)auStackY_148;

+  if (DAT_1 == 0) {

+    LOCK();

+    DAT_2 = 0;

+    UNLOCK();

   }

   else {

-    memset(local_b8,0,0x80);

-    if (DAT_4 != 0) {

-      FUN_1800ca1b8(unaff_retaddr,0,local_b8,0x40);

+    memset(local_98,0,0x80);

+    if (DAT_3 != 0) {

+      FUN_1800ca1b8(unaff_retaddr,0,local_98,0x40);

     }

-    if (5 < DAT_5) {

-      if (((_DAT_6 & 0x400000000000) == 0) ||

-         (bVar1 = true, (DAT_7 & 0x400000000000) != DAT_7)) {

+    if (5 < DAT_4) {

+      if (((_DAT_5 & 0x400000000000) == 0) ||

+         (bVar1 = true, (DAT_6 & 0x400000000000) != DAT_6)) {

         bVar1 = false;

       }

       if (bVar1) {

-        local_108 = &local_138;

-        local_138 = 1;

-        local_100 = 8;

-        local_f8 = "Faz_AreServerListsInSameNameSpace";

-        local_f0 = 0x22;

-        local_e8 = "FALSE";

-        local_e0 = 6;

-        FUN_180055600(local_d8,(undefined *)local_b8);

-        local_c8 = &local_130;

-        local_130 = 0x1000000;

-        local_c0 = 8;

-        FUN_1800e3690(0x180135218,&DAT_8,0,7,local_128);

+        local_e8 = &local_118;

+        local_118 = 1;

+        local_e0 = 8;

+        local_d8 = "Trace_Reset";

+        local_d0 = 0xc;

+        local_c8 = "FALSE";

+        local_c0 = 6;

+        FUN_180055600(local_b8,(undefined *)local_98);

+        local_a8 = &local_110;

+        local_110 = 0x1000000;

+        local_a0 = 8;

+        FUN_1800e3690(0x180135218,&DAT_7,0,7,local_108);

       }

     }

   }

-  return 0;

+  return;

 }
```

## `DestroyEventEntry`  (modified)

```diff
--- DestroyEventEntry
+++ __GSHandlerCheck
@@ -1,7 +1,47 @@
 

-void DestroyEventEntry(longlong param_1)

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

+

+undefined8 __GSHandlerCheck(longlong param_1,undefined1 *param_2,byte *param_3,longlong param_4)

 

 {

-  return;

+  byte *pbVar1;

+  byte *_Dst;

+  byte bVar2;

+  u_short uVar3;

+  uint uVar4;

+  longlong in_RAX;

+  

+  pbVar1 = (byte *)(in_RAX + -0x75);

+  *pbVar1 = *pbVar1 ^ (byte)param_1;

+  if (*pbVar1 != 0) {

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

+    halt_baddata();

+  }

+  if (param_2 + 6 <= param_3) {

+    *param_2 = *(undefined1 *)(param_1 + 0x20);

+    param_2[1] = *(undefined1 *)(param_1 + 0x21);

+    uVar3 = htons(*(u_short *)(param_1 + 0x22));

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

+    bVar2 = *(byte *)(param_1 + 0x24);

+    param_2[4] = bVar2;

+    uVar4 = (uint)bVar2;

+    pbVar1 = param_2 + 5 + bVar2;

+    if (pbVar1 <= param_3) {

+      memcpy(param_2 + 5,(void *)(param_1 + 0x28),(ulonglong)uVar4);

+      bVar2 = *(byte *)(param_1 + 0x25);

+      *pbVar1 = bVar2;

+      _Dst = pbVar1 + 1 + bVar2;

+      if (_Dst <= param_3) {

+        memcpy(pbVar1 + 1,(void *)(param_1 + 0x28 + (ulonglong)uVar4),(ulonglong)(uint)bVar2);

+        if (_Dst + *(ushort *)(param_1 + 0x26) <= param_3) {

+          memcpy(_Dst,(void *)((ulonglong)uVar4 + 0x28 + (ulonglong)(uint)bVar2 + param_1),

+                 (ulonglong)*(ushort *)(param_1 + 0x26));

+          return _Dst + *(ushort *)(param_1 + 0x26);

+        }

+      }

+    }

+  }

+  SetLastError(0xea);

+  return 0;

 }
```

## `FUN_1800a0f3c`  (modified)

```diff
--- FUN_1800a0f3c
+++ FUN_1800a0cf8
@@ -1,117 +1,97 @@
 

-int FUN_1800a0f3c(longlong *param_1,undefined8 *param_2,uint *param_3,longlong *param_4,

-                 undefined8 *param_5,uint *param_6,longlong *param_7,undefined8 *param_8,

-                 uint *param_9)

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

+

+ulonglong FUN_1800a0cf8(longlong param_1,undefined8 *param_2,uint *param_3,undefined8 *param_4,

+                       uint *param_5,uint *param_6)

 

 {

-  uint uVar1;

-  longlong lVar2;

-  uint *puVar3;

-  LPVOID _Dst;

-  int *piVar4;

-  uint uVar5;

-  int iVar6;

-  ulonglong uVar7;

-  uint local_48 [2];

-  LPVOID local_40;

+  int iVar1;

+  uint uVar2;

+  LPVOID pvVar3;

+  ulonglong uVar4;

+  ulonglong uVar5;

+  undefined1 auStackY_c8 [32];

+  int local_88;

+  int local_84 [3];

+  LPVOID local_78;

+  undefined8 local_70;

+  uint *local_68;

+  uint local_60;

+  uint local_5c;

+  ulonglong local_58;

   

-  local_40 = (LPVOID)0x0;

-  local_48[0] = 0;

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800e8c4c();

+  local_58 = DAT_0 ^ (ulonglong)auStackY_c8;

+  local_5c = 0;

+  local_68 = (uint *)0x0;

+  local_60 = 0;

+  local_70 = 0;

+  local_78 = (LPVOID)0x0;

+  local_84[0] = 0;

+  local_88 = 0;

+  local_84[1] = 0;

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800e61c4(param_1,0x10e,0x18010f550,param_2,param_3,param_4,param_5,param_6);

   }

-  iVar6 = 0;

-  if (param_7 != (longlong *)0x0) {

-    *param_7 = 0;

+  if (param_2 != (undefined8 *)0x0) {

+    *param_2 = 0;

   }

-  if (param_8 != (undefined8 *)0x0) {

-    *param_8 = 0;

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

+    *param_3 = 0;

   }

-  if (param_9 != (uint *)0x0) {

-    *param_9 = 0;

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

+    *param_4 = 0;

   }

-  if ((((((param_1 != (longlong *)0x0) && (param_2 != (undefined8 *)0x0)) &&

-        (param_3 != (uint *)0x0)) &&

-       ((param_4 != (longlong *)0x0 && (param_5 != (undefined8 *)0x0)))) &&

-      ((param_6 != (uint *)0x0 && ((param_7 != (longlong *)0x0 && (param_8 != (undefined8 *)0x0)))))

-      ) && (param_9 != (uint *)0x0)) {

-    lVar2 = *param_1;

-    if (lVar2 != 0) {

-      iVar6 = 0;

-      if ((LPVOID)*param_4 == (LPVOID)0x0) {

-        *param_7 = lVar2;

-        *param_1 = 0;

-        *param_8 = *param_2;

-        *param_2 = 0;

-        *param_9 = *param_3;

-        *param_3 = 0;

-        goto LAB_1;

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

+    *param_5 = 0;

+  }

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

+    *param_6 = 0;

+  }

+  if ((((param_1 == 0) || (param_2 == (undefined8 *)0x0)) || (param_3 == (uint *)0x0)) ||

+     (((param_4 == (undefined8 *)0x0 || (param_5 == (uint *)0x0)) || (param_6 == (uint *)0x0)))) {

+    uVar5 = 0x57;

+  }

+  else {

+    if ((DAT_1 & 8) != 0) {

+      FUN_1800e551c(0x40b,0x10f,0x18010f550,(short *)(param_1 + 0x10));

+    }

+    pvVar3 = FUN_1800c8108(1,1,param_1,&local_5c,&local_68);

+    uVar5 = (ulonglong)pvVar3 & 0xffffffff;

+    if ((int)pvVar3 == 0) {

+      uVar4 = (ulonglong)local_5c;

+      uVar2 = FUN_180070ad8(local_5c,local_68,&local_78,&local_60,&local_70,&local_88,

+                            (LPVOID *)local_84,(uint *)(local_84 + 1));

+      iVar1 = local_84[0];

+      uVar5 = (ulonglong)uVar2;

+      if (uVar2 == 0) {

+        if ((DAT_1 & 8) != 0) {

+          FUN_1800f8a88(uVar4,0x110,0x18010f550,local_84[0]);

+        }

+        uVar2 = 0;

+        if (iVar1 != 0) {

+          uVar2 = 4;

+        }

+        if (local_88 != 0) {

+          uVar2 = uVar2 | 0x40;

+        }

+        *param_2 = local_78;

+        *param_3 = local_60;

+        *param_4 = local_70;

+        *param_5 = uVar2;

+        *param_6 = uVar2 | 0x80;

+        local_78 = (LPVOID)0x0;

+        local_60 = 0;

+        local_70 = 0;

       }

-      puVar3 = FUN_180042b90((LPVOID)*param_4,*(uint *)(lVar2 + 4),0);

-      if (puVar3 == (uint *)0x0) {

-        iVar6 = 0xe;

-        goto LAB_1;

-      }

-      iVar6 = FUN_1800102f8(puVar3,*param_1,-1,0,0,(undefined *)0x0,0);

-      if (iVar6 == 0) {

-        if (*param_3 == 0) {

-          _Dst = (LPVOID)*param_5;

-          *param_5 = 0;

-          uVar5 = *param_6;

-          *param_6 = 0;

-        }

-        else {

-          _Dst = FUN_18008a630((ulonglong)(*param_6 + *param_3) * 0x98);

-          if (_Dst == (LPVOID)0x0) {

-            iVar6 = 0xe;

-            local_40 = (LPVOID)0x0;

-            goto LAB_2;

-          }

-          iVar6 = 0;

-          local_40 = _Dst;

-          memcpy(_Dst,(void *)*param_5,(ulonglong)*param_6 * 0x98);

-          memcpy((void *)((ulonglong)*param_6 * 0x98 + (longlong)_Dst),(void *)*param_2,

-                 (ulonglong)*param_3 * 0x98);

-          uVar1 = *param_6;

-          uVar5 = *param_3 + uVar1;

-          if (uVar1 < uVar5) {

-            piVar4 = (int *)((ulonglong)uVar1 * 0x98 + (longlong)_Dst);

-            uVar7 = (ulonglong)(uVar5 - uVar1);

-            do {

-              *piVar4 = *piVar4 + *param_6;

-              piVar4 = piVar4 + 0x26;

-              uVar7 = uVar7 - 1;

-            } while (uVar7 != 0);

-          }

-        }

-        local_40 = (LPVOID)0x0;

-        local_48[0] = 0;

-        *param_7 = (longlong)puVar3;

-        *param_8 = _Dst;

-        *param_9 = uVar5;

-      }

-      else {

-LAB_2:

-        DnsApiFree(puVar3);

-      }

-      goto LAB_1;

-    }

-    if (*param_4 != 0) {

-      *param_7 = *param_4;

-      *param_4 = 0;

-      *param_8 = *param_5;

-      *param_5 = 0;

-      *param_9 = *param_6;

-      *param_6 = 0;

-      goto LAB_1;

     }

   }

-  iVar6 = 0x57;

-LAB_1:

-  FUN_180019af8(local_48,&local_40);

-  if ((DAT_0 & 8) != 0) {

-    FUN_1800f658c(0x40b,0x113,0x18010f550,iVar6);

+  DnsFreeCustomServers(&local_5c,&local_68);

+  DnsApiFree(local_78);

+  local_78 = (LPVOID)0x0;

+  FUN_180019af8(&local_60,&local_70);

+  if ((DAT_1 & 8) != 0) {

+    FUN_1800f658c(0x40b,0x111,0x18010f550,(int)uVar5);

   }

-  return iVar6;

+  return uVar5;

 }
```

## `FUN_1800f5ac4`  (modified)

```diff
--- FUN_1800f5ac4
+++ FUN_1800f658c
@@ -1,19 +1,20 @@
 

-void FUN_1800f5ac4(undefined2 param_1,ushort param_2,ULONGLONG param_3,wchar_t *param_4)

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

+

+void FUN_1800f658c(undefined2 param_1,ushort param_2,ULONGLONG param_3,undefined4 param_4)

 

 {

-  longlong lVar1;

+  undefined1 auStack_48 [32];

+  undefined8 local_28;

+  undefined8 local_20;

+  undefined4 local_18 [2];

+  ulonglong local_10;

   

-  if (param_4 != (wchar_t *)0x0) {

-    lVar1 = -1;

-    do {

-      lVar1 = lVar1 + 1;

-    } while (param_4[lVar1] != L'\0');

-  }

-  if (param_4 == (wchar_t *)0x0) {

-    param_4 = L"NULL";

-  }

-  FUN_180082dc0(param_1,param_2,param_3,param_4);

+  local_10 = DAT_0 ^ (ulonglong)auStack_48;

+  local_20 = 0;

+  local_28 = 4;

+  local_18[0] = param_4;

+  FUN_180082dc0(param_1,param_2,param_3,local_18);

   return;

 }
```

## `DnsDoSecureUpdate`  (modified)

```diff
--- DnsDoSecureUpdate
+++ Coalesce_UpdateNetVersion
@@ -1,11 +1,62 @@
 

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

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

 

-DWORD DnsDoSecureUpdate(longlong param_1,longlong param_2,undefined8 param_3,undefined4 *param_4,

-                       LPCWSTR param_5,uint *param_6,undefined8 *param_7,undefined8 *param_8)

+int Coalesce_UpdateNetVersion(void)

 

 {

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

-  halt_baddata();

+  int *piVar1;

+  int iVar2;

+  longlong in_RAX;

+  char in_CL;

+  SOCKET SVar3;

+  short *unaff_RBX;

+  int unaff_ESI;

+  SOCKET unaff_RDI;

+  longlong in_R8;

+  undefined8 uVar4;

+  char *optval;

+  int unaff_R14D;

+  u_long unaff_R15D;

+  int optlen;

+  undefined4 in_stack_00000040;

+  u_long in_stack_00000044;

+  undefined8 in_stack_00000050;

+  undefined8 in_stack_00000058;

+  

+  *(char *)(in_RAX + -0x73) = *(char *)(in_RAX + -0x73) + in_CL;

+  piVar1 = (int *)(in_R8 + -0x7d);

+  *piVar1 = *piVar1 + -1;

+  if ((*piVar1 == 0) && ((unaff_R14D != 0 || (unaff_ESI != 0)))) {

+    if (*unaff_RBX == 2) {

+      in_stack_00000040 = *(undefined4 *)(unaff_RBX + 2);

+      in_stack_00000044 = htonl(unaff_R15D);

+      optlen = 8;

+      optval = (char *)&stack0x00000040;

+      iVar2 = 0;

+    }

+    else {

+      in_stack_00000050 = *(undefined8 *)(unaff_RBX + 4);

+      in_stack_00000058 = *(undefined8 *)(unaff_RBX + 8);

+      optval = (char *)&stack0x00000050;

+      optlen = 0x14;

+      iVar2 = 0x29;

+    }

+    uVar4 = 0xc;

+    SVar3 = unaff_RDI;

+    iVar2 = setsockopt(unaff_RDI,iVar2,0xc,optval,optlen);

+    if (iVar2 == -1) {

+      iVar2 = WSAGetLastError();

+      if ((DAT_0 & 8) != 0) {

+        FUN_1800e6694(SVar3,0x1b,uVar4,unaff_RDI);

+      }

+    }

+    else {

+      iVar2 = 0;

+    }

+  }

+  else {

+    iVar2 = 0x57;

+  }

+  return iVar2;

 }
```

## `FUN_1800e2548`  (modified)

```diff
--- FUN_1800e2548
+++ EnableFlushTimer
@@ -1,181 +1,29 @@
 

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

-

-uint FUN_1800e2548(longlong param_1,undefined8 param_2,wchar_t *param_3,undefined8 param_4,

-                  longlong param_5,undefined4 param_6,int param_7)

+u_short * EnableFlushTimer(PTP_TIMER param_1,ulonglong param_2)

 

 {

-  BOOL BVar1;

-  DWORD DVar2;

-  uint uVar3;

-  uint uVar4;

-  HANDLE ThreadHandle;

-  uint uVar5;

-  undefined1 auStack_158 [32];

-  int local_138;

-  undefined4 local_124;

-  undefined8 local_120;

-  RPC_BINDING_HANDLE local_118;

-  undefined8 local_110;

-  undefined4 local_108;

-  undefined4 local_104;

-  undefined8 local_100;

-  undefined8 uStack_f8;

-  longlong local_f0;

-  undefined8 uStack_e8;

-  undefined8 local_e0;

-  undefined4 local_d8;

-  undefined8 local_d4;

-  undefined4 local_cc;

-  undefined4 local_c8;

-  undefined4 local_c4;

-  undefined8 local_c0;

-  undefined8 *local_b8;

-  undefined8 local_b0;

-  undefined8 uStack_a8;

-  undefined8 local_a0;

-  wchar_t *pwStack_98;

-  undefined8 local_90;

-  undefined8 uStack_88;

-  undefined8 local_80;

-  RPC_BINDING_HANDLE local_78;

-  HANDLE local_70;

-  undefined4 local_68;

-  undefined4 local_64;

-  undefined4 local_60;

-  undefined4 local_5c;

-  ulonglong local_58;

+  byte *pbVar1;

+  undefined8 in_RAX;

+  u_short *puVar2;

+  undefined8 unaff_RSI;

+  u_short *unaff_RDI;

+  WCHAR *in_R8;

+  u_short *in_R10;

+  longlong in_R11;

   

-  local_58 = DAT_0 ^ (ulonglong)auStack_158;

-  uVar5 = 0;

-  local_124 = 0;

-  local_80 = 0;

-  local_5c = 0;

-  local_d4 = 0;

-  local_b0 = 0;

-  uStack_a8 = 0;

-  local_cc = 0;

-  local_a0 = 0;

-  pwStack_98 = (wchar_t *)0x0;

-  local_c0 = 0;

-  local_90 = 0;

-  uStack_88 = 0;

-  local_78 = (RPC_BINDING_HANDLE)0x0;

-  local_100 = 0;

-  uStack_f8 = 0;

-  local_70 = (HANDLE)0x0;

-  local_f0 = 0;

-  uStack_e8 = 0;

-  local_120 = param_2;

-  if ((DAT_1 & 0x20) != 0) {

-    local_138 = param_7;

-    FUN_1800e8f98(0x41d,0xd,0x18010f268,param_3);

+  pbVar1 = (byte *)(in_R11 + -0x2e + (longlong)param_1 * 4);

+  *pbVar1 = *pbVar1 & (byte)param_1;

+  puVar2 = FUN_1800d3f10(in_R10,unaff_RDI,in_R8,(WCHAR *)0x0,(ushort)unaff_RSI,

+                         (int)CONCAT71((int7)((ulonglong)in_RAX >> 8),*pbVar1 == 0));

+  if ((puVar2 != (u_short *)0x0) &&

+     (puVar2 = FUN_1800d3f10(puVar2,unaff_RDI,*(WCHAR **)(param_1 + 0x28),(WCHAR *)0x0,

+                             (ushort)unaff_RSI,

+                             (int)CONCAT71((int7)((ulonglong)unaff_RSI >> 8),

+                                           ((byte)*(undefined4 *)(param_1 + 0x14) & 0x18) == 8)),

+     puVar2 != (u_short *)0x0)) {

+    return puVar2;

   }

-  local_b0 = CONCAT44(local_b0._4_4_,1);

-  uStack_a8 = CONCAT44(uStack_a8._4_4_,3);

-  local_68 = 1;

-  local_60 = 5;

-  local_110 = 5;

-  local_104 = param_6;

-  local_64 = 1;

-  local_108 = 1;

-  if (param_5 != 0) {

-    local_f0 = param_5;

-    local_110 = 0x1100000005;

-  }

-  local_b8 = &local_110;

-  local_d8 = 1;

-  local_c8 = 6;

-  local_c4 = 0x14;

-  local_e0 = param_4;

-  pwStack_98 = param_3;

-  uVar4 = uVar5;

-  do {

-    uVar3 = RpcBindingCreateW(&local_b0,&local_d8,&local_68,&local_78);

-    if (uVar3 == 0) {

-      uVar4 = RpcBindingBind(0,local_78,local_120);

-      if (0 < (int)uVar4) {

-        uVar4 = uVar4 & 0xffff | 0x80070000;

-      }

-      if ((int)uVar4 < 0) {

-        local_124 = 0xb2;

-      }

-      else {

-        if (*(RPC_BINDING_HANDLE *)(param_1 + 8) != (RPC_BINDING_HANDLE)0x0) {

-          local_118 = *(RPC_BINDING_HANDLE *)(param_1 + 8);

-          RpcBindingFree(&local_118);

-        }

-        *(RPC_BINDING_HANDLE *)(param_1 + 8) = local_78;

-        local_78 = (RPC_BINDING_HANDLE)0x0;

-      }

-LAB_2:

-      if ((DAT_1 & 0x20) != 0) {

-        FUN_1800f658c(0x41d,0x10,0x18010f268,uVar4);

-      }

-      if (local_70 != (HANDLE)0x0) {

-        CloseHandle(local_70);

-        local_70 = (HANDLE)0x0;

-      }

-      if (local_78 != (RPC_BINDING_HANDLE)0x0) {

-        local_118 = local_78;

-        RpcBindingFree(&local_118);

-      }

-      return uVar4;

-    }

-    if ((DAT_3._3_1_ & 0x20) != 0) {

-      FUN_1800f658c(0x21d,0xe,0x18010f268,uVar3);

-    }

-    if (uVar5 != 0) {

-      if (0 < (int)uVar4) {

-        uVar4 = uVar4 & 0xffff | 0x80070000;

-      }

-      if ((int)uVar4 < 0) {

-        local_124 = 0x84;

-        goto LAB_2;

-      }

-    }

-    if (param_7 == 0) {

-      uVar4 = uVar3;

-      if (0 < (int)uVar3) {

-        uVar4 = uVar3 & 0xffff | 0x80070000;

-      }

-      if ((int)uVar4 < 0) {

-        local_124 = 0x8b;

-        goto LAB_2;

-      }

-    }

-    ThreadHandle = GetCurrentThread();

-    BVar1 = OpenThreadToken(ThreadHandle,8,1,&local_70);

-    if (BVar1 != 0) {

-      uVar4 = uVar3;

-      if (0 < (int)uVar3) {

-        uVar4 = uVar3 & 0xffff | 0x80070000;

-      }

-      if ((int)uVar4 < 0) {

-        local_124 = 0x9b;

-        goto LAB_2;

-      }

-    }

-    DVar2 = GetLastError();

-    if (DVar2 == 0x3f0) {

-      uVar4 = uVar3;

-      if (0 < (int)uVar3) {

-        uVar4 = uVar3 & 0xffff | 0x80070000;

-      }

-      if ((int)uVar4 < 0) {

-        local_124 = 0xa0;

-        goto LAB_2;

-      }

-    }

-    if ((DAT_3._3_1_ & 0x20) != 0) {

-      DVar2 = GetLastError();

-      FUN_1800f658c(0x21d,0xf,0x18010f268,DVar2);

-    }

-    local_e0 = 0;

-    local_110 = 1;

-    uVar5 = 1;

-    local_f0 = 0;

-    uVar4 = uVar3;

-  } while( true );

+  SetLastError(0xea);

+  return (u_short *)0x0;

 }
```
