- Remove KeAttachProcess and KeDetachProcess prototypes from winddk.h.

- Remove non-public object manager stuff from W32API and ROS headers.

svn path=/trunk/; revision=15916
This commit is contained in:
Filip Navara 2005-06-14 20:41:49 +00:00
parent a6b2363ea0
commit 095faa8449
16 changed files with 180 additions and 311 deletions

View file

@ -15,6 +15,7 @@
#include <ddk/ntddk.h>
#include <ddk/iotypes.h>
#include <internal/ob.h>
#include <internal/ps.h>
#define NDEBUG
#include <internal/debug.h>

View file

@ -10,6 +10,7 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <internal/ps.h>
#include <ntos/minmax.h>
#include <hal.h>

View file

@ -22,6 +22,7 @@
#include <bus.h>
#include <halirq.h>
#include <hal.h>
#include <internal/ob.h>
#include <internal/ps.h>
#define NDEBUG

View file

@ -18,6 +18,7 @@
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <internal/ps.h>
#include <internal/debug.h>

View file

@ -33,6 +33,7 @@
/* INCLUDES ***************************************************************/
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <internal/ps.h>
#include <hal.h>

View file

@ -14,6 +14,7 @@
#include <ddk/ntddk.h>
#include <hal.h>
#include "halxbox.h"
#include <internal/ob.h>
#include <internal/ps.h>
#define NDEBUG

View file

@ -2,158 +2,6 @@
#define _INCLUDE_DDK_OBFUNCS_H
/* OBJECT MANAGER ************************************************************/
typedef enum _OB_OPEN_REASON
{
ObCreateHandle,
ObOpenHandle,
ObDuplicateHandle,
ObInheritHandle,
ObMaxOpenReason
} OB_OPEN_REASON;
/* TEMPORARY HACK */
typedef NTSTATUS STDCALL_FUNC
(*OB_CREATE_METHOD)(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes);
/* Object Callbacks */
typedef NTSTATUS STDCALL_FUNC
(*OB_OPEN_METHOD)(OB_OPEN_REASON Reason,
PVOID ObjectBody,
PEPROCESS Process,
ULONG HandleCount,
ACCESS_MASK GrantedAccess);
typedef NTSTATUS STDCALL_FUNC
(*OB_PARSE_METHOD)(PVOID Object,
PVOID *NextObject,
PUNICODE_STRING FullPath,
PWSTR *Path,
ULONG Attributes);
typedef VOID STDCALL_FUNC
(*OB_DELETE_METHOD)(PVOID DeletedObject);
typedef VOID STDCALL_FUNC
(*OB_CLOSE_METHOD)(PVOID ClosedObject, ULONG HandleCount);
typedef VOID STDCALL_FUNC
(*OB_DUMP_METHOD)(VOID);
typedef NTSTATUS STDCALL_FUNC
(*OB_OKAYTOCLOSE_METHOD)(VOID);
typedef NTSTATUS STDCALL_FUNC
(*OB_QUERYNAME_METHOD)(PVOID ObjectBody,
POBJECT_NAME_INFORMATION ObjectNameInfo,
ULONG Length,
PULONG ReturnLength);
typedef PVOID STDCALL_FUNC
(*OB_FIND_METHOD)(PVOID WinStaObject,
PWSTR Name,
ULONG Attributes);
typedef NTSTATUS STDCALL_FUNC
(*OB_SECURITY_METHOD)(PVOID ObjectBody,
SECURITY_OPERATION_CODE OperationCode,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR SecurityDescriptor,
PULONG BufferLength);
typedef struct _OBJECT_HANDLE_COUNT_ENTRY
{
struct _EPROCESS *Process;
ULONG HandleCount;
} OBJECT_HANDLE_COUNT_ENTRY, *POBJECT_HANDLE_COUNT_ENTRY;
typedef struct _OBJECT_HANDLE_COUNT_DATABASE
{
ULONG CountEntries;
POBJECT_HANDLE_COUNT_ENTRY HandleCountEntries[1];
} OBJECT_HANDLE_COUNT_DATABASE, *POBJECT_HANDLE_COUNT_DATABASE;
typedef struct _OBJECT_HEADER_HANDLE_INFO
{
union {
POBJECT_HANDLE_COUNT_DATABASE HandleCountDatabase;
OBJECT_HANDLE_COUNT_ENTRY SingleEntry;
};
} OBJECT_HEADER_HANDLE_INFO, *POBJECT_HEADER_HANDLE_INFO;
typedef struct _OBJECT_HEADER_CREATOR_INFO
{
LIST_ENTRY TypeList;
PVOID CreatorUniqueProcess;
USHORT CreatorBackTraceIndex;
USHORT Reserved;
} OBJECT_HEADER_CREATOR_INFO, *POBJECT_HEADER_CREATOR_INFO;
typedef struct _OBJECT_HEADER_NAME_INFO
{
struct _DIRECTORY_OBJECT *Directory;
UNICODE_STRING Name;
ULONG QueryReferences;
ULONG Reserved2;
ULONG DbgReferenceCount;
} OBJECT_HEADER_NAME_INFO, *POBJECT_HEADER_NAME_INFO;
typedef struct _OBJECT_CREATE_INFORMATION
{
ULONG Attributes;
HANDLE RootDirectory;
PVOID ParseContext;
KPROCESSOR_MODE ProbeMode;
ULONG PagedPoolCharge;
ULONG NonPagedPoolCharge;
ULONG SecurityDescriptorCharge;
PSECURITY_DESCRIPTOR SecurityDescriptor;
PSECURITY_QUALITY_OF_SERVICE SecurityQos;
SECURITY_QUALITY_OF_SERVICE SecurityQualityOfService;
} OBJECT_CREATE_INFORMATION, *POBJECT_CREATE_INFORMATION;
typedef struct _OBJECT_TYPE_INITIALIZER
{
WORD Length;
UCHAR UseDefaultObject;
UCHAR CaseInsensitive;
ULONG InvalidAttributes;
GENERIC_MAPPING GenericMapping;
ULONG ValidAccessMask;
UCHAR SecurityRequired;
UCHAR MaintainHandleCount;
UCHAR MaintainTypeList;
POOL_TYPE PoolType;
ULONG DefaultPagedPoolCharge;
ULONG DefaultNonPagedPoolCharge;
OB_DUMP_METHOD DumpProcedure;
OB_OPEN_METHOD OpenProcedure;
OB_CLOSE_METHOD CloseProcedure;
OB_DELETE_METHOD DeleteProcedure;
OB_PARSE_METHOD ParseProcedure;
OB_SECURITY_METHOD SecurityProcedure;
OB_QUERYNAME_METHOD QueryNameProcedure;
OB_OKAYTOCLOSE_METHOD OkayToCloseProcedure;
} OBJECT_TYPE_INITIALIZER, *POBJECT_TYPE_INITIALIZER;
typedef struct _OBJECT_TYPE
{
ERESOURCE Mutex; /* Used to lock the Object Type */
LIST_ENTRY TypeList; /* Links all the Types Together for Debugging */
UNICODE_STRING Name; /* Name of the Type */
PVOID DefaultObject; /* What Object to use during a Wait (ie, FileObjects wait on FileObject->Event) */
ULONG Index; /* Index of this Type in the Object Directory */
ULONG TotalNumberOfObjects; /* Total number of objects of this type */
ULONG TotalNumberOfHandles; /* Total number of handles of this type */
ULONG HighWaterNumberOfObjects; /* Peak number of objects of this type */
ULONG HighWaterNumberOfHandles; /* Peak number of handles of this type */
OBJECT_TYPE_INITIALIZER TypeInfo; /* Information captured during type creation */
ULONG Key; /* Key to use when allocating objects of this type */
ERESOURCE ObjectLocks[4]; /* Locks for locking the Objects */
} OBJECT_TYPE;
NTSTATUS STDCALL
ObAssignSecurity(IN PACCESS_STATE AccessState,
IN PSECURITY_DESCRIPTOR SecurityDescriptor,

View file

@ -16,6 +16,169 @@
struct _EPROCESS;
typedef enum _OB_OPEN_REASON
{
ObCreateHandle,
ObOpenHandle,
ObDuplicateHandle,
ObInheritHandle,
ObMaxOpenReason
} OB_OPEN_REASON;
/* TEMPORARY HACK */
typedef NTSTATUS
(STDCALL *OB_CREATE_METHOD)(
PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes);
/* Object Callbacks */
typedef NTSTATUS
(STDCALL *OB_OPEN_METHOD)(
OB_OPEN_REASON Reason,
PVOID ObjectBody,
PEPROCESS Process,
ULONG HandleCount,
ACCESS_MASK GrantedAccess);
typedef NTSTATUS
(STDCALL *OB_PARSE_METHOD)(
PVOID Object,
PVOID *NextObject,
PUNICODE_STRING FullPath,
PWSTR *Path,
ULONG Attributes);
typedef VOID
(STDCALL *OB_DELETE_METHOD)(
PVOID DeletedObject);
typedef VOID
(STDCALL *OB_CLOSE_METHOD)(
PVOID ClosedObject,
ULONG HandleCount);
typedef VOID
(STDCALL *OB_DUMP_METHOD)(
VOID);
typedef NTSTATUS
(STDCALL *OB_OKAYTOCLOSE_METHOD)(
VOID);
typedef NTSTATUS
(STDCALL *OB_QUERYNAME_METHOD)(
PVOID ObjectBody,
POBJECT_NAME_INFORMATION ObjectNameInfo,
ULONG Length,
PULONG ReturnLength);
typedef PVOID
(STDCALL *OB_FIND_METHOD)(
PVOID WinStaObject,
PWSTR Name,
ULONG Attributes);
typedef NTSTATUS
(STDCALL *OB_SECURITY_METHOD)(
PVOID ObjectBody,
SECURITY_OPERATION_CODE OperationCode,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR SecurityDescriptor,
PULONG BufferLength);
typedef struct _OBJECT_HEADER_NAME_INFO
{
struct _DIRECTORY_OBJECT *Directory;
UNICODE_STRING Name;
ULONG QueryReferences;
ULONG Reserved2;
ULONG DbgReferenceCount;
} OBJECT_HEADER_NAME_INFO, *POBJECT_HEADER_NAME_INFO;
typedef struct _OBJECT_CREATE_INFORMATION
{
ULONG Attributes;
HANDLE RootDirectory;
PVOID ParseContext;
KPROCESSOR_MODE ProbeMode;
ULONG PagedPoolCharge;
ULONG NonPagedPoolCharge;
ULONG SecurityDescriptorCharge;
PSECURITY_DESCRIPTOR SecurityDescriptor;
PSECURITY_QUALITY_OF_SERVICE SecurityQos;
SECURITY_QUALITY_OF_SERVICE SecurityQualityOfService;
} OBJECT_CREATE_INFORMATION, *POBJECT_CREATE_INFORMATION;
typedef struct _OBJECT_TYPE_INITIALIZER
{
WORD Length;
UCHAR UseDefaultObject;
UCHAR CaseInsensitive;
ULONG InvalidAttributes;
GENERIC_MAPPING GenericMapping;
ULONG ValidAccessMask;
UCHAR SecurityRequired;
UCHAR MaintainHandleCount;
UCHAR MaintainTypeList;
POOL_TYPE PoolType;
ULONG DefaultPagedPoolCharge;
ULONG DefaultNonPagedPoolCharge;
OB_DUMP_METHOD DumpProcedure;
OB_OPEN_METHOD OpenProcedure;
OB_CLOSE_METHOD CloseProcedure;
OB_DELETE_METHOD DeleteProcedure;
OB_PARSE_METHOD ParseProcedure;
OB_SECURITY_METHOD SecurityProcedure;
OB_QUERYNAME_METHOD QueryNameProcedure;
OB_OKAYTOCLOSE_METHOD OkayToCloseProcedure;
} OBJECT_TYPE_INITIALIZER, *POBJECT_TYPE_INITIALIZER;
typedef struct _OBJECT_TYPE
{
ERESOURCE Mutex; /* Used to lock the Object Type */
LIST_ENTRY TypeList; /* Links all the Types Together for Debugging */
UNICODE_STRING Name; /* Name of the Type */
PVOID DefaultObject; /* What Object to use during a Wait (ie, FileObjects wait on FileObject->Event) */
ULONG Index; /* Index of this Type in the Object Directory */
ULONG TotalNumberOfObjects; /* Total number of objects of this type */
ULONG TotalNumberOfHandles; /* Total number of handles of this type */
ULONG HighWaterNumberOfObjects; /* Peak number of objects of this type */
ULONG HighWaterNumberOfHandles; /* Peak number of handles of this type */
OBJECT_TYPE_INITIALIZER TypeInfo; /* Information captured during type creation */
ULONG Key; /* Key to use when allocating objects of this type */
ERESOURCE ObjectLocks[4]; /* Locks for locking the Objects */
} OBJECT_TYPE;
typedef struct _OBJECT_HANDLE_COUNT_ENTRY
{
struct _EPROCESS *Process;
ULONG HandleCount;
} OBJECT_HANDLE_COUNT_ENTRY, *POBJECT_HANDLE_COUNT_ENTRY;
typedef struct _OBJECT_HANDLE_COUNT_DATABASE
{
ULONG CountEntries;
POBJECT_HANDLE_COUNT_ENTRY HandleCountEntries[1];
} OBJECT_HANDLE_COUNT_DATABASE, *POBJECT_HANDLE_COUNT_DATABASE;
typedef struct _OBJECT_HEADER_HANDLE_INFO
{
union {
POBJECT_HANDLE_COUNT_DATABASE HandleCountDatabase;
OBJECT_HANDLE_COUNT_ENTRY SingleEntry;
};
} OBJECT_HEADER_HANDLE_INFO, *POBJECT_HEADER_HANDLE_INFO;
typedef struct _OBJECT_HEADER_CREATOR_INFO
{
LIST_ENTRY TypeList;
PVOID CreatorUniqueProcess;
USHORT CreatorBackTraceIndex;
USHORT Reserved;
} OBJECT_HEADER_CREATOR_INFO, *POBJECT_HEADER_CREATOR_INFO;
typedef PVOID POBJECT;
typedef struct _QUAD

View file

@ -40,6 +40,7 @@
#include <internal/module.h>
#include <internal/handle.h>
#include <internal/pool.h>
#include <internal/ob.h>
#include <internal/ps.h>
#include <internal/mm.h>
#include <internal/cc.h>
@ -50,7 +51,6 @@
#include <internal/ldr.h>
#include <internal/kd.h>
#include <internal/ex.h>
#include <internal/ob.h>
#include "internal/xhal.h"
#include <internal/v86m.h>
#include <internal/ifs.h>

View file

@ -12,6 +12,7 @@
#include <ntos.h>
#include <internal/ke.h>
#include <internal/ob.h>
#include <internal/ps.h>
#define NDEBUG

View file

@ -26,11 +26,7 @@
* REVISION HISTORY:
* 06-06-2001 CSH Created
*/
#include <ddk/ntddk.h>
#include <ddk/ntpoapi.h>
#include <internal/ps.h>
#include <include/error.h>
#include <w32k.h>
VOID FASTCALL
SetLastNtError(NTSTATUS Status)

View file

@ -58,7 +58,7 @@ CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
OldProcess = PsGetCurrentProcess();
if (CsrProcess != OldProcess)
{
KeAttachProcess(CsrProcess);
KeAttachProcess(EPROCESS_TO_KPROCESS(CsrProcess));
}
Status = ZwRequestWaitReplyPort(WindowsApiPort,
&Request->Header,
@ -132,7 +132,7 @@ CsrCloseHandle(HANDLE Handle)
OldProcess = PsGetCurrentProcess();
if (CsrProcess != OldProcess)
{
KeAttachProcess(CsrProcess);
KeAttachProcess(EPROCESS_TO_KPROCESS(CsrProcess));
}
Status = ZwClose(Handle);

View file

@ -1361,7 +1361,7 @@ NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
may be a bit safer (e.g. when the desktop is being destroyed */
/* switch into the context of the thread we're trying to get the desktop from,
so we can use the handle */
KeAttachProcess(Thread->ThreadsProcess);
KeAttachProcess(EPROCESS_TO_KPROCESS(Thread->ThreadsProcess));
Status = ObReferenceObjectByHandle(hThreadDesktop,
GENERIC_ALL,
ExDesktopObjectType,

View file

@ -1250,7 +1250,7 @@ IntCleanupMenus(struct _EPROCESS *Process, PW32PROCESS Win32Process)
CurrentProcess = PsGetCurrentProcess();
if (CurrentProcess != Process)
{
KeAttachProcess(Process);
KeAttachProcess(EPROCESS_TO_KPROCESS(Process));
}
IntLockProcessMenus(Win32Process);

View file

@ -656,7 +656,7 @@ GDI_CleanupForProcess (struct _EPROCESS *Process)
CurrentProcess = PsGetCurrentProcess();
if (CurrentProcess != Process)
{
KeAttachProcess(Process);
KeAttachProcess(EPROCESS_TO_KPROCESS(Process));
}
W32Process = (PW32PROCESS)Process->Win32Process;
ASSERT(W32Process);

View file

@ -7121,6 +7121,8 @@ IoReuseIrp(
_InvokeOnCancel) \
{ \
PIO_STACK_LOCATION _IrpSp; \
ASSERT(_InvokeOnSuccess || _InvokeOnError || _InvokeOnCancel ? \
_CompletionRoutine != NULL : TRUE); \
_IrpSp = IoGetNextIrpStackLocation(_Irp); \
_IrpSp->CompletionRoutine = (PIO_COMPLETION_ROUTINE)(_CompletionRoutine); \
_IrpSp->Context = (_Context); \
@ -7502,12 +7504,6 @@ DDKAPI
KeAreApcsDisabled(
VOID);
NTOSAPI
VOID
DDKAPI
KeAttachProcess(
IN PKPROCESS Process);
NTOSAPI
VOID
DDKAPI
@ -7550,12 +7546,6 @@ DDKAPI
KeDeregisterBugCheckCallback(
IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord);
NTOSAPI
VOID
DDKAPI
KeDetachProcess(
VOID);
NTOSAPI
VOID
DDKAPI
@ -8459,142 +8449,7 @@ MmUnmapVideoDisplay(
/** Object manager **/
typedef enum _OB_OPEN_REASON
{
ObCreateHandle,
ObOpenHandle,
ObDuplicateHandle,
ObInheritHandle,
ObMaxOpenReason
} OB_OPEN_REASON;
/* TEMPORARY HACK */
typedef NTSTATUS
(DDKAPI *OB_CREATE_METHOD)(
PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes);
/* Object Callbacks */
typedef NTSTATUS
(DDKAPI *OB_OPEN_METHOD)(
OB_OPEN_REASON Reason,
PVOID ObjectBody,
PEPROCESS Process,
ULONG HandleCount,
ACCESS_MASK GrantedAccess);
typedef NTSTATUS
(DDKAPI *OB_PARSE_METHOD)(
PVOID Object,
PVOID *NextObject,
PUNICODE_STRING FullPath,
PWSTR *Path,
ULONG Attributes);
typedef VOID
(DDKAPI *OB_DELETE_METHOD)(
PVOID DeletedObject);
typedef VOID
(DDKAPI *OB_CLOSE_METHOD)(
PVOID ClosedObject,
ULONG HandleCount);
typedef VOID
(DDKAPI *OB_DUMP_METHOD)(
VOID);
typedef NTSTATUS
(DDKAPI *OB_OKAYTOCLOSE_METHOD)(
VOID);
typedef NTSTATUS
(DDKAPI *OB_QUERYNAME_METHOD)(
PVOID ObjectBody,
POBJECT_NAME_INFORMATION ObjectNameInfo,
ULONG Length,
PULONG ReturnLength);
typedef PVOID
(DDKAPI *OB_FIND_METHOD)(
PVOID WinStaObject,
PWSTR Name,
ULONG Attributes);
typedef NTSTATUS
(DDKAPI *OB_SECURITY_METHOD)(
PVOID ObjectBody,
SECURITY_OPERATION_CODE OperationCode,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR SecurityDescriptor,
PULONG BufferLength);
typedef struct _OBJECT_HEADER_NAME_INFO
{
struct _DIRECTORY_OBJECT *Directory;
UNICODE_STRING Name;
ULONG QueryReferences;
ULONG Reserved2;
ULONG DbgReferenceCount;
} OBJECT_HEADER_NAME_INFO, *POBJECT_HEADER_NAME_INFO;
typedef struct _OBJECT_CREATE_INFORMATION
{
ULONG Attributes;
HANDLE RootDirectory;
PVOID ParseContext;
KPROCESSOR_MODE ProbeMode;
ULONG PagedPoolCharge;
ULONG NonPagedPoolCharge;
ULONG SecurityDescriptorCharge;
PSECURITY_DESCRIPTOR SecurityDescriptor;
PSECURITY_QUALITY_OF_SERVICE SecurityQos;
SECURITY_QUALITY_OF_SERVICE SecurityQualityOfService;
} OBJECT_CREATE_INFORMATION, *POBJECT_CREATE_INFORMATION;
typedef struct _OBJECT_TYPE_INITIALIZER
{
WORD Length;
UCHAR UseDefaultObject;
UCHAR CaseInsensitive;
ULONG InvalidAttributes;
GENERIC_MAPPING GenericMapping;
ULONG ValidAccessMask;
UCHAR SecurityRequired;
UCHAR MaintainHandleCount;
UCHAR MaintainTypeList;
POOL_TYPE PoolType;
ULONG DefaultPagedPoolCharge;
ULONG DefaultNonPagedPoolCharge;
OB_DUMP_METHOD DumpProcedure;
OB_OPEN_METHOD OpenProcedure;
OB_CLOSE_METHOD CloseProcedure;
OB_DELETE_METHOD DeleteProcedure;
OB_PARSE_METHOD ParseProcedure;
OB_SECURITY_METHOD SecurityProcedure;
OB_QUERYNAME_METHOD QueryNameProcedure;
OB_OKAYTOCLOSE_METHOD OkayToCloseProcedure;
} OBJECT_TYPE_INITIALIZER, *POBJECT_TYPE_INITIALIZER;
typedef struct _OBJECT_TYPE
{
ERESOURCE Mutex; /* Used to lock the Object Type */
LIST_ENTRY TypeList; /* Links all the Types Together for Debugging */
UNICODE_STRING Name; /* Name of the Type */
PVOID DefaultObject; /* What Object to use during a Wait (ie, FileObjects wait on FileObject->Event) */
ULONG Index; /* Index of this Type in the Object Directory */
ULONG TotalNumberOfObjects; /* Total number of objects of this type */
ULONG TotalNumberOfHandles; /* Total number of handles of this type */
ULONG HighWaterNumberOfObjects; /* Peak number of objects of this type */
ULONG HighWaterNumberOfHandles; /* Peak number of handles of this type */
OBJECT_TYPE_INITIALIZER TypeInfo; /* Information captured during type creation */
ULONG Key; /* Key to use when allocating objects of this type */
ERESOURCE ObjectLocks[4]; /* Locks for locking the Objects */
} OBJECT_TYPE;
/** Object manager routines **/
NTOSAPI
NTSTATUS