IopGetPersistedStateLocation

NTSTATUS __stdcall IopGetPersistedStateLocation(INT64 a1, _WORD *a2, INT64 a3, CHAR **a4){
  UINT64 v6; 
  VOID **a5; 
  int PersistedStateLocation; 
  NTSTATUS result; 
  INT64 a6; 
  INT64 a7; 

  LODWORD(a7) = 0;
  v6 = 256i64;
  while( 1 )
  {
    a5 = ExAllocatePoolWithTag(1ui64, v6, 1665560393i64);
    if( !a5 )
    {
      PersistedStateLocation = -1073741670;
      goto LABEL_10;
    }
    LODWORD(a6) = v6;
    PersistedStateLocation = RtlGetPersistedStateLocation(
                               (WCHAR *)L"SecureDeviceClass",
                               0i64,
                               a2,
                               0i64,
                               a5,
                               a6,
                               (INT64)&a7);
    if( PersistedStateLocation != -2147483643 )
      break;
    if( (unsigned int)a7 <= (unsigned int)v6 )
    {
      PersistedStateLocation = -1073741595;
      break;
    }
    v6 = (unsigned int)a7;
    ExFreePoolWithTag(a5, 0);
  }
  if( PersistedStateLocation >= 0 )
    goto LABEL_5;
LABEL_10:
  if( a5 )
  {
    ExFreePoolWithTag(a5, 0);
    a5 = 0i64;
  }
LABEL_5:
  result = PersistedStateLocation;
  *a4 = (CHAR *)a5;
  return result;
}

Referenced by:

IopCreateSecureDeviceClassSettings