how to forbid a directory to be written?

HI, Everyone:
I have to design a file system filter driver to forbid a directory to be
written.
I am searching information from FILEMON sources. But I can not get what
I needed.
I try to do the following, but I failed.

switch( currentIrpStack->MajorFunction ) {

case IRP_MJ_CREATE:

if(comparison expression)
{
DbgPrint((“==LJP==5015\n\n”));
Irp->IoStatus.Information = 0;
return STATUS_ACCESS_DENIED;
}
break;

If the comparison expression success, system will
reboot!!!
why??
Anybody can help me? Thank you very much!

It is messing up because you are not handling the IRP correctly. You
have to complete the IRP as well as setting the status code in the
IoStatus.Status field. Assuming that the i/o subsystem will handle this
for you is incorrect.

Look more carefully at the samples, you will see they are doing
something similar to this …

Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = (Status == STATUS_SUCCESS) ?
FILE_CREATED : 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);

Also, be careful in using the IRP_MJ_CREATE intent for the directory to
make your decision (or for a file within the directory for that matter).
A lot of applications will open for write access even if their intention
is not to write the file or directory. In your case, you will probably
need to check for the existence of the file and then look at the open
type to see if the file will be created by the action.

-----Original Message-----
From: lists.osr.com [mailto:lijp@sh.sct-grp.com]
Sent: Monday, June 16, 2003 4:12 AM
To: File Systems Developers
Subject: [ntfsd] how to forbid a directory to be written?

HI, Everyone:
I have to design a file system filter driver to forbid a directory
to be
written.
I am searching information from FILEMON sources. But I can not get
what
I needed.
I try to do the following, but I failed.

switch( currentIrpStack->MajorFunction ) {

case IRP_MJ_CREATE:

if(comparison expression)
{
DbgPrint((“==LJP==5015\n\n”));
Irp->IoStatus.Information = 0;
return STATUS_ACCESS_DENIED;
}
break;

If the comparison expression success, system will
reboot!!!
why??
Anybody can help me? Thank you very much!


You are currently subscribed to ntfsd as: xxxxx@exagrid.com
To unsubscribe send a blank email to xxxxx@lists.osr.com