WdipSemWriteSemActionsEvent

NTSTATUS __stdcall WdipSemWriteSemActionsEvent(_GUID *ActivityId, INT64 a2){
  __int64 v4; 
  const in6_addr *v5; 
  int v6; 
  int v7; 
  __int64 v8; 
  int v9; 
  _BYTE *v10; 
  _BYTE *v11; 
  __int64 v12; 
  int v13; 
  __int64 *v14; 
  int v16; 
  int TraceInformation; 
  __int64 Buffer; 
  unsigned int AddressStringLength[2]; 
  __int64 v20[255]; 
  __int64 v21[124]; 

  memset(v21, 0i64, sizeof(v21));
  v16 = 0;
  v4 = 0i64;
  if( !ActivityId )
    return -1073741811;
  if( !a2 )
    return -1073741811;
  LODWORD(Buffer) = _InterlockedExchange(&WdipContextLoggerId, WdipContextLoggerId);
  TraceInformation = 0;
  if( !(_DWORD)Buffer )
    return -1073741811;
  v6 = WmiQueryTraceInformation(LoggerEventsLostClass, &TraceInformation, 4ui64, 0i64, &Buffer);
  v7 = v16;
  if( v6 >= 0 )
    v7 = TraceInformation;
  v16 = v7;
  if( v6 >= 0 )
  {
    v8 = *(_QWORD *)(a2 + 32);
    v9 = *(_DWORD *)(v8 + 48);
    v20[1] = v8 + 16;
    v20[3] = (__int64)&v16;
    *(_QWORD *)AddressStringLength = v8;
    v20[0] = 16i64;
    v20[2] = 2i64;
    v20[4] = 4i64;
    v20[5] = v8 + 48;
    v20[6] = 4i64;
    if( *(_DWORD *)(v8 + 48) )
    {
      while( 1 )
      {
        Buffer = *(_QWORD *)(v8 + 8 * v4 + 56);
        v10 = WdipSemFastAllocate(WDI_SEM_ALLOC_ACTION, 0x28ui64);
        v11 = v10;
        if( !v10 )
          break;
        v12 = Buffer;
        v21[v4] = (__int64)v10;
        *(_OWORD *)v10 = *(_OWORD *)v12;
        v10[16] = *(_BYTE *)(v12 + 18);
        *((_QWORD *)v10 + 3) = *(_QWORD *)(v12 + 24);
        *((_DWORD *)v10 + 8) = *(_DWORD *)(v12 + 36);
        v5 = (const in6_addr *)(2i64 * (unsigned int)(v4 + 4));
        v13 = *(_DWORD *)(a2 + 4 * v4 + 48);
        v4 = (unsigned int)(v4 + 1);
        *((_DWORD *)v11 + 9) = v13;
        HIDWORD(v20[(_QWORD)v5]) = 0;
        *(_QWORD *)&AddressStringLength[2 * (_QWORD)v5] = v11;
        LODWORD(v20[(_QWORD)v5]) = 40;
        if( (unsigned int)v4 >= *(_DWORD *)(v8 + 48) )
          goto LABEL_10;
      }
      v6 = -1073741670;
    }
    else
    {
LABEL_10:
      v6 = WdipSemWriteEvent(v5, (ULONG)ActivityId, a2 + 16, (PSTR)(unsigned int)(v9 + 4), AddressStringLength);
    }
    if( (_DWORD)v4 )
    {
      v14 = v21;
      do
      {
        WdipSemFastFree(4i64, (_SLIST_ENTRY *)*v14++);
        --v4;
      }
      while( v4 );
    }
  }
  return v6;
}

Referenced by:

WdipSemDisableScenario
WdipSemEnableScenario