- Added OBJECT_INFORMATION_CLASS type.

- Added, fixed or moved object information types.

svn path=/trunk/; revision=6225
This commit is contained in:
Eric Kohl 2003-10-04 17:12:31 +00:00
parent c102b23e07
commit 9b66809886
5 changed files with 188 additions and 115 deletions

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_OBTYPES_H
#define _INCLUDE_DDK_OBTYPES_H
/* $Id: obtypes.h,v 1.4 2003/09/25 20:00:25 ekohl Exp $ */
/* $Id: obtypes.h,v 1.5 2003/10/04 17:10:54 ekohl Exp $ */
struct _DIRECTORY_OBJECT;
struct _OBJECT_ATTRIBUTES;
@ -8,10 +8,6 @@ struct _OBJECT_ATTRIBUTES;
typedef ULONG ACCESS_STATE, *PACCESS_STATE;
typedef struct _OBJECT_NAME_INFORMATION
{
UNICODE_STRING Name;
} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
typedef struct _OBJECT_HANDLE_INFORMATION
{
@ -19,6 +15,51 @@ typedef struct _OBJECT_HANDLE_INFORMATION
ACCESS_MASK GrantedAccess;
} OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
typedef struct _OBJECT_BASIC_INFORMATION
{
ULONG Attributes;
ACCESS_MASK GrantedAccess;
ULONG HandleCount;
ULONG PointerCount;
ULONG PagedPoolUsage;
ULONG NonPagedPoolUsage;
ULONG Reserved[3];
ULONG NameInformationLength;
ULONG TypeInformationLength;
ULONG SecurityDescriptorLength;
LARGE_INTEGER CreateTime;
} OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION;
typedef struct _OBJECT_NAME_INFORMATION
{
UNICODE_STRING Name;
} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
typedef struct _OBJECT_TYPE_INFORMATION
{
UNICODE_STRING Name;
UNICODE_STRING Type;
ULONG TotalHandles;
ULONG ReferenceCount;
} OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION;
typedef struct _OBJECT_ALL_TYPES_INFORMATION
{
ULONG NumberOfTypes;
OBJECT_TYPE_INFORMATION TypeInformation[1];
} OBJECT_ALL_TYPES_INFORMATION, *POBJECT_ALL_TYPES_INFORMATION;
typedef struct _OBJECT_HANDLE_ATTRIBUTE_INFORMATION
{
BOOLEAN Inherit;
BOOLEAN ProtectFromClose;
} OBJECT_HANDLE_ATTRIBUTE_INFORMATION, *POBJECT_HANDLE_ATTRIBUTE_INFORMATION;
#endif /* __USE_W32API */
typedef struct _OBJECT_TYPE

View file

@ -1,5 +1,5 @@
/* $Id: zw.h,v 1.17 2003/09/10 06:12:21 vizzini Exp $
/* $Id: zw.h,v 1.18 2003/10/04 17:10:55 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -4748,12 +4748,7 @@ NtSetInformationKey(
* ObjectHandle =
* ObjectInformationClass = Index to the set of parameters to change.
ObjectBasicInformation
ObjectTypeInformation OBJECT_TYPE_INFORMATION
ObjectAllInformation
ObjectDataInformation OBJECT_DATA_INFORMATION
ObjectNameInformation OBJECT_NAME_INFORMATION
ObjectHandleInformation OBJECT_HANDLE_ATTRIBUTE_INFORMATION
* ObjectInformation = Caller supplies storage for parameters to set.
@ -4764,7 +4759,7 @@ NTSTATUS
STDCALL
NtSetInformationObject(
IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
IN PVOID ObjectInformation,
IN ULONG Length
);
@ -5353,10 +5348,11 @@ ZwQueryIntervalProfile(
ObjectHandle = Handle to a object
ObjectInformationClass = Index to a certain information structure
ObjectBasicInformation
ObjectTypeInformation OBJECT_TYPE_INFORMATION
ObjectBasicInformation OBJECT_BASIC_INFORMATION
ObjectNameInformation OBJECT_NAME_INFORMATION
ObjectDataInformation OBJECT_DATA_INFORMATION
ObjectTypeInformation OBJECT_TYPE_INFORMATION
ObjectAllTypesInformation OBJECT_ALL_TYPES_INFORMATION
ObjectHandleInformation OBJECT_HANDLE_ATTRIBUTES_INFORMATION
ObjectInformation = Caller supplies storage for resulting information
Length = Size of the supplied storage
@ -5367,10 +5363,10 @@ NTSTATUS
STDCALL
ZwQueryObject(
IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
OUT PVOID ObjectInformation,
IN ULONG Length,
OUT PULONG ResultLength
OUT PULONG ResultLength OPTIONAL
);
NTSTATUS
@ -5472,12 +5468,7 @@ ZwSetInformationKey(
* ObjectHandle =
* ObjectInformationClass = Index to the set of parameters to change.
ObjectBasicInformation
ObjectTypeInformation OBJECT_TYPE_INFORMATION
ObjectAllInformation
ObjectDataInformation OBJECT_DATA_INFORMATION
ObjectNameInformation OBJECT_NAME_INFORMATION
ObjectHandleInformation OBJECT_HANDLE_ATTRIBUTE_INFORMATION
* ObjectInformation = Caller supplies storage for parameters to set.
@ -5488,7 +5479,7 @@ NTSTATUS
STDCALL
ZwSetInformationObject(
IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
IN PVOID ObjectInformation,
IN ULONG Length
);
@ -5758,10 +5749,11 @@ NtQuerySystemTime (
ObjectHandle = Handle to a object
ObjectInformationClass = Index to a certain information structure
ObjectBasicInformation
ObjectTypeInformation OBJECT_TYPE_INFORMATION
ObjectBasicInformation OBJECT_BASIC_INFORMATION
ObjectNameInformation OBJECT_NAME_INFORMATION
ObjectDataInformation OBJECT_DATA_INFORMATION
ObjectTypeInformation OBJECT_TYPE_INFORMATION
ObjectAllTypesInformation OBJECT_ALL_TYPES_INFORMATION
ObjectHandleInformation OBJECT_HANDLE_ATTRIBUTE_INFORMATION
ObjectInformation = Caller supplies storage for resulting information
Length = Size of the supplied storage
@ -5772,10 +5764,10 @@ NTSTATUS
STDCALL
NtQueryObject(
IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
OUT PVOID ObjectInformation,
IN ULONG Length,
OUT PULONG ResultLength
OUT PULONG ResultLength OPTIONAL
);
/* BEGIN REACTOS ONLY */

View file

@ -1189,13 +1189,6 @@ extern ULONG NtBuildNumber;
#define ThreadHideFromDebugger 17
#define MaxThreadInfoClass 17
// object handle information
#define ObjectBasicInformation 0
#define ObjectNameInformation 1
#define ObjectTypeInformation 2
#define ObjectAllInformation 3
#define ObjectDataInformation 4
typedef struct _ATOM_TABLE_INFORMATION
{
@ -1581,20 +1574,16 @@ struct _SYSTEM_QUOTA_INFORMATION
#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
typedef struct _OBJECT_DATA_INFORMATION
{
BOOLEAN bInheritHandle;
BOOLEAN bProtectFromClose;
} OBJECT_DATA_INFORMATION, *POBJECT_DATA_INFORMATION;
/* object information class */
typedef struct _OBJECT_TYPE_INFORMATION
typedef enum _OBJECT_INFORMATION_CLASS
{
UNICODE_STRING Name;
UNICODE_STRING Type;
ULONG TotalHandles;
ULONG ReferenceCount;
} OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION;
ObjectBasicInformation,
ObjectNameInformation,
ObjectTypeInformation,
ObjectAllTypesInformation,
ObjectHandleInformation
} OBJECT_INFORMATION_CLASS;
// directory information

View file

@ -1,4 +1,4 @@
/* $Id: handle.c,v 1.13 2003/08/28 19:37:00 gvg Exp $
/* $Id: handle.c,v 1.14 2003/10/04 17:12:31 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -32,26 +32,31 @@ DuplicateConsoleHandle (HANDLE hConsole,
/*
* @implemented
*/
WINBOOL WINAPI GetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags)
WINBOOL WINAPI
GetHandleInformation (HANDLE hObject,
LPDWORD lpdwFlags)
{
OBJECT_DATA_INFORMATION HandleInfo;
OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo;
ULONG BytesWritten;
NTSTATUS errCode;
NTSTATUS Status;
errCode = NtQueryObject(hObject,
ObjectDataInformation,
Status = NtQueryObject (hObject,
ObjectHandleInformation,
&HandleInfo,
sizeof(OBJECT_DATA_INFORMATION),
sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
&BytesWritten);
if (!NT_SUCCESS(errCode))
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus (errCode);
SetLastErrorByStatus (Status);
return FALSE;
}
if ( HandleInfo.bInheritHandle )
if (HandleInfo.Inherit)
*lpdwFlags &= HANDLE_FLAG_INHERIT;
if ( HandleInfo.bProtectFromClose )
if (HandleInfo.ProtectFromClose)
*lpdwFlags &= HANDLE_FLAG_PROTECT_FROM_CLOSE;
return TRUE;
}
@ -59,40 +64,43 @@ WINBOOL WINAPI GetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags)
/*
* @implemented
*/
WINBOOL STDCALL SetHandleInformation(HANDLE hObject,
WINBOOL STDCALL
SetHandleInformation (HANDLE hObject,
DWORD dwMask,
DWORD dwFlags)
{
OBJECT_DATA_INFORMATION HandleInfo;
NTSTATUS errCode;
OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo;
ULONG BytesWritten;
NTSTATUS Status;
errCode = NtQueryObject(hObject,
ObjectDataInformation,
Status = NtQueryObject (hObject,
ObjectHandleInformation,
&HandleInfo,
sizeof(OBJECT_DATA_INFORMATION),
sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
&BytesWritten);
if (!NT_SUCCESS(errCode))
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus (errCode);
SetLastErrorByStatus (Status);
return FALSE;
}
if (dwMask & HANDLE_FLAG_INHERIT)
{
HandleInfo.bInheritHandle = dwFlags & HANDLE_FLAG_INHERIT;
}
if (dwMask & HANDLE_FLAG_PROTECT_FROM_CLOSE)
{
HandleInfo.bProtectFromClose = dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE;
HandleInfo.Inherit = dwFlags & HANDLE_FLAG_INHERIT;
}
errCode = NtSetInformationObject(hObject,
ObjectDataInformation,
&HandleInfo,
sizeof(OBJECT_DATA_INFORMATION));
if (!NT_SUCCESS(errCode))
if (dwMask & HANDLE_FLAG_PROTECT_FROM_CLOSE)
{
SetLastErrorByStatus (errCode);
HandleInfo.ProtectFromClose = dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE;
}
Status = NtSetInformationObject (hObject,
ObjectHandleInformation,
&HandleInfo,
sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION));
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus (Status);
return FALSE;
}

View file

@ -1,4 +1,4 @@
/* $Id: ntobj.c,v 1.14 2003/07/10 21:34:29 royce Exp $
/* $Id: ntobj.c,v 1.15 2003/10/04 17:11:58 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -35,10 +35,41 @@
*/
NTSTATUS STDCALL
NtSetInformationObject (IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
IN PVOID ObjectInformation,
IN ULONG Length)
{
#if 0
POBJECT_HEADER ObjectHeader;
PVOID Object;
NTSTATUS Status;
if (ObjectInformationClass != ObjectHandleInformation)
return STATUS_INVALID_INFO_CLASS;
if (Length != sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION))
return STATUS_INFO_LENGTH_MISMATCH;
Status = ObReferenceObjectByHandle (ObjectHandle,
0,
NULL,
KeGetPreviousMode(),
&Object,
NULL);
if (!NT_SUCCESS (Status))
{
return Status;
}
ObjectHeader = BODY_TO_HEADER(Object);
/* FIXME: Change handle attributes here... */
ObDereferenceObject(Object);
return Status;
#endif
UNIMPLEMENTED;
}
@ -67,10 +98,10 @@ NtSetInformationObject (IN HANDLE ObjectHandle,
*/
NTSTATUS STDCALL
NtQueryObject (IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
OUT PVOID ObjectInformation,
IN ULONG Length,
OUT PULONG ReturnLength)
OUT PULONG ReturnLength OPTIONAL)
{
POBJECT_TYPE_INFORMATION typeinfo;
POBJECT_HEADER ObjectHeader;
@ -92,6 +123,10 @@ NtQueryObject (IN HANDLE ObjectHandle,
switch (ObjectInformationClass)
{
case ObjectBasicInformation:
Status = STATUS_NOT_IMPLEMENTED;
break;
case ObjectNameInformation:
Status = ObQueryNameString (Object,
(POBJECT_NAME_INFORMATION)ObjectInformation,
@ -119,9 +154,17 @@ NtQueryObject (IN HANDLE ObjectHandle,
typeinfo->ReferenceCount = ObjectHeader -> RefCount;
break;
default:
case ObjectAllTypesInformation:
Status = STATUS_NOT_IMPLEMENTED;
break;
case ObjectHandleInformation:
Status = STATUS_NOT_IMPLEMENTED;
break;
default:
Status = STATUS_INVALID_INFO_CLASS;
break;
}
ObDereferenceObject(Object);
@ -177,7 +220,7 @@ NtMakeTemporaryObject (IN HANDLE Handle)
Status = ObReferenceObjectByHandle(Handle,
0,
NULL,
KernelMode,
KeGetPreviousMode(),
& Object,
NULL);
if (Status != STATUS_SUCCESS)