zoukankan      html  css  js  c++  java
  • InitializeObjectAttributes 宏

    InitializeObjectAttributes 宏

    用googlet翻译的,欢迎指正。

    The InitializeObjectAttributes macro initializes the opaque OBJECT_ATTRIBUTES structure,
    which specifies the properties of an object handle to routines that open handles.
    InitializeObjectAttributes宏,初始化一个OBJECT_ATTRIBUTES结构体,它指定对象句柄的属性,供打开句柄的例程使用。

    VOID InitializeObjectAttributes(
    [out] POBJECT_ATTRIBUTES InitializedAttributes,
    [in] PUNICODE_STRING ObjectName,
    [in] ULONG Attributes,
    [in] HANDLE RootDirectory,
    [in, optional] PSECURITY_DESCRIPTOR SecurityDescriptor
    );

    Parameters
    InitializedAttributes [out]
    Specifies the OBJECT_ATTRIBUTES structure to initialize.
    指定要初始化的OBJECT_ATTRIBUTES结构体指针。
    ObjectName [in]
    A pointer to a Unicode string that contains name of the object for which a handle is to be opened.
    This must either be a fully qualified object name,
    or a relative path name to the object directory specified by the RootDirectory parameter.
    一个指向UNICODE字符串对象的指针,它包含将要打开句柄的对象名称。
    它必须是一个完整的对象名称或者是相对于RootDirectory参数指定目录的相对路径。
    Attributes [in]
    Specifies one or more of the following flags:
    指定一个或多个以下列标志:
    OBJ_INHERIT
    This handle can be inherited by child processes of the current process.
    这个句柄可以被当前进程的子进程继承。
    OBJ_PERMANENT
    This flag only applies to objects that are named within the object manager.
    By default, such objects are deleted when all open handles to them are closed.
    If this flag is specified, the object is not deleted when all open handles are closed.
    Drivers can use ZwMakeTemporaryObject to delete permanent objects.
    此标志仅应用于对象管理器命名的对象。
    默认情况下,这样的对象会在关闭所有它们打开的句柄时删除。
    如果指定了此标志,对象不会在所有打开的句柄关闭时删除,
    驱动可以使用ZwMakeTemporaryObject删除固定的对象。
    OBJ_EXCLUSIVE
    Only a single handle can be open for this object.
    这个对象只可以有一个打开的句柄。意味着仅有一个进程可以访问此对象。
    OBJ_CASE_INSENSITIVE
    If this flag is specified, a case-insensitive comparison is used when matching the ObjectName parameter against the names of existing objects.
    Otherwise, object names are compared using the default system settings.
    如果指定了此标志,在对ObjectName参数与已存在的对象名称进行匹配时,会不区分大小写。
    OBJ_OPENIF
    If this flag is specified to a routine that creates objects, and that object already exists then the routine should open that object.
    Otherwise, the routine creating the object returns an NTSTATUS code of STATUS_OBJECT_NAME_COLLISION.
    如果在创建对象的例程中指定此标志,当对象已经存在时,例程将会打开些对象。
    否则,创建对象的例程会返回值为STATUS_OBJECT_NAME_COLLISION的NTSTATUS代码。
    OBJ_KERNEL_HANDLE
    Specifies that the handle can only be accessed in kernel mode.
    指定句柄仅能在内核模式访问。
    OBJ_FORCE_ACCESS_CHECK
    The routine opening the handle should enforce all access checks for the object, even if the handle is being opened in kernel mode.
    打开句柄的例程,应执行所有的访问检查,即使是在内核模式下也如此。
    RootDirectory [in]
    A handle to the root object directory for the path name specified in the ObjectName parameter.
    If ObjectName is a fully qualified object name, RootDirectory is NULL. Use ZwCreateDirectoryObject to obtain a handle to an object directory.
    root目录对象句柄,用于ObjectName参数指定的相对路径时。
    如果ObjectName参数是一个完整的对象名,RootDirectory是NULL。
    使用ZwCreateDirectoryObject获取对象目录的句柄。
    SecurityDescriptor [in, optional]
    Specifies a security descriptor to apply to an object when it is created. This parameter is optional.
    Drivers can specify NULL to accept the default security for the object. For more information, see the following Remarks section.
    指定对象创建时应用的一个安全描述符。此参数是可选的。对象如果接受默认的安全设置,驱动程序可以指定NULL。更多信息,参见下面的备注节。
    返回值:

    备注:
    InitializeObjectAttributes initializes an OBJECT_ATTRIBUTES structure that specifies the properties of an object handle to be opened.
    The caller can then pass a pointer to this structure to a routine that actually opens the handle.
    Driver routines that run in a process context other than that of the system process must set the OBJ_KERNEL_HANDLE flag for the Attributes parameter.
    This flag restricts the use of a handle opened for that object to processes running only in kernel mode.
    Otherwise, the handle can be accessed by the process in whose context the driver is running.

    InitializeObjectAttributes初始化一个OBJECT_ATTRIBUTES结构体,它设置将被打开的对象句柄的属性。
    调用者可以传递一个此结构的指针到实际打开句柄的例程。
    驱动程序运行进程上下文中,若要运行在系统进程,需要设置OBJ_KERNEL_HANDLE标志到Attributes参数。
    这个标志限制,使用此打开的句柄的进程仅能运行在内核模式。
    否则句柄可以在驱动运行的进程上下文中访问。

    Note that InitializeObjectAttributes always sets the SecurityQualityOfService member of OBJECT_ATTRIBUTES to NULL.
    注意,InitializeObjectAttributes始终设置OBJCECT_ATTRIBUTES的SecurityQualityOfService成员为NULL。
    Drivers that require a non-NULL value can set SecurityQualityOfService directly.
    如果驱动程序需要一个非空的值,可以直接设置SecurityQualityOfService成员。

  • 相关阅读:
    SSH防止超时的设置
    vuejs中v-bind绑定class时的注意事项
    js常用到的方法积累
    主流浏览器以及系统的判断
    理解Javascript的状态容器Redux
    可伸缩架构简短系列
    在Node.js中使用RabbitMQ系列一 Hello world
    在Node.js中使用RabbitMQ系列二 任务队列
    Javascript中的async await
    公钥,私钥和数字签名
  • 原文地址:https://www.cnblogs.com/bqrm/p/3116051.html
Copyright © 2011-2022 走看看