[ole32/tests 2/2] Fix crash on NT4 and below

Paul Vriens paul.vriens.wine at gmail.com
Tue Jun 10 07:05:30 CDT 2008


Rob Shearman wrote:
> 2008/6/10 Paul Vriens <paul.vriens.wine at gmail.com>:
>> This 'fixes' the crash on win9x and NT4.
>>
>> @@ -1130,11 +1130,15 @@ static void test_data_cache(void)
>>      hr = IOleCache_Uncache(pOleCache, 0xdeadbeef);
>>      ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr);
>>
>> -    hr = IOleCache_Cache(pOleCache, NULL, 0, &dwConnection);
>> -    ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
>> +    /* Both tests crash on NT4 and below */
>> +    if (0)
>> +    {
>> +        hr = IOleCache_Cache(pOleCache, NULL, 0, &dwConnection);
>> +        ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
>>
>> -    hr = IOleCache_Cache(pOleCache, NULL, 0, NULL);
>> -    ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr);
>> +        hr = IOleCache_Cache(pOleCache, NULL, 0, NULL);
>> +        ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr);
>> +    }
>>
>>      for (fmtetc.cfFormat = CF_TEXT; fmtetc.cfFormat < CF_MAX; fmtetc.cfFormat++)
>>      {
> 
> This test was added in response to a real application doing exactly
> this, so I think the test does have value when run on Win 2000+.
> Therefore, I think a version check would be better than "if (0)".
> 
Let me check (later) whether it's possible to have some logic in that decides 
whether we are on W2K and up.

If not, all remains is of course a real version check.

-- 
Cheers,

Paul.



More information about the wine-devel mailing list