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/


FindNextFile failing with error ERROR_INVALID_FUNCTION

KunalKunal Member - All Emails Posts: 21
Hi,

I have been using FindNextFile() to enumerate all files in a folder. It will enumerate all the files until FindNextFile() fails with error ERROR_NO_MORE_FILES.
There has been no changes in this part of code and it has been working fine all these years, but in one of my customers' machine (windows server 2016) it returns error (getlasterror) ERROR_INVALID_FUNCTION. What does it mean and how should I handle it?


Thanks,
Kunal

Comments

  • rod_widdowsonrod_widdowson Member - All Emails Posts: 1,266
    > What does it mean and how should I handle it?

    Your filter (or whatever) or something else has started returning
    STATUS_INVALID_FUNCTION.

    Promon is your friend. Fire that up, find the precise IRP that causes the
    problem and start reading code (or debugging it)

    Rod
  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,683
    Rod is spot on about running Process Monitor. However, just wanted to point
    out that multiple native status codes can translate to
    ERROR_INVALID_FUNCTION. According to winerror.exe:

    1 ERROR_INVALID_FUNCTION <--> 0xc0000002 STATUS_NOT_IMPLEMENTED
    1 ERROR_INVALID_FUNCTION <--> 0xc0000010 STATUS_INVALID_DEVICE_REQUEST
    1 ERROR_INVALID_FUNCTION <--> 0xc000001c STATUS_INVALID_SYSTEM_SERVICE
    1 ERROR_INVALID_FUNCTION <--> 0xc00000af STATUS_ILLEGAL_FUNCTION
    1 ERROR_INVALID_FUNCTION <--> 0xc000029c STATUS_VOLUME_NOT_UPGRADED
    1 ERROR_INVALID_FUNCTION <--> 0xc0000710
    STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING
    1 ERROR_INVALID_FUNCTION <--> 0xc0000711
    STATUS_APC_RETURNED_WHILE_IMPERSONATING
    1 ERROR_INVALID_FUNCTION <--> 0xc000071b
    STATUS_CALLBACK_RETURNED_THREAD_PRIORITY
    1 ERROR_INVALID_FUNCTION <--> 0xc000071d
    STATUS_CALLBACK_RETURNED_TRANSACTION
    1 ERROR_INVALID_FUNCTION <--> 0xc000071e STATUS_CALLBACK_RETURNED_LDR_LOCK
    1 ERROR_INVALID_FUNCTION <--> 0xc000071f STATUS_CALLBACK_RETURNED_LANG
    1 ERROR_INVALID_FUNCTION <--> 0xc0000720 STATUS_CALLBACK_RETURNED_PRI_BACK
    1 ERROR_INVALID_FUNCTION <--> 0xc0000721
    STATUS_CALLBACK_RETURNED_THREAD_AFFINITY
    1 ERROR_INVALID_FUNCTION <--> 0xc0010001 DBG_NO_STATE_CHANGE

    So you'll want to look for any of those in the Process Monitor output.

    -scott
    OSR
    @OSRDrivers

    -scott
    OSR

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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 9-13 Sept 2024 Live, Online
Developing Minifilters 15-19 July 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 20-24 May 2024 Live, Online