简体   繁体   English

打开,读取和写入Windows内核中的串行端口

[英]Opening, reading, and writing to a serial port in the Windows kernel

I'm writing a Windows kernel driver in C and I need to send and receive data over a serial device, specifically COM3. 我正在用C编写Windows内核驱动程序,我需要通过串行设备发送和接收数据,特别是COM3。 I am stuck on the CreateFile, ReadFile, and WriteFile functions, as these seem to be user space functions that will not work in the kernel. 我被困在CreateFile,ReadFile和WriteFile函数上,因为它们似乎是在内核中不起作用的用户空间函数。 Am I mistaken? 我错了吗? Or if not, what is the best way to open and use a serial port from within the Windows kernel? 或者如果没有,在Windows内核中打开和使用串口的最佳方法是什么?

Many thanks. 非常感谢。

您需要ZwCreateFileZwReadFileZwWriteFile函数才能在内核模式下工作。

You are writing a driver then You must have to write kernel module for windows . 您正在编写驱动程序然后您必须为Windows编写内核模块。

check this 检查一下

http://www.codeproject.com/Articles/9504/Driver-Development-Part-1-Introduction-to-Drivers http://www.codeproject.com/Articles/9504/Driver-Development-Part-1-Introduction-to-Drivers

One more thing once you have finished the driver you need a application to test it. 完成驱动程序后,还需要一个应用程序来测试它。

so you need a user space application to test it. 所以你需要一个用户空间应用程序来测试它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM