Questions tagged [setupapi]

SetupAPI is a Win32API that is used for installing device drivers and in enumerating existing devices on a Windows computer.

SetupAPI is a Win32API that is used for installing device drivers and in enumerating existing devices on a Windows computer.

116 questions
3
votes
1 answer

How to get device interface GUID for a device?

I enumerate all the devices on a machine as follows: HDEVINFO hDevList = SetupDiGetClassDevs( NULL, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT | DIGCF_ALLCLASSES /*| DIGCF_PROFILE*/ ); for ( int i = 0; true; ++i ) { SP_DEVINFO_DATA…
Roman Khvostikov
  • 305
  • 3
  • 14
3
votes
2 answers

"SetupOpenInfFile" getting access violation error in Delphi2010

When using the following line code in Delphi 2010, a'm getting an "Access Violation" error, but the same code working fine in VC++. The Delphi 2010 code is var hMyInf : HINF; begin hMyInf := SetupOpenInfFile('.\\DIGIMHID.INF','Mouse',…
Able Alias
  • 3,824
  • 11
  • 58
  • 87
3
votes
0 answers

Enumerating interfaces in device info set obtained for a specific PnP enumerator

I'm trying to get device interfaces data via SetupDiEnumDeviceInterfaces() for all devices which correspond to a specific PnP enumerator. Consider the following example (for interface with index 0 only): #include #include…
gsnoff
  • 31
  • 1
3
votes
1 answer

Programmatically detect faulty or missing drivers

I am tasked with finding a way to detect a faulty or missing driver so that my program can then install a better one that will work with my system. Things I have been trying include using setupapi.dll to get values from the Registry and try to find…
3
votes
2 answers

Determine C# P/Invoke Structure Alignment at Runtime

I'm trying to write good P/Invoke signatures for some Windows setupapi calls, and I've encountered the following problem with the packing of setupapi's structures: // Excerpt from setupapi.h #if defined(_WIN64) #include // Assume…
DoomMuffins
  • 1,174
  • 1
  • 9
  • 19
3
votes
0 answers

How is the guidProduct field of DIDEVICEINSTANCE generated

How does DirectInput generate the GUID for the guidProduct field in DIDEVICEINSTANCE? The documentation reads: guidProduct Unique identifier for the product. This identifier is established by the manufacturer of the device. I am searching for a…
The Fiddler
  • 2,726
  • 22
  • 28
3
votes
2 answers

HID Device programming - Does it works with C++ (SETUPAPI.dll and HID.dll)

I'm kinda new in asking @Stackoverflow, however it's been the closest thing I have as a Bible (other than Ritchie's C book) specially in these days of final projects for most of my subjects. Anyway, my question is about the libraries needed for an…
hectorgr
  • 43
  • 1
  • 5
2
votes
0 answers

Struggling with debug asserts with mem alloc for SP_DEVICE_INTERFACE_DETAIL_DATA

I'm struggling with some debug asserts when my test program exits. The purpose is to get the device path to a disk drive through using the Setup API. This I'm doing. I'm following the rule described here for SetupDiGetDeviceInterfaceDetail i.e.…
Andrew Falanga
  • 2,274
  • 4
  • 26
  • 51
2
votes
0 answers

How to get "Last Arrival Date" of a USB device using setupapi/cfmgr apis

There is a property "Last Arrival Date" that is present for my USB device in the Device Manager UI. screenshot (device-manager/properties/details) How can I programmatically retrieve that value? I already have the corresponding handle (setupapi) and…
Jason L.
  • 41
  • 2
2
votes
0 answers

How to force a generic Microsoft driver programmatically (RNDIS) with setupapi DiInstallDevice if it fails with ERROR_INVALID_PARAMETER?

When I plug a USB RNDIS device (Linux gadget) to a Windows PC, is seen as 'RNDIS' device, without driver. To make it work I go to Device Manager, and manually select the Microsoft Generic Remote RNDIS Driver. My final goal was to force-install that…
StefanoV
  • 485
  • 1
  • 4
  • 9
2
votes
0 answers

Setting a breakpoint on Marshal.GetLastWin32Error() seems to be modifying the last error set?

I am using C# with .NET 4.6 in VS2019 on Win10 x64 1809. When using P/Invoke, setting a breakpoint on a "Marshal.GetLastWin32Error()" line seems to be modifying the last-set Win32 error code. For example: using…
Justin Shidell
  • 588
  • 1
  • 5
  • 16
2
votes
1 answer

Windows Driver : Install legacy hardware with command line tool

Operation System: Windows Server 2016 R2 I have a RAMDisk driver can be installed with "Add Legacy Hardware Wizard" (hdwwiz.exe) successfully. From the output of devcon hwids *, the device can be seen as below. ROOT\UNKNOWN\0000 Name: RAMDrive […
Mr.Wang from Next Door
  • 13,670
  • 12
  • 64
  • 97
2
votes
1 answer

Disabling USB keyboard after reboot

I used SetupDiSetClassInstallParams and SetupDiCallClassInstaller to disable specific USB device. SP_PROPCHANGE_PARAMS params; params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); params.ClassInstallHeader.InstallFunction =…
2
votes
2 answers

How to find all connected removable USB storage devices in Windows?

I'm writing a program that processes USB drives, to get information about connecting a new device, I signed up for a window message WM_DEVICECHANGE. But I, of course, do not receive messages about the devices that were connected before my program…
drem1lin
  • 331
  • 1
  • 3
  • 14
2
votes
1 answer

unresolved external symbol _DEVPKEY_Device_BusReportedDeviceDesc

For devices attached to my machine I want to retrieve device-property Bus Reported Device Description. For this purpose I use function SetupDiGetDeviceProperty of Setup API. In devpkey.h I found the defintion…
Aedvald Tseh
  • 1,757
  • 16
  • 31