社区
硬件/系统
帖子详情
在WINDOWS下有什么办法可以读写任一个IO端口?
overflywing
2003-08-21 01:30:33
在WINDOWS下有什么办法可以读写任一个IO端口?除了写驱动外。
...全文
300
13
打赏
收藏
在WINDOWS下有什么办法可以读写任一个IO端口?
在WINDOWS下有什么办法可以读写任一个IO端口?除了写驱动外。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
13 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
kittycai
2003-08-27
打赏
举报
回复
还是自己写个简单的驱动吧
spbabyba
2003-08-27
打赏
举报
回复
下载 winio吧,里面有说明我原程序.
spbabyba
2003-08-27
打赏
举报
回复
下载winio吧,里面有使用说明.
ajn_sailing
2003-08-26
打赏
举报
回复
不是的,98下可以,2000下不行的。
利用winio好些
AthlonxpX86
2003-08-26
打赏
举报
回复
CreateFile();只能打开驱动程序,通过驱动程序倒是能访问端口,但是前提是有驱动
lygfqy
2003-08-26
打赏
举报
回复
赞成使用CreateFile();
AthlonxpX86
2003-08-26
打赏
举报
回复
楼上的兄弟,这些函数只能访问串口,不能读写端口
AthlonxpX86
2003-08-26
打赏
举报
回复
是
#include <conio.h>
int _inp( unsigned short port );
unsigned short _inpw( unsigned short port );
unsigned long _inpd( unsigned short port );
int _outp( unsigned short port, int databyte );
unsigned short _outpw( unsigned short port, unsigned short dataword );
unsigned long _outpd( unsigned short port, unsigned long dataword );
98可以
///////////////////////////////
正好说反了,2000下可以,98下不可以,
另外这个不是太好的方法,可能会出错并受到限制,MSDN上介绍好像着使用的是DOS虚拟机上的函数,只是访问的虚拟的物理端口,然后驱动程序把虚拟端口映射到物理端口,所以在98和2000下最好都用驱动的方法,winio是这样做的,98下写了VXD驱动来操作端口,2000下用#include <conio.h>
int _inp( unsigned short port );
unsigned short _inpw( unsigned short port );
unsigned long _inpd( unsigned short port );
int _outp( unsigned short port, int databyte );
unsigned short _outpw( unsigned short port, unsigned short dataword );
等来操作端口,所以建议98下面用winio,2000下自己写驱动吧,如果2000下的不会写,我这里有http://yds_086.html.533.net/
nicepose
2003-08-26
打赏
举报
回复
最好使用window的api这样什么版本的windows都可以用了
通用性强,资料和实例也多
------------------------------------------
看一下以下几个函数和结构吧
OVERLAPPED
COMMTIMEOUTS
DCB
CreateFile
ReadFile
WriteFile
ClearCommError
PurgeComm
GetOverlappedResult
GetCommState
SetCommState
SetCommTimeouts
CreateEvent
SetEvent
WaitForSingleObject
AthlonxpX86
2003-08-26
打赏
举报
回复
楼上不信去看看winio代码
#include <windows.h>
#include <winioctl.h>
#include <conio.h>
#include "port32.h"
#include "..\drv\nt\winio_nt.h"
#include "..\drv\9x\winio_9x.h"
#include "winio.h"
bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize)
{
tagPort32Struct Port32Struct;
DWORD dwBytesReturned;
if (!IsWinIoInitialized)
return false;
if (IsNT)//如果是winnt/2000/xp
{
switch (bSize)
{
case 1:
*pdwPortVal = _inp(wPortAddr);
break;
case 2:
*pdwPortVal = _inpw(wPortAddr);
break;
case 4:
*pdwPortVal = _inpd(wPortAddr);
break;
}
}
else//win9x
{
Port32Struct.bSize = bSize;
Port32Struct.wPortAddr = wPortAddr;
return DeviceIoControl(hDriver, WINIO_READPORT, &Port32Struct, sizeof(Port32Struct),
pdwPortVal, sizeof(DWORD), &dwBytesReturned, NULL);
}
return true;
}
在2000下的单布运行结果是调用了
switch (bSize)
{
case 1:
*pdwPortVal = _inp(wPortAddr);
break;
case 2:
*pdwPortVal = _inpw(wPortAddr);
break;
case 4:
*pdwPortVal = _inpd(wPortAddr);
break;
}
ndy_w
2003-08-22
打赏
举报
回复
用别人写好的驱动。google一下winio。
BSRONG
2003-08-21
打赏
举报
回复
是
#include <conio.h>
int _inp( unsigned short port );
unsigned short _inpw( unsigned short port );
unsigned long _inpd( unsigned short port );
int _outp( unsigned short port, int databyte );
unsigned short _outpw( unsigned short port, unsigned short dataword );
unsigned long _outpd( unsigned short port, unsigned long dataword );
98可以
balas
2003-08-21
打赏
举报
回复
98下可以,2000下不行。
_input();_output()
pyOpenLibSys,python
读写
Windows
硬件
端口
IO
,WinRing0x64 python 版本。
pyOpenLibSys,python
读写
Windows
硬件
端口
IO
。,WinRing0 Win
IO
python 版本。从服务加载WinRing0驱动。压缩文件包含: 1:py加载WingRing0的脚本代码 2:
一个
实例脚本代码,枚举本机PCI设备,读取PCI配置空间,读取硬盘ID相信。 3:驱动程序WingRingx32.sys WingRingx64.sys
linux字符驱动程序
读写
IO
端口
含makefile和测试程序
含驱动源码、makefile文件、测试程序源码、实现内容说明四部分 要写驱动程序
读写
IO
端口
的 可以参考下
驱动程序大作业-
Windows
XP下通用I/O
端口
读写
功能的WDM驱动程序
编写
一个
实现
Windows
XP下通用I/O
端口
读写
功能的WDM驱动程序及其应用层测试程序,该驱动程序的主要功能如下: 能够向指定的I/O
端口
写入
一个
或多个字节。 能够从指定的I/O
端口
读出
一个
或多个字节。 能够同时支持多个用户程序。 驱动程序大作业
在Delphi中使用Give
IO
.sys在
windows
上
读写
I/O
端口
演示用give
io
.sys来
读写
I/O
端口
,比如直接
读写
LPT
端口
数据等。在
windows
2000上可以运行,包括了全部源代码。用这个东东可以读出主板B
IO
S数据,用来加密程序。
CMOS 数据
读写
Windows
下进行底层
IO
操作之CMOS数据的读取和显示,在计算机系统中,对CMOS中数据的
读写
是通过两个I/O
端口
来实现的,其中,
端口
70H是
一个
字节的只写
端口
,用它来设置CMOS中的数据地址;而
端口
71H是用来
读写
端口
70H设置的CMOS地址中的数据单元字节内容。
硬件/系统
2,641
社区成员
17,239
社区内容
发帖
与我相关
我的任务
硬件/系统
VC/MFC 硬件/系统
复制链接
扫一扫
分享
社区描述
VC/MFC 硬件/系统
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章