- Also use FsRtlIsTotalDeviceFailure to check if the error was a fatal device error (like a CRC error) and abandon mounting in this case as well.
svn path=/trunk/; revision=22765
- Fix a bug which was causing us to incorrectly unlock the device if it was already locked by the caller isntead of by IopMountVolume.
- When loading the file system, make sure to unlock the device object if we had locked it in IopMountVolume, as well as to re-lock it afterwards. Also handle a potential race condition due to this unloacking, in which the VPB might've become mounted behind our back, and simply return success if this happened.
svn path=/trunk/; revision=22764
- Dereference the device object in case of failure.
- Add some optimizations to quickly skip invalid raw mounting.
- Add support for VPB_RAW_MOUNT.
- Allow raw mount if this is the only device on the list.
- Make the success case go through shared exit, otherwise the device wasn't getting unlocked previously.
svn path=/trunk/; revision=22763
- Reference the device object being mounted.
- If the file system being mounted is an atachee, find its base device object too, and increase the IRP Stack for each attached FSD.
- Fix IRP parameters with this new information.
svn path=/trunk/; revision=22762
- Set the right IRP flags for a mount operation.
- Don't ignore AllowRawMount flag.
- Don't waste time passing or clearing unused flags/data on the IRP/Io Stack.
svn path=/trunk/; revision=22761
- Don't mount if the VPB is alread ymoutned or being removed
- Bugcheck the system if we failed to mount the boot partition.
svn path=/trunk/; revision=22760
- Optimize by using directly the device queue instead of allocating a structure for each FS registered.
- Hack IopMountVolume to manage this new model. Improved version coming in next patch to deal with some bugs.
svn path=/trunk/; revision=22758
- Each new change request should be queued at the end of the list, not at the head.
- Also, reference the device object for each registration, since one more object is holding a pointer to it, likewise, dereference the object on deregistration.
- IopLoadFileSystem should use the base FSD in case the device object is an attachee. Also, use IoBuildDEviceIoControlRequest to minimize the IRP setup to only a couple of lines.
svn path=/trunk/; revision=22757
- IoVerifyVolume:
- Send the IRP to the base FSD, in case the current FSD is an attachee
- Set correct flags in the IRP to notify that this is a mount operation using PAGING I/O semantics.
- Don't ignore AllowRawMount parameter.
- We want to mount the File System on *FAILURE*, not on SUCCESS!
- Add reference/dereferencing to the VPB.
svn path=/trunk/; revision=22756
- Add IoCheckQuerySetvolumeInformation to util.c from vpb.c with other similar functions
- Add the actual VPB functions in vpc.c to fs.c, and rename fs.c to volume.c, because it already contained Volume APIs, and now with VPB, even more so. It also still contains the FileSystem stuff, which is of course also generically part of "volumes".
- Delete vpb.c, rename fs.c to volume.c.
svn path=/trunk/; revision=22748
- Create \wmi directory and put wmi.c, since it's the start of a large chunk of the XP+ kernel dedicated to WMI support.
- Separate \io into \iomgr and \pnpmgr
svn path=/trunk/; revision=22747
- I/O Packet APIs improvements Part 2:
- Implement IoSetStartIoAttributes
- Obey StartIo Flags set by IoSetStartIoAttributes and change Packet functions to Windows XP/2003 semantics by supporting non-cancelable packets and deferred Start I/O calling.
svn path=/trunk/; revision=22746
- I/O Packet APIs fixes Part 1:
- Clear the current IRP before parsing the Device Queues
- Respect Cancelable parameter in IoStartNextPacket(ByKey) instead of ignoring it (acquire the cancel lock when it's requested)
- Raise IRQL to DISPATCH_LEVEL in IoStartPacket instead of expecting the caller to do it and crashing. Also only use Cancel Lock if a Cancel Function was specified.
- Actually handle the case where the IRP Was cancelled right after insert and the Cancel Routine has to be called.
svn path=/trunk/; revision=22744
- Modify IoUnregisterShudownNotification to loop both lists now.
- Used the lock in IoShutdownREgisteredDevices when looping the list, and changed it to send IRP_MJ_SHUTDOWN to the attached DO. Also fixed a memory leak where the shutdown entry wasn't being freed, and optimized the function only to initialize the event once (And simply clear it each time).
- Moved IoSynchronousInvalidateDeviceRelations to PnP
svn path=/trunk/; revision=22743
- Fix some bugs in IoGetRelatedDeviceObject: We should make sure that FO_DIRECT_DEVICE_OPEN isn't set when reading from the VPB's DO, otherwise we return the FO's DO directly. Also check for attachment before trying to get any attached device.
svn path=/trunk/; revision=22741
- Implement device unloading through IopUnloadDevice and device referencing through IopReferenceDeviceObject and IopDereferenceDeviceObject, and make IoDeleteDevice and IoDetachDevice unload the device on 0 reference count. Doesn't fully work yet.
- Simplify IoGetAttachedDEvice/IoGetAttachedDeviceReference not to use an extra stack variable.
svn path=/trunk/; revision=22740
- IoAttachDevice/IoAttachDeviceByPointer: Fail with STATUS_NO_SUCH_DEVICE if we couldn't attach.
- IoAttachDEviceTodEviceStackSafe: VPBs don't get inherited.
- IoCreateDevice: Only set OBJ_PERMAMENT if the caller requested it.
- IoCreateDevice: Return a NULL Device object if we failed to create it.
- IoCreateDevice: Set alignment requirement to 0, x86 doesn't need it.
svn path=/trunk/; revision=22736
- Fix IoSetThreadHardErrorMode... it was reading the TEB instead of the PETHREAD.
- Optimize Error Logging: Use a static work item instead of allocating one each time, and don't use a spinlock for the buffer count, when we can use interlocked functions instead.
- Log Entries can have Device AND/OR Driver Objects, not just a single one. They must also be referenced/dereferenced on allocation/free.
- Rewrite IopLogWorker to properly deal with Device/Driver objects and querying their names, as well as with additional strings that the caller might be sending.
svn path=/trunk/; revision=22734
1. Do not try todo HeapFree when pointer is NULL in cleanup:
2. Remove goto cleanup code
3. Rewrote the code so it does not need goto
svn path=/trunk/; revision=22732
- Remlock's code was written by Filip Navara and is clean. My additions are based on wdm.h and only add size checks and fix two visible bugs.
- Add basic support/detection for debug I/O remove blocks (we bugcheck if we identify one though).
- Simplify IoReleaseRemoveLockAndWaitEx
- Remove locks are SYNCH events, not Notification events!
- Make sure IoConnectInterrupt returns NULL to the caller on failure.
svn path=/trunk/; revision=22724
- Use DELETE instead of SYMBOLIC_LINK_ALL_ACCESS when deleting.
- Fix formatting in timer.c
- Clear the IO_TIMER structure when creating it.
svn path=/trunk/; revision=22722
- Use only one SEH block in NtRemoveIoCompletion
- Get the completion status from the IRP, not from the Mini-Packet, if the completion came from an IRP and not a Mini-Packet.
svn path=/trunk/; revision=22721
1. Remove goto in the code, goto is slow and should be avoid.
2. reformat for adding {} around some code.
3. remove some NULL check after I did remove goto that is not longer need it.
svn path=/trunk/; revision=22718
- Rewrite I/O MDl support to use lookaside lists for allocations below 23 pages (same as on NT). This is is an incredible performance optimization because MDLs are often allocated and de-allocated during I/O operations, and using the lookaside list decreases pool fragmentation and slowdown.
- Rewrite IoBuildPartialMdl. It did not work like documented in the DDK and also had a bug documented by Microsoft as being in XP.
svn path=/trunk/; revision=22717