如何获取AHCI base address <二>
来源:互联网 发布:在数组中添加元素 编辑:程序博客网 时间:2024/05/17 06:58
我之前有篇文章有些利用第三方工具包来获取AHCI base address,这次我要讲的是利用WinRing0这个开源dll来完成这个功能。
请看WinRing0API的说明:
Support Functions for PCI Access C++ (OlsDef.h) *Macro// Bus Number, Device Number and Function Number to PCI Device Address#define PciBusDevFunc(Bus, Dev, Func) ((Bus&0xFF)<<8) | ((Dev&0x1F)<<3) | (Func&7)// PCI Device Address to Bus Number#define PciGetBus(address) ((address>>8) & 0xFF)// PCI Device Address to Device Number#define PciGetDev(address) ((address>>3) & 0x1F)// PCI Device Address to Function Number#define PciGetFunc(address) (address&7)C# (OpenLibSys.cs) // Bus Number, Device Number and Function Number to PCI Device Addresspublic uint PciBusDevFunc(uint bus, uint dev, uint func){ return ((bus&0xFF)<<8) | ((dev&0x1F)<<3) | (func&7);}// PCI Device Address to Bus Numberpublic uint PciGetBus(uint address){ return ((address>>8) & 0xFF);}// PCI Device Address to Device Numberpublic uint PciGetDev(uint address){ return ((address>>3) & 0x1F);}// PCI Device Address to Function Numberpublic uint PciGetFunc(uint address){ return (address&7);}PCI Device Addressbit description 0- 2 Function Number 3- 7 Device Number 8-15 PCI Bus Number 16-31 Reserved RequirementsWinRing0 1.0 or later
啦啦啦 看到了吧 我们可以用OpenLibSys.cs中现成的
PciBusDevFunc(uint bus, uint dev, uint func)
方法,就可以得到AHCI base address啦!有木有很激动?!附上调用的代码
/**getAHCIbaseAddress**/ public string getAHCIbaseAddress() { uint address = ols.PciBusDevFunc(0x00, 0x1F, 0x02); //add by kelsey string ahciBaseAddress = ""; // Host Bridge if (address != 0xFFFFFFFF) { for (int i = 0; i < 256; i += 16) { //str += i.ToString("X2") + "|"; for (int j = 0; j < 16; j++) { if (i == 32 && j == 4) { ahciBaseAddress = (ols.ReadPciConfigDword(address, (byte)(i + j))).ToString("X2"); break; } } } Console.WriteLine("ahciBaseAddress ==" + ahciBaseAddress); } return ahciBaseAddress; }
- 如何获取AHCI base address <二>
- 如何获取AHCI base address?
- 如何查看主板的base address
- 英语名词解释:Base.Address
- WinCE dll base address
- PCI中的base address
- address method 和 rate如何获取
- PCI 中的base address register
- win7系统如何开启AHCI
- AHCI
- AHCI
- CS8900 base address的确定方法
- CS8900 base address的确定方法
- CS8900 base address的确定方法
- PCI 中的base address register(转)
- 昭阳 E49 XP系统如何开启AHCI
- cve2012-1876 leak mshtml base address and leak shellcode base address
- iOS 获取Mac Address
- 开源中国iOS客户端学习——(四)GCDiscreetNotificationView提示视图
- Android AsyncTask源码解析
- 企业应用:一个够用的、通用的状态机(管理实体的业务状态)
- android -- notification使用(转)
- 开源中国iOS客户端学习——(五)网络通信ASI类库(1)
- 如何获取AHCI base address <二>
- 恢复数据使用记录
- c++ error: 'malloc' was not declared in this scope
- 最简单关闭软键盘的方法——只需要一行代码,关闭无限个输入视图
- fatal error LNK1123:转换到 COFF 期间失败: 文件无效或损坏
- 网络版 捕鱼设计思路
- 开源中国iOS客户端学习——(六)网络连接检测
- android ScrollView ListView的回弹效果
- 如何从技术走向管理?