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
Download Visual Studio Add-In

SetupDiBuildClassInfoList (setupapi)
 
.
Summary
The SetupDiBuildClassInfoList function returns a list of setup class GUIDs that identify the classes that are installed on a local machine.

C# Signature:

[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetupDiBuildClassInfoList(
        UInt32 Flags,
        [In, Out] Guid[] ClassGuidList,
        UInt32 ClassGuidListSize,
        out UInt32 RequiredSize);

Parameters

Flags

Flags used to control exclusion of classes from the list. If no flags are specified, all setup classes are included in the list. Can be a combination of the following values:

DIBCI_NOINSTALLCLASS // Exclude a class if it has the NoInstallClass value entry in its registry key.

DIBCI_NODISPLAYCLASS // Exclude a class if it has the NoDisplayClass value entry in its registry key.

ClassGuidList

A GUID array that receives a list of setup class GUIDs. This pointer is optional and can be NULL.

ClassGuidListSize

The number of GUIDs in the array that is pointed to by the ClassGuildList parameter. If ClassGuidList is NULL, ClassGuidSize must be zero.

RequiredSize

A pointer to a DWORD-typed variable that receives the number of GUIDs that are returned (if the number is less than or equal to the size, in GUIDs, of the array that is pointed to by the ClassGuidList parameter). If this number is greater than the size of the ClassGuidList array, it indicates how large the ClassGuidList array must be to contain all of the class GUIDs.

Return Value

The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to Marshal.GetLastWin32Error().

User-Defined Types:

const uint DIBCI_NOINSTALLCLASS = 0x00000001;
const uint DIBCI_NODISPLAYCLASS = 0x00000002;

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

  uint setupClassNum = 0;
  Guid[] setupClasses = null;
  SetupDiBuildClassInfoList(0, setupClasses, 0, out setupClassNum);
  setupClasses = new Guid[setupClassNum];
  if (!WinAPI.SetupDiBuildClassInfoList(WinAPI.DIBCI.NONE, setupClasses, setupClassNum, out setupClassNum))
  {
    // Handle the error
  }

  // Enumerate the devices in each class.
  foreach (Guid setupClass in setupClasses)
  {
    // Do something with the class, e.g. get class name using SetupDiClassNameFromGuid() and
    // enumerating devices in class using SetupDiGetClassDevs()
  }

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