Skip to content

Commit 5a39df4

Browse files
sblompiscisaureus
authored andcommitted
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 nodejs#4462 Closes nodejs#4511
1 parent a7d8c21 commit 5a39df4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/node_win32_perfctr_provider.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ void InitPerfCountersWin32() {
172172
ZeroMemory(&providerContext, sizeof(providerContext));
173173
providerContext.ContextSize = sizeof(providerContext);
174174

175+
if (!perfctr_startProvider ||
176+
!perfctr_setCounterSetInfo ||
177+
!perfctr_createInstance) {
178+
NodeCounterProvider = NULL;
179+
return;
180+
}
181+
175182
status = perfctr_startProvider(&NodeCounterSetGuid,
176183
&providerContext,
177184
&NodeCounterProvider);

0 commit comments

Comments
 (0)