> ## 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](/zh-TW/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](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist3/id3d12graphicscommandlist3_public)


## Related topics

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