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
- Handle cases where we ran out of memory while trying to allocate the IRP
- Make sure the IRP can be re-used in IoReuseIrp.
svn path=/trunk/; revision=22707
- Bugcheck if cancelling and IRP that's already been completed.
- Bugcheck if attempting to call a driver with an IRP that's already past its maximum stack size.
- Make sure that when we free an IRP, it's not associated to a thread anymore, nor having any drivers that think it's valid.
svn path=/trunk/; revision=22706
- Don't handle IRP_MJ_POWER in IoBuildAsyncronousFsdRequest.
- Use IoAllocateMdl instead of being a cowboy and using MmCreateMdl.
- Handle failure/out-of-memory cases in IoBuildAsyncronousFsdRequest
- Free the input buffer on failure in IoBuildDeviceIoControlRequest
- Handle failure in IoBuildSyncronousFsdREquest.
svn path=/trunk/; revision=22705
- Don't read pointers from the file object or IRP before they are actually used, because in some parts of the code, these pointers could change before we actually use them.
- Get rid of the #if 1/#if 0 nonsense hbirr had added.
- Properly check for success/warning/failure cases (thanks to Filip for checking this out with me last year)
- Handle scenarios when the IRP is marked IRP_CREATE_OPERATION
- Bugcheck if IofCompleteRequest is called twice on the same IRP
- Copy the master IRP's thread to the associated IRP
- Free the Auxiliary Buffer if there is one.
- Some formatting fixes, and majorly recomment the code to make it a lot clearer and more verbose on some of the more intricate details.
- Remove some hacks which I don't think are needed anymore. If you notice regressions due to this patch let me know ASAP.
svn path=/trunk/; revision=22704
- Fix irp.c file header
- IopRemoveThreadIrp:
- Get the DeviceObject and I/O Stack *before* going back to dispatch, otherwise race conditions will happen.
- Don't complete and IRP if it's already been through two stacks.
- Remove the IRP from the thread's IRP list before re-initializing the list, or else the IRP was lost.
- Make sure we have an error log entry before writing to it.
svn path=/trunk/; revision=22703
[AUDIT] - The routines in this file mostly come from documented information in "NT File System Internals" by Rajeev Nagar which has pseudo-code for a lot of them, and other WDM Books and information.
svn path=/trunk/; revision=22702
- Fix a check in ObpFreeObject which was causing a bugcheck if the object had a handle database (fixes another kmtest failure/crash).
- Verify parameters passed to ObCreateObjectType based on behaviour seen on Windows 2003 (I might've missed some, these are the ones I tested for). This fixes 2 of the kmtest failures.
- Also make sure the object type's name doesn't have a slash in the name.
- Also make sure we don't allow creating two object types with the same name.
- Also use our own local copy of the object name and copy it.
svn path=/trunk/; revision=22696
- Don't de-reference the object when duplicating it (not sure why this was left there). This fixes all the "misbehaving object: Event" messages in the console and fixes those regressions.
- Don't reference the object when doing a lookup (not sure why this was there either). This made it impossible to kill named objects, since ObpDeleteNameCheck did a lookup before killing them, and the lookup ended up adding a reference.
- Cm still needs fixing!
svn path=/trunk/; revision=22692
- Booting/installing still works, but the system will possibly be unstable. However I'm choosing to commit this because it shows correct Ob behavior and will allow Art to fix Cm's referencing properly.
- Implement ObCheckObjectAccess and call it to perform access verification checks.
- Properly create devices, processes and controllers with an extra reference count, so that when the code closes their handle they don't die.
- Check for invalid uses of ObfDereferenceObject for our current debugging purposes.
- Add SEH to NtQueryObject.
svn path=/trunk/; revision=22685
No longer need hacks to check reference counts.
Deleted a ton of wierd code.
Fixed bug where we allocated uninitialized memory for child nodes we never
populated.
Now reference counting mirrors pointers exactly:
- Hold one reference for the parent key pointer
- Hold one reference for the list entry in the connected hive list
svn path=/trunk/; revision=22684
- Also add a REALLY nasty hack that forces OBJ_CASE_INSENSITIVE on all Registry APIs... this is needed because we seem to completely mess up case sensitivity otherwise and any user-mode caller that doesn't specify that flag will fail.
- These two fixes fix all the WINE failures for the "ntdll reg" test and should increase compatibility with some applications.
- Runtime Library Registry Wrappers Fixes and Optimizations:
- Use an array of registry paths instead of duplicating them
- Fix implenmentation of RTL_REGISTRY_HANDLE.
- Verify all Appends for failure before continuing.
- Use the strict minimum key permissions isntead of KEY_ALL_ACCESS.
- Don't use OBJ_OPENIF
- Use CAPS for \\REGISTRY\\USER (required to match a Windows quirk exposed by a WINE test)
- Use the correct length in RtlpNtQueryValueKey
- Generic cleanups, formatting and commenting.
svn path=/trunk/; revision=22682
- Also adds implementations for RtlFindMostSignificantBit , RtlFindLeastSignificantBit, RtlFindNextForwardRunClear, RtlFindClearRuns.
- The RtlBitmap* package is essential for compatibility with NTFS.SYS and other File System Drivers, but these fixes should not really improve user-mode app. compat.
svn path=/trunk/; revision=22679