Any API to get native resolution at kernel level.

Hi,
I am trying to initialize DEVMODE structure but I don;t have current
display settings info. So currently I am using all static values like for
resolution I have restricted my driver to 800x600, etc. but I want to
initialize the data with current display settings dynamically.
Is there any DDI call or any other way through which I can get current
display settings at kernel level?

Please remember I need this at the time of driver initialization.

One solution that I was thinking is to use escape call and send all required
information to kernel driver but I am not sure if it is safe enough or
whether it is possible at the time of driver initialization.

Any input will help a lot here.

/sarbojit

Sarbojit Sarkar wrote:

I am trying to initialize DEVMODE structure but I don;t have current
display settings info. So currently I am using all static values like
for resolution I have restricted my driver to 800x600, etc. but I want
to initialize the data with current display settings dynamically.
Is there any DDI call or any other way through which I can get current
display settings at kernel level?

Where are you trying to initialize a DEVMODE, and why? I thought you
were writing a mirror driver. If so, the DEVMODE is an INPUT to
DrvEnablePDEV. GDI will fill in all the information for the mode your
mirror driver is supposed to use, and pass the structure to you, so you
can set up your own data structures.

Please remember I need this at the time of driver initialization.

Really, you need to be more explicit. There just aren’t that many
people doing display drivers, so we don’t all have the necessary context.


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

Yes, Tim is correct.

In DrvEnablePDEV you get DEVMODEW structure whose dmPelsWidth
and dmPelsHeight members provide the current resolution.

In case of any further query, feel free to write.

Anshul Makkar
www.justkernel.com
xxxxx@justkernel.com

On Tue, Jul 27, 2010 at 9:51 PM, Tim Roberts wrote:

> Sarbojit Sarkar wrote:
> >
> > I am trying to initialize DEVMODE structure but I don;t have current
> > display settings info. So currently I am using all static values like
> > for resolution I have restricted my driver to 800x600, etc. but I want
> > to initialize the data with current display settings dynamically.
> > Is there any DDI call or any other way through which I can get current
> > display settings at kernel level?
>
> Where are you trying to initialize a DEVMODE, and why? I thought you
> were writing a mirror driver. If so, the DEVMODE is an INPUT to
> DrvEnablePDEV. GDI will fill in all the information for the mode your
> mirror driver is supposed to use, and pass the structure to you, so you
> can set up your own data structures.
>
> > Please remember I need this at the time of driver initialization.
>
> Really, you need to be more explicit. There just aren’t that many
> people doing display drivers, so we don’t all have the necessary context.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Thanks
Anshul Makkar
www.justkernel.com
xxxxx@justkernel.com

Thanks for your response.

Yes, you are correct.
But I have made one entry point DrvGetModes(), here I am filling up DEVMODE
structure with constant values. So is this wrong? I need not to add this? As
OS it self is capable enough to initialize DevMode structure with current
information?

Waiting for your suggestions.

/sarbojit

On Wed, Jul 28, 2010 at 10:09 AM, anshul makkar <
xxxxx@gmail.com> wrote:

Yes, Tim is correct.

In DrvEnablePDEV you get DEVMODEW structure whose dmPelsWidth
and dmPelsHeight members provide the current resolution.

In case of any further query, feel free to write.

Anshul Makkar
www.justkernel.com
xxxxx@justkernel.com

On Tue, Jul 27, 2010 at 9:51 PM, Tim Roberts wrote:
>
>> Sarbojit Sarkar wrote:
>> >
>> > I am trying to initialize DEVMODE structure but I don;t have current
>> > display settings info. So currently I am using all static values like
>> > for resolution I have restricted my driver to 800x600, etc. but I want
>> > to initialize the data with current display settings dynamically.
>> > Is there any DDI call or any other way through which I can get current
>> > display settings at kernel level?
>>
>> Where are you trying to initialize a DEVMODE, and why? I thought you
>> were writing a mirror driver. If so, the DEVMODE is an INPUT to
>> DrvEnablePDEV. GDI will fill in all the information for the mode your
>> mirror driver is supposed to use, and pass the structure to you, so you
>> can set up your own data structures.
>>
>> > Please remember I need this at the time of driver initialization.
>>
>> Really, you need to be more explicit. There just aren’t that many
>> people doing display drivers, so we don’t all have the necessary context.
>>
>> –
>> Tim Roberts, xxxxx@probo.com
>> Providenza & Boekelheide, Inc.
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> –
> Thanks
> Anshul Makkar
> www.justkernel.com
> xxxxx@justkernel.com
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

Yes, it seems wrong.

DEVMODE structure is already initialized and you dont need to initialize it.
This structure is used to initialize GDIINFO and DEVINFO structure.

On Wed, Jul 28, 2010 at 10:20 AM, Sarbojit Sarkar wrote:

> Thanks for your response.
>
> Yes, you are correct.
> But I have made one entry point DrvGetModes(), here I am filling up DEVMODE
> structure with constant values. So is this wrong? I need not to add this? As
> OS it self is capable enough to initialize DevMode structure with current
> information?
>
> Waiting for your suggestions.
>
> /sarbojit
>
> On Wed, Jul 28, 2010 at 10:09 AM, anshul makkar <
> xxxxx@gmail.com> wrote:
>
>> Yes, Tim is correct.
>>
>> In DrvEnablePDEV you get DEVMODEW structure whose dmPelsWidth
>> and dmPelsHeight members provide the current resolution.
>>
>> In case of any further query, feel free to write.
>>
>> Anshul Makkar
>> www.justkernel.com
>> xxxxx@justkernel.com
>>
>> On Tue, Jul 27, 2010 at 9:51 PM, Tim Roberts wrote:
>>
>>> Sarbojit Sarkar wrote:
>>> >
>>> > I am trying to initialize DEVMODE structure but I don;t have current
>>> > display settings info. So currently I am using all static values like
>>> > for resolution I have restricted my driver to 800x600, etc. but I want
>>> > to initialize the data with current display settings dynamically.
>>> > Is there any DDI call or any other way through which I can get current
>>> > display settings at kernel level?
>>>
>>> Where are you trying to initialize a DEVMODE, and why? I thought you
>>> were writing a mirror driver. If so, the DEVMODE is an INPUT to
>>> DrvEnablePDEV. GDI will fill in all the information for the mode your
>>> mirror driver is supposed to use, and pass the structure to you, so you
>>> can set up your own data structures.
>>>
>>> > Please remember I need this at the time of driver initialization.
>>>
>>> Really, you need to be more explicit. There just aren’t that many
>>> people doing display drivers, so we don’t all have the necessary context.
>>>
>>> –
>>> Tim Roberts, xxxxx@probo.com
>>> Providenza & Boekelheide, Inc.
>>>
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>
>>
>>
>> –
>> Thanks
>> Anshul Makkar
>> www.justkernel.com
>> xxxxx@justkernel.com
>> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
>> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
>> the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>
>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer


Thanks
Anshul Makkar
www.justkernel.com
xxxxx@justkernel.com

Sarbojit Sarkar wrote:

Yes, you are correct.
But I have made one entry point DrvGetModes(), here I am filling up
DEVMODE structure with constant values. So is this wrong? I need not
to add this? As OS it self is capable enough to initialize DevMode
structure with current information?

DrvGetModes is only required by drivers that have miniports (meaning
real hardware). A mirror driver does not need to implement it. Notice,
for example, that the sample mirror driver in the WDK does not have
DrvGetModes.


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

Thanks Tim & Anshul, for your response.

But Tim, my doubt is how graphics cards (I assumed by real H/W you means to
say graphics cards.) get this information, that is what is current
resolution of that particular monitor at boot time? Or DEVMODE is for what
is the display mode H/W can support?Just for information I wanted to know.

Miniports will be present only in case of real hardware, is it true?
I never able to make clear understandings about miniports. If you know give
some light it will be great or any like or materials which can give clear
understandings about miniports.

Thanks once again.

/sarbojit

On Wed, Jul 28, 2010 at 10:05 PM, Tim Roberts wrote:

> Sarbojit Sarkar wrote:
> >
> > Yes, you are correct.
> > But I have made one entry point DrvGetModes(), here I am filling up
> > DEVMODE structure with constant values. So is this wrong? I need not
> > to add this? As OS it self is capable enough to initialize DevMode
> > structure with current information?
>
> DrvGetModes is only required by drivers that have miniports (meaning
> real hardware). A mirror driver does not need to implement it. Notice,
> for example, that the sample mirror driver in the WDK does not have
> DrvGetModes.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Hi,

a display device (physical as well as virtual) always requires a “Display Driver” (the *.dll) and a “Miniport Driver” (the *.sys). Of course you need an *.inf file as well (for installation).
The miniport driver is the part which “talks” to the hardware (if there is a hardware). In case of the mirror driver you have to have this pair of drivers too, but as you have no hardware, the miniport does not have to implement any functionality except simple initialization in DriverEntry() and returning “TRUE” or something like that in the other entry points.
The display driver is responsible for rendering.

Maybe you should have a look on the documentation on the MSDN websites, e.g.:
Windows 2000 Display Architecture:
http://msdn.microsoft.com/en-us/library/ff570583(VS.85).aspx
General Design and Implementation Strategies:
http://msdn.microsoft.com/en-us/library/ff566724(VS.85).aspx
Mirror Drivers:
http://msdn.microsoft.com/en-us/library/ff568315(VS.85).aspx
Mirror - Mirror driver for mirroring GDI content:
http://msdn.microsoft.com/en-us/library/ff568319(VS.85).aspx
Creating Graphics INF Files:
http://msdn.microsoft.com/en-us/library/ff540766(VS.85).aspx

Markus

Sarbojit Sarkar wrote:

But Tim, my doubt is how graphics cards (I assumed by real H/W you
means to say graphics cards.) get this information, that is what is
current resolution of that particular monitor at boot time? Or DEVMODE
is for what is the display mode H/W can support?Just for information I
wanted to know.

DrvGetModes returns ALL of the modes that the graphics card is capable
of supporting. It’s not about the “current” mode, or the current
monitor. A monitor “driver” stores in the registry information about
what resolutions it can handle. The operating system uses that
information to trim down the huge list of potential resolutions returned
by DrvGetModes, and offers those to the user. It is the USER that
decides which mode in that list they want to run. That selected mode
will then be sent to the driver. It’s not up to the driver to choose
the “current” mode.


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