# CVE-2026-62768 — msi.dll patch diff

`msi.dll` 5.0.26100.8875 -> 5.0.26100.9168 (ghidriff).

## `FormatText`  (modified)

```diff
--- FormatText
+++ FormatText
@@ -1,56 +1,607 @@
 

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

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

    guard_dispatch_icall */

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

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

+/* class IMsiString const & __ptr64 __cdecl FormatText(class IMsiString const & __ptr64,enum

+   Bool,enum Bool,int (__cdecl*)(unsigned short const * __ptr64,int,class CTempBufferRef<unsigned

+   short> & __ptr64,enum Bool & __ptr64,enum Bool & __ptr64,enum Bool & __ptr64,struct IUnknown *

+   __ptr64),struct IUnknown * __ptr64,int (* __ptr64)[2],int * __ptr64) */

 

 IMsiString * __cdecl

 FormatText(IMsiString *param_1,Bool param_2,Bool param_3,

           _func_int_ushort_ptr_int_CTempBufferRef<unsigned_short>_ptr_Bool_ptr_Bool_ptr_Bool_ptr_IUnknown_ptr

           *param_4,IUnknown *param_5,int *param_6,int *param_7)

 

 {

-  uint uVar1;

-  BOOL BVar2;

-  DWORD DVar3;

-  ulonglong in_RAX;

-  void *hObject;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  IMsiString *unaff_RSI;

-  char unaff_DIL;

-  void *unaff_R13;

-  ulong *unaff_R14;

-  code *pcVar4;

+  longlong lVar1;

+  ushort uVar2;

+  undefined1 auVar3 [16];

+  undefined1 auVar4 [16];

+  undefined1 auVar5 [16];

+  undefined1 auVar6 [16];

+  IMsiString *pIVar7;

+  uint *puVar8;

+  bool bVar9;

+  bool bVar10;

+  long lVar11;

+  int iVar12;

+  int iVar13;

+  ushort *puVar14;

+  ulonglong uVar15;

+  undefined1 *puVar16;

+  void *_Dst;

+  ushort uVar17;

+  int iVar18;

+  longlong lVar19;

+  int *piVar20;

+  ushort *puVar21;

+  ushort *puVar22;

+  ushort *puVar23;

+  uint uVar24;

+  undefined1 *puVar25;

+  IMsiMalloc *pIVar26;

+  ushort *puVar27;

+  undefined1 auStackY_118 [32];

+  int local_b8;

+  int local_b4;

+  Bool local_b0;

+  Bool local_ac;

+  Bool local_a8 [2];

+  int *local_a0;

+  Bool local_98;

+  Bool local_94;

+  IUnknown *local_90;

+  _func_int_ushort_ptr_int_CTempBufferRef<unsigned_short>_ptr_Bool_ptr_Bool_ptr_Bool_ptr_IUnknown_ptr

+  *local_88;

+  IMsiString *local_80;

+  uint *local_78;

+  undefined1 *local_70;

+  int local_68;

+  undefined4 local_64;

+  undefined1 local_60 [8];

+  void *local_58;

+  int local_50;

+  undefined4 local_4c;

+  ulonglong local_40;

   

-  *(char *)(unaff_RBX + 0x44c7ffca) = *(char *)(unaff_RBX + 0x44c7ffca) + ((byte)in_RAX & 0x30);

-  uVar1 = (int)(int *)(in_RAX & 0xffffffffffffff20) + *(int *)(in_RAX & 0xffffffffffffff20);

-  pcVar4 = (code *)(ulonglong)uVar1;

-  *pcVar4 = (code)((char)*pcVar4 + (char)uVar1);

-  DVar3 = (*pcVar4)();

-  hObject = *(void **)(unaff_RBP + 0x30);

-  if (hObject != unaff_R13) {

-    if (unaff_DIL == '\0') {

-      DisablePrivilegesFromMap(hObject,*unaff_R14);

-      BVar2 = SetThreadToken((PHANDLE)0x0,*(HANDLE *)(unaff_RBP + 0x30));

-      if (BVar2 == 0) {

-        CloseHandle(*(HANDLE *)(unaff_RBP + 0x30));

-        return unaff_RSI;

+  local_40 = __security_cookie ^ (ulonglong)auStackY_118;

+  local_90 = param_5;

+  local_a0 = param_6;

+  local_78 = (uint *)param_7;

+  local_68 = 0x200;

+  local_98 = param_2;

+  local_94 = param_3;

+  local_88 = param_4;

+  if (((piMalloc != (IMsiMalloc *)0x0) || (InitializeMsiMalloc(), piMalloc != (IMsiMalloc *)0x0)) &&

+     (local_70 = (undefined1 *)(**(code **)(*(longlong *)piMalloc + 0x18))(piMalloc,0x400),

+     local_70 != (undefined1 *)0x0)) {

+    local_b8 = 0;

+    puVar14 = (ushort *)(**(code **)(*(longlong *)param_1 + 0x50))(param_1);

+    uVar17 = *puVar14;

+    lVar19 = _s_NullString;

+    pIVar26 = piMalloc;

+    while (_s_NullString = lVar19, uVar17 != 0) {

+      bVar10 = false;

+      puVar21 = puVar14;

+LAB_0:

+      do {

+        if ((uVar17 - 0x5b & 0xffdf) == 0) {

+          uVar2 = *puVar21;

+          if (uVar2 == 0x7b) {

+            puVar22 = puVar21;

+            if (puVar21[1] == 0x7b) {

+              puVar22 = puVar21 + 1;

+            }

+            puVar22 = puVar22 + 1;

+            bVar10 = puVar21[1] == 0x7b;

+            uVar17 = *puVar22;

+            puVar27 = puVar21;

+            puVar21 = puVar22;

+            goto joined_r0x00018005771f;

+          }

+          if (((uVar2 == 0x5b) && (puVar21[1] == 0x5c)) && (puVar21[2] == 0x7b)) {

+            puVar21 = puVar21 + 2;

+          }

+          else {

+            uVar17 = 0;

+            if (uVar2 == 0) goto LAB_1;

+          }

+          uVar17 = puVar21[1];

+          puVar21 = puVar21 + 1;

+        }

+        else {

+          uVar17 = puVar21[1];

+          puVar21 = puVar21 + 1;

+          if (uVar17 != 0) goto LAB_0;

+        }

+LAB_1:

+      } while (uVar17 != 0);

+      uVar17 = 0;

+      puVar22 = puVar21;

+      puVar27 = puVar14;

+joined_r0x00018005771f:

+      if (uVar17 != 0) {

+        if ((uVar17 != 0x7d) && (uVar17 != 0x5b)) goto LAB_2;

+        uVar2 = *puVar22;

+        if ((uVar2 != 0x5b) && (uVar2 == 0x7d)) {

+          puVar23 = puVar22;

+          if (bVar10) {

+            if (puVar22[1] != 0x7d) goto LAB_3;

+            puVar22 = puVar22 + 2;

+          }

+          else {

+            puVar22 = puVar22 + 1;

+          }

+          goto LAB_4;

+        }

+LAB_3:

+        uVar17 = 0;

+        if (uVar2 != 0) {

+LAB_2:

+          uVar17 = puVar22[1];

+          puVar22 = puVar22 + 1;

+        }

+        goto joined_r0x00018005771f;

+      }

+      bVar10 = false;

+      puVar23 = puVar21;

+      puVar27 = puVar22;

+LAB_4:

+      local_b0 = 0;

+      local_a8[0] = 0;

+      local_ac = 0;

+      if (0 < (longlong)((longlong)puVar27 - (longlong)puVar14 & 0xfffffffffffffffeU)) {

+        bVar9 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::__private_IsEnabled

+                          ((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                            ::__l2::impl);

+        local_64 = 1;

+        if (bVar9) {

+          lVar11 = FormatSegment(puVar14,puVar27,(CTempBufferRef<unsigned_short> *)&local_70,

+                                 &local_b8,0,&local_b0,local_a8,&local_ac,local_88,local_90,local_a0

+                                 ,(int *)local_78);

+          pIVar26 = piMalloc;

+          if (lVar11 < 0) goto LAB_5;

+        }

+        else {

+          FormatSegment(puVar14,puVar27,(CTempBufferRef<unsigned_short> *)&local_70,&local_b8,0,

+                        &local_b0,local_a8,&local_ac,local_88,local_90,local_a0,(int *)local_78);

+          pIVar26 = piMalloc;

+        }

+      }

+      if ((0 < (longlong)((longlong)puVar23 - (longlong)puVar21 & 0xfffffffffffffffeU)) &&

+         (((!bVar10 || (local_98 == 0)) || (local_94 != 0)))) {

+        local_50 = 0x200;

+        if ((pIVar26 == (IMsiMalloc *)0x0) &&

+           (InitializeMsiMalloc(), pIVar26 = piMalloc, piMalloc == (IMsiMalloc *)0x0)) {

+          local_58 = (void *)0x0;

+LAB_6:

+          local_50 = 0;

+        }

+        else {

+          local_58 = (void *)(**(code **)(*(longlong *)pIVar26 + 0x18))(pIVar26,0x400);

+          puVar8 = local_78;

+          if (local_58 == (void *)0x0) goto LAB_6;

+          puVar16 = (undefined1 *)0x0;

+          local_b4 = 0;

+          puVar25 = puVar16;

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

+            puVar25 = (undefined1 *)(ulonglong)*local_78;

+          }

+          bVar9 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::

+                  __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                                       ::__l2::impl);

+          local_4c = 1;

+          if (bVar9) {

+            lVar11 = FormatSegment(puVar21,puVar23,(CTempBufferRef<unsigned_short> *)&local_58,

+                                   &local_b4,0,&local_b0,local_a8,&local_ac,local_88,local_90,

+                                   local_a0,(int *)puVar8);

+            if (-1 < lVar11) goto LAB_7;

+            goto LAB_8;

+          }

+          FormatSegment(puVar21,puVar23,(CTempBufferRef<unsigned_short> *)&local_58,&local_b4,0,

+                        &local_b0,local_a8,&local_ac,local_88,local_90,local_a0,(int *)puVar8);

+LAB_7:

+          iVar18 = (int)puVar25;

+          pIVar26 = piMalloc;

+          if (bVar10) {

+            if (local_98 == 0) {

+              if ((local_a0 != (int *)0x0) && (iVar18 < (int)*puVar8)) {

+                piVar20 = local_a0 + (longlong)iVar18 * 2;

+                do {

+                  *piVar20 = *piVar20 + local_b8 + 2;

+                  piVar20 = piVar20 + 2;

+                  uVar24 = (int)puVar25 + 1;

+                  puVar25 = (undefined1 *)(ulonglong)uVar24;

+                } while ((int)uVar24 < (int)*puVar8);

+              }

+              bVar10 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::

+                       __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                                            ::__l2::impl);

+              local_64 = 1;

+              if (bVar10) {

+                iVar12 = ExtendOutputBuffer(&local_70,local_b8,local_b4 + 4);

+                iVar18 = local_b4;

+                if (-1 < iVar12) {

+                  *(undefined2 *)(local_70 + (longlong)local_b8 * 2) = 0x7b;

+                  iVar12 = local_b8 + 2;

+                  *(undefined2 *)(local_70 + (longlong)(local_b8 + 1) * 2) = 0x7b;

+                  local_64 = 1;

+                  local_b8 = iVar12;

+                  if ((longlong)local_b4 * 2 + 0x80000000U < 0x100000000) {

+                    memcpy(local_70 + (longlong)iVar12 * 2,local_58,

+                           (longlong)(int)((longlong)local_b4 * 2));

+                    pIVar26 = piMalloc;

+                    iVar18 = iVar18 + iVar12;

+                    *(undefined2 *)(local_70 + (longlong)iVar18 * 2) = 0x7d;

+                    local_b8 = iVar18 + 2;

+                    *(undefined2 *)(local_70 + (longlong)(iVar18 + 1) * 2) = 0x7d;

+                    goto LAB_9;

+                  }

+                }

+LAB_8:

+                if (((1 < local_50) && (local_58 != (void *)0x0)) && (piMalloc != (IMsiMalloc *)0x0)

+                   ) {

+                  (**(code **)(*(longlong *)piMalloc + 0x28))();

+                }

+                if ((local_68 < 2) || (local_70 == (undefined1 *)0x0)) goto LAB_10;

+                goto LAB_11;

+              }

+              iVar12 = local_b8 + local_b4 + 4;

+              puVar25 = local_70;

+              iVar18 = local_68;

+              if (local_68 < iVar12) {

+                iVar18 = iVar12 + 0x100;

+                if (iVar18 < 2) {

+                  puVar16 = local_60;

+                }

+                else {

+                  auVar3._8_8_ = 0;

+                  auVar3._0_8_ = (longlong)iVar18;

+                  uVar15 = SUB168(ZEXT816(2) * auVar3,0);

+                  if (SUB168(ZEXT816(2) * auVar3,8) != 0) {

+                    uVar15 = 0xffffffffffffffff;

+                  }

+                  if ((piMalloc != (IMsiMalloc *)0x0) ||

+                     (InitializeMsiMalloc(), piMalloc != (IMsiMalloc *)0x0)) {

+                    puVar16 = (undefined1 *)

+                              (**(code **)(*(longlong *)piMalloc + 0x18))

+                                        (piMalloc,uVar15 & 0xffffffff);

+                  }

+                  if (puVar16 == (undefined1 *)0x0) {

+                    iVar18 = 0;

+                  }

+                }

+                if (local_70 != puVar16) {

+                  iVar12 = local_68;

+                  if (iVar18 < local_68) {

+                    iVar12 = iVar18;

+                  }

+                  lVar19 = (longlong)iVar12;

+                  if (iVar12 != 0) {

+                    do {

+                      lVar1 = lVar19 * 2;

+                      lVar19 = lVar19 + -1;

+                      *(undefined2 *)(puVar16 + lVar19 * 2) = *(undefined2 *)(local_70 + lVar1 + -2)

+                      ;

+                    } while (lVar19 != 0);

+                  }

+                }

+                puVar25 = puVar16;

+                if (((local_70 != local_60) && (local_70 != (undefined1 *)0x0)) &&

+                   (piMalloc != (IMsiMalloc *)0x0)) {

+                  (**(code **)(*(longlong *)piMalloc + 0x28))(piMalloc);

+                }

+              }

+              local_68 = iVar18;

+              local_70 = puVar25;

+              pIVar26 = piMalloc;

+              if (local_70 == (undefined1 *)0x0) goto LAB_12;

+              iVar18 = local_b8 + 1;

+              *(undefined2 *)(local_70 + (longlong)local_b8 * 2) = 0x7b;

+              local_b8 = local_b8 + 2;

+              *(undefined2 *)(local_70 + (longlong)iVar18 * 2) = 0x7b;

+              memcpy(local_70 + (longlong)local_b8 * 2,local_58,(longlong)local_b4 * 2);

+              iVar18 = local_b4 + local_b8;

+              *(undefined2 *)(local_70 + (longlong)iVar18 * 2) = 0x7d;

+              local_b8 = iVar18 + 2;

+              *(undefined2 *)(local_70 + (longlong)(iVar18 + 1) * 2) = 0x7d;

+            }

+            else if (local_94 != 0) {

+              if ((local_a0 != (int *)0x0) && (iVar18 < (int)*puVar8)) {

+                piVar20 = local_a0 + (longlong)iVar18 * 2;

+                do {

+                  *piVar20 = *piVar20 + local_b8;

+                  piVar20 = piVar20 + 2;

+                  uVar24 = (int)puVar25 + 1;

+                  puVar25 = (undefined1 *)(ulonglong)uVar24;

+                } while ((int)uVar24 < (int)*puVar8);

+              }

+              bVar10 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::

+                       __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                                            ::__l2::impl);

+              local_64 = 1;

+              if (!bVar10) {

+                if (local_68 < local_b4 + local_b8) {

+                  iVar18 = local_b4 + local_b8 + 0x100;

+                  if (iVar18 < 2) {

+                    puVar16 = local_60;

+                  }

+                  else {

+                    auVar4._8_8_ = 0;

+                    auVar4._0_8_ = (longlong)iVar18;

+                    uVar15 = SUB168(ZEXT816(2) * auVar4,0);

+                    if (SUB168(ZEXT816(2) * auVar4,8) != 0) {

+                      uVar15 = 0xffffffffffffffff;

+                    }

+                    if ((piMalloc != (IMsiMalloc *)0x0) ||

+                       (InitializeMsiMalloc(), piMalloc != (IMsiMalloc *)0x0)) {

+                      puVar16 = (undefined1 *)

+                                (**(code **)(*(longlong *)piMalloc + 0x18))

+                                          (piMalloc,uVar15 & 0xffffffff);

+                    }

+                    if (puVar16 == (undefined1 *)0x0) {

+                      iVar18 = 0;

+                    }

+                  }

+                  if (local_70 != puVar16) {

+                    iVar12 = local_68;

+                    if (iVar18 < local_68) {

+                      iVar12 = iVar18;

+                    }

+                    lVar19 = (longlong)iVar12;

+                    if (iVar12 != 0) {

+                      do {

+                        lVar1 = lVar19 * 2;

+                        lVar19 = lVar19 + -1;

+                        *(undefined2 *)(puVar16 + lVar19 * 2) =

+                             *(undefined2 *)(local_70 + lVar1 + -2);

+                      } while (lVar19 != 0);

+                    }

+                  }

+                  goto LAB_13;

+                }

+LAB_14:

+                local_64 = 1;

+                puVar16 = local_70;

+                iVar18 = local_68;

+                goto LAB_15;

+              }

+LAB_16:

+              local_64 = 1;

+              iVar13 = ExtendOutputBuffer(&local_70,local_b8,local_b4);

+              iVar12 = local_b4;

+              iVar18 = local_b8;

+              if (-1 < iVar13) {

+                local_64 = 1;

+                if ((longlong)local_b4 * 2 + 0x80000000U < 0x100000000) {

+                  memcpy(local_70 + (longlong)local_b8 * 2,local_58,

+                         (longlong)(int)((longlong)local_b4 * 2));

+                  local_b8 = iVar12 + iVar18;

+                  pIVar26 = piMalloc;

+                  goto LAB_9;

+                }

+              }

+              goto LAB_8;

+            }

+LAB_9:

+            if (((1 < local_50) && (local_58 != (void *)0x0)) && (pIVar26 != (IMsiMalloc *)0x0)) {

+              (**(code **)(*(longlong *)pIVar26 + 0x28))(pIVar26);

+              pIVar26 = piMalloc;

+            }

+            goto LAB_17;

+          }

+          if ((local_b0 == 0) || (local_ac != 0)) {

+            if ((local_a0 != (int *)0x0) && (iVar18 < (int)*puVar8)) {

+              piVar20 = local_a0 + (longlong)iVar18 * 2;

+              do {

+                *piVar20 = *piVar20 + local_b8 + 1;

+                piVar20 = piVar20 + 2;

+                uVar24 = (int)puVar25 + 1;

+                puVar25 = (undefined1 *)(ulonglong)uVar24;

+              } while ((int)uVar24 < (int)*puVar8);

+            }

+            bVar10 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::

+                     __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                                          ::__l2::impl);

+            local_64 = 1;

+            if (bVar10) {

+              iVar12 = ExtendOutputBuffer(&local_70,local_b8,local_b4 + 2);

+              iVar18 = local_b4;

+              if (-1 < iVar12) {

+                iVar12 = local_b8 + 1;

+                *(undefined2 *)(local_70 + (longlong)local_b8 * 2) = 0x7b;

+                local_64 = 1;

+                local_b8 = iVar12;

+                if ((longlong)local_b4 * 2 + 0x80000000U < 0x100000000) {

+                  memcpy(local_70 + (longlong)iVar12 * 2,local_58,

+                         (longlong)(int)((longlong)local_b4 * 2));

+                  iVar18 = iVar18 + iVar12;

+                  pIVar26 = piMalloc;

+                  goto LAB_18;

+                }

+              }

+              goto LAB_8;

+            }

+            iVar12 = local_b8 + local_b4 + 2;

+            puVar25 = local_70;

+            iVar18 = local_68;

+            if (local_68 < iVar12) {

+              iVar18 = iVar12 + 0x100;

+              if (iVar18 < 2) {

+                puVar16 = local_60;

+              }

+              else {

+                auVar6._8_8_ = 0;

+                auVar6._0_8_ = (longlong)iVar18;

+                uVar15 = SUB168(ZEXT816(2) * auVar6,0);

+                if (SUB168(ZEXT816(2) * auVar6,8) != 0) {

+                  uVar15 = 0xffffffffffffffff;

+                }

+                if ((piMalloc != (IMsiMalloc *)0x0) ||

+                   (InitializeMsiMalloc(), piMalloc != (IMsiMalloc *)0x0)) {

+                  puVar16 = (undefined1 *)

+                            (**(code **)(*(longlong *)piMalloc + 0x18))

+                                      (piMalloc,uVar15 & 0xffffffff);

+                }

+                if (puVar16 == (undefined1 *)0x0) {

+                  iVar18 = 0;

+                }

+              }

+              if (local_70 != puVar16) {

+                iVar12 = local_68;

+                if (iVar18 < local_68) {

+                  iVar12 = iVar18;

+                }

+                lVar19 = (longlong)iVar12;

+                if (iVar12 != 0) {

+                  do {

+                    lVar1 = lVar19 * 2;

+                    lVar19 = lVar19 + -1;

+                    *(undefined2 *)(puVar16 + lVar19 * 2) = *(undefined2 *)(local_70 + lVar1 + -2);

+                  } while (lVar19 != 0);

+                }

+              }

+              puVar25 = puVar16;

+              if (((local_70 != local_60) && (local_70 != (undefined1 *)0x0)) &&

+                 (piMalloc != (IMsiMalloc *)0x0)) {

+                (**(code **)(*(longlong *)piMalloc + 0x28))(piMalloc);

+              }

+            }

+            local_68 = iVar18;

+            local_70 = puVar25;

+            pIVar26 = piMalloc;

+            if (local_70 == (undefined1 *)0x0) goto LAB_12;

+            lVar19 = (longlong)local_b8;

+            local_b8 = local_b8 + 1;

+            *(undefined2 *)(local_70 + lVar19 * 2) = 0x7b;

+            memcpy(local_70 + (longlong)local_b8 * 2,local_58,(longlong)local_b4 * 2);

+            iVar18 = local_b4 + local_b8;

+LAB_18:

+            local_b8 = iVar18 + 1;

+            *(undefined2 *)(local_70 + (longlong)iVar18 * 2) = 0x7d;

+            goto LAB_9;

+          }

+          if (local_a8[0] != 0) goto LAB_9;

+          if ((local_a0 != (int *)0x0) && (iVar18 < (int)*puVar8)) {

+            piVar20 = local_a0 + (longlong)iVar18 * 2;

+            do {

+              *piVar20 = *piVar20 + local_b8;

+              piVar20 = piVar20 + 2;

+              uVar24 = (int)puVar25 + 1;

+              puVar25 = (undefined1 *)(ulonglong)uVar24;

+            } while ((int)uVar24 < (int)*puVar8);

+          }

+          bVar10 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::

+                   __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                                        ::__l2::impl);

+          local_64 = 1;

+          if (bVar10) goto LAB_16;

+          if (local_b4 + local_b8 <= local_68) goto LAB_14;

+          iVar18 = local_b4 + local_b8 + 0x100;

+          if (iVar18 < 2) {

+            puVar16 = local_60;

+          }

+          else {

+            auVar5._8_8_ = 0;

+            auVar5._0_8_ = (longlong)iVar18;

+            uVar15 = SUB168(ZEXT816(2) * auVar5,0);

+            if (SUB168(ZEXT816(2) * auVar5,8) != 0) {

+              uVar15 = 0xffffffffffffffff;

+            }

+            if ((piMalloc != (IMsiMalloc *)0x0) ||

+               (InitializeMsiMalloc(), piMalloc != (IMsiMalloc *)0x0)) {

+              puVar16 = (undefined1 *)

+                        (**(code **)(*(longlong *)piMalloc + 0x18))(piMalloc,uVar15 & 0xffffffff);

+            }

+            if (puVar16 == (undefined1 *)0x0) {

+              iVar18 = 0;

+            }

+          }

+          if (local_70 != puVar16) {

+            iVar12 = local_68;

+            if (iVar18 < local_68) {

+              iVar12 = iVar18;

+            }

+            lVar19 = (longlong)iVar12;

+            if (iVar12 != 0) {

+              do {

+                lVar1 = lVar19 * 2;

+                lVar19 = lVar19 + -1;

+                *(undefined2 *)(puVar16 + lVar19 * 2) = *(undefined2 *)(local_70 + lVar1 + -2);

+              } while (lVar19 != 0);

+            }

+          }

+LAB_13:

+          if (((local_70 != local_60) && (local_70 != (undefined1 *)0x0)) &&

+             (piMalloc != (IMsiMalloc *)0x0)) {

+            (**(code **)(*(longlong *)piMalloc + 0x28))(piMalloc);

+          }

+LAB_15:

+          local_68 = iVar18;

+          local_70 = puVar16;

+          pIVar26 = piMalloc;

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

+            memcpy(local_70 + (longlong)local_b8 * 2,local_58,(longlong)local_b4 * 2);

+            local_b8 = local_b8 + local_b4;

+            goto LAB_9;

+          }

+LAB_12:

+          if (((1 < local_50) && (local_58 != (void *)0x0)) && (piMalloc != (IMsiMalloc *)0x0)) {

+            (**(code **)(*(longlong *)piMalloc + 0x28))(piMalloc);

+          }

+        }

+        if (((local_68 < 2) || (local_70 == (undefined1 *)0x0)) || (piMalloc == (IMsiMalloc *)0x0))

+        goto LAB_10;

+        lVar19 = *(longlong *)piMalloc;

+        goto LAB_19;

+      }

+LAB_17:

+      puVar14 = puVar22;

+      lVar19 = _s_NullString;

+      uVar17 = *puVar22;

+    }

+    local_80 = (IMsiString *)&MsiString::s_NullString;

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

+      _Dst = (void *)(**(code **)(lVar19 + 0xe0))(&MsiString::s_NullString,local_b8,1,&local_80);

+      if ((local_b8 == 0) || (_Dst != (void *)0x0)) {

+        memcpy(_Dst,local_70,(longlong)local_b8 * 2);

+        (**(code **)(*(longlong *)local_80 + 8))();

+        pIVar7 = local_80;

+        (**(code **)(*(longlong *)local_80 + 0x10))(local_80);

+        if (local_68 < 2) {

+          return pIVar7;

+        }

+        if (local_70 == (undefined1 *)0x0) {

+          return pIVar7;

+        }

+        if (piMalloc == (IMsiMalloc *)0x0) {

+          return pIVar7;

+        }

+        (**(code **)(*(longlong *)piMalloc + 0x28))();

+        return pIVar7;

+      }

+      lVar19 = *(longlong *)local_80;

+    }

+    (**(code **)(lVar19 + 0x10))();

+LAB_5:

+    if ((1 < local_68) && (local_70 != (undefined1 *)0x0)) {

+LAB_11:

+      if (piMalloc != (IMsiMalloc *)0x0) {

+        lVar19 = *(longlong *)piMalloc;

+LAB_19:

+        (**(code **)(lVar19 + 0x28))(piMalloc,local_70);

       }

     }

-    else {

-      BVar2 = SetThreadToken((PHANDLE)0x0,(HANDLE)0x0);

-      if (BVar2 == 0) {

-        DVar3 = GetLastError();

-      }

-    }

-    hObject = *(void **)(unaff_RBP + 0x30);

-    CloseHandle(hObject);

   }

-  StopImpersonating(SUB81(hObject,0));

-  if ((DVar3 != 0) && (g_dmDiagnosticMode != 0)) {

-    DebugString(9,0,0,(ushort *)L"SetProxyBlanket failed with: 0x%X",(ushort *)(longlong)(int)DVar3,

-                (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

-                (ushort *)L"(NULL)",0,(void *)0x0);

-  }

-  return unaff_RSI;

+LAB_10:

+  return (IMsiString *)&g_MsiStringNull;

 }
```

## `FormatSegment`  (modified)

```diff
--- FormatSegment
+++ FormatSegment
@@ -1,178 +1,295 @@
 

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

-/* WARNING: Variable defined which should be unmapped: param_5 */

-/* WARNING: Variable defined which should be unmapped: param_11 */

-

-void __cdecl

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

+   guard_dispatch_icall */

+/* long __cdecl FormatSegment(unsigned short const * __ptr64,unsigned short const * __ptr64,class

+   CTempBufferRef<unsigned short> & __ptr64,int & __ptr64,enum Bool,enum Bool & __ptr64,enum Bool &

+   __ptr64,enum Bool & __ptr64,int (__cdecl*)(unsigned short const * __ptr64,int,class

+   CTempBufferRef<unsigned short> & __ptr64,enum Bool & __ptr64,enum Bool & __ptr64,enum Bool &

+   __ptr64,struct IUnknown * __ptr64),struct IUnknown * __ptr64,int (* __ptr64)[2],int * __ptr64) */

+

+long __cdecl

 FormatSegment(ushort *param_1,ushort *param_2,CTempBufferRef<unsigned_short> *param_3,int *param_4,

              Bool param_5,Bool *param_6,Bool *param_7,Bool *param_8,

              _func_int_ushort_ptr_int_CTempBufferRef<unsigned_short>_ptr_Bool_ptr_Bool_ptr_Bool_ptr_IUnknown_ptr

              *param_9,IUnknown *param_10,int *param_11,int *param_12)

 

 {

   ushort *puVar1;

-  bool bVar2;

-  long lVar3;

-  Bool BVar4;

-  int iVar5;

-  int iVar6;

-  ushort *puVar7;

-  char *pcVar8;

-  int unaff_EBX;

-  CAPITempBufferRef<char> *unaff_RBP;

-  CAPITempBufferRef<char> *unaff_RSI;

-  ulong *unaff_RDI;

-  ulong *puVar9;

-  undefined4 *unaff_R12;

-  undefined8 unaff_R13;

-  int unaff_R14D;

-  int unaff_R15D;

-  CAPITempBufferRef<char> *pCVar10;

-  CAPITempBufferRef<char> *in_stack_00000070;

-  int in_stack_00000078;

+  int iVar2;

+  bool bVar3;

+  ushort *_Src;

+  bool bVar4;

+  ushort uVar5;

+  long lVar6;

+  int iVar7;

+  int iVar8;

+  ushort *puVar9;

+  ulonglong uVar10;

+  longlong lVar11;

+  undefined1 auStackY_1e8 [32];

+  Bool local_188 [2];

+  Bool local_180;

+  Bool local_17c;

+  uint *local_178;

+  IUnknown *local_170;

+  _func_int_ushort_ptr_int_CTempBufferRef<unsigned_short>_ptr_Bool_ptr_Bool_ptr_Bool_ptr_IUnknown_ptr

+  *local_168;

+  Bool *local_160;

+  Bool *local_158;

+  int *local_150;

+  Bool *local_148;

+  undefined1 *local_138;

+  int local_130;

+  undefined4 local_12c;

+  undefined1 local_128 [208];

+  ulonglong local_58;

   

-  puVar9 = unaff_RDI + -0xfdebffc;

-  *(char *)puVar9 = (char)*puVar9 + (char)unaff_EBX;

-  if ((char)*puVar9 == '\0') {

-    puVar9 = (ulong *)&stack0x0000006c;

-    pcVar8 = "PackageName";

-    *(int *)(unaff_RBP + 0xc) = unaff_R15D;

-    pCVar10 = unaff_RBP;

-    lVar3 = MsiRegQueryValueExA(*(HKEY__ **)(unaff_RBP + -0x50),"PackageName",(ulong *)param_3,

-                                puVar9,unaff_RBP,unaff_RDI);

-    BVar4 = (Bool)puVar9;

-    if (lVar3 == 0) {

-      *(int *)(unaff_RBP + 0x188) = unaff_R15D;

-      *(CAPITempBufferRef<char> **)(unaff_RBP + 0x180) = unaff_RBP + 400;

-      *(int *)(unaff_RBP + 0x18c) = unaff_R15D;

-      *(CAPITempBufferRef<char> **)(unaff_RBP + 0x5c0) = unaff_RBP + 0x5d0;

-      *(int *)(unaff_RBP + 0x5c8) = unaff_EBX;

-      *(ulong **)(unaff_RBP + 0x7d8) = unaff_RDI;

-      *(undefined8 *)(unaff_RBP + 2000) = unaff_R13;

-      pcVar8 = CApiConvertString::operator_char_const____ptr64

-                         ((CApiConvertString *)(unaff_RBP + 0x5c0));

-      BVar4 = ResolveSource(pcVar8,1,unaff_RBP + 0x180,BVar4,(HWND__ *)pCVar10);

-      if (unaff_EBX < *(int *)(unaff_RBP + 0x5c8)) {

-        GlobalFree(*(HGLOBAL *)(unaff_RBP + 0x5c0));

-      }

-      pcVar8 = *(char **)(unaff_RBP + 0x180);

-      if ((BVar4 == 0) || (*pcVar8 == (char)unaff_RDI)) {

-        if (unaff_R15D < *(int *)(unaff_RBP + 0x188)) {

-          GlobalFree(pcVar8);

-        }

-        *(CAPITempBufferRef<char> **)(unaff_RBP + 0x180) = unaff_RBP + 400;

-        *(int *)(unaff_RBP + 0x188) = unaff_R15D;

-        if (0x21 < in_stack_00000078) {

-          GlobalFree(in_stack_00000070);

-        }

-        in_stack_00000070 = unaff_RBP + -0x80;

-        in_stack_00000078 = 0x21;

-        if (unaff_R15D < *(int *)(unaff_RBP + 8)) {

-          GlobalFree(*(HGLOBAL *)unaff_RBP);

-        }

-      }

-      else {

-        iVar5 = lstrlenA(pcVar8);

-        iVar6 = lstrlenA(*(LPCSTR *)unaff_RBP);

-        bVar2 = CAPITempBufferRef<char>::SetSize(unaff_RSI,iVar6 + 2 + iVar5,false);

-        if (bVar2) {

-          lVar3 = StringCchCopyA(*(char **)unaff_RSI,(longlong)*(int *)(unaff_RSI + 8),pcVar8);

-          if (((lVar3 < 0) ||

-              (((pcVar8[(longlong)iVar5 + -1] != '\\' && (pcVar8[(longlong)iVar5 + -1] != '/')) &&

-               (lVar3 = StringCchCatA(*(char **)unaff_RSI,(longlong)*(int *)(unaff_RSI + 8),"\\"),

-               lVar3 < 0)))) ||

-             (lVar3 = StringCchCatA(*(char **)unaff_RSI,(longlong)*(int *)(unaff_RSI + 8),

-                                    *(char **)unaff_RBP), lVar3 < 0)) {

-            if (unaff_R15D < *(int *)(unaff_RBP + 0x188)) {

-              GlobalFree(*(HGLOBAL *)(unaff_RBP + 0x180));

-            }

-            *(CAPITempBufferRef<char> **)(unaff_RBP + 0x180) = unaff_RBP + 400;

-            *(int *)(unaff_RBP + 0x188) = unaff_R15D;

-            if (0x21 < in_stack_00000078) {

-              GlobalFree(in_stack_00000070);

-            }

-            in_stack_00000070 = unaff_RBP + -0x80;

-            in_stack_00000078 = 0x21;

-            if (unaff_R15D < *(int *)(unaff_RBP + 8)) {

-              GlobalFree(*(HGLOBAL *)unaff_RBP);

-            }

-          }

-          else {

-            *unaff_R12 = 2;

-            if (unaff_R15D < *(int *)(unaff_RBP + 0x188)) {

-              GlobalFree(*(HGLOBAL *)(unaff_RBP + 0x180));

-            }

-            *(CAPITempBufferRef<char> **)(unaff_RBP + 0x180) = unaff_RBP + 400;

-            *(int *)(unaff_RBP + 0x188) = unaff_R15D;

-            if (0x21 < in_stack_00000078) {

-              GlobalFree(in_stack_00000070);

-            }

-            in_stack_00000070 = unaff_RBP + -0x80;

-            in_stack_00000078 = 0x21;

-            if (unaff_R15D < *(int *)(unaff_RBP + 8)) {

-              GlobalFree(*(HGLOBAL *)unaff_RBP);

-            }

-          }

-        }

-        else {

-          if (unaff_R15D < *(int *)(unaff_RBP + 0x188)) {

-            GlobalFree(*(HGLOBAL *)(unaff_RBP + 0x180));

-          }

-          *(CAPITempBufferRef<char> **)(unaff_RBP + 0x180) = unaff_RBP + 400;

-          *(int *)(unaff_RBP + 0x188) = unaff_R15D;

-          if (0x21 < in_stack_00000078) {

-            GlobalFree(in_stack_00000070);

-          }

-          in_stack_00000070 = unaff_RBP + -0x80;

-          in_stack_00000078 = 0x21;

-          if (unaff_R15D < *(int *)(unaff_RBP + 8)) {

-            GlobalFree(*(HGLOBAL *)unaff_RBP);

-          }

-        }

-      }

-    }

-    else {

-      param_5 = (Bool)unaff_RDI;

-      OpenSpecificSourceListKeyPacked

-                ((char *)in_stack_00000070,pcVar8,(iaaAppAssignment)param_3,0,

-                 (CRegHandle *)(unaff_RBP + -0x50),param_5,true);

-      puVar1 = *(ushort **)(unaff_RBP + -0x40);

-      *(CAPITempBufferRef<char> **)(unaff_RBP + 0x5c0) = unaff_RBP + 0x5d0;

-      *(ulong **)(unaff_RBP + 0x7d8) = unaff_RDI;

-      *(char **)(unaff_RBP + 2000) = "PackageName";

-      *(undefined4 *)(unaff_RBP + 0x5c8) = 0x100;

-      puVar7 = CApiConvertString::operator_unsigned_short_const____ptr64

-                         ((CApiConvertString *)(unaff_RBP + 0x5c0));

-      DebugString(0x15,1,0x3ea,puVar7,(ushort *)L"",puVar1,(ushort *)L"(NULL)",(ushort *)L"(NULL)",

-                  (ushort *)L"(NULL)",(ushort *)L"(NULL)",param_5,unaff_RDI);

-      if (0x100 < *(int *)(unaff_RBP + 0x5c8)) {

-        GlobalFree(*(HGLOBAL *)(unaff_RBP + 0x5c0));

-      }

-      if (unaff_R14D < in_stack_00000078) {

-        GlobalFree(in_stack_00000070);

-      }

-      in_stack_00000070 = unaff_RBP + -0x80;

-      in_stack_00000078 = unaff_R14D;

-      if (unaff_R15D < *(int *)(unaff_RBP + 8)) {

-        GlobalFree(*(HGLOBAL *)unaff_RBP);

-      }

-    }

-    *(int *)(unaff_RBP + 8) = unaff_R15D;

-    *(CAPITempBufferRef<char> **)unaff_RBP = unaff_RBP + 0x10;

-    CRegHandle::~CRegHandle((CRegHandle *)(unaff_RBP + -0x50));

+  local_58 = __security_cookie ^ (ulonglong)auStackY_1e8;

+  local_168 = param_9;

+  local_170 = param_10;

+  local_150 = param_11;

+  *param_6 = 0;

+  *param_7 = 0;

+  *param_8 = 0;

+  iVar2 = *param_4;

+  lVar11 = (longlong)iVar2;

+  local_148 = param_6;

+  local_158 = param_7;

+  local_160 = param_8;

+  local_178 = (uint *)param_12;

+  bVar4 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::__private_IsEnabled

+                    ((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                      ::__l2::impl);

+  _Src = param_1;

+  if ((bVar4) && (iVar2 < 0)) {

+LAB_0:

+    lVar6 = -0x7fffbffb;

   }

   else {

-    if (unaff_R14D < in_stack_00000078) {

-      GlobalFree(in_stack_00000070);

+    while (_Src < param_2) {

+      if (*_Src == 0x5b) {

+        uVar10 = (longlong)_Src - (longlong)param_1 >> 1;

+        if (0 < (longlong)uVar10) {

+          bVar4 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::

+                  __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                                       ::__l2::impl);

+          if (bVar4) {

+            iVar7 = ExtendOutputBuffer(param_3,*param_4,uVar10 & 0xffffffff);

+            if (iVar7 < 0) {

+              return iVar7;

+            }

+            iVar7 = WriteOutputBuffer(param_3,param_4,*param_4,param_1);

+            if (iVar7 < 0) {

+              return iVar7;

+            }

+          }

+          else {

+            iVar7 = *param_4 + (int)uVar10;

+            if (*(int *)(param_3 + 8) < iVar7) {

+              CTempBufferRef<unsigned_short>::Resize(param_3,iVar7 + 0x100);

+            }

+            memcpy((void *)(*(longlong *)param_3 + (longlong)*param_4 * 2),param_1,uVar10 * 2);

+            *param_4 = *param_4 + (int)uVar10;

+          }

+        }

+        puVar1 = _Src + 1;

+        iVar7 = 1;

+        bVar4 = false;

+        puVar9 = puVar1;

+        bVar3 = false;

+        if (puVar1 < param_2) {

+          do {

+            if (bVar4) {

+              bVar4 = false;

+LAB_1:

+              if (*puVar9 != 0) goto LAB_2;

+            }

+            else {

+              if (*puVar9 != 0x5c) {

+                if ((bVar3) || (*puVar9 != 0x5b)) {

+                  if (*puVar9 == 0x5d) {

+                    iVar7 = iVar7 + -1;

+                    bVar3 = false;

+                  }

+                }

+                else {

+                  iVar7 = iVar7 + 1;

+                }

+                if (iVar7 != 0) goto LAB_1;

+                goto LAB_3;

+              }

+              bVar3 = true;

+              bVar4 = true;

+LAB_2:

+              puVar9 = puVar9 + 1;

+            }

+          } while (puVar9 < param_2);

+          if (iVar7 != 0) goto LAB_4;

+LAB_3:

+          local_180 = 0;

+          local_17c = 0;

+          local_188[0] = 0;

+          bVar4 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::

+                  __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                                       ::__l2::impl);

+          if (bVar4) {

+            lVar6 = FormatSegment(puVar1,puVar9,param_3,param_4,1,&local_180,&local_17c,local_188,

+                                  local_168,local_170,local_150,(int *)local_178);

+            if (lVar6 < 0) {

+              return lVar6;

+            }

+          }

+          else {

+            FormatSegment(puVar1,puVar9,param_3,param_4,1,&local_180,&local_17c,local_188,local_168,

+                          local_170,local_150,(int *)local_178);

+          }

+          if (local_180 != 0) {

+            *local_148 = 1;

+          }

+          if (local_17c != 0) {

+            *local_158 = 1;

+          }

+          if (local_188[0] != 0) {

+            *local_160 = 1;

+          }

+          uVar5 = *puVar9;

+          param_1 = puVar9;

+          if (uVar5 != 0) {

+            param_1 = puVar9 + 1;

+          }

+        }

+        else {

+LAB_4:

+          bVar4 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::

+                  __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                                       ::__l2::impl);

+          uVar10 = (longlong)param_2 - (longlong)_Src >> 1;

+          if (bVar4) {

+            iVar7 = ExtendOutputBuffer(param_3,*param_4,uVar10 & 0xffffffff);

+            if (iVar7 < 0) {

+              return iVar7;

+            }

+            iVar7 = WriteOutputBuffer(param_3,param_4,*param_4,_Src);

+            if (iVar7 < 0) {

+              return iVar7;

+            }

+          }

+          else {

+            iVar7 = (int)uVar10 + *param_4;

+            if (*(int *)(param_3 + 8) < iVar7) {

+              CTempBufferRef<unsigned_short>::Resize(param_3,iVar7 + 0x100);

+            }

+            memcpy((void *)(*(longlong *)param_3 + (longlong)*param_4 * 2),_Src,uVar10 * 2);

+            *param_4 = *param_4 + (int)uVar10;

+          }

+          uVar5 = *param_2;

+          puVar9 = param_2;

+          param_1 = param_2;

+        }

+        _Src = puVar9 + 1;

+        param_12 = (int *)local_178;

+        if (uVar5 == 0) {

+          _Src = puVar9;

+        }

+      }

+      else {

+        _Src = _Src + 1;

+        param_12 = (int *)local_178;

+      }

     }

-    in_stack_00000070 = unaff_RBP + -0x80;

-    if (unaff_R15D < *(int *)(unaff_RBP + 8)) {

-      GlobalFree(*(HGLOBAL *)unaff_RBP);

+    if (param_1 < param_2) {

+      bVar4 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::__private_IsEnabled

+                        ((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                          ::__l2::impl);

+      uVar10 = (longlong)param_2 - (longlong)param_1 >> 1;

+      if (bVar4) {

+        iVar7 = ExtendOutputBuffer(param_3,*param_4,uVar10 & 0xffffffff);

+        if (iVar7 < 0) {

+          return iVar7;

+        }

+        iVar7 = WriteOutputBuffer(param_3,param_4,*param_4,param_1);

+        if (iVar7 < 0) {

+          return iVar7;

+        }

+      }

+      else {

+        iVar7 = (int)uVar10 + *param_4;

+        if (*(int *)(param_3 + 8) < iVar7) {

+          CTempBufferRef<unsigned_short>::Resize(param_3,iVar7 + 0x100);

+        }

+        memcpy((void *)(*(longlong *)param_3 + (longlong)*param_4 * 2),param_1,uVar10 * 2);

+        *param_4 = *param_4 + (int)uVar10;

+      }

     }

-    *(int *)(unaff_RBP + 8) = unaff_R15D;

-    *(CAPITempBufferRef<char> **)unaff_RBP = unaff_RBP + 0x10;

-    CRegHandle::~CRegHandle((CRegHandle *)(unaff_RBP + -0x50));

+    if (param_5 != 0) {

+      *local_148 = 1;

+      memset(local_128,0,200);

+      local_138 = local_128;

+      local_188[0] = 0;

+      local_130 = 100;

+      bVar4 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::__private_IsEnabled

+                        ((FeatureImpl<__WilFeatureTraits_Feature_126862651> *)

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

+                          ::__l2::impl);

+      if (bVar4) {

+        if (((-1 < iVar2) && (iVar2 <= *param_4)) && (iVar2 <= *(int *)(param_3 + 8))) {

+          local_12c = 100;

+          iVar7 = (*local_168)((ushort *)(*(longlong *)param_3 + lVar11 * 2),*param_4 - iVar2,

+                               (CTempBufferRef<unsigned_short> *)&local_138,local_158,local_160,

+                               local_188,local_170);

+          if (((-1 < iVar7) && (iVar7 <= 0x7fffffff - iVar2)) && (iVar7 <= local_130)) {

+            iVar8 = ExtendOutputBuffer(param_3,iVar2,iVar7);

+            if (iVar8 < 0) {

+              if (local_130 < 0x65) {

+                return iVar8;

+              }

+              operator_delete(local_138);

+              return iVar8;

+            }

+            iVar8 = WriteOutputBuffer(param_3,param_4,iVar2,local_138);

+            if (iVar8 < 0) {

+              if (local_130 < 0x65) {

+                return iVar8;

+              }

+              operator_delete(local_138);

+              return iVar8;

+            }

+            goto LAB_5;

+          }

+        }

+        if (100 < local_130) {

+          operator_delete(local_138);

+        }

+        goto LAB_0;

+      }

+      local_12c = 100;

+      iVar7 = (*local_168)((ushort *)(*(longlong *)param_3 + lVar11 * 2),*param_4 - iVar2,

+                           (CTempBufferRef<unsigned_short> *)&local_138,local_158,local_160,

+                           local_188,local_170);

+      iVar8 = iVar7 + iVar2;

+      *param_4 = iVar8;

+      if (*(int *)(param_3 + 8) < iVar8) {

+        CTempBufferRef<unsigned_short>::Resize(param_3,iVar8 + 0x100);

+      }

+      memcpy((void *)(*(longlong *)param_3 + lVar11 * 2),local_138,(longlong)iVar7 * 2);

+LAB_5:

+      if (((local_188[0] != 0) && (local_150 != (int *)0x0)) && ((uint)*param_12 < 10)) {

+        local_150[(longlong)*param_12 * 2] = iVar2;

+        local_150[(longlong)*param_12 * 2 + 1] = iVar7;

+        *param_12 = *param_12 + 1;

+      }

+      if (100 < local_130) {

+        operator_delete(local_138);

+      }

+    }

+    lVar6 = 0;

   }

-  return;

+  return lVar6;

 }
```

## `SplitPath`  (modified)

```diff
--- SplitPath
+++ SplitPath
@@ -1,764 +1,58 @@
 

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

    guard_dispatch_icall */

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

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

+/* class IMsiRecord * __ptr64 __cdecl SplitPath(unsigned short const * __ptr64,class IMsiString

+   const * __ptr64 * __ptr64,class IMsiString const * __ptr64 * __ptr64) */

 

 IMsiRecord * __cdecl SplitPath(ushort *param_1,IMsiString **param_2,IMsiString **param_3)

 

 {

-  IMsiCursor *pIVar1;

-  longlong *plVar2;

-  longlong lVar3;

-  undefined2 uVar4;

-  ievtEnum iVar5;

-  int iVar6;

-  uint uVar7;

-  ieiEnum iVar8;

-  short *psVar9;

-  undefined8 uVar10;

-  IMsiRecord *in_RAX;

-  IMsiRecord *pIVar11;

-  CComPointer<class_IMsiEngine> *pCVar12;

-  CMsiEngine *pCVar13;

-  PatchTransformState *pPVar14;

-  IMsiString *pIVar15;

-  IMsiString *pIVar16;

-  ushort *puVar17;

-  code *pcVar18;

-  imodcEnum iVar19;

-  CComPointer<IMsiEngine> *this;

-  CMsiEngine *pCVar20;

-  IMsiString *unaff_RBX;

-  longlong unaff_RBP;

-  IMsiString *unaff_RSI;

-  CMsiStringNullCopy *unaff_RDI;

-  CMsiStringNull *pCVar21;

-  char *pcVar22;

-  longlong *unaff_R12;

-  longlong *unaff_R13;

-  IMsiString *unaff_R14;

-  longlong *unaff_R15;

-  bool bVar23;

-  bool bStack0000000000000050;

-  int *in_stack_00000058;

-  IMsiRecord *in_stack_00000070;

-  longlong *in_stack_00000078;

+  bool bVar1;

+  IMsiString *pIVar2;

+  uint uVar3;

+  undefined1 auStack_278 [32];

+  bool local_258 [4];

+  ulong local_254;

+  CMsiStringNullCopy *local_250;

+  ushort local_248;

+  undefined1 local_246 [526];

+  ulonglong local_38;

   

-  bVar23 = (int)param_1 == 0;

-  while( true ) {

-    if (!bVar23) {

-      (**(code **)(*(longlong *)param_1 + 0x10))();

-      in_RAX = *(IMsiRecord **)(unaff_RBP + -0x30);

-    }

-    in_stack_00000070 = in_RAX;

-    if ((in_RAX != (IMsiRecord *)0x0) || (*(longlong *)(unaff_RBP + -0x80) == 0)) {

-      iVar8 = CMsiEngine::PostInitializeError

-                        (*(CMsiEngine **)(unaff_RBP + 0x50),in_RAX,unaff_RSI,0x12);

-      lVar3 = *unaff_R15;

-      *(ieiEnum *)(unaff_RBP + 0x80) = iVar8;

-      (**(code **)(lVar3 + 0x10))(unaff_R15);

-      (**(code **)(*unaff_R12 + 0x10))(unaff_R12);

-      pcVar18 = *(code **)(*unaff_R13 + 0x10);

+  local_38 = __security_cookie ^ (ulonglong)auStack_278;

+  local_258[0] = false;

+  bVar1 = IsURL(param_1,local_258);

+  local_248 = 0;

+  memset(local_246,0,0x208);

+  local_254 = 0x104;

+  local_250 = &MsiString::s_NullString;

+  if (bVar1) {

+    if (local_258[0] == false) {

+      MsiCanonicalizeUrl(param_1,&local_248,&local_254,0x20000000);

+      param_1 = &local_248;

+      uVar3 = 0x2f;

       goto LAB_0;

     }

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

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

-    pIVar11 = LoadTransformViewTable

-                        (*(IMsiDatabase **)(unaff_RBP + 0x58),*(IMsiStorage **)(unaff_RBP + -0x78),

-                         (ushort *)L"_MsiPatchAuthorTransformView",(IMsiRecord *)0x0,0x1f,

-                         (IMsiCursor **)(unaff_RBP + -0x68),(IMsiTable **)(unaff_RBP + -0x50),

-                         SUB41(*(undefined4 *)(unaff_RBP + -0x28),0),false);

-    *(IMsiRecord **)(unaff_RBP + -0x30) = pIVar11;

-    if (in_stack_00000070 != (IMsiRecord *)0x0) {

-      (**(code **)(*(longlong *)in_stack_00000070 + 0x10))();

-      pIVar11 = *(IMsiRecord **)(unaff_RBP + -0x30);

-    }

-    in_stack_00000070 = pIVar11;

-    if (pIVar11 != (IMsiRecord *)0x0) break;

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

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

-    pIVar11 = LoadTransformViewTable

-                        (*(IMsiDatabase **)(unaff_RBP + 0x58),*(IMsiStorage **)(unaff_RBP + -0x80),

-                         (ushort *)L"_MsiPatchPatchTransformView",(IMsiRecord *)0x0,0x1f,

-                         (IMsiCursor **)(unaff_RBP + -0x60),(IMsiTable **)(unaff_RBP + -0x58),

-                         SUB41(*(undefined4 *)(unaff_RBP + -0x28),0),true);

-    *(IMsiRecord **)(unaff_RBP + -0x30) = pIVar11;

-    if (in_stack_00000070 != (IMsiRecord *)0x0) {

-      (**(code **)(*(longlong *)in_stack_00000070 + 0x10))();

-      pIVar11 = *(IMsiRecord **)(unaff_RBP + -0x30);

-    }

-    if (pIVar11 != (IMsiRecord *)0x0) {

-      in_stack_00000070 = pIVar11;

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchAuthorTransformView");

-      iVar8 = 0x21;

-      pCVar21 = (CMsiStringNull *)unaff_RSI;

-LAB_1:

-      iVar8 = CMsiEngine::PostInitializeError

-                        (*(CMsiEngine **)(unaff_RBP + 0x50),in_stack_00000070,(IMsiString *)pCVar21,

-                         iVar8);

-      *(ieiEnum *)(unaff_RBP + 0x80) = iVar8;

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x58));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x60));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x50));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x68));

-      pcVar18 = *(code **)(*unaff_R15 + 0x10);

-LAB_2:

-      (*pcVar18)(unaff_R15);

-      pcVar18 = *(code **)(*unaff_R12 + 0x10);

-      goto LAB_3;

-    }

-    if (**(char **)(unaff_RBP + 0x98) == '\0') {

-      pCVar13 = (CMsiEngine *)in_stack_00000070;

-      in_stack_00000070 = pIVar11;

-      pIVar11 = CMsiEngine::CreateNewPatchTableSchema

-                          (pCVar13,*(IMsiDatabase **)(unaff_RBP + 0x58),

-                           *(IMsiCursor **)(unaff_RBP + -0x60));

-      pCVar12 = CComPointer<IMsiEngine>::operator=

-                          ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-      if (*(longlong *)pCVar12 != 0) {

-        if (g_dmDiagnosticMode != 0) {

-          DebugString(9,0,0,(ushort *)L"Unable to create new patch table schema",(ushort *)L"(NULL)"

-                      ,(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

-                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

-        }

-        iVar8 = 0x11;

-        pCVar21 = &g_MsiStringNull;

-        goto LAB_1;

-      }

-      **(undefined1 **)(unaff_RBP + 0x98) = 1;

-      pIVar11 = in_stack_00000070;

-    }

-    in_stack_00000070 = pIVar11;

-    pCVar13 = *(CMsiEngine **)(unaff_RBP + 0x50);

-    pIVar1 = *(IMsiCursor **)(unaff_RBP + -0x68);

-    this = (CComPointer<IMsiEngine> *)0x0;

-    if (*(CMsiBaselineManager **)(pCVar13 + 0x3a0) != (CMsiBaselineManager *)0x0) {

-      pIVar11 = CMsiBaselineManager::PopulateBaselineFileTable

-                          (*(CMsiBaselineManager **)(pCVar13 + 0x3a0),

-                           *(IMsiString **)(unaff_RBP + 0x60),*(IMsiCursor **)(unaff_RBP + -0x60));

-      CComPointer<IMsiEngine>::operator=

-                ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-      if (in_stack_00000070 == (IMsiRecord *)0x0) {

-        pIVar11 = CMsiBaselineManager::PopulateBaselineFileTableWithResequencedFiles

-                            (*(CMsiBaselineManager **)(*(longlong *)(unaff_RBP + 0x50) + 0x3a0),

-                             *(IMsiString **)(unaff_RBP + 0x60),pIVar1);

-        this = (CComPointer<IMsiEngine> *)&stack0x00000070;

-        CComPointer<IMsiEngine>::operator=(this,(IMsiEngine *)pIVar11);

-        if (in_stack_00000070 == (IMsiRecord *)0x0) {

-          pCVar13 = *(CMsiEngine **)(unaff_RBP + 0x50);

-          goto LAB_4;

-        }

-      }

-LAB_5:

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchAuthorTransformView");

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchPatchTransformView");

-      iVar8 = 0x21;

-      pIVar15 = unaff_RSI;

-LAB_6:

-      iVar8 = CMsiEngine::PostInitializeError

-                        (*(CMsiEngine **)(unaff_RBP + 0x50),in_stack_00000070,pIVar15,iVar8);

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x58));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x60));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x50));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x68));

-      pcVar18 = *(code **)(**(longlong **)(unaff_RBP + -0x40) + 0x10);

-LAB_7:

-      (*pcVar18)();

-      (**(code **)(*unaff_R12 + 0x10))(unaff_R12);

-      (**(code **)(*unaff_R13 + 0x10))(unaff_R13);

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)&stack0x00000070);

-      (**(code **)(*(longlong *)unaff_R14 + 0x10))(unaff_R14);

-      (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-      (**(code **)(*(longlong *)unaff_RDI + 0x10))(unaff_RDI);

-      (**(code **)(*(longlong *)unaff_RSI + 0x10))(unaff_RSI);

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x80));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x78));

-LAB_8:

-      (**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0x10))();

-      (**(code **)(*in_stack_00000078 + 0x10))();

-      return (IMsiRecord *)(ulonglong)iVar8;

-    }

-LAB_4:

-    pIVar15 = (IMsiString *)unaff_RDI;

-    if (*(char *)(unaff_RBP + 0x78) != '\0') {

-      if (pCVar13[0x3b0] != (CMsiEngine)0x0) {

-        pIVar11 = CMsiEngine::HandleFlyWeightTransformDetection

-                            (pCVar13,*(IMsiTable **)(unaff_RBP + -0x50),pIVar1);

-        CComPointer<IMsiEngine>::operator=

-                  ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-        pCVar13 = *(CMsiEngine **)(unaff_RBP + 0x50);

-        if (in_stack_00000070 != (IMsiRecord *)0x0) {

-          pCVar13[0x3b0] = (CMsiEngine)0x0;

-        }

-        pIVar11 = CMsiEngine::HandleFlyWeightTransformDetection

-                            (pCVar13,*(IMsiTable **)(unaff_RBP + -0x58),

-                             *(IMsiCursor **)(unaff_RBP + -0x60));

-        this = (CComPointer<IMsiEngine> *)&stack0x00000070;

-        CComPointer<IMsiEngine>::operator=(this,(IMsiEngine *)pIVar11);

-        pCVar13 = *(CMsiEngine **)(unaff_RBP + 0x50);

-        if (in_stack_00000070 != (IMsiRecord *)0x0) {

-          pCVar13[0x3b0] = (CMsiEngine)0x0;

-        }

-      }

-      pCVar20 = (CMsiEngine *)0x0;

-      if (pCVar13[0x3b8] != (CMsiEngine)0x0) {

-        while( true ) {

-          iVar19 = (imodcEnum)pCVar20;

-          *(imodcEnum *)(unaff_RBP + -0x38) = iVar19;

-          this = (CComPointer<IMsiEngine> *)pCVar20;

-          if (0x1a < (int)iVar19) break;

-          pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                              (pCVar13,*(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1,iVar19,2);

-          CComPointer<IMsiEngine>::operator=

-                    ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-          if (in_stack_00000070 != (IMsiRecord *)0x0) {

-            ReleaseTransformViewTable

-                      (*(IMsiDatabase **)(unaff_RBP + 0x58),

-                       (ushort *)L"_MsiPatchAuthorTransformView");

-            ReleaseTransformViewTable

-                      (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchPatchTransformView"

-                      );

-            iVar8 = 0x21;

-            goto LAB_6;

-          }

-          pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                              (*(CMsiEngine **)(unaff_RBP + 0x50),

-                               *(IMsiDatabase **)(unaff_RBP + 0x58),

-                               *(IMsiCursor **)(unaff_RBP + -0x60),*(imodcEnum *)(unaff_RBP + -0x38)

-                               ,2);

-          CComPointer<IMsiEngine>::operator=

-                    ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-          if (in_stack_00000070 != (IMsiRecord *)0x0) goto LAB_5;

-          pCVar13 = *(CMsiEngine **)(unaff_RBP + 0x50);

-          pCVar20 = (CMsiEngine *)(ulonglong)(*(int *)(unaff_RBP + -0x38) + 1);

-        }

-      }

-    }

-    iVar8 = CMsiEngine::CheckForChangedSupersededComponentAttribute

-                      ((CMsiEngine *)this,*(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1);

-    *(ieiEnum *)(unaff_RBP + -0x38) = iVar8;

-    if (iVar8 != 0) {

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchAuthorTransformView");

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchPatchTransformView");

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x58));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x60));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x50));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x68));

-      (**(code **)(**(longlong **)(unaff_RBP + -0x40) + 0x10))();

-      (**(code **)(*unaff_R12 + 0x10))(unaff_R12);

-      (**(code **)(*unaff_R13 + 0x10))(unaff_R13);

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)&stack0x00000070);

-      (**(code **)(*(longlong *)unaff_R14 + 0x10))(unaff_R14);

-      (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-      (**(code **)(*(longlong *)unaff_RDI + 0x10))(unaff_RDI);

-      (**(code **)(*(longlong *)unaff_RSI + 0x10))(unaff_RSI);

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x80));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x78));

-      (**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0x10))();

-      (**(code **)(*in_stack_00000078 + 0x10))();

-      return (IMsiRecord *)(ulonglong)*(uint *)(unaff_RBP + -0x38);

-    }

-    if ((*(byte *)(unaff_RBP + 0x80) & 0x80) == 0) {

-      pIVar11 = CMsiEngine::CheckPatchForNotUninstallableContent

-                          ((CMsiEngine *)this,*(IMsiString **)(unaff_RBP + 0x60),pIVar1,

-                           *(bool **)(unaff_RBP + 0x90));

-      CComPointer<IMsiEngine>::operator=

-                ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-      if (in_stack_00000070 != (IMsiRecord *)0x0) goto LAB_5;

+    bVar1 = MsiConvertFileUrlToFilePath(param_1,&local_248,&local_254,0x20000000);

+    if (bVar1) {

+      param_1 = &local_248;

     }

     else {

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

+      param_1 = param_1 + 7;

     }

-    if (*(char *)(unaff_RBP + 0x88) != '\0') {

-      pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                          (*(CMsiEngine **)(unaff_RBP + 0x50),*(IMsiDatabase **)(unaff_RBP + 0x58),

-                           pIVar1,2,1);

-      CComPointer<IMsiEngine>::operator=

-                ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-      if (in_stack_00000070 == (IMsiRecord *)0x0) {

-        pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                            (*(CMsiEngine **)(unaff_RBP + 0x50),*(IMsiDatabase **)(unaff_RBP + 0x58)

-                             ,pIVar1,0x1b,1);

-        CComPointer<IMsiEngine>::operator=

-                  ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-        if (in_stack_00000070 == (IMsiRecord *)0x0) {

-          pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                              (*(CMsiEngine **)(unaff_RBP + 0x50),

-                               *(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1,0x18,1);

-          CComPointer<IMsiEngine>::operator=

-                    ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-          if (in_stack_00000070 == (IMsiRecord *)0x0) {

-            pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                                (*(CMsiEngine **)(unaff_RBP + 0x50),

-                                 *(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1,0x1c,1);

-            CComPointer<IMsiEngine>::operator=

-                      ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-            if (in_stack_00000070 == (IMsiRecord *)0x0) {

-              pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                                  (*(CMsiEngine **)(unaff_RBP + 0x50),

-                                   *(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1,0xb,1);

-              CComPointer<IMsiEngine>::operator=

-                        ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-              if (in_stack_00000070 == (IMsiRecord *)0x0) {

-                pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                                    (*(CMsiEngine **)(unaff_RBP + 0x50),

-                                     *(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1,0x11,1);

-                CComPointer<IMsiEngine>::operator=

-                          ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-                if (in_stack_00000070 == (IMsiRecord *)0x0) {

-                  pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                                      (*(CMsiEngine **)(unaff_RBP + 0x50),

-                                       *(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1,7,1);

-                  CComPointer<IMsiEngine>::operator=

-                            ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-                  if (in_stack_00000070 == (IMsiRecord *)0x0) {

-                    pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                                        (*(CMsiEngine **)(unaff_RBP + 0x50),

-                                         *(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1,0x12,1);

-                    CComPointer<IMsiEngine>::operator=

-                              ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-                    if (in_stack_00000070 == (IMsiRecord *)0x0) {

-                      pIVar11 = CMsiEngine::DetermineInstallPatchModifications

-                                          (*(CMsiEngine **)(unaff_RBP + 0x50),

-                                           *(IMsiDatabase **)(unaff_RBP + 0x58),pIVar1,0x14,1);

-                      CComPointer<IMsiEngine>::operator=

-                                ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-                      if (in_stack_00000070 == (IMsiRecord *)0x0) goto LAB_9;

-                    }

-                  }

-                }

-              }

-            }

-          }

-        }

-      }

-      goto LAB_5;

-    }

-LAB_9:

-    pPVar14 = (PatchTransformState *)(*(longlong *)(unaff_RBP + 0x50) + 0x30c);

-    *(PatchTransformState **)(unaff_RBP + -0x18) = pPVar14;

-    pIVar11 = ApplyTransform(*(IMsiDatabase **)(unaff_RBP + 0x58),

-                             *(IMsiStorage **)(unaff_RBP + -0x78),*(int *)(unaff_RBP + -0x24),false,

-                             pPVar14,pIVar1,SUB41(*(undefined4 *)(unaff_RBP + -0x28),0));

-    *(IMsiRecord **)(unaff_RBP + -0x30) = pIVar11;

-    if (in_stack_00000070 != (IMsiRecord *)0x0) {

-      (**(code **)(*(longlong *)in_stack_00000070 + 0x10))();

-      pIVar11 = *(IMsiRecord **)(unaff_RBP + -0x30);

-    }

-    in_stack_00000070 = pIVar11;

-    if (pIVar11 != (IMsiRecord *)0x0) {

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchAuthorTransformView");

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchPatchTransformView");

-      iVar8 = 0xe;

-      goto LAB_6;

-    }

-    if (pIVar1 != (IMsiCursor *)0x0) {

-      (**(code **)(*(longlong *)pIVar1 + 0x10))(pIVar1);

-    }

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

-    plVar2 = *(longlong **)(unaff_RBP + -0x50);

-    if (plVar2 != (longlong *)0x0) {

-      (**(code **)(*plVar2 + 0x10))(plVar2);

-    }

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

-    ReleaseTransformViewTable

-              (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchAuthorTransformView");

-    iVar6 = (**(code **)(*in_stack_00000078 + 0x38))();

-    if (iVar6 != 0) {

-      MsiString::MsiString((MsiString *)(unaff_RBP + -0x10),0x3b);

-      MsiString::operator+=((MsiString *)&stack0x00000078,(MsiString *)(unaff_RBP + -0x10));

-      (**(code **)(**(longlong **)(unaff_RBP + -0x10) + 0x10))();

-    }

-    (**(code **)(*in_stack_00000078 + 0x98))(in_stack_00000078,unaff_RBX,&stack0x00000078);

-    pIVar15 = (IMsiString *)

-              (**(code **)(**(longlong **)(unaff_RBP + 0x50) + 0xb8))

-                        (*(longlong **)(unaff_RBP + 0x50),L"ProductCode");

-    *(IMsiString **)(unaff_RBP + -0x30) = pIVar15;

-    (**(code **)(*unaff_R13 + 0x50))(unaff_R13);

-    pIVar16 = pIVar15;

-    iVar6 = (**(code **)(*(longlong *)pIVar15 + 200))(pIVar15,1);

-    if (iVar6 != 0) {

-      pIVar16 = (IMsiString *)(**(code **)(**(longlong **)(unaff_RBP + 0x50) + 0xb8))();

-      puVar17 = (ushort *)(**(code **)(*unaff_R12 + 0x50))(unaff_R12);

-      uVar7 = ProductVersionStringToInt(puVar17);

-      lVar3 = *(longlong *)pIVar16;

-      *(uint *)(unaff_RBP + -0x38) = uVar7;

-      puVar17 = (ushort *)(**(code **)(lVar3 + 0x50))(pIVar16);

-      uVar7 = ProductVersionStringToInt(puVar17);

-      if (*(uint *)(unaff_RBP + -0x38) == uVar7) {

-        bVar23 = g_dmDiagnosticMode != 0;

-        *(undefined1 *)(unaff_RBP + 0x70) = 1;

-        if (bVar23) {

-          pcVar22 = 

-          "Detected that this is a \'Small Update\' patch.  Any remaining transforms in the patch will be skipped."

-          ;

-LAB_10:

-          DebugString(9,0,0,pcVar22,"(NULL)","(NULL)","(NULL)","(NULL)","(NULL)","(NULL)",

-                      _bStack0000000000000050,in_stack_00000058);

-        }

-      }

-      else if (((*(byte *)(unaff_RBP + -0x20) & 0x38) == 0 ||

-                (*(uint *)(unaff_RBP + -0x20) & 0x7c0) == 0) &&

-              (bVar23 = g_dmDiagnosticMode != 0, *(undefined1 *)(unaff_RBP + -0x48) = 1, bVar23)) {

-        pcVar22 = 

-        "Detected that this patch is a \'Minor Update\' patch without product version validation. Any remaining transforms in the patch will be skipped."

-        ;

-        goto LAB_10;

-      }

-      (**(code **)(*(longlong *)pIVar16 + 0x10))();

-      pIVar15 = *(IMsiString **)(unaff_RBP + -0x30);

-    }

-    pIVar11 = GetTransformErrorConditions

-                        (pIVar16,*(IMsiStorage **)(unaff_RBP + -0x80),(int *)(unaff_RBP + -0x24));

-    *(IMsiRecord **)(unaff_RBP + -0x20) = pIVar11;

-    if (in_stack_00000070 != (IMsiRecord *)0x0) {

-      (**(code **)(*(longlong *)in_stack_00000070 + 0x10))();

-      pIVar11 = *(IMsiRecord **)(unaff_RBP + -0x20);

-    }

-    in_stack_00000070 = pIVar11;

-    if (pIVar11 != (IMsiRecord *)0x0) {

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchPatchTransformView");

-      iVar8 = CMsiEngine::PostInitializeError

-                        (*(CMsiEngine **)(unaff_RBP + 0x50),in_stack_00000070,unaff_RSI,0xe);

-      lVar3 = *(longlong *)pIVar15;

-      *(ieiEnum *)(unaff_RBP + 0x80) = iVar8;

-      (**(code **)(lVar3 + 0x10))(pIVar15);

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x58));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x60));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x50));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x68));

-      unaff_R15 = *(longlong **)(unaff_RBP + -0x40);

-      pcVar18 = *(code **)(*unaff_R15 + 0x10);

-      goto LAB_2;

-    }

-    pIVar1 = *(IMsiCursor **)(unaff_RBP + -0x60);

-    pIVar11 = ApplyTransform(*(IMsiDatabase **)(unaff_RBP + 0x58),

-                             *(IMsiStorage **)(unaff_RBP + -0x80),*(int *)(unaff_RBP + -0x24),true,

-                             *(PatchTransformState **)(unaff_RBP + -0x18),pIVar1,

-                             SUB41(*(undefined4 *)(unaff_RBP + -0x28),0));

-    *(IMsiRecord **)(unaff_RBP + -0x18) = pIVar11;

-    if (in_stack_00000070 != (IMsiRecord *)0x0) {

-      (**(code **)(*(longlong *)in_stack_00000070 + 0x10))();

-      pIVar11 = *(IMsiRecord **)(unaff_RBP + -0x18);

-    }

-    in_stack_00000070 = pIVar11;

-    if (pIVar11 != (IMsiRecord *)0x0) {

-      ReleaseTransformViewTable

-                (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchPatchTransformView");

-      iVar8 = 0xe;

-      pCVar13 = *(CMsiEngine **)(unaff_RBP + 0x50);

-LAB_11:

-      iVar8 = CMsiEngine::PostInitializeError(pCVar13,in_stack_00000070,unaff_RSI,iVar8);

-      (**(code **)(**(longlong **)(unaff_RBP + -0x30) + 0x10))();

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x58));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x60));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x50));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x68));

-      pcVar18 = *(code **)(**(longlong **)(unaff_RBP + -0x40) + 0x10);

-      goto LAB_7;

-    }

-    if (pIVar1 != (IMsiCursor *)0x0) {

-      (**(code **)(*(longlong *)pIVar1 + 0x10))(pIVar1);

-    }

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

-    plVar2 = *(longlong **)(unaff_RBP + -0x58);

-    if (plVar2 != (longlong *)0x0) {

-      (**(code **)(*plVar2 + 0x10))(plVar2);

-    }

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

-    ReleaseTransformViewTable

-              (*(IMsiDatabase **)(unaff_RBP + 0x58),(ushort *)L"_MsiPatchPatchTransformView");

-    pCVar13 = *(CMsiEngine **)(unaff_RBP + 0x50);

-    if (*(CMsiBaselineManager **)(pCVar13 + 0x3a0) != (CMsiBaselineManager *)0x0) {

-      pIVar11 = CMsiBaselineManager::UpdateMatchDataForEntirePatch

-                          (*(CMsiBaselineManager **)(pCVar13 + 0x3a0),

-                           *(IMsiString **)(unaff_RBP + 0x60));

-      CComPointer<IMsiEngine>::operator=

-                ((CComPointer<IMsiEngine> *)&stack0x00000070,(IMsiEngine *)pIVar11);

-      if (in_stack_00000070 != (IMsiRecord *)0x0) {

-        iVar8 = 0x21;

-        goto LAB_11;

-      }

-    }

-    lVar3 = _s_NullString;

-    *(CMsiStringNullCopy **)(unaff_RBP + -0x68) = &MsiString::s_NullString;

-    (**(code **)(lVar3 + 0x80))(&MsiString::s_NullString,0x3b,unaff_RBP + -0x68);

-    (**(code **)(*in_stack_00000078 + 0x98))

-              (in_stack_00000078,*(undefined8 *)(unaff_RBP + -0x68),&stack0x00000078);

-    (**(code **)(**(longlong **)(unaff_RBP + -0x68) + 0x10))();

-    (**(code **)(*in_stack_00000078 + 0x98))(in_stack_00000078,unaff_R14,&stack0x00000078);

-    (**(code **)(**(longlong **)(unaff_RBP + -0x30) + 0x10))();

-    unaff_R15 = *(longlong **)(unaff_RBP + -0x40);

-LAB_12:

-    (**(code **)(*unaff_R15 + 0x10))(unaff_R15);

-    (**(code **)(*unaff_R12 + 0x10))(unaff_R12);

-    (**(code **)(*unaff_R13 + 0x10))(unaff_R13);

-    if (in_stack_00000070 != (IMsiRecord *)0x0) {

-      (**(code **)(*(longlong *)in_stack_00000070 + 0x10))();

-    }

-    if ((*(char *)(unaff_RBP + 0x70) != '\0') || (*(char *)(unaff_RBP + -0x48) != '\0')) {

-      (**(code **)(*(longlong *)unaff_R14 + 0x10))(unaff_R14);

-      (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-      (**(code **)(*(longlong *)unaff_RDI + 0x10))(unaff_RDI);

-      (**(code **)(*(longlong *)unaff_RSI + 0x10))(unaff_RSI);

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

-        (**(code **)(**(longlong **)(unaff_RBP + -0x80) + 0x10))();

-      }

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

-        (**(code **)(**(longlong **)(unaff_RBP + -0x78) + 0x10))();

-      }

-LAB_13:

-      (**(code **)(*in_stack_00000078 + 8))();

-      **(undefined8 **)(unaff_RBP + 0xa0) = in_stack_00000078;

-      (**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0x10))();

-      (**(code **)(*in_stack_00000078 + 0x10))();

-      return (IMsiRecord *)0x0;

-    }

-    pCVar13 = *(CMsiEngine **)(unaff_RBP + 0x50);

-    plVar2 = *(longlong **)(unaff_RBP + 0x68);

-    do {

-      (**(code **)(*(longlong *)unaff_R14 + 0x10))(unaff_R14);

-      (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-      (**(code **)(*(longlong *)unaff_RDI + 0x10))(unaff_RDI);

-      (**(code **)(*(longlong *)unaff_RSI + 0x10))(unaff_RSI);

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

-        (**(code **)(**(longlong **)(unaff_RBP + -0x80) + 0x10))();

-      }

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

-        (**(code **)(**(longlong **)(unaff_RBP + -0x78) + 0x10))();

-      }

-      iVar6 = (**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0x38))();

-      if (iVar6 == 0) goto LAB_13;

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

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

-      unaff_RDI = &MsiString::s_NullString;

-      unaff_RBX = (IMsiString *)(**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0xb8))();

-      iVar6 = (**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0x38))();

-      if (iVar6 == 0) {

-        if (g_dmDiagnosticMode != 0) {

-          DebugString(10,0,0,"Patch did not contain pairs of transforms.","(NULL)","(NULL)","(NULL)"

-                      ,"(NULL)","(NULL)","(NULL)",_bStack0000000000000050,in_stack_00000058);

-        }

-        (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-        (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

-        (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

-        CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                  ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x80));

-        CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                  ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x78));

-        goto LAB_14;

-      }

-      unaff_R14 = (IMsiString *)(**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0xb8))();

-      psVar9 = (short *)(**(code **)(*(longlong *)unaff_R14 + 0x50))(unaff_R14);

-      if (*psVar9 == 0x3a) {

-        (**(code **)(*(longlong *)unaff_R14 + 0x40))();

-        unaff_RSI = (IMsiString *)(**(code **)(*(longlong *)unaff_R14 + 0xb0))(unaff_R14,4);

-        (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

-      }

-      else {

-        (**(code **)(*(longlong *)unaff_R14 + 8))(unaff_R14);

-        (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

-        unaff_RSI = unaff_R14;

-      }

-      iVar6 = (**(code **)(*(longlong *)unaff_RBX + 0x38))(unaff_RBX);

-    } while (iVar6 == 0);

-    psVar9 = (short *)(**(code **)(*(longlong *)unaff_RBX + 0x50))(unaff_RBX);

-    if (*psVar9 == 0x3a) {

-      (**(code **)(*(longlong *)unaff_RBX + 0x40))();

-      unaff_RDI = (CMsiStringNullCopy *)(**(code **)(*(longlong *)unaff_RBX + 0xb0))(unaff_RBX);

-      (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

-    }

-    else {

-      (**(code **)(*(longlong *)unaff_RBX + 8))(unaff_RBX);

-      (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

-      unaff_RDI = (CMsiStringNullCopy *)unaff_RBX;

-    }

-    if (g_dmDiagnosticMode != 0) {

-      puVar17 = (ushort *)(**(code **)(*(longlong *)unaff_RDI + 0x50))(unaff_RDI);

-      _bStack0000000000000050 = 0;

-      DebugString(9,0,0,(ushort *)L"Looking for patch transform: %s",puVar17,(ushort *)L"(NULL)",

-                  (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",0,

-                  (void *)0x0);

-    }

-    psVar9 = (short *)(**(code **)(*(longlong *)unaff_RDI + 0x50))(unaff_RDI);

-    if (*psVar9 == 0x23) {

-      (**(code **)(*(longlong *)unaff_R14 + 0x10))(unaff_R14);

-      (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-      (**(code **)(*(longlong *)unaff_RDI + 0x10))(unaff_RDI);

-      (**(code **)(*(longlong *)unaff_RSI + 0x10))(unaff_RSI);

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

-        (**(code **)(**(longlong **)(unaff_RBP + -0x80) + 0x10))();

-      }

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

-        (**(code **)(**(longlong **)(unaff_RBP + -0x78) + 0x10))();

-      }

-LAB_14:

-      (**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0x10))();

-      (**(code **)(*in_stack_00000078 + 0x10))();

-      return (IMsiRecord *)0x12;

-    }

-    pcVar18 = *(code **)(*plVar2 + 0x40);

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

-      (**(code **)(**(longlong **)(unaff_RBP + -0x78) + 0x10))();

-    }

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

-    uVar10 = (**(code **)(*(longlong *)unaff_RDI + 0x50))(unaff_RDI);

-    in_stack_00000070 = (IMsiRecord *)(*pcVar18)(plVar2,uVar10,0,unaff_RBP + -0x78);

-    if ((in_stack_00000070 != (IMsiRecord *)0x0) || (*(longlong *)(unaff_RBP + -0x78) == 0)) {

-      iVar8 = CMsiEngine::PostInitializeError

-                        (pCVar13,in_stack_00000070,(IMsiString *)unaff_RDI,0x12);

-      if (in_stack_00000070 != (IMsiRecord *)0x0) {

-        (**(code **)(*(longlong *)in_stack_00000070 + 0x10))();

-      }

-      (**(code **)(*(longlong *)unaff_R14 + 0x10))(unaff_R14);

-      (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-      (**(code **)(*(longlong *)unaff_RDI + 0x10))(unaff_RDI);

-      (**(code **)(*(longlong *)unaff_RSI + 0x10))(unaff_RSI);

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

-        (**(code **)(**(longlong **)(unaff_RBP + -0x80) + 0x10))();

-      }

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

-        (**(code **)(**(longlong **)(unaff_RBP + -0x78) + 0x10))();

-      }

-      goto LAB_8;

-    }

-    unaff_R13 = (longlong *)(**(code **)(*(longlong *)pCVar13 + 0xb8))(pCVar13,L"ProductCode");

-    unaff_R12 = (longlong *)(**(code **)(*(longlong *)pCVar13 + 0xb8))(pCVar13,L"ProductVersion");

-    unaff_R15 = (longlong *)(**(code **)(*(longlong *)pCVar13 + 0xb8))(pCVar13,L"UpgradeCode");

-    *(longlong **)(unaff_RBP + -0x40) = unaff_R15;

-    iVar6 = (**(code **)(*unaff_R13 + 0x38))(unaff_R13);

-    if ((iVar6 == 0) || (iVar6 = (**(code **)(*unaff_R12 + 0x38))(unaff_R12), iVar6 == 0)) {

-      (**(code **)(*unaff_R15 + 0x10))(unaff_R15);

-      (**(code **)(*unaff_R12 + 0x10))(unaff_R12);

-      (**(code **)(*unaff_R13 + 0x10))(unaff_R13);

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)&stack0x00000070);

-      (**(code **)(*(longlong *)unaff_R14 + 0x10))(unaff_R14);

-      (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-      (**(code **)(*(longlong *)unaff_RDI + 0x10))(unaff_RDI);

-      (**(code **)(*(longlong *)unaff_RSI + 0x10))(unaff_RSI);

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x80));

-      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-                ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x78));

-      (**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0x10))();

-      (**(code **)(*in_stack_00000078 + 0x10))();

-      return (IMsiRecord *)0x6;

-    }

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

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

-    if (in_stack_00000070 != (IMsiRecord *)0x0) {

-      (**(code **)(*(longlong *)in_stack_00000070 + 0x10))();

-    }

-    in_stack_00000070 = (IMsiRecord *)0x0;

-    uVar10 = (**(code **)(*(longlong *)unaff_RDI + 0x50))(unaff_RDI);

-    *(undefined8 *)(unaff_RBP + -0x30) = uVar10;

-    uVar4 = (**(code **)(**(longlong **)(unaff_RBP + 0x50) + 0x58))

-                      (*(longlong **)(unaff_RBP + 0x50));

-    lVar3 = *unaff_R15;

-    *(undefined2 *)(unaff_RBP + -0x38) = uVar4;

-    uVar10 = (**(code **)(lVar3 + 0x50))(unaff_R15);

-    lVar3 = *unaff_R12;

-    *(undefined8 *)(unaff_RBP + -0x68) = uVar10;

-    uVar10 = (**(code **)(lVar3 + 0x50))(unaff_R12);

-    lVar3 = *unaff_R13;

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

-    puVar17 = (ushort *)(**(code **)(lVar3 + 0x50))(unaff_R13);

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

-    iVar5 = ValidateTransform(*(IMsiServices **)(*(longlong *)(unaff_RBP + 0x50) + 0x80),

-                              *(IMsiStorage **)(unaff_RBP + -0x78),

-                              *(IMsiString **)(*(longlong *)(unaff_RBP + 0x50) + 0x200),puVar17,

-                              *(ushort **)(unaff_RBP + -0x58),*(ushort **)(unaff_RBP + -0x68),

-                              *(ushort *)(unaff_RBP + -0x38),(int *)(unaff_RBP + -0x24),false,

-                              *(ushort **)(unaff_RBP + -0x30),bStack0000000000000050,

-                              in_stack_00000058,&stack0x00000070);

-    if (iVar5 != 0) {

-      if (in_stack_00000070 != (IMsiRecord *)0x0) {

-        (**(code **)(**(longlong **)(unaff_RBP + 0x50) + 0x18))();

-      }

-      if (g_dmDiagnosticMode != 0) {

-        puVar17 = (ushort *)(**(code **)(*(longlong *)unaff_RSI + 0x50))(unaff_RSI);

-        in_stack_00000058 = (int *)0x0;

-        _bStack0000000000000050 = 0;

-        DebugString(9,0,0,(ushort *)

-                          L"Skipping validation for patch transform %s.  Will not apply because previous transform was invalid"

-                    ,puVar17,(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

-                    (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

-      }

-      goto LAB_12;

-    }

-    *(undefined8 *)(unaff_RBP + -0x30) = *(undefined8 *)(**(longlong **)(unaff_RBP + 0x68) + 0x40);

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

-      (**(code **)(**(longlong **)(unaff_RBP + -0x80) + 0x10))();

-    }

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

-    uVar10 = (**(code **)(*(longlong *)unaff_RSI + 0x50))(unaff_RSI);

-    in_RAX = (IMsiRecord *)

-             (**(code **)(unaff_RBP + -0x30))(*(undefined8 *)(unaff_RBP + 0x68),uVar10,0);

-    *(IMsiRecord **)(unaff_RBP + -0x30) = in_RAX;

-    bVar23 = in_stack_00000070 == (IMsiRecord *)0x0;

-    param_1 = (ushort *)in_stack_00000070;

   }

-  iVar8 = CMsiEngine::PostInitializeError

-                    (*(CMsiEngine **)(unaff_RBP + 0x50),pIVar11,(IMsiString *)unaff_RDI,0x21);

-  *(ieiEnum *)(unaff_RBP + 0x80) = iVar8;

-  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-            ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x50));

-  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-            ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x68));

-  (**(code **)(*unaff_R15 + 0x10))(unaff_R15);

-  pcVar18 = *(code **)(*unaff_R12 + 0x10);

-LAB_3:

-  (*pcVar18)(unaff_R12);

-  pcVar18 = *(code **)(*unaff_R13 + 0x10);

+  uVar3 = 0x5c;

 LAB_0:

-  (*pcVar18)(unaff_R13);

-  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-            ((CComPointer<IXMLDOMElement> *)&stack0x00000070);

-  (**(code **)(*(longlong *)unaff_R14 + 0x10))(unaff_R14);

-  (**(code **)(*(longlong *)unaff_RBX + 0x10))(unaff_RBX);

-  (**(code **)(*(longlong *)unaff_RDI + 0x10))(unaff_RDI);

-  (**(code **)(*(longlong *)unaff_RSI + 0x10))(unaff_RSI);

-  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-            ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x80));

-  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

-            ((CComPointer<IXMLDOMElement> *)(unaff_RBP + -0x78));

-  (**(code **)(**(longlong **)(unaff_RBP + -0x70) + 0x10))();

-  (**(code **)(*in_stack_00000078 + 0x10))();

-  return (IMsiRecord *)(ulonglong)*(uint *)(unaff_RBP + 0x80);

+  MsiString::operator=((MsiString *)&local_250,param_1);

+  pIVar2 = MsiString::ExtractAndRemove((MsiString *)&local_250,6,uVar3);

+  if (param_3 != (IMsiString **)0x0) {

+    (**(code **)(*(longlong *)pIVar2 + 8))(pIVar2);

+    *param_3 = pIVar2;

+  }

+  (**(code **)(*(longlong *)local_250 + 8))();

+  *param_2 = (IMsiString *)local_250;

+  (**(code **)(*(longlong *)pIVar2 + 0x10))(pIVar2);

+  (**(code **)(*(longlong *)local_250 + 0x10))();

+  return (IMsiRecord *)0x0;

 }
```

## `EnumVersionResLangProc`  (modified)

```diff
--- EnumVersionResLangProc
+++ EnumVersionResLangProc
@@ -1,105 +1,100 @@
 

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

+   guard_dispatch_icall */

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

+/* int __cdecl EnumVersionResLangProc(struct HINSTANCE__ * __ptr64,unsigned short const *

+   __ptr64,unsigned short const * __ptr64,unsigned short,__int64) */

 

 int __cdecl

 EnumVersionResLangProc

           (HINSTANCE__ *param_1,ushort *param_2,ushort *param_3,ushort param_4,__int64 param_5)

 

 {

-  long lVar1;

-  HGLOBAL hMem;

-  int unaff_EBX;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  uint uVar2;

-  ulonglong unaff_RDI;

-  undefined6 in_register_0000008a;

-  longlong lVar4;

-  ushort *unaff_R12;

-  longlong unaff_R13;

-  ulong *unaff_R14;

-  char in_ZF;

-  undefined1 *in_stack_00000060;

-  int in_stack_00000068;

-  ulonglong uVar3;

+  ushort uVar1;

+  ulonglong uVar2;

+  bool bVar3;

+  DWORD DVar4;

+  int iVar5;

+  HRSRC hResInfo;

+  HGLOBAL hResData;

+  LPVOID _Src;

+  uint uVar6;

+  ulonglong uVar7;

+  ulonglong uVar8;

+  undefined1 uVar9;

+  ushort *puVar10;

+  undefined1 auStack_98 [48];

+  uint local_68;

+  short *local_60;

+  undefined1 *local_58;

+  int local_50;

+  undefined1 local_48 [8];

+  ulonglong local_40;

   

-  lVar4 = CONCAT62(in_register_0000008a,param_4);

-  hMem = (HGLOBAL)((longlong)&param_1[-1].unused + 3);

-  if (hMem == (HGLOBAL)0x0 || in_ZF != '\0') {

-    GlobalFree(hMem);

-    unaff_EBX = 0xe;

+  local_40 = __security_cookie ^ (ulonglong)auStack_98;

+  if (param_5 != 0) {

+    hResInfo = FindResourceExW(param_1,(LPCWSTR)param_2,(LPCWSTR)param_3,param_4);

+    uVar9 = SUB81(param_3,0);

+    if (((hResInfo != (HRSRC)0x0) &&

+        (hResData = LoadResource(param_1,hResInfo), hResData != (HGLOBAL)0x0)) &&

+       (_Src = LockResource(hResData), _Src != (LPVOID)0x0)) {

+      DVar4 = SizeofResource(param_1,hResInfo);

+      if ((DVar4 != 0) &&

+         ((bVar3 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_1834194232>::

+                   __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_1834194232> *)

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

+                                        ::__l2::impl), !bVar3 || (DVar4 < 0x80000000)))) {

+        local_58 = local_48;

+        local_50 = 1;

+        bVar3 = CAPITempBuffer<unsigned_char,1>::SetSize

+                          ((CAPITempBuffer<unsigned_char,1> *)&local_58,DVar4,(bool)uVar9);

+        if (bVar3) {

+          memcpy(local_58,_Src,(ulonglong)DVar4);

+          local_68 = 0;

+          local_60 = (short *)0x0;

+          iVar5 = (*(code *)VERSION::VerQueryValueW)

+                            (local_58,L"\\VarFileInfo\\Translation",&local_60);

+          if (iVar5 != 0) {

+            uVar2 = (ulonglong)*(uint *)(param_5 + 0xc);

+            while ((uVar7 = uVar2, local_68 != 0 &&

+                   (uVar6 = (uint)uVar2, uVar6 < *(uint *)(param_5 + 8)))) {

+              bVar3 = false;

+              if (uVar6 == 0) {

+LAB_0:

+                uVar7 = (ulonglong)(uVar6 + 1);

+                *(short *)(*(longlong *)param_5 + uVar2 * 2) = *local_60;

+              }

+              else {

+                puVar10 = *(ushort **)param_5;

+                uVar8 = uVar2;

+                do {

+                  uVar1 = *puVar10;

+                  puVar10 = puVar10 + 1;

+                  if ((uint)uVar1 == (int)*local_60) {

+                    bVar3 = true;

+                  }

+                  uVar8 = uVar8 - 1;

+                } while (uVar8 != 0);

+                if (!bVar3) goto LAB_0;

+              }

+              if (local_68 < 5) break;

+              local_68 = local_68 - 4;

+              local_60 = local_60 + 2;

+              uVar2 = uVar7;

+            }

+            *(int *)(param_5 + 0xc) = (int)uVar7;

+            if (1 < local_50) {

+              GlobalFree(local_58);

+            }

+            return 1;

+          }

+        }

+        if (1 < local_50) {

+          GlobalFree(local_58);

+        }

+      }

+    }

   }

-  else {

-    while( true ) {

-      lVar1 = StringCchPrintfExW((ushort *)((unaff_RDI & 0xffffffff) * 2 + lVar4),

-                                 (ulonglong)(uint)((int)param_2 - (int)unaff_RDI),

-                                 (ushort **)&stack0x00000048,(__uint64 *)0x0,(ulong)unaff_R13,

-                                 (ushort *)L"%d");

-      if (lVar1 < 0) break;

-      lVar4 = *(longlong *)(unaff_RBP + 0xc0);

-      uVar2 = (int)unaff_RDI +

-              (int)((longlong)((unaff_R13 + (unaff_RDI & 0xffffffff) * -2) - lVar4) >> 1);

-      uVar3 = (ulonglong)uVar2;

-      if (unaff_ESI < 1) {

-        *(short *)(lVar4 + uVar3 * 2) = (short)unaff_R13;

-        uVar2 = FillBufferW(*(ushort **)(unaff_RBP + 0xc0),uVar2,unaff_R12,unaff_R14);

-        if (0x100 < *(int *)(unaff_RBP + 200)) {

-          GlobalFree(*(HGLOBAL *)(unaff_RBP + 0xc0));

-        }

-        if (unaff_EBX == 0) {

-          if (0x34 < in_stack_00000068) {

-            GlobalFree(in_stack_00000060);

-          }

-          in_stack_00000060 = &stack0x00000070;

-          in_stack_00000068 = 0x34;

-          if (100 < *(int *)(unaff_RBP + -0x18)) {

-            GlobalFree(*(HGLOBAL *)(unaff_RBP + -0x20));

-          }

-          *(undefined4 *)(unaff_RBP + -0x18) = 100;

-          *(longlong *)(unaff_RBP + -0x20) = unaff_RBP + -0x10;

-          CForbidTokenChangesDuringCall::~CForbidTokenChangesDuringCall

-                    ((CForbidTokenChangesDuringCall *)&stack0x00000050);

-          return uVar2;

-        }

-        if (0x34 < in_stack_00000068) {

-          GlobalFree(in_stack_00000060);

-        }

-        in_stack_00000060 = &stack0x00000070;

-        in_stack_00000068 = 0x34;

-        if (100 < *(int *)(unaff_RBP + -0x18)) {

-          GlobalFree(*(HGLOBAL *)(unaff_RBP + -0x20));

-        }

-        goto LAB_0;

-      }

-      unaff_RDI = uVar3;

-      if (uVar2 != 0) {

-        unaff_RDI = (ulonglong)(uVar2 + 1);

-        *(undefined2 *)(lVar4 + uVar3 * 2) = 0x2c;

-        lVar4 = *(longlong *)(unaff_RBP + 0xc0);

-      }

-      param_2 = (ushort *)(ulonglong)*(uint *)(unaff_RBP + 200);

-      unaff_ESI = unaff_ESI + -1;

-    }

-    if (0x100 < *(int *)(unaff_RBP + 200)) {

-      GlobalFree(*(HGLOBAL *)(unaff_RBP + 0xc0));

-    }

-    *(undefined4 *)(unaff_RBP + 200) = 0x100;

-    *(longlong *)(unaff_RBP + 0xc0) = unaff_RBP + 0xd0;

-    if (0x34 < in_stack_00000068) {

-      GlobalFree(in_stack_00000060);

-    }

-    in_stack_00000060 = &stack0x00000070;

-    in_stack_00000068 = 0x34;

-    if (100 < *(int *)(unaff_RBP + -0x18)) {

-      GlobalFree(*(HGLOBAL *)(unaff_RBP + -0x20));

-    }

-    unaff_EBX = 0x65b;

-  }

-LAB_0:

-  *(undefined4 *)(unaff_RBP + -0x18) = 100;

-  *(longlong *)(unaff_RBP + -0x20) = unaff_RBP + -0x10;

-  CForbidTokenChangesDuringCall::~CForbidTokenChangesDuringCall

-            ((CForbidTokenChangesDuringCall *)&stack0x00000050);

-  return unaff_EBX;

+  return 0;

 }
```

## `GetAllFileVersionInfo`  (modified)

```diff
--- GetAllFileVersionInfo
+++ GetAllFileVersionInfo
@@ -1,14 +1,189 @@
+

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

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

+   guard_dispatch_icall */

+/* enum ifiEnum __cdecl GetAllFileVersionInfo(unsigned short const * __ptr64,unsigned long *

+   __ptr64,unsigned long * __ptr64,unsigned short * __ptr64 const,int,int * __ptr64,enum Bool,bool)

+    */

 

 ifiEnum __cdecl

 GetAllFileVersionInfo

           (ushort *param_1,ulong *param_2,ulong *param_3,ushort *param_4,int param_5,int *param_6,

           Bool param_7,bool param_8)

 

 {

-  char *in_RAX;

-  ifiEnum unaff_EDI;

+  bool bVar1;

+  Bool BVar2;

+  ulong uVar3;

+  DWORD DVar4;

+  int iVar5;

+  ulong *puVar6;

+  undefined1 uVar7;

+  ushort *puVar8;

+  ulong *puVar9;

+  CAPITempBufferRef<unsigned_char> *pCVar10;

+  ulong *puVar11;

+  ifiEnum iVar12;

+  undefined1 auStackY_8b8 [32];

+  int local_888;

+  ulong local_884;

+  int local_880 [2];

+  ulong *local_878;

+  longlong local_870;

+  ushort *local_868;

+  ulong *local_858;

+  ulong local_850;

+  undefined4 local_84c;

+  ulong local_848 [512];

+  ulonglong local_48;

   

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

-  return unaff_EDI;

+  local_48 = __security_cookie ^ (ulonglong)auStackY_8b8;

+  local_888 = 2;

+  puVar11 = param_2;

+  local_878 = param_3;

+  local_868 = param_4;

+  do {

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

+      *param_2 = 0;

+      *local_878 = 0;

+    }

+    if (local_868 != (ushort *)0x0) {

+      *param_6 = 0;

+    }

+    if ((param_1 == (ushort *)0x0) || (BVar2 = FFileExists(param_1,puVar11,param_7), BVar2 == 0)) {

+      return 1;

+    }

+    if (param_7 != 0) {

+      StartImpersonating();

+    }

+    local_884 = 0;

+    puVar11 = &local_884;

+    iVar12 = 0;

+    puVar8 = param_1;

+    uVar3 = MsiGetFileVersionInfoSize(param_1,puVar11);

+    uVar7 = SUB81(puVar8,0);

+    if (uVar3 == 0) {

+      DVar4 = GetLastError();

+      if ((param_8) && (param_2 != (ulong *)0x0)) {

+        puVar8 = param_1;

+        puVar11 = param_2;

+        BVar2 = FGetTTFVersion(param_1,param_2,local_878);

+        uVar7 = SUB81(puVar8,0);

+        if (BVar2 != 0) {

+          if (param_6 != (int *)0x0) {

+            *param_6 = -1;

+          }

+          goto LAB_0;

+        }

+      }

+      if (DVar4 == 0x20) {

+        iVar12 = 3;

+      }

+      else {

+        uVar7 = 5;

+        iVar12 = 2;

+        if (DVar4 == 5) {

+          iVar12 = 5;

+        }

+      }

+    }

+    else {

+      local_848[0] = 0x74450101;

+      local_858 = local_848;

+      local_850 = 0x800;

+      local_848[1] = 0x6b7559;

+      bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_1834194232>::__private_IsEnabled

+                        ((FeatureImpl<__WilFeatureTraits_Feature_1834194232> *)

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

+                          ::__l2::impl);

+      if ((bVar1) && (0x7fffffff < uVar3)) {

+        iVar5 = local_850 + -0x800;

+        bVar1 = iVar5 == 0;

+LAB_1:

+        if (!bVar1 && SBORROW4(local_850,0x800) == iVar5 < 0) {

+          GlobalFree(local_858);

+        }

+        return 4;

+      }

+      if ((int)uVar3 < 0x801) {

+        puVar6 = local_848;

+      }

+      else {

+        puVar6 = GlobalAlloc(0x40,(longlong)(int)uVar3);

+        if (puVar6 == (ulong *)0x0) {

+          iVar5 = local_850 + -0x800;

+          bVar1 = local_850 == 0x800;

+          goto LAB_1;

+        }

+      }

+      if (local_858 != local_848) {

+        GlobalFree(local_858);

+      }

+      puVar11 = (ulong *)(ulonglong)local_884;

+      puVar9 = (ulong *)param_1;

+      local_858 = puVar6;

+      local_850 = uVar3;

+      iVar5 = (*(code *)VERSION::GetFileVersionInfoW)(param_1,puVar11,uVar3,puVar6);

+      uVar7 = SUB81(puVar9,0);

+      if (iVar5 == 0) {

+        DVar4 = GetLastError();

+        if (DVar4 == 0x20) {

+          iVar12 = 3;

+        }

+        else {

+          uVar7 = 5;

+          iVar12 = 5 - (DVar4 != 5);

+        }

+      }

+      else {

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

+          local_880[0] = 0;

+          puVar11 = (ulong *)&u__;

+          local_870 = 0;

+          puVar9 = local_858;

+          iVar5 = (*(code *)VERSION::VerQueryValueW)(local_858,&u__,&local_870,local_880);

+          if (iVar5 == 0) {

+            iVar12 = 4;

+          }

+          else if (local_880[0] == 0) {

+            iVar12 = 2;

+          }

+          else {

+            *param_2 = *(ulong *)(local_870 + 8);

+            *local_878 = *(ulong *)(local_870 + 0xc);

+            puVar9 = local_878;

+          }

+        }

+        uVar7 = SUB81(puVar9,0);

+        if ((local_868 != (ushort *)0x0) && (iVar12 == 0)) {

+          pCVar10 = (CAPITempBufferRef<unsigned_char> *)&local_858;

+          local_84c = 0x800;

+          puVar11 = (ulong *)param_1;

+          bVar1 = GetLangIDArrayFromActualFile(pCVar10,param_1,local_868,param_5,param_6);

+          uVar7 = SUB81(pCVar10,0);

+          if ((!bVar1) && (*param_6 = -1, param_2 == (ulong *)0x0)) {

+            iVar12 = 2;

+          }

+        }

+      }

+      if (0x800 < (int)local_850) {

+        puVar6 = local_858;

+        GlobalFree(local_858);

+        uVar7 = SUB81(puVar6,0);

+      }

+    }

+LAB_0:

+    if (param_7 != 0) {

+      StopImpersonating((bool)uVar7);

+    }

+    if (iVar12 != 4) {

+      return iVar12;

+    }

+    if (local_888 < 1) {

+      return 4;

+    }

+    local_888 = local_888 + -1;

+    Sleep(500);

+  } while( true );

 }
```

## `CustomExeThread`  (modified)

```diff
--- CustomExeThread
+++ CustomExeThread
@@ -1,128 +1,584 @@
 

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

+   guard_dispatch_icall */

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

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

+/* unsigned long __cdecl CustomExeThread(class CActionThreadData * __ptr64) */

 

 ulong __cdecl CustomExeThread(CActionThreadData *param_1)

 

 {

-  char *pcVar1;

-  BOOL BVar2;

-  uint extraout_EAX;

-  uint extraout_EAX_00;

-  int iVar3;

-  uint uVar4;

-  ulong uVar5;

-  char *in_RAX;

-  undefined8 *puVar7;

-  ulonglong extraout_RAX;

-  int unaff_EBX;

-  longlong unaff_RBP;

-  LPCWSTR unaff_RSI;

-  char unaff_DIL;

-  char in_R8B;

-  char unaff_R13B;

-  char unaff_R15B;

-  ulonglong uVar6;

+  wchar_t wVar1;

+  code *pcVar2;

+  undefined *puVar3;

+  uint dwCreationFlags;

+  longlong *plVar4;

+  bool bVar5;

+  int iVar6;

+  int iVar7;

+  long lVar8;

+  UINT UVar9;

+  DWORD DVar10;

+  int iVar11;

+  Bool BVar12;

+  BOOL BVar13;

+  ushort *puVar14;

+  CMsiEnvironmentBlock *pCVar15;

+  undefined8 uVar16;

+  wchar_t *pwVar17;

+  IMsiServices *pIVar18;

+  IMsiRecord *pIVar19;

+  CComPointer<class_IMsiEngine> *pCVar20;

+  IMsiSummaryInfo **ppIVar21;

+  IMsiEngine *pIVar22;

+  LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList;

+  void *pvVar23;

+  HANDLE pvVar24;

+  undefined1 uVar25;

+  uint uVar26;

+  IMsiString *pIVar27;

+  CActionThreadData *pCVar28;

+  int iVar29;

+  LPWSTR pWVar30;

+  LPWSTR pWVar31;

+  HWND pHVar32;

+  CMsiStringNullCopy *pCVar33;

+  __uint64 _Var34;

+  wchar_t *pwVar35;

+  char *pcVar36;

+  IMsiString *pIVar37;

+  LPPROC_THREAD_ATTRIBUTE_LIST p_Var38;

+  undefined1 auStackY_1d8 [32];

+  ulong in_stack_fffffffffffffe78;

+  void *in_stack_fffffffffffffe80;

+  BOOL local_178;

+  DWORD local_174;

+  char local_170;

+  char local_16f;

+  char local_16e;

+  uint local_16c;

+  IMsiString *local_168;

+  IMsiString *local_160;

+  undefined1 local_158 [4];

+  short local_154;

+  IMsiString *local_150;

+  undefined2 local_148 [2];

+  DWORD local_144;

+  longlong *local_140;

+  LPPROC_THREAD_ATTRIBUTE_LIST local_138;

+  LPVOID local_130;

+  LPVOID local_128;

+  LPCWSTR local_120;

+  _PROCESS_INFORMATION local_118;

+  CMsiStringNullCopy *local_100;

+  IMsiServices *local_f8;

+  _STARTUPINFOW local_e8;

+  LPPROC_THREAD_ATTRIBUTE_LIST local_80;

+  MSG local_78;

+  LPWSTR local_48;

+  int local_40;

+  ulonglong local_30;

   

-  *in_RAX = *in_RAX + in_R8B;

-  DAT_0 = in_RAX;

-  if ((unaff_DIL != '\0') && (unaff_EBX != 0)) {

-    Wow64RevertWow64FsRedirection(*(PVOID *)(unaff_RBP + 0x30));

-  }

-  BVar2 = SetThreadToken((PHANDLE)(unaff_RBP + -0x38),*(HANDLE *)(unaff_RBP + -0x40));

-  if (BVar2 == 0) {

-    CloseHandle(DAT_0);

-    DAT_0 = (char *)0x0;

-    CHandle::~CHandle((CHandle *)(unaff_RBP + -0x40));

-    uVar4 = extraout_EAX;

-    goto LAB_1;

-  }

-  CHandle::~CHandle((CHandle *)(unaff_RBP + -0x40));

-  if (DAT_0 == (char *)0xffffffffffffffff) {

-    DAT_0 = (char *)0x0;

-    uVar4 = extraout_EAX_00;

-    goto LAB_1;

-  }

-  if ((unaff_R15B == '\0') || (iVar3 = lstrcmpiW(unaff_RSI,L"NUL"), iVar3 == 0)) {

+  local_30 = __security_cookie ^ (ulonglong)auStackY_1d8;

+  local_118.dwProcessId = 0;

+  local_118.dwThreadId = 0;

+  local_118.hProcess = (HANDLE)0x0;

+  local_118.hThread = (HANDLE)0x0;

+  memset(&local_e8.field_0x4,0,0x6c);

+  lpAttributeList = (LPPROC_THREAD_ATTRIBUTE_LIST)0x0;

+  iVar11 = 0;

+  local_e8.cb = 0x70;

+  local_148[0] = 0x8664;

+  p_Var38 = (LPPROC_THREAD_ATTRIBUTE_LIST)0x0;

+  local_174 = 0;

+  local_130 = (LPVOID)0x0;

+  local_128 = (LPVOID)0x0;

+  local_144 = 0;

+  local_178 = 0;

+  local_16e = '\0';

+  local_120 = (LPCWSTR)0x0;

+  local_138 = (LPPROC_THREAD_ATTRIBUTE_LIST)0x0;

+  iVar6 = (**(code **)(**(longlong **)(param_1 + 0x48) + 0x38))();

+  iVar7 = (**(code **)(**(longlong **)(param_1 + 0x40) + 0x38))();

+  iVar29 = iVar6;

+  if (((byte)*(undefined4 *)(param_1 + 8) & 0x30) != 0x20) {

+    iVar29 = iVar6 + 3 + iVar7;

+  }

+  CTempBuffer<unsigned_short,1>::CTempBuffer<unsigned_short,1>

+            ((CTempBuffer<unsigned_short,1> *)&local_48,iVar29 + 1);

+  pWVar31 = local_48;

+  _Var34 = (__uint64)local_40;

+  if (local_48 == (LPWSTR)0x0) goto LAB_0;

+  if (((byte)*(undefined4 *)(param_1 + 8) & 0x30) != 0x20) {

+    *local_48 = L'\"';

+    pWVar30 = local_48 + 1;

+    puVar14 = (ushort *)(**(code **)(**(longlong **)(param_1 + 0x40) + 0x50))();

+    lVar8 = StringCchCopyW((ushort *)pWVar30,_Var34 - 1,puVar14);

+    if (-1 < lVar8) {

+      pWVar30 = pWVar30 + iVar7;

+      *pWVar30 = L'\"';

+      pWVar31 = pWVar30 + 1;

+      _Var34 = _Var34 - (longlong)(iVar7 + 2);

+      if (iVar6 != 0) {

+        *pWVar31 = L' ';

+        pWVar31 = pWVar30 + 2;

+        _Var34 = _Var34 - 1;

+      }

+      goto LAB_1;

+    }

 LAB_2:

-    pcVar1 = DAT_0;

-    *(undefined2 *)(unaff_RBP + 0x30) = 0xfeff;

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

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

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

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

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

-    BVar2 = WriteFile(pcVar1,(LPCVOID)(unaff_RBP + 0x30),2,(LPDWORD)(unaff_RBP + -0x40),

-                      (LPOVERLAPPED)(unaff_RBP + -0x30));

-    if (BVar2 != 0) goto LAB_3;

-    uVar4 = GetLastError();

-    if (uVar4 == 0x3e5) {

-      while (*(int *)(unaff_RBP + -0x30) == 0x103) {

-        WaitForSingleObject(DAT_0,0xffffffff);

+    lpAttributeList = p_Var38;

+    iVar11 = 0;

+    goto LAB_0;

+  }

+  local_120 = (LPCWSTR)(**(code **)(**(longlong **)(param_1 + 0x40) + 0x50))();

+LAB_1:

+  puVar14 = (ushort *)(**(code **)(**(longlong **)(param_1 + 0x48) + 0x50))();

+  lVar8 = StringCchCopyW((ushort *)pWVar31,_Var34,puVar14);

+  if (lVar8 < 0) {

+    if (g_dmDiagnosticMode == 0) goto LAB_0;

+    pcVar36 = "ERROR: StringCchCopy failure in CustomExeThread";

+  }

+  else {

+    if (g_scServerContext == 2) {

+      local_16e = StartImpersonating();

+    }

+    if ((*(uint *)(param_1 + 8) & 0x10000) != 0) {

+      DebugBreak();

+    }

+    if (DAT_3 == (CMsiEnvironmentBlock *)0x0) {

+      bVar5 = CMsiEnvironmentBlock::InitializeFromProcessEnvironment

+                        ((CMsiEnvironmentBlock *)&local_130);

+      if (bVar5) goto LAB_4;

+      if (g_dmDiagnosticMode == 0) goto LAB_0;

+      pcVar36 = 

+      "ERROR: Failed to initialize impersonate custom action environment block from process environment"

+      ;

+    }

+    else {

+      bVar5 = CMsiEnvironmentBlock::InitializeFromSource

+                        ((CMsiEnvironmentBlock *)&local_130,DAT_3);

+      if (bVar5) {

+LAB_4:

+        pCVar15 = MsiUIMessageContext::GetSystemEnvironment(&g_MessageContext);

+        if (pCVar15 == (CMsiEnvironmentBlock *)0x0) {

+          bVar5 = CMsiEnvironmentBlock::InitializeFromProcessEnvironment

+                            ((CMsiEnvironmentBlock *)&local_128);

+          if (!bVar5) {

+            if (g_dmDiagnosticMode == 0) goto LAB_0;

+            pcVar36 = 

+            "ERROR: Failed to initialize system custom action environment block from process environment"

+            ;

+            goto LAB_5;

+          }

+        }

+        else {

+          bVar5 = CMsiEnvironmentBlock::InitializeFromSource

+                            ((CMsiEnvironmentBlock *)&local_128,pCVar15);

+          if (!bVar5) {

+            if (g_dmDiagnosticMode == 0) goto LAB_0;

+            pcVar36 = 

+            "ERROR: Failed to initialize system custom action environment block from session environment"

+            ;

+            goto LAB_5;

+          }

+        }

+        if (param_1[0x88] != (CActionThreadData)0x0) {

+          CTempBuffer<unsigned_short,1>::CTempBuffer<unsigned_short,1>

+                    ((CTempBuffer<unsigned_short,1> *)&local_78,0x20b);

+          pHVar32 = local_78.hwnd;

+          if (local_78.hwnd == (HWND)0x0) {

+            CTempBuffer<unsigned_short,1>::~CTempBuffer<unsigned_short,1>

+                      ((CTempBuffer<unsigned_short,1> *)&local_78);

+            goto LAB_0;

+          }

+          local_16c = local_78.message;

+          *(wchar_t *)&(local_78.hwnd)->unused = L'\0';

+          puVar3 = APPHELP::ApphelpFixMsiPackageExe;

+          uVar16 = (**(code **)(**(longlong **)param_1 + 0x50))();

+          iVar29 = (*(code *)puVar3)(param_1 + 0x8c,param_1 + 0x9c,uVar16,pHVar32);

+          if (iVar29 == 0) {

+LAB_6:

+            *(wchar_t *)&(local_78.hwnd)->unused = L'\0';

+          }

+          else if (local_78.message < local_16c) {

+            CTempBuffer<unsigned_short,1>::SetSize

+                      ((CTempBuffer<unsigned_short,1> *)&local_78,local_16c);

+            pHVar32 = local_78.hwnd;

+            if (local_78.hwnd == (HWND)0x0) {

+              CTempBuffer<unsigned_short,1>::~CTempBuffer<unsigned_short,1>

+                        ((CTempBuffer<unsigned_short,1> *)&local_78);

+              goto LAB_2;

+            }

+            local_16c = local_78.message;

+            *(wchar_t *)&(local_78.hwnd)->unused = L'\0';

+            puVar3 = APPHELP::ApphelpFixMsiPackageExe;

+            uVar16 = (**(code **)(**(longlong **)param_1 + 0x50))();

+            iVar29 = (*(code *)puVar3)(param_1 + 0x8c,param_1 + 0x9c,uVar16,pHVar32);

+            if ((iVar29 == 0) || (local_78.message < local_16c)) goto LAB_6;

+          }

+          iVar29 = lstrlenW((LPCWSTR)local_78.hwnd);

+          pHVar32 = local_78.hwnd;

+          if (iVar29 != 0) {

+            while (((wchar_t)pHVar32->unused != L'\0' &&

+                   (pwVar17 = wcschr((wchar_t *)pHVar32,L'='), pwVar17 != (wchar_t *)0x0))) {

+              pwVar35 = pwVar17 + 1;

+              *pwVar17 = L'\0';

+              bVar5 = CMsiEnvironmentBlock::Set

+                                ((CMsiEnvironmentBlock *)&local_130,(ushort *)pHVar32,

+                                 (ushort *)pwVar35);

+              if (!bVar5) {

+                if (g_dmDiagnosticMode != 0) {

+                  puVar14 = (ushort *)(**(code **)(**(longlong **)param_1 + 0x50))();

+                  pwVar17 = 

+                  L"ERROR: Failed to apply app compat flags to impersonate environment for custom action %s."

+                  ;

+LAB_7:

+                  DebugString(10,0,0,(ushort *)pwVar17,puVar14,(ushort *)L"(NULL)",

+                              (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                              (ushort *)L"(NULL)",0,(void *)0x0);

+                }

+LAB_8:

+                CTempBuffer<unsigned_short,1>::~CTempBuffer<unsigned_short,1>

+                          ((CTempBuffer<unsigned_short,1> *)&local_78);

+                lpAttributeList = p_Var38;

+                iVar11 = 0;

+                goto LAB_0;

+              }

+              bVar5 = CMsiEnvironmentBlock::Set

+                                ((CMsiEnvironmentBlock *)&local_128,(ushort *)pHVar32,

+                                 (ushort *)pwVar35);

+              if (!bVar5) {

+                if (g_dmDiagnosticMode != 0) {

+                  puVar14 = (ushort *)(**(code **)(**(longlong **)param_1 + 0x50))();

+                  pwVar17 = 

+                  L"ERROR: Failed to apply app compat flags to system environment for custom action %s."

+                  ;

+                  goto LAB_7;

+                }

+                goto LAB_8;

+              }

+              wVar1 = *pwVar35;

+              while (wVar1 != L'\0') {

+                pwVar35 = pwVar35 + 1;

+                wVar1 = *pwVar35;

+              }

+              pHVar32 = (HWND)(pwVar35 + 1);

+            }

+          }

+          CTempBuffer<unsigned_short,1>::~CTempBuffer<unsigned_short,1>

+                    ((CTempBuffer<unsigned_short,1> *)&local_78);

+        }

+        uVar26 = *(uint *)(param_1 + 8);

+        local_e8.lpDesktop = L"WinSta0\\Default";

+        local_158[0] = 0;

+        local_170 = '\0';

+        local_154 = -1;

+        local_16c = (uVar26 & 0x80) << 0x11 | 0x80420;

+        local_16f = '\x01';

+        if (g_wArchitecture == 0xc) {

+          local_140 = (longlong *)0x0;

+          local_160 = (IMsiString *)0x0;

+          local_150 = (IMsiString *)&MsiString::s_NullString;

+          local_168 = (IMsiString *)&MsiString::s_NullString;

+          local_100 = &MsiString::s_NullString;

+          pIVar18 = LoadServices();

+          pIVar27 = (IMsiString *)&MsiString::s_NullString;

+          pCVar33 = &MsiString::s_NullString;

+          local_f8 = pIVar18;

+          if (pIVar18 == (IMsiServices *)0x0) {

+            if (g_dmDiagnosticMode != 0) {

+              DebugString(9,0,0,(ushort *)L"Failed to Load Services",(ushort *)L"(NULL)",

+                          (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                          (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+            }

+            local_174 = 0x641;

+            pIVar37 = (IMsiString *)&MsiString::s_NullString;

+          }

+          else {

+            (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

+            local_174 = ExtractExeFromCommandLine((ushort *)local_48,&local_150);

+            pIVar37 = local_150;

+            lpAttributeList = p_Var38;

+            if (local_174 == 0) {

+              (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

+              (**(code **)(_s_NullString + 0x10))(&MsiString::s_NullString);

+              pIVar37 = local_150;

+              puVar14 = (ushort *)(**(code **)(*(longlong *)local_150 + 0x50))(local_150);

+              pIVar19 = SplitPath(puVar14,&local_168,(IMsiString **)&local_100);

+              pCVar20 = CComPointer<IMsiEngine>::operator=

+                                  ((CComPointer<IMsiEngine> *)&local_160,(IMsiEngine *)pIVar19);

+              pIVar27 = local_168;

+              pCVar33 = local_100;

+              if (*(longlong *)pCVar20 == 0) {

+                iVar29 = (**(code **)(*(longlong *)local_168 + 200))(local_168,0,L"");

+                pCVar33 = local_100;

+                if (iVar29 != 0) {

+                  (**(code **)(*(longlong *)pIVar27 + 0x10))(pIVar27);

+                  local_168 = (IMsiString *)&MsiString::s_NullString;

+                  puVar14 = (ushort *)(**(code **)(*(longlong *)pCVar33 + 0x50))(pCVar33);

+                  local_174 = SearchForExePath(puVar14,&local_168);

+                  pIVar27 = local_168;

+                  if (local_174 != 0) goto LAB_9;

+                }

+                pcVar2 = *(code **)(*(longlong *)pIVar18 + 0x78);

+                ppIVar21 = CComPointer<IMsiSummaryInfo>::operator&

+                                     ((CComPointer<IMsiSummaryInfo> *)&local_140);

+                uVar16 = (**(code **)(*(longlong *)pIVar27 + 0x50))(pIVar27);

+                pIVar18 = local_f8;

+                pIVar22 = (IMsiEngine *)(*pcVar2)(local_f8,uVar16,ppIVar21);

+                pCVar20 = CComPointer<IMsiEngine>::operator=

+                                    ((CComPointer<IMsiEngine> *)&local_160,pIVar22);

+                plVar4 = local_140;

+                lpAttributeList = local_138;

+                if (*(longlong *)pCVar20 == 0) {

+                  pcVar2 = *(code **)(*local_140 + 0x1c8);

+                  uVar16 = (**(code **)(*(longlong *)pCVar33 + 0x50))(pCVar33);

+                  pIVar22 = (IMsiEngine *)(*pcVar2)(plVar4,uVar16,&local_16f,local_158);

+                  CComPointer<IMsiEngine>::operator=((CComPointer<IMsiEngine> *)&local_160,pIVar22);

+                  pIVar18 = local_f8;

+                  lpAttributeList = local_138;

+                }

+              }

+            }

+          }

+LAB_9:

+          if ((local_160 != (IMsiString *)0x0) || (local_174 != 0)) {

+            local_174 = 2;

+          }

+          if (pIVar18 != (IMsiServices *)0x0) {

+            FreeServices();

+          }

+          (**(code **)(*(longlong *)pCVar33 + 0x10))(pCVar33);

+          (**(code **)(*(longlong *)pIVar27 + 0x10))(pIVar27);

+          (**(code **)(*(longlong *)pIVar37 + 0x10))(pIVar37);

+          CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                    ((CComPointer<IXMLDOMElement> *)&local_160);

+          CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                    ((CComPointer<IXMLDOMElement> *)&local_140);

+          uVar26 = *(uint *)(param_1 + 8);

+        }

+        dwCreationFlags = local_16c;

+        iVar11 = local_178;

+        if (local_16f == '\0') {

+          local_174 = 0xd8;

+          goto LAB_0;

+        }

+        if (((((local_174 == 0) && (g_wArchitecture == 0xc)) && (local_154 == 0xc)) &&

+            ((local_170 != '\0' && (g_w64BitCustomActionPlatform != 0xc)))) &&

+           ((g_w64BitCustomActionPlatform != 0xffff || (g_wPackagePlatform != 0xc)))) {

+          local_140 = (longlong *)0x0;

+          InitializeProcThreadAttributeList

+                    ((LPPROC_THREAD_ATTRIBUTE_LIST)0x0,1,0,(PSIZE_T)&local_140);

+          lpAttributeList = operator_new((__uint64)local_140);

+          if (lpAttributeList == (LPPROC_THREAD_ATTRIBUTE_LIST)0x0) goto LAB_0;

+          BVar13 = InitializeProcThreadAttributeList(lpAttributeList,1,0,(PSIZE_T)&local_140);

+          if (BVar13 == 0) {

+            operator_delete(lpAttributeList);

+            lpAttributeList = (LPPROC_THREAD_ATTRIBUTE_LIST)0x0;

+            goto LAB_0;

+          }

+          BVar13 = UpdateProcThreadAttribute

+                             (lpAttributeList,0,0x20019,local_148,2,(PVOID)0x0,(PSIZE_T)0x0);

+          if (BVar13 == 0) goto LAB_0;

+          uVar26 = *(uint *)(param_1 + 8);

+          local_80 = lpAttributeList;

+        }

+        if (g_scServerContext == 2) {

+          bVar5 = false;

+          if ((param_1[0x7d] == (CActionThreadData)0x0) || ((uVar26 & 0xc00) != 0xc00)) {

+            if ((uVar26 >> 0x13 & 1) == 0) {

+              pvVar24 = MsiUIMessageContext::GetUserToken(&g_MessageContext);

+            }

+            else {

+              pvVar24 = GetAISToken();

+            }

+            local_168 = (IMsiString *)0xffffffffffffffff;

+            if (pvVar24 != (HANDLE)0x0) {

+              DuplicateTokenEx(pvVar24,0,(LPSECURITY_ATTRIBUTES)0x0,SecurityAnonymous,TokenPrimary,

+                               &local_168);

+              pIVar27 = local_168;

+              local_168 = (IMsiString *)0xffffffffffffffff;

+              if (pIVar27 != (IMsiString *)0xffffffffffffffff) {

+                iVar29 = (*(code *)ADVAPI32::SaferComputeTokenFromLevel)

+                                   (DAT_10,pIVar27,&local_168,4);

+                if (iVar29 == 0) {

+                  if (g_dmDiagnosticMode != 0) {

+                    DVar10 = GetLastError();

+                    DebugString(9,0,0,(ushort *)

+                                      L"SaferComputeTokenFromLevel failed with last error = %d",

+                                (ushort *)(ulonglong)DVar10,(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                                (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",0,

+                                (void *)0x0);

+                  }

+                  local_168 = (IMsiString *)0xffffffffffffffff;

+                }

+                CloseHandle(pIVar27);

+                if (local_168 != (IMsiString *)0xffffffffffffffff) {

+                  UVar9 = SetErrorMode(3);

+                  iVar11 = CreateProcessAsUserW

+                                     (local_168,(LPCWSTR)0x0,local_48,(LPSECURITY_ATTRIBUTES)0x0,

+                                      (LPSECURITY_ATTRIBUTES)0x0,0,dwCreationFlags,local_130,

+                                      local_120,&local_e8,&local_118);

+                  SetErrorMode(UVar9);

+                  CloseHandle(local_168);

+                }

+              }

+            }

+            goto LAB_0;

+          }

+          pvVar23 = MsiUIMessageContext::GetUserToken(&g_MessageContext);

+          local_160 = (IMsiString *)0x0;

+          local_150 = (IMsiString *)0x0;

+          CElevate::CElevate((CElevate *)&local_138,true);

+          pvVar24 = GetCurrentProcess();

+          BVar13 = OpenProcessToken(pvVar24,0xf01ff,&local_150);

+          if ((((BVar13 != 0) && (local_150 != (IMsiString *)0x0)) &&

+              (BVar13 = DuplicateTokenEx(local_150,0x2000000,(LPSECURITY_ATTRIBUTES)0x0,

+                                         SecurityAnonymous,TokenPrimary,&local_160), BVar13 != 0))

+             && (local_160 != (IMsiString *)0x0)) {

+            local_16c = 0;

+            local_168 = (IMsiString *)((ulonglong)local_168 & 0xffffffff00000000);

+            BVar13 = GetTokenInformation(pvVar23,TokenSessionId,&local_16c,4,(PDWORD)&local_168);

+            if ((BVar13 != 0) &&

+               (BVar13 = SetTokenInformation(local_160,TokenSessionId,&local_16c,4), BVar13 != 0)) {

+              bVar5 = true;

+            }

+          }

+          CElevate::~CElevate((CElevate *)&local_138);

+          if (bVar5) {

+            UVar9 = SetErrorMode(3);

+            local_178 = CreateProcessAsUserW

+                                  (local_160,(LPCWSTR)0x0,local_48,(LPSECURITY_ATTRIBUTES)0x0,

+                                   (LPSECURITY_ATTRIBUTES)0x0,0,dwCreationFlags | 4,local_128,

+                                   local_120,&local_e8,&local_118);

+            SetErrorMode(UVar9);

+          }

+          if (local_160 != (IMsiString *)0x0) {

+            CloseHandle(local_160);

+          }

+          pIVar27 = local_150;

+          if (local_150 != (IMsiString *)0x0) goto LAB_11;

+        }

+        else {

+          local_160 = (IMsiString *)0xffffffffffffffff;

+          iVar29 = (*(code *)ADVAPI32::SaferComputeTokenFromLevel)(DAT_10,0,&local_160,4);

+          if (iVar29 == 0) {

+            if (g_dmDiagnosticMode != 0) {

+              DVar10 = GetLastError();

+              DebugString(9,0,0,(ushort *)L"SaferComputeTokenFromLevel failed with last error = %d",

+                          (ushort *)(ulonglong)DVar10,(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                          (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0)

+              ;

+            }

+            local_160 = (IMsiString *)0xffffffffffffffff;

+          }

+          if (local_160 == (IMsiString *)0xffffffffffffffff) goto LAB_0;

+          local_150 = (IMsiString *)0xffffffffffffffff;

+          BVar13 = DuplicateTokenEx(local_160,0,(LPSECURITY_ATTRIBUTES)0x0,SecurityAnonymous,

+                                    TokenPrimary,&local_150);

+          pIVar27 = local_160;

+          if (BVar13 != 0) {

+            UVar9 = SetErrorMode(3);

+            local_178 = CreateProcessAsUserW

+                                  (local_150,(LPCWSTR)0x0,local_48,(LPSECURITY_ATTRIBUTES)0x0,

+                                   (LPSECURITY_ATTRIBUTES)0x0,0,dwCreationFlags | 4,local_130,

+                                   local_120,&local_e8,&local_118);

+            SetErrorMode(UVar9);

+            CloseHandle(local_150);

+            pIVar27 = local_160;

+          }

+LAB_11:

+          CloseHandle(pIVar27);

+        }

+        iVar11 = local_178;

+        if (local_178 == 0) goto LAB_0;

+        CElevate::CElevate((CElevate *)&local_138,true);

+        if ((*(uint *)(param_1 + 8) & 0x40000) == 0) {

+LAB_12:

+          ResumeThread(local_118.hThread);

+        }

+        else {

+          pvVar23 = MsiUIMessageContext::GetUserToken(&g_MessageContext);

+          BVar13 = SetThreadToken(&local_118.hThread,pvVar23);

+          if ((BVar13 != 0) || (BVar12 = IsTerminalServerInstalled(), BVar12 != 0))

+          goto LAB_12;

+          TerminateProcess(local_118.hProcess,0xffffffff);

+          (**(code **)(**(longlong **)(param_1 + 0x48) + 0x10))();

+          (**(code **)(**(longlong **)(param_1 + 0x40) + 0x10))();

+        }

+        CElevate::~CElevate((CElevate *)&local_138);

+        goto LAB_0;

       }

-      BVar2 = GetOverlappedResult(DAT_0,(LPOVERLAPPED)(unaff_RBP + -0x30),

-                                  (LPDWORD)(unaff_RBP + -0x40),0);

-      uVar4 = 0;

-      if (BVar2 != 0) goto LAB_3;

-    }

+      if (g_dmDiagnosticMode == 0) goto LAB_0;

+      pcVar36 = 

+      "ERROR: Failed to initialize impersonate custom action environment block from session environment"

+      ;

+    }

+  }

+LAB_5:

+  DebugString(9,0,0,pcVar36,"(NULL)","(NULL)","(NULL)","(NULL)","(NULL)","(NULL)",

+              in_stack_fffffffffffffe78,in_stack_fffffffffffffe80);

+LAB_0:

+  (**(code **)(**(longlong **)(param_1 + 0x48) + 0x10))();

+  (**(code **)(**(longlong **)(param_1 + 0x40) + 0x10))();

+  if (iVar11 == 0) {

+    local_174 = 0x65f;

   }

   else {

-    uVar4 = SetFilePointer(DAT_0,0,(PLONG)0x0,2);

-    if (uVar4 == 0xffffffff) goto LAB_4;

-    if (uVar4 == 0) goto LAB_2;

-LAB_3:

-    uVar5 = CreatePerUserFileLockMutex((ushort *)unaff_RSI,DAT_0,&DAT_180311680);

-    uVar6 = (ulonglong)uVar5;

-    if (uVar5 == 0) {

-      _DAT_5 = 0;

-    }

-    else {

-      _DAT_5 = 0x100000003;

-    }

-    if ((g_fFlushEachLine != false) || (unaff_R13B != '\0')) {

-LAB_6:

-      return (ulong)CONCAT71((int7)(uVar6 >> 8),1);

-    }

-    puVar7 = GlobalAlloc(0x40,0x70);

-    pcVar1 = DAT_0;

-    uVar4 = 0;

-    DAT_7 = puVar7;

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

-      uVar4 = (uint)DAT_8;

-      *puVar7 = 0;

-      *(undefined4 *)(puVar7 + 1) = 0;

-      *(undefined4 *)(puVar7 + 3) = 1;

-      puVar7[2] = puVar7 + 4;

-      puVar7[5] = 0;

-      *(undefined4 *)(puVar7 + 6) = 0;

-      puVar7[7] = puVar7 + 9;

-      *(undefined4 *)(puVar7 + 8) = 1;

-      puVar7[10] = pcVar1;

-      *(uint *)(puVar7 + 0xd) = uVar4;

-      *(undefined4 *)(puVar7 + 0xb) = 0;

-      *(undefined1 *)(puVar7 + 0xc) = 0;

-      *(undefined4 *)((longlong)puVar7 + 100) = 0;

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

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

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

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

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

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

-      GetSystemInfo((LPSYSTEM_INFO)(unaff_RBP + -0x30));

-      *(undefined4 *)((longlong)puVar7 + 0x5c) = *(undefined4 *)(unaff_RBP + -0x2c);

-      uVar6 = extraout_RAX;

-      goto LAB_6;

-    }

-  }

-LAB_4:

-  if (DAT_0 != (char *)0x0) {

-    uVar4 = CloseHandle(DAT_0);

-    DAT_0 = (char *)0x0;

-  }

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

-    uVar4 = CloseHandle(DAT_9);

-    DAT_9 = (HANDLE)0x0;

-  }

-LAB_1:

-  return uVar4 & 0xffffff00;

+    CloseHandle(local_118.hThread);

+    if ((((byte)param_1[8] & 0x80) == 0) ||

+       (((byte)param_1[8] & 0x40) == 0 && (*(uint *)(param_1 + 8) & 0x500) != 0x500)) {

+      while (local_144 = MsgWaitForMultipleObjects(1,&local_118.hProcess,0,0xffffffff,0x1cff),

+            local_144 == 1) {

+        local_78.hwnd = (HWND)0x0;

+        local_78.message = 0;

+        local_78._12_4_ = 0;

+        local_78.wParam = 0;

+        local_78.lParam = 0;

+        local_78.time = 0;

+        local_78.pt.x = 0;

+        local_78.pt.y = 0;

+        local_78._44_4_ = 0;

+        local_144 = 1;

+        while (BVar13 = PeekMessageW(&local_78,(HWND)0x0,0,0,1), BVar13 != 0) {

+          TranslateMessage(&local_78);

+          DispatchMessageW(&local_78);

+        }

+      }

+      GetExitCodeProcess(local_118.hProcess,&local_174);

+      ThreadLogActionReturn(param_1,local_174);

+      if (((byte)param_1[8] & 0x40) != 0) {

+        local_174 = 0;

+      }

+    }

+    CloseHandle(local_118.hProcess);

+    if ((local_144 == 0xffffffff) || (((*(uint *)(param_1 + 8) & 0x20000) == 0 && (local_174 != 0)))

+       ) {

+      local_174 = 0x643;

+    }

+  }

+  pCVar28 = param_1;

+  DVar10 = local_174;

+  ThreadLogActionEnd(param_1,local_174);

+  uVar25 = SUB81(pCVar28,0);

+  if (lpAttributeList != (LPPROC_THREAD_ATTRIBUTE_LIST)0x0) {

+    DeleteProcThreadAttributeList(lpAttributeList);

+    operator_delete(lpAttributeList);

+    uVar25 = SUB81(lpAttributeList,0);

+  }

+  if (((byte)param_1[8] & 0x80) == 0) {

+    CActionThreadData::_scalar_deleting_destructor_(param_1,DVar10);

+    uVar25 = SUB81(param_1,0);

+  }

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

+    StopImpersonating((bool)uVar25);

+  }

+  DVar10 = local_174;

+  CTempBuffer<unsigned_short,1>::~CTempBuffer<unsigned_short,1>

+            ((CTempBuffer<unsigned_short,1> *)&local_48);

+  CMsiEnvironmentBlock::~CMsiEnvironmentBlock((CMsiEnvironmentBlock *)&local_128);

+  CMsiEnvironmentBlock::~CMsiEnvironmentBlock((CMsiEnvironmentBlock *)&local_130);

+  return DVar10;

 }
```

## `CMsiTable::SaveToStorage`  (modified)

```diff
--- CMsiTable::SaveToStorage
+++ CMsiTable::SaveToStorage
@@ -1,2 +1,231 @@
-Failed to decompile msi.dll - .ProgramDB CMsiTable::SaveToStorage : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+   guard_dispatch_icall */

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

+/* public: enum Bool __cdecl CMsiTable::SaveToStorage(class IMsiString const & __ptr64,class

+   IMsiStorage & __ptr64) __ptr64 */

+

+Bool __thiscall CMsiTable::SaveToStorage(CMsiTable *this,IMsiString *param_1,IMsiStorage *param_2)

+

+{

+  uint uVar1;

+  uint *puVar2;

+  code *pcVar3;

+  ushort uVar4;

+  bool bVar5;

+  Bool BVar6;

+  undefined8 uVar7;

+  IMsiSummaryInfo **ppIVar8;

+  longlong *plVar9;

+  IMsiString *pIVar10;

+  longlong lVar11;

+  IMsiStorage *pIVar12;

+  IMsiData *pIVar13;

+  int iVar14;

+  undefined4 uVar15;

+  CMsiTable *pCVar16;

+  int iVar17;

+  Bool BVar18;

+  int iVar19;

+  undefined1 auStack_2d8 [48];

+  int local_2a8;

+  Bool local_2a4;

+  longlong *local_2a0;

+  longlong local_298;

+  CMsiTable *local_290;

+  longlong *local_288;

+  longlong *local_280;

+  undefined4 local_278;

+  IMsiStorage *local_270;

+  IMsiString *local_268;

+  IMsiStorage *local_260;

+  CMsiTable *local_258;

+  undefined1 local_248 [512];

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStack_2d8;

+  lVar11 = *(longlong *)param_2;

+  BVar6 = 0;

+  local_270 = param_2;

+  local_268 = param_1;

+  local_258 = this;

+  if (*(int *)(this + 0x5c) == 0) {

+    uVar7 = (**(code **)(*(longlong *)param_1 + 0x50))(param_1);

+    local_268 = (IMsiString *)(**(code **)(lVar11 + 0x58))(param_2,uVar7,2);

+    CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+              ((CComPointer<IXMLDOMElement> *)&local_268);

+    BVar6 = 1;

+  }

+  else {

+    local_288 = (longlong *)0x0;

+    local_2a4 = 1;

+    ppIVar8 = CComPointer<IMsiSummaryInfo>::operator&((CComPointer<IMsiSummaryInfo> *)&local_288);

+    uVar7 = (**(code **)(*(longlong *)local_268 + 0x50))();

+    plVar9 = (longlong *)(**(code **)(lVar11 + 0x38))(param_2,uVar7,3,ppIVar8);

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

+      local_290 = this + 0xfa;

+      local_2a8 = 1;

+      local_278 = *(undefined4 *)(*(longlong *)(this + 0x10) + 0xe0);

+      BVar18 = 1;

+      if (0 < *(int *)(this + 0x44)) {

+        local_298 = 4;

+        pCVar16 = local_290;

+        do {

+          iVar17 = *(int *)(this + 0x5c);

+          puVar2 = *(uint **)(this + 0x28);

+          if ((*(ushort *)local_290 & 0x800) == 0) {

+            if ((*(ushort *)local_290 & 0x400) == 0) {

+              for (; (iVar17 != 0 && (iVar17 = iVar17 + -1, (*puVar2 & 0x2000000) == 0));

+                  puVar2 = puVar2 + *(int *)(this + 0x3c)) {

+                (**(code **)(*local_288 + 0x68))

+                          (local_288,*(undefined4 *)(local_298 + (longlong)puVar2));

+              }

+            }

+            else {

+              for (; (iVar17 != 0 && (iVar17 = iVar17 + -1, (*puVar2 & 0x2000000) == 0));

+                  puVar2 = puVar2 + *(int *)(this + 0x3c)) {

+                uVar4 = *(ushort *)(local_298 + (longlong)puVar2) ^ 0x8000;

+                if (*(int *)(local_298 + (longlong)puVar2) == 0) {

+                  uVar4 = *(ushort *)(local_298 + (longlong)puVar2);

+                }

+                (**(code **)(*local_288 + 0x60))(local_288,uVar4);

+              }

+            }

+          }

+          else if ((*(ushort *)local_290 & 0x400) == 0) {

+            for (; (iVar17 != 0 && (iVar17 = iVar17 + -1, (*puVar2 & 0x2000000) == 0));

+                puVar2 = puVar2 + *(int *)(this + 0x3c)) {

+              uVar1 = *(uint *)(local_298 + (longlong)puVar2);

+              uVar15 = 0;

+              if (uVar1 == 0) {

+LAB_0:

+                (**(code **)(*local_288 + 0x60))(local_288,uVar15);

+              }

+              else {

+                pIVar10 = CMsiDatabase::ComputeStreamName

+                                    (*(CMsiDatabase **)(this + 0x10),local_268,puVar2 + 1,

+                                     (ushort *)pCVar16);

+                local_2a0 = (longlong *)0x0;

+                if (uVar1 == 1) {

+                  local_260 = *(IMsiStorage **)(this + 0x48);

+                  if (local_260 == local_270) {

+                    (**(code **)(*local_288 + 0x60))(local_288,1);

+                  }

+                  else {

+                    pcVar3 = *(code **)(*(longlong *)local_260 + 0x38);

+                    uVar7 = (**(code **)(*(longlong *)pIVar10 + 0x50))(pIVar10);

+                    plVar9 = (longlong *)(*pcVar3)(local_260,uVar7,0,&local_2a0);

+                    if (plVar9 == (longlong *)0x0) goto LAB_1;

+LAB_2:

+                    lVar11 = *plVar9;

+LAB_3:

+                    (**(code **)(lVar11 + 0x10))(plVar9);

+LAB_4:

+                    local_2a4 = 0;

+                  }

+                  (**(code **)(*(longlong *)pIVar10 + 0x10))(pIVar10);

+                }

+                else {

+                  if (0xff < uVar1) {

+                    pIVar13 = GetObjectDataProc(uVar1);

+                    iVar19 = (*(code *)**(undefined8 **)pIVar13)(pIVar13,&IID_IMsiStream,&local_2a0)

+                    ;

+                    if (iVar19 == 0) {

+                      (**(code **)(*(longlong *)pIVar13 + 0x10))(pIVar13);

+                      (**(code **)(*local_2a0 + 0x70))();

+                      goto LAB_1;

+                    }

+                    goto LAB_4;

+                  }

+                  pIVar12 = CMsiDatabase::GetTransformStorage(*(CMsiDatabase **)(this + 0x10),uVar1)

+                  ;

+                  pcVar3 = *(code **)(*(longlong *)pIVar12 + 0x38);

+                  uVar7 = (**(code **)(*(longlong *)pIVar10 + 0x50))(pIVar10);

+                  plVar9 = (longlong *)(*pcVar3)(pIVar12,uVar7,0,&local_2a0);

+                  (**(code **)(*(longlong *)pIVar12 + 0x10))(pIVar12);

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

+LAB_1:

+                    local_280 = (longlong *)0x0;

+                    pcVar3 = *(code **)(*(longlong *)local_270 + 0x38);

+                    uVar7 = (**(code **)(*(longlong *)pIVar10 + 0x50))(pIVar10);

+                    plVar9 = (longlong *)(*pcVar3)(local_270,uVar7,1,&local_280);

+                    if (plVar9 != (longlong *)0x0) goto LAB_2;

+                    iVar19 = (**(code **)(*local_2a0 + 0x20))();

+                    bVar5 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_176919867>::

+                            __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_176919867> *

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

+                                                  ::__l2::impl);

+                    if ((bVar5) && (iVar19 < 0)) {

+                      (**(code **)(*local_2a0 + 0x10))();

+                    }

+                    else {

+                      for (; iVar19 != 0; iVar19 = iVar19 - iVar14) {

+                        iVar14 = 0x200;

+                        if (iVar19 < 0x200) {

+                          iVar14 = iVar19;

+                        }

+                        (**(code **)(*local_2a0 + 0x40))(local_2a0,local_248,iVar14);

+                        (**(code **)(*local_280 + 0x48))(local_280,local_248,iVar14);

+                        this = local_258;

+                      }

+                      iVar19 = (**(code **)(*local_2a0 + 0x80))();

+                      if ((iVar19 == 0) &&

+                         (iVar19 = (**(code **)(*local_280 + 0x80))(), iVar19 == 0)) {

+                        (**(code **)(*local_2a0 + 0x10))();

+                        (**(code **)(*local_280 + 0x10))();

+                        uVar15 = 1;

+                        *(undefined4 *)(local_298 + (longlong)puVar2) = 1;

+                        (**(code **)(*(longlong *)pIVar10 + 0x10))(pIVar10);

+                        goto LAB_0;

+                      }

+                    }

+                    lVar11 = *local_280;

+                    plVar9 = local_280;

+                    goto LAB_3;

+                  }

+                  (**(code **)(*plVar9 + 0x10))(plVar9);

+                  local_2a4 = 0;

+                  (**(code **)(*(longlong *)pIVar10 + 0x10))(pIVar10);

+                }

+              }

+              pCVar16 = this + 0xfa;

+            }

+          }

+          else {

+            for (; (iVar17 != 0 && (iVar17 = iVar17 + -1, (*puVar2 & 0x2000000) == 0));

+                puVar2 = puVar2 + *(int *)(this + 0x3c)) {

+              (**(code **)(*local_288 + 0x48))(local_288,puVar2 + local_2a8,local_278);

+            }

+          }

+          pCVar16 = this + 0xfa;

+          local_2a8 = local_2a8 + 1;

+          local_298 = local_298 + 4;

+          local_290 = local_290 + 2;

+          param_2 = local_270;

+          BVar18 = local_2a4;

+        } while (local_2a8 <= *(int *)(this + 0x44));

+      }

+      iVar17 = (**(code **)(*local_288 + 0x80))();

+      *(undefined4 *)(this + 0x74) = 0;

+      BVar6 = 0;

+      if (iVar17 == 0) {

+        BVar6 = BVar18;

+      }

+      CCatalogTable::SetTableState

+                (*(CCatalogTable **)(*(longlong *)(this + 0x10) + 0x18),*(uint *)(this + 0x18),0xd);

+      if (*(int *)(*(longlong *)(this + 0x10) + 0xe0) == 3) {

+        CCatalogTable::SetTableState

+                  (*(CCatalogTable **)(*(longlong *)(this + 0x10) + 0x18),*(uint *)(this + 0x18),0xc

+                  );

+      }

+      *(IMsiStorage **)(this + 0x48) = param_2;

+    }

+    else {

+      (**(code **)(*plVar9 + 0x10))(plVar9);

+    }

+    CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+              ((CComPointer<IXMLDOMElement> *)&local_288);

+  }

+  return BVar6;

+}

+
```

## `CMsiRemoteAPI::DoAction`  (modified)

```diff
--- CMsiRemoteAPI::DoAction
+++ CMsiRemoteAPI::DoAction
@@ -1,2 +1,88 @@
-Failed to decompile msi.dll - .ProgramDB CMsiRemoteAPI::DoAction : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: virtual long __cdecl CMsiRemoteAPI::DoAction(int,unsigned long,unsigned char const *

+   __ptr64,int,unsigned long,unsigned short const * __ptr64) __ptr64 */

+

+long __thiscall

+CMsiRemoteAPI::DoAction

+          (CMsiRemoteAPI *this,int param_1,ulong param_2,uchar *param_3,int param_4,ulong param_5,

+          ushort *param_6)

+

+{

+  bool bVar1;

+  uint uVar2;

+  CActionEntry *pCVar3;

+  IMsiEngine *pIVar4;

+  bool bVar5;

+  CClientThreadImpersonate local_28 [8];

+  IMsiEngine *local_20;

+  CResetImpersonationInfo local_18 [16];

+  

+  CResetImpersonationInfo::CResetImpersonationInfo(local_18);

+  CClientThreadImpersonate::CClientThreadImpersonate(local_28,param_2,param_1);

+  bVar1 = ValidateCookie(this,param_1,param_3,param_4);

+  if (bVar1) {

+    bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_63156538>::__private_IsEnabled

+                      ((FeatureImpl<__WilFeatureTraits_Feature_63156538> *)

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

+                        ::__l2::impl);

+    bVar5 = true;

+    if (bVar1) {

+      if (((uint)param_1 < 2) || (param_1 - 6U < 4)) {

+        if (param_6 == (ushort *)0x0) {

+          uVar2 = 0x80070057;

+          goto LAB_0;

+        }

+        pCVar3 = CActionEntry::Find(param_6);

+        if (((pCVar3 != (CActionEntry *)0x0) && (pCVar3[8] == (CActionEntry)0x0)) &&

+           (g_scServerContext == 2)) {

+          pIVar4 = GetEngineFromHandle(param_5);

+          local_20 = pIVar4;

+          if (g_dmDiagnosticMode != 0) {

+            DebugString(9,0,0,(ushort *)

+                              L"MSI_LUA: unsafe standard action \'%s\' from impersonated CA - attempting UAC consent"

+                        ,param_6,(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                        (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+          }

+          bVar1 = ShouldPromptForElevationAndConsent(pIVar4,param_6);

+          if (!bVar1) {

+            if (g_dmDiagnosticMode != 0) {

+              DebugString(9,0,0,(ushort *)

+                                L"MSI_LUA: denied unsafe standard action \'%s\' invoked from impersonated custom action; UAC consent unavailable or denied"

+                          ,param_6,(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                          (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+            }

+            CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                      ((CComPointer<IXMLDOMElement> *)&local_20);

+            goto LAB_1;

+          }

+          CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                    ((CComPointer<IXMLDOMElement> *)&local_20);

+        }

+      }

+      else {

+        bVar5 = false;

+      }

+      CImpersonate::CImpersonate((CImpersonate *)&local_20,bVar5);

+    }

+    else {

+      if ((1 < (uint)param_1) && (3 < param_1 - 6U)) {

+        bVar5 = false;

+      }

+      CImpersonate::CImpersonate((CImpersonate *)&local_20,bVar5);

+    }

+    uVar2 = MsiDoActionW(param_5,param_6);

+    if (0 < (int)uVar2) {

+      uVar2 = uVar2 & 0xffff | 0x80070000;

+    }

+    CImpersonate::~CImpersonate((CImpersonate *)&local_20);

+  }

+  else {

+LAB_1:

+    uVar2 = 0x80070005;

+  }

+LAB_0:

+  CClientThreadImpersonate::~CClientThreadImpersonate(local_28);

+  CResetImpersonationInfo::~CResetImpersonationInfo(local_18);

+  return uVar2;

+}

+
```

## `CMsiOpExecute::ixfServiceInstall`  (modified)

```diff
--- CMsiOpExecute::ixfServiceInstall
+++ CMsiOpExecute::ixfServiceInstall
@@ -1,2 +1,408 @@
-Failed to decompile msi.dll - .ProgramDB CMsiOpExecute::ixfServiceInstall : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+   guard_dispatch_icall */

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

+/* protected: enum iesEnum __cdecl CMsiOpExecute::ixfServiceInstall(class IMsiRecord & __ptr64)

+   __ptr64 */

+

+iesEnum __thiscall CMsiOpExecute::ixfServiceInstall(CMsiOpExecute *this,IMsiRecord *param_1)

+

+{

+  code *pcVar1;

+  imsEnum iVar2;

+  uint uVar3;

+  DWORD DVar4;

+  int iVar5;

+  DWORD DVar6;

+  imtEnum iVar7;

+  BOOL BVar8;

+  IMsiString *pIVar9;

+  IMsiString *pIVar10;

+  IMsiRecord *pIVar11;

+  IMsiEngine *pIVar12;

+  CComPointer<class_IMsiEngine> *pCVar13;

+  undefined8 uVar14;

+  undefined8 *puVar15;

+  SC_HANDLE__ *pSVar16;

+  LPCWSTR pWVar17;

+  LPCWSTR pWVar18;

+  LPCWSTR pWVar19;

+  SC_HANDLE hSCObject;

+  longlong *plVar20;

+  wchar_t *pwVar21;

+  IMsiRecord *pIVar22;

+  IMsiString *pIVar23;

+  IMsiSummaryInfo **ppIVar24;

+  IMsiTable *pIVar25;

+  ushort *puVar26;

+  MsiUIMessageContext *pMVar27;

+  longlong lVar28;

+  wchar_t *pwVar29;

+  iesEnum iVar30;

+  imtEnum iVar31;

+  bool bVar32;

+  undefined1 auStackY_378 [32];

+  bool local_308;

+  longlong *local_300;

+  imtEnum local_2f8 [2];

+  longlong *local_2f0;

+  imtEnum local_2e8 [2];

+  longlong *local_2e0;

+  undefined8 local_2d8;

+  IMsiRecord *local_2d0;

+  CMsiOpExecute *local_2c8;

+  SC_HANDLE local_2c0;

+  IMsiRecord *local_2b8;

+  IMsiRecord *local_2b0;

+  wchar_t *local_2a8;

+  ulonglong local_2a0;

+  IMsiString *local_298;

+  undefined4 local_290 [2];

+  LPCWSTR local_288;

+  LPCWSTR local_280;

+  LPCWSTR local_278;

+  longlong *local_270;

+  undefined8 local_268;

+  LPCWSTR local_260;

+  undefined1 *local_258;

+  int local_250;

+  undefined1 local_248 [512];

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStackY_378;

+  local_2c8 = this;

+  local_2b8 = param_1;

+  pIVar9 = (IMsiString *)(**(code **)(*(longlong *)param_1 + 0x48))(param_1,1);

+  iVar31 = 2;

+  local_298 = pIVar9;

+  pIVar10 = (IMsiString *)(**(code **)(*(longlong *)param_1 + 0x48))(param_1,2);

+  local_290[0] = 0;

+  pIVar11 = (IMsiRecord *)(**(code **)(**(longlong **)this + 0x30))(*(longlong **)this,1);

+  local_2d0 = pIVar11;

+  (**(code **)(*(longlong *)pIVar11 + 0x78))(pIVar11,1,pIVar9);

+  iVar2 = Message(this,0x9000000,pIVar11);

+  if (iVar2 == 2) {

+    CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+              ((CComPointer<IXMLDOMElement> *)&local_2d0);

+    (**(code **)(*(longlong *)pIVar10 + 0x10))(pIVar10);

+    (**(code **)(*(longlong *)pIVar9 + 0x10))(pIVar9);

+    return 2;

+  }

+  local_2d8 = 0;

+  MsiString::MsiString((MsiString *)&local_2e0,(ushort *)L"System\\CurrentControlSet\\Services\\");

+  MsiString::operator+=((MsiString *)&local_2e0,(MsiString *)&local_298);

+  local_2f0 = (longlong *)0x0;

+  pIVar12 = (IMsiEngine *)

+            (**(code **)(**(longlong **)this + 0xc0))(*(longlong **)this,0x80000002,0xffffffff);

+  pCVar13 = CComPointer<IMsiEngine>::operator=((CComPointer<IMsiEngine> *)&local_2f0,pIVar12);

+  plVar20 = local_2f0;

+  if (*(longlong *)pCVar13 != 0) {

+    pcVar1 = *(code **)(*local_2f0 + 0x70);

+    uVar14 = (**(code **)(*local_2e0 + 0x50))();

+    pIVar12 = (IMsiEngine *)(*pcVar1)(plVar20,uVar14,0,0xffffffff);

+    pCVar13 = CComPointer<IMsiEngine>::operator=((CComPointer<IMsiEngine> *)&local_2f0,pIVar12);

+    if (*(longlong *)pCVar13 != 0) {

+      pIVar12 = (IMsiEngine *)(**(code **)(*local_2f0 + 0x58))(local_2f0,local_290);

+      CComPointer<IMsiEngine>::operator=((CComPointer<IMsiEngine> *)&local_2d8,pIVar12);

+      local_298 = (IMsiString *)OpenSCManagerW((LPCWSTR)0x0,L"ServicesActive",0xf003f);

+      pIVar11 = local_2b8;

+      if (local_298 != (IMsiString *)0x0) {

+        uVar3 = (**(code **)(*(longlong *)local_2b8 + 0x38))(local_2b8,6);

+        bVar32 = (uVar3 >> 0xf & 1) != 0;

+        if (bVar32) {

+          uVar3 = uVar3 - 0x8000;

+        }

+        local_2a0 = (ulonglong)bVar32;

+        local_300 = (longlong *)CONCAT44(local_300._4_4_,uVar3);

+        local_2e8[0] = 1;

+        local_278 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,10);

+        do {

+          DAT_0 = DAT_0 + 1;

+          puVar15 = (undefined8 *)MsiString::MsiString((MsiString *)&local_270,(ushort *)L"");

+          pSVar16 = GetServiceHandle((IMsiString *)*puVar15,pIVar9,0xe0007);

+          local_2c0 = pSVar16;

+          (**(code **)(*local_270 + 0x10))();

+          local_2b0 = (IMsiRecord *)0x0;

+          local_308 = true;

+          if (pSVar16 == (SC_HANDLE__ *)0x0) {

+            local_2f8[0] = 0;

+            local_2c0 = (SC_HANDLE)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,0xb);

+            local_288 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,8);

+            local_280 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,7);

+            pWVar17 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,3);

+            DVar6 = (**(code **)(*(longlong *)pIVar11 + 0x38))(pIVar11,5);

+            DVar4 = (**(code **)(*(longlong *)pIVar11 + 0x38))(pIVar11,4);

+            pWVar18 = (LPCWSTR)(**(code **)(*(longlong *)pIVar10 + 0x50))(pIVar10);

+            pWVar19 = (LPCWSTR)(**(code **)(*(longlong *)pIVar9 + 0x50))(pIVar9);

+            hSCObject = CreateServiceW((SC_HANDLE)local_298,pWVar19,pWVar18,0xf0002,DVar4,DVar6,

+                                       (DWORD)local_300,pWVar17,local_280,(LPDWORD)0x0,local_288,

+                                       local_278,(LPCWSTR)local_2c0);

+            this = local_2c8;

+            pIVar11 = local_2b8;

+            local_2c0 = hSCObject;

+            if (hSCObject != (SC_HANDLE)0x0) {

+              local_268 = (**(code **)(*(longlong *)local_2b8 + 0x50))(local_2b8,0xc);

+              iVar5 = (*(code *)ADVAPI32::ChangeServiceConfig2W)(hSCObject,1,&local_268);

+              this = local_2c8;

+              pIVar11 = local_2b8;

+              if ((iVar5 == 0) &&

+                 (DVar6 = GetLastError(), this = local_2c8, pIVar11 = local_2b8, DVar6 != 1)) {

+                DispatchError(local_2c8,0x4000000,0x78a,pIVar10,pIVar9);

+                pIVar11 = local_2b8;

+              }

+            }

+          }

+          else {

+            local_2f8[0] = 1;

+            if (*(longlong *)(this + 0x20) != 0) {

+              local_2b0 = GetSharedRecord(this,0xe);

+              local_308 = RollbackServiceConfiguration(this,pSVar16,pIVar9,local_2b0);

+            }

+            local_280 = (LPCWSTR)(**(code **)(*(longlong *)pIVar10 + 0x50))(pIVar10);

+            local_288 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,0xb);

+            local_260 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,10);

+            pWVar17 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,8);

+            pWVar18 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,7);

+            pWVar19 = (LPCWSTR)(**(code **)(*(longlong *)pIVar11 + 0x50))(pIVar11,3);

+            DVar6 = (**(code **)(*(longlong *)local_2b8 + 0x38))(local_2b8,5);

+            DVar4 = (**(code **)(*(longlong *)local_2b8 + 0x38))(local_2b8,4);

+            hSCObject = local_2c0;

+            BVar8 = ChangeServiceConfigW

+                              (local_2c0,DVar4,DVar6,(DWORD)local_300,pWVar19,pWVar18,(LPDWORD)0x0,

+                               pWVar17,local_260,local_288,local_280);

+            pIVar11 = local_2b8;

+            if (BVar8 == 0) {

+              CloseServiceHandle(hSCObject);

+              hSCObject = (SC_HANDLE)0x0;

+              local_2c0 = (SC_HANDLE)0x0;

+              this = local_2c8;

+              pIVar11 = local_2b8;

+            }

+            else {

+              plVar20 = (longlong *)(**(code **)(*(longlong *)local_2b8 + 0x48))(local_2b8,0xc);

+              iVar5 = (**(code **)(*plVar20 + 0x38))(plVar20);

+              pwVar29 = (wchar_t *)0x0;

+              if (iVar5 != 0) {

+                pwVar21 = (wchar_t *)(**(code **)(*plVar20 + 0x50))();

+                pwVar29 = L"";

+                if (*pwVar21 != L'\0') {

+                  pwVar29 = pwVar21;

+                }

+              }

+              local_2a8 = pwVar29;

+              iVar5 = (*(code *)ADVAPI32::ChangeServiceConfig2W)(hSCObject,1,&local_2a8);

+              this = local_2c8;

+              if ((iVar5 == 0) && (DVar6 = GetLastError(), this = local_2c8, DVar6 != 1)) {

+                DispatchError(local_2c8,0x4000000,0x78a,pIVar10,pIVar9);

+              }

+              (**(code **)(*plVar20 + 0x10))(plVar20);

+            }

+          }

+          lVar28 = 0x20;

+          pMVar27 = (MsiUIMessageContext *)this;

+          MsiUIMessageContext::EnableTimeout((MsiUIMessageContext *)this);

+          if (hSCObject != (SC_HANDLE)0x0) {

+            iVar30 = 1;

+            if (*(CScriptGenerate **)(pMVar27 + lVar28) != (CScriptGenerate *)0x0) {

+              if (local_2f8[0] == 0) {

+                pIVar22 = GetSharedRecord(this,5);

+                (**(code **)(*(longlong *)pIVar22 + 0x60))(pIVar22,1);

+                (**(code **)(*(longlong *)pIVar22 + 0x78))(pIVar22,2,pIVar9);

+                (**(code **)(*(longlong *)pIVar22 + 0x68))(pIVar22,3,8);

+                (**(code **)(*(longlong *)pIVar22 + 0x60))(pIVar22,4);

+                (**(code **)(*(longlong *)pIVar22 + 0x60))(pIVar22,5);

+                bVar32 = WriteScriptRecord(*(CScriptGenerate **)(this + 0x20),0x4d,pIVar22,true,

+                                           *(IMsiMessage **)(this + 0x10));

+                iVar30 = (bVar32 ^ 1) * 2 + 1;

+              }

+              else if (local_308 != false) {

+                bVar32 = WriteScriptRecord(*(CScriptGenerate **)(pMVar27 + lVar28),0x4e,local_2b0,

+                                           true,*(IMsiMessage **)(this + 0x10));

+                iVar30 = 1;

+                if (!bVar32) {

+                  iVar30 = 3;

+                }

+              }

+            }

+            local_300 = (longlong *)0x0;

+            iVar5 = (**(code **)(*(longlong *)pIVar11 + 0x20))(pIVar11,0xe);

+            if (iVar5 == 0) {

+              pIVar23 = (IMsiString *)(**(code **)(*(longlong *)pIVar11 + 0x48))(pIVar11,0xe);

+              ppIVar24 = CComPointer<IMsiSummaryInfo>::operator&

+                                   ((CComPointer<IMsiSummaryInfo> *)&local_300);

+              bVar32 = GenerateSDFromSDDL(pIVar23,(IMsiStream **)ppIVar24);

+              if (bVar32) {

+                (**(code **)(*(longlong *)pIVar23 + 0x10))(pIVar23);

+                goto LAB_1;

+              }

+              puVar15 = (undefined8 *)

+                        MsiString::MsiString((MsiString *)&local_2a8,(ushort *)L"ServiceInstall");

+              DispatchError(this,0x1000000,0x797,pIVar23,pIVar9,(IMsiString *)*puVar15);

+              (**(code **)(*(longlong *)local_2a8 + 0x10))();

+              (**(code **)(*(longlong *)pIVar23 + 0x10))(pIVar23);

+            }

+            else {

+              iVar5 = (**(code **)(*(longlong *)pIVar11 + 0x20))(pIVar11,0xd);

+              pSVar16 = local_2c0;

+              if (iVar5 != 0) {

+LAB_2:

+                CloseServiceHandle(pSVar16);

+                CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                          ((CComPointer<IXMLDOMElement> *)&local_300);

+                break;

+              }

+              pIVar25 = (IMsiTable *)(**(code **)(*(longlong *)pIVar11 + 0x40))(pIVar11,0xd);

+              CComPointer<IMsiTable>::operator=((CComPointer<IMsiTable> *)&local_300,pIVar25);

+LAB_1:

+              memset(local_248,0,0x200);

+              local_258 = local_248;

+              local_250 = 0x200;

+              (**(code **)(*local_300 + 0x70))();

+              iVar5 = (**(code **)(*local_300 + 0x20))();

+              bVar32 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_502502712>::

+                       __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_502502712> *)

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

+                                            ::__l2::impl);

+              if ((!bVar32) || (-1 < iVar5)) {

+                if (0x200 < iVar5) {

+                  CTempBuffer<char,512>::SetSize((CTempBuffer<char,512> *)&local_258,iVar5);

+                }

+                if (local_258 == (undefined1 *)0x0) {

+                  DispatchError(this,0x1000000,0x962);

+                }

+                else {

+                  (**(code **)(*local_300 + 0x40))(local_300,local_258,iVar5);

+                  IsValidSecurityDescriptor(local_258);

+                  iVar7 = GetSecurityInformation(local_258);

+                  CElevate::CElevate((CElevate *)&local_2b0,*(int *)(this + 500) == 2);

+                  bVar32 = RefCountedTokenPrivilegesCore(1,true);

+                  local_2e8[0] = iVar31;

+                  if (bVar32) {

+                    local_2e8[0] = 1;

+                  }

+                  pSVar16 = local_2c0;

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

+                    CloseServiceHandle(local_2c0);

+                    bVar32 = RefCountedTokenPrivilegesCore(0,true);

+                    if (bVar32) {

+                      iVar31 = 0;

+                    }

+                    local_2f8[0] = iVar31;

+                    puVar15 = (undefined8 *)

+                              MsiString::MsiString((MsiString *)&local_2a8,(ushort *)L"");

+                    pIVar23 = pIVar9;

+                    pSVar16 = GetServiceHandle((IMsiString *)*puVar15,pIVar9,0x10c0000);

+                    iVar31 = (imtEnum)pIVar23;

+                    (**(code **)(*(longlong *)local_2a8 + 0x10))();

+                    if (pSVar16 == (SC_HANDLE__ *)0x0) {

+                      puVar26 = (ushort *)(**(code **)(*(longlong *)pIVar9 + 0x50))(pIVar9);

+                      DVar6 = GetLastError();

+                      DispatchError(this,iVar31,0x798,DVar6,puVar26);

+                      CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges

+                                ((CRefCountedTokenPrivileges *)local_2f8);

+                      CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges

+                                ((CRefCountedTokenPrivileges *)local_2e8);

+                      CElevate::~CElevate((CElevate *)&local_2b0);

+                      goto LAB_3;

+                    }

+                    CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges

+                              ((CRefCountedTokenPrivileges *)local_2f8);

+                  }

+                  BVar8 = SetServiceObjectSecurity(pSVar16,iVar7,local_258);

+                  CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges

+                            ((CRefCountedTokenPrivileges *)local_2e8);

+                  CElevate::~CElevate((CElevate *)&local_2b0);

+                  if (BVar8 != 0) {

+                    if (0x200 < local_250) {

+                      operator_delete(local_258);

+                    }

+                    goto LAB_2;

+                  }

+                  puVar26 = (ushort *)(**(code **)(*(longlong *)pIVar9 + 0x50))(pIVar9);

+                  DVar6 = GetLastError();

+                  DispatchError(this,iVar7,0x798,DVar6,puVar26);

+                }

+              }

+LAB_3:

+              if (0x200 < local_250) {

+                operator_delete(local_258);

+              }

+            }

+            CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                      ((CComPointer<IXMLDOMElement> *)&local_300);

+            goto LAB_4;

+          }

+          GetLastError();

+          if ((local_278 == (LPCWSTR)0x0) || (*(int *)(this + 0x28) != 2)) {

+            if (local_2a0 == 0) {

+              if ((DWORD)local_300 != 0) {

+                if ((DWORD)local_300 == 1) {

+                  iVar7 = 0x1000202;

+                  goto LAB_5;

+                }

+                if (((DWORD)local_300 == 2) || ((DWORD)local_300 == 3)) goto LAB_6;

+              }

+              goto LAB_7;

+            }

+LAB_6:

+            iVar7 = 0x1000005;

+          }

+          else {

+LAB_7:

+            iVar7 = 0x4000000;

+          }

+LAB_5:

+          iVar2 = DispatchError(this,iVar7,0x783,pIVar10,pIVar9);

+          if (iVar2 == 4) {

+LAB_8:

+            iVar30 = 3;

+          }

+          else {

+            local_2e8[0] = 0;

+            if (iVar2 == 5) {

+              iVar30 = 1;

+              break;

+            }

+            if (iVar2 != 0) goto LAB_8;

+            if (iVar7 == 0x4000000) {

+              iVar30 = 1;

+            }

+            else {

+              local_2f8[0] = iVar7 & 0x202;

+              iVar30 = 3;

+              if (local_2f8[0] == 0x202) {

+                iVar30 = 1;

+              }

+            }

+          }

+        } while (local_2e8[0] != 0);

+        CloseServiceHandle((SC_HANDLE)local_298);

+        CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                  ((CComPointer<IXMLDOMElement> *)&local_2f0);

+        (**(code **)(*local_2e0 + 0x10))();

+        CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                  ((CComPointer<IXMLDOMElement> *)&local_2d8);

+        CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                  ((CComPointer<IXMLDOMElement> *)&local_2d0);

+        (**(code **)(*(longlong *)pIVar10 + 0x10))(pIVar10);

+        (**(code **)(*(longlong *)pIVar9 + 0x10))(pIVar9);

+        return iVar30;

+      }

+      DispatchError(this,0x1000000,0x783,pIVar10,pIVar9);

+      goto LAB_4;

+    }

+  }

+  Message(this,0x1000000,(IMsiRecord *)&DAT_9);

+LAB_4:

+  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+            ((CComPointer<IXMLDOMElement> *)&local_2f0);

+  (**(code **)(*local_2e0 + 0x10))();

+  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+            ((CComPointer<IXMLDOMElement> *)&local_2d8);

+  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+            ((CComPointer<IXMLDOMElement> *)&local_2d0);

+  (**(code **)(*(longlong *)pIVar10 + 0x10))(pIVar10);

+  (**(code **)(*(longlong *)pIVar9 + 0x10))(pIVar9);

+  return 3;

+}

+
```

## `CMsiEngine::FNeedElevatedCredentialsPrompt`  (modified)

```diff
--- CMsiEngine::FNeedElevatedCredentialsPrompt
+++ CMsiEngine::FNeedElevatedCredentialsPrompt
@@ -1,2 +1,103 @@
-Failed to decompile msi.dll - .ProgramDB CMsiEngine::FNeedElevatedCredentialsPrompt : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+   guard_dispatch_icall */

+/* public: virtual bool __cdecl CMsiEngine::FNeedElevatedCredentialsPrompt(bool) __ptr64 */

+

+bool __thiscall CMsiEngine::FNeedElevatedCredentialsPrompt(CMsiEngine *this,bool param_1)

+

+{

+  CMsiEngine CVar1;

+  bool bVar2;

+  int iVar3;

+  CMsiSecureRepairManager *this_00;

+  longlong *plVar4;

+  ushort *puVar5;

+  CMsiSecureRepairManager *this_01;

+  uint uVar6;

+  undefined7 in_register_00000011;

+  eSecRepairModeEnum *peVar7;

+  bool bVar8;

+  wchar_t *pwVar9;

+  eSecRepairModeEnum local_res8 [2];

+  

+  uVar6 = (uint)CONCAT71(in_register_00000011,param_1);

+  CVar1 = this[0x25a];

+  iVar3 = (**(code **)(*(longlong *)this + 0x1f8))();

+  bVar8 = false;

+  if ((CVar1 == (CMsiEngine)0x0) ||

+     ((iVar3 != 4 && ((iVar3 != 3 || (this[99] == (CMsiEngine)0x0)))))) {

+    return false;

+  }

+  this_01 = (CMsiSecureRepairManager *)0x40;

+  this_00 = operator_new(0x40);

+  if (this_00 == (CMsiSecureRepairManager *)0x0) {

+    if (g_dmDiagnosticMode == 0) {

+      return false;

+    }

+    DebugString(9,0,0,(ushort *)

+                      L"MSI_LUA: Failed to create local repair manager for elevation checks",

+                (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+    return false;

+  }

+  *(undefined8 *)(this_00 + 0x38) = 0xffffffffffffffff;

+  *(CMsiEngine **)this_00 = this;

+  *(undefined8 *)(this_00 + 8) = 0;

+  *(undefined2 *)(this_00 + 0x10) = 0;

+  this_00[0x12] = (CMsiSecureRepairManager)0x0;

+  *(undefined8 *)(this_00 + 0x14) = 0;

+  *(undefined8 *)(this_00 + 0x1c) = 0;

+  *(undefined8 *)(this_00 + 0x24) = 0;

+  *(undefined8 *)(this_00 + 0x30) = 0;

+  bVar2 = CMsiSecureRepairManager::DonotShowHashMissingUAC(this_01);

+  if (bVar2) {

+    if (g_dmDiagnosticMode != 0) {

+      uVar6 = 0;

+      DebugString(9,0,0,(ushort *)L"MSI_LUA: machine has NoUACforHashMissing policy",

+                  (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                  (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+    }

+    CMsiSecureRepairManager::_scalar_deleting_destructor_(this_00,uVar6);

+    return false;

+  }

+  plVar4 = (longlong *)(**(code **)(*(longlong *)this + 0x128))(this);

+  local_res8[0] = 0;

+  puVar5 = (ushort *)(**(code **)(*plVar4 + 0x50))(plVar4);

+  peVar7 = local_res8;

+  bVar2 = CMsiSecureRepairManager::NeedsSecureRepair(puVar5,peVar7);

+  uVar6 = (uint)peVar7;

+  if (!bVar2) {

+    if (g_dmDiagnosticMode != 0) {

+      uVar6 = 0;

+      DebugString(9,0,0,(ushort *)L"MSI_LUA: Secure repair not needed",(ushort *)L"(NULL)",

+                  (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                  (ushort *)L"(NULL)",0,(void *)0x0);

+    }

+    CMsiSecureRepairManager::_scalar_deleting_destructor_(this_00,uVar6);

+    (**(code **)(*plVar4 + 0x10))(plVar4);

+    return false;

+  }

+  if (param_1) {

+    bVar2 = CMsiSecureRepairManager::CheckCustomActionsRequireElevationInRepair(this_00);

+    if (!bVar2) goto LAB_0;

+    if (g_dmDiagnosticMode != 0) {

+      pwVar9 = 

+      L"MSI_LUA: Credential prompt is required. MSI file includes an elevated custom action";

+      goto LAB_1;

+    }

+  }

+  else if (g_dmDiagnosticMode != 0) {

+    pwVar9 = L"MSI_LUA: Credential prompt is required now. current custom action requires elevation"

+    ;

+LAB_1:

+    uVar6 = 0;

+    DebugString(10,0,0,(ushort *)pwVar9,(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+  }

+  bVar8 = true;

+LAB_0:

+  CMsiSecureRepairManager::_scalar_deleting_destructor_(this_00,uVar6);

+  (**(code **)(*plVar4 + 0x10))(plVar4);

+  return bVar8;

+}

+
```

## `CMsiEngine::ClearEngineData`  (modified)

```diff
--- CMsiEngine::ClearEngineData
+++ CMsiEngine::ClearEngineData
@@ -1,2 +1,405 @@
-Failed to decompile msi.dll - .ProgramDB CMsiEngine::ClearEngineData : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+   guard_dispatch_icall */

+/* protected: void __cdecl CMsiEngine::ClearEngineData(void) __ptr64 */

+

+void __thiscall CMsiEngine::ClearEngineData(CMsiEngine *this)

+

+{

+  longlong *plVar1;

+  undefined8 *puVar2;

+  CMsiEmbeddedUIManager *pCVar3;

+  int iVar4;

+  BOOL BVar5;

+  DWORD DVar6;

+  LPCWSTR pWVar7;

+  IMsiString *pIVar8;

+  ushort *puVar9;

+  CMsiEngine *pCVar10;

+  CWin64DualFolders *this_00;

+  undefined8 in_RDX;

+  uint uVar11;

+  ulonglong uVar13;

+  longlong lVar14;

+  bool bVar15;

+  CElevate local_res8 [8];

+  ulonglong uVar12;

+  

+  uVar13 = 0;

+  if ((g_scServerContext == 0) && (*(longlong *)(this + 0xb0) == 0)) {

+    (**(code **)(*(longlong *)this + 0x1c8))();

+    if (g_pEmbeddedUI == (CMsiEmbeddedUIManager *)0x0) {

+      (**(code **)(*(longlong *)this + 0x1d0))(this);

+      goto LAB_0;

+    }

+  }

+  else {

+LAB_0:

+    if (g_pEmbeddedUI == (CMsiEmbeddedUIManager *)0x0) goto LAB_1;

+  }

+  pCVar3 = g_pEmbeddedUI;

+  if (g_pEmbeddedUI[0x444] == (CMsiEmbeddedUIManager)0x0) {

+    *(undefined4 *)(g_pEmbeddedUI + 0x440) = 0;

+    pCVar10 = (CMsiEngine *)(pCVar3 + 0x218);

+    MsiMessageHandler::ShutdownHandler((MsiMessageHandler *)pCVar10);

+    if ((g_scServerContext == 0) && (*(longlong *)(this + 0xb0) == 0)) {

+      pCVar10 = this;

+      (**(code **)(*(longlong *)this + 0x1d0))();

+    }

+    CMsiEmbeddedUIManager::CleanupTempDirectory((CMsiEmbeddedUIManager *)pCVar10);

+    if (g_pEmbeddedUI != (CMsiEmbeddedUIManager *)0x0) {

+      CMsiEmbeddedUIManager::_scalar_deleting_destructor_(g_pEmbeddedUI,(uint)in_RDX);

+    }

+    g_pEmbeddedUI = (CMsiEmbeddedUIManager *)0x0;

+  }

+LAB_1:

+  if (*(CMsiBaselineManager **)(this + 0x3a0) != (CMsiBaselineManager *)0x0) {

+    CMsiBaselineManager::_scalar_deleting_destructor_

+              (*(CMsiBaselineManager **)(this + 0x3a0),(uint)in_RDX);

+    *(undefined8 *)(this + 0x3a0) = 0;

+  }

+  if (*(CMsiSecureRepairManager **)(this + 0x8a0) != (CMsiSecureRepairManager *)0x0) {

+    CMsiSecureRepairManager::_scalar_deleting_destructor_

+              (*(CMsiSecureRepairManager **)(this + 0x8a0),(uint)in_RDX);

+    *(undefined8 *)(this + 0x8a0) = 0;

+  }

+  if (*(CMsiPatchManager **)(this + 0x3a8) != (CMsiPatchManager *)0x0) {

+    CMsiPatchManager::_scalar_deleting_destructor_

+              (*(CMsiPatchManager **)(this + 0x3a8),(uint)in_RDX);

+    *(undefined8 *)(this + 0x3a8) = 0;

+  }

+  pCVar10 = this + 0xd0;

+  lVar14 = 0x10;

+  do {

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

+      (**(code **)(**(longlong **)pCVar10 + 0x10))();

+      *(longlong *)pCVar10 = 0;

+    }

+    pCVar10 = pCVar10 + 8;

+    lVar14 = lVar14 + -1;

+  } while (lVar14 != 0);

+  if (*(longlong **)(this + 0x1a0) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x1a0) + 0x10))();

+    *(undefined8 *)(this + 0x1a0) = 0;

+  }

+  if (*(longlong **)(this + 0x1a8) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x1a8) + 0x10))();

+    *(undefined8 *)(this + 0x1a8) = 0;

+  }

+  if (*(longlong **)(this + 0xb8) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0xb8) + 0x10))();

+    *(undefined8 *)(this + 0xb8) = 0;

+  }

+  if (*(longlong **)(this + 0xc0) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0xc0) + 0x10))();

+    *(undefined8 *)(this + 0xc0) = 0;

+  }

+  if (*(longlong **)(this + 200) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 200) + 0x10))();

+    *(undefined8 *)(this + 200) = 0;

+  }

+  if (*(longlong **)(this + 0x380) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x380) + 0x10))();

+    *(undefined8 *)(this + 0x380) = 0;

+  }

+  if (*(longlong **)(this + 0x388) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x388) + 0x10))();

+    *(undefined8 *)(this + 0x388) = 0;

+  }

+  if (*(longlong **)(this + 0x2a0) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x2a0) + 0x10))();

+    *(undefined8 *)(this + 0x2a0) = 0;

+  }

+  if (*(longlong **)(this + 0x2a8) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x2a8) + 0x10))();

+    *(undefined8 *)(this + 0x2a8) = 0;

+  }

+  if (*(longlong **)(this + 0x150) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x150) + 0x10))();

+    *(undefined8 *)(this + 0x150) = 0;

+  }

+  if (*(longlong **)(this + 0x158) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x158) + 0x10))();

+    *(undefined8 *)(this + 0x158) = 0;

+  }

+  if (*(int *)(this + 0x164) != 0) {

+    (**(code **)(**(longlong **)(this + 0x168) + 0x10))();

+    *(undefined8 *)(this + 0x168) = 0;

+    (**(code **)(**(longlong **)(this + 0x170) + 0x10))();

+    *(undefined8 *)(this + 0x170) = 0;

+    (**(code **)(**(longlong **)(this + 0x178) + 0x10))();

+    *(undefined8 *)(this + 0x178) = 0;

+    (**(code **)(**(longlong **)(this + 0x180) + 0x10))();

+    *(undefined8 *)(this + 0x180) = 0;

+    (**(code **)(**(longlong **)(this + 0x188) + 0x10))();

+    *(undefined8 *)(this + 0x188) = 0;

+    *(undefined4 *)(this + 0x164) = 0;

+  }

+  uVar11 = (uint)in_RDX;

+  *(undefined8 *)(this + 0x44) = 0;

+  *(undefined4 *)(this + 0x60) = 0;

+  *(undefined4 *)(this + 0x24) = 0;

+  *(undefined2 *)(this + 0x654) = 0;

+  *(undefined4 *)(this + 0x710) = 0;

+  *(undefined4 *)(this + 0x658) = 0;

+  *(undefined2 *)(this + 0x259) = 0;

+  this[0x24c] = (CMsiEngine)0x0;

+  *(undefined4 *)(this + 0x1fc) = 0;

+  this[0x3b9] = (CMsiEngine)0x0;

+  if (*(CScriptGenerate **)(this + 0x68) != (CScriptGenerate *)0x0) {

+    CScriptGenerate::_scalar_deleting_destructor_(*(CScriptGenerate **)(this + 0x68),uVar11);

+    uVar11 = (uint)in_RDX;

+    bVar15 = g_scServerContext == 2;

+    *(undefined8 *)(this + 0x68) = 0;

+    if (bVar15) {

+      uVar11 = (uint)CONCAT71((int7)((ulonglong)in_RDX >> 8),1);

+      CElevate::CElevate(local_res8,true);

+      pWVar7 = (LPCWSTR)(**(code **)(**(longlong **)(this + 0x1b0) + 0x50))();

+      DeleteFileW(pWVar7);

+      CElevate::~CElevate(local_res8);

+    }

+    else {

+      pWVar7 = (LPCWSTR)(**(code **)(**(longlong **)(this + 0x1b0) + 0x50))();

+      DeleteFileW(pWVar7);

+    }

+  }

+  if (*(CScriptGenerate **)(this + 0x70) != (CScriptGenerate *)0x0) {

+    CScriptGenerate::_scalar_deleting_destructor_(*(CScriptGenerate **)(this + 0x70),uVar11);

+    *(undefined8 *)(this + 0x70) = 0;

+  }

+  *(undefined4 *)(this + 0x1e0) = 0;

+  if (*(longlong **)(this + 0x1b0) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x1b0) + 0x10))();

+    *(undefined8 *)(this + 0x1b0) = 0;

+  }

+  if (*(longlong **)(this + 0x1b8) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x1b8) + 0x10))();

+    *(undefined8 *)(this + 0x1b8) = 0;

+  }

+  if (*(longlong **)(this + 0x878) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x878) + 0x10))();

+    *(undefined8 *)(this + 0x878) = 0;

+  }

+  if (*(longlong **)(this + 0x880) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x880) + 0x10))();

+    *(undefined8 *)(this + 0x880) = 0;

+  }

+  if (*(longlong **)(this + 800) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 800) + 0x10))();

+    *(undefined8 *)(this + 800) = 0;

+  }

+  if (*(longlong **)(this + 0x328) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x328) + 0x10))();

+    *(undefined8 *)(this + 0x328) = 0;

+  }

+  if (*(longlong **)(this + 0x350) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x350) + 0x10))();

+    *(undefined8 *)(this + 0x350) = 0;

+  }

+  if (*(longlong **)(this + 0x358) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x358) + 0x10))();

+    *(undefined8 *)(this + 0x358) = 0;

+  }

+  if (*(longlong **)(this + 0x3d0) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x3d0) + 0x10))();

+    *(undefined8 *)(this + 0x3d0) = 0;

+  }

+  if (*(longlong **)(this + 0x3d8) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x3d8) + 0x10))();

+    *(undefined8 *)(this + 0x3d8) = 0;

+  }

+  if (*(longlong **)(this + 0x3f0) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x3f0) + 0x10))();

+    *(undefined8 *)(this + 0x3f0) = 0;

+  }

+  if (*(longlong **)(this + 0x3f8) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x3f8) + 0x10))();

+    *(undefined8 *)(this + 0x3f8) = 0;

+  }

+  if (*(longlong **)(this + 0x410) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x410) + 0x10))();

+    *(undefined8 *)(this + 0x410) = 0;

+  }

+  if (*(longlong **)(this + 0x418) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x418) + 0x10))();

+    *(undefined8 *)(this + 0x418) = 0;

+  }

+  if (*(longlong **)(this + 0x468) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x468) + 0x10))();

+    *(undefined8 *)(this + 0x468) = 0;

+  }

+  if (*(longlong **)(this + 0x470) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x470) + 0x10))();

+    *(undefined8 *)(this + 0x470) = 0;

+  }

+  if (*(longlong **)(this + 0x488) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x488) + 0x10))();

+    *(undefined8 *)(this + 0x488) = 0;

+  }

+  if (*(longlong **)(this + 0x490) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x490) + 0x10))();

+    *(undefined8 *)(this + 0x490) = 0;

+  }

+  if (*(longlong **)(this + 0x4a8) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x4a8) + 0x10))();

+    *(undefined8 *)(this + 0x4a8) = 0;

+  }

+  if (*(longlong **)(this + 0x4b0) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x4b0) + 0x10))();

+    *(undefined8 *)(this + 0x4b0) = 0;

+  }

+  if (*(longlong **)(this + 0x4d0) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x4d0) + 0x10))();

+    *(undefined8 *)(this + 0x4d0) = 0;

+  }

+  if (*(longlong **)(this + 0x4d8) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x4d8) + 0x10))();

+    *(undefined8 *)(this + 0x4d8) = 0;

+  }

+  if (*(longlong **)(this + 0x430) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x430) + 0x10))();

+    *(undefined8 *)(this + 0x430) = 0;

+  }

+  if (*(longlong **)(this + 0x438) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x438) + 0x10))();

+    *(undefined8 *)(this + 0x438) = 0;

+  }

+  if (*(longlong *)(this + 0x4f0) != 0) {

+    uVar12 = uVar13;

+    if (*(int *)(this + 0x4f8) != 0) {

+      do {

+        plVar1 = *(longlong **)(*(longlong *)(this + 0x4f0) + uVar12 * 8);

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

+          (**(code **)(*plVar1 + 0x10))();

+          *(undefined8 *)(*(longlong *)(this + 0x4f0) + uVar12 * 8) = 0;

+        }

+        uVar11 = (int)uVar12 + 1;

+        uVar12 = (ulonglong)uVar11;

+      } while (uVar11 < *(uint *)(this + 0x4f8));

+    }

+    operator_delete(*(void **)(this + 0x4f0));

+    *(undefined8 *)(this + 0x4f0) = 0;

+  }

+  if (*(longlong *)(this + 0x4e8) != 0) {

+    if (*(int *)(this + 0x4f8) != 0) {

+      do {

+        plVar1 = *(longlong **)(*(longlong *)(this + 0x4e8) + uVar13 * 8);

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

+          (**(code **)(*plVar1 + 0x10))();

+          *(undefined8 *)(*(longlong *)(this + 0x4e8) + uVar13 * 8) = 0;

+        }

+        uVar11 = (int)uVar13 + 1;

+        uVar13 = (ulonglong)uVar11;

+      } while (uVar11 < *(uint *)(this + 0x4f8));

+    }

+    operator_delete(*(void **)(this + 0x4e8));

+    *(undefined8 *)(this + 0x4e8) = 0;

+  }

+  if ((g_scServerContext == 2) && (*(int *)(this + 100) != 0)) {

+    MsiCloseHandle();

+    *(undefined4 *)(this + 100) = 0;

+  }

+  DestroyPatchUninstallCustomActionData(this);

+  this[0x3b0] = (CMsiEngine)0x0;

+  this[0x3ba] = (CMsiEngine)0x0;

+  SetPatchingRunFromSourceFeatures(this,false);

+  SetPatchingDownRevFiles(this,false);

+  SetActiveMajorUpgradePatch(this,false);

+  SetForceRepair(this,false);

+  *(undefined4 *)(this + 0x28) = 0;

+  *(undefined2 *)(this + 0x5d0) = 0;

+  if (*(longlong **)(this + 0x98) != (longlong *)0x0) {

+    (**(code **)(**(longlong **)(this + 0x98) + 0x10))();

+    *(undefined8 *)(this + 0x98) = 0;

+  }

+  *(undefined4 *)(this + 0x250) = 0xffffffff;

+  puVar2 = *(undefined8 **)(this + 0x868);

+  *(undefined4 *)(this + 0x248) = 0;

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

+    (**(code **)*puVar2)(puVar2,1);

+    *(undefined8 *)(this + 0x868) = 0;

+  }

+  *(undefined8 *)(this + 0x30c) = 0;

+  *(undefined8 *)(this + 0x314) = 0;

+  this[0x7e8] = (CMsiEngine)0x0;

+  *(undefined8 *)(this + 0x7ec) = 0;

+  *(undefined8 *)(this + 0x7f4) = 0;

+  *(undefined8 *)(this + 0x7fc) = 0;

+  *(undefined8 *)(this + 0x804) = 0;

+  (**(code **)(**(longlong **)(this + 0x3c0) + 0x10))();

+  *(CMsiStringNull **)(this + 0x3c0) = &g_MsiStringNull;

+  while( true ) {

+    iVar4 = (**(code **)(**(longlong **)(this + 0x788) + 0x38))();

+    if (iVar4 == 0) break;

+    pIVar8 = MsiString::ExtractAndRemove((MsiString *)(this + 0x788),2,0x3b);

+    iVar4 = (**(code **)(*(longlong *)pIVar8 + 0x38))(pIVar8);

+    if (iVar4 != 0) {

+      if (g_scServerContext == 2) {

+        CElevate::CElevate(local_res8,true);

+        if (g_dmDiagnosticMode != 0) {

+          puVar9 = (ushort *)(**(code **)(*(longlong *)pIVar8 + 0x50))(pIVar8);

+          DebugString(10,0,0,(ushort *)L"Attempting to delete file %s",puVar9,(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",0,(void *)0x0);

+        }

+        pWVar7 = (LPCWSTR)(**(code **)(*(longlong *)pIVar8 + 0x50))(pIVar8);

+        BVar5 = DeleteFileW(pWVar7);

+        if ((BVar5 == 0) && (g_dmDiagnosticMode != 0)) {

+          DVar6 = GetLastError();

+          DebugString(10,0,0,(ushort *)L"Unable to delete the file. LastError = %d",

+                      (ushort *)(ulonglong)DVar6,(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+        }

+        CElevate::~CElevate(local_res8);

+      }

+      else {

+        if (g_dmDiagnosticMode != 0) {

+          puVar9 = (ushort *)(**(code **)(*(longlong *)pIVar8 + 0x50))(pIVar8);

+          DebugString(10,0,0,(ushort *)L"Attempting to delete file %s",puVar9,(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",0,(void *)0x0);

+        }

+        pWVar7 = (LPCWSTR)(**(code **)(*(longlong *)pIVar8 + 0x50))(pIVar8);

+        BVar5 = DeleteFileW(pWVar7);

+        if ((BVar5 == 0) && (g_dmDiagnosticMode != 0)) {

+          DVar6 = GetLastError();

+          DebugString(10,0,0,(ushort *)L"Unable to delete the file. LastError = %d",

+                      (ushort *)(ulonglong)DVar6,(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+        }

+      }

+    }

+    (**(code **)(*(longlong *)pIVar8 + 0x10))(pIVar8);

+  }

+  *(undefined8 *)(this + 0x2b0) = 0;

+  *(undefined8 *)(this + 0x2b8) = 0;

+  *(undefined8 *)(this + 0x2c0) = 0;

+  *(undefined8 *)(this + 0x2c8) = 0;

+  *(undefined8 *)(this + 0x2d0) = 0;

+  *(undefined8 *)(this + 0x2d8) = 0;

+  *(undefined8 *)(this + 0x2e0) = 0;

+  *(undefined8 *)(this + 0x2e8) = 0;

+  *(undefined8 *)(this + 0x2f0) = 0;

+  *(undefined8 *)(this + 0x2f8) = 0;

+  *(undefined8 *)(this + 0x300) = 0;

+  *(undefined4 *)(this + 0x308) = 0;

+  *(undefined8 *)(this + 0x478) = 0;

+  *(undefined8 *)(this + 0x480) = 0;

+  *(undefined8 *)(this + 0x498) = 0;

+  *(undefined8 *)(this + 0x4a0) = 0;

+  *(undefined8 *)(this + 0x4b8) = 0;

+  *(undefined8 *)(this + 0x4c0) = 0;

+  *(undefined8 *)(this + 0x4c8) = 0;

+  *(undefined4 *)(this + 0x4e0) = 0;

+  this_00 = *(CWin64DualFolders **)(this + 0x788);

+  (**(code **)(*(longlong *)this_00 + 0x10))();

+  bVar15 = g_scServerContext != 2;

+  *(CMsiStringNull **)(this + 0x788) = &g_MsiStringNull;

+  this[0x890] = (CMsiEngine)0x1;

+  this[0x298] = (CMsiEngine)0x0;

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

+    CWin64DualFolders::Release(this_00);

+  }

+  return;

+}

+
```

## `CTransformStreamWrite::CopyStream`  (modified)

```diff
--- CTransformStreamWrite::CopyStream
+++ CTransformStreamWrite::CopyStream
@@ -1,2 +1,77 @@
-Failed to decompile msi.dll - .ProgramDB CTransformStreamWrite::CopyStream : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

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

+   guard_dispatch_icall */

+/* public: class IMsiRecord * __ptr64 __cdecl CTransformStreamWrite::CopyStream(class IMsiStream &

+   __ptr64,class IMsiCursor & __ptr64) __ptr64 */

+

+IMsiRecord * __thiscall

+CTransformStreamWrite::CopyStream

+          (CTransformStreamWrite *this,IMsiStream *param_1,IMsiCursor *param_2)

+

+{

+  longlong *plVar1;

+  code *pcVar2;

+  bool bVar3;

+  int iVar4;

+  IMsiRecord *pIVar5;

+  longlong *plVar6;

+  undefined8 uVar7;

+  int iVar8;

+  undefined1 auStack_88 [48];

+  longlong *local_58;

+  longlong local_50;

+  int local_48;

+  ulonglong local_38;

+  

+  local_38 = __security_cookie ^ (ulonglong)auStack_88;

+  CTempBuffer<char,1>::CTempBuffer<char,1>((CTempBuffer<char,1> *)&local_50,0x800);

+  if (local_50 == 0) {

+    pIVar5 = ::PostError(0x92a);

+  }

+  else {

+    plVar6 = (longlong *)(**(code **)(*(longlong *)param_2 + 0xe0))(param_2);

+    local_58 = (longlong *)0x0;

+    plVar1 = *(longlong **)(this + 0x18);

+    pcVar2 = *(code **)(*plVar1 + 0x38);

+    uVar7 = (**(code **)(*plVar6 + 0x50))(plVar6);

+    pIVar5 = (IMsiRecord *)(*pcVar2)(plVar1,uVar7);

+    if (pIVar5 == (IMsiRecord *)0x0) {

+      (**(code **)(*(longlong *)param_1 + 0x70))(param_1);

+      iVar8 = (**(code **)(*(longlong *)param_1 + 0x20))(param_1);

+      bVar3 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_1450939707>::__private_IsEnabled

+                        ((FeatureImpl<__WilFeatureTraits_Feature_1450939707> *)

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

+                          ::__l2::impl);

+      if ((bVar3) && (iVar8 < 0)) {

+        (**(code **)(*local_58 + 0x10))();

+      }

+      else {

+        for (; iVar8 != 0; iVar8 = iVar8 - iVar4) {

+          iVar4 = iVar8;

+          if (local_48 <= iVar8) {

+            iVar4 = local_48;

+          }

+          (**(code **)(*(longlong *)param_1 + 0x40))(param_1,local_50,iVar4);

+          (**(code **)(*local_58 + 0x48))(local_58,local_50);

+        }

+        iVar8 = (**(code **)(*local_58 + 0x80))();

+        iVar4 = (**(code **)(*(longlong *)param_1 + 0x80))(param_1);

+        (**(code **)(*local_58 + 0x10))();

+        if (iVar8 == 0 && iVar4 == 0) {

+          (**(code **)(*plVar6 + 0x10))(plVar6);

+          pIVar5 = (IMsiRecord *)0x0;

+          goto LAB_0;

+        }

+      }

+      pIVar5 = CMsiDatabase::PostError

+                         (*(CMsiDatabase **)(this + 0x28),0x8c7,(ushort *)0x0,(ushort *)0x0);

+    }

+    (**(code **)(*plVar6 + 0x10))(plVar6);

+  }

+LAB_0:

+  CTempBuffer<unsigned_char,1>::~CTempBuffer<unsigned_char,1>

+            ((CTempBuffer<unsigned_char,1> *)&local_50);

+  return pIVar5;

+}

+
```

## `CMsiOpExecute::CreateFolder`  (modified)

```diff
--- CMsiOpExecute::CreateFolder
+++ CMsiOpExecute::CreateFolder
@@ -1,2 +1,257 @@
-Failed to decompile msi.dll - .ProgramDB CMsiOpExecute::CreateFolder : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+   guard_dispatch_icall */

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

+/* protected: enum iesEnum __cdecl CMsiOpExecute::CreateFolder(class IMsiPath & __ptr64,enum

+   Bool,enum Bool,class IMsiStream * __ptr64,enum Bool,enum Bool,enum Bool) __ptr64 */

+

+iesEnum __thiscall

+CMsiOpExecute::CreateFolder

+          (CMsiOpExecute *this,IMsiPath *param_1,Bool param_2,Bool param_3,IMsiStream *param_4,

+          Bool param_5,Bool param_6,Bool param_7)

+

+{

+  code *pcVar1;

+  bool bVar2;

+  char cVar3;

+  imsEnum iVar4;

+  imtEnum SecurityInformation;

+  BOOL BVar5;

+  DWORD DVar6;

+  IMsiEngine *pIVar7;

+  CComPointer<class_IMsiEngine> *pCVar8;

+  IMsiSummaryInfo **ppIVar9;

+  longlong *plVar10;

+  LPCWSTR pWVar11;

+  HANDLE pvVar12;

+  ushort *puVar13;

+  undefined1 *puVar14;

+  itkpEnum iVar15;

+  undefined8 uVar16;

+  int iVar17;

+  undefined8 *puVar18;

+  iesEnum iVar19;

+  Bool BVar20;

+  Bool BVar21;

+  undefined8 *puVar22;

+  undefined1 auStackY_308 [32];

+  int local_2a8;

+  Bool local_2a4;

+  longlong local_2a0;

+  IMsiRecord *local_298;

+  Bool local_290 [2];

+  longlong *local_288;

+  CElevate local_280 [8];

+  undefined8 local_278;

+  undefined1 *puStack_270;

+  ulonglong local_268;

+  undefined1 *local_258;

+  int local_250;

+  undefined1 local_248 [512];

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStackY_308;

+  puVar22 = (undefined8 *)0x0;

+  local_2a8 = 0;

+  local_298 = (IMsiRecord *)0x0;

+  local_2a4 = param_3;

+  memset(local_248,0,0x200);

+  local_258 = local_248;

+  local_250 = 0x200;

+  local_268 = 0;

+  local_278 = 0;

+  puStack_270 = (undefined1 *)0x0;

+  puVar18 = puVar22;

+  if (param_4 == (IMsiStream *)0x0) {

+LAB_0:

+    iVar19 = 2;

+    if ((param_6 != 0) || (*(int *)(this + 0x28) == 2)) {

+      puVar22 = (undefined8 *)&DAT_1;

+    }

+LAB_2:

+    BVar21 = (Bool)puVar22;

+    BVar20 = BVar21;

+    pIVar7 = (IMsiEngine *)(**(code **)(*(longlong *)param_1 + 200))(param_1,&local_2a8,puVar18);

+    pCVar8 = CComPointer<IMsiEngine>::operator=((CComPointer<IMsiEngine> *)&local_298,pIVar7);

+    if (*(longlong *)pCVar8 != 0) {

+      iVar4 = DispatchMessageW(this,0x1000005,local_298,BVar20);

+      if (iVar4 != 2) goto code_r0x0001801c91b6;

+      if (0x200 < local_250) {

+        operator_delete(local_258);

+      }

+      goto LAB_3;

+    }

+    if (param_5 == 0) {

+      if (local_2a8 == 0) goto LAB_4;

+    }

+    else if (local_2a8 == 0) goto LAB_5;

+    if ((param_2 != 0) || ((param_7 != 1 && (*(int *)(this + 500) == 5)))) goto LAB_5;

+    local_288 = (longlong *)0x0;

+    pcVar1 = *(code **)(*(longlong *)param_1 + 0x58);

+    ppIVar9 = CComPointer<IMsiSummaryInfo>::operator&((CComPointer<IMsiSummaryInfo> *)&local_288);

+    pIVar7 = (IMsiEngine *)(*pcVar1)(param_1,ppIVar9);

+    CComPointer<IMsiEngine>::operator=((CComPointer<IMsiEngine> *)&local_298,pIVar7);

+    BVar20 = local_2a4;

+    if (local_298 == (IMsiRecord *)0x0) {

+      iVar17 = 0;

+      if (0 < local_2a8) {

+        do {

+          pIVar7 = (IMsiEngine *)

+                   (**(code **)(**(longlong **)(this + 8) + 0x100))

+                             (*(longlong **)(this + 8),local_288,BVar20);

+          CComPointer<IMsiEngine>::operator=((CComPointer<IMsiEngine> *)&local_298,pIVar7);

+          if (local_298 != (IMsiRecord *)0x0) {

+            Message(this,0x4000000,local_298);

+          }

+          (**(code **)(*local_288 + 0x70))();

+          iVar17 = iVar17 + 1;

+        } while (iVar17 < local_2a8);

+      }

+      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                ((CComPointer<IXMLDOMElement> *)&local_288);

+LAB_5:

+      if ((param_4 == (IMsiStream *)0x0) || (local_2a8 != 0)) {

+LAB_6:

+        if (0x200 < local_250) {

+          operator_delete(local_258);

+        }

+        iVar19 = 1;

+        goto LAB_3;

+      }

+      plVar10 = (longlong *)(**(code **)(*(longlong *)param_1 + 0x38))(param_1);

+      local_2a0 = -1;

+      if (BVar21 == 0) {

+        pWVar11 = (LPCWSTR)(**(code **)(*plVar10 + 0x50))(plVar10);

+        pvVar12 = CreateFileW(pWVar11,0x80000000,3,(LPSECURITY_ATTRIBUTES)0x0,3,0x2200000,

+                              (HANDLE)0x0);

+        CHandle::operator=((CHandle *)&local_2a0,pvVar12);

+        if (local_2a0 != -1) goto LAB_7;

+        if (g_dmDiagnosticMode != 0) {

+          puVar13 = (ushort *)(**(code **)(*plVar10 + 0x50))(plVar10);

+          DebugString(9,0,0,(ushort *)L"Folder is not accessible: %s",puVar13,(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",0,(void *)0x0);

+        }

+      }

+      else {

+        CElevate::CElevate((CElevate *)local_290,true);

+        pWVar11 = (LPCWSTR)(**(code **)(*plVar10 + 0x50))(plVar10);

+        pvVar12 = CreateFileW(pWVar11,0x80000000,3,(LPSECURITY_ATTRIBUTES)0x0,3,0x2200000,

+                              (HANDLE)0x0);

+        CHandle::operator=((CHandle *)&local_2a0,pvVar12);

+        if (local_2a0 == -1) {

+          if (g_dmDiagnosticMode != 0) {

+            puVar13 = (ushort *)(**(code **)(*plVar10 + 0x50))(plVar10);

+            DebugString(9,0,0,(ushort *)L"Folder is not accessible: %s",puVar13,(ushort *)L"(NULL)",

+                        (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                        (ushort *)L"(NULL)",0,(void *)0x0);

+          }

+          CElevate::~CElevate((CElevate *)local_290);

+        }

+        else {

+          cVar3 = (**(code **)(*(longlong *)param_1 + 0x248))(param_1);

+          if ((cVar3 != '\0') && (BVar21 = 0, g_dmDiagnosticMode != 0)) {

+            puVar13 = (ushort *)(**(code **)(*plVar10 + 0x50))(plVar10);

+            pvVar12 = (HANDLE)0x0;

+            DebugString(9,0,0,(ushort *)L"Folder has Junction: %s",puVar13,(ushort *)L"(NULL)",

+                        (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                        (ushort *)L"(NULL)",0,(void *)0x0);

+          }

+          CElevate::~CElevate((CElevate *)local_290);

+LAB_7:

+          SecurityInformation = GetSecurityInformation(local_258);

+          uVar16 = CONCAT71((int7)((ulonglong)pvVar12 >> 8),1);

+          iVar15 = (itkpEnum)uVar16;

+          if (BVar21 == 0) {

+            bVar2 = RefCountedTokenPrivilegesCore(1,true);

+            local_2a4 = 2;

+            if (bVar2) {

+              local_2a4 = 1;

+            }

+            CRefCountedTokenPrivileges::CRefCountedTokenPrivileges

+                      ((CRefCountedTokenPrivileges *)local_290,iVar15,SecurityInformation >> 3 & 1);

+            puVar14 = local_258;

+            pWVar11 = (LPCWSTR)(**(code **)(*plVar10 + 0x50))(plVar10);

+            BVar5 = SetFileSecurityW(pWVar11,SecurityInformation,puVar14);

+            CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges

+                      ((CRefCountedTokenPrivileges *)local_290);

+            CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges

+                      ((CRefCountedTokenPrivileges *)&local_2a4);

+          }

+          else {

+            CElevate::CElevate(local_280,true);

+            iVar15 = (itkpEnum)CONCAT71((int7)((ulonglong)uVar16 >> 8),1);

+            bVar2 = RefCountedTokenPrivilegesCore(1,true);

+            local_290[0] = 2;

+            if (bVar2) {

+              local_290[0] = 1;

+            }

+            CRefCountedTokenPrivileges::CRefCountedTokenPrivileges

+                      ((CRefCountedTokenPrivileges *)&local_2a4,iVar15,SecurityInformation >> 3 & 1)

+            ;

+            puVar14 = local_258;

+            pWVar11 = (LPCWSTR)(**(code **)(*plVar10 + 0x50))(plVar10);

+            BVar5 = SetFileSecurityW(pWVar11,SecurityInformation,puVar14);

+            CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges

+                      ((CRefCountedTokenPrivileges *)&local_2a4);

+            CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges

+                      ((CRefCountedTokenPrivileges *)local_290);

+            CElevate::~CElevate(local_280);

+          }

+          if (BVar5 != 0) {

+            CHandle::~CHandle((CHandle *)&local_2a0);

+            (**(code **)(*plVar10 + 0x10))(plVar10);

+            goto LAB_6;

+          }

+          puVar13 = (ushort *)(**(code **)(*plVar10 + 0x50))(plVar10);

+          DVar6 = GetLastError();

+          DispatchError(this,SecurityInformation,0x786,DVar6,puVar13);

+        }

+      }

+      CHandle::~CHandle((CHandle *)&local_2a0);

+      (**(code **)(*plVar10 + 0x10))(plVar10);

+      goto LAB_4;

+    }

+    Message(this,0x1000000,local_298);

+    CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+              ((CComPointer<IXMLDOMElement> *)&local_288);

+    goto LAB_4;

+  }

+  (**(code **)(*(longlong *)param_4 + 0x70))(param_4);

+  iVar17 = (**(code **)(*(longlong *)param_4 + 0x20))(param_4);

+  bVar2 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_502502712>::__private_IsEnabled

+                    ((FeatureImpl<__WilFeatureTraits_Feature_502502712> *)

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

+                      ::__l2::impl);

+  if ((bVar2) && (iVar17 < 0)) {

+LAB_4:

+    puVar14 = local_258;

+    if (local_250 < 0x201) goto LAB_8;

+  }

+  else {

+    if ((iVar17 < 0x201) ||

+       (CTempBuffer<char,512>::SetSize((CTempBuffer<char,512> *)&local_258,iVar17),

+       local_258 != (undefined1 *)0x0)) {

+      (**(code **)(*(longlong *)param_4 + 0x40))(param_4,local_258,iVar17);

+      IsValidSecurityDescriptor(local_258);

+      puVar18 = &local_278;

+      puStack_270 = local_258;

+      local_278 = CONCAT44(local_278._4_4_,0x18);

+      local_268 = local_268 & 0xffffffff00000000;

+      goto LAB_0;

+    }

+    if (local_250 < 0x201) goto LAB_8;

+    puVar14 = (undefined1 *)0x0;

+  }

+  operator_delete(puVar14);

+LAB_8:

+  iVar19 = 3;

+LAB_3:

+  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+            ((CComPointer<IXMLDOMElement> *)&local_298);

+  return iVar19;

+code_r0x0001801c91b6:

+  if (iVar4 != 4) goto LAB_4;

+  goto LAB_2;

+}

+
```

## `CMsiStream::GetMsiStringValue`  (modified)

```diff
--- CMsiStream::GetMsiStringValue
+++ CMsiStream::GetMsiStringValue
@@ -1,2 +1,60 @@
-Failed to decompile msi.dll - .ProgramDB CMsiStream::GetMsiStringValue : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+   guard_dispatch_icall */

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

+/* public: virtual class IMsiString const & __ptr64 __cdecl CMsiStream::GetMsiStringValue(void)const

+   __ptr64 */

+

+IMsiString * __thiscall CMsiStream::GetMsiStringValue(CMsiStream *this)

+

+{

+  bool bVar1;

+  int iVar2;

+  uint cchWideChar;

+  LPWSTR lpWideCharStr;

+  Bool BVar3;

+  undefined1 auStackY_478 [32];

+  int local_448 [2];

+  longlong *local_440;

+  IMsiString *local_438 [2];

+  CHAR *local_428;

+  undefined4 local_420;

+  CHAR local_418 [1024];

+  ulonglong local_18;

+  

+  local_18 = __security_cookie ^ (ulonglong)auStackY_478;

+  local_438[0] = (IMsiString *)0x0;

+  local_440 = (longlong *)0x0;

+  local_448[0] = 0;

+  bVar1 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_502502712>::__private_IsEnabled

+                    ((FeatureImpl<__WilFeatureTraits_Feature_502502712> *)

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

+                      ::__l2::impl);

+  if ((((!bVar1) || (*(uint *)(this + 0x41c) < 0x80000000)) && (*(int *)(this + 0x41c) != 0)) &&

+     ((*(int *)(this + 0x418) == 0 &&

+      (iVar2 = (**(code **)(**(longlong **)(this + 0x440) + 0x68))(), iVar2 == 0)))) {

+    memset(local_418,0,0x400);

+    local_428 = local_418;

+    local_420 = 0x400;

+    CTempBuffer<char,1024>::SetSize((CTempBuffer<char,1024> *)&local_428,*(int *)(this + 0x41c));

+    if (local_428 != (CHAR *)0x0) {

+      (**(code **)(*local_440 + 0x18))(local_440,local_428,*(undefined4 *)(this + 0x41c),local_448);

+      (**(code **)(*local_440 + 0x10))();

+      if (local_448[0] == *(int *)(this + 0x41c)) {

+        BVar3 = 0;

+        cchWideChar = MultiByteToWideChar(0,0,local_428,*(int *)(this + 0x41c),(LPWSTR)0x0,0);

+        lpWideCharStr = (LPWSTR)AllocateString(cchWideChar,BVar3,local_438);

+        if (lpWideCharStr != (LPWSTR)0x0) {

+          MultiByteToWideChar(0,0,local_428,*(int *)(this + 0x41c),lpWideCharStr,cchWideChar);

+          CTempBuffer<unsigned_short,1024>::~CTempBuffer<unsigned_short,1024>

+                    ((CTempBuffer<unsigned_short,1024> *)&local_428);

+          return local_438[0];

+        }

+      }

+    }

+    CTempBuffer<unsigned_short,1024>::~CTempBuffer<unsigned_short,1024>

+              ((CTempBuffer<unsigned_short,1024> *)&local_428);

+  }

+  return (IMsiString *)&g_MsiStringNull;

+}

+
```

## `CAutoRecord::ReadStream`  (modified)

```diff
--- CAutoRecord::ReadStream
+++ CAutoRecord::ReadStream
@@ -1,23 +1,135 @@
 

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

    guard_dispatch_icall */

+/* public: long __cdecl CAutoRecord::ReadStream(class CAutoArgs & __ptr64) __ptr64 */

 

-long __thiscall CAutoDatabase::ReadStream(CAutoRecord *this,CAutoArgs *param_1)

+long __thiscall CAutoRecord::ReadStream(CAutoRecord *this,CAutoArgs *param_1)

 

 {

-  long lVar1;

-  longlong in_RAX;

-  undefined8 *in_R8;

+  bool bVar1;

+  long lVar2;

+  int iVar3;

+  CVariant *pCVar4;

+  LPWSTR lpWideCharStr;

+  byte *lpMultiByteStr;

+  uint uVar5;

+  LPWSTR pWVar6;

+  byte *pbVar7;

+  uint local_res18 [2];

+  int local_res20 [2];

+  uint local_38;

+  uint local_34;

+  int local_30 [2];

   

-  if (in_RAX == 0x46000000000000c0) {

-    *in_R8 = this;

-    (**(code **)(*(longlong *)this + 8))();

-    lVar1 = 0;

+  local_res20[0] = 0;

+  local_38 = 0;

+  local_34 = 0;

+  pCVar4 = CAutoArgs::operator[](param_1,1);

+  lVar2 = CVariant::GetInt(pCVar4,local_res20);

+  if (lVar2 != 0) {

+    return lVar2;

+  }

+  pCVar4 = CAutoArgs::operator[](param_1,2);

+  lVar2 = CVariant::GetInt(pCVar4,(int *)&local_38);

+  if (lVar2 != 0) {

+    return lVar2;

+  }

+  pCVar4 = CAutoArgs::operator[](param_1,3);

+  lVar2 = CVariant::GetInt(pCVar4,(int *)&local_34);

+  if (lVar2 != 0) {

+    return lVar2;

+  }

+  local_res18[0] = local_38;

+  local_30[0] = 0;

+  if (local_34 < 4) {

+    iVar3 = MsiRecordIsNull(*(undefined4 *)(this + 0x28),local_res20[0]);

+    if (iVar3 == 0) {

+      iVar3 = MsiRecordReadStream(*(undefined4 *)(this + 0x28),local_res20[0],0,local_res18);

+      if (iVar3 != 0) {

+        return iVar3;

+      }

+      if (local_res18[0] != 0) {

+        if (local_38 < local_res18[0]) {

+          local_res18[0] = local_38;

+        }

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

+                __private_IsEnabled((FeatureImpl<__WilFeatureTraits_Feature_3594491195> *)

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

+                                     ::__l2::impl);

+        if ((!bVar1) || (local_res18[0] < 0x80000000)) {

+          if (local_34 != 0) {

+            if (local_34 == 1) {

+              lpMultiByteStr = operator_new((ulonglong)local_res18[0]);

+              if (lpMultiByteStr == (byte *)0x0) {

+                return -0x7ff8fff2;

+              }

+              MsiRecordReadStream(*(undefined4 *)(this + 0x28),local_res20[0],lpMultiByteStr);

+              lpWideCharStr = (LPWSTR)(*(code *)OLEAUT32::SysAllocStringLen)(0,local_res18[0]);

+              pWVar6 = lpWideCharStr;

+              pbVar7 = lpMultiByteStr;

+              uVar5 = local_res18[0];

+              if (lpWideCharStr == (LPWSTR)0x0) {

+                return -0x7ff8fff2;

+              }

+              for (; uVar5 != 0; uVar5 = uVar5 - 1) {

+                *pWVar6 = (ushort)*pbVar7;

+                pWVar6 = pWVar6 + 1;

+                pbVar7 = pbVar7 + 1;

+              }

+              local_38 = 0xffffffff;

+              *pWVar6 = L'\0';

+            }

+            else {

+              if (local_34 != 2) {

+                if (local_34 != 3) {

+                  return -0x7fffbffb;

+                }

+                lpWideCharStr =

+                     (LPWSTR)(*(code *)OLEAUT32::SysAllocStringLen)(0,local_res18[0] + 1 >> 1);

+                if (lpWideCharStr == (LPWSTR)0x0) {

+                  return -0x7ff8fff2;

+                }

+                MsiRecordReadStream(*(undefined4 *)(this + 0x28),local_res20[0],lpWideCharStr,

+                                    local_res18);

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

+                  *(undefined1 *)((ulonglong)local_res18[0] + (longlong)lpWideCharStr) = 0;

+                }

+                goto LAB_0;

+              }

+              lpMultiByteStr = operator_new((ulonglong)local_res18[0]);

+              if (lpMultiByteStr == (byte *)0x0) {

+                return -0x7ff8fff2;

+              }

+              MsiRecordReadStream(*(undefined4 *)(this + 0x28),local_res20[0],lpMultiByteStr,

+                                  local_res18);

+              iVar3 = MultiByteToWideChar(0,0,(LPCSTR)lpMultiByteStr,local_res18[0],(LPWSTR)0x0,0);

+              lpWideCharStr = (LPWSTR)(*(code *)OLEAUT32::SysAllocStringLen)(0,iVar3);

+              if (lpWideCharStr == (LPWSTR)0x0) {

+                return -0x7ff8fff2;

+              }

+              MultiByteToWideChar(0,0,(LPCSTR)lpMultiByteStr,local_res18[0],lpWideCharStr,iVar3);

+              lpWideCharStr[iVar3] = L'\0';

+            }

+            operator_delete(lpMultiByteStr);

+LAB_0:

+            lVar2 = CAutoArgs::ReturnBSTR(param_1,(ushort *)lpWideCharStr);

+            return lVar2;

+          }

+          if (local_res18[0] < 5) {

+            MsiRecordReadStream(*(undefined4 *)(this + 0x28),local_res20[0],local_30,local_res18);

+            lVar2 = CAutoArgs::Assign(param_1,local_30[0]);

+            return lVar2;

+          }

+        }

+        goto LAB_1;

+      }

+    }

+    lVar2 = 0;

   }

   else {

-    *in_R8 = 0;

-    lVar1 = -0x7fffbffe;

+LAB_1:

+    lVar2 = -0x7ffdfff5;

   }

-  return lVar1;

+  return lVar2;

 }
```

## `CMsiRegKey::InitMsiRegKey`  (modified)

```diff
--- CMsiRegKey::InitMsiRegKey
+++ CMsiRegKey::InitMsiRegKey
@@ -1,2 +1,217 @@
-Failed to decompile msi.dll - .ProgramDB CMsiRegKey::InitMsiRegKey : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+   guard_dispatch_icall */

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

+/* private: class IMsiRecord * __ptr64 __cdecl CMsiRegKey::InitMsiRegKey(enum rrwEnum,enum Bool)

+   __ptr64 */

+

+IMsiRecord * __thiscall CMsiRegKey::InitMsiRegKey(CMsiRegKey *this,rrwEnum param_1,Bool param_2)

+

+{

+  ulong uVar1;

+  uint uVar2;

+  uint uVar3;

+  _func_long_HKEY___ptr_ushort_ptr_ulong_ulong_HKEY___ptr_ptr *p_Var4;

+  bool bVar5;

+  long lVar6;

+  LONG LVar7;

+  IMsiString *pIVar8;

+  IMsiRecord *pIVar9;

+  ushort *puVar10;

+  longlong *plVar11;

+  ulong uVar12;

+  _SECURITY_ATTRIBUTES *p_Var13;

+  wchar_t *pwVar14;

+  int iVar15;

+  uint uVar16;

+  uint uVar17;

+  undefined1 auStackY_2e8 [32];

+  wchar_t *pwVar18;

+  ulong local_284;

+  uint local_280;

+  int local_27c;

+  ulong local_278;

+  CRefCountedTokenPrivileges local_274 [4];

+  CRefCountedTokenPrivileges local_270 [8];

+  _func_long_HKEY___ptr_ushort_ptr_ulong_ushort_ptr_ulong_ulong__SECURITY_ATTRIBUTES_ptr_HKEY___ptr_ptr_ulong_ptr

+  *local_268;

+  _SECURITY_ATTRIBUTES local_260;

+  undefined1 *local_248;

+  int local_240;

+  undefined1 local_238 [512];

+  ulonglong local_38;

+  

+  local_38 = __security_cookie ^ (ulonglong)auStackY_2e8;

+  if ((g_fWinNT64) || (*(int *)(this + 0x68) != 1)) {

+    if (*(int *)(this + 0x24) == 1) {

+      *(undefined4 *)(this + 0x20) = 1;

+      return (IMsiRecord *)0x0;

+    }

+    if (*(int *)(this + 0x20) == 1) {

+      if (*(int *)(this + 0x50) != 0) {

+        return (IMsiRecord *)0x0;

+      }

+      if (param_1 != 1) {

+        return (IMsiRecord *)0x0;

+      }

+      RegCloseKey(*(HKEY *)(this + 0x18));

+      *(undefined4 *)(this + 0x20) = 0;

+    }

+    local_278 = 0x20019;

+    uVar17 = 0x2001f;

+    if (g_fWinNT64 != false) {

+      uVar17 = 0x100;

+      if (*(int *)(this + 0x68) != 1) {

+        uVar17 = 0x200;

+      }

+      local_278 = uVar17 | 0x20019;

+      uVar17 = uVar17 | 0x2001f;

+    }

+    iVar15 = 3;

+LAB_0:

+    uVar12 = local_278;

+    p_Var4 = RegOpenKeyAPI;

+    iVar15 = iVar15 + -1;

+    local_27c = iVar15;

+    if (param_2 == 1) {

+      memset(local_238,0,0x200);

+      local_248 = local_238;

+      local_240 = 0x200;

+      local_260.bInheritHandle = 0;

+      local_260._20_4_ = 0;

+      local_280 = 0;

+      local_260.nLength = 0;

+      local_260._4_4_ = 0;

+      local_260.lpSecurityDescriptor = (undefined1 *)0x0;

+      if (*(longlong **)(this + 0x60) != (longlong *)0x0) {

+        uVar17 = uVar17 | 0xc0000;

+        (**(code **)(**(longlong **)(this + 0x60) + 0x70))();

+        iVar15 = (**(code **)(**(longlong **)(this + 0x60) + 0x20))();

+        bVar5 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_502502712>::__private_IsEnabled

+                          ((FeatureImpl<__WilFeatureTraits_Feature_502502712> *)

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

+                            ::__l2::impl);

+        if ((bVar5) && (iVar15 < 0)) {

+LAB_1:

+          pIVar9 = ::PostError(0x962);

+          if (0x200 < local_240) {

+            operator_delete(local_248);

+            return pIVar9;

+          }

+          return pIVar9;

+        }

+        if (0x200 < iVar15) {

+          CTempBuffer<char,512>::SetSize((CTempBuffer<char,512> *)&local_248,iVar15);

+        }

+        if (local_248 == (undefined1 *)0x0) goto LAB_1;

+        (**(code **)(**(longlong **)(this + 0x60) + 0x40))

+                  (*(longlong **)(this + 0x60),local_248,iVar15);

+        IsValidSecurityDescriptor(local_248);

+        local_260.lpSecurityDescriptor = local_248;

+        local_260.nLength = 0x18;

+        local_260.bInheritHandle = 1;

+        local_280 = GetSecurityInformation(local_248);

+      }

+      local_284 = 0;

+      uVar2 = local_280 & 1;

+      uVar3 = local_280 & 1;

+      uVar16 = local_280 & 8;

+      if (param_1 == 1) {

+        uVar12 = uVar17;

+      }

+      uVar1 = uVar12 | 0x1000000;

+      if (uVar16 == 0) {

+        uVar1 = uVar12;

+      }

+      CRefCountedTokenPrivileges::CRefCountedTokenPrivileges

+                (local_270,1,(bool)((byte)local_280 & 1));

+      CRefCountedTokenPrivileges::CRefCountedTokenPrivileges(local_274,0,uVar16 != 0);

+      local_268 = RegCreateKeyAPI;

+      if (((*(longlong *)(this + 0x60) == 0) || (uVar2 != 0)) || (uVar16 != 0)) {

+        p_Var13 = (_SECURITY_ATTRIBUTES *)0x0;

+      }

+      else {

+        p_Var13 = &local_260;

+      }

+      puVar10 = (ushort *)(**(code **)(**(longlong **)(this + 0x30) + 0x50))();

+      lVar6 = (*local_268)(*(HKEY__ **)(this + 0x48),puVar10,0,(ushort *)L"",0,uVar1,p_Var13,

+                           (HKEY__ **)(this + 0x18),&local_284);

+      if (((*(longlong *)(this + 0x60) != 0) && (lVar6 == 0)) &&

+         ((local_284 == 2 || ((uVar3 != 0 || (uVar16 != 0)))))) {

+        lVar6 = RegSetKeySecurity(*(HKEY *)(this + 0x18),local_280,local_248);

+      }

+      CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges(local_274);

+      CRefCountedTokenPrivileges::~CRefCountedTokenPrivileges(local_270);

+      iVar15 = local_27c;

+      if (0x200 < local_240) {

+        operator_delete(local_248);

+        iVar15 = local_27c;

+      }

+    }

+    else {

+      if (param_1 == 1) {

+        uVar12 = uVar17;

+      }

+      puVar10 = (ushort *)(**(code **)(**(longlong **)(this + 0x30) + 0x50))();

+      lVar6 = (*p_Var4)(*(HKEY__ **)(this + 0x48),puVar10,0,uVar12,(HKEY__ **)(this + 0x18));

+    }

+    if (lVar6 == 0x5aa) {

+      bVar5 = IncreaseRegistryQuota(0);

+      if ((!bVar5) || (iVar15 == 0)) goto LAB_2;

+      goto LAB_0;

+    }

+    if (lVar6 == 0) {

+      *(undefined4 *)(this + 0x20) = 1;

+      *(rrwEnum *)(this + 0x50) = param_1;

+      if (g_fWoW == false) {

+        return (IMsiRecord *)0x0;

+      }

+      if (g_fWinNT64 == false) {

+        return (IMsiRecord *)0x0;

+      }

+      if (param_1 != 1) {

+        return (IMsiRecord *)0x0;

+      }

+      if (this[0x28] != (CMsiRegKey)0x0) {

+        return (IMsiRecord *)0x0;

+      }

+      if (*(int *)(this + 0x54) == -1) {

+        return (IMsiRecord *)0x0;

+      }

+      this[0x28] = (CMsiRegKey)0x1;

+      if (*(int *)(this + 0x54) != 0) {

+        RegEnableReflectionKey(*(HKEY *)(this + 0x18));

+        return (IMsiRecord *)0x0;

+      }

+      plVar11 = (longlong *)(**(code **)(*(longlong *)this + 0x78))(this);

+      LVar7 = RegDisableReflectionKey(*(HKEY *)(this + 0x18));

+      if (LVar7 == 0) {

+        if (g_dmDiagnosticMode == 0) goto LAB_3;

+        puVar10 = (ushort *)(**(code **)(**(longlong **)(this + 0x38) + 0x50))();

+        pwVar14 = L"Disabling reflection on key: %s";

+        pwVar18 = L"(NULL)";

+      }

+      else {

+        if (g_dmDiagnosticMode == 0) goto LAB_3;

+        pwVar18 = (wchar_t *)(longlong)LVar7;

+        puVar10 = (ushort *)(**(code **)(**(longlong **)(this + 0x38) + 0x50))();

+        pwVar14 = L"Failed trying to disable reflection on key: %s, with error code: %d";

+      }

+      DebugString(9,0,0,(ushort *)pwVar14,puVar10,(ushort *)pwVar18,(ushort *)L"(NULL)",

+                  (ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+LAB_3:

+      (**(code **)(*plVar11 + 0x10))(plVar11);

+      return (IMsiRecord *)0x0;

+    }

+LAB_2:

+    pIVar8 = (IMsiString *)(**(code **)(*(longlong *)this + 0x78))();

+    pIVar9 = ::PostError(0x57a - (uint)(param_2 != 0),pIVar8,lVar6);

+  }

+  else {

+    pIVar8 = (IMsiString *)(**(code **)(*(longlong *)this + 0x78))();

+    pIVar9 = ::PostError(0x961,pIVar8);

+  }

+  (**(code **)(*(longlong *)pIVar8 + 0x10))(pIVar8);

+  return pIVar9;

+}

+
```

## `CMsiFileCopy::OpenDestination`  (modified)

```diff
--- CMsiFileCopy::OpenDestination
+++ CMsiFileCopy::OpenDestination
@@ -1,2 +1,364 @@
-Failed to decompile msi.dll - .ProgramDB CMsiFileCopy::OpenDestination : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+   guard_dispatch_icall */

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

+/* protected: class IMsiRecord * __ptr64 __cdecl CMsiFileCopy::OpenDestination(bool) __ptr64 */

+

+IMsiRecord * __thiscall CMsiFileCopy::OpenDestination(CMsiFileCopy *this,bool param_1)

+

+{

+  CMsiFileCopy CVar1;

+  longlong *plVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  CMsiCustomActionManager *this_00;

+  undefined1 *pSecurityDescriptor;

+  bool bVar5;

+  char cVar6;

+  bool bVar7;

+  uint uVar8;

+  uint uVar9;

+  int iVar10;

+  ielfEnum iVar11;

+  DWORD DVar12;

+  DWORD DVar13;

+  ulong uVar14;

+  Bool BVar15;

+  uint uVar16;

+  IMsiRecord *pIVar17;

+  ushort *puVar18;

+  longlong *plVar19;

+  CMsiFileCopy *this_01;

+  void *pvVar20;

+  _FILETIME *p_Var21;

+  LPCWSTR lpFileName;

+  HANDLE pvVar22;

+  undefined8 uVar23;

+  undefined1 uVar24;

+  CTempBuffer<unsigned_char,512> *this_02;

+  bool bVar25;

+  undefined1 auStackY_2f8 [32];

+  undefined8 in_stack_fffffffffffffd28;

+  undefined4 uVar26;

+  ulong in_stack_fffffffffffffd58;

+  void *in_stack_fffffffffffffd60;

+  ulong local_298 [2];

+  longlong *local_290;

+  longlong *local_288;

+  _SECURITY_ATTRIBUTES local_280;

+  undefined1 *local_268;

+  undefined4 local_25c;

+  undefined1 *local_248;

+  uint local_240;

+  undefined1 local_238 [512];

+  ulonglong local_38;

+  

+  uVar26 = (undefined4)((ulonglong)in_stack_fffffffffffffd28 >> 0x20);

+  local_38 = __security_cookie ^ (ulonglong)auStackY_2f8;

+  uVar16 = (**(code **)(**(longlong **)(this + 0x20) + 0x38))(*(longlong **)(this + 0x20),4);

+  bVar25 = false;

+  bVar7 = false;

+  if (*(longlong *)(this + 0x18) == 0) {

+    plVar19 = (longlong *)

+              (**(code **)(**(longlong **)(this + 0x20) + 0x48))(*(longlong **)(this + 0x20),3);

+    if (this[0x79] == (CMsiFileCopy)0x0) {

+      plVar2 = *(longlong **)(this + 0x60);

+      plVar3 = *(longlong **)(this + 0x68);

+      pcVar4 = *(code **)(*plVar2 + 0x18);

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

+        (**(code **)(*plVar3 + 0x10))();

+      }

+      *(longlong *)(this + 0x68) = 0;

+      CVar1 = this[0x78];

+      uVar23 = (**(code **)(*plVar19 + 0x50))(plVar19);

+      uVar16 = (*pcVar4)(plVar2,0,uVar23,CVar1 != (CMsiFileCopy)0x0);

+    }

+    else {

+      this_00 = *(CMsiCustomActionManager **)(this + 0x80);

+      CVar1 = this[0x78];

+      puVar18 = (ushort *)(**(code **)(*plVar19 + 0x50))(plVar19);

+      uVar16 = CMsiCustomActionManager::URTCreateAssemblyFileStream

+                         (this_00,puVar18,(uint)(CVar1 != (CMsiFileCopy)0x0));

+    }

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

+      (**(code **)(*plVar19 + 0x10))(plVar19);

+      return (IMsiRecord *)0x0;

+    }

+    puVar18 = (ushort *)(**(code **)(*plVar19 + 0x50))();

+    pIVar17 = ::PostError(0x51e,uVar16 & 0xffff,puVar18);

+    (**(code **)(*plVar19 + 0x10))(plVar19);

+    return pIVar17;

+  }

+  *(undefined8 *)(this + 0x30) = 0xffffffffffffffff;

+  CTempBuffer<char,1>::CTempBuffer<char,1>((CTempBuffer<char,1> *)&local_268,0xc00);

+  if (local_268 == (undefined1 *)0x0) {

+    pIVar17 = ::PostError(0x11);

+    goto LAB_0;

+  }

+  local_290 = (longlong *)(**(code **)(**(longlong **)(this + 0x18) + 0x48))();

+  uVar8 = (**(code **)(*local_290 + 0x70))(local_290);

+  if ((uVar16 >> 0xf & 1) == 0) {

+LAB_1:

+    if (param_1) {

+LAB_2:

+      bVar25 = true;

+      StartImpersonating();

+      this[0x50] = (CMsiFileCopy)0x1;

+    }

+    else {

+      puVar18 = (ushort *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+      bVar5 = GetImpersonationFromPath(puVar18);

+      if ((bVar5) || (cVar6 = (**(code **)(**(longlong **)(this + 0x18) + 0x248))(), cVar6 != '\0'))

+      goto LAB_2;

+      puVar18 = (ushort *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+      bVar5 = IsSubstDrive(puVar18);

+      if (bVar5) goto LAB_2;

+    }

+    local_298[0] = 0;

+    DVar12 = 0;

+    if (((uVar8 & 8) == 0) ||

+       ((iVar10 = (**(code **)(**(longlong **)(this + 0x20) + 0x20))(), iVar10 != 0 && (!bVar7)))) {

+      if (this[0x50] != (CMsiFileCopy)0x0) {

+        DAT_3 = DAT_3 + 1;

+      }

+      lpFileName = (LPCWSTR)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+      p_Var21 = (_FILETIME *)CONCAT44(uVar26,2);

+      pvVar22 = CreateFileW(lpFileName,0x40000000,0,(LPSECURITY_ATTRIBUTES)0x0,2,

+                            uVar16 & 7 | 0x100000,(HANDLE)0x0);

+      *(HANDLE *)(this + 0x30) = pvVar22;

+      if ((pvVar22 != (HANDLE)0xffffffffffffffff) &&

+         (bVar7 = VerifyDestination(this,bVar25), DVar12 = 0, !bVar7)) {

+        DVar12 = GetLastError();

+        local_298[0] = DVar12;

+        if ((DVar12 != 1) && (g_dmDiagnosticMode != 0)) {

+          p_Var21 = (_FILETIME *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+          DebugString(9,0,0,(ushort *)

+                            L"Error: This file path is updated, hence failing to create: %s",

+                      (ushort *)p_Var21,(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+        }

+        CloseHandle(*(HANDLE *)(this + 0x30));

+        *(undefined8 *)(this + 0x30) = 0xffffffffffffffff;

+        SetLastError(DVar12);

+      }

+      this_02 = *(CTempBuffer<unsigned_char,512> **)(this + 0x30);

+      if ((this_02 != (CTempBuffer<unsigned_char,512> *)0xffffffffffffffff) &&

+         (DVar13 = GetFileType(this_02), DVar13 - 2 < 2)) {

+        if (g_dmDiagnosticMode != 0) {

+          p_Var21 = (_FILETIME *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+          DebugString(9,0,0,(ushort *)

+                            L"Error: This is not a valid file, hence failing to create: %s",

+                      (ushort *)p_Var21,(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+        }

+        CloseHandle(*(HANDLE *)(this + 0x30));

+        this_02 = (CTempBuffer<unsigned_char,512> *)0x6e;

+        *(undefined8 *)(this + 0x30) = 0xffffffffffffffff;

+        SetLastError(0x6e);

+      }

+      if (*(longlong *)(this + 0x30) == -1) {

+        DVar12 = GetLastError();

+        local_298[0] = DVar12;

+      }

+      if (this[0x50] != (CMsiFileCopy)0x0) {

+        MsiUIMessageContext::EnableTimeout((MsiUIMessageContext *)this_02);

+      }

+    }

+    else {

+      local_280._4_4_ = 0;

+      local_280._20_4_ = 0;

+      memset(local_238,0,0x200);

+      local_248 = local_238;

+      local_240 = 0x200;

+      iVar10 = (**(code **)(**(longlong **)(this + 0x20) + 0x20))();

+      if (iVar10 == 0) {

+        if (g_dmDiagnosticMode != 0) {

+          uVar26 = 1;

+          DebugString(10,0,0,"File will have security applied from OpCode.","(NULL)","(NULL)",

+                      "(NULL)","(NULL)","(NULL)","(NULL)",in_stack_fffffffffffffd58,

+                      in_stack_fffffffffffffd60);

+        }

+        plVar19 = (longlong *)(**(code **)(**(longlong **)(this + 0x20) + 0x40))();

+        local_288 = plVar19;

+        (**(code **)(*plVar19 + 0x70))(plVar19);

+        uVar8 = (**(code **)(*plVar19 + 0x20))(plVar19);

+        bVar7 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_502502712>::__private_IsEnabled

+                          ((FeatureImpl<__WilFeatureTraits_Feature_502502712> *)

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

+                            ::__l2::impl);

+        if ((bVar7) && ((int)uVar8 < 0)) {

+LAB_4:

+          pIVar17 = ::PostError(0x11);

+          CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                    ((CComPointer<IXMLDOMElement> *)&local_288);

+          CTempBuffer<unsigned_char,512>::~CTempBuffer<unsigned_char,512>

+                    ((CTempBuffer<unsigned_char,512> *)&local_248);

+          goto LAB_5;

+        }

+        if (0x200 < (int)uVar8) {

+          if (0x200 < (int)local_240) {

+            operator_delete(local_248);

+          }

+          local_248 = operator_new((longlong)(int)uVar8);

+          local_240 = -(uint)(local_248 != (undefined1 *)0x0) & uVar8;

+          if (local_248 == (undefined1 *)0x0) goto LAB_4;

+        }

+        pSecurityDescriptor = local_248;

+        (**(code **)(*plVar19 + 0x40))(plVar19,local_248,uVar8);

+        IsValidSecurityDescriptor(local_248);

+        IsValidSecurityDescriptor(pSecurityDescriptor);

+        CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                  ((CComPointer<IXMLDOMElement> *)&local_288);

+        local_268 = pSecurityDescriptor;

+      }

+      local_280.nLength = 0x18;

+      iVar11 = 0;

+      local_280.bInheritHandle = 0;

+      if (this[0x50] != (CMsiFileCopy)0x0) {

+        DAT_3 = DAT_3 + 1;

+      }

+      local_280.lpSecurityDescriptor = local_268;

+      iVar10 = (**(code **)(**(longlong **)(this + 0x20) + 0x20))(*(longlong **)(this + 0x20),9);

+      if (iVar10 == 0) {

+        iVar11 = (**(code **)(**(longlong **)(this + 0x20) + 0x38))(*(longlong **)(this + 0x20),9);

+      }

+      this_01 = (CMsiFileCopy *)

+                (**(code **)(**(longlong **)(this + 0x40) + 0x50))(*(longlong **)(this + 0x40));

+      p_Var21 = (_FILETIME *)CONCAT44(uVar26,iVar11);

+      pvVar20 = MsiCreateFileWithUserAccessCheck

+                          ((ushort *)this_01,&local_280,uVar16 & 7,bVar25,iVar11);

+      *(void **)(this + 0x30) = pvVar20;

+      if ((pvVar20 != (void *)0xffffffffffffffff) &&

+         (this_01 = this, bVar7 = VerifyDestination(this,bVar25), DVar12 = 0, !bVar7)) {

+        DVar12 = GetLastError();

+        local_298[0] = DVar12;

+        if ((DVar12 != 1) && (g_dmDiagnosticMode != 0)) {

+          p_Var21 = (_FILETIME *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+          DebugString(9,0,0,(ushort *)

+                            L"Error: This file path is updated, hence failing to create: %s",

+                      (ushort *)p_Var21,(ushort *)L"(NULL)",(ushort *)L"(NULL)",(ushort *)L"(NULL)",

+                      (ushort *)L"(NULL)",(ushort *)L"(NULL)",0,(void *)0x0);

+        }

+        CloseHandle(*(HANDLE *)(this + 0x30));

+        this_01 = (CMsiFileCopy *)(ulonglong)DVar12;

+        *(undefined8 *)(this + 0x30) = 0xffffffffffffffff;

+        SetLastError(DVar12);

+      }

+      if (*(longlong *)(this + 0x30) == -1) {

+        DVar12 = GetLastError();

+        local_298[0] = DVar12;

+      }

+      if (this[0x50] != (CMsiFileCopy)0x0) {

+        MsiUIMessageContext::EnableTimeout((MsiUIMessageContext *)this_01);

+      }

+      this_02 = (CTempBuffer<unsigned_char,512> *)&local_248;

+      CTempBuffer<unsigned_char,512>::~CTempBuffer<unsigned_char,512>(this_02);

+    }

+    uVar24 = SUB81(this_02,0);

+    if (*(longlong *)(this + 0x30) != -1) {

+      DVar13 = GetFileSize(*(HANDLE *)(this + 0x38),(LPDWORD)0x0);

+      uVar24 = (undefined1)(DVar13 - 0x10001);

+      if (DVar13 - 0x10001 < 0xfffefffe) {

+        pvVar20 = *(void **)(this + 0x30);

+        bVar7 = MsiSetFileSize(pvVar20,DVar13,local_298);

+        uVar24 = SUB81(pvVar20,0);

+        DVar12 = local_298[0];

+        if (!bVar7) {

+          pvVar22 = *(HANDLE *)(this + 0x30);

+          CloseHandle(pvVar22);

+          uVar24 = SUB81(pvVar22,0);

+          *(undefined8 *)(this + 0x30) = 0xffffffffffffffff;

+          DVar12 = local_298[0];

+        }

+      }

+    }

+    if (bVar25 != false) {

+      StopImpersonating((bool)uVar24);

+    }

+    if (*(void **)(this + 0x30) == (void *)0xffffffffffffffff) {

+      if (DVar12 == 5) {

+        if (bVar25 != false) {

+          StartImpersonating();

+        }

+        puVar18 = (ushort *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+        uVar14 = MsiGetFileAttributesEx

+                           (puVar18,(ulong *)0x0,(__uint64 *)0x0,(_FILETIME *)0x0,p_Var21,

+                            (_FILETIME *)0x0);

+        if (bVar25 != false) {

+          StopImpersonating(SUB81(puVar18,0));

+        }

+        if ((uVar14 == 0xffffffff) || ((uVar14 & 0x10) == 0)) {

+LAB_6:

+          puVar18 = (ushort *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+          pIVar17 = ::PostError(0x51e,DVar12,puVar18);

+        }

+        else {

+          puVar18 = (ushort *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+          iVar10 = 0x515;

+LAB_7:

+          pIVar17 = ::PostError(iVar10,puVar18);

+        }

+      }

+      else {

+        if (DVar12 == 0x70) {

+          puVar18 = (ushort *)(**(code **)(**(longlong **)(this + 0x40) + 0x50))();

+          iVar10 = 0x51b;

+          goto LAB_7;

+        }

+        if ((DVar12 != 1) || (bVar25 != false)) goto LAB_6;

+        pIVar17 = OpenDestination(this,true);

+      }

+    }

+    else {

+      BVar15 = MsiRegisterSysHandle(*(void **)(this + 0x30));

+      if (BVar15 != 0) {

+        CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                  ((CComPointer<IXMLDOMElement> *)&local_290);

+        CTempBuffer<unsigned_char,1>::~CTempBuffer<unsigned_char,1>

+                  ((CTempBuffer<unsigned_char,1> *)&local_268);

+        return (IMsiRecord *)0x0;

+      }

+      *(undefined8 *)(this + 0x30) = 0xffffffffffffffff;

+      pIVar17 = ::PostError(0x11);

+    }

+  }

+  else {

+    local_288 = (longlong *)

+                (**(code **)(**(longlong **)(this + 0x70) + 0x48))(*(longlong **)(this + 0x70));

+    uVar9 = (**(code **)(*local_288 + 0x70))(local_288);

+    CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+              ((CComPointer<IXMLDOMElement> *)&local_288);

+    puVar18 = (ushort *)

+              (**(code **)(**(longlong **)(this + 0x48) + 0x50))(*(longlong **)(this + 0x48));

+    bVar5 = GetImpersonationFromPath(puVar18);

+    if (((((uVar9 >> 3 & 1) == 0) || ((uVar8 & 8) == 0)) || (bVar5)) ||

+       (iVar10 = (**(code **)(**(longlong **)(this + 0x20) + 0x20))(*(longlong **)(this + 0x20),0xc)

+       , iVar10 == 0)) goto LAB_1;

+    CElevate::CElevate((CElevate *)&local_288,true);

+    bVar7 = true;

+    local_298[0] = 0;

+    if (g_dmDiagnosticMode != 0) {

+      uVar26 = 1;

+      DebugString(10,0,0,"Using source file security for destination.","(NULL)","(NULL)","(NULL)",

+                  "(NULL)","(NULL)","(NULL)",in_stack_fffffffffffffd58,in_stack_fffffffffffffd60);

+    }

+    local_25c = 1;

+    puVar18 = (ushort *)(**(code **)(**(longlong **)(this + 0x48) + 0x50))();

+    bVar5 = MsiGetFileSecurity(puVar18,0xf,(CTempBufferRef<unsigned_char> *)&local_268,local_298);

+    if (bVar5) {

+      CElevate::~CElevate((CElevate *)&local_288);

+      goto LAB_1;

+    }

+    puVar18 = (ushort *)(**(code **)(**(longlong **)(this + 0x48) + 0x50))();

+    pIVar17 = ::PostError(0x52e,local_298[0],puVar18);

+    CElevate::~CElevate((CElevate *)&local_288);

+  }

+LAB_5:

+  CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+            ((CComPointer<IXMLDOMElement> *)&local_290);

+LAB_0:

+  CTempBuffer<unsigned_char,1>::~CTempBuffer<unsigned_char,1>

+            ((CTempBuffer<unsigned_char,1> *)&local_268);

+  return pIVar17;

+}

+
```

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

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

+/* void __cdecl wil::details::WilApiImpl_RecordFeatureUsage(unsigned int,unsigned int,unsigned

+   int,char const * __ptr64) */

+

+void __cdecl

+wil::details::WilApiImpl_RecordFeatureUsage(uint param_1,uint param_2,uint param_3,char *param_4)

+

+{

+  undefined4 in_register_0000000c;

+  wil_details_ServiceReportingKind wVar1;

+  

+  wVar1 = param_2 & 0x7fffffff;

+  if (((param_1 == 0) && (param_3 == 0)) && (wVar1 == 0)) {

+    FeatureStateManager::FlushUsage((FeatureStateManager *)&g_featureStateManager);

+    return;

+  }

+  if (wVar1 >> 0x1e != 0) {

+    FeatureStateManager::QueueBackgroundSRUMUsageReporting

+              ((FeatureStateManager *)&g_featureStateManager,param_1,(ushort)wVar1,param_3);

+    return;

+  }

+  if ((param_3 == 0) && (wVar1 != 0xfe)) {

+    wil_RtlStagingConfig_RecordFeatureUsage

+              (CONCAT44(in_register_0000000c,param_1),wVar1,param_2 >> 0x1f);

+    return;

+  }

+  FeatureStateManager::RecordFeatureUsage

+            ((FeatureStateManager *)&g_featureStateManager,param_1,wVar1,(ulonglong)param_3);

+  return;

+}

+
```

## `CMsiEngine::DoInitialize`  (modified)

```diff
--- CMsiEngine::DoInitialize
+++ CMsiEngine::DoInitialize
@@ -1,2 +1 @@
-Failed to decompile msi.dll - .ProgramDB CMsiEngine::DoInitialize : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+Failed to decompile msi.dll - .ProgramDB CMsiEngine::DoInitialize : Error: Decompile error: Exception while decompiling 1800f8e64: process: timeout
```

## `CMsiTable::MatchRow`  (modified)

```diff
--- CMsiTable::MatchRow
+++ CMsiTable::MatchRow
@@ -1,2 +1,154 @@
-Failed to decompile msi.dll - .ProgramDB CMsiTable::MatchRow : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

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

+   guard_dispatch_icall */

+/* public: enum Bool __cdecl CMsiTable::MatchRow(int & __ptr64,unsigned int * __ptr64) __ptr64 */

+

+Bool __thiscall CMsiTable::MatchRow(CMsiTable *this,int *param_1,uint *param_2)

+

+{

+  uint *puVar1;

+  uint uVar2;

+  uint uVar3;

+  code *pcVar4;

+  bool bVar5;

+  int iVar6;

+  int iVar7;

+  longlong lVar8;

+  IMsiString *pIVar9;

+  IMsiSummaryInfo **ppIVar10;

+  undefined8 uVar11;

+  longlong *plVar12;

+  IMsiData *pIVar13;

+  int iVar14;

+  uint *puVar15;

+  ulonglong _Size;

+  Bool BVar16;

+  LPCRITICAL_SECTION lpCriticalSection;

+  void *pvVar17;

+  undefined1 auStack_b8 [48];

+  longlong *local_88;

+  uint *local_80;

+  longlong local_78;

+  void *local_70 [3];

+  void *local_58;

+  uint local_50;

+  ulonglong local_40;

+  

+  local_40 = __security_cookie ^ (ulonglong)auStack_b8;

+  lpCriticalSection = (LPCRITICAL_SECTION)(*(longlong *)(this + 0x10) + 0xa0);

+  local_80 = param_2;

+  EnterCriticalSection(lpCriticalSection);

+  BVar16 = 1;

+  puVar1 = (uint *)(*(longlong *)(this + 0x28) +

+                   (longlong)((*param_1 + -1) * *(int *)(this + 0x3c)) * 4);

+  iVar14 = *(int *)(this + 0x50) + 1;

+  lVar8 = (longlong)iVar14;

+  if (*(int *)(this + 0x44) < lVar8) {

+LAB_0:

+    *puVar1 = *puVar1 & 0xefffffff;

+  }

+  else {

+    puVar15 = puVar1 + lVar8;

+    while( true ) {

+      uVar2 = *puVar15;

+      uVar3 = *(uint *)(((longlong)param_2 - (longlong)puVar1) + (longlong)puVar15);

+      if (uVar2 != uVar3) break;

+      iVar14 = iVar14 + 1;

+      lVar8 = lVar8 + 1;

+      puVar15 = puVar15 + 1;

+      if (*(int *)(this + 0x44) < lVar8) goto LAB_0;

+    }

+    if (((uVar3 == 0) || (uVar2 == 0)) ||

+       (local_78 = (longlong)iVar14, (*(ushort *)(this + local_78 * 2 + 0xf8) & 0xd00) != 0x900))

+    goto LAB_1;

+    local_88 = (longlong *)0x0;

+    if (uVar2 == 1) {

+      pIVar9 = CMsiDatabase::DecodeStringNoRef

+                         (*(CMsiDatabase **)(this + 0x10),*(uint *)(this + 0x18));

+      pIVar9 = CMsiDatabase::ComputeStreamName

+                         (*(CMsiDatabase **)(this + 0x10),pIVar9,puVar1 + 1,(ushort *)(this + 0xfa))

+      ;

+      plVar12 = *(longlong **)(this + 0x48);

+      pcVar4 = *(code **)(*plVar12 + 0x38);

+      ppIVar10 = CComPointer<IMsiSummaryInfo>::operator&((CComPointer<IMsiSummaryInfo> *)&local_88);

+      uVar11 = (**(code **)(*(longlong *)pIVar9 + 0x50))(pIVar9);

+      plVar12 = (longlong *)(*pcVar4)(plVar12,uVar11,0,ppIVar10);

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

+        (**(code **)(*plVar12 + 0x10))(plVar12);

+        (**(code **)(*(longlong *)pIVar9 + 0x10))(pIVar9);

+        goto LAB_2;

+      }

+      (**(code **)(*(longlong *)pIVar9 + 0x10))(pIVar9);

+      param_2 = local_80;

+    }

+    else {

+      pIVar13 = GetObjectDataProc(uVar2);

+      CComPointer<IMsiTable>::operator=((CComPointer<IMsiTable> *)&local_88,(IMsiTable *)pIVar13);

+      (**(code **)(*local_88 + 8))();

+    }

+    pIVar13 = GetObjectDataProc(param_2[local_78]);

+    iVar14 = (**(code **)(*local_88 + 0x20))();

+    iVar6 = (**(code **)(*(longlong *)pIVar13 + 0x20))(pIVar13);

+    if (iVar14 != iVar6) goto LAB_3;

+    bVar5 = wil::details::FeatureImpl<__WilFeatureTraits_Feature_3530265912>::__private_IsEnabled

+                      ((FeatureImpl<__WilFeatureTraits_Feature_3530265912> *)

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

+                        ::__l2::impl);

+    if ((bVar5) && (iVar14 < 0)) {

+      *puVar1 = *puVar1 | 0x10000000;

+LAB_2:

+      CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                ((CComPointer<IXMLDOMElement> *)&local_88);

+      LeaveCriticalSection(lpCriticalSection);

+      return 0;

+    }

+    CTempBuffer<char,1>::CTempBuffer<char,1>((CTempBuffer<char,1> *)&local_58,0x400);

+    CTempBuffer<char,1>::CTempBuffer<char,1>((CTempBuffer<char,1> *)local_70,0x400);

+    if ((local_58 == (void *)0x0) || (local_70[0] == (void *)0x0)) {

+      BVar16 = 0;

+    }

+    else {

+      _Size = (ulonglong)local_50;

+      pvVar17 = local_58;

+      do {

+        iVar6 = iVar14;

+        if ((int)_Size <= iVar14) {

+          iVar6 = (int)_Size;

+        }

+        _Size = (ulonglong)iVar6;

+        (**(code **)(*local_88 + 0x40))(local_88,pvVar17,iVar6);

+        (**(code **)(*(longlong *)pIVar13 + 0x40))(pIVar13,local_70[0],iVar6);

+        pvVar17 = local_58;

+        iVar7 = memcmp(local_58,local_70[0],_Size);

+      } while ((iVar7 == 0) && (iVar14 = iVar14 - iVar6, iVar14 != 0));

+      (**(code **)(*local_88 + 0x70))();

+      (**(code **)(*(longlong *)pIVar13 + 0x70))(pIVar13);

+      if (iVar14 != 0) {

+        CTempBuffer<unsigned_char,1>::~CTempBuffer<unsigned_char,1>

+                  ((CTempBuffer<unsigned_char,1> *)local_70);

+        CTempBuffer<unsigned_char,1>::~CTempBuffer<unsigned_char,1>

+                  ((CTempBuffer<unsigned_char,1> *)&local_58);

+LAB_3:

+        CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+                  ((CComPointer<IXMLDOMElement> *)&local_88);

+LAB_1:

+        *puVar1 = *puVar1 | 0x10000000;

+        BVar16 = 0;

+        goto LAB_4;

+      }

+      *puVar1 = *puVar1 & 0xefffffff;

+      BVar16 = 1;

+    }

+    CTempBuffer<unsigned_char,1>::~CTempBuffer<unsigned_char,1>

+              ((CTempBuffer<unsigned_char,1> *)local_70);

+    CTempBuffer<unsigned_char,1>::~CTempBuffer<unsigned_char,1>

+              ((CTempBuffer<unsigned_char,1> *)&local_58);

+    CComPointer<IXMLDOMElement>::~CComPointer<IXMLDOMElement>

+              ((CComPointer<IXMLDOMElement> *)&local_88);

+  }

+LAB_4:

+  LeaveCriticalSection(lpCriticalSection);

+  return BVar16;

+}

+
```

## `CTempBuffer<unsigned_short,1>::~CTempBuffer<unsigned_short,1>`  (modified)

```diff
--- CTempBuffer<unsigned_short,1>::~CTempBuffer<unsigned_short,1>
+++ ExtendOutputBuffer
@@ -1,2 +1,23 @@
-Failed to decompile msi.dll - .ProgramDB CTempBuffer<unsigned_short,1>::~CTempBuffer<unsigned_short,1> : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+long ExtendOutputBuffer(CTempBufferRef<unsigned_short> *param_1,int param_2,int param_3)

+

+{

+  int iVar1;

+  long lVar2;

+  int local_res10 [2];

+  

+  local_res10[0] = 0;

+  lVar2 = LongLongToInt((longlong)param_2 + (longlong)param_3,local_res10);

+  iVar1 = local_res10[0];

+  if (-1 < lVar2) {

+    if (*(int *)(param_1 + 8) < local_res10[0]) {

+      CTempBufferRef<unsigned_short>::Resize(param_1,local_res10[0] + 0x100);

+    }

+    lVar2 = -0x7ff8fff2;

+    if ((*(longlong *)param_1 != 0) && (lVar2 = -0x7ff8fff2, iVar1 <= *(int *)(param_1 + 8))) {

+      lVar2 = 0;

+    }

+  }

+  return lVar2;

+}

+
```

## `KERNEL32.DLL::AcquireSRWLockExclusive`  (modified)

```diff
--- KERNEL32.DLL::AcquireSRWLockExclusive calling
+++ KERNEL32.DLL::AcquireSRWLockExclusive calling
@@ -8,0 +9,5 @@
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::GetCachedFeatureEnabledState
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_1450939707>::GetCachedFeatureEnabledState
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_176919867>::GetCachedFeatureEnabledState
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_1834194232>::GetCachedFeatureEnabledState
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_251367739>::GetCachedFeatureEnabledState
@@ -9,0 +15,2 @@
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_3530265912>::GetCachedFeatureEnabledState
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_3594491195>::GetCachedFeatureEnabledState
@@ -11 +18,2 @@
-wil::details::FeatureImpl<__WilFeatureTraits_Feature_531045689>::GetCachedFeatureEnabledState
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_502502712>::GetCachedFeatureEnabledState
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_63156538>::GetCachedFeatureEnabledState
@@ -16 +23,0 @@
-wil::details::FeatureImpl<__WilFeatureTraits_Feature_KVS_BugFixes_55830887>::GetCachedFeatureEnabledState
@@ -19 +25,0 @@
-wil::details::FeatureImpl<__WilFeatureTraits_Feature_Servicing_MSI_PathEvalFix>::GetCachedFeatureEnabledState
@@ -25 +30,0 @@
-wil::details::FeatureImpl<__WilFeatureTraits_Feature_UxLabTest>::GetCachedFeatureEnabledState
```

## `KERNEL32.DLL::GetTickCount`  (modified)

```diff
--- KERNEL32.DLL::GetTickCount calling
+++ KERNEL32.DLL::GetTickCount calling
@@ -13,0 +14,5 @@
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_126862651>::__private_IsEnabled
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_1450939707>::__private_IsEnabled
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_176919867>::__private_IsEnabled
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_1834194232>::__private_IsEnabled
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_251367739>::__private_IsEnabled
@@ -14,0 +20,2 @@
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_3530265912>::__private_IsEnabled
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_3594491195>::__private_IsEnabled
@@ -16 +23,2 @@
-wil::details::FeatureImpl<__WilFeatureTraits_Feature_531045689>::__private_IsEnabled
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_502502712>::__private_IsEnabled
+wil::details::FeatureImpl<__WilFeatureTraits_Feature_63156538>::__private_IsEnabled
@@ -21 +28,0 @@
-wil::details::FeatureImpl<__WilFeatureTraits_Feature_KVS_BugFixes_55830887>::__private_IsEnabled
@@ -23 +29,0 @@
-wil::details::FeatureImpl<__WilFeatureTraits_Feature_Servicing_MSI_PathEvalFix>::__private_IsEnabled
```
