Top Description Inners Fields Methods
com.sun.jna.platform.win32

public Interface SetupApi

extends StdCallLibrary
Imports
java.util.List, com.sun.jna.Native, .Pointer, .Structure, .Structure.FieldOrder, com.sun.jna.platform.win32.Guid.GUID, .WinNT.HANDLE, .WinReg.HKEY, com.sun.jna.ptr.IntByReference, com.sun.jna.win32.StdCallLibrary, .W32APIOptions

The interface for the w32 setup API.
Author
Christian Schwarz

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SetupApi.SP_DEVICE_INTERFACE_DATA

An SP_DEVICE_INTERFACE_DATA structure defines a device interface in a device information set.

public static class
SetupApi.SP_DEVINFO_DATA

An SP_DEVINFO_DATA structure defines a device instance that is a member of a device information set.

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
DICS_FLAG_CONFIGGENERAL

1 or more hardware profile-specific changes to follow.

public static final int
DICS_FLAG_CONFIGSPECIFIC

make change in specified profile only

public static final int
DICS_FLAG_GLOBAL

make change in all hardware profiles

public static final int
DIGCF_ALLCLASSES

Return a list of installed devices for all device setup classes or all device interface classes.

public static final int
DIGCF_DEFAULT

Return only the device that is associated with the system default device interface, if one is set, for the specified device interface classes.

public static final int
DIGCF_DEVICEINTERFACE

Return devices that support device interfaces for the specified device interface classes.

public static final int
DIGCF_PRESENT

Return only devices that are currently present in a system.

public static final int
DIGCF_PROFILE

Return only devices that are a part of the current hardware profile.

public static final int
DIREG_BOTH

Delete both driver and Device key

public static final int
DIREG_DEV

Open/Create/Delete device key.

public static final int
DIREG_DRV

Open/Create/Delete driver key

public static final Guid.GUID
GUID_DEVINTERFACE_COMPORT

Drivers for serial ports register instances of this device interface class to notify the operating system and applications of the presence of COM ports.

public static final Guid.GUID
GUID_DEVINTERFACE_DISK

The GUID_DEVINTERFACE_DISK device interface class is defined for hard disk storage devices.

public static final SetupApi
public static final int
SPDRP_DEVICEDESC

DeviceDesc (R/W)

Device registry property codes (Codes marked as read-only (R) may only be used for SetupDiGetDeviceRegistryProperty)

These values should cover the same set of registry properties as defined by the CM_DRP codes in cfgmgr32.h.

public static final int
SPDRP_REMOVAL_POLICY

(Windows XP and later) The function retrieves the device's current removal policy as a DWORD that contains one of the CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h.

Inherited from com.sun.jna.win32.StdCallLibrary:
FUNCTION_MAPPERSTDCALL_CONVENTION

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.
SetupDiDestroyDeviceInfoList
(WinNT.HANDLE
A handle to the device information set to delete.
hDevInfo
)

The SetupDiDestroyDeviceInfoList function deletes a device information set and frees all associated memory.

public boolean

Returns:

The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.
SetupDiEnumDeviceInfo
(WinNT.HANDLE
A handle to the device information set for which to return an SP_DEVINFO_DATA structure that represents a device information element.
deviceInfoSet
,
int
A zero-based index of the device information element to retrieve.
memberIndex
,
SetupApi.SP_DEVINFO_DATA
A pointer to an SP_DEVINFO_DATA structure to receive information about an enumerated device information element.
deviceInfoData
)

The SetupDiEnumDeviceInfo function returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set.

public boolean

Returns:

SetupDiEnumDeviceInterfaces returns TRUE if the function completed without error. If the function completed with an error, FALSE is returned and the error code for the failure can be retrieved by calling GetLastError.
SetupDiEnumDeviceInterfaces
(WinNT.HANDLE
A pointer to a device information set that contains the device interfaces for which to return information. This handle is typically returned by SetupDiGetClassDevs.
hDevInfo
,
Pointer
A pointer to an SP_DEVINFO_DATA structure that specifies a device information element in DeviceInfoSet. This parameter is optional and can be NULL. If this parameter is specified, SetupDiEnumDeviceInterfaces constrains the enumeration to the interfaces that are supported by the specified device. If this parameter is NULL, repeated calls to SetupDiEnumDeviceInterfaces return information about the interfaces that are associated with all the device information elements in DeviceInfoSet. This pointer is typically returned by SetupDiEnumDeviceInfo.
devInfo
,
Guid.GUID
A pointer to a GUID that specifies the device interface class for the requested interface.
interfaceClassGuid
,
int
A zero-based index into the list of interfaces in the device information set. The caller should call this function first with MemberIndex set to zero to obtain the first interface. Then, repeatedly increment MemberIndex and retrieve an interface until this function fails and GetLastError returns ERROR_NO_MORE_ITEMS. If DeviceInfoData specifies a particular device, the MemberIndex is relative to only the interfaces exposed by that device.
memberIndex
,
SetupApi.SP_DEVICE_INTERFACE_DATA
A pointer to a caller-allocated buffer that contains, on successful return, a completed SP_DEVICE_INTERFACE_DATA structure that identifies an interface that meets the search parameters. The caller must set DeviceInterfaceData.cbSize to sizeof(SP_DEVICE_INTERFACE_DATA) before calling this function.
deviceInterfaceData
)

The SetupDiEnumDeviceInterfaces function enumerates the device interfaces that are contained in a device information set.

public WinNT.HANDLE

Returns:

If the operation succeeds, SetupDiGetClassDevs returns a handle to a device information set that contains all installed devices that matched the supplied parameters. If the operation fails, the function returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
SetupDiGetClassDevs
(Guid.GUID
A pointer to the GUID for a device setup class or a device interface class. This pointer is optional and can be NULL. For more information about how to set ClassGuid, see the following Remarks section.
classGuid
,
Pointer
A pointer to a NULL-terminated string that specifies: An identifier (ID) of a Plug and Play (PnP) enumerator. This ID can either be the value's globally unique identifier (GUID) or symbolic name. For example, "PCI" can be used to specify the PCI PnP value. Other examples of symbolic names for PnP values include "USB," "PCMCIA," and "SCSI". A PnP device instance ID. When specifying a PnP device instance ID, DIGCF_DEVICEINTERFACE must be set in the Flags parameter. This pointer is optional and can be NULL. If an enumeration value is not used to select devices, set Enumerator to NULL.
enumerator
,
Pointer
A handle to the top-level window to be used for a user interface that is associated with installing a device instance in the device information set. This handle is optional and can be NULL.
hwndParent
,
int
A variable of type DWORD that specifies control options that filter the device information elements that are added to the device information set.
flags
)

The SetupDiGetClassDevs function returns a handle to a device information set that contains requested device information elements for a local computer.

public boolean

Returns:

SetupDiGetDeviceInterfaceDetail returns TRUE if the function completed without error. If the function completed with an error, FALSE is returned and the error code for the failure can be retrieved by calling GetLastError.
SetupDiGetDeviceInterfaceDetail
(WinNT.HANDLE
A pointer to the device information set that contains the interface for which to retrieve details. This handle is typically returned by SetupDiGetClassDevs.
hDevInfo
,
SetupApi.SP_DEVICE_INTERFACE_DATA
A pointer to an SP_DEVICE_INTERFACE_DATA structure that specifies the interface in DeviceInfoSet for which to retrieve details. A pointer of this type is typically returned by SetupDiEnumDeviceInterfaces.
deviceInterfaceData
,
Pointer
A pointer to an SP_DEVICE_INTERFACE_DETAIL_DATA structure to receive information about the specified interface. This parameter is optional and can be NULL. This parameter must be NULL if DeviceInterfaceDetailSize is zero. If this parameter is specified, the caller must set DeviceInterfaceDetailData.cbSize to sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA) before calling this function. The cbSize member always contains the size of the fixed part of the data structure, not a size reflecting the variable-length string at the end.
deviceInterfaceDetailData
,
int
The size of the DeviceInterfaceDetailData buffer. The buffer must be at least (offsetof(SP_DEVICE_INTERFACE_DETAIL_DATA, DevicePath) + sizeof(TCHAR)) bytes, to contain the fixed part of the structure and a single NULL to terminate an empty MULTI_SZ string. This parameter must be zero if DeviceInterfaceDetailData is NULL.
deviceInterfaceDetailDataSize
,
IntByReference
A pointer to a variable of type DWORD that receives the required size of the DeviceInterfaceDetailData buffer. This size includes the size of the fixed part of the structure plus the number of bytes required for the variable-length device path string. This parameter is optional and can be NULL.
requiredSize
,
SetupApi.SP_DEVINFO_DATA
A pointer to a buffer that receives information about the device that supports the requested interface. The caller must set DeviceInfoData.cbSize to sizeof(SP_DEVINFO_DATA). This parameter is optional and can be NULL.
deviceInfoData
)

The SetupDiGetDeviceInterfaceDetail function returns details about a device interface.

public boolean

Returns:

SetupDiGetDeviceRegistryProperty returns TRUE if the call was successful. Otherwise, it returns FALSE and the logged error can be retrieved by making a call to GetLastError. SetupDiGetDeviceRegistryProperty returns the ERROR_INVALID_DATA error code if the requested property does not exist for a device or if the property data is not valid.
SetupDiGetDeviceRegistryProperty
(WinNT.HANDLE
A handle to a device information set that contains a device information element that represents the device for which to retrieve a Plug and Play property.
DeviceInfoSet
,
SetupApi.SP_DEVINFO_DATA
A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet.
DeviceInfoData
,
int
Specifies the property to be retrieved.
Property
,
IntByReference
A pointer to a variable that receives the data type of the property that is being retrieved. This is one of the standard registry data types. This parameter is optional and can be NULL.
PropertyRegDataType
,
Pointer
A pointer to a buffer that receives the property that is being retrieved. If this parameter is set to NULL, and PropertyBufferSize is also set to zero, the function returns the required size for the buffer in RequiredSize.
PropertyBuffer
,
int
The size, in bytes, of the PropertyBuffer buffer.
PropertyBufferSize
,
IntByReference
A pointer to a variable of type DWORD that receives the required size, in bytes, of the PropertyBuffer buffer that is required to hold the data for the requested property. This parameter is optional and can be NULL.
RequiredSize
)

The SetupDiGetDeviceRegistryProperty function retrieves a specified Plug and Play device property.

public WinReg.HKEY

Returns:

If the function is successful, it returns a handle to an opened registry key where private configuration data about this device instance can be stored/retrieved.

If the function fails, it returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

SetupDiOpenDevRegKey
(WinNT.HANDLE
A handle to the device information set that contains a device information element that represents the device for which to open a registry key.
deviceInfoSet
,
SetupApi.SP_DEVINFO_DATA
A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet.
deviceInfoData
,
int
he scope of the registry key to open. The scope determines where the information is stored. The scope can be global or specific to a hardware profile. The scope is specified by one of the following values:
  • DICS_FLAG_GLOBAL Open a key to store global configuration information. This information is not specific to a particular hardware profile. This opens a key that is rooted at HKEY_LOCAL_MACHINE. The exact key opened depends on the value of the KeyType parameter.
  • DICS_FLAG_CONFIGSPECIFIC Open a key to store hardware profile-specific configuration information. This key is rooted at one of the hardware-profile specific branches, instead of HKEY_LOCAL_MACHINE. The exact key opened depends on the value of the KeyType parameter.
scope
,
int
A hardware profile value, which is set as follows:
  • If Scope is set to DICS_FLAG_CONFIGSPECIFIC, HwProfile specifies the hardware profile of the key that is to be opened.
  • If HwProfile is 0, the key for the current hardware profile is opened.
  • If Scope is DICS_FLAG_GLOBAL, HwProfile is ignored.
hwProfile
,
int
The type of registry storage key to open, which can be one of the following values:
  • DIREG_DEV Open a hardware key for the device.
  • DIREG_DRV Open a software key for the device. For more information about a device's hardware and software keys, see Registry Trees and Keys for Devices and Drivers.
keyType
,
int
The registry security access that is required for the requested key. For information about registry security access values of type REGSAM, see the Microsoft Windows SDK documentation.
samDesired
)

The SetupDiOpenDevRegKey function opens a registry key for device-specific configuration information.

Field Detail

CM_DEVCAP_REMOVABLEback to summary
public static final int CM_DEVCAP_REMOVABLE

Removable.

DICS_FLAG_CONFIGGENERALback to summary
public static final int DICS_FLAG_CONFIGGENERAL

1 or more hardware profile-specific changes to follow.

DICS_FLAG_CONFIGSPECIFICback to summary
public static final int DICS_FLAG_CONFIGSPECIFIC

make change in specified profile only

DICS_FLAG_GLOBALback to summary
public static final int DICS_FLAG_GLOBAL

make change in all hardware profiles

DIGCF_ALLCLASSESback to summary
public static final int DIGCF_ALLCLASSES

Return a list of installed devices for all device setup classes or all device interface classes.

DIGCF_DEFAULTback to summary
public static final int DIGCF_DEFAULT

Return only the device that is associated with the system default device interface, if one is set, for the specified device interface classes.

DIGCF_DEVICEINTERFACEback to summary
public static final int DIGCF_DEVICEINTERFACE

Return devices that support device interfaces for the specified device interface classes. This flag must be set in the Flags parameter if the Enumerator parameter specifies a device instance ID.

DIGCF_PRESENTback to summary
public static final int DIGCF_PRESENT

Return only devices that are currently present in a system.

DIGCF_PROFILEback to summary
public static final int DIGCF_PROFILE

Return only devices that are a part of the current hardware profile.

DIREG_BOTHback to summary
public static final int DIREG_BOTH

Delete both driver and Device key

See Also
SetupDiOpenDevRegKey
DIREG_DEVback to summary
public static final int DIREG_DEV

Open/Create/Delete device key.

See Also
SetupDiOpenDevRegKey
DIREG_DRVback to summary
public static final int DIREG_DRV

Open/Create/Delete driver key

See Also
SetupDiOpenDevRegKey
GUID_DEVINTERFACE_COMPORTback to summary
public static final Guid.GUID GUID_DEVINTERFACE_COMPORT

Drivers for serial ports register instances of this device interface class to notify the operating system and applications of the presence of COM ports.

GUID_DEVINTERFACE_DISKback to summary
public static final Guid.GUID GUID_DEVINTERFACE_DISK

The GUID_DEVINTERFACE_DISK device interface class is defined for hard disk storage devices.

INSTANCEback to summary
public static final SetupApi INSTANCE
SPDRP_DEVICEDESCback to summary
public static final int SPDRP_DEVICEDESC

DeviceDesc (R/W)

Device registry property codes (Codes marked as read-only (R) may only be used for SetupDiGetDeviceRegistryProperty)

These values should cover the same set of registry properties as defined by the CM_DRP codes in cfgmgr32.h.

SPDRP_REMOVAL_POLICYback to summary
public static final int SPDRP_REMOVAL_POLICY

(Windows XP and later) The function retrieves the device's current removal policy as a DWORD that contains one of the CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h.

Method Detail

SetupDiDestroyDeviceInfoListback to summary
public boolean SetupDiDestroyDeviceInfoList(WinNT.HANDLE hDevInfo)

The SetupDiDestroyDeviceInfoList function deletes a device information set and frees all associated memory.

Parameters
hDevInfo:WinNT.HANDLE

A handle to the device information set to delete.

Returns:boolean

The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.

SetupDiEnumDeviceInfoback to summary
public boolean SetupDiEnumDeviceInfo(WinNT.HANDLE deviceInfoSet, int memberIndex, SetupApi.SP_DEVINFO_DATA deviceInfoData)

The SetupDiEnumDeviceInfo function returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set.

Remarks
Repeated calls to this function return a device information element for a different device. This function can be called repeatedly to get information about all devices in the device information set.

To enumerate device information elements, an installer should initially call SetupDiEnumDeviceInfo with the MemberIndex parameter set to 0. The installer should then increment MemberIndex and call SetupDiEnumDeviceInfo until there are no more values (the function fails and a call to GetLastError returns ERROR_NO_MORE_ITEMS).

Call SetupDiEnumDeviceInterfaces to get a context structure for a device interface element (versus a device information element).

Parameters
deviceInfoSet:WinNT.HANDLE

A handle to the device information set for which to return an SP_DEVINFO_DATA structure that represents a device information element.

memberIndex:int

A zero-based index of the device information element to retrieve.

deviceInfoData:SetupApi.SP_DEVINFO_DATA

A pointer to an SP_DEVINFO_DATA structure to receive information about an enumerated device information element.

Returns:boolean

The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.

SetupDiEnumDeviceInterfacesback to summary
public boolean SetupDiEnumDeviceInterfaces(WinNT.HANDLE hDevInfo, Pointer devInfo, Guid.GUID interfaceClassGuid, int memberIndex, SetupApi.SP_DEVICE_INTERFACE_DATA deviceInterfaceData)

The SetupDiEnumDeviceInterfaces function enumerates the device interfaces that are contained in a device information set.

Parameters
hDevInfo:WinNT.HANDLE

A pointer to a device information set that contains the device interfaces for which to return information. This handle is typically returned by SetupDiGetClassDevs.

devInfo:Pointer

A pointer to an SP_DEVINFO_DATA structure that specifies a device information element in DeviceInfoSet. This parameter is optional and can be NULL. If this parameter is specified, SetupDiEnumDeviceInterfaces constrains the enumeration to the interfaces that are supported by the specified device. If this parameter is NULL, repeated calls to SetupDiEnumDeviceInterfaces return information about the interfaces that are associated with all the device information elements in DeviceInfoSet. This pointer is typically returned by SetupDiEnumDeviceInfo.

interfaceClassGuid:Guid.GUID

A pointer to a GUID that specifies the device interface class for the requested interface.

memberIndex:int

A zero-based index into the list of interfaces in the device information set. The caller should call this function first with MemberIndex set to zero to obtain the first interface. Then, repeatedly increment MemberIndex and retrieve an interface until this function fails and GetLastError returns ERROR_NO_MORE_ITEMS. If DeviceInfoData specifies a particular device, the MemberIndex is relative to only the interfaces exposed by that device.

deviceInterfaceData:SetupApi.SP_DEVICE_INTERFACE_DATA

A pointer to a caller-allocated buffer that contains, on successful return, a completed SP_DEVICE_INTERFACE_DATA structure that identifies an interface that meets the search parameters. The caller must set DeviceInterfaceData.cbSize to sizeof(SP_DEVICE_INTERFACE_DATA) before calling this function.

Returns:boolean

SetupDiEnumDeviceInterfaces returns TRUE if the function completed without error. If the function completed with an error, FALSE is returned and the error code for the failure can be retrieved by calling GetLastError.

SetupDiGetClassDevsback to summary
public WinNT.HANDLE SetupDiGetClassDevs(Guid.GUID classGuid, Pointer enumerator, Pointer hwndParent, int flags)

The SetupDiGetClassDevs function returns a handle to a device information set that contains requested device information elements for a local computer.

Parameters
classGuid:Guid.GUID

A pointer to the GUID for a device setup class or a device interface class. This pointer is optional and can be NULL. For more information about how to set ClassGuid, see the following Remarks section.

enumerator:Pointer

A pointer to a NULL-terminated string that specifies: An identifier (ID) of a Plug and Play (PnP) enumerator. This ID can either be the value's globally unique identifier (GUID) or symbolic name. For example, "PCI" can be used to specify the PCI PnP value. Other examples of symbolic names for PnP values include "USB," "PCMCIA," and "SCSI". A PnP device instance ID. When specifying a PnP device instance ID, DIGCF_DEVICEINTERFACE must be set in the Flags parameter. This pointer is optional and can be NULL. If an enumeration value is not used to select devices, set Enumerator to NULL.

hwndParent:Pointer

A handle to the top-level window to be used for a user interface that is associated with installing a device instance in the device information set. This handle is optional and can be NULL.

flags:int

A variable of type DWORD that specifies control options that filter the device information elements that are added to the device information set.

Returns:WinNT.HANDLE

If the operation succeeds, SetupDiGetClassDevs returns a handle to a device information set that contains all installed devices that matched the supplied parameters. If the operation fails, the function returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

SetupDiGetDeviceInterfaceDetailback to summary
public boolean SetupDiGetDeviceInterfaceDetail(WinNT.HANDLE hDevInfo, SetupApi.SP_DEVICE_INTERFACE_DATA deviceInterfaceData, Pointer deviceInterfaceDetailData, int deviceInterfaceDetailDataSize, IntByReference requiredSize, SetupApi.SP_DEVINFO_DATA deviceInfoData)

The SetupDiGetDeviceInterfaceDetail function returns details about a device interface.

Parameters
hDevInfo:WinNT.HANDLE

A pointer to the device information set that contains the interface for which to retrieve details. This handle is typically returned by SetupDiGetClassDevs.

deviceInterfaceData:SetupApi.SP_DEVICE_INTERFACE_DATA

A pointer to an SP_DEVICE_INTERFACE_DATA structure that specifies the interface in DeviceInfoSet for which to retrieve details. A pointer of this type is typically returned by SetupDiEnumDeviceInterfaces.

deviceInterfaceDetailData:Pointer

A pointer to an SP_DEVICE_INTERFACE_DETAIL_DATA structure to receive information about the specified interface. This parameter is optional and can be NULL. This parameter must be NULL if DeviceInterfaceDetailSize is zero. If this parameter is specified, the caller must set DeviceInterfaceDetailData.cbSize to sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA) before calling this function. The cbSize member always contains the size of the fixed part of the data structure, not a size reflecting the variable-length string at the end.

deviceInterfaceDetailDataSize:int

The size of the DeviceInterfaceDetailData buffer. The buffer must be at least (offsetof(SP_DEVICE_INTERFACE_DETAIL_DATA, DevicePath) + sizeof(TCHAR)) bytes, to contain the fixed part of the structure and a single NULL to terminate an empty MULTI_SZ string. This parameter must be zero if DeviceInterfaceDetailData is NULL.

requiredSize:IntByReference

A pointer to a variable of type DWORD that receives the required size of the DeviceInterfaceDetailData buffer. This size includes the size of the fixed part of the structure plus the number of bytes required for the variable-length device path string. This parameter is optional and can be NULL.

deviceInfoData:SetupApi.SP_DEVINFO_DATA

A pointer to a buffer that receives information about the device that supports the requested interface. The caller must set DeviceInfoData.cbSize to sizeof(SP_DEVINFO_DATA). This parameter is optional and can be NULL.

Returns:boolean

SetupDiGetDeviceInterfaceDetail returns TRUE if the function completed without error. If the function completed with an error, FALSE is returned and the error code for the failure can be retrieved by calling GetLastError.

SetupDiGetDeviceRegistryPropertyback to summary
public boolean SetupDiGetDeviceRegistryProperty(WinNT.HANDLE DeviceInfoSet, SetupApi.SP_DEVINFO_DATA DeviceInfoData, int Property, IntByReference PropertyRegDataType, Pointer PropertyBuffer, int PropertyBufferSize, IntByReference RequiredSize)

The SetupDiGetDeviceRegistryProperty function retrieves a specified Plug and Play device property.

Parameters
DeviceInfoSet:WinNT.HANDLE

A handle to a device information set that contains a device information element that represents the device for which to retrieve a Plug and Play property.

DeviceInfoData:SetupApi.SP_DEVINFO_DATA

A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet.

Property:int

Specifies the property to be retrieved.

PropertyRegDataType:IntByReference

A pointer to a variable that receives the data type of the property that is being retrieved. This is one of the standard registry data types. This parameter is optional and can be NULL.

PropertyBuffer:Pointer

A pointer to a buffer that receives the property that is being retrieved. If this parameter is set to NULL, and PropertyBufferSize is also set to zero, the function returns the required size for the buffer in RequiredSize.

PropertyBufferSize:int

The size, in bytes, of the PropertyBuffer buffer.

RequiredSize:IntByReference

A pointer to a variable of type DWORD that receives the required size, in bytes, of the PropertyBuffer buffer that is required to hold the data for the requested property. This parameter is optional and can be NULL.

Returns:boolean

SetupDiGetDeviceRegistryProperty returns TRUE if the call was successful. Otherwise, it returns FALSE and the logged error can be retrieved by making a call to GetLastError. SetupDiGetDeviceRegistryProperty returns the ERROR_INVALID_DATA error code if the requested property does not exist for a device or if the property data is not valid.

SetupDiOpenDevRegKeyback to summary
public WinReg.HKEY SetupDiOpenDevRegKey(WinNT.HANDLE deviceInfoSet, SetupApi.SP_DEVINFO_DATA deviceInfoData, int scope, int hwProfile, int keyType, int samDesired)

The SetupDiOpenDevRegKey function opens a registry key for device-specific configuration information.

Depending on the value that is passed in the samDesired parameter, it might be necessary for the caller of this function to be a member of the Administrators group.

Close the handle returned from this function by calling RegCloseKey.

The specified device instance must be registered before this function is called. However, be aware that the operating system automatically registers PnP device instances. For information about how to register non-PnP device instances, see SetupDiRegisterDeviceInfo.

Parameters
deviceInfoSet:WinNT.HANDLE

A handle to the device information set that contains a device information element that represents the device for which to open a registry key.

deviceInfoData:SetupApi.SP_DEVINFO_DATA

A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet.

scope:int

he scope of the registry key to open. The scope determines where the information is stored. The scope can be global or specific to a hardware profile. The scope is specified by one of the following values:

  • DICS_FLAG_GLOBAL Open a key to store global configuration information. This information is not specific to a particular hardware profile. This opens a key that is rooted at HKEY_LOCAL_MACHINE. The exact key opened depends on the value of the KeyType parameter.
  • DICS_FLAG_CONFIGSPECIFIC Open a key to store hardware profile-specific configuration information. This key is rooted at one of the hardware-profile specific branches, instead of HKEY_LOCAL_MACHINE. The exact key opened depends on the value of the KeyType parameter.
hwProfile:int

A hardware profile value, which is set as follows:

  • If Scope is set to DICS_FLAG_CONFIGSPECIFIC, HwProfile specifies the hardware profile of the key that is to be opened.
  • If HwProfile is 0, the key for the current hardware profile is opened.
  • If Scope is DICS_FLAG_GLOBAL, HwProfile is ignored.
keyType:int

The type of registry storage key to open, which can be one of the following values:

  • DIREG_DEV Open a hardware key for the device.
  • DIREG_DRV Open a software key for the device. For more information about a device's hardware and software keys, see Registry Trees and Keys for Devices and Drivers.
samDesired:int

The registry security access that is required for the requested key. For information about registry security access values of type REGSAM, see the Microsoft Windows SDK documentation.

Returns:WinReg.HKEY

If the function is successful, it returns a handle to an opened registry key where private configuration data about this device instance can be stored/retrieved.

If the function fails, it returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

com.sun.jna.platform.win32 back to summary

public Class SetupApi.SP_DEVICE_INTERFACE_DATA

extends Structure
Class Inheritance
Annotations
@FieldOrder:cbSize, InterfaceClassGuid, Flags, Reserved

An SP_DEVICE_INTERFACE_DATA structure defines a device interface in a device information set.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public int
cbSize

The size, in bytes, of the SP_DEVICE_INTERFACE_DATA structure.

public int
Flags

Can be one or more of the following: SPINT_ACTIVE - The interface is active (enabled).

public Guid.GUID
InterfaceClassGuid

The GUID for the class to which the device interface belongs.

public Pointer
Reserved

Reserved.

Inherited from com.sun.jna.Structure:
ALIGN_DEFAULTALIGN_GNUCALIGN_MSVCALIGN_NONECALCULATE_SIZE

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Inherited from com.sun.jna.Structure:
allocateMemoryallocateMemoryautoAllocateautoReadautoReadautoWriteautoWritecacheTypeInfocalculateSizeclearcreateFieldsOrdercreateFieldsOrdercreateFieldsOrdercreateFieldsOrderdataEqualsdataEqualsensureAllocatedequalsfieldOffsetgetAutoReadgetAutoWritegetFieldListgetFieldOrdergetFieldsgetNativeAlignmentgetNativeSizegetNativeSizegetPointergetStringEncodinggetStructAlignmenthashCodenewInstancenewInstancereadreadFieldreadFieldsetAlignTypesetAutoReadsetAutoSynchsetAutoWritesetStringEncodingsizesortFieldstoArraytoArraytoStringtoStringuseMemoryuseMemorywritewriteFieldwriteFieldwriteField

Field Detail

cbSizeback to summary
public int cbSize

The size, in bytes, of the SP_DEVICE_INTERFACE_DATA structure.

Flagsback to summary
public int Flags

Can be one or more of the following: SPINT_ACTIVE - The interface is active (enabled). SPINT_DEFAULT - The interface is the default interface for the device class. SPINT_REMOVED - The interface is removed.

InterfaceClassGuidback to summary
public Guid.GUID InterfaceClassGuid

The GUID for the class to which the device interface belongs.

Reservedback to summary
public Pointer Reserved

Reserved. Do not use.

Constructor Detail

SP_DEVICE_INTERFACE_DATAback to summary
public SP_DEVICE_INTERFACE_DATA()
SP_DEVICE_INTERFACE_DATAback to summary
public SP_DEVICE_INTERFACE_DATA(Pointer memory)
com.sun.jna.platform.win32 back to summary

public Class SetupApi.SP_DEVICE_INTERFACE_DATA.ByReference

extends SP_DEVINFO_DATA
implements ByReference
Class Inheritance
All Implemented Interfaces
com.sun.jna.Structure.ByReference

Constructor Summary

AccessConstructor and Description
public
public

Constructor Detail

ByReferenceback to summary
public ByReference()
ByReferenceback to summary
public ByReference(Pointer memory)
com.sun.jna.platform.win32 back to summary

public Class SetupApi.SP_DEVINFO_DATA

extends Structure
Class Inheritance
Known Direct Subclasses
com.sun.jna.platform.win32.SetupApi.SP_DEVINFO_DATA.ByReference, com.sun.jna.platform.win32.SetupApi.SP_DEVICE_INTERFACE_DATA.ByReference
Annotations
@FieldOrder:cbSize, InterfaceClassGuid, DevInst, Reserved

An SP_DEVINFO_DATA structure defines a device instance that is a member of a device information set.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public int
cbSize

The size, in bytes, of the SP_DEVINFO_DATA structure.

public int
DevInst

An opaque handle to the device instance (also known as a handle to the devnode).

public Guid.GUID
InterfaceClassGuid

The GUID of the device's setup class.

public Pointer
Reserved

Reserved.

Inherited from com.sun.jna.Structure:
ALIGN_DEFAULTALIGN_GNUCALIGN_MSVCALIGN_NONECALCULATE_SIZE

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Inherited from com.sun.jna.Structure:
allocateMemoryallocateMemoryautoAllocateautoReadautoReadautoWriteautoWritecacheTypeInfocalculateSizeclearcreateFieldsOrdercreateFieldsOrdercreateFieldsOrdercreateFieldsOrderdataEqualsdataEqualsensureAllocatedequalsfieldOffsetgetAutoReadgetAutoWritegetFieldListgetFieldOrdergetFieldsgetNativeAlignmentgetNativeSizegetNativeSizegetPointergetStringEncodinggetStructAlignmenthashCodenewInstancenewInstancereadreadFieldreadFieldsetAlignTypesetAutoReadsetAutoSynchsetAutoWritesetStringEncodingsizesortFieldstoArraytoArraytoStringtoStringuseMemoryuseMemorywritewriteFieldwriteFieldwriteField

Field Detail

cbSizeback to summary
public int cbSize

The size, in bytes, of the SP_DEVINFO_DATA structure.

DevInstback to summary
public int DevInst

An opaque handle to the device instance (also known as a handle to the devnode). Some functions, such as SetupDiXxx functions, take the whole SP_DEVINFO_DATA structure as input to identify a device in a device information set. Other functions, such as CM_Xxx functions like CM_Get_DevNode_Status, take this DevInst handle as input.

InterfaceClassGuidback to summary
public Guid.GUID InterfaceClassGuid

The GUID of the device's setup class.

Reservedback to summary
public Pointer Reserved

Reserved. For internal use only.

Constructor Detail

SP_DEVINFO_DATAback to summary
public SP_DEVINFO_DATA()
SP_DEVINFO_DATAback to summary
public SP_DEVINFO_DATA(Pointer memory)
com.sun.jna.platform.win32 back to summary

public Class SetupApi.SP_DEVINFO_DATA.ByReference

extends SP_DEVINFO_DATA
implements ByReference
Class Inheritance
All Implemented Interfaces
com.sun.jna.Structure.ByReference

Constructor Summary

AccessConstructor and Description
public
public

Constructor Detail

ByReferenceback to summary
public ByReference()
ByReferenceback to summary
public ByReference(Pointer memory)