1ee7d8384SMartin MaresSince 2.1.99-test5, pciutils should also be compilable on Windows. Thanks 2ee7d8384SMartin Maresto Alexander Stock for contributing the port. 3c0eece92SMartin Mares 409156b3bSMartin MaresUpdated after version 2.2.6 to compile again, and with MinGW, even (only?) 509156b3bSMartin Marescross-compiling. (Hopefully it works with MSVC too.) 609156b3bSMartin Mares 7*b8773677SPali RohárFor simple listing PCI devices in system via win32-cfgmgr32 access method 8*b8773677SPali Rohárwhich provides only basic information and emulated config space, there is no 9353f4109SPali Rohárspecial requirement. To list PCI resources on Windows 8 and higher versions, 10353f4109SPali Rohárit is necessary to have architecture-native version (e.g. AMD64 version on 11353f4109SPali RohárAMD64 systems). 12353f4109SPali Rohár 13*b8773677SPali RohárFor config space access there are different windows specific access methods: 14*b8773677SPali Rohár- win32-kldbg - Kernel Local Debugging Driver kldbgdrv.sys 15*b8773677SPali Rohár- win32-sysdbg - NT SysDbg interface 16*b8773677SPali Rohár- intel-conf1 - Direct hardware access via Intel configuration mechanism 1 17*b8773677SPali Rohár 18*b8773677SPali RohárThe default access method is win32-cfgmgr32 and by default it tries to use 19*b8773677SPali Rohárone of the above config access access method to provide as much as possible 20*b8773677SPali Rohárinformation to application. More details about particular access method and 21*b8773677SPali Rohárcaveats are described in the pcilib(8) manual page. 22*b8773677SPali Rohár 23*b8773677SPali RohárTo access config space via intel-conf1 access method on NT-based systems via 24*b8773677SPali RohárNT ProcessUserModeIOPL system call, it is required to have SeTcbPrivilege 25b8fbb6f0SPali Rohár(Act as part of the operating system privilege), which can be enabled in User 26b8fbb6f0SPali RohárAccounts settings (take effect after next login). By default this privilege is 27b8fbb6f0SPali Rohárnot enabled for any non-system user. Or alternatively it is required to be in 28b8fbb6f0SPali Rohárlocal Administrators group and on Windows 2000 SP4 or higher systems to have 29b8fbb6f0SPali RohárSeImpersonatePrivilege (Impersonate a client after authentication privilege) 30b8fbb6f0SPali Rohárwhich is by default enabled for all local Administrators accounts. There is no 31353f4109SPali Rohárspecial requirement for DOS-based systems. 64-bit systems do not have to allow 32353f4109SPali Rohárusers to access config space even with SeTcbPrivilege. 33b5847329SMartin Mares 3463435b6eSPali RohárTo compile this port, run following command: 3563435b6eSPali Rohár 3642e6a803SMartin Mares make CROSS_COMPILE=i586-mingw32msvc- HOST=i586-windows ZLIB=no IDSDIR="" 3763435b6eSPali Rohár 38353f4109SPali RohárTo build 64-bit version, run: 39353f4109SPali Rohár 40353f4109SPali Rohár make CROSS_COMPILE=x86_64-w64-mingw32- HOST=x86_64-windows ZLIB=no IDSDIR="" 41353f4109SPali Rohár 4263435b6eSPali RohárSometimes compilation may fail due to broken or missing getopt implementation. 4363435b6eSPali RohárIn this case try to compile with additional make option: COMPAT_GETOPT=yes 4463435b6eSPali Rohár 45*b8773677SPali RohárBuilding of shared DLL library libpci3.dll is supported too but needs to be 46*b8773677SPali Rohármanually enabled by make option: SHARED=yes 47*b8773677SPali Rohár 48*b8773677SPali RohárThis DLL library libpci3.dll has versioned symbols with stable ordinal numbers 49*b8773677SPali Rohárwhich provides backward and forward compatibility. Every symbol in DLL library 50*b8773677SPali Rohárhas '@LIBPCI_3.<version>' suffix to achieve it. For linking application to 51*b8773677SPali Rohárlibpci3.dll it is possible to generate import library from libpci3.def file. 52*b8773677SPali RohárSuch import library will provide import symbol names without versioned suffix 53*b8773677SPali Roháras an alias for the latest symbol version, which matches function name in pci.h 54*b8773677SPali Rohárheader file. The alias is resolved by the linker at linking time, so the final 55*b8773677SPali Rohárapplication binary would always reference only versioned symbol. DLL library 56*b8773677SPali Rohárlibpci3.dll does not provide unversioned symbols, so for using GetProcAddress() 57*b8773677SPali Roháror dlsym() it is needed to specify full versioned symbol name. 58