Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Using MsiGetProductInfo to get installation path


13 replies to this topic

Annie

Annie
  • Members
  • 7 posts

Posted 27 September 2002 - 08:31

I want to get the installation path on a already installed product. I use MsiGetProductInfo function but I always get an error ERROR_MORE_DATA.
I try to increase the buffer lenght but it has no effect ??
iState = MsiGetProductInfo(
"{C01A0196-D15D-11D6-8071-0050DA398C60}",   INSTALLPROPERTY_INSTALLLOCATION,
szValueBuf,
iValueCount);
Thank you for your help.
Annie.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 September 2002 - 10:08

Did you also increase iValueCount?

Annie

Annie
  • Members
  • 7 posts

Posted 27 September 2002 - 10:22

No, I have only declared and the value is equal to 0.
Annie.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 September 2002 - 10:39

You must set it to the size of your buffer.

Annie

Annie
  • Members
  • 7 posts

Posted 27 September 2002 - 12:36

It works when setting the value to the buffer size.
But the function returns 0 in the buffer size ?!?
I put the function call in the maintenance mode to get the previous installation path when modifying installation.
Do you have an idea ??
Thank you.
Annie.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 September 2002 - 13:32

Depending on your programming language you will have to pass in a pointer to the buffer size.

Annie

Annie
  • Members
  • 7 posts

Posted 27 September 2002 - 14:12

I use InstallShield Developper 7 and szValueBuf is a string variable as declared in the GetProductInfo prototype. So I don't know what's wrong ?
Annie.

vips

vips
  • Members
  • 9 posts

Posted 19 November 2003 - 14:00

Hi all,

I have the same problem:

DWORD bufLen = MAX_PATH;
LPTSTR pBuff = m_strRootPath.GetBuffer(bufLen);

if (pBuff!=NULL)
{
UINT retCode = MsiGetProductInfo(m_strProdCode,
INSTALLPROPERTY_INSTALLLOCATION,
pBuff,&bufLen);

After executing this code:
retCode = 0 (ERROR_SUCCESS)
bufLen = 0
pBuff = ""

Other properties works OK with this code dry.gif

What's wrong ? Isn't something changed since the last post (about a year ago) mad.gif

Is there some other method of getting the product path? unsure.gif

Thank you,
Valery blink.gif

vips

vips
  • Members
  • 9 posts

Posted 19 November 2003 - 15:38

It seems I've found the answer:

The function MsiGetProductInfo returns info from the following registry key:

HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\UserData\S-x-x-x\Products\<Package code>\InstalProperties\

The registry value "InstallLocation" was empty when I tryed to get the install path with MsiGetProductInfo. I typed manually some letters to this value and - oops ! I got these letters in my program biggrin.gif

Searching info for this topic I found some considerations about that:

Someone tells that this value must be explicitly set during the last installation stage by using scripts...

Anyway, its seems to be a good solution to place the installation path as the registry value under

HKLM\Software\[Manufacturer]\[ProductCode] = [INSTALLDIR]

wink.gif

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 20 November 2003 - 09:05

I believe this will be set automatically if you set the ARPINSTALLLOCATION property in your setup properly.

vips

vips
  • Members
  • 9 posts

Posted 20 November 2003 - 09:42

But it seems there is no way to set this property in InstallShield Express 3.5

MSDN tells about this propery:

"Typically needs to be set by a custom action" sad.gif

Edited by vips, 20 November 2003 - 09:44.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 20 November 2003 - 09:51

This should happen automatically, at least in the later Express versions (not sure about 3.5). YOu could add a custom action that sets the ARPINSTALLLOCATION property to [INSTALLDIR]

vips

vips
  • Members
  • 9 posts

Posted 20 November 2003 - 10:32

The custom action is the real solution of this in the case of IS Express 3.5, Thank you smile.gif

I've tested InstallShield Developer 8.0 - it puts this property automaticaly though even don't show it in the property table

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 20 November 2003 - 12:03

Developer automatically adds such a custom action behind the scenes.