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

Find out if a component is already installed


3 replies to this topic

DeusApprime

DeusApprime
  • Members
  • 73 posts

Posted 01 November 2001 - 13:54

Hi,
I am trying to do the following:
1. Determine if a certain component (not product!) is already installed.
2. If it is installed, then at the beginning of the setup, I wish to set a property to X, otherwise set it to Y (X and Y are example values).
3. Also, there is a possibility that the above property should be set to a value that resides in the registry (a value that is not constant like X or Y). The registry path is known, of course.

I don't know where exactly to begin. Any suggestions?


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 01 November 2001 - 14:30

Use the component locator.

CompLocator table
_Signature    sigTheComp
ComponentId   {Guid of the component}
Type   1

AppSearch Table
Property  MYCOMPPROPERTY
Signature_  sigTheComp

MYCOMPPROPERTY will be set if the component is present.

I am not sure if this will work if the component belongs to another product  alone.  In this case you can write a custom action that calls MsiLocateComponent that will find it.


DeusApprime

DeusApprime
  • Members
  • 73 posts

Posted 04 November 2001 - 08:50

Thanks. How do I get the component code I need? I looked in the registry, but the GUIDs there are packed and the bit order there is different than in the IDE. Is there a way to convert a packed GUID to a regular {xx-xx-xx-xx} format GUID?

DeusApprime

DeusApprime
  • Members
  • 73 posts

Posted 04 November 2001 - 10:07

Oops. Nevermind. found out the structure and wrote a little program to convert. If anyone's interested, this is the code:

int main(int argc, char* argv[])
{
   char unpacked[38];
   char* s=argv[1];

   sprintf(unpacked,
       "{%c%c%c%c%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c%c%c%c%c%c%c%c%c}",
       s[7],s[6],s[5],s[4],s[3],s[2],s[1],s[0],
       s[11],s[10],s[9],s[8],
       s[15],s[14],s[13],s[12],
       s[17],s[16],s[19],s[18],
       s[21],s[20],s[23],s[22],s[25],s[24],s[27],s[26],s[29],s[28],s[31],s[30]
       );

  printf("%s",unpacked);
return 0;
}