Desperately want GDIINFO, how can I obtain this structure?

L

lucy

Dear all,

I am mad about this...

GDIINFO is a Windows System structure, and it is global...

But I just don't know where to access it...

I searched many places but cannot find how to read its field out...

Any thoughts? Please help me! Thank you so much!

-Lucy
 
V

vipin

I confirm that there is no windows API to obtain this.You will have to write
some filtering mechanism,
on the driver dll to obtain it. A GDIINFO is associated with each DC and
is not a global information maintained per driver session.
 
C

Calvin Guan

Do you own the display driver? If yes, you can add an escape support in the
driver. You then can get it by issuing ExtEscape call. If you don't own the
driver, then you need a KM GDI filter.

-
Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com
 
L

lucy

Calvin Guan said:
Do you own the display driver? If yes, you can add an escape support in the
driver. You then can get it by issuing ExtEscape call. If you don't own the
driver, then you need a KM GDI filter.

-
Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com


I don't own the driver...the display card driver is from your ATI... I am
just in need of the GDIINFO obtained from the driver. What does KM mean?

Thank you
 
B

Brian Catlin

lucy said:
Dear all,

I am mad about this...

GDIINFO is a Windows System structure, and it is global...

But I just don't know where to access it...

I searched many places but cannot find how to read its field out...

Any thoughts? Please help me! Thank you so much!

What information in the GDIINFO structure are you looking for? The Win32 API
GetDeviceCaps will return pretty much everything in the GDIINFO structure

-Brian

Brian Catlin, Sannas Consulting 310-944-9492
Windows Network, Video, WDM Device Driver Training & Consulting
See WWW.AZIUS.COM.bad for courses and scheduling
REMOVE .BAD FROM EMAIL AND WEB ADDRESS
 
L

lucy

Brian Catlin said:
What information in the GDIINFO structure are you looking for? The Win32 API
GetDeviceCaps will return pretty much everything in the GDIINFO structure

-Brian

Brian Catlin, Sannas Consulting 310-944-9492
Windows Network, Video, WDM Device Driver Training & Consulting
See WWW.AZIUS.COM.bad for courses and scheduling
REMOVE .BAD FROM EMAIL AND WEB ADDRESS

Hi Brian,

thank you very much for your help. I am in need of this field ULONG
ulPhysicalPixelCharacteristics;

from the GDIINFO desperately...

I did not see this from GetDeviceCaps... do you have a way to get it?

thanks a lot,

-Lucy
 
V

vipin

He wants stuff which doesn't make sense from application point of view. THe
only way out is the km driver filter.

thanks
vipin
 
B

Brian Catlin

lucy said:
Hi Brian,

thank you very much for your help. I am in need of this field ULONG
ulPhysicalPixelCharacteristics;

from the GDIINFO desperately...

I did not see this from GetDeviceCaps... do you have a way to get it?

There is a kernel debugger extension DLL for display drivers called GDIKDX.DLL,
and it has the ability to display just about anything you would like to know
regarding display and print drivers, including their data structures.
Unfortunately, the extension isn't supported after Win2K. >:-{

On the bright side, using that extension (specifically, the !dpdev command), you
can look at the global list of PDEVs, and the GDIINFO structure in them.
Unfortunately, the extension DLL doesn't display the
ulPhysicalPixelCharacteristics, but that's OK, you can find it using the
debugger. There is a global linked list of PDEVs starting at Win32K!gppdevlist.
With a little bit of effort, you should be able to find the offset of the
GDIINFO structure within the PDEV structure.

If this is too much of a hack for you, then you'll have to write what I call an
"intermediate display driver" (some people may refer to this as a filter driver,
but since I wrote the very first one, I get to name it). This is a display
driver that sits between GDI and the real display driver, allowing you to see
everything being sent to and from the display driver.

-Brian

Brian Catlin, Sannas Consulting 310-944-9492
Windows Network, Video, WDM Device Driver Training & Consulting
See WWW.AZIUS.COM.bad for courses and scheduling
REMOVE .BAD FROM EMAIL AND WEB ADDRESS
 
V

vipin

Hi Brian,
GDIINFO is not part of the PDEV structure.I am not sure if
the debugger has the ability of getting to the association of PDEV and
GDIINFO,might be as you said windbg might be able to,that would be very
interesting. I have to see then. As you already know,
PDEV is a chunk of memory which the driver allocates in the
DrvEnablePDev(...) and returns so it gets associated when DrvEnableSurface
is called with a drawing surface. So not sure how an offset into pdev
structure would give GDIINFO.

Since you are the best person, I ask, do you know why microsoft has this,
whats the history behind it?
GeDeviceCaps
PDEVICESIZE Reserved.


Brian,Didn't you author a book on display drivers, Is it possible to get
hold of the book., any pointers where to look for.
thanks
vipin
 
V

vipin

Calvin,

Since you are an ATI guy, might be lucy can get special builds from you ATI
guys to retreive the information via some custom escapes. Might be an
opportunity for business :) What does lucy say?

thanks
vipin
 
C

Calvin Guan

Let me talk to the 2D owner to see that they think.
Lucy, can you give a little bit more detail why you need this information? I
need to convince our 2D guys.
 
V

vipin

You have to provide a custom escape support.
He can call ExtEscape(...) win32 call and you should implement the stuff in
the DrvEscape(...) to pass back the information( would be few lines of
code).
Since ExtEscape takes a HDC as a parameter, GDI will map the HDC to
SURFOBJ, from the SURFOBJ the driver can get the PDEV
and somehow you should have the association between PDEV and GDIINFO handled
in DrvEnablePdev(...), to do the ultimate mapping to GDIINFO.

Might be a global variable would do so you don't have to do the mapping and
stuff in the driver, since there is no concept of ResetDC(...) for display
drivers as it is
for printer drivers and the GDIINFO would be constant for any number of
DEVICE CONTEXTS created at a given point of time.

Ofcourse Lucy has to get back to you on this.Of course let me know if the
business deal works out and if you guys plan something offline and might be
you
may want to share a pie with me :)

thanks
vipin
 
B

Brian Catlin

vipin said:
Hi Brian,
GDIINFO is not part of the PDEV structure

There is a global list of structures maintained by GDI, which they refer to as
PDEVs; not to be confused with your own structure in a display driver that you
refer to as a PDEV
.I am not sure if
the debugger has the ability of getting to the association of PDEV and
GDIINFO,might be as you said windbg might be able to,that would be very
interesting.

Go to a Win2K system (or crash dump), type ".load gdikdx.dll", followed by
"!dpdev -a"
I have to see then. As you already know,
PDEV is a chunk of memory which the driver allocates in the
DrvEnablePDev(...) and returns so it gets associated when DrvEnableSurface
is called with a drawing surface. So not sure how an offset into pdev
structure would give GDIINFO.

See above
Since you are the best person, I ask, do you know why microsoft has this,
whats the history behind it?
GeDeviceCaps
PDEVICESIZE Reserved

Do you mean, "Why wasn't it implemented?". I don't know. You might want to ask
Andre Vachon, who hangs out in the WinDbg newsgroup now
Brian,Didn't you author a book on display drivers, Is it possible to get
hold of the book., any pointers where to look for.

I was working on it, but I never finished it because I was putting more money
into it (in terms of my time) than I would every receive in terms of royalties

-Brian

Brian Catlin, Sannas Consulting 310-944-9492
Windows Network, Video, WDM Device Driver Training & Consulting
See WWW.AZIUS.COM.bad for courses and scheduling
REMOVE .BAD FROM EMAIL AND WEB ADDRESS
 
L

lucy

vipin said:
Calvin,

Since you are an ATI guy, might be lucy can get special builds from you ATI
guys to retreive the information via some custom escapes. Might be an
opportunity for business :) What does lucy say?

thanks
vipin

Hi Vipin,

Thank you very much for always taking care of my questions :=) that's really
a great idea. Will this make our program locked on ATI card? I am wondering
if a GDI filter really needs to hang on with a partilular display card and
be dependent on that card? Then if the user has another card, my program
won't work?

Thank you very much!

-Lucy
 
L

lucy

Calvin Guan said:
Let me talk to the 2D owner to see that they think.
Lucy, can you give a little bit more detail why you need this information? I
need to convince our 2D guys.

Hi Calvin,

thank you very much for your help! I am trying to study the effect of
reading text on computer screen. So the color and pixel layout on the screen
is important to me...
 
L

lucy

vipin said:
You have to provide a custom escape support.
He can call ExtEscape(...) win32 call and you should implement the stuff in
the DrvEscape(...) to pass back the information( would be few lines of
code).
Since ExtEscape takes a HDC as a parameter, GDI will map the HDC to
SURFOBJ, from the SURFOBJ the driver can get the PDEV
and somehow you should have the association between PDEV and GDIINFO handled
in DrvEnablePdev(...), to do the ultimate mapping to GDIINFO.

Might be a global variable would do so you don't have to do the mapping and
stuff in the driver, since there is no concept of ResetDC(...) for display
drivers as it is
for printer drivers and the GDIINFO would be constant for any number of
DEVICE CONTEXTS created at a given point of time.

Ofcourse Lucy has to get back to you on this.Of course let me know if the
business deal works out and if you guys plan something offline and might be
you
may want to share a pie with me :)

thanks
vipin

Hi Vipin,

Thank you very much for your suggestion. I am not sure I fully understand
your ideas. But will this approach make my program dependent on ATI card?
For those non-ATI card user, my program won't work?

Meanwhile, I am guessing that my small program won't convince ATI for such a
custom build... as there are so many developers such as me worldwide that
exceed the number ATI can handle... :=)

Anyway,thank you so much, I am learning bit by bit...
 
L

lucy

vipin said:
He wants stuff which doesn't make sense from application point of view. THe
only way out is the km driver filter.

thanks
vipin

Hi Vipin,

See my another post. You still think that does not make sense? I also know
that the only way out is KM display driver filter, I just cannot believe
that obtaining such a simple structure needs a driver programming... it
should be a global structure somewhere... At the same time, I should admit
that I don't know how to do display driver filtering at all. I even don't
know how to program a driver at all. I guess I will start with mirror
filtering in the DDK. Is that a good starting point for a truely novice in
this driver stuff? I will consult you later after I try it...
 
L

lucy

Brian Catlin said:
There is a kernel debugger extension DLL for display drivers called GDIKDX.DLL,
and it has the ability to display just about anything you would like to know
regarding display and print drivers, including their data structures.
Unfortunately, the extension isn't supported after Win2K. >:-{

On the bright side, using that extension (specifically, the !dpdev command), you
can look at the global list of PDEVs, and the GDIINFO structure in them.
Unfortunately, the extension DLL doesn't display the
ulPhysicalPixelCharacteristics, but that's OK, you can find it using the
debugger. There is a global linked list of PDEVs starting at Win32K!gppdevlist.
With a little bit of effort, you should be able to find the offset of the
GDIINFO structure within the PDEV structure.

Hi Brian,

Thank you very much for your help! At the first glance I feel very happy and
thought the good approach of obtaining the info I want has been discovered.
After some digestion I found that you meant that this method is no longer
available in current or newer OS.... :=) since I am developing on Windows XP
and hope that I can find a (almost) universal way to handle Windows family
together(at least Windows 2000 to Windows XP...) so this method does not
work, I guess? If I finally cannot find a universal way, then I guess I'd
better come back to this one...
If this is too much of a hack for you, then you'll have to write what I call an
"intermediate display driver" (some people may refer to this as a filter driver,
but since I wrote the very first one, I get to name it). This is a display
driver that sits between GDI and the real display driver, allowing you to see
everything being sent to and from the display driver.

Yeah, many people have suggested KM GDI filter, but how to really write one?
Novice programmer always love the tutorials. Are there any tutorials and
sample codes for doing this? Since I just need to read the information, not
changing the information, I guess my GDI filter driver should be reasonably
simple? However, I have searched google many times, frankly I haven't see
any place for tutorial or sample codes... Please do give me some pointers!
Thank you so much!

Best,

-Lucy
 
L

lucy

vipin said:
Hi Brian,
GDIINFO is not part of the PDEV structure.I am not sure if
the debugger has the ability of getting to the association of PDEV and
GDIINFO,might be as you said windbg might be able to,that would be very
interesting. I have to see then. As you already know,
PDEV is a chunk of memory which the driver allocates in the
DrvEnablePDev(...) and returns so it gets associated when DrvEnableSurface
is called with a drawing surface. So not sure how an offset into pdev
structure would give GDIINFO.

Since you are the best person, I ask, do you know why microsoft has this,
whats the history behind it?
GeDeviceCaps
PDEVICESIZE Reserved.


Brian,Didn't you author a book on display drivers, Is it possible to get
hold of the book., any pointers where to look for.
thanks
vipin

to

Wah, you know a lot... Vipin... then why don't you tell me how to implement
this? Anyway, I learned a lot through your discussion. Thank you very much!
 
L

lucy

Brian Catlin said:
There is a global list of structures maintained by GDI, which they refer to as
PDEVs; not to be confused with your own structure in a display driver that you
refer to as a PDEV


Go to a Win2K system (or crash dump), type ".load gdikdx.dll", followed by
"!dpdev -a"


Hi Brian,

do you mean that the "tracing by debugging" method does not apply on any OS
after win2000,

but once one get the offset address in that global structure, the offset
won't change in WinXP,

so the result I obtained in Win2000 should work for WinXP?

Do you mean, "Why wasn't it implemented?". I don't know. You might want to ask
Andre Vachon, who hangs out in the WinDbg newsgroup now

Is there a way to use GetDeviceCaps to hack the complete structure of
GDIINFO to get the field I want?
I was working on it, but I never finished it because I was putting more money
into it (in terms of my time) than I would every receive in terms of royalties

Is your book published? I am interested in taking a look! If it has sample
for "GDI filter"... I guess it must have some samples inside...

Anyrate, please do give me some pointers on this stuffy. I've been mad about
this.

thank you very much and have a nice weekend,

-Lucy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top