AuthzBasepAddSecurityAttribute

INT64 __fastcall AuthzBasepAddSecurityAttribute(INT64 a1, INT64 a2){
  bool v2; 
  UNICODE_STRING *SecurityAttribute; 
  UINT8 v6; 
  __int64 v7; 
  UNICODE_STRING *v8; 
  UNICODE_STRING *v9; 
  INT64 v10; 
  UNICODE_STRING pAttributeName; 
  v2 = *(_DWORD *)(a2 + 24) == 0;
  pAttributeName = 0i64;
  if( v2 )
    return 3221225485i64;
  pAttributeName.Length = *(_WORD *)a2;
  pAttributeName.MaximumLength = pAttributeName.Length;
  pAttributeName.Buffer = *(wchar_t **)(a2 + 8);
  SecurityAttribute = AuthzBasepFindSecurityAttribute(a1, &pAttributeName);
  v8 = SecurityAttribute;
  if( SecurityAttribute )
  {
    LODWORD(SecurityAttribute[3].Buffer) &= ~4u;
    goto LABEL_5;
  }
  v9 = AuthzBasepAllocateSecurityAttribute(&pAttributeName, v6);
  v8 = v9;
  if( v9 )
  {
    *(_DWORD *)(&v9[3].MaximumLength + 1) = *(_DWORD *)(a2 + 20);
    v9[3].Length = *(_WORD *)(a2 + 16);
LABEL_5:
    LOBYTE(v7) = 1;
    AuthzBasepAddSecurityAttributeToLists(a1, v8, 0i64, v7);
    return AuthzBasepAddSecurityAttributeValues(v10, a2);
  }
  return 3221225626i64;
}

Referenced by:

AuthzBasepReplaceSecurityAttribute
AuthzBasepSetSecurityAttributesToken