> ## 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.

# SetPrivateDataInterface

> 将从 IUnknown 派生的接口与设备对象关联，并将该接口与应用程序定义的 GUID 关联。

将从 [IUnknown](https://learn.microsoft.com/en-us/windows/desktop/api/unknwn/nn-unknwn-iunknown) 派生的接口与设备对象关联，并将该接口与应用程序定义的 **GUID** 关联。

## 语法

```cpp theme={null}
HRESULT SetPrivateDataInterface(
    const GUID & guid,
    const IUnknown  pData
)
```

### 参数

*guid \[in]*\
类型：const GUID &

要与接口关联的 **GUID**。

*pData \[in, optional]*\
类型：const IUnknown \*

指向要与设备对象关联的从 [IUnknown](https://learn.microsoft.com/en-us/windows/desktop/api/unknwn/nn-unknwn-iunknown) 派生的接口的指针。

### 返回值

类型：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 系列

## 另请参阅

[ID3D12Object](/reference/graphics/d3d12_xs/interfaces/ID3D12Object/id3d12object)


## Related topics

- [GetPrivateData](/zh-CN/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_getprivatedata_public.md)
- [CreatePipelineLibrary](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device1/methods/id3d12device1_createpipelinelibrary_public.md)
- [SetPrivateData](/zh-CN/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setprivatedata_public.md)
- [SetName](/zh-CN/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setname_public.md)
- [PFUserDataPermission](/zh-CN/services/playfab/api-references/c/pftypes/enums/pfuserdatapermission.md)
