SeAssignWorldSecurityDescriptor

INT64 __stdcall SeAssignWorldSecurityDescriptor(VOID *SecurityDescriptor, UINT64 *Length, UINT64 *SecurityInformation){
  UINT8 *v6; 
  unsigned int v7; 
  unsigned int v8; 
  unsigned int v9; 
  UINT64 v10; 
  UINT8 *v11; 
  int v12; 
  __int16 v13; 
  if( !SecurityInformation )
    return 3221225506i64;
  v6 = (UINT8 *)SeWorldSid;
  v7 = 4 * *((unsigned __int8 *)SeWorldSid + 1) + 8;
  v8 = *(_DWORD *)Length;
  v9 = 2 * v7 + 20;
  *(_DWORD *)Length = v9;
  if( v8 < v9 )
    return 3221225507i64;
  v10 = v7;
  v11 = (UINT8 *)SecurityDescriptor + 20;
  *(_OWORD *)SecurityDescriptor = 0i64;
  *((_DWORD *)SecurityDescriptor + 4) = 0;
  *(_BYTE *)SecurityDescriptor = 1;
  v12 = *(_DWORD *)SecurityInformation;
  if( (*(_DWORD *)SecurityInformation & 1) != 0 )
  {
    memmove((UINT8 *)SecurityDescriptor + 20, v6, v7);
    *((_DWORD *)SecurityDescriptor + 1) = 20;
    v11 += v10;
    v12 = *(_DWORD *)SecurityInformation;
  }
  if( (v12 & 2) != 0 )
  {
    memmove(v11, v6, v10);
    *((_DWORD *)SecurityDescriptor + 2) = (_DWORD)v11 - (_DWORD)SecurityDescriptor;
    v12 = *(_DWORD *)SecurityInformation;
  }
  if( (v12 & 4) != 0 )
  {
    *((_WORD *)SecurityDescriptor + 1) |= 4u;
    v12 = *(_DWORD *)SecurityInformation;
  }
  v13 = *((_WORD *)SecurityDescriptor + 1);
  if( (v12 & 8) != 0 )
    v13 |= 0x10u;
  *((_WORD *)SecurityDescriptor + 1) = v13 | 0x8000;
  return 0i64;
}

Referenced by:

IopGetSetSecurityObject