I'm using Inno Setup to change the recycle bin in the OS. I need to make some cases for if the user is running Windows 7 or Windows XP. I try using:
if not FileExists(winDir + '\System32\imageres.dll') then
if not FileExists(winDir + '\System32\shell32.dll') then
installError(3);
But it seems like it can't find imageres.dll
or shell32.dll
even though I've verified they exist. What am I doing wrong? Or can I check the Windows version another way?
You should use the GetWindowsVersionEx
function. It fills a TWindowsVersion
record:
TWindowsVersion = record
Major: Cardinal; // Major version number
Minor: Cardinal; // Minor version number
Build: Cardinal; // Build number
ServicePackMajor: Cardinal; // Major version number of service pack
ServicePackMinor: Cardinal; // Minor version number of service pack
NTPlatform: Boolean; // True if an NT-based platform
ProductType: Byte; // Product type (see below)
SuiteMask: Word; // Product suites installed (see below)
end;
There are a lot of other related functions. See below 'System functions' at this page.