Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
msienumproducts (msi)
 
.
Summary
The MsiEnumProducts function enumerates through all the products currently advertised or installed. Both per-user and per-machine installations and advertisements are enumerated.

C# Signature:

[DllImport("msi.dll", SetLastError=true)]
static extern int MsiEnumProducts(int iProductIndex, StringBuilder lpProductBuf);

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    using System;
    using System.Text;
    using System.Runtime.InteropServices;

    static class Program
    {
        [DllImport("msi.dll", SetLastError = true)]
        static extern int MsiEnumProducts(int iProductIndex, StringBuilder lpProductBuf);

        public enum MSI_ERROR : int
        {
            ERROR_SUCCESS = 0,
            ERROR_MORE_DATA = 234,
            ERROR_NO_MORE_ITEMS = 259,
            ERROR_INVALID_PARAMETER = 87,
            ERROR_BAD_CONFIGURATION = 1610,
        }

        [STAThread]
        static void Main()
        {
            StringBuilder sb = new StringBuilder(39);
            MSI_ERROR error = MSI_ERROR.ERROR_SUCCESS;
            for (int index = 0; error == MSI_ERROR.ERROR_SUCCESS; index++)
            {
                error = (MSI_ERROR) MsiEnumProducts(index, sb);
                string productID = sb.ToString();
                if (error == MSI_ERROR.ERROR_SUCCESS)
                {
                    Console.WriteLine("ProductID=" + productID);
                }
            }
        }
    }

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions