microsoft / Windows-driver-samples

This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples.
Microsoft Public License
6.76k stars 4.89k forks source link

[filesys/fastfat] FASTFAT Errors on Surprise removal #1106

Open rodwiddowson opened 4 months ago

rodwiddowson commented 4 months ago

I am debugging and issue with my own file system driver and IRP_MN_SURPRISE_REMOVAL so I built a debug version of FASTFAT and started testing.

In my initial set of tests I got a series of PAGED_CODE asserts in the classpnp completion routine Because my own driver was loaded I didn't take any notes but tried to reproduce without it.

Investigations are ongoing but so far I have seen this (FATDATA.c - 478)

 if (ExceptionCode == STATUS_VERIFY_REQUIRED) {

            PDEVICE_OBJECT Device = NULL;

            DebugTrace(0, Dbg, "Perform Verify Operation\n", 0);

            //
            //  Now we are at the top level file system entry point.
            //
            //  Grab the device to verify from the thread local storage
            //  and stick it in the information field for transportation
            //  to the fsp.  We also clear the field at this time.
            //

            Device = IoGetDeviceToVerify( Irp->Tail.Overlay.Thread );
            IoSetDeviceToVerify( Irp->Tail.Overlay.Thread, NULL );

            if ( Device == NULL ) {

                Device = IoGetDeviceToVerify( PsGetCurrentThread() );
                IoSetDeviceToVerify( PsGetCurrentThread(), NULL );

                NT_ASSERT( Device != NULL );
            }

I'll keep on testing (with and without my drivers) and I'll fill in more details as I find them.

darwin-msft commented 1 month ago

STATUS_VERIFY_REQUIRED is expected. It is returned whenever fastfat needs to validate that the underlying storage is as expected. Usually after a media ejection, or power state transition or something like that.