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 StructLayoutSP_DEVICE_INTERFACE_DATA: cbSize (DWORD) + InterfaceClassGuid (GUID=16 bytes) + Flags (DWORD) + Reserved (ULONG_PTR=8 bytes on 64-bit)Fields inherited from class ForeignFunctions
CAPTURE_CALL_STATE, CAPTURED_STATE_LAYOUT, ERRNO_HANDLE, LIBRARY_ARENA, LINKER, SYMBOL_LOOKUP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OptionalIntSetupDiDestroyDeviceInfoList(MemorySegment hDevInfo) 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.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:
-
-
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
-