Starting with Windows 10 2004 PdhMakeCounterPathA() does not check the query handle before using it.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- This fixes the crashes on Windows 10 >= 2004. https://test.winehq.org/data/patterns.html#pdh:pdh
I have kept the PdhMakeCounterPathA/W() handle check in Wine for backward compatibility though I doubt applications actually depend on that. Let me know if the check should be removed. --- dlls/pdh/tests/pdh.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/pdh/tests/pdh.c b/dlls/pdh/tests/pdh.c index 8165f32f50a..928714475bb 100644 --- a/dlls/pdh/tests/pdh.c +++ b/dlls/pdh/tests/pdh.c @@ -867,9 +867,11 @@ static void test_PdhMakeCounterPathA(void) ret = PdhMakeCounterPathA(NULL, NULL, &buflen, 0); ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
+ if (0) { /* Crashes on Windows 10 >= 2004 */ buflen = 0; ret = PdhMakeCounterPathA(NULL, buffer, &buflen, 0); ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret); + }
buflen = sizeof(buffer); memset(&e, 0, sizeof(e));