Here is example of a file logging function that I use. The 3rd parameter is a pointer to a character buffer
that contains the logging text. The 4th parameter contains the size of the character buffer. It can be just that, a simple buffer.
NTSTATUS Status;
IO_STATUS_BLOCK ioStatusBlock;
PIRP newIRP;
KEVENT event;
PIO_STACK_LOCATION IrpSp;
if( m_FileHandle == NULL )
{
return;
}
if( m_WriteCount == 0 )
{
return;
}
KeInitializeEvent( &event,
NotificationEvent,
FALSE );
newIRP = IoBuildSynchronousFsdRequest( IRP_MJ_WRITE,
m_DeviceObject,
m_WriteBuffer,
m_WriteCount,
&m_FilePosition,
&event,
&ioStatusBlock );
// can’t flush, can’t create an IRP
if( !newIRP )
{
return;
}
IrpSp = IoGetNextIrpStackLocation( newIRP );
IrpSp->FileObject = m_FileObject;
Status = IoCallDriver( m_DeviceObject, newIRP );
if( Status == STATUS_PENDING )
{
KeWaitForSingleObject( &event,
Executive,
KernelMode,
FALSE,
NULL );
}
Status = ioStatusBlock.Status;
if( NT_SUCCESS(Status) )
{
m_FilePosition.LowPart += ioStatusBlock.Information;
}
-----Original Message-----
From: zhangbo [mailto:xxxxx@gmx.net]
Sent: Thursday, October 10, 2002 5:28 AM
To: File Systems Developers
Subject: [ntfsd] How to use IoBuildSynchronousFsdRequest to read a disk
file?
hi,
I want to use IoBuildSynchronousFsdRequest to read/write “c:\1.txt” at
“HardDisk\Volume1”, coz ZwOpenFile sometimes failes with a error
STATUS_SHARE_VIOLATION.
How to set its parameters? I have read the DDK docs, but can’t figure out
how to fill the 3rd parameter named “buffer”.
Thx for help!
You are currently subscribed to ntfsd as: xxxxx@inflectionsystems.com
To unsubscribe send a blank email to %%email.unsub%%