Page 1 of 1

Read PCI Device Vendor ID

Posted: Thu Apr 11, 2019 7:30 am
by joechen882000
I try to use InpOut32 to read the PCI Vendor ID but can't get correct data throught inpOut32.dll
My code please refer below(C#) , Read the RTC Port is ok , But Read/Write the PCI config register get nothing ....

uint Bus_No = 0, Dev = 0, Func1 = 0, VID, DID, count = 0;
uint Val = 0x80000000 + (Bus_No << 16) + (Dev << 11) + ( Func1 << 8 ) ;
uint Rt_Val;
if (IsInpOutDriverOpen_x64() == 1)
{
/* Read PCI Register */
DlPortWritePortUlong_x64(0x0cf8, Val);
Rt_Val = DlPortReadPortUlong_x64(0x0cfc);
Console.WriteLine(Rt_Val.ToString("x")); /* Get 0 */

/* Read RTC Time */
Out32_x64(0x70, 0x00);
uint sec = Inp32_x64(0x71);
Out32_x64(0x70, 0x02);
uint min = Inp32_x64(0x71);
Out32_x64(0x70, 0x04);
uint hour = Inp32_x64(0x71);

Console.WriteLine(hour.ToString("x")+":"+min.ToString("x")+":"+sec.ToString("x"));
}

====Test environment=====
Windows 7 X64 / Win10 X64
Visual Studio Community 2017
My Own Program is 64bit .

====Program exec result===
80000000
0 ->Should read 0x16048086
14:32:23



Thanks you..

Re: Read PCI Device Vendor ID

Posted: Thu Apr 11, 2019 9:31 am
by phil
I think there is a bug in the Read/Write ULong code in the driver. There was some discussion about it here several years ago
It cant be fixed by me (as I no longer am able to sign drivers).

InpOut32 is stale now, it hasn't had any work done on it since I was no longer able to sign the drivers - there is no point.
If someone is able to sign drivers, they would be welcome to take on the code (its all there) and update it, hopefully fixing the bugs. But there is very little need/use of this type of driver these days so I expect it will just fizzle out. Much like the original author of InpOut32 who seems to have just disappeared.

Re: Read PCI Device Vendor ID

Posted: Fri Apr 12, 2019 2:40 am
by joechen882000
Get it ! thank your quick reply !