cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
buckshaw
Level 2

find ms component ID in registry?

Hello,

How do I find a MS componet ID in the registry?

Need to set a condition on a prerequisite. A simple find this key / value eludes me.

I have a MS Component ID like this:

PACKAGE: Visual Studio 2005 Tools for Office Language Pack
PRODUCT CODE: {5DB161C0-7C9C-41D7-8DA1-CB112F60946B}
COMPONENT ID: {2E3A394E-C9BD-40C3-9990-BA7AF7C8B4AF}


>>> Simply, I would like to check the registry to see if COMPONENT ID exists. Seems easy enough, I looked all over and can not finger it.

I need to doo this for a few items like the office 2003 PIA assemblies etc . . .

These codes do not seem to show up in a registry search as text, but the componentcheck.exe file does find them (or not)


In the past I have used componentcheck.exe and passed in the parameters. This is a MS thing used with MSI, found as an example in installing vsto applications examples. Link: http://msdn.microsoft.com/en-us/library/bb332051.aspx


The cpp code for componentcheck.exe is this:

int APIENTRY _tWinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UINT errCode = 0;
HMODULE hMsiLib = LoadLibrary(_T("MSI.DLL"));
if (hMsiLib == NULL)
{
errCode = GetLastError();
if (errCode == 0) // make sure the error code is not 0
errCode = ERROR_MOD_NOT_FOUND;
}
else
{
FMsiLocateComponent pfnMsiLocateComponent = (FMsiLocateComponent)GetProcAddress(hMsiLib, FUNCNAME_MsiLocateComponent);
if (pfnMsiLocateComponent == NULL)
{
errCode = GetLastError();
if (errCode == 0) // make sure the error code is not 0
errCode = ERROR_PROC_NOT_FOUND;
}
else
{
// Loop through the specified components in the arguments.
for (int i = 1; i < __argc; i++)
{
LPCTSTR szComponentCode = __targv;
INSTALLSTATE state = (*pfnMsiLocateComponent)(szComponentCode, NULL, 0);
if (state != INSTALLSTATE_LOCAL)
{
errCode = ERROR_UNKNOWN_COMPONENT;
break;
}
}
}
}

if (hMsiLib != NULL)
{
FreeLibrary(hMsiLib);
}
return errCode;
}


Sour Notes:
Odd such a big forum does not have answers, many have asked about this with no real solutions posted. I noticed there are many valid posts / questions with 0 answers - replies.

So what is it? Possibly paid support is so good that they answer via a ticket submission and the forum never gets the update or ... well . . . if you do not have nothing good to say . . .
Labels (1)
0 Kudos
(1) Reply
RobertDickau
Flexera Alumni

A system search supports searching for a component, but that runs after setup prerequisites, of course. For a prerequisite's condition, perhaps look at KB article Q105971, and check for the existence of the transformed GUID in the registry?
0 Kudos