ioperm - Windows下设置端口权限 (二)

2014-11-24 02:37:40 · 作者: · 浏览: 5
}
}
unsigned char inp( unsigned short addr)
{
unsigned char cha;
asm{
mov dx,addr
in al,dx
mov cha ,al
}
return cha;
}

#endif

int main( void )
{
int i;
unsigned char c;
install(0);
Sleep(500);
if (ioperm(0x70, 2, 1 )) {
fprintf( stderr, "Error: ioperm() failed. Please install ioperm.sys driver.\n" );
}else{
for (i=0; i<260; i++)
{
// Sleep(100);
outp(0x70, i);
c = inp(0x71);
printf("%02x ", c);
if ((i+1)%20 == 0)
printf("\n");
}
}
uninstall(0);
return 0;
}