Class SetupApiFFM
java.lang.Object
oshi.ffm.ForeignFunctions
oshi.ffm.windows.WindowsForeignFunctions
oshi.ffm.windows.SetupApiFFM
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final StructLayoutSP_DEVICE_INTERFACE_DATA: cbSize (DWORD) + InterfaceClassGuid (GUID=16 bytes) + Flags (DWORD) + Reserved (ULONG_PTR=8 bytes on 64-bit)static final longstatic final intSP_DEVINFO_DATA: cbSize(4) + ClassGuid(16) + DevInst(4) + Reserved(8 on x64) = 32 bytes.Fields inherited from class ForeignFunctions
CAPTURE_CALL_STATE, CAPTURED_STATE_LAYOUT, ERRNO_HANDLE, LIBRARY_ARENA, LINKER, NATIVE_LONG_SIZE, NATIVE_POINTER_SIZE, NATIVE_SIZE_T_SIZE, SYMBOL_LOOKUP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OptionalIntSetupDiDestroyDeviceInfoList(MemorySegment hDevInfo) static booleanSetupDiEnumDeviceInfo(MemorySegment hDevInfo, int memberIndex, MemorySegment devInfoData) Enumerates device info elements in a device info set.static intSetupDiEnumDeviceInterfaces(MemorySegment hDevInfo, MemorySegment classGuid, int memberIndex, MemorySegment deviceInterfaceData) static Optional<MemorySegment> SetupDiGetClassDevs(MemorySegment classGuid, int flags) SetupDiGetDeviceInterfaceDetail(MemorySegment hDevInfo, MemorySegment deviceInterfaceData, int requiredSize, Arena arena) Second call with allocated buffer to get device path.static intSetupDiGetDeviceInterfaceDetailSize(MemorySegment hDevInfo, MemorySegment deviceInterfaceData, Arena arena) First call with null detail buffer to get required size.static MemorySegmentSetupDiOpenDevRegKey(MemorySegment hDevInfo, MemorySegment devInfoData, int scope, int hwProfile, int keyType, int samDesired) Opens a registry key for device-specific configuration information.Methods inherited from class WindowsForeignFunctions
checkSuccess, isSuccess, readAnsiString, readWideString, setupTokenPrivileges, toWideStringMethods inherited from class ForeignFunctions
downcall, getByteArrayFromNativePointer, getErrno, getStringFromNativePointer, getStructFromNativePointer, lib, libraryLookup
-
Field Details
-
SP_DEVICE_INTERFACE_DATA
SP_DEVICE_INTERFACE_DATA: cbSize (DWORD) + InterfaceClassGuid (GUID=16 bytes) + Flags (DWORD) + Reserved (ULONG_PTR=8 bytes on 64-bit) -
DIGCF_PRESENT
public static final int DIGCF_PRESENT- See Also:
-
DIGCF_DEVICEINTERFACE
public static final int DIGCF_DEVICEINTERFACE- See Also:
-
SP_DEVINFO_DATA_SIZE
public static final int SP_DEVINFO_DATA_SIZESP_DEVINFO_DATA: cbSize(4) + ClassGuid(16) + DevInst(4) + Reserved(8 on x64) = 32 bytes.- See Also:
-
SP_DEVINFO_DATA_DEVINST_OFFSET
public static final long SP_DEVINFO_DATA_DEVINST_OFFSET- See Also:
-
DICS_FLAG_GLOBAL
public static final int DICS_FLAG_GLOBAL- See Also:
-
DIREG_DEV
public static final int DIREG_DEV- See Also:
-
-
Constructor Details
-
SetupApiFFM
public SetupApiFFM()
-
-
Method Details
-
SetupDiGetClassDevs
-
SetupDiEnumDeviceInterfaces
public static int SetupDiEnumDeviceInterfaces(MemorySegment hDevInfo, MemorySegment classGuid, int memberIndex, MemorySegment deviceInterfaceData) - Parameters:
hDevInfo- the device info set handleclassGuid- the interface class GUIDmemberIndex- zero-based index of the interface to retrievedeviceInterfaceData- receives information about the device interface- Returns:
- 0 if no more items, 1 if success, -1 on other error
-
SetupDiGetDeviceInterfaceDetailSize
public static int SetupDiGetDeviceInterfaceDetailSize(MemorySegment hDevInfo, MemorySegment deviceInterfaceData, Arena arena) First call with null detail buffer to get required size.- Parameters:
hDevInfo- the device info set handledeviceInterfaceData- the device interface dataarena- the arena to allocate the size buffer from- Returns:
- required buffer size, or 0 on unexpected error
-
SetupDiGetDeviceInterfaceDetail
public static Optional<String> SetupDiGetDeviceInterfaceDetail(MemorySegment hDevInfo, MemorySegment deviceInterfaceData, int requiredSize, Arena arena) Second call with allocated buffer to get device path. The detail buffer layout is: cbSize (DWORD=4) + DevicePath (WCHAR[]). On 64-bit, cbSize field value must be 8; on 32-bit it is 5 or 6.- Parameters:
hDevInfo- the device info set handledeviceInterfaceData- the device interface datarequiredSize- the buffer size returned bySetupDiGetDeviceInterfaceDetailSize(MemorySegment, MemorySegment, Arena)arena- the arena to allocate buffers from- Returns:
- the device path string, or empty if failed
-
SetupDiDestroyDeviceInfoList
-
SetupDiEnumDeviceInfo
public static boolean SetupDiEnumDeviceInfo(MemorySegment hDevInfo, int memberIndex, MemorySegment devInfoData) Enumerates device info elements in a device info set.- Parameters:
hDevInfo- the device info set handlememberIndex- zero-based indexdevInfoData- receives the device info data (must be pre-allocated with cbSize set)- Returns:
- true if successful, false if no more items or error
-
SetupDiOpenDevRegKey
public static MemorySegment SetupDiOpenDevRegKey(MemorySegment hDevInfo, MemorySegment devInfoData, int scope, int hwProfile, int keyType, int samDesired) Opens a registry key for device-specific configuration information.- Parameters:
hDevInfo- the device info set handledevInfoData- the device info datascope- DICS_FLAG_GLOBAL or DICS_FLAG_CONFIGSPECIFIChwProfile- hardware profile (0 for current)keyType- DIREG_DEV or DIREG_DRVsamDesired- registry access mask (e.g. KEY_QUERY_VALUE)- Returns:
- registry key handle, or null if failed
-