Commit graph

30 commits

Author SHA1 Message Date
Thomas Faber 3d95d5dd14 [NTOS]
- Fix TAG_IRP

svn path=/trunk/; revision=69004
2015-09-04 16:16:48 +00:00
Pierre Schweitzer 51832e3b60 [NTOSKRNL]
Define UNC tag in tag header

svn path=/trunk/; revision=68781
2015-08-21 08:17:48 +00:00
Thomas Faber 9a56808986 [NTOSKRNL]
- More pool tagging!

svn path=/trunk/; revision=66948
2015-03-29 06:04:19 +00:00
Thomas Faber 2c91c440f1 [NTOS:IO]
- Don't delete the device node for root enumerated device objects on failure. It's pointless, since IopEnumerateDevice will just recreate it, and more importantly it causes a use-after-free because IopFreeDeviceNode does not unset the DeviceNode member of the device object extension, so IopEnumerateDevice will try to access the freed node
- Set the device object's DeviceNode pointer to NULL in IopFreeDeviceNode
- Use consistent pool tagging for device nodes
CORE-8671 #resolve

svn path=/trunk/; revision=64950
2014-10-24 09:39:15 +00:00
Thomas Faber 72e7415f50 [NTOS:CC]
- Organize pool tags and make them somewhat Windows-compatible
CORE-8065

svn path=/trunk/; revision=62714
2014-04-12 11:12:14 +00:00
Thomas Faber dca12046f3 [NTOS:CC]
- Remove CacheSegmentSize
- Misc simplifications and style improvements
CORE-7491

svn path=/trunk/; revision=60484
2013-09-30 20:06:18 +00:00
Hermès Bélusca-Maïto 91ef640fe5 Merge my current work done on the kd++ branch:
- FreeLdr is able now to load personalized Kernel Debugger Transport DLLs by reading at the kernel command line and interpreting the /DEBUGPORT=xxx entry (--> loads KDxxx.DLL dll in \SystemRoot\System32\).
  Therefore we can not only load the "default" kdcom.dll, but also 3rd-party ones such as kdbazis.dll from VirtualKD (from revision 58902).
- The GCC-compiled-only version of kdcom, containing legacy COM code, was removed and put directly along KDBG. It remains only a stub / template for future kdcom-like dlls. The MSVC-version remains untouched.
- Make those functions ^ use directly the CPORTLIB library.

svn path=/trunk/; revision=58974
2013-05-09 13:12:58 +00:00
Hermès Bélusca-Maïto e1ef078741 Create this branch to work on loading of different Kernel-Debugger DLL providers, and see whether it is possible to move KDBG from ntoskrnl to a new DLL called, say, KDROSDBG.DLL.
The idea then would be to have the following behaviour (when specifying the following options in the kernel command line):

/DEBUGPORT=COMi --> load KDCOM.DLL and use COMi port (i == 1,2,3,4) if possible.
/DEBUGPORT=FOO  --> load KDFOO.DLL (useful for KDUSB.DLL, KD1394.DLL, KDBAZIS.DLL for VirtualKD, etc...)
/DEBUGPORT=ROSDBG:[COMi|SCREEN|FILE|GDB|...] --> load KDROSDBG.DLL which contains the ROS kernel debugger, and use COMi or SCREEN or... as output port.

svn path=/branches/kd++/; revision=58883
2013-04-28 13:26:45 +00:00
Thomas Faber afdd96eaae [NTOSKRNL]
- Fix callback pool tags
- Fix a reference leak in PsSetCreateProcessNotifyRoutine
See issue #7120 for more details.

svn path=/trunk/; revision=56735
2012-06-14 22:06:24 +00:00
Rafal Harabien 2861515d78 [NTOSKRNL]
- Use tags when allocation and freeing memory and define them in tag.h
- Fix some wrongly used tags when freeing
- Our new memory manager doesn't check tags when ExFreePoolWithTag is used. It will be fixed after testing

svn path=/trunk/; revision=52043
2011-06-01 13:39:36 +00:00
Ged Murphy c5b25b8e9b - Move from using include guards to pragma once.
- Whilst this is non-standard and potentially makes the code less portable, it's supported by both gcc and msvc and should bringg increased compilation speed due to its optimized behaviour (doesn't need to invoke the preprocessor)
- Patch by Amine Khaldi [amine.khaldi@reactos.org]

svn path=/trunk/; revision=45685
2010-02-26 11:43:19 +00:00
Stefan Ginsberg beba1269e6 - Get rid of TAG() from the kernel
- mmtypes.h: Goodbye TAG(), you won't be missed

svn path=/trunk/; revision=42920
2009-08-24 18:19:53 +00:00
Alex Ionescu 8f2eb74d99 - Fix OB_SECURITY_METHOD prototype, callers, and implementors.
- Add call to SeOpenObjectAuditAlarm in ObCheckObjectAccess.
- Start adding Ob Callout validation on checked builds. For now only done around security functions.
- Set *MemoryAllocated to FALSE in ObGetObjectSecurity early on to avoid inconcistent state if the callback failed.
- Implement new XP function ObSetSecurityObjectByPointer and simplify NtSetSecurityObject by making it use it.
- More Win 2003 SecurityDescriptor Cache functions to sdcache instead of obsecure.c.

svn path=/trunk/; revision=25240
2006-12-29 22:17:29 +00:00
Alex Ionescu 635dda87ec - Fix some subtle bugs in NtWaitForMultipleObjects/NtWaitForSingleObject:
- Fail if memory allocation failed.
  - Don't overwrite original captured handle value when decoding to kernel handle.
  - Use PAGED_CODE.
  - Check timeout validity first before probing the entire handle array.
- Fix a critical bug in NtSignalAndWaitForObject which was using the wrong object type (waitable object instead of signalled objecT).

svn path=/trunk/; revision=25239
2006-12-29 20:52:33 +00:00
Alex Ionescu 2fea34f0e1 - Re-implement KiRequestApcInterrupt in ke_x.h. Make it work by CPU number (as documented) instead of comparing PRCBs.
- Move NtQueueApcThread to ps/state.c since it's a Ps-level function.
- Make NtQueueApcThread use POOL_QUOTA_FAIL_INSTEAD_OF_RAISE and add that flag to our DDK. Also fix the check for SystemThread by looking at the flag, not checking if TEB == NULL. Also fix a memory leak and comment header.
- Fix comment header in KiInitalizeUserApc.

svn path=/trunk/; revision=24051
2006-09-11 01:15:03 +00:00
Alex Ionescu 3d6bddb98f [AUDIT] security.c is mostly composed of trivial implementations of APIs that transfer one set of data from another, or simply wrap around complex Se* functions which do the actual work. There are one or two slightly more complex APIs (~15-20 lines), but they were written by Eric/Thomas, which are well-known for always writing clean code.
[FORMATTING] Re-formatted file properly, ordered functions and annotated them, added proper programmer credits, etc.
- Pushlocks need to be acquired in a -critical-, not -guarded- region.
- PsDisableImpersonation should return FALSE if it was already disbled.
- Don't forget to reference the token in PsReferenceEffectiveToken.
- PsImpersonateClient should still return success if it was given no token.
- PsImperstonateClient should de-reference the token if there is already active impersonation info.

svn path=/trunk/; revision=23152
2006-07-18 15:13:55 +00:00
Alex Ionescu f4539b7037 - Massive re-write of some parts of Ps, based on a patch I wrote almost a year ago and peer-reviewed with Thomas and Filip. Causes some shutdown regressions and process leaks (will fix). Needs more work. Changelog:
- Architectural changes to match information in Windows Internals 4 and other documented sources of information (Windows Internals II by Probert). Code should match Win2003 layout.
    - Handle almost any possible process/thread sub structure and add its cleanup code stubs, so that when we actually implement them, we won't forget to clean them up in the process code.
    - Add interlocked usage of process and thread flags in order to make everything more thread-safe.
    - Better handle cases where threads die instantly, race conditions, and other weird issues.
    - Better handle process termination and thread termination.
    - Implement NtCreateProcessEx and update PspCreateProcess/NtCreateProcess.
    - Improve cleanup of process object in PspProcessDelete.
    - Optimize some things like User Thread startup.
    - Add some extra asserts, paged_code checks and also user-mode security check.
    - Implement helper API PsGetNextProcessThread
    - Optimize thread reaper (thanks Filip)
    - Do proper referencing/dereferencing of thread/processes (thanks Thomas)
    - Document FIXMEs needed for Ps code to be up to standards and complete.

svn path=/trunk/; revision=22976
2006-07-09 18:54:13 +00:00
Alex Ionescu 17c27b70cd - Allocate Re-Init entries with a tag
- Fix IoAllocateDriverObjectExtension and IoGetDriverObjectExtension:
  - They were using the wrong structure (a made up one).
  - They were saving the extension where the Driver Object's base address should be.
  - Memory leaks.
  - Sometimes holding the lock too long.
- Created EXTENDED_DRIVER_OBJECT structure in NDK, since parts of the documented one are hidden (much like EXTENDED_DEVICE_OBJECT).
- Fixed IopDeleteDriver to free what it should.
- Fixed IoCreateDriver to handle more failure cases.

svn path=/trunk/; revision=22962
2006-07-09 00:01:31 +00:00
Alex Ionescu aa2513791b - Make an I/O Tagged copy of the file name and properly handle failure.
svn path=/trunk/; revision=22904
2006-07-07 17:29:12 +00:00
Alex Ionescu 790e2352f2 - Allocate a copy of the EA buffer even for kernel-mode requests, also make the call use a tagged buffer.
- Document call to ObOpenObjectByName
- Properly handle and document all possible cases (parse failures vs I/o failures vs both), and handle dereferencing and status codes nicely.
- Detect if the FSD is reparsing, which we don't support now (we'll bugcheck for now, so we can quickly detect this later instead of handling it wrong).

svn path=/trunk/; revision=22882
2006-07-06 03:40:16 +00:00
Alex Ionescu c31f4054ec - Add some missing IO_ERROR definitions to the DDK and add some tags
- 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
2006-07-01 03:36:15 +00:00
Alex Ionescu 766bb1c7a8 - Cleanup profiling and debugging code, add function comment headers and comment the functions in obdir.c
- Remove directory object parsing. Directory objects don't have parse routines. Instead, inline the lookup in ObFindObject (this hasn't been optimized yet, a lot of the code is now setting a = b, c = a, c = b.

svn path=/trunk/; revision=22029
2006-05-24 23:20:50 +00:00
Alex Ionescu 901bb3dc40 - Reorganize most of /ob so that functions inside each module actually follow some sort of cohesive model instead of complete randomness.
svn path=/trunk/; revision=22024
2006-05-24 21:44:59 +00:00
Alex Ionescu 300da88aff - New ERESOURCE implementation: fixes the return value of some functions (VOID vs NTSTATUS, USHORT vs ULONG), as well as optimized the code loops and general structure of the code. Additionnaly, functions do not simply call other functions with similar names; the exact implementation of each function has now been properly separated (see the DDK for more information on this) to have the most optimized scenarios.
- Also, the spinlock is not actually acquired on non-SMP builds; instead, interrupts are blocked and unblocked for acquire/release, this optimizes locking.
- Added many asserts and bugcheck scenarios.
- Added thread priority boosting.
- Added some debugging helpers and deadlock detection.
- Added RESOURCE_NOT_OWNED bugcehck message.
* Thanks again to Waxdragon (Andrew) for testing this build.

svn path=/trunk/; revision=20580
2006-01-05 16:24:32 +00:00
Filip Navara ca071d7417 - Replace MODULE_OBJECT with LDR_DATA_TABLE_ENTRY.
- Export PsGetCurrentThread and PsGetCurrentProcess.

svn path=/trunk/; revision=16894
2005-07-30 16:25:35 +00:00
Alex Ionescu deb7a80fdd Large partial cleanup of ntoskrnl internal headers, mostly to delete obsoleted or non-useful headers, to reformat some horrible tab, spaces, etc mixups, and to move to NDK some public structures and remove all the include headers so that the standard one can be added. Note the word partial, meaning more will come in order to fully fix the mess.
svn path=/trunk/; revision=16268
2005-06-25 17:01:17 +00:00
Hervé Poussineau 7599760096 Read device instance IDs in registry instead of forcing 0000. This allows more than one instance for each device enumerated by Root bus.
Be ready to have resource requirements for each device instance (not used ATM)
Replace some ExAllocatePool/ExFreePool with ExAllocatePoolWithTag/ExFreePoolWithTag

svn path=/trunk/; revision=15671
2005-05-29 19:48:43 +00:00
Alex Ionescu b09db8ab65 Nonpaged Pool Liberation Day: Allow PagedPool to be used earlier, allow fast mutex to be used earlier on debug builds. Allocate all Se stuff from PagedPool, set the right object types to use paged pool, allocate all strings from paged pool, allocate PE sections from paged pool, and a bunch of other things which should, imo, be in paged pool. If anyone has any contradicting proof, let me know...until then, enjoy ~4-6MB more NonPagedPool
svn path=/trunk/; revision=15492
2005-05-25 04:16:56 +00:00
Steven Edwards 7fb3ebb9f9 move the rest of the alread defined tags to the private tag.h
svn path=/trunk/; revision=15427
2005-05-20 04:33:47 +00:00
Steven Edwards 3354ce28a8 started moving tags to a private internal header
svn path=/trunk/; revision=15426
2005-05-20 03:50:13 +00:00