Silent return of STATUS_ACCESS_DENIED?

Is it possible to deny access to a file in the post create of a IRP_MJ_CREATE without alerting the user? After some logic, I have the following:

FltCancelFileOpen( FltObjects->Instance, FltObjects->FileObject );

Data->IoStatus.Status = STATUS_ACCESS_DENIED;
Data->IoStatus.Information = 0;

returnStatus = FLT_POSTOP_FINISHED_PROCESSING;

This works as expected. Access to the file is denied but, it shows a message box with the requested filename and path in the title and the message “Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access this item”. I want to silently deny access and then have my user mode application do some authentication/authorization and relaunch the application on success.

What Windows pops up is Windows’ perogative, your “interface” to it is
how you complete the IRP. Generally speaking, if you complete it
unsuccessfully, windows is probably going to try to tell the user
something informative as to why. Otherwise how does the user know what
to do when things don’t work.

That said, from what you’ve described, you probably don’t want to try to
return STATUS_ACCESS_DENIED and restart the app that made the request
originally. Instead, you might look into notifying you user mode
service that it needs to do some work, queueing the IRP, and pending the
IRP by returning FLT_POSTOP_MORE_PROCESSING_REQUIRED. Then your
userland service does whatever, messages back the minifilter, and the
minifilter then dequeues the IRP and completes it appropriately. I
believe that’s more or less what the scanner sample does, though I
haven’t looked at it recently.

~Eric

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@redbeardweb.com
Sent: Friday, April 11, 2008 4:01 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Silent return of STATUS_ACCESS_DENIED?

Is it possible to deny access to a file in the post create of a
IRP_MJ_CREATE without alerting the user? After some logic, I have the
following:

FltCancelFileOpen( FltObjects->Instance, FltObjects->FileObject
);

Data->IoStatus.Status = STATUS_ACCESS_DENIED;
Data->IoStatus.Information = 0;

returnStatus = FLT_POSTOP_FINISHED_PROCESSING;

This works as expected. Access to the file is denied but, it shows a
message box with the requested filename and path in the title and the
message “Windows cannot access the specified device, path, or file. You
may not have the appropriate permissions to access this item”. I want
to silently deny access and then have my user mode application do some
authentication/authorization and relaunch the application on success.


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars (including our new
fs mini-filter seminar) visit:
http://www.osr.com/seminars

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

>permissions to access this item". I want to silently deny access

For any user mode app? impossible.

For only 1 your app you control? invent your own NTSTATUS code for failure. If
NTSTATUS value has a “customer” bit set in it, then the Win32 error value will
be the same, and your app can catch this kind of failure.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

ok, so I can’t silently kill the process. My original reason for wanting to do this is because my filter is monitoring access to EXE files. If the user accesses one from a list, I need to authorize the user and log the launch including the processid that the launched program is running under. Can I get that process id during the IRP request? I know I can get it if my application launches the app but, as far as I can tell, calling IoThreadToProcess( Data->Thread) in the pre/post create methods return the process of the requestor (Data being of type PFLT_CALLBACK_DATA). Is there another way to get the process id of the EXE that’s about to launch?