I've pretty much got it down how to determine operating system version, service pack level, 95/NT based, etc. for Windows XP and earlier versions by using GetVersionEx(...) and that's pretty handy for getting system information that software users probably don't know and don't know how to figure out (sadly).

A new wrench in the works is driver signing enforcement on 64 bit versions of windows (e.g. Windows Vista Home Premium 64-bit), which requires drivers to be digitally signed (read: 30 pieces of silver to MS and their cronies) which, by the way, Kaspersky and other AV folks say doesn't do squat for preventing malicious code from executing.

Driver signature enforcement may be disabled by the user at boot time using the F8 key and selecting the appropriate option, but that is inconvenient and impractical for the user. There is also a work around which can be used after the fact for this particular driver (which involves installing the signed drivers and the unsigned drivers, which are the same drivers only modified to include my PID and VID).

In any case, it would be easiest if we were able to determine the version of the operating system and resolve it down to the OS major and minor version, service pack, on which OS it is based as well as 32- vs 64-bit. Which leads to my question: How do I do that?

I think I'll need to use the GetProductInfo(...) function (?) but I'm not sure if that will do the trick or not and, further, I'm not sure how to use it and can't find any really good examples. Does anyone know if this will work and, if so, can you explain/show me how to do it? Is there another, easier, way to determine this information programatically? I'm using VC++ 6.0.

Recommended Answers

All 4 Replies

>>I'm using VC++ 6.0.

You won't be able to use that compiler if you think you need to write 64-bit code. Upgrade to vc++ 2008 Pro or the new vc++ 2010 Pro (the Express versions are not adequate either because they don't produce 64-bit code).

I know you can create 32-bit programs to run on a 64-bit os, but I'm not sure if 32-bit device drivers can run on 64-bit os.

The current drivers do work fine on 32 and 64 bit OS (or at least the distributed package contains the drivers for both and it can figure out which it needs). The drivers we use are for Prolific CP210x UART chip. The Prolific (signed) drivers work fine on all OS, my modified drivers work fine when signature enforcement is turned off and the workaround works fine. Additionally, the main software works perfectly under all OS, but without the drivers functioning properly, communication with the device fails. Using one of the above methods to get the drivers working, everything works (software, communication, etc.).

I don't want to write 64-bit code; I'm certainly not doing anything with big instructions or the like. I just want a program that will run, the user can click a button and the system information will pop up in the display or be written to a text file that the user can send to me. I've got that done now so that it can give me the major and minor versions, whether it's NT or DOS based, SP level, etc. using GetVersionEX, but that doesn't let me differentiate between 32- and 64-bit operating systems which, at the moment, is the deciding factor for whether or not Windows enforces driver signing requirements. At best, it can tell you if they're using XP vs Longhorn vs W7.

>>but that doesn't let me differentiate between 32- and 64-bit operating systems which, at the moment, is the deciding factor for whether or not Windows enforces driver signing requirements

XP, Vista and Win7 all have 64-bit versions, so how is that going to help you determine which version is being run?

>>but that doesn't let me differentiate between 32- and 64-bit operating systems which, at the moment, is the deciding factor for whether or not Windows enforces driver signing requirements

XP, Vista and Win7 all have 64-bit versions, so how is that going to help you determine which version is being run?

I realize that all of the aforementioned OS have 32- and 64-bit versions. This is exactly why the old software I have written (using GetVersionEX which, at most, lets you know which of those three, among others, is being run) is not useful for determining whether it is a 32- or 64-bit version. That's why I am trying to figure out how to use GetProductInfo(...) or find out if there is some other way to discriminate between the versions. Saying that they all have 64-bit versions is simply restating the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.