mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
correct bug in WriteFile : crash if Overlapped is null
svn path=/trunk/; revision=226
This commit is contained in:
parent
638ba1c9e4
commit
d6995d6c9c
1 changed files with 4 additions and 3 deletions
|
@ -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))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue