Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

SetEndOfFile with FileTest tool

victor_richvictor_rich Member Posts: 7

Hello All,

I am not sure if it is a bug for FileTest tool or the normal file system behavior. If I open the file with FileTest tool with write access, and SetEndOfFile with some value, from the filespy it always shows the EndOfFile value is 0 instead of the value I set, but if I write data first, then set the set length of the current file, the I will see the correct value.

Does anyone know if this is the bug or I was doing something wrong?



  • rod_widdowsonrod_widdowson Member - All Emails Posts: 1,172

    Do you mean on the ‘write’ tab? I never use that button - it’s wired to WIN32 so it could be doing any number of weird things, including what you say.

    I always use FileEofInforation on the file info tab and that does work

  • victor_richvictor_rich Member Posts: 7

    I meant I used SetEndOfFile on the ReadWrite tab, this is the latest versionv tool. It can't set the right value to the file.

  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,376

    SetEndOfFile sets the EOF based on the current file pointer. You need to call SetFilePointer to move the file pointer out and then call SetEndOfFile. This is all just wacky Win32 stuff, it would work "as expected" if you used the native API.


  • victor_richvictor_rich Member Posts: 7

    Thanks Scott, you are right, the SetEndOfFile in the ReadWrite tag only set the end of file for the current file pointer. To test the SetEndOfFileInfo, it needs to go to the NtFileInfoTag.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE