Tech Support > Microsoft Windows > Drivers > working with multiple OS versions
working with multiple OS versions
Posted by Maurice zmau on February 25th, 2004


Hi All,

The question is at the end.

I have a PCI device + driver, which has to work on both Win-NT and
Win-2K.
I have 2 Drivers : A WDM driver for Win2K, and a Non-WDM driver for
Win-NT.
So, far everything is great.
The 2 drivers has the axact same interface from the application point
of
view. The only difference is in the "CreateFile() method". So,
naturally,
I want to have one DLL for both drivers, and do the CreateFile()
according to the runtime OS version.
This works also very good.

Here comes the problem :
Up until now, I compiled the DLL on Win-2K, and ran it under both OS.
Now, I want to compile this DLL, under Win-NT (I am not expecting to
run this DLL on win-2K). I am expecting to have one code though.
Now the following line does not compile !!!!
"include <initGuid.h>
The file axists, but I get some funny compilation error. Here I do not
care for the GUID (I CreateFile() by the good old NT method), so I
delete
this line and everything works. Remember that I am expecting to have
one
code for the DLL.
I want to do something like:
#if (WINVER > 0x0400)
"include <initGuid.h>
#endif
But for some reason, this does not work: On my Win-2K compilation
machine,
WINVER is also defined to be 0x0400.

***************************
So here comes the question :
How do I figgure out during compilation, which OS version I am
compiling on ?
I want to use some compiler variable.


Thanks
Maurice

Posted by Tim Reago on February 25th, 2004


GetVersion()
GetVersionEx()



Posted by Gary G. Little on February 25th, 2004


Why not assign a symbolic link? Using GUIDs for 2K and above is fine, but
given that NT4 is in the mix I would simply assign a symbolic link and do a
CreateFile on \\.\MyDumbDriver whether I'm running NT4, 2000, XP, or Server
2003.

--
Gary G. Little
Seagate Technologies, LLC

"Maurice zmau" <zmau@netvision.net.il> wrote in message
news:a4a129d6.0402250451.443deb36@posting.google.c om...


Posted by Walter Oney on February 25th, 2004


Maurice zmau wrote:
I don't think you can. Your problem is simply that you have the wrong
SDK installed on your NT4 system. I suggest merely copying initguid.h
from someplace else into your project directory.

--
Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Check out our schedule at http://www.oneysoft.com


Similar Posts