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

# OpenSharedHandle

> Opens a handle for shared resources, shared heaps, and shared fences, by using HANDLE and REFIID.

Opens a handle for shared resources, shared heaps, and shared fences, by using HANDLE and REFIID.

## Syntax

```cpp theme={null}
HRESULT OpenSharedHandle(
    HANDLE NTHandle,
    const IID & riid,
    void  ppvObj
)
```

### Parameters

*NTHandle \[in]*\
Type: HANDLE

The handle that was output by the call to
[ID3D12Device::CreateSharedHandle](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createsharedhandle_public).

*riid*\
Type: const IID &

The globally unique identifier (**GUID**) for one of the following interfaces:

<ul>
  <li>
    [ID3D12Heap](/reference/graphics/d3d12/interfaces/id3d12heap/id3d12heap_public)
  </li>

  <li>
    [ID3D12Resource](/reference/graphics/d3d12_xs/interfaces/ID3D12Resource/id3d12resource_xs)
  </li>

  <li>
    [ID3D12Fence](/reference/graphics/d3d12/interfaces/id3d12fence/id3d12fence_public)
  </li>
</ul>

The **REFIID**, or **GUID**, of the interface can be obtained by using the \_\_uuidof() macro.
For example, \_\_uuidof(ID3D12Heap) will get the **GUID** of the interface to a resource.

*ppvObj \[out, optional]*\
Type: void \*\*

A pointer to a memory block that receives a pointer to one of the following interfaces:

<ul>
  <li>
    [ID3D12Heap](/reference/graphics/d3d12/interfaces/id3d12heap/id3d12heap_public)
  </li>

  <li>
    [ID3D12Resource](/reference/graphics/d3d12_xs/interfaces/ID3D12Resource/id3d12resource_xs)
  </li>

  <li>
    [ID3D12Fence](/reference/graphics/d3d12/interfaces/id3d12fence/id3d12fence_public)
  </li>
</ul>

### Return value

Type: HRESULT

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

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

[ID3D12Device](/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device)

[Multi-adapter systems](https://learn.microsoft.com/en-us/windows/win32/direct3d12/multi-engine)


## Related topics

- [OpenSharedHandleByName](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_opensharedhandlebyname_public.md)
- [IGameInputDispatcher::OpenWaitHandle](/reference/input/gameinput/interfaces/IGameInputDispatcher/methods/igameinputdispatcher_openwaithandle.md)
- [XStore on PC — DRM, license tokens, and sandboxes](/publishing/xstore-commerce/xstore-pc.md)
- [DirectStorage Overview](/build/console-features/storage/directstorage/directstorage-overview.md)
- [Profile Writes Meter API Description](/services/playfab/pricing/meters/profile-writes.md)
