> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenSharedHandleByName

> 使用 Name 和 Access 打开共享资源、共享堆和共享围栏的句柄。

使用 Name 和 Access 打开共享资源、共享堆和共享围栏的句柄。

## 语法

```cpp theme={null}
HRESULT OpenSharedHandleByName(
    LPCWSTR Name,
    DWORD Access,
    HANDLE  pNTHandle
)
```

### 参数

*Name \[in]*\
类型：LPCWSTR

在对 [ID3D12Device::CreateSharedHandle](https://docs.xbox.com/zh-CN/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createsharedhandle_public.md) 的调用中可选择性地作为 *Name* 参数传递的名称。

*Access*\
类型：DWORD

在对 [ID3D12Device::CreateSharedHandle](https://docs.xbox.com/zh-CN/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createsharedhandle_public.md) 的调用中的 *Access* 参数中指定的访问级别。

*pNTHandle \[out]*\
类型：HANDLE \*

指向共享句柄的指针。

### 返回值

类型：HRESULT

此方法返回 [Direct3D 12 返回代码](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/d3d12-graphics-reference-returnvalues) 之一。

## 要求

**头文件：** d3d12\_xs.h 或 d3d12\_x.h\
**库：** d3d12\_xs.lib 或 d3d12\_x.lib\
**支持的平台**：XBOX Series 主机和 XBOX One 系列

## 另请参阅

[ID3D12Device](https://docs.xbox.com/zh-CN/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device.md)


## Related topics

- [OpenSharedHandle](https://docs.xbox.com/zh-CN/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_opensharedhandle_public.md)
- [OpenWaitHandle](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/IGameInputDispatcher/methods/igameinputdispatcher_openwaithandle.md)
- [Get Player Shared Secrets](https://docs.xbox.com/api-reference/authentication/get-player-shared-secrets.md)
- [Update Player Shared Secret](https://docs.xbox.com/api-reference/authentication/update-player-shared-secret.md)
- [Create Player Shared Secret](https://docs.xbox.com/api-reference/authentication/create-player-shared-secret.md)
