NTDEV is to a certain extent a debating society and a circular firing
squad. We like getting into personal arguments.
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anuj Agarwal
Sent: Tuesday, March 28, 2006 9:47 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] OS detection problem
Hello Everybody
Thanks for your kind support, I have finally solved my problem by using
‘MmGetSystemRoutineAddress()’ routine and the routine that I was using
earlier could not solve my problem i.e. ‘IoIsWdmVersionAvailable()’.
But I doesnt understand why you people starts arguing on each other,
here you people are to help/support others and not to get involve in
personal arguments.
But anyway thanks everyone and especially to Daniel for his kind
support.
Anuj Agarwal
On 3/28/06, MM wrote:
Daniel Terhell wrote:
>Come on you guys could do better than this and be more noble
>
Daniel, if you read the post I pointed him to searching the archive with
the search string “detect os version”.
The very FIRST link returned discusses the differences between
RtlGetVersion vs. PsGetVersion. Once he
knew the name of the api, he could of looked it up in the DDK/WDK for
further information.
>
>I wonder how far you guys would be getting writing device drivers on an
OS
>with a different language or character set than your own.
>
The OP wrote in excellent English - what’s your point? What does
searching the ddk/wdk or the archives have to
do with his native language when his English is ‘just fine’?
>
>I am with Gary on this one, not with you, Don Burn or MM.
>
>
Like anyone gives a damn.
Do note, Gary did not answer the question
- he called me an ass followed by a smiley face.
>/Daniel
>-------
>
>
>“Tim Roberts” wrote in message news:xxxxx@ntdev …
>
>
>>The MSDN page includes an explicit example of how to use this API
>>
>>
>
>“Don Burn” wrote in message news:xxxxx@ntdev…
>
>
>>Well I’m with Matt on this one
>>
>>
>
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
>To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
>
>
>
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Anuj Agarwal wrote:
Thanks for your kind support, I have finally solved my problem by
using ‘MmGetSystemRoutineAddress()’ routine and the routine that I was
using earlier could not solve my problem i.e.
‘IoIsWdmVersionAvailable()’.
I, for one, would like to “drill down” a bit and find out exactly what
went wrong here. I suspect this is yet another case where the question
you asked is not really the question you wanted answered. Here is your
original query, in its entirety:
How can I detect the OS version from the filter driver, I want to
detect the OS on which my driver gets loaded is whether 2K or XP.
IoIsWdmVersionAvailable() is *exactly* the right API to solve this
problem. It is simple, costs virtually nothing, and has no confusion
over hot fixes and service packs. When you tried to use it, you used it
incorrectly. I pointed that out, and told you exactly how it was
supposed to be used.
So, why didn’t that work for you? How does “MmGetSystemRoutineAddress”
get involved? What were you REALLY trying to do?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Sorry for all the confusion, but it is better to use PsGetVersion or
RtlGetVersion. These functions return information about the current
operating system, while IoIsWdmVersion is there for another purpose. If you
are building a driver that also has to run on Win2000, use PsGetVersion.
However it is declared obsolete, if your driver runs on Win XP and above
only you should use RtlGetVersion. As Doron has pointed out,
MmGetSystemRoutineAddress using RtlGetVersion is not a good idea. I admit my
suggestion was not too serious and I kind of mentioned this to cover up my
mistake. Although there’s written it is only available on Windows XP and
above, it could theoretically be added to a future service pack of Windows
2000.
/Daniel
When I was using ‘IoIsWdmVersionAvailable()’ as follows:
if(IoIsWdmVersionAvailable(1, 0x10))
{
DbgPrint(“Inside 2K\n”);
}
else
if(IoIsWdmVersionAvailable(1, 0x20))
{
//If WDM 1.20 is supported, this is Windows XP
//or better.
DbgPrint(“Inside XP\n”);
}
I was always getting ‘Inside 2K’ even I was running under XP, So I tried
MmGetSystemRoutineAddress() with ‘RtlVerifyVersionInfo()’ and I got the
desired result that I needed.
If any other better solution is there, Please tell.
Anuj Agarwal
On 3/28/06, Tim Roberts wrote:
>
> Anuj Agarwal wrote:
>
> >
> > Thanks for your kind support, I have finally solved my problem by
> > using ‘MmGetSystemRoutineAddress()’ routine and the routine that I was
> > using earlier could not solve my problem i.e.
> > ‘IoIsWdmVersionAvailable()’.
>
>
> I, for one, would like to “drill down” a bit and find out exactly what
> went wrong here. I suspect this is yet another case where the question
> you asked is not really the question you wanted answered. Here is your
> original query, in its entirety:
>
> > How can I detect the OS version from the filter driver, I want to
> > detect the OS on which my driver gets loaded is whether 2K or XP.
>
>
> IoIsWdmVersionAvailable() is exactly the right API to solve this
> problem. It is simple, costs virtually nothing, and has no confusion
> over hot fixes and service packs. When you tried to use it, you used it
> incorrectly. I pointed that out, and told you exactly how it was
> supposed to be used.
>
> So, why didn’t that work for you? How does “MmGetSystemRoutineAddress”
> get involved? What were you REALLY trying to do?
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Your check is just in the wrong order.
MSDN will tell you that the return value is “TRUE if the version of WDM
that the operating system provides is GREATER THAN OR EQUAL TO the
version number of WDM being requested.”. You want to check for 1.2
first, then for 1.1 if the first check failed.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anuj Agarwal
Sent: Tuesday, March 28, 2006 10:23 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] OS detection problem
When I was using ‘IoIsWdmVersionAvailable()’ as follows:
if(IoIsWdmVersionAvailable(1, 0x10))
{
DbgPrint(“Inside 2K\n”);
}
else
if(IoIsWdmVersionAvailable(1, 0x20))
{
//If WDM 1.20 is supported, this is Windows XP
//or better.
DbgPrint(“Inside XP\n”);
}
I was always getting ‘Inside 2K’ even I was running under XP,
So I tried MmGetSystemRoutineAddress() with
‘RtlVerifyVersionInfo()’ and I got the desired result that I needed.
If any other better solution is there, Please tell.
Anuj Agarwal
On 3/28/06, Tim Roberts wrote:
>
> Anuj Agarwal wrote:
>
> >
> > Thanks for your kind support, I have finally solved
> my problem by
> > using ‘MmGetSystemRoutineAddress()’ routine and the
> routine that I was
> > using earlier could not solve my problem i.e.
> > ‘IoIsWdmVersionAvailable()’.
>
>
> I, for one, would like to “drill down” a bit and find
> out exactly what
> went wrong here. I suspect this is yet another case
> where the question
> you asked is not really the question you wanted
> answered. Here is your
> original query, in its entirety:
>
> > How can I detect the OS version from the filter
> driver, I want to
> > detect the OS on which my driver gets loaded is
> whether 2K or XP.
>
>
> IoIsWdmVersionAvailable() is exactly the right API to
> solve this
> problem. It is simple, costs virtually nothing, and
> has no confusion
> over hot fixes and service packs. When you tried to
> use it, you used it
> incorrectly. I pointed that out, and told you exactly
> how it was
> supposed to be used.
>
> So, why didn’t that work for you? How does
> “MmGetSystemRoutineAddress”
> get involved? What were you REALLY trying to do?
>
> –
> Tim Roberts, xxxxx@probo.com mailto:xxxxx
> Providenza & Boekelheide, Inc.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR
> Online at http://www.osronline.com/page.cfm?name=ListServer
>
>
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 To unsubscribe,
> visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></mailto:xxxxx>
I tried in both ordering but result is same, in that case it was going
‘Inside XP’, so of no use.
Anuj Agarwal.
On 3/29/06, Scott wrote:
>
> Your check is just in the wrong order.
>
> MSDN will tell you that the return value is “TRUE if the version of WDM
> that the operating system provides is GREATER THAN OR EQUAL TO the
> version number of WDM being requested.”. You want to check for 1.2
> first, then for 1.1 if the first check failed.
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Anuj Agarwal
> > Sent: Tuesday, March 28, 2006 10:23 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] OS detection problem
> >
> > When I was using ‘IoIsWdmVersionAvailable()’ as follows:
> >
> > if(IoIsWdmVersionAvailable(1, 0x10))
> > {
> > DbgPrint(“Inside 2K\n”);
> > }
> > else
> > if(IoIsWdmVersionAvailable(1, 0x20))
> > {
> > //If WDM 1.20 is supported, this is Windows XP
> > //or better.
> > DbgPrint(“Inside XP\n”);
> > }
> > I was always getting ‘Inside 2K’ even I was running under XP,
> > So I tried MmGetSystemRoutineAddress() with
> > ‘RtlVerifyVersionInfo()’ and I got the desired result that I needed.
> > If any other better solution is there, Please tell.
> >
> > Anuj Agarwal
> >
> >
> > On 3/28/06, Tim Roberts wrote:
> >
> > Anuj Agarwal wrote:
> >
> > >
> > > Thanks for your kind support, I have finally solved
> > my problem by
> > > using ‘MmGetSystemRoutineAddress()’ routine and the
> > routine that I was
> > > using earlier could not solve my problem i.e.
> > > ‘IoIsWdmVersionAvailable()’.
> >
> >
> > I, for one, would like to “drill down” a bit and find
> > out exactly what
> > went wrong here. I suspect this is yet another case
> > where the question
> > you asked is not really the question you wanted
> > answered. Here is your
> > original query, in its entirety:
> >
> > > How can I detect the OS version from the filter
> > driver, I want to
> > > detect the OS on which my driver gets loaded is
> > whether 2K or XP.
> >
> >
> > IoIsWdmVersionAvailable() is exactly the right API to
> > solve this
> > problem. It is simple, costs virtually nothing, and
> > has no confusion
> > over hot fixes and service packs. When you tried to
> > use it, you used it
> > incorrectly. I pointed that out, and told you exactly
> > how it was
> > supposed to be used.
> >
> > So, why didn’t that work for you? How does
> > “MmGetSystemRoutineAddress”
> > get involved? What were you REALLY trying to do?
> >
> > –
> > Tim Roberts, xxxxx@probo.com mailto:xxxxx
> > Providenza & Boekelheide, Inc.
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR
> > Online at http://www.osronline.com/page.cfm?name=ListServer
> >
> >
> >
> > — Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256 To unsubscribe,
> > visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></mailto:xxxxx>
Your logic is wrong, IoIsWdmVersionAvailable will return true if that
version or higher is avaialble, so for any current operating system the
first call always returns true. Drop thje else from your code and you
should see “Inside 2k” followed by “Inside XP”
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
“Anuj Agarwal” wrote in message
news:xxxxx@ntdev…
When I was using ‘IoIsWdmVersionAvailable()’ as follows:
if(IoIsWdmVersionAvailable(1, 0x10))
{
DbgPrint(“Inside 2K\n”);
}
else
if(IoIsWdmVersionAvailable(1, 0x20))
{
//If WDM 1.20 is supported, this is Windows XP
//or better.
DbgPrint(“Inside XP\n”);
}
I was always getting ‘Inside 2K’ even I was running under XP, So I tried
MmGetSystemRoutineAddress() with ‘RtlVerifyVersionInfo()’ and I got the
desired result that I needed.
If any other better solution is there, Please tell.
Anuj Agarwal
On 3/28/06, Tim Roberts wrote:
>
> Anuj Agarwal wrote:
>
> >
> > Thanks for your kind support, I have finally solved my problem by
> > using ‘MmGetSystemRoutineAddress()’ routine and the routine that I was
> > using earlier could not solve my problem i.e.
> > ‘IoIsWdmVersionAvailable()’.
>
>
> I, for one, would like to “drill down” a bit and find out exactly what
> went wrong here. I suspect this is yet another case where the question
> you asked is not really the question you wanted answered. Here is your
> original query, in its entirety:
>
> > How can I detect the OS version from the filter driver, I want to
> > detect the OS on which my driver gets loaded is whether 2K or XP.
>
>
> IoIsWdmVersionAvailable() is exactly the right API to solve this
> problem. It is simple, costs virtually nothing, and has no confusion
> over hot fixes and service packs. When you tried to use it, you used it
> incorrectly. I pointed that out, and told you exactly how it was
> supposed to be used.
>
> So, why didn’t that work for you? How does “MmGetSystemRoutineAddress”
> get involved? What were you REALLY trying to do?
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Anuj Agarwal wrote:
I tried in both ordering but result is same, in that case it was going
‘Inside XP’, so of no use.
No, you didn’t. You may THINK you tried both orderings, but you
didn’t. This absolutely works:
if( IoIsWdmVersionAvailable( 1, 0x30 ) )
{
DbgPrint( “In 2003\n” );
}
else if( IoIsWdmVersionAvailable( 1, 0x20 ) )
{
DbgPrint( “In XP\n” );
}
else if( IoIsWdmVersionAvailable( 1, 0x10 ) )
{
DbgPrint( “In 2K\n” );
}
else if( IoIsWdmVersionAvailable( 1, 0x05 ) )
{
DbgPrint( “In ME\n” );
}
else
{
DbgPrint( “In Win98\n” );
}
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.