mirror of https://github.com/nodejs/node.git
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 #4511pull/24504/head
parent
a7d8c21bca
commit
5a39df4959
|
@ -172,6 +172,13 @@ void InitPerfCountersWin32() {
|
||||||
ZeroMemory(&providerContext, sizeof(providerContext));
|
ZeroMemory(&providerContext, sizeof(providerContext));
|
||||||
providerContext.ContextSize = sizeof(providerContext);
|
providerContext.ContextSize = sizeof(providerContext);
|
||||||
|
|
||||||
|
if (!perfctr_startProvider ||
|
||||||
|
!perfctr_setCounterSetInfo ||
|
||||||
|
!perfctr_createInstance) {
|
||||||
|
NodeCounterProvider = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
status = perfctr_startProvider(&NodeCounterSetGuid,
|
status = perfctr_startProvider(&NodeCounterSetGuid,
|
||||||
&providerContext,
|
&providerContext,
|
||||||
&NodeCounterProvider);
|
&NodeCounterProvider);
|
||||||
|
|
Loading…
Reference in New Issue