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

Home NTFSD
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: https://www.osr.com/osr-learning-library/


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?

Regards
victorR

Comments

  • rod_widdowsonrod_widdowson Member - All Emails Posts: 1,121

    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 2.7.0.581FileTest tool. It can't set the right value to the file.

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

    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.

    -scott
    OSR

  • 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.

    VictorR

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!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA