- Implement new ExHandle* implementation using pushlocks and the Windows 2003 HANDLE_TABLE structure and semantics. Only the currently used base APIs were implemented; support for audit masks still disabled, debug/tracing calls disabled.

- Remove manual overrides of NTDDI_VERSION all over the thread and set it once globally, since ExHandle* was the only non-updated package. The entire kernel now builds with Windows 2003 SP1 as a target.
- Remove this entry from kernel fun.

svn path=/trunk/; revision=25586
This commit is contained in:
Alex Ionescu 2007-01-22 08:15:17 +00:00
parent d1c966119b
commit 3e42c58603
19 changed files with 1378 additions and 1054 deletions

View file

@ -8,9 +8,6 @@
// Do NOT ask when it will be fixed.
// Failure to respect this will *ACHIEVE NOTHING*.
//
// Ex:
// - Use pushlocks for handle implementation.
//
// Ke2:
// - Dispatcher Rewrite (DPCs-Timers-Waits).
//

View file

@ -66,7 +66,7 @@ CmpCreateHandle(PVOID ObjectBody,
ObjectHeader = OBJECT_TO_OBJECT_HEADER(ObjectBody);
/* check that this is a valid kernel pointer */
ASSERT((ULONG_PTR)ObjectHeader & EX_HANDLE_ENTRY_LOCKED);
//ASSERT((ULONG_PTR)ObjectHeader & EX_HANDLE_ENTRY_LOCKED);
if (GrantedAccess & MAXIMUM_ALLOWED)
{
@ -82,9 +82,9 @@ CmpCreateHandle(PVOID ObjectBody,
NewEntry.Object = ObjectHeader;
if(HandleAttributes & OBJ_INHERIT)
NewEntry.ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE;
NewEntry.ObAttributes |= OBJ_INHERIT;
else
NewEntry.ObAttributes &= ~EX_HANDLE_ENTRY_INHERITABLE;
NewEntry.ObAttributes &= ~OBJ_INHERIT;
NewEntry.GrantedAccess = GrantedAccess;
if ((HandleAttributes & OBJ_KERNEL_HANDLE) &&

File diff suppressed because it is too large Load diff

View file

@ -21,6 +21,20 @@ ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
ULONG ExpUnicodeCaseTableDataOffset;
PVOID ExpNlsSectionPointer;
typedef struct _EXHANDLE
{
union
{
struct
{
ULONG TagBits:2;
ULONG Index:30;
};
HANDLE GenericHandleOverlay;
ULONG_PTR Value;
};
} EXHANDLE, *PEXHANDLE;
typedef struct _ETIMER
{
KTIMER KeTimer;
@ -42,13 +56,6 @@ typedef struct
#define MAX_FAST_REFS 7
#define EX_OBJ_TO_HDR(eob) ((POBJECT_HEADER)((ULONG_PTR)(eob) & \
~(EX_HANDLE_ENTRY_PROTECTFROMCLOSE | EX_HANDLE_ENTRY_INHERITABLE | \
EX_HANDLE_ENTRY_AUDITONCLOSE)))
#define EX_HTE_TO_HDR(hte) ((POBJECT_HEADER)((ULONG_PTR)((hte)->Object) & \
~(EX_HANDLE_ENTRY_PROTECTFROMCLOSE | EX_HANDLE_ENTRY_INHERITABLE | \
EX_HANDLE_ENTRY_AUDITONCLOSE)))
/* Note: we only use a spinlock on SMP. On UP, we cli/sti intead */
#ifndef CONFIG_SMP
#define ExAcquireResourceLock(l, i) { \
@ -68,6 +75,27 @@ typedef struct
#define ExRundownCompleted _ExRundownCompleted
#define ExGetPreviousMode KeGetPreviousMode
//
// Various bits tagged on the handle or handle table
//
#define EXHANDLE_TABLE_ENTRY_LOCK_BIT 1
#define FREE_HANDLE_MASK -1
//
// Number of entries in each table level
//
#define LOW_LEVEL_ENTRIES (PAGE_SIZE / sizeof(HANDLE_TABLE_ENTRY))
#define MID_LEVEL_ENTRIES (PAGE_SIZE / sizeof(PHANDLE_TABLE_ENTRY))
#define HIGH_LEVEL_ENTRIES (65535 / (LOW_LEVEL_ENTRIES * MID_LEVEL_ENTRIES))
//
// Maximum index in each table level before we need another table
//
#define MAX_LOW_INDEX LOW_LEVEL_ENTRIES
#define MAX_MID_INDEX (MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES)
#define MAX_HIGH_INDEX (MID_LEVEL_ENTRIES * MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES)
//
// Detect GCC 4.1.2+
//
@ -308,104 +336,98 @@ ExfWaitForRundownProtectionRelease(
/* HANDLE TABLE FUNCTIONS ***************************************************/
#define EX_HANDLE_ENTRY_LOCKED (1 << ((sizeof(PVOID) * 8) - 1))
#define EX_HANDLE_ENTRY_PROTECTFROMCLOSE (1 << 0)
#define EX_HANDLE_ENTRY_INHERITABLE (1 << 1)
#define EX_HANDLE_ENTRY_AUDITONCLOSE (1 << 2)
#define EX_HANDLE_TABLE_CLOSING 0x1
#define EX_HANDLE_ENTRY_FLAGSMASK (EX_HANDLE_ENTRY_LOCKED | \
EX_HANDLE_ENTRY_PROTECTFROMCLOSE | \
EX_HANDLE_ENTRY_INHERITABLE | \
EX_HANDLE_ENTRY_AUDITONCLOSE)
typedef VOID (NTAPI PEX_SWEEP_HANDLE_CALLBACK)(
typedef VOID
(NTAPI *PEX_SWEEP_HANDLE_CALLBACK)(
PHANDLE_TABLE_ENTRY HandleTableEntry,
HANDLE Handle,
HANDLE Handle,
PVOID Context
);
typedef BOOLEAN (NTAPI PEX_DUPLICATE_HANDLE_CALLBACK)(
PHANDLE_TABLE HandleTable,
PHANDLE_TABLE_ENTRY HandleTableEntry,
PVOID Context
);
typedef BOOLEAN (NTAPI PEX_CHANGE_HANDLE_CALLBACK)(
PHANDLE_TABLE HandleTable,
PHANDLE_TABLE_ENTRY HandleTableEntry,
PVOID Context
);
VOID
ExpInitializeHandleTables(VOID);
PHANDLE_TABLE
ExCreateHandleTable(IN PEPROCESS QuotaProcess OPTIONAL);
VOID
ExDestroyHandleTable(
IN PHANDLE_TABLE HandleTable
);
VOID
ExSweepHandleTable(
typedef BOOLEAN
(NTAPI *PEX_DUPLICATE_HANDLE_CALLBACK)(
IN PEPROCESS Process,
IN PHANDLE_TABLE HandleTable,
IN PEX_SWEEP_HANDLE_CALLBACK SweepHandleCallback OPTIONAL,
IN PVOID Context OPTIONAL
IN PHANDLE_TABLE_ENTRY HandleTableEntry,
IN PHANDLE_TABLE_ENTRY NewEntry
);
typedef BOOLEAN
(NTAPI *PEX_CHANGE_HANDLE_CALLBACK)(
PHANDLE_TABLE_ENTRY HandleTableEntry,
ULONG_PTR Context
);
VOID
NTAPI
ExpInitializeHandleTables(
VOID
);
PHANDLE_TABLE
ExDupHandleTable(
IN PEPROCESS QuotaProcess OPTIONAL,
IN PEX_DUPLICATE_HANDLE_CALLBACK DuplicateHandleCallback OPTIONAL,
IN PVOID Context OPTIONAL,
IN PHANDLE_TABLE SourceHandleTable
);
BOOLEAN
ExLockHandleTableEntry(
IN PHANDLE_TABLE HandleTable,
IN PHANDLE_TABLE_ENTRY Entry
NTAPI
ExCreateHandleTable(
IN PEPROCESS Process OPTIONAL
);
VOID
NTAPI
ExUnlockHandleTableEntry(
IN PHANDLE_TABLE HandleTable,
IN PHANDLE_TABLE_ENTRY Entry
IN PHANDLE_TABLE_ENTRY HandleTableEntry
);
HANDLE
NTAPI
ExCreateHandle(
IN PHANDLE_TABLE HandleTable,
IN PHANDLE_TABLE_ENTRY Entry
);
BOOLEAN
ExDestroyHandle(
IN PHANDLE_TABLE HandleTable,
IN HANDLE Handle
IN PHANDLE_TABLE_ENTRY HandleTableEntry
);
VOID
ExDestroyHandleByEntry(
NTAPI
ExDestroyHandleTable(
IN PHANDLE_TABLE HandleTable,
IN PHANDLE_TABLE_ENTRY Entry,
IN HANDLE Handle
IN PVOID DestroyHandleProcedure OPTIONAL
);
BOOLEAN
NTAPI
ExDestroyHandle(
IN PHANDLE_TABLE HandleTable,
IN HANDLE Handle,
IN PHANDLE_TABLE_ENTRY HandleTableEntry OPTIONAL
);
PHANDLE_TABLE_ENTRY
NTAPI
ExMapHandleToPointer(
IN PHANDLE_TABLE HandleTable,
IN HANDLE Handle
);
PHANDLE_TABLE
NTAPI
ExDupHandleTable(
IN PEPROCESS Process,
IN PHANDLE_TABLE HandleTable,
IN PEX_DUPLICATE_HANDLE_CALLBACK DupHandleProcedure,
IN ULONG_PTR Mask
);
BOOLEAN
NTAPI
ExChangeHandle(
IN PHANDLE_TABLE HandleTable,
IN HANDLE Handle,
IN PEX_CHANGE_HANDLE_CALLBACK ChangeHandleCallback,
IN PEX_CHANGE_HANDLE_CALLBACK ChangeRoutine,
IN ULONG_PTR Context
);
VOID
NTAPI
ExSweepHandleTable(
IN PHANDLE_TABLE HandleTable,
IN PEX_SWEEP_HANDLE_CALLBACK EnumHandleProcedure,
IN PVOID Context
);
@ -797,7 +819,7 @@ ExConvertPushLockSharedToExclusive(IN PEX_PUSH_LOCK PushLock)
VOID
FORCEINLINE
ExWaitOnPushLock(PEX_PUSH_LOCK PushLock)
{
{
/* Check if we're locked */
if (PushLock->Locked)
{

View file

@ -43,6 +43,16 @@
GENERIC_EXECUTE | \
GENERIC_ALL)
//
// 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)
//
// Identifies a Kernel Handle
//
@ -66,6 +76,12 @@
#define ObpGetHandleCountByHandleTable(HandleTable) \
((PHANDLE_TABLE)HandleTable)->HandleCount
//
// Converts from an EXHANDLE object to a POBJECT_HEADER
//
#define ObpGetHandleObject(x) \
((POBJECT_HEADER)((ULONG_PTR)x->Object & ~OBJ_HANDLE_ATTRIBUTES))
//
// Context Structures for Ex*Handle Callbacks
//
@ -214,9 +230,8 @@ ObpLookupObjectName(
BOOLEAN
NTAPI
ObpSetHandleAttributes(
IN PHANDLE_TABLE HandleTable,
IN OUT PHANDLE_TABLE_ENTRY HandleTableEntry,
IN PVOID Context
IN ULONG_PTR Context
);
VOID

View file

@ -8,7 +8,9 @@
/* INCLUDES ******************************************************************/
/* Tells the WDK that we don't want to import */
/* Always target Windows 2003 Service Pack 1 */
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WS03SP1
#define NTKERNELAPI
/* DDK/IFS/NDK Headers */

View file

@ -8,7 +8,6 @@
/* INCLUDES *****************************************************************/
#define NTDDI_VERSION NTDDI_WS03
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>
@ -952,3 +951,4 @@ KeAreAllApcsDisabled(VOID)

View file

@ -10,8 +10,6 @@
/* INCLUDES ******************************************************************/
#define NTDDI_VERSION NTDDI_WS03
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>

View file

@ -8,7 +8,6 @@
/* INCLUDES *****************************************************************/
#define NTDDI_VERSION NTDDI_WS03
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>

View file

@ -9,7 +9,6 @@
/* INCLUDES ******************************************************************/
#define NTDDI_VERSION NTDDI_WS03SP1
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>

View file

@ -8,7 +8,6 @@
/* INCLUDES *****************************************************************/
#define NTDDI_VERSION NTDDI_WS03SP1
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
@ -788,3 +787,4 @@ AppCpuInit:
KiIdleLoop();
}

View file

@ -131,16 +131,13 @@ ObpReferenceProcessObjectByHandle(IN HANDLE Handle,
if (HandleEntry)
{
/* Get the object header and validate the type*/
ObjectHeader = EX_HTE_TO_HDR(HandleEntry);
ObjectHeader = ObpGetHandleObject(HandleEntry);
/* Get the granted access and validate it */
GrantedAccess = HandleEntry->GrantedAccess;
/* Mask out the internal attributes */
Attributes = HandleEntry->ObAttributes &
(EX_HANDLE_ENTRY_PROTECTFROMCLOSE |
EX_HANDLE_ENTRY_INHERITABLE |
EX_HANDLE_ENTRY_AUDITONCLOSE);
Attributes = HandleEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
/* Fill out the information */
HandleInformation->HandleAttributes = Attributes;
@ -588,7 +585,7 @@ ObpCloseHandleTableEntry(IN PHANDLE_TABLE HandleTable,
PAGED_CODE();
/* Get the object data */
ObjectHeader = EX_HTE_TO_HDR(HandleEntry);
ObjectHeader = ObpGetHandleObject(HandleEntry);
ObjectType = ObjectHeader->Type;
Body = &ObjectHeader->Body;
GrantedAccess = HandleEntry->GrantedAccess;
@ -621,7 +618,7 @@ ObpCloseHandleTableEntry(IN PHANDLE_TABLE HandleTable,
}
/* The callback allowed us to close it, but does the handle itself? */
if ((HandleEntry->ObAttributes & EX_HANDLE_ENTRY_PROTECTFROMCLOSE) &&
if ((HandleEntry->ObAttributes & OBJ_PROTECT_CLOSE) &&
!(IgnoreHandleProtection))
{
/* It doesn't, are we from user mode? */
@ -650,7 +647,7 @@ ObpCloseHandleTableEntry(IN PHANDLE_TABLE HandleTable,
}
/* Destroy and unlock the handle entry */
ExDestroyHandleByEntry(HandleTable, HandleEntry, Handle);
ExDestroyHandle(HandleTable, Handle, HandleEntry);
/* Now decrement the handle count */
ObpDecrementHandleCount(Body, PsGetCurrentProcess(), GrantedAccess);
@ -1258,10 +1255,7 @@ ObpCreateUnnamedHandle(IN PVOID Object,
NewEntry.Object = ObjectHeader;
/* Mask out the internal attributes */
NewEntry.ObAttributes |= HandleAttributes &
(EX_HANDLE_ENTRY_PROTECTFROMCLOSE |
EX_HANDLE_ENTRY_INHERITABLE |
EX_HANDLE_ENTRY_AUDITONCLOSE);
NewEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES;
/* Remove what's not in the valid access mask */
GrantedAccess = DesiredAccess & (ObjectType->TypeInfo.ValidAccessMask |
@ -1460,14 +1454,11 @@ ObpCreateHandle(IN OB_OPEN_REASON OpenReason,
if (AccessState->GenerateOnClose)
{
/* Force the attribute on */
HandleAttributes|= EX_HANDLE_ENTRY_AUDITONCLOSE;
HandleAttributes|= OBJ_AUDIT_OBJECT_CLOSE;
}
/* Mask out the internal attributes */
NewEntry.ObAttributes |= HandleAttributes &
(EX_HANDLE_ENTRY_PROTECTFROMCLOSE |
EX_HANDLE_ENTRY_INHERITABLE |
EX_HANDLE_ENTRY_AUDITONCLOSE);
NewEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES;
/* Get the original desired access */
DesiredAccess = AccessState->RemainingDesiredAccess |
@ -1697,9 +1688,6 @@ ObpCloseHandle(IN HANDLE Handle,
*
* The ObpSetHandleAttributes routine <FILLMEIN>
*
* @param HandleTable
* <FILLMEIN>.
*
* @param HandleTableEntry
* <FILLMEIN>.
*
@ -1713,12 +1701,11 @@ ObpCloseHandle(IN HANDLE Handle,
*--*/
BOOLEAN
NTAPI
ObpSetHandleAttributes(IN PHANDLE_TABLE HandleTable,
IN OUT PHANDLE_TABLE_ENTRY HandleTableEntry,
IN PVOID Context)
ObpSetHandleAttributes(IN OUT PHANDLE_TABLE_ENTRY HandleTableEntry,
IN ULONG_PTR Context)
{
POBP_SET_HANDLE_ATTRIBUTES_CONTEXT SetHandleInfo = Context;
POBJECT_HEADER ObjectHeader = EX_HTE_TO_HDR(HandleTableEntry);
POBP_SET_HANDLE_ATTRIBUTES_CONTEXT SetHandleInfo = (PVOID)Context;
POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
PAGED_CODE();
/* Don't allow operations on kernel objects */
@ -1740,24 +1727,24 @@ ObpSetHandleAttributes(IN PHANDLE_TABLE HandleTable,
}
/* Set the flag */
HandleTableEntry->ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE;
HandleTableEntry->ObAttributes |= OBJ_INHERIT;
}
else
{
/* Otherwise this implies we're removing the flag */
HandleTableEntry->ObAttributes &= ~EX_HANDLE_ENTRY_INHERITABLE;
HandleTableEntry->ObAttributes &= ~OBJ_INHERIT;
}
/* Check if making the handle protected */
if (SetHandleInfo->Information.ProtectFromClose)
{
/* Set the flag */
HandleTableEntry->ObAttributes |= EX_HANDLE_ENTRY_PROTECTFROMCLOSE;
HandleTableEntry->ObAttributes |= OBJ_PROTECT_CLOSE;
}
else
{
/* Otherwise, remove it */
HandleTableEntry->ObAttributes &= ~EX_HANDLE_ENTRY_PROTECTFROMCLOSE;
HandleTableEntry->ObAttributes &= ~OBJ_PROTECT_CLOSE;
}
/* Return success */
@ -1823,9 +1810,10 @@ ObpCloseHandleCallback(IN PHANDLE_TABLE_ENTRY HandleTableEntry,
*--*/
BOOLEAN
NTAPI
ObpDuplicateHandleCallback(IN PHANDLE_TABLE HandleTable,
IN PHANDLE_TABLE_ENTRY HandleTableEntry,
IN PVOID Context)
ObpDuplicateHandleCallback(IN PEPROCESS Process,
IN PHANDLE_TABLE HandleTable,
IN PHANDLE_TABLE_ENTRY OldEntry,
IN PHANDLE_TABLE_ENTRY HandleTableEntry)
{
POBJECT_HEADER ObjectHeader;
BOOLEAN Ret = FALSE;
@ -1834,11 +1822,17 @@ ObpDuplicateHandleCallback(IN PHANDLE_TABLE HandleTable,
PAGED_CODE();
/* Make sure that the handle is inheritable */
Ret = (HandleTableEntry->ObAttributes & EX_HANDLE_ENTRY_INHERITABLE) != 0;
Ret = (HandleTableEntry->ObAttributes & OBJ_INHERIT) != 0;
if (Ret)
{
/* Get the object header */
ObjectHeader = EX_HTE_TO_HDR(HandleTableEntry);
ObjectHeader = ObpGetHandleObject(HandleTableEntry);
/* Increment the pointer count */
InterlockedIncrement(&ObjectHeader->PointerCount);
/* Release the handle lock */
ExUnlockHandleTableEntry(HandleTable, OldEntry);
/* Setup the access state */
AccessState.PreviouslyGrantedAccess = HandleTableEntry->GrantedAccess;
@ -1848,18 +1842,19 @@ ObpDuplicateHandleCallback(IN PHANDLE_TABLE HandleTable,
&AccessState,
KernelMode,
HandleTableEntry->ObAttributes,
PsGetCurrentProcess(),
Process,
ObInheritHandle);
if (!NT_SUCCESS(Status))
{
/* Return failure */
ObDereferenceObject(&ObjectHeader->Body);
Ret = FALSE;
}
else
{
/* Otherwise increment the pointer count */
InterlockedIncrement(&ObjectHeader->PointerCount);
}
}
else
{
/* Release the handle lock */
ExUnlockHandleTableEntry(HandleTable, OldEntry);
}
/* Return duplication result */
@ -1906,9 +1901,9 @@ ObpCreateHandleTable(IN PEPROCESS Parent,
/* Duplicate the parent's */
HandleTable = ExDupHandleTable(Process,
HandleTable,
ObpDuplicateHandleCallback,
NULL,
HandleTable);
OBJ_INHERIT);
}
else
{
@ -1981,7 +1976,7 @@ ObKillProcess(IN PEPROCESS Process)
/* Destroy the object table */
Process->ObjectTable = NULL;
ExDestroyHandleTable(HandleTable);
ExDestroyHandleTable(HandleTable, NULL);
}
NTSTATUS
@ -2121,10 +2116,7 @@ ObDuplicateObject(IN PEPROCESS SourceProcess,
/* Fill out the entry */
NewHandleEntry.Object = ObjectHeader;
NewHandleEntry.ObAttributes |= HandleAttributes &
(EX_HANDLE_ENTRY_PROTECTFROMCLOSE |
EX_HANDLE_ENTRY_INHERITABLE |
EX_HANDLE_ENTRY_AUDITONCLOSE);
NewHandleEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES;
/* Check if we're using a generic mask */
if (DesiredAccess & GENERIC_ACCESS)

View file

@ -1442,10 +1442,9 @@ NtQueryObject(IN HANDLE ObjectHandle,
ObjectInformation;
/* Set the flags */
HandleFlags->Inherit = (HandleInfo.HandleAttributes &
EX_HANDLE_ENTRY_INHERITABLE) != 0;
HandleFlags->Inherit = HandleInfo.HandleAttributes & OBJ_INHERIT;
HandleFlags->ProtectFromClose = (HandleInfo.HandleAttributes &
EX_HANDLE_ENTRY_PROTECTFROMCLOSE) != 0;
OBJ_PROTECT_CLOSE) != 0;
/* Break out with success */
Status = STATUS_SUCCESS;
@ -1581,7 +1580,7 @@ NtSetInformationObject(IN HANDLE ObjectHandle,
if (!ExChangeHandle(ObjectTable,
ObjectHandle,
ObpSetHandleAttributes,
&Context))
(ULONG_PTR)&Context))
{
/* Some failure */
Status = STATUS_ACCESS_DENIED;

View file

@ -11,7 +11,6 @@
/* INCLUDES ******************************************************************/
#define NTDDI_VERSION NTDDI_WINXP
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>

View file

@ -560,7 +560,7 @@ ObReferenceObjectByHandle(IN HANDLE Handle,
if (HandleEntry)
{
/* Get the object header and validate the type*/
ObjectHeader = EX_HTE_TO_HDR(HandleEntry);
ObjectHeader = ObpGetHandleObject(HandleEntry);
if (!(ObjectType) || (ObjectType == ObjectHeader->Type))
{
/* Get the granted access and validate it */
@ -572,10 +572,7 @@ ObReferenceObjectByHandle(IN HANDLE Handle,
InterlockedIncrement(&ObjectHeader->PointerCount);
/* Mask out the internal attributes */
Attributes = HandleEntry->ObAttributes &
(EX_HANDLE_ENTRY_PROTECTFROMCLOSE |
EX_HANDLE_ENTRY_INHERITABLE |
EX_HANDLE_ENTRY_AUDITONCLOSE);
Attributes = HandleEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
/* Check if the caller wants handle information */
if (HandleInformation)

View file

@ -829,8 +829,7 @@ ObQueryObjectAuditingByHandle(IN HANDLE Handle,
if(HandleEntry)
{
/* Check if the flag is set */
*GenerateOnClose = (HandleEntry->ObAttributes &
EX_HANDLE_ENTRY_AUDITONCLOSE) != 0;
*GenerateOnClose = HandleEntry->ObAttributes & OBJ_AUDIT_OBJECT_CLOSE;
/* Unlock the entry */
ExUnlockHandleTableEntry(HandleTable, HandleEntry);

View file

@ -181,7 +181,7 @@ NtWaitForMultipleObjects(IN ULONG ObjectCount,
}
/* Get the Object Header */
ObjectHeader = EX_HTE_TO_HDR(HandleEntry);
ObjectHeader = ObpGetHandleObject(HandleEntry);
/* Get default Object */
DefaultObject = ObjectHeader->Type->DefaultObject;

View file

@ -310,7 +310,7 @@ PspDeleteProcess(IN PVOID ObjectBody)
if (Process->UniqueProcessId)
{
/* Delete the PID */
if (!(ExDestroyHandle(PspCidTable, Process->UniqueProcessId)))
if (!(ExDestroyHandle(PspCidTable, Process->UniqueProcessId, NULL)))
{
/* Something wrong happened, bugcheck */
KEBUGCHECK(CID_HANDLE_DELETION);
@ -360,7 +360,7 @@ PspDeleteThread(IN PVOID ObjectBody)
if (Thread->Cid.UniqueThread)
{
/* Delete the CID Handle */
if (!(ExDestroyHandle(PspCidTable, Thread->Cid.UniqueThread)))
if (!(ExDestroyHandle(PspCidTable, Thread->Cid.UniqueThread, NULL)))
{
/* Something wrong happened, bugcheck */
KEBUGCHECK(CID_HANDLE_DELETION);

View file

@ -259,7 +259,7 @@ RtlpDestroyAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
ExSweepHandleTable(AtomTable->ExHandleTable,
NULL,
NULL);
ExDestroyHandleTable(AtomTable->ExHandleTable);
ExDestroyHandleTable(AtomTable->ExHandleTable, NULL);
AtomTable->ExHandleTable = NULL;
}
}
@ -308,7 +308,8 @@ VOID
RtlpFreeAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
{
ExDestroyHandle(AtomTable->ExHandleTable,
(HANDLE)((ULONG_PTR)Entry->HandleIndex << 2));
(HANDLE)((ULONG_PTR)Entry->HandleIndex << 2),
NULL);
}
BOOLEAN
@ -336,7 +337,8 @@ RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
}
else
ExDestroyHandle(AtomTable->ExHandleTable,
Handle);
Handle,
NULL);
}
return FALSE;