这个函数是干什么用的 还有怎么用啊 谢谢各位指点

解决方案 »

  1.   

    获取对应object的相关信息WDK:
    The ZwQueryObject routine provides information about a supplied object.NTSTATUS 
      ZwQueryObject(
        IN HANDLE   OPTIONAL,
        IN OBJECT_INFORMATION_CLASS  ,
        OUT PVOID   OPTIONAL,
        IN ULONG  ,
        OUT PULONG   OPTIONAL
        ); Parameters
    Handle 
    A handle to the object to obtain information about. 
    ObjectInformationClass 
    Specifies an OBJECT_INFORMATION_CLASS value that determines the type of information returned in the ObjectInformation buffer. 
    ObjectInformation 
    A pointer to a caller-allocated buffer that receives the requested information. 
    ObjectInformationLength 
    Specifies the size, in bytes, of the ObjectInformation buffer. 
    ReturnLength 
    A pointer to a variable that receives the size, in bytes, of the requested key information. If ZwQueryObject returns STATUS_SUCCESS, the variable contains the amount of data returned. If ZwQueryObject returns STATUS_BUFFER_OVERFLOW or STATUS_BUFFER_TOO_SMALL, you can use the value of the variable to determine the required buffer size. Return Value
    ZwQueryObject returns STATUS_SUCCESS or an appropriate error status. Possible error status codes include the following:STATUS_ACCESS_DENIED 
    There were insufficient permissions to perform this query. 
    STATUS_INVALID_HANDLE 
    The supplied object handle is invalid. 
    STATUS_INFO_LENGTH_MISMATCH 
    The info length is not sufficient to hold the data. 
    Requirements
    Versions: This routine is available on Microsoft Windows 2000 and later versions of the Windows operating system. IRQL: PASSIVE_LEVELHeaders: Declared in Ntifs.h. Include Ntifs.h. 
    See Also
    OBJECT_INFORMATION_CLASS
      

  2.   

    NTOSAPI
    NTSTATUS
    NTAPI
    ZwQueryObject(
    IN HANDLE  ObjectHandle,
    IN OBJECT_INFORMATION_CLASS  ObjectInformationClass,
    OUT PVOID  ObjectInformation,
    IN ULONG  ObjectInformationLength,
    OUT PULONG  ReturnLength  OPTIONAL);Native Api
      

  3.   

    ZwQueryObject queries generic information about any object.
    NTSYSAPI
    NTSTATUS
    NTAPI
    ZwQueryObject(
    IN HANDLE ObjectHandle,
    IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
    OUT PVOID ObjectInformation,
    IN ULONG ObjectInformationLength,
    OUT PULONG ReturnLength OPTIONAL
    );
    Parameters
    ObjectHandle
    A handle to an object.The handle need not grant any specific access. If the information
    class requested does not return information which is specific to a particular object
    or handle, this parameter may be zero.
    ObjectInformationClass
    The type of object information to be queried.The permitted values are drawn from
    the enumeration OBJECT_INFORMATION_CLASS, described in the following section.
    ObjectInformation
    Points to a caller-allocated buffer or variable that receives the requested object
    information.
    1996 Ch02 11/19/99 12:25 PM Page 61
    62 Objects, Object Directories, and Symbolic Links: Links: ZwQueryObject
    ObjectInformationLength
    Specifies the size in bytes of ObjectInformation, that the caller should set according
    to the given ObjectInformationClass.
    ReturnLength
    Optionally points to a variable that receives the number of bytes actually returned to
    ObjectInformation. If ObjectInformationLength is too small to contain the available
    data, the variable is set to the number of bytes required for the available data. If this
    information is not needed, ReturnLength may be a null pointer.
    Return Value
    Returns STATUS_SUCCESS or an error status, such as STATUS_INVALID_HANDLE,
    STATUS_INVALID_INFO_CLASS, or STATUS_INFO_LENGTH_MISMATCH.
    Related Win32 Functions
    GetHandleInformation.
    Res
    ZwQueryObject returns generic information about objects. For most object types there
    is a native API routine that returns object type specific information. For example,
    ZwQueryInformationProcess returns information specific to process objects.
      

  4.   


    获取对象的类型PUBLIC_OBJECT_TYPE_INFORMATION
    The PUBLIC_OBJECT_TYPE_INFORMATION structure holds the type name of the object.typedef struct _PUBLIC_OBJECT_TYPE_INFORMATION {
      UNICODE_STRING  TypeName;
      ULONG  Reserved[22];
    } PUBLIC_OBJECT_TYPE_INFORMATION; PPUBLIC_OBJECT_TYPE_INFORMATIONMembers
    TypeName 
    Specifies the type name of the object. 
    Reserved 
    Reserved for system use. 
      

  5.   


    typedef enum _OBJECT_INFORMATION_CLASS {
    ObjectBasicInformation, // 0 Y N
    ObjectNameInformation, // 1 Y N
    ObjectTypeInformation, // 2 Y N
    ObjectAllTypesInformation, // 3 Y N
    ObjectHandleInformation // 4 Y Y
    } OBJECT_INFORMATION_CLASS;typedef struct _OBJECT_TYPE_INFORMATION { // Information Class 2
    UNICODE_STRING Name;
    ULONG ObjectCount;
    ULONG HandleCount;
    ULONG Reserved1[4];
    ULONG PeakObjectCount;
    ULONG PeakHandleCount;
    ULONG Reserved2[4];
    ULONG InvalidAttributes;
    GENERIC_MAPPING GenericMapping;
    ULONG ValidAccess;
    UCHAR Unknown;
    BOOLEAN MaintainHandleDatabase;
    POOL_TYPE PoolType;
    ULONG PagedPoolUsage;
    ULONG NonPagedPoolUsage;
    } OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION;
    Members
    Name
    A name that identifies this object type.
    ObjectCount
    The number of objects of this type in the system.
    HandleCount
    The number of handles to objects of this type in the system.
    1996 Ch02 11/19/99 12:25 PM Page 65
    66 Objects, Object Directories, and Symbolic Links: ObjectAllTypesInformation
    PeakObjectCount
    The peak number of objects of this type in the system.
    PeakHandleCount
    The peak number of handles to objects of this type in the system.
    InvalidAttributes
    A bit mask of the OBJ_Xxx attributes that are not valid for objects of this type.
    GenericMapping
    The mapping of generic access rights to specific access rights for this object type.
    ValidAccessMask
    The valid specific access rights for this object type.
    Unknown
    Interpretation unknown. Same as SYSTEM_OBJECT_TYPE_INFORMATION.Unknown.
    MaintainHandleDatabase
    Specifies whether the handles to objects of this type should be recorded in the objects
    to which they refer.
    PoolType
    The type of pool from which this object type is allocated (paged or nonpaged).
    PagedPoolUsage
    The amount of paged pool used by objects of this type.
    NonPagedPoolUsage
    The amount of nonpaged pool used by objects of this type.
    Res
    The ObjectInformation buffer should be large enough to hold the Buffer associated
    with the Name UNICODE_STRING.
    This information is similar to that returned by ZwQuerySystemInformation with an
    information class of SystemObjectInformation (17).
      

  6.   

     可以看看 《windows NT 本机 API 参考》 好像是这个名字吧,讲内核API的。