PopUpdateUpgradeInProgress

NTSTATUS __stdcall PopUpdateUpgradeInProgress(HANDLE KeyHandle){
  WCHAR v1; 
  HANDLE v3; 
  NTSTATUS result; 
  BOOL WatchTree; 
  BOOL Asynchronous; 
  void *KeyHandlea; 
  ULONG ResultLength; 
  struct _UNICODE_STRING DestinationString; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  __int128 KeyValueInformation; 
  int v12; 
  ResultLength = 0;
  KeyHandlea = KeyHandle;
  v12 = 0;
  v3 = KeyHandle;
  memset(&ObjectAttributes, 0, sizeof(ObjectAttributes));
  KeyValueInformation = 0i64;
  DestinationString = 0i64;
  if( !KeyHandle )
  {
    RtlInitUnicodeString(&DestinationString, L"\\Registry\\Machine\\System\\Setup", v1);
    ObjectAttributes.RootDirectory = 0i64;
    ObjectAttributes.ObjectName = &DestinationString;
    ObjectAttributes.Length = 48;
    ObjectAttributes.Attributes = 576;
    *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
    result = ZwOpenKey(&KeyHandlea, 0x20019u, &ObjectAttributes);
    if( result < 0 )
      goto LABEL_13;
    v3 = KeyHandlea;
  }
  RtlInitUnicodeString(&DestinationString, L"SystemSetupInProgress", v1);
  result = ZwQueryValueKey(
             v3,
             &DestinationString,
             KeyValuePartialInformation,
             &KeyValueInformation,
             0x14u,
             &ResultLength);
  if( result < 0 || *(_QWORD *)((char *)&KeyValueInformation + 4) != 0x400000004i64 || !HIDWORD(KeyValueInformation) )
  {
    if( KeyHandle )
    {
      PopAcquirePolicyLock();
      PopRemoveReasonRecordByReasonCode(0xFui64);
      PopReleasePolicyLock();
    }
    goto LABEL_13;
  }
  if( !KeyHandle && (result = PopLogSleepDisabled(0xFui64, 8ui64, 0i64, 0i64), result < 0)
    || (*(_QWORD *)PopSetupInProgressUpdateWorkItem = 0i64,
        LOBYTE(Asynchronous) = 1,
        qword_140C24EB0 = (__int64)PopUpdateUpgradeInProgress,
        LOBYTE(WatchTree) = 0,
        qword_140C24EB8 = (__int64)KeyHandlea,
        result = ZwNotifyChangeKey(
                   KeyHandlea,
                   0i64,
                   PopSetupInProgressUpdateWorkItem,
                   (PVOID)1,
                   &PopSetupInProgressStatusBlock,
                   4u,
                   WatchTree,
                   0i64,
                   0,
                   Asynchronous),
        result < 0) )
  {
LABEL_13:
    if( KeyHandlea )
      return ZwClose(KeyHandlea);
  }
  return result;
}

Referenced by:

PoInitSystem