This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Check if WIndows 7 or not, usingGetVersionEx
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 24, 2010
05:56 AM
Check if WIndows 7 or not, usingGetVersionEx
I try to check if Windows 7 or not, using GetVersionEx in Install Script.
However, When I debugged as below Script in Windows 7, th nimber of nMinorVersion was returned 0. (The Number of nMajorVersion was correctlly returned 1.)
Could someone help me, please ?
// ----------------------------------------------------------------------
// InstallScript:
//
// ----------------------------------------------------------------------
#include "ifx.h"
export prototype MyFunction(HWND);
OSVERSIONINFOEX osvi;
BOOL bAns;
number nMajorVersion;
number nMinorVersion;
function MyFunction(hMSI)
begin
osvi.nOSVersionInfoSize = SizeOf(osvi);
bAns = GetVersionEx(&osvi);
nMajorVersion = osvi.nMajorVersion;
nMinorVersion = osvi.nMinorVersion;
end;
However, When I debugged as below Script in Windows 7, th nimber of nMinorVersion was returned 0. (The Number of nMajorVersion was correctlly returned 1.)
Could someone help me, please ?
// ----------------------------------------------------------------------
// InstallScript:
//
// ----------------------------------------------------------------------
#include "ifx.h"
export prototype MyFunction(HWND);
OSVERSIONINFOEX osvi;
BOOL bAns;
number nMajorVersion;
number nMinorVersion;
function MyFunction(hMSI)
begin
osvi.nOSVersionInfoSize = SizeOf(osvi);
bAns = GetVersionEx(&osvi);
nMajorVersion = osvi.nMajorVersion;
nMinorVersion = osvi.nMinorVersion;
end;
(7) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 24, 2010
05:59 AM
There was a type miss in the Previous post.
The number of nMajorVersion was correctly 6.
Sorry
The number of nMajorVersion was correctly 6.
Sorry
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 24, 2010
12:19 PM
This API is known to intentionally report incorrect values in installers. You should reference the VersionNT property from your MSI.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 26, 2010
11:20 PM
Thank you, MichaelU.
As "idriver.exe" is running in compatible mode, GetVersionInfo returns the information incorrectly, I've heard.
In such a case, are nServicePackMajor and nServicePackMinor returned incorrect value ?
As "idriver.exe" is running in compatible mode, GetVersionInfo returns the information incorrectly, I've heard.
In such a case, are nServicePackMajor and nServicePackMinor returned incorrect value ?
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 27, 2010
10:25 AM
Hello, chocodachs
Why not use SYSINFO structure?
Why not use SYSINFO structure?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 27, 2010
10:51 AM
I believe the SYSINFO struct is populated from the same incorrectly reported values, so it won't be any better. While we could reference VersionNT to build this in some cases, in other cases (like those invoked from deferred custom actions) this wouldn't work, and the disconnect would be much more risky.
Another approach to consider, depending on your needs, is to use the VerifyVersionInfo API instead. I don't believe it is as likely to lie, as it handles the check internally so an application's code is less likely to misuse it.
Another approach to consider, depending on your needs, is to use the VerifyVersionInfo API instead. I don't believe it is as likely to lie, as it handles the check internally so an application's code is less likely to misuse it.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 27, 2010
09:05 PM
Hello, Kevin
Of course, I tried to use SYSINFO information.
But The below information is the same as GetInfoEx's.
SYSINFO.nOSMajor -> 6
SYSINFO.nOSMinor -> 0
SYSINFO.nWinMajor -> 6
SYSINFO.nWnMinor -> 0
Regards,
chocodachs
Of course, I tried to use SYSINFO information.
But The below information is the same as GetInfoEx's.
SYSINFO.nOSMajor -> 6
SYSINFO.nOSMinor -> 0
SYSINFO.nWinMajor -> 6
SYSINFO.nWnMinor -> 0
Regards,
chocodachs