SepRmGlobalSaclSetWrkr

VOID __stdcall SepRmGlobalSaclSetWrkr(_RM_COMMAND_MESSAGE *CommandMessage, _RM_REPLY_MESSAGE *ReplyMessage){
  UINT64 v2; 
  char *v3; 
  char v5; 
  NTSTATUS GlobalSacl; 
  INT64 v7; 
  _ETHREAD *CurrentThread; 
  _SEP_GLOBAL_SACL *v9; 
  void *v10; 
  void *v11; 
  void *v12; 
  VOID **PoolWithTag; 
  VOID **v14; 
  VOID **v15; 
  unsigned __int16 MaximumLength; 
  UINT8 *v17; 
  _UNICODE_STRING ObjectType; 
  UINT64 AclSize; 
  UINT8 *ppSacl; 
  _SEP_GLOBAL_SACL *Match; 
  _SEP_GLOBAL_SACL *Previous; 

  v2 = *((unsigned __int16 *)CommandMessage + 22);
  v3 = (char *)CommandMessage + 46;
  Match = 0i64;
  Previous = 0i64;
  LODWORD(AclSize) = 0;
  ppSacl = 0i64;
  *(_DWORD *)(&ObjectType.MaximumLength + 1) = 0;
  ObjectType.MaximumLength = v2;
  ObjectType.Length = v2;
  v5 = 0;
  ObjectType.Buffer = (wchar_t *)CommandMessage + 23;
  GlobalSacl = SepRmFetchGlobalSacl(&ObjectType, &AclSize, &ppSacl);
  if( GlobalSacl >= 0 )
  {
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    --CurrentThread->Tcb.KernelApcDisable;
    v5 = 1;
    ExAcquireResourceExclusiveLite((UINT64)&unk_140CEC530, 1, v7);
    GlobalSacl = SepRmGlobalSaclFind(&Match, &Previous, &ObjectType, 0);
    if( GlobalSacl < 0 )
    {
      if( !(_DWORD)AclSize )
        goto LABEL_2;
      PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x20ui64, 1818448711i64);
      if( PoolWithTag )
      {
        v14 = ExAllocatePoolWithTag(1ui64, v2, 1818448711i64);
        PoolWithTag[2] = v14;
        v15 = v14;
        if( v14 )
        {
          MaximumLength = ObjectType.MaximumLength;
          *((_WORD *)PoolWithTag + 5) = ObjectType.MaximumLength;
          *((_WORD *)PoolWithTag + 4) = MaximumLength;
          memmove(v15, v3, v2);
          v17 = ppSacl;
          ppSacl = 0i64;
          PoolWithTag[3] = v17;
          *PoolWithTag = (VOID *)SepRmGlobalSaclHead;
          SepRmGlobalSaclHead = (__int64)PoolWithTag;
          goto LABEL_2;
        }
        ExFreePoolWithTag(PoolWithTag, 0);
      }
      GlobalSacl = -1073741801;
      goto LABEL_2;
    }
    v9 = Match;
    if( (_DWORD)AclSize )
    {
      v10 = (void *)*((_QWORD *)Match + 3);
      if( v10 )
        ExFreePoolWithTag(v10, 0);
      *((_QWORD *)v9 + 3) = ppSacl;
      goto LABEL_11;
    }
    if( Previous )
      *(_QWORD *)Previous = *(_QWORD *)Match;
    else
      SepRmGlobalSaclHead = *(_QWORD *)Match;
    v11 = (void *)*((_QWORD *)v9 + 2);
    if( v11 )
    {
      ExFreePoolWithTag(v11, 0);
      *((_QWORD *)v9 + 2) = 0i64;
    }
    v12 = (void *)*((_QWORD *)v9 + 3);
    if( v12 )
    {
      ExFreePoolWithTag(v12, 0);
      *((_QWORD *)v9 + 3) = 0i64;
    }
    ExFreePoolWithTag(v9, 0);
  }
LABEL_2:
  if( ppSacl )
    ExFreePoolWithTag(ppSacl, 0);
  if( v5 )
  {
LABEL_11:
    ExReleaseResourceLite(&unk_140CEC530);
    KeLeaveCriticalRegion();
  }
  ReplyMessage[10] = GlobalSacl;
}

Referenced by:

No references.