Hans Leidekker wrote:
On Monday 22 October 2007 14:43:59 Jeff Latimer wrote:
to test with and hence the delay. The current patch I submitted was cleaning up the Null reference issue before moving on to sorting out the
I don't see any crash on Wine or XP when running the test.
When I run size = sizeof(buffer) / sizeof(WCHAR); ret = PdhLookupPerfNameByIndexW( NULL, 674, NULL, &size ); it crashes for me in wine and XP returns PDH_INVALID_ARGUMENT.
You are trying to protect against a hypothetical case where an app specifies a size > 0 but no buffer. XP won't accept that anyway and it's unlikely any app will do that on non-XP systems.
I don't accept that it hypothetical because that is the exact behaviour the API spec encourages. The buffer can be NULL in all circumstances.
In fact your patch will break in another - also unlikely - situation where an app relies on non-XP behaviour, which is to accept a null buffer and size > 0 but less than the required size.
What is the result of that behaviour? It looks to me that the only response should be PDH_INVALID_ARGUMENT or ok with an updated size. As is stands pdh does neither.
So a crash is even desirable here, because it tells us immediately that the app is doing something peculiar.
I don't understand this as there must be defined behaviour in this circumstance.
Jeff