Obviously mostly a small and theoretical problem, but anyway: Looking at git commit 754b97c72c38f736100c6542af234c31a4bf7a5b, it seems, PdhMakeCounterPathA may be returning the wrong error in this case:
Everything goes well until the allocation of bufferW. Assuming this fails, the function will return PDH_MORE_DATA, which seems the wrong error value (instead it should probably return PDH_MEMORY_ALLOCATION_FAILURE ? )
regards, Joris