Go Back   PackageDeploy Application Packaging Forums > Package Development > Application Packaging > Platformsdk MSI

Reply
 
LinkBack Thread Tools Display Modes
Old 06-03-2009, 06:02 AM   #1 (permalink)
Gary Nguyen
Guest
 
Posts: n/a
Default How do I detect Window Installer 4.5 on different OS

Can someone please help me how I can detect WI 4.5 on Vista, XP, Server 2003?
Prefer registry detection.

Thanks
  Reply With Quote
Old 06-03-2009, 06:02 AM   #2 (permalink)
Jeff Henkels
Guest
 
Posts: n/a
Default Re: How do I detect Window Installer 4.5 on different OS

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



  Reply With Quote
Old 06-03-2009, 06:02 AM   #3 (permalink)
Gary Nguyen
Guest
 
Posts: n/a
Default Re: How do I detect Window Installer 4.5 on different OS

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

>
>
>

  Reply With Quote
Old 06-03-2009, 06:02 AM   #4 (permalink)
Richard [Microsoft Windows Installer MVP]
Guest
 
Posts: n/a
Default Re: How do I detect Window Installer 4.5 on different OS

[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/>
  Reply With Quote
Old 06-03-2009, 06:02 AM   #5 (permalink)
Kalle Olavi Niemitalo
Guest
 
Posts: n/a
Default Re: How do I detect Window Installer 4.5 on different OS

"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.
  Reply With Quote
Old 06-03-2009, 06:02 AM   #6 (permalink)
Jeff Henkels
Guest
 
Posts: n/a
Default Re: How do I detect Window Installer 4.5 on different OS

"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.


  Reply With Quote
Old 06-03-2009, 06:02 AM   #7 (permalink)
Gary Nguyen
Guest
 
Posts: n/a
Default Re: How do I detect Window Installer 4.5 on different OS

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.
>
>
>

  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:39 PM.


vBulletin, Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
2007 - 2012 PackageDeploy.com