WdipSemEnableContextProvider

NTSTATUS __fastcall WdipSemEnableContextProvider(_GUID *ProviderGuid){
  _ETHREAD *CurrentThread; 
  int v2; 
  __int64 v4; 
  UINT8 v5; 
  UINT8 v6; 
  __int64 v7; 
  int v8; 
  __int64 v9; 
  int v10; 
  UINT64 EnableProperty; 
  UINT64 ControlCode; 

  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  v2 = 0;
  --CurrentThread->Tcb.KernelApcDisable;
  ExAcquirePushLockExclusiveEx(&stru_140C1C3C8, 0i64);
  if( !ProviderGuid )
  {
    v2 = -1073741811;
    goto LABEL_9;
  }
  if( ProviderGuid[2].Data1 != 1 )
  {
    v4 = *(_QWORD *)ProviderGuid[2].Data4;
    v5 = BYTE2(ProviderGuid[1].Data1);
    v6 = *(_BYTE *)(v4 + 48);
    v7 = *(_QWORD *)(v4 + 56);
    v8 = *(_DWORD *)(v4 + 64);
    if( v5 <= v6 )
      v5 = *(_BYTE *)(v4 + 48);
    v9 = v7 | *(_QWORD *)ProviderGuid[1].Data4;
    v10 = v8 | *(_DWORD *)&ProviderGuid[2].Data2;
    if( *(_BYTE *)(v4 + 69) && v9 == v7 && v5 == v6 && v10 == v8 )
      goto LABEL_8;
    LODWORD(ControlCode) = 1;
    LODWORD(EnableProperty) = v8 | *(_DWORD *)&ProviderGuid[2].Data2;
    v2 = WdipSemEnableDisableTrace(
           (unsigned int)_InterlockedExchange(&WdipContextLoggerId, WdipContextLoggerId),
           ProviderGuid,
           v5,
           v7 | *(_QWORD *)ProviderGuid[1].Data4,
           EnableProperty,
           ControlCode);
    if( v2 >= 0 )
    {
      *(_BYTE *)(v4 + 69) = 1;
      *(_QWORD *)(v4 + 56) = v9;
      *(_BYTE *)(v4 + 48) = v5;
      *(_DWORD *)(v4 + 64) = v10;
LABEL_8:
      ++*(_DWORD *)(v4 + 72);
    }
  }
LABEL_9:
  ExReleasePushLockEx((ULONG_PTR)&stru_140C1C3C8, 0);
  KeLeaveCriticalRegionThread(KeGetCurrentThread());
  return v2;
}

Referenced by:

WdipSemEnableContextProviders