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

# SetPrivateData

> Sets application-defined data to a device object and associates that data with an application-defined GUID.

Sets application-defined data to a device object and associates that data with an application-defined **GUID**.

## Syntax

```cpp theme={null}
HRESULT SetPrivateData(
    const GUID & guid,
    UINT DataSize,
    const void  pData
)
```

### Parameters

*guid \[in]*\
Type: const GUID &

The **GUID** to associate with the data.

*DataSize \[in]*\
Type: UINT

The size in bytes of the data.

*pData \[in, optional]*\
Type: const void \*

A pointer to a memory block that contains the data to be stored with this device object. If *pData* is **NULL**, *DataSize* must also be 0, and any data that was previously associated with the **GUID** specified in *guid* will be destroyed.

### Return value

Type: HRESULT

This method returns one of the [Direct3D 12 Return Codes](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/d3d12-graphics-reference-returnvalues).

## Remarks

Rather than using the Direct3D 11 debug object naming scheme of calling **ID3D12Object::SetPrivateData** using **WKPDID\_D3DDebugObjectName** with an ASCII name,
call [ID3D12Object::SetName](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setname_public.md) with a UNICODE name.

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[ID3D12Object](https://docs.xbox.com/reference/graphics/d3d12_xs/interfaces/ID3D12Object/id3d12object.md)


## Related topics

- [SetName](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setname_public.md)
- [SetPrivateDataInterface](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setprivatedatainterface_public.md)
- [GetPrivateData](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_getprivatedata_public.md)
- [How to set internal player data](https://docs.xbox.com/services/playfab/player-progression/player-data/how-to-set-internal-player-data.md)
- [PFUserPrivateAccountInfo](https://docs.xbox.com/services/playfab/api-references/c/pftypes/structs/pfuserprivateaccountinfo.md)
