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
0
votes
0 answers

Obtaining the Location paths attribute of usb device using the device instance path

I am currently working on a C# program that is responsible for monitoring COM ports. In case of an error condition, the connected device should be restarted. For this purpose, all relevant devices are connected to the computer using a programmable…
SourceC0de
  • 31
  • 7
0
votes
0 answers

WinAPI: Cannot (re)install a device

I have this C++ WinAPI program. If we assume that the following source code is compiled into devctrl.exe, running devctrl.exe uninstalls the device with GUID class If, however, it is run as devctrl.exe --install…
coderodde
  • 1,269
  • 4
  • 17
  • 34
0
votes
1 answer

A Windows program cannot obtain a SP_DEVINFO_DATA for a device

Now I have this non-working (minimum?) example: #pragma comment (lib, "Setupapi.lib") #pragma comment (lib, "newdev.lib") #include #include #include #include int main() { GUID guid; HRESULT…
coderodde
  • 1,269
  • 4
  • 17
  • 34
0
votes
0 answers

How to get the guidDeviceInterface via VID/PID?

I am trying to understand a WinUsb Microsoft example. There is next code: int _tmain(int argc, _TCHAR* argv[]) { GUID guidDeviceInterface = OSR_DEVICE_INTERFACE; //in the INF file HANDLE hDeviceHandle = INVALID_HANDLE_VALUE; …
Arseniy
  • 266
  • 2
  • 14
0
votes
0 answers

What is config manager services and how to install it inside a Windows Container? (setupapi 0xe0000223)

I am trying to install a virtual device driver package inside a Windows Container based on windows/server:ltsc2022. It looks like the driver installer tool uses setupapi. The installation fails inside the container, and I found these messages in…
LOST
  • 2,956
  • 3
  • 25
  • 40
0
votes
0 answers

DeviceIoControl (kernel32.lib)

Inspired by balena.io's drivelist, I create a Rust version. The idea is simple, using Windows' Setup API to read all connected storages list (with mount points/drive letters), using winapi crate ///file main.rs use core::{slice, ffi}; use…
ir1keren
  • 37
  • 9
0
votes
1 answer

Should I use SetupApi or CfgMgr32 in 2022?

I have a lot of experience with libusb, libudev, and SetupAPI for writing Windows drivers, but it's totally unclear to me what CfgMgr32 offers over SetupAPI for Windows USB applications. Microsoft outlines how one would port from SetupAPI to…
Charles Lohr
  • 695
  • 1
  • 8
  • 23
0
votes
1 answer

How to tell digital camera from other devices using WPD and using Setup API

I've got 2 tasks: a) distinguish digital cameras from other MTP-devices, obtained by IPortableDeviceManager::GetDeviceList; b) I want to find connected digital cameras with Setup API. My thought was to get all USB devices…
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
0
votes
0 answers

Using cfgmgr32 to get device ids/instances that support a given interface class

I'm trying to port code from SetupAPI to cfgmgr32, since Microsoft now recommends this, and I do the following query: SetupDiGetClassDevsExA(&GUID_DEVINTERFACE_COMPORT, nullptr, nullptr, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE, nullptr, nullptr,…
KitsuneSan
  • 39
  • 3
0
votes
1 answer

Installing a driver for a specific device

I would like to install a custom driver for a specific device in my machine programmatically: The driver comes as an .inf file (with some other files as well). The device is one of two identical network adapters in my computer. As far as I know…
Boris
  • 8,551
  • 25
  • 67
  • 120
0
votes
0 answers

How do I get the DeviceName ("\\.\DISPLAY1") that corresponds to a PNPDeviceID ("SWD\MyEnumerator\MyInstance")?

To manage display adapters and display properties, my code uses APIs from two different Windows DLLs: CfgMgr32.dll I use functions in CfgMgr32 (successor to SetupApi) to: enumerate adapters (get ids & properties) determine whether a specific…
Scott Smith
  • 3,900
  • 2
  • 31
  • 63
0
votes
1 answer

Getting the USB Device Descriptor in C# without libusb?

I want to read the Device Descriptor of a USB Serial port (not just the VID/PID -- mainly so I can get the bcdDevice, iProduct, and iManufacturer) so I can know if the USB serial port is capable of what I want it to do (we have a couple of modems in…
0
votes
0 answers

How to get from Serial Port to Bluetooth device and unpair it

I am using WMI to query for serial ports which are connected via bluetooth, I get management object with the following properties: Property[Caption] = null Property[ClassGuid] = {4d36e978-e325-11ce-bfc1-08002be10318} Property[CompatID] =…
Myar
  • 112
  • 10
0
votes
1 answer

How to get a consistent deive list via Setup API?

A word in before: Much of text and code follows, but I try to explain my problem (which occurs randomly) as much detailed as possible: My application, which is dealing with the network interfaces via thet Setup API, fails randomly, most likely when…
Willy K.
  • 397
  • 2
  • 14
0
votes
2 answers

How to disable “allow the computer to turn off this device to save power” using C++?

I my C++ application, I need to disable this option for the hubs that I can find in "Device Manager/Universal Serial Bus controllers". I have iterated in these hubs using SetupDiEnumDeviceInfo and SetupDiGetDeviceInstanceId, but after that I don't…
Bruno
  • 139
  • 1
  • 8