FltWriteFile to EOF behavior changed in Vista?

NTFSD Folk:

My mini-filter driver has had this code for a long time to append to a file:

LARGE_INTEGER EndOfFile;
EndOfFile.QuadPart = -1LL;

status = FltWriteFile(
RepositoryInstance, // Instance
foOut, // File Object
&EndOfFile, // ByteOffset (-1 = append to end of file)
iBytes, // Length
pCopyOfRecords, // Buffer
0, // Flags
NULL, // BytesWritten
NULL, // CallbackRoutine
NULL ); // CallbackContext

It has always worked fine, but on Vista it is getting STATUS_INVALID_PARAMETER_3 (“An invalid parameter was passed to a service or
function as the third argument.”)

That seems to indicate that it doesn’t like -1 for the byte offset. I get the same results if I open the file with GENERIC_WRITE or
FILE_APPEND_WRITE.

Anybody else noticed this in Vista? Any workaround?

Ken

Well, the obvious workaround (which I’ve implemented) is to precede the write with FltQueryFileInformation to get the current EOF,
and use that in the write.

The fact that it doesn’t work (and isn’t documented) seems tacky, though…

Ken

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ken Cross
Sent: Thursday, June 07, 2007 7:17 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] FltWriteFile to EOF behavior changed in Vista?

NTFSD Folk:

My mini-filter driver has had this code for a long time to append to a file:

LARGE_INTEGER EndOfFile;
EndOfFile.QuadPart = -1LL;

status = FltWriteFile(
RepositoryInstance, // Instance
foOut, // File Object
&EndOfFile, // ByteOffset (-1 = append to end of file)
iBytes, // Length
pCopyOfRecords, // Buffer
0, // Flags
NULL, // BytesWritten
NULL, // CallbackRoutine
NULL ); // CallbackContext

It has always worked fine, but on Vista it is getting STATUS_INVALID_PARAMETER_3 (“An invalid parameter was passed to a service or
function as the third argument.”)

That seems to indicate that it doesn’t like -1 for the byte offset. I get the same results if I open the file with GENERIC_WRITE or
FILE_APPEND_WRITE.

Anybody else noticed this in Vista? Any workaround?

Ken


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

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