windows: fix perfctr crash on XP and 2003

Some performance counter related functions are not available on Windows
XP and Windows Server 2003, which caused node to call a NULL pointer.

Closes #4462
Closes #4511
pull/24504/head
Scott Blomquist 2013-01-02 18:06:41 -08:00 committed by Bert Belder
parent a7d8c21bca
commit 5a39df4959
1 changed files with 7 additions and 0 deletions

View File

@ -172,6 +172,13 @@ void InitPerfCountersWin32() {
ZeroMemory(&providerContext, sizeof(providerContext));
providerContext.ContextSize = sizeof(providerContext);
if (!perfctr_startProvider ||
!perfctr_setCounterSetInfo ||
!perfctr_createInstance) {
NodeCounterProvider = NULL;
return;
}
status = perfctr_startProvider(&NodeCounterSetGuid,
&providerContext,
&NodeCounterProvider);