correct bug in WriteFile : crash if Overlapped is null

svn path=/trunk/; revision=226
This commit is contained in:
jean 1999-02-11 12:40:02 +00:00
parent 638ba1c9e4
commit d6995d6c9c

View file

@ -90,7 +90,7 @@ WINBOOL STDCALL WriteFile(HANDLE hFile,
LPOVERLAPPED lpOverLapped) LPOVERLAPPED lpOverLapped)
{ {
LARGE_INTEGER Offset; LARGE_INTEGER Offset,*pOffset;
HANDLE hEvent = NULL; HANDLE hEvent = NULL;
NTSTATUS errCode; NTSTATUS errCode;
PIO_STATUS_BLOCK IoStatusBlock; PIO_STATUS_BLOCK IoStatusBlock;
@ -105,11 +105,12 @@ WINBOOL STDCALL WriteFile(HANDLE hFile,
lpOverLapped->Internal = STATUS_PENDING; lpOverLapped->Internal = STATUS_PENDING;
hEvent= lpOverLapped->hEvent; hEvent= lpOverLapped->hEvent;
IoStatusBlock = (PIO_STATUS_BLOCK)lpOverLapped; IoStatusBlock = (PIO_STATUS_BLOCK)lpOverLapped;
pOffset=&Offset;
} }
else else
{ {
IoStatusBlock = &IIosb; IoStatusBlock = &IIosb;
Offset = NULL; pOffset = NULL;
} }
errCode = NtWriteFile(hFile, errCode = NtWriteFile(hFile,
hEvent, hEvent,
@ -118,7 +119,7 @@ WINBOOL STDCALL WriteFile(HANDLE hFile,
IoStatusBlock, IoStatusBlock,
(PVOID)lpBuffer, (PVOID)lpBuffer,
nNumberOfBytesToWrite, nNumberOfBytesToWrite,
&Offset, pOffset,
NULL); NULL);
if (!NT_SUCCESS(errCode)) if (!NT_SUCCESS(errCode))
{ {