ver 1.0.0.5
支持win7,但需要管理员权限
可在启动a代码文件(例如main.aardio)首行加上以下代码启用管理权限
//RUNAS//
dll.api("Cpuid","bool(INT index,INT &eax,INT &ebx,INT &ecx,INT &edx)");
dll.api("CpuidPx","bool(INT index,INT &eax,INT &ebx,INT &ecx,INT &edx,INT processAffinityMask)");
dll.api("CpuidTx","bool(INT index,INT &eax,INT &ebx,INT &ecx,INT &edx,INT threadAffinityMask)");
卸载驱动,库卸载时会自动调用该函数。
dll.api("FindPciDeviceByClass","INT( BYTE baseClass, BYTE subClass, BYTE programIf, BYTE index )");
dll.api("FindPciDeviceById","INT( WORD vendorId, WORD deviceId, BYTE index )");
返回DLL状态码,以_OLS_DLL_前缀的常量表示不同状态,
0/*_OLS_DLL_NO_ERROR*/表示加载驱动成功
返回版本号,返回四个值:
version,major,minor,revision,release
返回驱动类型,
OLS_DRIVER_TYPE_前缀常量表示不同类型
返回驱动版本号,返回四个值:
version,major,minor,revision,release
dll.api("Hlt","bool()");
dll.api("HltPx","bool(INT processAffinityMask)");
dll.api("HltTx","bool(INT threadAffinityMask)");
加载驱动,成功返回true
导入库时会自动调用该函数
dll.api("IsCpuid","bool()");
dll.api("IsMsr","bool()");
dll.api("IsTsc","bool()");
function(Bus, Dev, Func){
return (Bus&0xFF)<<8) | ((Dev&0x1F)<<3) | (Func&7);
}
function(address){
return ((address>>8) & 0xFF)
}
function(address){
return ((address>>3) & 0x1F)
}
function(address){
return (address&7)
}
dll.api("Rdmsr","bool(INT index,INT &eax,INT &edx )");
dll.api("RdmsrPx","bool(INT index,INT & eax,INT & edx, INT processAffinityMask)");
dll.api("RdmsrTx","bool(INT index,INT & eax,INT & edx, INT threadAffinityMask)");
dll.api("Rdpmc","bool(INT index,INT & eax,INT &edx )");
dll.api("RdpmcPx","bool(INT index,INT & eax,INT &edx,INT processAffinityMask)");
dll.api("RdpmcTx","bool(INT index,INT & eax,INT &edx,INT threadAffinityMask)");
dll.api("Rdtsc","bool(INT &eax,INT &edx )");
dll.api("RdtscPx","bool(INT &eax,INT & edx,INT processAffinityMask)");
dll.api("RdtscTx","bool(INT &eax,INT &edx,INT threadAffinityMask)");
dll.api("ReadIoPortByte","BYTE( WORD port )");
dll.api("ReadIoPortByteEx","int( WORD port, BYTE& value )");
dll.api("ReadIoPortDword","INT( WORD port )");
dll.api("ReadIoPortDwordEx","int( WORD port, INT value )");
dll.api("ReadIoPortWord","WORD( WORD port )");
dll.api("ReadIoPortWordEx","int( WORD port, WORD& value )");
dll.api("ReadPciConfigByte","BYTE(INT pciAddress, BYTE regAddress )");
dll.api("ReadPciConfigByteEx","int(INT pciAddress, INT regAddress, BYTE& value )");
dll.api("ReadPciConfigDword","INT(INT pciAddress, BYTE regAddress )");
dll.api("ReadPciConfigDwordEx","int(INT pciAddress, INT regAddress, INT value )");
dll.api("ReadPciConfigWord","WORD(INT pciAddress, BYTE regAddress )");
dll.api("ReadPciConfigWordEx","int(INT pciAddress, INT regAddress, WORD& value )");
dll.api("SetPciMaxBusIndex","void( BYTE max )");
dll.api("WriteIoPortByte","void( WORD port, BYTE value )");
dll.api("WriteIoPortByteEx","int( WORD port, BYTE value )");
dll.api("WriteIoPortDword","void( WORD port, INT value )");
dll.api("WriteIoPortDwordEx","int( WORD port, INT value )");
dll.api("WriteIoPortWord","void( WORD port, WORD value )");
dll.api("WriteIoPortWordEx","int( WORD port, WORD value )");
dll.api("WritePciConfigByte","void(INT pciAddress, BYTE regAddress, BYTE value )");
dll.api("WritePciConfigByteEx","int(INT pciAddress, INT regAddress, BYTE value )");
dll.api("WritePciConfigDword","void(INT pciAddress, BYTE regAddress, INT value )");
dll.api("WritePciConfigDwordEx","int(INT pciAddress, INT regAddress, INT value )");
dll.api("WritePciConfigWord","void(INT pciAddress, BYTE regAddress, WORD value )");
dll.api("WritePciConfigWordEx","int(INT pciAddress, INT regAddress, WORD value )");
dll.api("Wrmsr","bool(INT index, INT eax, INT edx )");
dll.api("WrmsrPx","bool(INT index, INT eax, INT edx,INT processAffinityMask)");
dll.api("WrmsrTx","bool(INT index, INT eax, INT edx,INT threadAffinityMask)");
_OLS_DLL_DRIVER_NOT_FOUND=3
_OLS_DLL_DRIVER_NOT_LOADED=2
_OLS_DLL_DRIVER_NOT_LOADED_ON_NETWORK=5
_OLS_DLL_DRIVER_UNLOADED=4
_OLS_DLL_NO_ERROR=0
_OLS_DLL_UNKNOWN_ERROR=9
_OLS_DLL_UNSUPPORTED_PLATFORM=1
_OLS_DRIVER_TYPE_UNKNOWN=0
_OLS_DRIVER_TYPE_WIN_9X=1
_OLS_DRIVER_TYPE_WIN_NT=2
_OLS_DRIVER_TYPE_WIN_NT4=3
_OLS_DRIVER_TYPE_WIN_NT_IA64=5
_OLS_DRIVER_TYPE_WIN_NT_X64=4
_OLS_ERROR_PCI_BUS_NOT_EXIST=0xE0000001
_OLS_ERROR_PCI_NO_DEVICE=0xE0000002
_OLS_ERROR_PCI_READ_CONFIG=0xE0000004
_OLS_ERROR_PCI_WRITE_CONFIG=0xE0000003