wine-devel-request@winehq.org wrote:
Message: 4 Date: Sun, 30 Mar 2008 19:13:46 -0600 From: Vitaliy Margolen wine-devel@kievinfo.com Subject: Re: setupapi: prevent page faults in SetupDiDeleteDeviceInterfaceRegKey To: wine-devel@winehq.org Message-ID: 47F03ACA.5010308@kievinfo.com Content-Type: text/plain; charset=ISO-8859-1; format=flowed Christopher wrote:
Changelog: Check that the handle and pointer passed to SetupDiDeleteDeviceInterfaceRegKey are valid to read from. This patch continues to address bug #12242
- if (!DeviceInterfaceData ||
- if (!DeviceInterfaceData || IsBadReadPtr(DeviceInterfaceData, sizeof(SP_DEVICE_INTERFACE_DATA)) ||
Don't ever use IsBadReadPtr and IsBadWritePtr functions. They are bad and even MS stopped using them. You have to use TRY-EXCEPT block around an access to the memory. For example see implementation of lstrcpyA (kernel32/string.c: 359).
- ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "Expected SetupDiDeleteDeviceInterfaceRegKey to return FALSE, got %s, \
+with error code: 6, got %d\n", ret ? "TRUE" : "FALSE", GetLastError());
This is bad way to split strings in c. Do something like this:
ok(!ret && GetLastError() == ERROR_INVALID_HANDLE,
"Expected SetupDiDeleteDeviceInterfaceRegKey to return FALSE, got %s, " "with error code: 6, got %d\n", ret ? "TRUE" : "FALSE", GetLastError());
Vitaliy.
Thanks for the comments! I found that Alexander Morozov's patches fix the same issue my patch was aimed at. After his are committed, I'll fix and resubmit mine if it's needed.
Christopher Berner