Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing the PCI config space with Win32 API

Given the address of a PCI device (i.e. bus, device, function), how can one programatically read, using Win32 API calls in userspace, the config space (e.g. vendor ID, device ID) for that device?

On Linux, one openes the /sys/bus/pci/devices//config file and reads from the right offset.

like image 656
Mircea Avatar asked Oct 18 '22 12:10

Mircea


1 Answers

You can use the SetupDiGetClassDevs API to traverse a list of devices. If you pass PCI in the Enumerator parameter, you can enumerate only PCI devices.

like image 75
kerem Avatar answered Oct 29 '22 17:10

kerem