How to get graphic framebuffer address?

Hello everyone,

I’m trying to access my graphic framebuffer. Under Linux I found its
physical address which is 0xd0000000
I thought my framebuffer would be the same on vista. So I tried some things
to translate this physical address into a virtual one.
For exemple MmGetVirtualForPhysical(PHYSICAL_ADDRESS addr) returns me 0. And
it’s the same when I test MmAllocatePagesForMdl with this
physical address. So I fear my framebuffer is not at the same address under
windows.

What do you think I should do to find this framebuffer address?

Thanks…

Frédéric Weisbecker wrote:

I’m trying to access my graphic framebuffer. Under Linux I found its
physical address which is 0xd0000000
I thought my framebuffer would be the same on vista. So I tried some
things to translate this physical address into a virtual one.
For exemple MmGetVirtualForPhysical(PHYSICAL_ADDRESS addr) returns me
0. And it’s the same when I test MmAllocatePagesForMdl with this
physical address. So I fear my framebuffer is not at the same address
under windows.

What do you think I should do to find this framebuffer address?

If you are the graphics driver, then this information is being given to
your miniport driver at startup time.

If you are not the graphics driver, then you don’t have any business
accessing the physical frame buffer. You can use DirectX to get a
legitimate virtual pointer to the frame buffer.

By the way, Device Manager will show you the actual resources assigned
to any device.


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

In fact, I’m not the graphic driver. But I need to access the graphic buffer from kernel land. So I guess that I can’t use DirectX…
0xd0000000-0xdfffffff is given by the device manager as a memory range used by graphic device.

In Windows you cannot do this reliably without the risk of crashing the OS,
since the framebuffer belongs to video stack and not to you.

I would abandon this “amazing” (in fact, dirty hackery) idea and go with
the usual user-mode GDI or D3D APIs, probably by writing a helper user mode app
to the driver.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“Frédéric Weisbecker” wrote in message
news:xxxxx@ntdev…
> Hello everyone,
>
> I’m trying to access my graphic framebuffer. Under Linux I found its
> physical address which is 0xd0000000
> I thought my framebuffer would be the same on vista. So I tried some things
> to translate this physical address into a virtual one.
> For exemple MmGetVirtualForPhysical(PHYSICAL_ADDRESS addr) returns me 0. And
> it’s the same when I test MmAllocatePagesForMdl with this
> physical address. So I fear my framebuffer is not at the same address under
> windows.
>
> What do you think I should do to find this framebuffer address?
>
> Thanks…
>

xxxxx@gmail.com wrote:

In fact, I’m not the graphic driver. But I need to access the graphic buffer from kernel land.

Why? What are you planning to do?

So I guess that I can’t use DirectX…

There are kernel interfaces to DirectX.

0xd0000000-0xdfffffff is given by the device manager as a memory range used by graphic device.

Have you tried the usual MmMapIoSpace?


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

To explain you more exactly, my goal is to develop something like this:
http://home.comcast.net/~fbui/
…but under windows… The only way I found to do that was accessing directly frambuffer. But if you know another solution I would be very interested since I’m still a beginner in kernel side. The Softice GUI is an example of what I want to do. So I don’t really want to do that in user space because I need to freeze user and kernel threads when my GUI is in action. But of course I will not mask interrupts…

Why do you need a kernel GUI? the very need in this is strange for me.

SoftICE is a hack, which had known issues with particular graphics cards
for years (and was generally dependent on particular graphics card), and never
was the production stability product - it is a lab product, you cannot install
it on the production server.

It also produced known Heiseinbugs.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> To explain you more exactly, my goal is to develop something like this:
> http://home.comcast.net/~fbui/
> …but under windows… The only way I found to do that was accessing
directly frambuffer. But if you know another solution I would be very
interested since I’m still a beginner in kernel side. The Softice GUI is an
example of what I want to do. So I don’t really want to do that in user space
because I need to freeze user and kernel threads when my GUI is in action. But
of course I will not mask interrupts…
>

xxxxx@gmail.com wrote:

To explain you more exactly, my goal is to develop something like this:
http://home.comcast.net/~fbui/
…but under windows… The only way I found to do that was accessing directly frambuffer. But if you know another solution I would be very interested since I’m still a beginner in kernel side. The Softice GUI is an example of what I want to do. So I don’t really want to do that in user space because I need to freeze user and kernel threads when my GUI is in action. But of course I will not mask interrupts…

An fbui clone could be manufactured entirely in user-mode, by using
DirectDraw to fetch the address of the primary surface. That’s exactly
what SoftICE did.

Are you trying to reinvent all of SoftICE, including the kernel debugger
aspects? Good freakin’ luck.


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

wrote in message news:xxxxx@ntdev…
> To explain you more exactly, my goal is to develop something like this:
> http://home.comcast.net/~fbui/
> …but under windows… The only way I found to do that was accessing
> directly frambuffer. But if you know another solution I would be very
> interested since I’m still a beginner in kernel side. The Softice GUI is
> an example of what I want to do. So I don’t really want to do that in user
> space because I need to freeze user and kernel threads when my GUI is in
> action. But of course I will not mask interrupts…
>

So no freezing interrupts, but what will you do about DPC’s, timers, etc.
When your GUI is active you can still mess up the world, even if you could
get to frame buffer and use it reliably something that SoftICE did not do
(the reliable part, unless you mean reliably mess up many systems).


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

:slight_smile:
I’m not planning anything serious. I just want to learn how to program in kernel land, and how does work the internals on my computer.

MmMapIoSpace works for me. I succeded to draw a white line on my screen.
But do you think it is possible to draw a simple and resident window from kernel by using directX for example…

You are learning bad habits and practices, dump this approach now, and do
something useful or avoid the kernel since the rest of us don’t want the
crashes your code will cause.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> :slight_smile:
> I’m not planning anything serious. I just want to learn how to program in
> kernel land, and how does work the internals on my computer.
>
> MmMapIoSpace works for me. I succeded to draw a white line on my screen.
> But do you think it is possible to draw a simple and resident window from
> kernel by using directX for example…
>

xxxxx@gmail.com wrote:

:slight_smile:
I’m not planning anything serious. I just want to learn how to program in kernel land, and how does work the internals on my computer.

MmMapIoSpace works for me. I succeded to draw a white line on my screen.
But do you think it is possible to draw a simple and resident window from kernel by using directX for example…

I don’t know what you mean by “resident”. Windows believes with full
confidence that it owns the desktop. Anything you draw is unknown to
Windows, so it will be obliterated the next time something causes a refresh.

You can certainly do DirectDraw by using a small user-mode helper app.


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

When I mean resident I think about a window that owns the desktop when we need it. When we don’t need it anymore, it is able to restore the desktop to other processes.

xxxxx@gmail.com wrote:

When I mean resident I think about a window that owns the desktop when we need it. When we don’t need it anymore, it is able to restore the desktop to other processes.

You can do this from user mode by using DirectX exclusive mode. There’s
no practical way to do it from the kernel without the cooperation of the
operating system. There are just too many players.


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

>>MmMapIoSpace works for me. I succeded to draw a white line on my screen.

>But do you think it is possible to draw a simple and resident window from kernel
>by using directX for example…

Try enabling Aero. It wont work.