1.下载USBDeview.exe,获取hid设备的vid,pid。
2. 利用vid,pid在注册表查找hid设备的符号链接
3. 符号链接即为SymbolicLink的值,但拷到程序中前面的路径需改为,否则CreateFile会返回失败.下面是我做过的获取密码键盘psam卡号关键的一段代码,其中getpsamno_data中的报告内容是由Bus Hound截获的:
HANDLE hDev=CreateFile(",
OPEN_EXISTING,0,NULL);
if(hDev==INVALID_HANDLE_VALUE)
{
DWORD nret=GetLastError();
MessageBox("CreateFile Fail!",NULL,MB_ICONERROR);
exit(1);
}
char getpsamno_data[128]=
{
0x02,0x04 ,0x1b, 0x4c,0x03, 0x54 ,0xad, 0xba ,0x0d, 0xf0 ,0xad, 0xba ,
0x0d,0xf0 ,0xad ,0xba, 0x0d ,0xf0 ,0xad ,0xba ,0x0d, 0xf0 ,0xad ,0xba ,
0x0d ,0xf0, 0xad ,0xba,0x0d, 0xf0 ,0xad ,0xba ,0x0d ,0xf0 ,0xad ,0xba, 0x0d ,0xf0 ,
0xad ,0xba ,0x0d ,0xf0 ,0xad ,0xba, 0x0d ,0xf0 ,0xad, 0xba, 0x0d, 0xf0 ,
0xad ,0xba ,0x0d ,0xf0 ,0xad ,0xba , 0x0d ,0xf0, 0xad, 0xba, 0x0d
};
DWORD wlen,rlen;
char rbuf[128]={0};
WriteFile(hDev,getpsamno_data,strlen(getpsamno_data),&wlen,NULL);
ReadFile(hDev,rbuf,strlen(getpsamno_data),&rlen,NULL);