Display driver check

Hello everyone, I just started to learn how to write drivers and I don’t fully understand how do I check the drivers … I want to see the examples provided by MS and I don’t understand what to check so I hope someone could help me with some guide lines , sorry if this question is off-topic but this is the only “live” forum deals with drivers…
In general : what I’m trying to do is to print pictures/change color of the screen from the kernel mode so I’ll be happy to hear any advice about how to do it right…
Thank you all and have a nice day :slight_smile:

xxxxx@gmail.com wrote:

Hello everyone, I just started to learn how to write drivers and I don’t fully understand how do I check the drivers … I want to see the examples provided by MS and I don’t understand what to check so I hope someone could help me with some guide lines , sorry if this question is off-topic but this is the only “live” forum deals with drivers…
In general : what I’m trying to do is to print pictures/change color of the screen from the kernel mode so I’ll be happy to hear any advice about how to do it right…

There is no way to do that right. The concept of “user interface” is a
user-mode concept, not a kernel-mode concept. You don’t have easy
access to the desktop from the kernel.

What’s your overall goal here? You can certainly launch a helper
application to handle the UI tasks for you.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

My overall goal is to draw/print pixels on the monitor without being application. I wanna to be able to communicate directly with the GPU and display things on the monitor - For example, draw a blue rectangle in the middle of the screen without any nessecery application.

xxxxx@gmail.com wrote:

My overall goal is to draw/print pixels on the monitor without being application. I wanna to be able to communicate directly with the GPU and display things on the monitor - For example, draw a blue rectangle in the middle of the screen without any nessecery application.

Nope. You can’t do that, at least not in any supportable and
maintainable way. You will need user-mode help.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

If you wish to take over a monitor from Windows are draw your image on it this might be possible. If you want to interleave your blue rectangle with ordinary Windows drawing, then you are out of luck. This is of course possible by hammering or random memory, but in terms of a solution that works in general, this is way out of bounds

Sent from Mailhttps: for Windows 10

From: xxxxx@gmail.commailto:xxxxx
Sent: May 9, 2017 1:32 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Display driver check

My overall goal is to draw/print pixels on the monitor without being application. I wanna to be able to communicate directly with the GPU and display things on the monitor - For example, draw a blue rectangle in the middle of the screen without any nessecery application.


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></mailto:xxxxx></mailto:xxxxx></https:>

So when you say here is that I can’t go to the register which holds the next screen and change their values so things I want will show on the screen ?
If I can’t, can you please say what can I change in the screen in term so colors and pixels changing without application - For example, lets say the next screen is what you see now ( I mean the forum ) and by changing things I’ll draw a black line in the middle of the screen.

I found that : https://www.youtube.com/watch?v=Tfh0ytz8S0k.
Look at 6:00 you’ll see that he draw a Pacman over all elements of the screen and if you look bit earlier you’ll see that he done it but writing values to the memory.
But, that is “out-dated” I’m looking for more “dated”/modern implementation of the same result.

Nice jurassic video.
Exactly the same things can be done today with a modern contemporary Windows DirectX application. This DirectX application can run in both “Windowed Mode” or in “Full Screen Mode”.

What a DirectX application can NEVER do in any standard, documented and maintainable way:
Modify screen content of OTHER applications or even Windows itself.

One of the many reasons is shown at 0:30 “The video chip back then didn’t have its own bank of memory, so it had to share with the CPU”. Nowadays graphics adapters DO have own dedicated PCI on-board video memory (at least AMD and NVidia do). This on-board video memory can directly display to the screen. It might reside in a segment which is not even CPU-visible. It is extremely difficult to access by any software (other than the GPU vendor’s display driver itself).

Marcel Ruedinger
datronicsoft

But doesn’t embedded video cards like Intel graphics share their memory with the CPU ? And I can’t DirectX or OpenGL because as you said, it’s limited to only their application.

If limited to Intel GPU only, then the frame buffer can be accessed more easily, indeed.
Still the Intel WDDM display driver would need to be hacked to find out where the frame buffer is located, what is its resolution pitch, etc.

Such a “solution” would still be very hard to implement reliably and maintain because:

  • Frame buffer can change location in memory and size at any point time.
    (e.g. resolution change, sleep/wake, and many more occasions)
  • Framebuffer of Intel GPUs is tiled/swizzled in memory.
  • Next update of Intel driver can break existing “solution”.
    Just to name a few of the problems one would encounter with such a “solution”…

Why not use a very simple user mode application implementing “Transparent Window” and “Always on Top” Windows features. That sounds much more like a real solution to me…

Marcel Ruedinger
datronicsoft

OK first of all really than you for helping me!
Secondly, I’m limited to Intel GPU ( sorry I didn’t said that before… ).
I can’t use “Transparent Window” and “Always on Top” application because that will block all the other apps - I mean that lets say I’m on facebook and then the app started, although it’s transparent I couldn’t be able to keep surfing in Facebook and click on things because the top window is the app ( if the app on full screen ). But, if I could write to the GPU then I could keep surfing but there is always be something ( lets say black line ) that I *see* on the screen but the line don’t hurt my surfing experience - except for the fact that there is black line in the screen.
About your “solution” can you instruct me what I need to do in order to accomplish what I just described to you?

This is a Windows driver development forum.
I don’t want to pollute it with beginner level Windows application programming instructions.
Just one hint: Use Windows Task Manager and select the menu “Always on Top”.
Then you can still see Windows Task Manager and input into the Window below.

Marcel Ruedinger
datronicsoft

By saying “solution” I didn’t mean to the DirectX solution …
I meant to instructions for your first solution which I write to the memory of the embedded GPU.

AlwaysOnTop != HasFocus

* Bob

? Bob Ammerman
? xxxxx@ramsystems.biz
716.864.8337

138 Liston St
Buffalo, NY 14223
www.ramsystems.biz

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-631079-
xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, May 10, 2017 7:03 AM
To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] Display driver check
>
> OK first of all really than you for helping me!
> Secondly, I’m limited to Intel GPU ( sorry I didn’t said that before… ).
> I can’t use “Transparent Window” and “Always on Top” application because
> that will block all the other apps - I mean that lets say I’m on facebook and
> then the app started, although it’s transparent I couldn’t be able to keep
> surfing in Facebook and click on things because the top window is the app ( if
> the app on full screen ). But, if I could write to the GPU then I could keep
> surfing but there is always be something ( lets say black line ) that I see on
> the screen but the line don’t hurt my surfing experience - except for the fact
> that there is black line in the screen.
> About your “solution” can you instruct me what I need to do in order to
> accomplish what I just described to you?
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at:
> http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at
> http:</http:></http:></http:>

what?

xxxxx@gmail.com wrote:

Secondly, I’m limited to Intel GPU ( sorry I didn’t said that before… ).
I can’t use “Transparent Window” and “Always on Top” application because that will block all the other apps - I mean that lets say I’m on facebook and then the app started, although it’s transparent I couldn’t be able to keep surfing in Facebook and click on things because the top window is the app ( if the app on full screen ).

Wrong. As Bob tried to tell you, just because your window is topmost in
the Z order does not mean you have the focus. Clicks and keyboard
entries can still go to your browser.

However, you do not actually have to BE the topmost window to draw on
the desktop:
HDC * dc = GetDC(GetDesktopWindow());

That gives you a DC to draw on the desktop. You don’t even need a
window at all. You can compile and run this complete command-line
application to prove that:

#include <atlbase.h>
#pragma comment( lib, “gdi32.lib” )

int main()
{
HDC dc = GetDC( GetDesktopWindow() );
SetDCBrushColor( dc, RGB(255,0,0) );
SelectObject( dc, GetStockObject(DC_BRUSH) );
Rectangle( dc, 200, 200, 400, 400 );
}

> But doesn’t embedded video cards like Intel graphics share their memory with the CPU ?

Possibly, but but there’s no way to find that memory in kernel mode, and
even if you found it, the memory doesn’t belong to you. It belongs to
another driver. It might be in a format you don’t know, especially if
the foreground app has taken control.

> But, if I could write to the GPU then I could keep surfing but there is always be something ( lets say black line ) that I see on the screen but the line don’t hurt my surfing experience - except for the fact that there is black line in the screen.
> About your “solution” can you instruct me what I need to do in order to accomplish what I just described to you?

We are all absolutely clear on what you want to do. We’ve all told you
the facts – in modern Windows, it can’t be done in kernel mode. When
you don’t LIKE an answer. you don’t get a different answer by asking the
question again.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.</atlbase.h>

Well, you decided to delve into beginner level Windows application programming here. Subsequently the following questions arise immediately:
How would this approach synchronize with Desktop being redrawn by Windows?
Was this a good advice to solve the OP’s problem?

Marcel R?dinger
datronicsoft

On Wed, May 10, 2017 at 2:06 PM, wrote:
> Well, you decided to delve into beginner level Windows application programming here. Subsequently the following questions arise immediately:
> How would this approach synchronize with Desktop being redrawn by Windows?
> Was this a good advice to solve the OP’s problem?
>

This devolved into normal application programming because the list
either refused to or was unable to answer his original question. The
question he originally asked has an answer even if it is a bad idea. I
can think of a few valid reasons to want to control video memory
directly, or even a whole monitor, even if it’s just for the novelty
of it.

To the OP: If you actually want to pursue this you will probably need
to switch to Linux. Nobody here has any idea how to do what you asked
about. They gave you some guesses which are mostly right but there may
in fact be a way to do it by interfacing with the Windows display
driver that is above the drivers that talk to graphics cards. If you
start reading about the (modern!) Linux graphics system you will see
what I’m talking about.

Windows kernel architecture seems to mirror Linux kernel architecture
in more than a few places, which kind of implies something similar has
to exist. But discounting that it’s unlikely they don’t have some kind
of wrapper layer.

Also to the OP: If you want to interface with the graphics card, as a
graphics device, and display things to the screen, under Windows, you
should probably look at
https://www.khronos.org/opengl/wiki/Creating_an_OpenGL_Context_(WGL).
It would also be possible to use a cross platform library like SDL2 or
GLFW.

Okay, I really do apologize for the triple post, but I just remembered
some relevant information w.r.t. the original topic:

It’s possible to allocate framebuffers from an OpenGL device. These
framebuffers have no associated display. However, there is one
framebuffer, normally claimed by the OS, that is tied to the display
output. If you can claim this framebuffer and set it up then you
control the video output for the computer at the lowest level
possible.

In this case the “driver above the graphics card drivers” is kind of OpenGL.