PiPnpRtlApplyMandatoryFilters

VOID __fastcall PiPnpRtlApplyMandatoryFilters(){
  void *v0; 
  INT64 v1; 
  int v2; 
  SECURITY_SUBJECT_CONTEXT *v3; 
  SECURITY_SUBJECT_CONTEXT *v4; 
  INT64 v5; 
  SECURITY_SUBJECT_CONTEXT *v6; 
  int v7; 
  void *v8; 
  void *ClientToken; 
  INT64 v10; 
  UINT8 *v11; 
  int v12; 
  int v13; 
  NTSTATUS v14; 
  char v15; 
  char IsServiceSession[40]; 
  SECURITY_SUBJECT_CONTEXT *SessionId; 
  UINT8 *a5; 
  v4 = SessionId;
  v5 = v1;
  IsServiceSession[0] = 0;
  v6 = v3;
  v7 = v2;
  v8 = v0;
  ClientToken = SessionId->ClientToken;
  if( !SessionId->ClientToken )
    ClientToken = SessionId->PrimaryToken;
  if( SeQuerySessionIdTokenEx(ClientToken, (UINT64 *)&SessionId, (UINT8 *)IsServiceSession) >= 0 )
  {
    if( !IsServiceSession[0] )
      goto LABEL_5;
    LOBYTE(SessionId) = 0;
    v14 = PiAuVerifyAccessToObject(
            0xF0000ui64,
            PiAuLocalSystemSecurityObject,
            (GENERIC_MAPPING *)&PiAuLocalSystemSecurityMapping,
            v4,
            (UINT8 *)&SessionId);
    v15 = (char)SessionId;
    if( v14 < 0 )
      v15 = 0;
    if( v14 >= 0 )
    {
      if( v15 )
      {
        v11 = a5;
        goto LABEL_14;
      }
LABEL_5:
      v11 = a5;
      v12 = v7 - 1;
      if( !v12 )
      {
        PiPnpRtlApplyMandatoryDeviceFilters(v5, v8, v6, (UINT8 *)v4, a5);
        return;
      }
      v13 = v12 - 2;
      if( !v13 )
      {
        PiPnpRtlApplyMandatoryDeviceInterfaceFilters(v5, (INT64)v8, (INT64)v6, v4, a5);
        return;
      }
      if( v13 == 2 )
      {
        PiPnpRtlApplyMandatoryDeviceContainerFilters(v5, (WCHAR *)v8, v10, (INT64)v4, a5);
        return;
      }
LABEL_14:
      *v11 = 1;
    }
  }
}

Referenced by:

IoGetDeviceInterfaceAlias
IopDeviceInterfaceFilterCallback
IopGetDeviceInterfaces
PiCMMandatoryFilterCallback
PiCMValidateDeviceInstance
PiDqQueryApplyObjectEvent
PiDqQueryEnumObject
PiUEventApplyAdditionalFilters