Re: ZwWriteFile and buffer reuse
- From: RJ <RJ@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 2 Nov 2006 15:01:01 -0800
No, the below code is in Worker thread which is in PASSIVE LEVEL. Interrupt
routine
fills the buffer with data to be writen to file. Once buffer is full, the
worker thread is scheduled from DPC to write data to file.
"RJ" wrote:
How can I make sure that NtWriteFile is complete?.
"RJ" wrote:
Here is my file create routine and file write routines. I make sure in the
interrupt routine that ZwWrite routine is completed. But seems it doesn't
mean than write operation is actually completed. I tried to use event object
to signal write complete as shown below. But this event object never set
into signaled state.
RJ
status = ZwCreateFile(&(pDevExt->hFileHandle),
GENERIC_WRITE | SYNCHRONIZE,
&objAttrs,
&ioStatus,
0,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_SUPERSEDE, FILE_SYNCHRONOUS_IO_ALERT,
NULL,
0);
KeClearEvent(gpDevExt->pfileEvent);
status = ZwWriteFile( pDevExt->hFileHandle,
pDevExt->pfileEvent,
NULL,
NULL,
&ioStatus,
pucStartAddress,
ulNumBytes,
NULL,
NULL);
KeWaitForSingleObject(pDevExt->pfileEvent,
Executive,
KernelMode,
FALSE,
NULL);
"Skywing [MVP]" wrote:
Wait until either NtWriteFile returns or signals asynchronous completion.
You cannot touch a buffer passed to NtReadFile/NtWriteFile while it is
working on the operation.
--
Ken Johnson (Skywing)
Windows SDK MVP
http://www.nynaeve.net
"RJ" <RJ@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1E31915E-06C5-4721-8784-5ED892157540@xxxxxxxxxxxxxxxx
I use ZwWriteFile function to write data from a buffer to a file in a
worker
thread. I would like to know when can I resue the input buffer again to
fill
new data. Buffer is filled in the interrupt/DPC and once the buffer is
filled, a worker thread is scheduled to write the data to file. My
interrupt
routine is trying to write new date to the buffer while NtWriteFile
routine
is still running. This creates a bugcheck.
Any help appreciated.
Thanks,
RJ
- References:
- Re: ZwWriteFile and buffer reuse
- From: Skywing [MVP]
- Re: ZwWriteFile and buffer reuse
- From: RJ
- Re: ZwWriteFile and buffer reuse
- From: RJ
- Re: ZwWriteFile and buffer reuse
- Prev by Date: Re: ZwWriteFile and buffer reuse
- Next by Date: Re: ZwWriteFile and buffer reuse
- Previous by thread: Re: ZwWriteFile and buffer reuse
- Next by thread: Re: ZwWriteFile and buffer reuse
- Index(es):
Relevant Pages
|