Signed-off-by: Francois Gouget fgouget@codeweavers.com --- This fixes two failures on Windows 10 >= 2004. https://test.winehq.org/data/patterns.html#pdh:pdh --- dlls/pdh/pdh_main.c | 6 ++++-- dlls/pdh/tests/pdh.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/pdh/pdh_main.c b/dlls/pdh/pdh_main.c index 73d4fef2a14..3840b9d0288 100644 --- a/dlls/pdh/pdh_main.c +++ b/dlls/pdh/pdh_main.c @@ -284,7 +284,8 @@ PDH_STATUS WINAPI PdhAddEnglishCounterA( PDH_HQUERY query, LPCSTR path, { TRACE("%p %s %lx %p\n", query, debugstr_a(path), userdata, counter);
- if (!query) return PDH_INVALID_ARGUMENT; + if (!counter) return PDH_INVALID_ARGUMENT; + if (!query) return PDH_INVALID_HANDLE; return PdhAddCounterA( query, path, userdata, counter ); }
@@ -296,7 +297,8 @@ PDH_STATUS WINAPI PdhAddEnglishCounterW( PDH_HQUERY query, LPCWSTR path, { TRACE("%p %s %lx %p\n", query, debugstr_w(path), userdata, counter);
- if (!query) return PDH_INVALID_ARGUMENT; + if (!counter) return PDH_INVALID_ARGUMENT; + if (!query) return PDH_INVALID_HANDLE; return PdhAddCounterW( query, path, userdata, counter ); }
diff --git a/dlls/pdh/tests/pdh.c b/dlls/pdh/tests/pdh.c index 71603f8c6ba..8165f32f50a 100644 --- a/dlls/pdh/tests/pdh.c +++ b/dlls/pdh/tests/pdh.c @@ -240,7 +240,8 @@ static void test_PdhAddEnglishCounterA( void ) ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterA failed 0x%08x\n", ret);
ret = pPdhAddEnglishCounterA( NULL, "\System\System Up Time", 0, &counter ); - ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterA failed 0x%08x\n", ret); + ok(ret == PDH_INVALID_HANDLE || broken(ret == PDH_INVALID_ARGUMENT) /* win10 <= 1909 */, + "PdhAddEnglishCounterA failed 0x%08x\n", ret);
ret = pPdhAddEnglishCounterA( query, NULL, 0, &counter ); ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterA failed 0x%08x\n", ret); @@ -281,7 +282,8 @@ static void test_PdhAddEnglishCounterW( void ) ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
ret = pPdhAddEnglishCounterW( NULL, system_uptime, 0, &counter ); - ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterW failed 0x%08x\n", ret); + ok(ret == PDH_INVALID_HANDLE || broken(ret == PDH_INVALID_ARGUMENT) /* win10 <= 1909 */, + "PdhAddEnglishCounterW failed 0x%08x\n", ret);
ret = pPdhAddEnglishCounterW( query, NULL, 0, &counter ); ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterW failed 0x%08x\n", ret);