D3DKMTShareObjects function (d3dkmthk.h)

D3DKMTShareObjects shares resource objects that were created with the D3KMTCreateAllocation, D3KMTCreateAllocation2D3DKMTCreateKeyedMutex2, and D3DKMTCreateSynchronizationObject2 functions.

Syntax

NTSTATUS D3DKMTShareObjects(
  [in]  UINT                cObjects,
  [in]  const D3DKMT_HANDLE *hObjects,
  [in]  POBJECT_ATTRIBUTES  pObjectAttributes,
  [in]  DWORD               dwDesiredAccess,
  [out] HANDLE              *phSharedNtHandle
);

Parameters

[in] cObjects

The number of resource objects provided in the hObjects parameter. This value must be less than or equal to D3DKMT_MAX_OBJECTS_PER_HANDLE.

[in] hObjects

A pointer to an array of local kernel-mode handles that specify the resource objects to be shared. For more information, see Remarks.

[in] pObjectAttributes

A pointer to an OBJECT_ATTRIBUTES structure that specifies attributes of the resource objects.

[in] dwDesiredAccess

Specifies read and write access for the resource.

For GPU synchronization objects, dwDesiredAccess can be a combination of the following bit fields (defined in d3dukmdt.h).

Value Meaning
STANDARD_RIGHTS_READ The process that opens the sync object can read the state of the sync object. This flag must be specified or the object will be inaccessible.
D3DDDI_SYNC_OBJECT_WAIT The process that opens the sync object can issue wait operations for the sync object.
D3DDDI_SYNC_OBJECT_SIGNAL The process that opens the sync object can issue signal operations for the sync object.
D3DDDI_SYNC_OBJECT_ALL_ACCESS The process that opens the sync object can issue any operation for the sync object.

For shared resources, the desired access can be specified as a combination of the following flags (defined in d3dkmthk.h):

Value Meaning
STANDARD_RIGHTS_READ The process that opens the resource can have read access. This flag must be specified or the object will be inaccessible.
SHARED_ALLOCATION_WRITE The process that opens the resource can have write access. If this access flag is not specified, the resource will be opened as read-only.
SHARED_ALLOCATION_ALL_ACCESS The process that opens the resource can have all access to the object.

[out] phSharedNtHandle

A pointer to a shared NT handle that specifies the resource objects.

This parameter will be NULL if the NtSecuritySharing flag value is not set. For more information, see Remarks.

Return value

The method returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method might return an appropriate NTSTATUS error code.

Remarks

Objects to be shared using D3DKMTShareObjects must first be created with the NtSecuritySharing flag value set. This flag value is available in the D3DKMT_CREATEALLOCATIONFLAGS, D3DKMT_CREATEKEYEDMUTEX2_FLAGS, and D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS structures.

This function must specify handles through the hObjects parameter only to the following combinations of input object array types:

  • an allocation
  • an allocation, a keyed mutex, and a synchronization object
  • a synchronization object

The operating system will reject any other input handle combinations.

Requirements

Requirement Value
Minimum supported client Windows 8
Minimum supported server Windows Server 2012
Target Platform Universal
Header d3dkmthk.h (include D3dkmthk.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS

D3DKMTCreateAllocation

D3DKMTCreateAllocation2

D3DKMTCreateKeyedMutex2

D3DKMTCreateSynchronizationObject2

D3DKMT_CREATEALLOCATIONFLAGS

D3DKMT_CREATEKEYEDMUTEX2_FLAGS