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

# SetProtectedResourceSession

> 指定命令列表中的后续命令是否可以访问受保护的资源。

指定命令列表中的后续命令是否可以访问受保护的资源。默认情况下，不启用任何受保护的资源。使用有效会话调用 **SetProtectedResourceSession** 之后，相同类型的受保护资源可以引用该会话。使用 **NULL** 调用 **SetProtectedResourceSession** 之后，将无法访问任何受保护的资源。

## 语法

```cpp theme={null}
void SetProtectedResourceSession(
    ID3D12ProtectedResourceSession  pProtectedResourceSession
)
```

### 参数

*pProtectedResourceSession \[in, optional]*<br />类型：ID3D12ProtectedResourceSession \*

指向 **ID3D12ProtectedResourceSession** 的可选指针。可以通过调用 [ID3D12Device4::CreateProtectedResourceSession](/reference/graphics/d3d12/interfaces/id3d12device4/methods/id3d12device4_createprotectedresourcesession_public) 来获取 **ID3D12ProtectedResourceSession**。

### 返回值

类型：void

如果已设置，则表示可以使用给定会话访问受保护的资源。只有使用有效会话调用 **SetProtectedResourceSession** 之后，才能访问受保护的资源。调用此方法时会清除命令列表状态。如果传递 **NULL**，则无法访问任何受保护的资源。

## 要求

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

## 另请参阅

[ID3D12GraphicsCommandList3](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist3/id3d12graphicscommandlist3_public)


## Related topics

- [ID3D12ProtectedResourceSession](/zh-CN/reference/graphics/d3d12/interfaces/id3d12protectedresourcesession/id3d12protectedresourcesession_public.md)
- [D3D12_PROTECTED_RESOURCE_SESSION_DESC](/zh-CN/reference/graphics/d3d12/structs/d3d12_protected_resource_session_desc_public.md)
- [CreateProtectedResourceSession (XBOX Series 主机)](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device4/methods/id3d12device4_createprotectedresourcesession_public.md)
- [D3D12_PROTECTED_RESOURCE_SESSION_DESC1](/zh-CN/reference/graphics/d3d12/structs/d3d12_protected_resource_session_desc1_public.md)
- [ID3D12ProtectedResourceSession1](/zh-CN/reference/graphics/d3d12/interfaces/id3d12protectedresourcesession1/id3d12protectedresourcesession1_public.md)
