Change file size

How to change the file size when it is queried in my filter driver?

In a Dos-prompt dir, the only I/O shown are IRP_MJ_CREATE, IRP_MJ_CLEANUP,
IRP_MJ_CLOSE and IRP_MJ_DEVICE_CHANGE.

Even for the Explorer, after I change the EndOfFile size in the
IRP_MJ_QUERY_INFORMATION, the file size is not changed.

If I change the FileObject->FsContext->FileSize, then the file size will
be changed permanently, which is not my intention.

File size is returned in a directory query as well as a file attributes
query. It sounds like you are missing one of these in your filter driver
(my guess is the directory query). Have you used filemon to confirm that
you are not seeing an IRP_MJ_DIRECTORY_CONTROL?

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Eric Chan [mailto:xxxxx@hotmail.com]
Sent: Saturday, April 27, 2002 2:24 AM
To: File Systems Developers
Subject: [ntfsd] Change file size

How to change the file size when it is queried in my filter driver?

In a Dos-prompt dir, the only I/O shown are IRP_MJ_CREATE, IRP_MJ_CLEANUP,
IRP_MJ_CLOSE and IRP_MJ_DEVICE_CHANGE.

Even for the Explorer, after I change the EndOfFile size in the
IRP_MJ_QUERY_INFORMATION, the file size is not changed.

If I change the FileObject->FsContext->FileSize, then the file size will
be changed permanently, which is not my intention.


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

You forgot that IRP_MJ_DRECTORY_CONTROL / IRP_MN_QUERY_DIRECTORY is also
called for these operations, which is where DOS prompt or Explorer and other
applications get the file size DURING LISTING. A type command, or Properties
in Explorer will call IRP_MJ_QUERY_INFORMATION, though.
Do note that filters above you in the chain see the new file size, while
those below you see the unchanged. You will have QUITE a lot of possible
incompatibility issues.

Regards, Dejan.

Eric Chan wrote:

How to change the file size when it is queried in my filter driver?

In a Dos-prompt dir, the only I/O shown are IRP_MJ_CREATE, IRP_MJ_CLEANUP,
IRP_MJ_CLOSE and IRP_MJ_DEVICE_CHANGE.

Even for the Explorer, after I change the EndOfFile size in the
IRP_MJ_QUERY_INFORMATION, the file size is not changed.

If I change the FileObject->FsContext->FileSize, then the file size will
be changed permanently, which is not my intention.


You are currently subscribed to ntfsd as: xxxxx@alfasp.com
To unsubscribe send a blank email to %%email.unsub%%


Kind regards, Dejan M. www.alfasp.com
E-mail: xxxxx@alfasp.com ICQ#: 56570367
Alfa File Monitor - File monitoring library for Win32 developers.
Alfa File Protector - File protection and hiding library for Win32 developers.

Alfa Registry Monitor - Registry monitoring library for Win32 developers.
Alfa Registry Protector - Registry protection library for Win32 developers.