Work around a problem where WriteFile is asked to write memory protected by DIBSection code.
diff --git a/dlls/kernel/file.c b/dlls/kernel/file.c index 5242885..2e4efd9 100644 --- a/dlls/kernel/file.c +++ b/dlls/kernel/file.c
@@ -451,6 +451,16 @@ status = NtWriteFile(hFile, hEvent, NULL, NULL, piosb, buffer, bytesToWrite, poffset, NULL); + /* FIXME: NtWriteFile does not always cause page faults, generate them now */ + if (status == STATUS_INVALID_USER_BUFFER && !IsBadReadPtr( buffer, bytesToWrite )) + { + status = NtWriteFile(hFile, hEvent, NULL, NULL, piosb, + buffer, bytesToWrite, poffset, NULL); + if (status != STATUS_INVALID_USER_BUFFER) + FIXME("Could not access memory (%p,%ld) at first, now OK. Protected by DIBSection code?\n", + buffer, bytesToWrite); + } + if (status != STATUS_PENDING && bytesWritten) *bytesWritten = piosb->Information;