简体   繁体   English

Windows-使用内核驱动程序直接写入视频显示吗?

[英]Windows - Write to the video display directly using kernel driver?

I am in the process of writing a windows 7 kernel driver. 我正在编写Windows 7内核驱动程序。 Today, I want to have it output debug information via the display. 今天,我想让它通过显示器输出调试信息。 Now I know that I can just use the DbgPrint or the KdPrint functions, but I want to output my string or anything, directly to my monitor. 现在,我知道我可以只使用DbgPrint或KdPrint函数,但是我想将字符串或任何东西直接输出到监视器。 This way, I don't have to fire up Debug View to see my output. 这样,我不必启动调试视图即可查看我的输出。 This also serves as an educational exercise. 这也可以用作教育活动。

As I understand it, I will have to access the frame buffer for the display and write my values to it, correct? 据我了解,我将不得不访问显示的帧缓冲区并将其值写入其中,对吗? However, I have no clue how to do this. 但是,我不知道如何执行此操作。 Basically, I want to be able to write something onto the monitor directly, thus it would overlap anything that windows is displaying. 基本上,我希望能够直接在监视器上写一些东西,因此它将与Windows正在显示的内容重叠。 I know this might sound weird, but its just for fun. 我知道这听起来很奇怪,但这只是为了好玩。

The main goal is to do this from a KERNEL DRIVER. 主要目标是从内核驱动程序执行此操作。 Not inside a userland process. 不在用户层进程内。 Note that I am only wanting to use a 640x480 resolution. 请注意,我只想使用640x480的分辨率。 Not anything higher. 没有什么更高的了。 If I understand correctly, anything higher than this would require me to write my own display driver for my current video card. 如果我理解正确,那么超出此范围的任何内容都将要求我为当前的视频卡编写自己的显示驱动程序。

My system setup: Windows 7 SP1 x86 Intel Pentium 4 @ 3.00Ghz Nvidia GeForce FX 5200 我的系统设置:Windows 7 SP1 x86 Intel Pentium 4 @ 3.00Ghz Nvidia GeForce FX 5200

Thanks for all of you help in advance! 谢谢大家的帮助!

Now I know that I can just use the DbgPrint or the KdPrint functions, but I want to output my string or anything, directly to my monitor. 现在,我知道我可以只使用DbgPrint或KdPrint函数,但是我想将字符串或任何东西直接输出到监视器。

You'll have to go through the display driver. 您将必须通过显示驱动程序。 Who says that your computer running windows has a monitor at all? 谁说您运行Windows的计算机根本没有显示器?

Even if it has, there won't be a MSDOS-style single framebuffer in RAM that stores your current picture. 即使有,RAM中也不会有MSDOS样式的单个帧缓冲区来存储您的当前图片。 Modern GPUs just don't work that way any more – instead, operating systems ask them to compose the whole screen of single buffers they hand over for compositing – in simplification: Every window is its own framebuffer, and it's the GPU's job to compose everything to a whole screen picture. 现代GPU不再那样工作了-操作系统要求它们将它们交出的单个缓冲区的整个屏幕组成,以进行简化-简化:每个窗口都是自己的帧缓冲区,并且GPU负责组成所有内容到全屏图片。

You also can't just write to some memory region from your kernel driver just because you like to do so – a) you don't know where that would be and b) you'd compete with other components, and that would be a bad thing. 您也不能仅仅因为您喜欢这样做而从内核驱动程序中写入某些内存区域– a)您不知道那在哪里,b)您将与其他组件竞争,那将是坏事。

EDIT I feel like I should add this for posteriority: 编辑我觉得我应该为此添加后缀:

the point is very simple: write a driver that is a driver and not a user interface. 重点很简单:编写一个驱动程序,该驱动程序是驱动程序而不是用户界面。 That's not the job of a driver. 那不是司机的工作。 Putting UI functionality into a driver is a bad idea for many reasons, and you simply shouldn't do it. 由于许多原因,将UI功能放入驱动程序是一个坏主意,而您根本不应该这样做。

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

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