1998-09-13 15:55:36 +00:00
|
|
|
/*
|
2006-06-12 05:58:08 +00:00
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2015-10-04 11:54:25 +00:00
|
|
|
* FILE: ntoskrnl/include/internal/ob.h
|
2006-06-12 05:58:08 +00:00
|
|
|
* PURPOSE: Internal header for the Object Manager
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
*/
|
2006-07-23 05:43:28 +00:00
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Define this if you want debugging support
|
|
|
|
//
|
2009-06-01 06:21:12 +00:00
|
|
|
#define _OB_DEBUG_ 0x00
|
2006-06-12 05:58:08 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// These define the Debug Masks Supported
|
|
|
|
//
|
|
|
|
#define OB_HANDLE_DEBUG 0x01
|
|
|
|
#define OB_NAMESPACE_DEBUG 0x02
|
|
|
|
#define OB_SECURITY_DEBUG 0x04
|
|
|
|
#define OB_REFERENCE_DEBUG 0x08
|
|
|
|
#define OB_CALLBACK_DEBUG 0x10
|
|
|
|
|
|
|
|
//
|
|
|
|
// Debug/Tracing support
|
|
|
|
//
|
|
|
|
#if _OB_DEBUG_
|
|
|
|
#ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
|
|
|
|
#define OBTRACE DbgPrintEx
|
|
|
|
#else
|
|
|
|
#define OBTRACE(x, ...) \
|
|
|
|
if (x & ObpTraceLevel) DbgPrint(__VA_ARGS__)
|
|
|
|
#endif
|
|
|
|
#else
|
2011-07-31 19:26:11 +00:00
|
|
|
#define OBTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__)
|
2006-06-12 05:58:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Mask to detect GENERIC_XXX access masks being used
|
|
|
|
//
|
|
|
|
#define GENERIC_ACCESS \
|
|
|
|
(GENERIC_READ | \
|
|
|
|
GENERIC_WRITE | \
|
|
|
|
GENERIC_EXECUTE | \
|
|
|
|
GENERIC_ALL)
|
|
|
|
|
2007-01-22 08:15:17 +00:00
|
|
|
//
|
|
|
|
// Handle Bit Flags
|
|
|
|
//
|
|
|
|
#define OBJ_PROTECT_CLOSE 0x01
|
|
|
|
//#define OBJ_INHERIT 0x02
|
|
|
|
#define OBJ_AUDIT_OBJECT_CLOSE 0x04
|
|
|
|
#define OBJ_HANDLE_ATTRIBUTES (OBJ_PROTECT_CLOSE |\
|
|
|
|
OBJ_INHERIT | \
|
|
|
|
OBJ_AUDIT_OBJECT_CLOSE)
|
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Identifies a Kernel Handle
|
|
|
|
//
|
2012-02-04 23:08:20 +00:00
|
|
|
#ifdef _WIN64
|
|
|
|
#define KERNEL_HANDLE_FLAG 0xFFFFFFFF80000000ULL
|
|
|
|
#else
|
|
|
|
#define KERNEL_HANDLE_FLAG 0x80000000
|
|
|
|
#endif
|
2013-11-18 14:27:01 +00:00
|
|
|
#define ObpIsKernelHandle(Handle, ProcessorMode) \
|
|
|
|
((((ULONG_PTR)(Handle) & KERNEL_HANDLE_FLAG) == KERNEL_HANDLE_FLAG) && \
|
|
|
|
((ProcessorMode) == KernelMode) && \
|
|
|
|
((Handle) != NtCurrentProcess()) && \
|
|
|
|
((Handle) != NtCurrentThread()))
|
2006-06-12 05:58:08 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Converts to and from a Kernel Handle to a normal handle
|
|
|
|
//
|
|
|
|
#define ObKernelHandleToHandle(Handle) \
|
|
|
|
(HANDLE)((ULONG_PTR)(Handle) & ~KERNEL_HANDLE_FLAG)
|
|
|
|
#define ObMarkHandleAsKernelHandle(Handle) \
|
|
|
|
(HANDLE)((ULONG_PTR)(Handle) | KERNEL_HANDLE_FLAG)
|
|
|
|
|
2007-01-22 08:15:17 +00:00
|
|
|
//
|
|
|
|
// Converts from an EXHANDLE object to a POBJECT_HEADER
|
|
|
|
//
|
|
|
|
#define ObpGetHandleObject(x) \
|
|
|
|
((POBJECT_HEADER)((ULONG_PTR)x->Object & ~OBJ_HANDLE_ATTRIBUTES))
|
|
|
|
|
2008-04-01 21:09:28 +00:00
|
|
|
//
|
|
|
|
// Recovers the security descriptor from a cached security descriptor header
|
|
|
|
//
|
|
|
|
#define ObpGetHeaderForSd(x) \
|
|
|
|
CONTAINING_RECORD((x), SECURITY_DESCRIPTOR_HEADER, SecurityDescriptor)
|
|
|
|
|
|
|
|
//
|
|
|
|
// Recovers the security descriptor from a cached security descriptor list entry
|
|
|
|
//
|
|
|
|
#define ObpGetHeaderForEntry(x) \
|
|
|
|
CONTAINING_RECORD((x), SECURITY_DESCRIPTOR_HEADER, Link)
|
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Context Structures for Ex*Handle Callbacks
|
|
|
|
//
|
2006-06-05 00:04:36 +00:00
|
|
|
typedef struct _OBP_SET_HANDLE_ATTRIBUTES_CONTEXT
|
|
|
|
{
|
|
|
|
KPROCESSOR_MODE PreviousMode;
|
|
|
|
OBJECT_HANDLE_ATTRIBUTE_INFORMATION Information;
|
|
|
|
} OBP_SET_HANDLE_ATTRIBUTES_CONTEXT, *POBP_SET_HANDLE_ATTRIBUTES_CONTEXT;
|
2008-04-01 21:09:28 +00:00
|
|
|
|
2006-06-08 18:09:01 +00:00
|
|
|
typedef struct _OBP_CLOSE_HANDLE_CONTEXT
|
|
|
|
{
|
|
|
|
PHANDLE_TABLE HandleTable;
|
|
|
|
KPROCESSOR_MODE AccessMode;
|
|
|
|
} OBP_CLOSE_HANDLE_CONTEXT, *POBP_CLOSE_HANDLE_CONTEXT;
|
2008-04-01 21:09:28 +00:00
|
|
|
|
2007-01-08 19:40:10 +00:00
|
|
|
typedef struct _OBP_FIND_HANDLE_DATA
|
|
|
|
{
|
|
|
|
POBJECT_HEADER ObjectHeader;
|
|
|
|
POBJECT_TYPE ObjectType;
|
|
|
|
POBJECT_HANDLE_INFORMATION HandleInformation;
|
|
|
|
} OBP_FIND_HANDLE_DATA, *POBP_FIND_HANDLE_DATA;
|
2006-06-08 18:09:01 +00:00
|
|
|
|
2008-04-01 21:09:28 +00:00
|
|
|
//
|
|
|
|
// Cached Security Descriptor Header
|
|
|
|
//
|
|
|
|
typedef struct _SECURITY_DESCRIPTOR_HEADER
|
|
|
|
{
|
|
|
|
LIST_ENTRY Link;
|
|
|
|
ULONG RefCount;
|
|
|
|
ULONG FullHash;
|
2009-01-28 10:32:43 +00:00
|
|
|
QUAD SecurityDescriptor;
|
2008-04-01 21:09:28 +00:00
|
|
|
} SECURITY_DESCRIPTOR_HEADER, *PSECURITY_DESCRIPTOR_HEADER;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Cached Security Descriptor List
|
|
|
|
//
|
|
|
|
typedef struct _OB_SD_CACHE_LIST
|
|
|
|
{
|
|
|
|
EX_PUSH_LOCK PushLock;
|
|
|
|
LIST_ENTRY Head;
|
|
|
|
} OB_SD_CACHE_LIST, *POB_SD_CACHE_LIST;
|
|
|
|
|
2007-01-22 22:16:13 +00:00
|
|
|
//
|
|
|
|
// Structure for quick-compare of a DOS Device path
|
|
|
|
//
|
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
WCHAR Name[sizeof(ULARGE_INTEGER) / sizeof(WCHAR)];
|
|
|
|
ULARGE_INTEGER Alignment;
|
|
|
|
} ALIGNEDNAME;
|
|
|
|
|
2007-01-08 08:03:47 +00:00
|
|
|
//
|
|
|
|
// Private Temporary Buffer for Lookup Routines
|
|
|
|
//
|
2009-08-24 18:19:53 +00:00
|
|
|
#define TAG_OB_TEMP_STORAGE 'tSbO'
|
2007-01-08 08:03:47 +00:00
|
|
|
typedef struct _OB_TEMP_BUFFER
|
|
|
|
{
|
|
|
|
ACCESS_STATE LocalAccessState;
|
|
|
|
OBJECT_CREATE_INFORMATION ObjectCreateInfo;
|
|
|
|
OBP_LOOKUP_CONTEXT LookupContext;
|
2008-06-16 08:54:21 +00:00
|
|
|
AUX_ACCESS_DATA AuxData;
|
2007-01-08 08:03:47 +00:00
|
|
|
} OB_TEMP_BUFFER, *POB_TEMP_BUFFER;
|
|
|
|
|
2008-04-01 19:27:58 +00:00
|
|
|
//
|
|
|
|
// Startup and Shutdown Functions
|
|
|
|
//
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
ObInitSystem(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObShutdownSystem(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Directory Namespace Functions
|
|
|
|
//
|
2006-05-24 20:06:13 +00:00
|
|
|
BOOLEAN
|
2005-09-13 23:48:54 +00:00
|
|
|
NTAPI
|
2006-06-06 21:02:55 +00:00
|
|
|
ObpDeleteEntryDirectory(
|
|
|
|
IN POBP_LOOKUP_CONTEXT Context
|
|
|
|
);
|
2005-09-13 23:48:54 +00:00
|
|
|
|
2006-05-24 20:06:13 +00:00
|
|
|
BOOLEAN
|
2006-05-24 04:28:57 +00:00
|
|
|
NTAPI
|
2006-06-06 21:02:55 +00:00
|
|
|
ObpInsertEntryDirectory(
|
|
|
|
IN POBJECT_DIRECTORY Parent,
|
|
|
|
IN POBP_LOOKUP_CONTEXT Context,
|
|
|
|
IN POBJECT_HEADER ObjectHeader
|
|
|
|
);
|
2006-05-24 04:28:57 +00:00
|
|
|
|
2006-05-24 20:06:13 +00:00
|
|
|
PVOID
|
2005-09-13 23:48:54 +00:00
|
|
|
NTAPI
|
2006-06-06 21:02:55 +00:00
|
|
|
ObpLookupEntryDirectory(
|
|
|
|
IN POBJECT_DIRECTORY Directory,
|
|
|
|
IN PUNICODE_STRING Name,
|
|
|
|
IN ULONG Attributes,
|
|
|
|
IN UCHAR SearchShadow,
|
|
|
|
IN POBP_LOOKUP_CONTEXT Context
|
|
|
|
);
|
1998-10-05 04:01:30 +00:00
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Symbolic Link Functions
|
|
|
|
//
|
2003-02-25 16:43:45 +00:00
|
|
|
VOID
|
2005-09-13 23:48:54 +00:00
|
|
|
NTAPI
|
- Set OBJ_OPENLINK invalid for core object types.
- Initialize symbolic link in-line with other core object types.
- Use the SePublicDefaultUnrestrictedSd directly instead of building another SD.
- Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling.
- Create core objects with OBJ_CASE_INSENSITIVE.
- Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore.
- Support Quota Information during object allocation and deallocation isntead of ignoring it.
- Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation).
- Use the right object key when freeing the object.
- Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables.
- Add various accounting variables.
- Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit).
- Add checks to see if Quota informatio is needed.
- Clear CreatorBackTraceIndex during allocation.
- Remove CreatorUniqueProcess hack from back when the idle thread was NULL.
- Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL).
- Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption).
- Update HighWaterNumberOfObjects when needed.
- If caller didn't give pool charges, use the one from the object type.
- Clear the Total/HighWater* values for newly created object types instead of using random values.
- Properly typecast the WCHAR tag as CHAR.
- Insert each new object type in the ObTypeObjectType Type List.
- Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented.
- Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists.
- Move DOS Devices\"??" initialization in its own routine and fix it:
- Use Nt APIs for all operations instead of raw I/O.
- Create GLOBALROOT link to \
- Create \??\Global link to \??
svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
|
|
|
ObpDeleteSymbolicLink(
|
|
|
|
IN PVOID ObjectBody
|
2006-06-06 21:02:55 +00:00
|
|
|
);
|
1998-10-05 04:01:30 +00:00
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ObpParseSymbolicLink(
|
|
|
|
IN PVOID ParsedObject,
|
|
|
|
IN PVOID ObjectType,
|
|
|
|
IN OUT PACCESS_STATE AccessState,
|
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
IN ULONG Attributes,
|
|
|
|
IN OUT PUNICODE_STRING FullPath,
|
|
|
|
IN OUT PUNICODE_STRING RemainingName,
|
|
|
|
IN OUT PVOID Context OPTIONAL,
|
|
|
|
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
|
|
|
|
OUT PVOID *NextObject
|
|
|
|
);
|
|
|
|
|
2007-01-08 19:52:49 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpCreateSymbolicLinkName(
|
|
|
|
IN POBJECT_SYMBOLIC_LINK SymbolicLink
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpDeleteSymbolicLinkName(
|
|
|
|
IN POBJECT_SYMBOLIC_LINK SymbolicLink
|
|
|
|
);
|
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Process/Handle Table Init/Rundown
|
|
|
|
//
|
2006-05-24 04:28:57 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
- PS_UNKNOWN_VALUE determines if the process should be created with large pages: rename to PS_LARGE_PAGES
- Do Address Space initialization as per "Windows Internals II" slides, either for the Boot, System, Cloned User or New User Process cases.
- Rename MmCreateProcessAddressSpace to MmInitializeProcessAddressSpace, and MmCopyMmInfo to MmCreateProcessAddressSpace. What ReactOS did is correct as per "Windows Internals II", but the names were inverted.
- Clone the Object Table if we are the boot process, and only initialize part of the address space (since we don't need things like guard page, TEB, etc), however, do initialize and map the shared user data section.
- Make the initial system process and idle process share the same page directory instead of creating a new one.
- Use the same priority class as the parent process, if the process was in the idle or below-normal priority class.
- Only duplicate handles if the caller requested it, instead of always duplicating the process's handles!
- Generate a null image file name for system processes.
- Rename ObpCreateHandleTable to ObInitProcess and better handle race and out-of-memory conditions. Detect if auditing required, but don't do anything about it.
- Initialize the Idle/System process address space much earlier in the boot process, in MmInitSystem.
Thanks to Alex for providing various information, and answering all my questions.
svn path=/trunk/; revision=29223
2007-09-26 20:55:26 +00:00
|
|
|
ObInitProcess(
|
|
|
|
IN PEPROCESS Parent OPTIONAL,
|
2006-06-06 21:02:55 +00:00
|
|
|
IN PEPROCESS Process
|
2006-05-24 04:28:57 +00:00
|
|
|
);
|
|
|
|
|
2007-01-10 03:35:59 +00:00
|
|
|
PHANDLE_TABLE
|
|
|
|
NTAPI
|
|
|
|
ObReferenceProcessHandleTable(
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObDereferenceProcessHandleTable(
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
|
|
|
|
2005-09-13 23:48:54 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2006-06-06 21:02:55 +00:00
|
|
|
ObKillProcess(
|
|
|
|
IN PEPROCESS Process
|
2005-09-13 23:48:54 +00:00
|
|
|
);
|
1998-09-13 15:55:36 +00:00
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Object Lookup Functions
|
|
|
|
//
|
2005-09-13 23:48:54 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
2007-01-08 08:03:47 +00:00
|
|
|
ObpLookupObjectName(
|
2006-05-28 19:05:19 +00:00
|
|
|
IN HANDLE RootHandle,
|
|
|
|
IN PUNICODE_STRING ObjectName,
|
|
|
|
IN ULONG Attributes,
|
|
|
|
IN POBJECT_TYPE ObjectType,
|
2007-01-08 08:03:47 +00:00
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
IN OUT PVOID ParseContext,
|
2006-05-28 19:05:19 +00:00
|
|
|
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
|
2007-01-08 08:03:47 +00:00
|
|
|
IN PVOID InsertObject,
|
|
|
|
IN PACCESS_STATE AccessState,
|
|
|
|
IN POBP_LOOKUP_CONTEXT LookupContext,
|
|
|
|
OUT PVOID *FoundObject
|
2005-09-13 23:48:54 +00:00
|
|
|
);
|
2003-10-21 15:50:51 +00:00
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Object Attribute Functions
|
|
|
|
//
|
2006-06-05 00:04:36 +00:00
|
|
|
BOOLEAN
|
2005-09-13 23:48:54 +00:00
|
|
|
NTAPI
|
|
|
|
ObpSetHandleAttributes(
|
2006-06-05 00:04:36 +00:00
|
|
|
IN OUT PHANDLE_TABLE_ENTRY HandleTableEntry,
|
2007-01-22 08:15:17 +00:00
|
|
|
IN ULONG_PTR Context
|
2005-09-13 23:48:54 +00:00
|
|
|
);
|
1999-02-06 18:34:14 +00:00
|
|
|
|
2004-11-21 06:51:18 +00:00
|
|
|
VOID
|
2006-06-06 21:02:55 +00:00
|
|
|
NTAPI
|
2005-09-13 23:48:54 +00:00
|
|
|
ObQueryDeviceMapInformation(
|
2006-06-06 21:02:55 +00:00
|
|
|
IN PEPROCESS Process,
|
|
|
|
OUT PPROCESS_DEVICEMAP_INFORMATION DeviceMapInfo
|
2005-09-13 23:48:54 +00:00
|
|
|
);
|
2004-07-16 17:20:23 +00:00
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Object Lifetime Functions
|
|
|
|
//
|
2006-05-29 00:05:07 +00:00
|
|
|
VOID
|
- Fix critical bugs in exception handling: Unwinding was completely broken, using the wrong SEH protector to detect collided unwinding. The correct protector itself also had a broken check.
- Fix architectural bug in the entire TrapFrame<->Context conversion system and Ring Privilege Transitions (Inter-ring and intra-ring) which was lacking proper sanitation and validation of segments, flags and debug registers. Among other things, IOPL is now respected, CS is not KGDT_R0_CODE | RPL_MASK anymore, and the GPF code is now properly being called. This completely fixes exception handling being totally broken and crashing firefox installer, mirc, and other applications.
- Rewrite the page fault handler base code in assembly instead of relying on a broken C routine. Detect VDM, V8086, detecting expected/normal fault in ExpInterlockedPopEntrySList and faults in the system handler code. Rewrite MmAccessFault to be the main function that calls out to other sub-fault functions, and use the same prototype as NT.
- Fix the KGDT boot table to have proper granularity and big flags, and extend it to 256 entries.
- Create proper thread context in RtlInitializeContext and cleanup Rtl Thread routines.
- Remove all int3 and breakpoints from trap handlers, and replace them with a much better "UNHANDLED_PATH" macro which freezes the system, beeps, and displays a message with the line of code that's unhandled. This is to clearly tell the user that something is unhandled, instead of nesting infinite exceptions due to the int3.
- Fix a bug in INT_PROLOG.
- Sanitize EFLAGS and Code Segments in KeContextToTrapFrame and KeTrapFrameToContext.
- Implement KiUpdateDr7 and KiRecordDr7 as well as DR_MASK and other DR-validation macros and functions to protect against DR-vulnerabilites as well as to properly account for each active hardware breakpoint in a per-thread fashion by using the dispatcher header.
- Allow CR0_EM when running in a VDM.
- Fix FPU/NPX Register handling in KeContextToTrapFrame and KeTrapFrameToContext, and also speed it up by manual copying instead of a memory move.
- Properly give IOPL 3 to user-mode threads if they requested it.
- Detect GPF during GPF.
- Detect pagefault with a trap-frame spread over two or more pages and nested.
- Properly sanitize and set correct trap frame in KiInitailizeUserApc.
- Return STATUS_ACCESS_VIOLATION during page faults instead of STATUS_UNSUCESSFUL.
- Fix assert in VdmSwapContext, as well as Code Selector check which was broken.
- Fix delayed object deletion (ObDeferDeleteObject) and the Ob Repear Routine and list.
- Update Kernel Fun.
- BUGBUG: Temporaily hack VMWare to detection to always detect VMWare.
svn path=/trunk/; revision=25238
2006-12-29 18:49:00 +00:00
|
|
|
NTAPI
|
2006-05-29 00:05:07 +00:00
|
|
|
ObpDeleteObject(
|
- Fix critical bugs in exception handling: Unwinding was completely broken, using the wrong SEH protector to detect collided unwinding. The correct protector itself also had a broken check.
- Fix architectural bug in the entire TrapFrame<->Context conversion system and Ring Privilege Transitions (Inter-ring and intra-ring) which was lacking proper sanitation and validation of segments, flags and debug registers. Among other things, IOPL is now respected, CS is not KGDT_R0_CODE | RPL_MASK anymore, and the GPF code is now properly being called. This completely fixes exception handling being totally broken and crashing firefox installer, mirc, and other applications.
- Rewrite the page fault handler base code in assembly instead of relying on a broken C routine. Detect VDM, V8086, detecting expected/normal fault in ExpInterlockedPopEntrySList and faults in the system handler code. Rewrite MmAccessFault to be the main function that calls out to other sub-fault functions, and use the same prototype as NT.
- Fix the KGDT boot table to have proper granularity and big flags, and extend it to 256 entries.
- Create proper thread context in RtlInitializeContext and cleanup Rtl Thread routines.
- Remove all int3 and breakpoints from trap handlers, and replace them with a much better "UNHANDLED_PATH" macro which freezes the system, beeps, and displays a message with the line of code that's unhandled. This is to clearly tell the user that something is unhandled, instead of nesting infinite exceptions due to the int3.
- Fix a bug in INT_PROLOG.
- Sanitize EFLAGS and Code Segments in KeContextToTrapFrame and KeTrapFrameToContext.
- Implement KiUpdateDr7 and KiRecordDr7 as well as DR_MASK and other DR-validation macros and functions to protect against DR-vulnerabilites as well as to properly account for each active hardware breakpoint in a per-thread fashion by using the dispatcher header.
- Allow CR0_EM when running in a VDM.
- Fix FPU/NPX Register handling in KeContextToTrapFrame and KeTrapFrameToContext, and also speed it up by manual copying instead of a memory move.
- Properly give IOPL 3 to user-mode threads if they requested it.
- Detect GPF during GPF.
- Detect pagefault with a trap-frame spread over two or more pages and nested.
- Properly sanitize and set correct trap frame in KiInitailizeUserApc.
- Return STATUS_ACCESS_VIOLATION during page faults instead of STATUS_UNSUCESSFUL.
- Fix assert in VdmSwapContext, as well as Code Selector check which was broken.
- Fix delayed object deletion (ObDeferDeleteObject) and the Ob Repear Routine and list.
- Update Kernel Fun.
- BUGBUG: Temporaily hack VMWare to detection to always detect VMWare.
svn path=/trunk/; revision=25238
2006-12-29 18:49:00 +00:00
|
|
|
IN PVOID Object,
|
|
|
|
IN BOOLEAN CalledFromWorkerThread
|
2006-05-29 00:05:07 +00:00
|
|
|
);
|
|
|
|
|
2006-07-23 17:45:30 +00:00
|
|
|
LONG
|
|
|
|
FASTCALL
|
|
|
|
ObDereferenceObjectEx(
|
|
|
|
IN PVOID Object,
|
2006-10-25 18:23:45 +00:00
|
|
|
IN LONG Count
|
2006-07-23 17:45:30 +00:00
|
|
|
);
|
|
|
|
|
2006-07-20 05:33:03 +00:00
|
|
|
LONG
|
|
|
|
FASTCALL
|
|
|
|
ObReferenceObjectEx(
|
|
|
|
IN PVOID Object,
|
2006-10-25 18:23:45 +00:00
|
|
|
IN LONG Count
|
2006-07-20 05:33:03 +00:00
|
|
|
);
|
|
|
|
|
2006-07-20 18:47:35 +00:00
|
|
|
BOOLEAN
|
|
|
|
FASTCALL
|
|
|
|
ObReferenceObjectSafe(
|
|
|
|
IN PVOID Object
|
|
|
|
);
|
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpReapObject(
|
|
|
|
IN PVOID Unused
|
2006-05-24 21:44:59 +00:00
|
|
|
);
|
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
ObpSetPermanentObject(
|
|
|
|
IN PVOID ObjectBody,
|
|
|
|
IN BOOLEAN Permanent
|
|
|
|
);
|
2004-07-16 17:20:23 +00:00
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpDeleteNameCheck(
|
|
|
|
IN PVOID Object
|
|
|
|
);
|
|
|
|
|
2006-07-09 18:54:13 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
- Set OBJ_OPENLINK invalid for core object types.
- Initialize symbolic link in-line with other core object types.
- Use the SePublicDefaultUnrestrictedSd directly instead of building another SD.
- Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling.
- Create core objects with OBJ_CASE_INSENSITIVE.
- Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore.
- Support Quota Information during object allocation and deallocation isntead of ignoring it.
- Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation).
- Use the right object key when freeing the object.
- Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables.
- Add various accounting variables.
- Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit).
- Add checks to see if Quota informatio is needed.
- Clear CreatorBackTraceIndex during allocation.
- Remove CreatorUniqueProcess hack from back when the idle thread was NULL.
- Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL).
- Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption).
- Update HighWaterNumberOfObjects when needed.
- If caller didn't give pool charges, use the one from the object type.
- Clear the Total/HighWater* values for newly created object types instead of using random values.
- Properly typecast the WCHAR tag as CHAR.
- Insert each new object type in the ObTypeObjectType Type List.
- Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented.
- Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists.
- Move DOS Devices\"??" initialization in its own routine and fix it:
- Use Nt APIs for all operations instead of raw I/O.
- Create GLOBALROOT link to \
- Create \??\Global link to \??
svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
|
|
|
ObClearProcessHandleTable(
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
2006-07-09 18:54:13 +00:00
|
|
|
|
2006-10-19 20:08:52 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ObDuplicateObject(
|
|
|
|
IN PEPROCESS SourceProcess,
|
|
|
|
IN HANDLE SourceHandle,
|
|
|
|
IN PEPROCESS TargetProcess OPTIONAL,
|
|
|
|
IN PHANDLE TargetHandle OPTIONAL,
|
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN ULONG HandleAttributes,
|
|
|
|
IN ULONG Options,
|
|
|
|
IN KPROCESSOR_MODE PreviousMode
|
|
|
|
);
|
|
|
|
|
- Fix SleepEx.
- Put volatile statements in EX_RUNDOWN_REF, IRP, DEVICE_OBJECT, ERESOURCE, FILE_OBJECT, IO_REMOVE_LOCK, WORK_QUEUE_ITEM where required (thanks to Microsoft's changes in the WDK to mark the fields properly).
- Update FILE_OBJECT definition.
- Add some asserts to some I/O functions.
- Add stub support for File Objects created by XP+ Drivers which have File Object Extensions.
- Add some fixes to IopDeleteFile, including proper reference counting for the DO and VPB, as well as cleanup when the file is closed without a handle.
- Fix a bug in IopSecurityFile.
- Queue and unqueue IRPs in all I/O functions.
- Fully support IRP cancellation now.
- Fix critical bugs in NtDeviceIoControlFile and NtDeviceFsControlFile which were causing double queueing of IRPs and freeing of invalid memory, as well as invalid paramter checking for user-mode buffers.
- Add exhaustive validation checks to IoCreateFile, add more failure cases, and validate the EA buffer. Also support IO_ATTACH_DEVICE_API flag.
- Implement IoCreateStreamFileObjectEx and IoCreateStreamFileObjectLite and fix several bugs in the original implementation of IoCreateStreamFileObject.
- Fix a bug in RtlRaiseException.
- Update Io*ShareAccess routines to support XP+ style semantics related to special File Object flags which disable their use.
- Add validation to all Query/Set routines so that information clasess, lengths, buffers and alignment are properly checked.
- Also add an array for the proper acess rights that each query/set operation requires.
- Check backup/restore privileges during I/O File operations.
- Check traverse access during I/O File Operations.
- Check access privileges to the device during I/O file operations.
- Rename IopReferenceDeviceObject and also verify if an exclusive DO is trying to be invalidly opened.
- Support various extra security checks during I/O File/Device Parse Routine.
- Fix a bug during IopCleanupIrp so that we don't dereference the File OBject if this was a create operation.
- Fix some bogus asserts in IofCompleteRequest, and save the IRP Flags before signalling it's event, since the driver might've freed it behind our back.
- Fix a large bug in ObInsertObject which affected the insert of unnamed objects with forced security options (Such as process/threads).
- Fix the creation of the Process/Thread/Job Obejct Types to that security information is forced.
- Remove "Fix PS!!!" messages since the bug is now fixed and these objects now get proper security descriptors.
- Fix another bug in ObInsertObjet which wasn't properly validating user-mode objects and always assumed kernel mode.
- Silence multiple trace/checkpoint messages that have accumulated throughout time for various debugging purposes.
svn path=/trunk/; revision=25118
2006-12-10 18:40:30 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObFreeObjectCreateInfoBuffer(
|
|
|
|
IN POBJECT_CREATE_INFORMATION ObjectCreateInfo
|
|
|
|
);
|
|
|
|
|
2007-01-08 21:02:22 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpFreeObjectNameBuffer(
|
|
|
|
IN PUNICODE_STRING Name
|
|
|
|
);
|
|
|
|
|
2008-04-01 19:27:58 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpDeleteObjectType(
|
|
|
|
IN PVOID Object
|
|
|
|
);
|
|
|
|
|
- Set OBJ_OPENLINK invalid for core object types.
- Initialize symbolic link in-line with other core object types.
- Use the SePublicDefaultUnrestrictedSd directly instead of building another SD.
- Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling.
- Create core objects with OBJ_CASE_INSENSITIVE.
- Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore.
- Support Quota Information during object allocation and deallocation isntead of ignoring it.
- Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation).
- Use the right object key when freeing the object.
- Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables.
- Add various accounting variables.
- Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit).
- Add checks to see if Quota informatio is needed.
- Clear CreatorBackTraceIndex during allocation.
- Remove CreatorUniqueProcess hack from back when the idle thread was NULL.
- Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL).
- Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption).
- Update HighWaterNumberOfObjects when needed.
- If caller didn't give pool charges, use the one from the object type.
- Clear the Total/HighWater* values for newly created object types instead of using random values.
- Properly typecast the WCHAR tag as CHAR.
- Insert each new object type in the ObTypeObjectType Type List.
- Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented.
- Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists.
- Move DOS Devices\"??" initialization in its own routine and fix it:
- Use Nt APIs for all operations instead of raw I/O.
- Create GLOBALROOT link to \
- Create \??\Global link to \??
svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
|
|
|
//
|
|
|
|
// DOS Devices Functions
|
|
|
|
//
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObDereferenceDeviceMap(
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
|
|
|
|
2007-01-08 08:03:47 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
ObfDereferenceDeviceMap(
|
|
|
|
IN PVOID DeviceMap
|
|
|
|
);
|
|
|
|
|
- Set OBJ_OPENLINK invalid for core object types.
- Initialize symbolic link in-line with other core object types.
- Use the SePublicDefaultUnrestrictedSd directly instead of building another SD.
- Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling.
- Create core objects with OBJ_CASE_INSENSITIVE.
- Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore.
- Support Quota Information during object allocation and deallocation isntead of ignoring it.
- Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation).
- Use the right object key when freeing the object.
- Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables.
- Add various accounting variables.
- Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit).
- Add checks to see if Quota informatio is needed.
- Clear CreatorBackTraceIndex during allocation.
- Remove CreatorUniqueProcess hack from back when the idle thread was NULL.
- Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL).
- Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption).
- Update HighWaterNumberOfObjects when needed.
- If caller didn't give pool charges, use the one from the object type.
- Clear the Total/HighWater* values for newly created object types instead of using random values.
- Properly typecast the WCHAR tag as CHAR.
- Insert each new object type in the ObTypeObjectType Type List.
- Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented.
- Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists.
- Move DOS Devices\"??" initialization in its own routine and fix it:
- Use Nt APIs for all operations instead of raw I/O.
- Create GLOBALROOT link to \
- Create \??\Global link to \??
svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObInheritDeviceMap(
|
|
|
|
IN PEPROCESS Parent,
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ObpCreateDosDevicesDirectory(
|
|
|
|
VOID
|
|
|
|
);
|
2006-07-09 18:54:13 +00:00
|
|
|
|
- Set OBJ_OPENLINK invalid for core object types.
- Initialize symbolic link in-line with other core object types.
- Use the SePublicDefaultUnrestrictedSd directly instead of building another SD.
- Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling.
- Create core objects with OBJ_CASE_INSENSITIVE.
- Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore.
- Support Quota Information during object allocation and deallocation isntead of ignoring it.
- Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation).
- Use the right object key when freeing the object.
- Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables.
- Add various accounting variables.
- Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit).
- Add checks to see if Quota informatio is needed.
- Clear CreatorBackTraceIndex during allocation.
- Remove CreatorUniqueProcess hack from back when the idle thread was NULL.
- Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL).
- Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption).
- Update HighWaterNumberOfObjects when needed.
- If caller didn't give pool charges, use the one from the object type.
- Clear the Total/HighWater* values for newly created object types instead of using random values.
- Properly typecast the WCHAR tag as CHAR.
- Insert each new object type in the ObTypeObjectType Type List.
- Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented.
- Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists.
- Move DOS Devices\"??" initialization in its own routine and fix it:
- Use Nt APIs for all operations instead of raw I/O.
- Create GLOBALROOT link to \
- Create \??\Global link to \??
svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
|
|
|
//
|
|
|
|
// Security descriptor cache functions
|
|
|
|
//
|
2004-07-16 17:20:23 +00:00
|
|
|
NTSTATUS
|
2005-09-13 23:48:54 +00:00
|
|
|
NTAPI
|
2006-06-12 05:58:08 +00:00
|
|
|
ObpInitSdCache(
|
|
|
|
VOID
|
|
|
|
);
|
2004-07-16 17:20:23 +00:00
|
|
|
|
2006-06-08 05:41:39 +00:00
|
|
|
PSECURITY_DESCRIPTOR
|
2005-09-13 23:48:54 +00:00
|
|
|
NTAPI
|
2008-04-01 21:09:28 +00:00
|
|
|
ObpReferenceSecurityDescriptor(
|
|
|
|
IN POBJECT_HEADER ObjectHeader
|
2006-06-12 05:58:08 +00:00
|
|
|
);
|
2004-07-23 21:44:10 +00:00
|
|
|
|
2007-01-08 08:03:47 +00:00
|
|
|
//
|
|
|
|
// Object Security Routines
|
|
|
|
//
|
2006-06-29 05:05:27 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
ObCheckObjectAccess(
|
|
|
|
IN PVOID Object,
|
|
|
|
IN OUT PACCESS_STATE AccessState,
|
2007-01-08 08:03:47 +00:00
|
|
|
IN BOOLEAN LockHeld,
|
2006-06-29 05:05:27 +00:00
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
OUT PNTSTATUS ReturnedStatus
|
|
|
|
);
|
|
|
|
|
2007-01-08 08:03:47 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
ObCheckCreateObjectAccess(
|
|
|
|
IN PVOID Object,
|
|
|
|
IN ACCESS_MASK CreateAccess,
|
|
|
|
IN PACCESS_STATE AccessState,
|
|
|
|
IN PUNICODE_STRING ComponentName,
|
|
|
|
IN BOOLEAN LockHeld,
|
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
OUT PNTSTATUS AccessStatus
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
ObpCheckTraverseAccess(
|
|
|
|
IN PVOID Object,
|
|
|
|
IN ACCESS_MASK TraverseAccess,
|
|
|
|
IN PACCESS_STATE AccessState OPTIONAL,
|
|
|
|
IN BOOLEAN LockHeld,
|
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
OUT PNTSTATUS AccessStatus
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
ObpCheckObjectReference(
|
|
|
|
IN PVOID Object,
|
|
|
|
IN OUT PACCESS_STATE AccessState,
|
|
|
|
IN BOOLEAN LockHeld,
|
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
OUT PNTSTATUS AccessStatus
|
|
|
|
);
|
|
|
|
|
2008-03-31 20:07:02 +00:00
|
|
|
//
|
|
|
|
// Default Object Security Callback Routines
|
|
|
|
//
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ObAssignObjectSecurityDescriptor(
|
|
|
|
IN PVOID Object,
|
|
|
|
IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL,
|
|
|
|
IN POOL_TYPE PoolType
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ObDeassignSecurity(
|
|
|
|
IN OUT PSECURITY_DESCRIPTOR *SecurityDescriptor
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ObQuerySecurityDescriptorInfo(
|
|
|
|
IN PVOID Object,
|
|
|
|
IN PSECURITY_INFORMATION SecurityInformation,
|
|
|
|
OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
IN OUT PULONG Length,
|
|
|
|
IN PSECURITY_DESCRIPTOR *OutputSecurityDescriptor
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ObSetSecurityDescriptorInfo(
|
|
|
|
IN PVOID Object,
|
|
|
|
IN PSECURITY_INFORMATION SecurityInformation,
|
|
|
|
IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
IN OUT PSECURITY_DESCRIPTOR *OutputSecurityDescriptor,
|
|
|
|
IN POOL_TYPE PoolType,
|
|
|
|
IN PGENERIC_MAPPING GenericMapping
|
|
|
|
);
|
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Executive Fast Referencing Functions
|
|
|
|
//
|
2005-05-06 22:54:40 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
2005-09-13 23:48:54 +00:00
|
|
|
ObInitializeFastReference(
|
|
|
|
IN PEX_FAST_REF FastRef,
|
2006-06-12 05:58:08 +00:00
|
|
|
IN PVOID Object
|
2005-09-13 23:48:54 +00:00
|
|
|
);
|
2005-05-06 22:54:40 +00:00
|
|
|
|
|
|
|
PVOID
|
|
|
|
FASTCALL
|
2005-09-13 23:48:54 +00:00
|
|
|
ObFastReplaceObject(
|
|
|
|
IN PEX_FAST_REF FastRef,
|
2006-06-12 05:58:08 +00:00
|
|
|
IN PVOID Object
|
2005-09-13 23:48:54 +00:00
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-05-06 22:54:40 +00:00
|
|
|
PVOID
|
|
|
|
FASTCALL
|
2006-06-12 05:58:08 +00:00
|
|
|
ObFastReferenceObject(
|
|
|
|
IN PEX_FAST_REF FastRef
|
|
|
|
);
|
2005-05-06 22:54:40 +00:00
|
|
|
|
2006-07-11 15:36:44 +00:00
|
|
|
PVOID
|
|
|
|
FASTCALL
|
|
|
|
ObFastReferenceObjectLocked(
|
|
|
|
IN PEX_FAST_REF FastRef
|
|
|
|
);
|
|
|
|
|
2005-05-06 22:54:40 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
2005-09-13 23:48:54 +00:00
|
|
|
ObFastDereferenceObject(
|
|
|
|
IN PEX_FAST_REF FastRef,
|
2006-06-12 05:58:08 +00:00
|
|
|
IN PVOID Object
|
2005-09-13 23:48:54 +00:00
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Object Create and Object Name Capture Functions
|
|
|
|
//
|
2005-01-21 10:28:13 +00:00
|
|
|
NTSTATUS
|
2006-06-12 05:58:08 +00:00
|
|
|
NTAPI
|
2005-09-13 23:48:54 +00:00
|
|
|
ObpCaptureObjectName(
|
|
|
|
IN PUNICODE_STRING CapturedName,
|
|
|
|
IN PUNICODE_STRING ObjectName,
|
2006-05-29 03:32:43 +00:00
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
IN BOOLEAN AllocateFromLookaside
|
2005-09-13 23:48:54 +00:00
|
|
|
);
|
|
|
|
|
Object Manager Patch. This patch continues the work done in the previous patch and makes the following changes in order to support OB 2.0 (it basically temporarily fixes a highly incorrect implementation so that caller code will be ready to work with the OB 2.0 without change):
1) The documented Object Create Information Structure and semantics implemented. All Object Attributes and passed data from user-mode is now probed and saved into this object create structure when ObCreateObject is called.
2) ObCreateObject does NOT PERFORM ANY OTHER OPERATION EXCEPT CREATING THE OBJECT ANYMORE. ObCreateObject will NOT insert the Object into the tree and other operations. These are now done correctly by ObInsertObject. Therefore, the biggest hurdle was changing pieces of code which assumed ObCreateObject would be enough.
3) ObInsertObject uses the captured create info for all operations isntead of the Object Attributes.
4) ObFindObject now uses the captured info as well.
5) The OBject name and directory are now stored in the documented Object Name Information, always allocated and freed from non paged pool.
HACKS:
5) Because the registry code is horribly broken and doesn't use ObFindObjectByName, the old ObFindObject had to be temporarily duplicated into CmpFindObject.
7) Win32k used ObInsertObject in CsrInsertObject as a way to create a handle inside csrss. However, OBInsertObject now does more then this. As a temporary hack, ObpCreateHandle is exported from the kernel and called from win32k. A fix needs to be done for this, but I don't know the design of win32k+csrss well enough to find a solution.
8) SEH has been commented out in some places of the new probing code because it breaks smss and explorer. These need to be investigated (seh did not exist in the previous code, so this is not really a hack)
9) Named objects with a parent directory are NOT allowed. However because of bugs in kernel32, the new check has been temporarily disabled. (this check did not exist in the previous code, so this is not really a hack)
The next patch will add a proper ObFindObject which will support a more complete Parse Procedure with context and security information. This is needed for proper registry access (requested by Eric Kohl) and for proper functionality of the Desktop/File creation, which should use the Parse routine, and not the Create Handle Routine. This will also make it possible to remove some previous hacks and pave the way for a fixed Iop/IoCreateFile
svn path=/trunk/; revision=15395
2005-05-18 19:26:47 +00:00
|
|
|
NTSTATUS
|
2006-06-12 05:58:08 +00:00
|
|
|
NTAPI
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpCaptureObjectCreateInformation(
|
2005-09-13 23:48:54 +00:00
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
2012-01-30 07:48:49 +00:00
|
|
|
IN KPROCESSOR_MODE CreatorMode,
|
2006-05-29 03:32:43 +00:00
|
|
|
IN BOOLEAN AllocateFromLookaside,
|
2005-09-13 23:48:54 +00:00
|
|
|
IN POBJECT_CREATE_INFORMATION ObjectCreateInfo,
|
|
|
|
OUT PUNICODE_STRING ObjectName
|
|
|
|
);
|
2005-01-21 10:28:13 +00:00
|
|
|
|
2009-01-28 10:32:43 +00:00
|
|
|
//
|
|
|
|
// Miscellanea
|
|
|
|
//
|
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
ObGetProcessHandleCount(
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
|
|
|
|
2006-06-12 05:58:08 +00:00
|
|
|
//
|
|
|
|
// Global data inside the Object Manager
|
|
|
|
//
|
|
|
|
extern ULONG ObpTraceLevel;
|
|
|
|
extern KEVENT ObpDefaultObject;
|
2011-04-25 16:08:00 +00:00
|
|
|
extern KGUARDED_MUTEX ObpDeviceMapLock;
|
2006-06-12 05:58:08 +00:00
|
|
|
extern POBJECT_TYPE ObpTypeObjectType;
|
|
|
|
extern POBJECT_TYPE ObSymbolicLinkType;
|
2007-02-19 18:52:23 +00:00
|
|
|
extern POBJECT_TYPE ObpTypeObjectType;
|
|
|
|
extern POBJECT_DIRECTORY ObpRootDirectoryObject;
|
2006-06-12 05:58:08 +00:00
|
|
|
extern POBJECT_DIRECTORY ObpTypeDirectoryObject;
|
|
|
|
extern PHANDLE_TABLE ObpKernelHandleTable;
|
|
|
|
extern WORK_QUEUE_ITEM ObpReaperWorkItem;
|
|
|
|
extern volatile PVOID ObpReaperList;
|
2008-04-01 19:27:58 +00:00
|
|
|
extern GENERAL_LOOKASIDE ObpNameBufferLookasideList, ObpCreateInfoLookasideList;
|
2006-07-02 16:20:10 +00:00
|
|
|
extern BOOLEAN IoCountOperations;
|
2007-01-22 22:16:13 +00:00
|
|
|
extern ALIGNEDNAME ObpDosDevicesShortNamePrefix;
|
|
|
|
extern ALIGNEDNAME ObpDosDevicesShortNameRoot;
|
|
|
|
extern UNICODE_STRING ObpDosDevicesShortName;
|
2006-07-02 16:20:10 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Inlined Functions
|
|
|
|
//
|
|
|
|
#include "ob_x.h"
|