将数据写入I/O地址
我有一个设备(现金抽屉),我想直接与该设备通信。我知道它在地址 f1 上。 openbit 也是 01。
据我所知,到目前为止,我需要将 1 发送到内存地址 f1,现金抽屉应该打开。虽然使用 asm,但我遇到了访问冲突。然后我又读到 Windows 不允许您直接与设备 I/O 地址通信(需要使用 win)。将数据发送到该地址的正确方法是什么? 请注意,我无法使用驱动程序,因为我无法与应用程序内的驱动程序通信。 操作。系统是win7。
提前致谢!
i have a device (cash drawer) and i would like to directly communicate with the device. I know that its on address f1. Also openbit is 01.
As i've understood so far, i'd need to send 1 to memory address f1 and the cash drawer should open. Though using asm, i get access violation. Then again i've read that windows does not let you communicate directly to device i/o addresses (need to use win). What would be the correct way to send the data to that address.
Note that i cannot use drivers, because i can't communicate with the driver inside my application.
Op. system is win7.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个名为 inpout32.dll 的库,允许直接端口访问,您可以在这里找到它
http:// /logix4u.net/Inpout32.dll_Discussion/write_DELPHI_for_inpout32.dll.html
但是我不知道是否支持windows 7。
There was a library called inpout32.dll that allowed direct port access you can find it here
http://logix4u.net/Inpout32.dll_Discussion/write_DELPHI_for_inpout32.dll.html
But i don't know if supports windows 7.
除了上面的优秀建议之外,请查看 这个用于编写和阅读的 Delphi 代码输入/输出。我们已经使用 GWIOPM 来完成您所要求的操作,但请注意,对于 32 位版本的 Windows 直至 W7 等都可以(大多数“免费”驱动程序都是如此)。对于 64 位 Windows,您需要签名的内核驱动程序。目前可用的东西很少。我们必须自己编写。
In addition to the excellent suggestions above, check out this delphi code for writing and reading I/O. We have used the GWIOPM to do what you are asking, but note that it will be ok for 32-bit versions of Windows up to W7 etc (as is the case for most 'free' drivers). For 64-bit Windows you need a signed kernel driver. For this there are few things available at the moment. We had to write our own.
为什么您无法通过应用程序与驱动程序通信?这是 Ring 3 应用程序以安全方式与硬件对话的最佳方式。
但是,如果您确实坚持使用驱动程序,您可以尝试拨打 0 并进行直接访问。这比以前的 Windows 版本(XP 及之前的版本)要困难得多,但这是可能的。我自己没有这样做,因为我没有 Windows 7,但你可以尝试在任何地方的 asm 编程论坛中提问。
Why can't you communicate with the driver from your application? It's the best way for ring 3 application to talk with hardware in a safe manner.
However, if you really insist using drivers, you can try going to ring 0 and do direct access. It's much harder than in previous Windows versions (XP and before) but it's possible. I haven't done it myself since I don't have Windows 7, but you can try asking in asm programming forum anywhere.