能力值:
( LV2,RANK:10 )
2 楼
如题,谁能详细解释一下题中的两个东东,具体应该怎样使用他们两个呢?
能力值:
( LV8,RANK:130 )
3 楼
NTSYSAPI
NTSTATUS
NTAPI
ObReferenceObjectByName (
IN PUNICODE_STRING ObjectName,
IN ULONG Attributes,
IN PACCESS_STATE PassedAccessState OPTIONAL,
IN ACCESS_MASK DesiredAccess OPTIONAL,
IN POBJECT_TYPE ObjectType OPTIONAL,
IN KPROCESSOR_MODE AccessMode,
IN OUT PVOID ParseContext OPTIONAL,
OUT PVOID *Object
); typedef struct _OBJECT_TYPE {
ERESOURCE Mutex;
LIST_ENTRY TypeList;
UNICODE_STRING Name; // Copy from object header for convenience
PVOID DefaultObject;
ULONG Index;
ULONG TotalNumberOfObjects;
ULONG TotalNumberOfHandles;
ULONG HighWaterNumberOfObjects;
ULONG HighWaterNumberOfHandles;
OBJECT_TYPE_INITIALIZER TypeInfo;
#ifdef POOL_TAGGING
ULONG Key;
#endif //POOL_TAGGING
} OBJECT_TYPE, *POBJECT_TYPE; POBJECT_TYPE 如果是IoDeviceObjectType,调用上面的这个函数后就会返回一个PDEVICE_OBJECT
POBJECT_TYPE 如果是IoDriverObjectType,调用上面的这个函数后就会返回一个PDRIVER_OBJECT
POBJECT_TYPE是导出的 还有好多,你说的只是两个
自己查找一下资料
能力值:
( LV9,RANK:610 )
4 楼
重复发帖有意义吗?不如自己去看Windows对象管理
能力值:
( LV2,RANK:10 )
5 楼
很抱歉,帖子发重了,本来想在另一个板块发的,非常抱歉。
能力值:
( LV2,RANK:10 )
6 楼
我想问一下,可不可以不通过ObReferenceObjectByHandle之类的函数使用IoDeviceObjectType,而是将其当成是一种类型对象链表的头结点,从而依次枚举链表上的各结点的信息。
能力值:
( LV8,RANK:130 )
7 楼
//模拟IoGetDeviceObjectPointer实现
NTSTATUS
MyIoGetDeviceObjectPointer(
IN PUNICODE_STRING ObjectName,
IN ACCESS_MASK DesiredAccess,
OUT PFILE_OBJECT *FileObject,
OUT PDEVICE_OBJECT *DeviceObject
)
{
PFILE_OBJECT fileObject;
OBJECT_ATTRIBUTES objectAttributes;
HANDLE fileHandle;
IO_STATUS_BLOCK ioStatus;
NTSTATUS status;
//设置要打开的设备的设备名
InitializeObjectAttributes( &objectAttributes,
ObjectName,
OBJ_KERNEL_HANDLE,
(HANDLE) NULL,
(PSECURITY_DESCRIPTOR) NULL );
//ZwOpenFile打开设备
status = ZwOpenFile( &fileHandle,
DesiredAccess,
&objectAttributes,
&ioStatus,
0,
FILE_NON_DIRECTORY_FILE );
if (NT_SUCCESS( status ))
{
//得到文件对象指针
status = ObReferenceObjectByHandle( fileHandle,
0,
*IoFileObjectType,
KernelMode,
(PVOID *) &fileObject,
NULL );
if (NT_SUCCESS( status ))
{
*FileObject = fileObject;
//得到设备对象指针
*DeviceObject = IoGetBaseFileSystemDeviceObject( fileObject );
}
ZwClose( fileHandle );
}
return status;
} 仔细看一下