Class SetupApiFFM


public final class SetupApiFFM extends WindowsForeignFunctions
  • Field Details

    • SP_DEVICE_INTERFACE_DATA

      public static final StructLayout 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

      public static Optional<MemorySegment> SetupDiGetClassDevs(MemorySegment classGuid, int flags)
    • SetupDiEnumDeviceInterfaces

      public static int SetupDiEnumDeviceInterfaces(MemorySegment hDevInfo, MemorySegment classGuid, int memberIndex, MemorySegment deviceInterfaceData)
      Parameters:
      hDevInfo - the device info set handle
      classGuid - the interface class GUID
      memberIndex - zero-based index of the interface to retrieve
      deviceInterfaceData - 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 handle
      deviceInterfaceData - the device interface data
      arena - 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 handle
      deviceInterfaceData - the device interface data
      requiredSize - the buffer size returned by SetupDiGetDeviceInterfaceDetailSize(MemorySegment, MemorySegment, Arena)
      arena - the arena to allocate buffers from
      Returns:
      the device path string, or empty if failed
    • SetupDiDestroyDeviceInfoList

      public static OptionalInt SetupDiDestroyDeviceInfoList(MemorySegment hDevInfo)