Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:00:17+00:00 2026-05-26T10:00:17+00:00

I am using the msi windows api to programmatically manage some installed programs. I

  • 0

I am using the msi windows api to programmatically manage some installed programs.

I have the case where I know the Product code, but I wish to find all of the Components that relate to this product.

I know how to enumerate through all of the components in the system, and to query the component’s product code. So an obvious solution is to just iterate through all of these components, and perform a string comparison on the product ids. (See the code below).

But this performs badly. On my machine this code is searching through 37,601 components to find the 8 components that match.

Is there some API call which, given the product identifier, lists just the components of that product?

do
{
    // productGuid is a std::wstring
    TCHAR componentBuffer[39];
    msiReturn = ::MsiEnumComponents(componentIndex++, componentBuffer);
    if(msiReturn != ERROR_NO_MORE_ITEMS)
    {
        TCHAR productBuffer[39];
        UINT productReturnCode = ::MsiGetProductCode(componentBuffer, productBuffer);
        if(productGuid == productBuffer)
        {
            // Add this to the matching component ids
        }
    }
}
while (msiReturn != ERROR_NO_MORE_ITEMS);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:00:18+00:00Added an answer on May 26, 2026 at 10:00 am

    Take a look at the MsiGetProductInfo function and it’s INSTALLPROPERTY_LOCALPACKAGE property. This should be able to return you a path to the cached MSI in [WindowsFolder]Installer and from there you should be able to use MsiOpenDatabase and other related functions to query the Component table to get the information you are looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using WiX (Windows Installer XML) I have created an MSI installer which installs Word
Usually, when you install an MSI package on windows, it is installed using the
I have downloaded the Python 2.7.2 Windows x86 32-bit MSI from python.org and installed
I'm building an installer using InstallScript MSI project. During installation I save some information
Does anyone know how to install IronPython 2.0 with NGEN'ed binaries using the MSI
I'm using this code to return a FileContentResult with an MSI file for the
Does anyone have a good way to build MSI (vdproj) projects using MsBuild or
Following the tutorial here , I installed Subversion 1.5.6 (Setup-Subversion-1.5.6.msi here ) on Windows
Now my team working in a project using Windows Application(C#) . We use MSI
I have a Windows form App which write to log files using log4net. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.