Função UMDEtwRegister (umdprovider.h)
Registra o provedor de rastreamento de eventos. O driver deve chamar essa função antes de fazer chamadas para eventos de log.
Sintaxe
void UMDEtwRegister(
PFNUMDETW_RUNDOWN CbRundown
);
Parâmetros
CbRundown
Um ponteiro para uma função de retorno de chamada que retorna informações sobre o estado atual do driver do modo de usuário.
Essa função de retorno de chamada deve chamar a função UMDEtwLogMapAllocation para cada mapeamento de alocação atual.
Valor de retorno
Nenhum
Observações
O tipo de dados do parâmetro CbRundown é definido como:
typedef void (*PFNUMDETW_RUNDOWN)();
UMDEtwRegister é definido embutido em Umdprovider.h como:
// GUID for UMD ETW provider
// {A688EE40-D8D9-4736-B6F9-6B74935BA3B1}
static const GUID UMDEtwProviderId =
{ 0xa688ee40, 0xd8d9, 0x4736, { 0xb6, 0xf9, 0x6b, 0x74, 0x93, 0x5b, 0xa3, 0xb1 } };
// Registration handle, returned by EventRegister and passed to EventUnregister
__declspec(selectany) REGHANDLE RegHandle = NULL;
// Whether any level of logging is enabled.
__declspec(selectany) BOOLEAN Enabled = FALSE;
// Whether we are currently in a rundown
__declspec(selectany) BOOLEAN InRundown = FALSE;
// Callback to the driver when a rundown is needed
__declspec(selectany) PFNUMDETW_RUNDOWN Rundown = NULL;
FORCEINLINE void NTAPI EnableCallback(
__in LPCGUID SourceId,
__in ULONG IsEnabled,
__in UCHAR Level,
__in ULONGLONG MatchAnyKeyword,
__in ULONGLONG MatchAllKeywords,
__in_opt PEVENT_FILTER_DESCRIPTOR FilterData,
__in_opt PVOID CallbackContext
)
{
switch (IsEnabled)
{
case EVENT_CONTROL_CODE_DISABLE_PROVIDER:
Enabled = FALSE;
break;
case EVENT_CONTROL_CODE_ENABLE_PROVIDER:
Enabled = TRUE;
break;
case EVENT_CONTROL_CODE_CAPTURE_STATE:
// Temporarily enable logging during the rundown
BOOLEAN OldEnabled = Enabled;
Enabled = TRUE;
InRundown = TRUE;
Rundown();
InRundown = FALSE;
// Restore Enabled to its original state
Enabled = OldEnabled;
break;
}
}
FORCEINLINE void UMDEtwRegister(PFNUMDETW_RUNDOWN RundownCb)
{
Rundown = RundownCb;
// Register the provider
EventRegister(&UMDEtwProviderId,
EnableCallback,
NULL,
&RegHandle);
}
A função EventRegister e os valores EVENT_CONTROL_CODE_XXX são descritos na documentação eventos do Windows.
Requisitos
Requisito | Valor |
---|---|
de cliente com suporte mínimo | Windows 8 |
servidor com suporte mínimo | Windows Server 2012 |
da Plataforma de Destino | Área de trabalho |
cabeçalho | umdprovider.h (include Umdprovider.h) |