|
|
#2 (permalink) |
|
Guest
Posts: n/a
|
I'd do it by calling DllGetVersion in miss.dll:
hMsi = LoadLibrary("miss.dll"); pDllGetVer = GetProcAddress(hMsi, "DllGetVersion"); DLLVERSIONINFO2 dllVersionInfo; dllVersionInfo.info1.cbSize = sizeof(DLLVERSIONINFO2); pDllGetVer(&dllVersionInfo); if ((dllVersionInfo.info1.dwMajorVersion >= 4) && (dllVersionInfo.info1.dwMinorVersion >= 5)) // It's 4.5 or later... "Gary Nguyen" <GaryNguyen@discussions.microsoft.com> wrote in message news:8E97685E-5411-4021-83AD-9881CC6D59D2@microsoft.com... > Can someone please help me how I can detect WI 4.5 on Vista, XP, Server > 2003? > Prefer registry detection. > > Thanks |
|
|
|
#3 (permalink) |
|
Guest
Posts: n/a
|
Jeff,
Thanks for your answer but i'm so new to C++. As reading your message and searching around, i think the easiest way is reading the version number of "system32\msi.dll" Your code below is help though, but can you go a little more detail on the code? Thanks. "Jeff Henkels" wrote: > I'd do it by calling DllGetVersion in miss.dll: > > hMsi = LoadLibrary("miss.dll"); > pDllGetVer = GetProcAddress(hMsi, "DllGetVersion"); > > DLLVERSIONINFO2 dllVersionInfo; > dllVersionInfo.info1.cbSize = sizeof(DLLVERSIONINFO2); > pDllGetVer(&dllVersionInfo); > > if ((dllVersionInfo.info1.dwMajorVersion >= 4) && > (dllVersionInfo.info1.dwMinorVersion >= 5)) > // It's 4.5 or later... > > "Gary Nguyen" <GaryNguyen@discussions.microsoft.com> wrote in message > news:8E97685E-5411-4021-83AD-9881CC6D59D2@microsoft.com... > > Can someone please help me how I can detect WI 4.5 on Vista, XP, Server > > 2003? > > Prefer registry detection. > > > > Thanks > > > |
|
|
|
#4 (permalink) |
|
Guest
Posts: n/a
|
[Please do not mail me a copy of your followup]
=?Utf-8?B?R2FyeSBOZ3V5ZW4=?= <GaryNguyen@discussions.microsoft.com> spake the secret code <8E97685E-5411-4021-83AD-9881CC6D59D2@microsoft.com> thusly: >Can someone please help me how I can detect WI 4.5 on Vista, XP, Server 2003? >Prefer registry detection. There is no supported way to use the registry to detect the version of Windows Installer. See <http://msdn.microsoft.com/en-us/library/aa368280(VS.85).aspx> for a list of different ways to detect the installed version. -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download <http://www.xmission.com/~legalize/book/download/index.html> Legalize Adulthood! <http://blogs.xmission.com/legalize/> |
|
|
|
#5 (permalink) |
|
Guest
Posts: n/a
|
"Jeff Henkels" <jeff@mapson.jeffhenkels.com> writes:
> I'd do it by calling DllGetVersion in miss.dll: > > hMsi = LoadLibrary("miss.dll"); > pDllGetVer = GetProcAddress(hMsi, "DllGetVersion"); Surely you mean "msi.dll". > DLLVERSIONINFO2 dllVersionInfo; > dllVersionInfo.info1.cbSize = sizeof(DLLVERSIONINFO2); > pDllGetVer(&dllVersionInfo); I'd perhaps use plain old DLLVERSIONINFO here, just in case some older versions of msi.dll don't support DLLVERSIONINFO2 and leave uninitialized values in the structure. Alternatively check the HRESULT and treat errors as too old versions. > if ((dllVersionInfo.info1.dwMajorVersion >= 4) && > (dllVersionInfo.info1.dwMinorVersion >= 5)) > // It's 4.5 or later... That looks like the kind of bug DLLVERSIONINFO2::ullVersion is intended to avoid. I.e. this recognizes MSI 4.5 and 5.5 but not 5.0. |
|
|
|
#6 (permalink) |
|
Guest
Posts: n/a
|
"Kalle Olavi Niemitalo" <kon@iki.fi> wrote in message
news:874owi7fab.fsf@Astalo.kon.iki.fi... > "Jeff Henkels" <jeff@mapson.jeffhenkels.com> writes: > >> I'd do it by calling DllGetVersion in miss.dll: >> >> hMsi = LoadLibrary("miss.dll"); >> pDllGetVer = GetProcAddress(hMsi, "DllGetVersion"); > > Surely you mean "msi.dll". Yes I did -- damn OE spell checker. > >> DLLVERSIONINFO2 dllVersionInfo; >> dllVersionInfo.info1.cbSize = sizeof(DLLVERSIONINFO2); >> pDllGetVer(&dllVersionInfo); > > I'd perhaps use plain old DLLVERSIONINFO here, just in case some > older versions of msi.dll don't support DLLVERSIONINFO2 and leave > uninitialized values in the structure. Alternatively check the > HRESULT and treat errors as too old versions. According to MSDN, DLLVERSIONINFO2 is supported from Windows 2000 onwards, so we should be safe. However, your recommendation is still a good idea. I'm usually in the "belt-and-suspenders" school when it comes to coding, but I do tend to skip error handling when posting samples composed on the spot. > >> if ((dllVersionInfo.info1.dwMajorVersion >= 4) && >> (dllVersionInfo.info1.dwMinorVersion >= 5)) >> // It's 4.5 or later... > > That looks like the kind of bug DLLVERSIONINFO2::ullVersion is > intended to avoid. I.e. this recognizes MSI 4.5 and 5.5 but > not 5.0. Good point; I hadn't thought about that (obviously). I stand corrected. |
|
|
|
#7 (permalink) |
|
Guest
Posts: n/a
|
I got my c++ codes working for this check.
Thanks all. I wish if I would write this check in c# instead. I'm a new baby in c++. "Jeff Henkels" wrote: > "Kalle Olavi Niemitalo" <kon@iki.fi> wrote in message > news:874owi7fab.fsf@Astalo.kon.iki.fi... > > "Jeff Henkels" <jeff@mapson.jeffhenkels.com> writes: > > > >> I'd do it by calling DllGetVersion in miss.dll: > >> > >> hMsi = LoadLibrary("miss.dll"); > >> pDllGetVer = GetProcAddress(hMsi, "DllGetVersion"); > > > > Surely you mean "msi.dll". > > Yes I did -- damn OE spell checker. > > > > >> DLLVERSIONINFO2 dllVersionInfo; > >> dllVersionInfo.info1.cbSize = sizeof(DLLVERSIONINFO2); > >> pDllGetVer(&dllVersionInfo); > > > > I'd perhaps use plain old DLLVERSIONINFO here, just in case some > > older versions of msi.dll don't support DLLVERSIONINFO2 and leave > > uninitialized values in the structure. Alternatively check the > > HRESULT and treat errors as too old versions. > > According to MSDN, DLLVERSIONINFO2 is supported from Windows 2000 onwards, > so we should be safe. However, your recommendation is still a good idea. > I'm usually in the "belt-and-suspenders" school when it comes to coding, but > I do tend to skip error handling when posting samples composed on the spot. > > > > >> if ((dllVersionInfo.info1.dwMajorVersion >= 4) && > >> (dllVersionInfo.info1.dwMinorVersion >= 5)) > >> // It's 4.5 or later... > > > > That looks like the kind of bug DLLVERSIONINFO2::ullVersion is > > intended to avoid. I.e. this recognizes MSI 4.5 and 5.5 but > > not 5.0. > > Good point; I hadn't thought about that (obviously). I stand corrected. > > > |
|