CreateDeviceAccessInstance function (deviceaccess.h)

Creates the object that's used to access a device. The instantiated object implements the IDeviceIoControl and ICreateDeviceAccessAsync interfaces.

Conditions (FYI):


 !defined(__deviceaccess_h__) [-AND-]  ((NTDDI_VERSION >= NTDDI_WIN8)) [-AND-]  defined(__cplusplus)

Declaration from header.


 HRESULT WINAPI  
CreateDeviceAccessInstance(  
    _In_ LPCWSTR deviceInterfacePath,  
    _In_ DWORD desiredAccess,  
    _Outptr_ ICreateDeviceAccessAsync **createAsync  
    );

Syntax

HRESULT CreateDeviceAccessInstance(
  [in] PCWSTR                   deviceInterfacePath,
  [in] DWORD                    desiredAccess,
       ICreateDeviceAccessAsync **createAsync
);

Parameters

[in] deviceInterfacePath

A valid device interface path for the device that this instance should bind to.

[in] desiredAccess

The requested level of access to the device, which can be summarized as read, write, both, or neither (zero).

The most commonly used values are GENERIC_READ, GENERIC_WRITE, or both (GENERIC_READ | GENERIC_WRITE). For more information, see Generic Access Rights, File Security and Access Rights, File Access Rights Constants, Creating and Opening Files, and ACCESS_MASK.

createAsync

Asynchronous interface to control binding for this instance. For more information, see ICreateDeviceAccessAsync.

Return value

S_OK if the underlying object and asynchronous operation are created successfully; an appropriate error otherwise. Note that this function doesn't perform the actual binding.That happens as part of the asynchronous operation.

Requirements

Requirement Value
Target Platform Windows
Header deviceaccess.h
Library Deviceaccess.lib
DLL Deviceaccess.dll