WmipSaveGuidSecurityDescriptor

NTSTATUS __stdcall WmipSaveGuidSecurityDescriptor(PUNICODE_STRING GuidName, PSECURITY_DESCRIPTOR SecurityDescriptor){
  VOID **a5; 
  NTSTATUS v5; 
  unsigned int v6; 
  NTSTATUS PersistedStateLocation; 
  NTSTATUS v8; 
  INT64 a6; 
  INT64 a7; 

  a5 = 0i64;
  v5 = RtlLengthSecurityDescriptor((INT64)SecurityDescriptor);
  v6 = 0;
  LODWORD(a7) = 0;
  while( 1 )
  {
    if( v6 )
    {
      a5 = ExAllocatePoolWithTag(1ui64, v6, 1885957463i64);
      if( !a5 )
        return -1073741670;
    }
    LODWORD(a6) = v6;
    PersistedStateLocation = RtlGetPersistedStateLocation(
                               (WCHAR *)&ExceptionFrame.P5,
                               0i64,
                               0i64,
                               0i64,
                               a5,
                               a6,
                               (INT64)&a7);
    v8 = PersistedStateLocation;
    if( PersistedStateLocation != -2147483643 )
      break;
    if( a5 )
    {
      ExFreePoolWithTag(a5, 0);
      a5 = 0i64;
    }
    v6 = a7;
  }
  if( !PersistedStateLocation )
  {
    LODWORD(a6) = v5;
    v8 = RtlWriteRegistryValue(0i64, (const WCHAR *)a5, GuidName->Buffer, 3ui64, SecurityDescriptor, a6);
  }
  if( v8 == -1073741772 )
  {
    LODWORD(a6) = v5;
    v8 = RtlWriteRegistryValue(2ui64, (const WCHAR *)&ExceptionFrame, GuidName->Buffer, 3ui64, SecurityDescriptor, a6);
  }
  if( a5 )
    ExFreePoolWithTag(a5, 0);
  return v8;
}

Referenced by:

WmipSecurityMethod