mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[KERNEL32] Check for NULL lpBytesReturned
Add NULL check for lpBytesReturned to match Windows 8+ behavior, which Wine code relies on.
This commit is contained in:
@@ -264,13 +264,16 @@ DeviceIoControl(IN HANDLE hDevice,
|
||||
/* Check for success */
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Return the byte count */
|
||||
*lpBytesReturned = Iosb.Information;
|
||||
/* Windows 2003 and Vista do not check for lpBytesReturned == NULL,
|
||||
* but Windows 8+ does. Avoid crashing. */
|
||||
if (lpBytesReturned != NULL)
|
||||
*lpBytesReturned = Iosb.Information;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check for informational or warning failure */
|
||||
if (!NT_ERROR(Status)) *lpBytesReturned = Iosb.Information;
|
||||
if (!NT_ERROR(Status) && (lpBytesReturned != NULL))
|
||||
*lpBytesReturned = Iosb.Information;
|
||||
|
||||
/* Return a failure */
|
||||
BaseSetLastNTError(Status);
|
||||
|
||||
Reference in New Issue
Block a user