IopProtectSystemPartition

UINT8 __stdcall IopProtectSystemPartition(_LOADER_PARAMETER_BLOCK *LoaderBlock){
  WCHAR v1; 
  WCHAR v2; 
  UINT64 Length; 
  UINT64 ResultLength; 
  void *KeyHandle; 
  struct _UNICODE_STRING DestinationString; 
  struct _UNICODE_STRING ValueName; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  char KeyValueInformation[80]; 
  KeyHandle = 0i64;
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  LODWORD(ResultLength) = 0;
  DestinationString = 0i64;
  ValueName = 0i64;
  RtlInitUnicodeString(&DestinationString, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Lsa", v1);
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.ObjectName = &DestinationString;
  ObjectAttributes.Length = 48;
  ObjectAttributes.Attributes = 64;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  if( NtOpenKey(&KeyHandle, 0x20019ui64, &ObjectAttributes) >= 0 )
  {
    RtlInitUnicodeString(&ValueName, L"Protect System Partition", v2);
    LODWORD(Length) = 20;
    if( (int)NtQueryValueKey(
                KeyHandle,
                &ValueName,
                KeyValuePartialInformation,
                KeyValueInformation,
                Length,
                &ResultLength) >= 0
      && KeyValueInformation[12] )
    {
      IopApplySystemPartitionProt();
    }
    NtClose(KeyHandle);
  }
  return 1;
}

Referenced by:

IoInitSystemPreDrivers