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

SetupDiClassNameFromGuid (setupapi)
 
.
Summary
The SetupDiClassNameFromGuid function retrieves the class name associated with a class GUID.

C# Signature:

[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetupDiClassNameFromGuid(
    Guid ClassGuid,
    StringBuilder ClassName,
    UInt32 ClassNameSize,
    out UInt32 RequiredSize
    );

[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]

static extern bool SetupDiClassNameFromGuid(

        Guid ClassGuid,
        StringBuilder ClassName,
        UInt32 ClassNameSize,
        out UInt32 RequiredSize);

Parameters

ClassGuid

The class GUID for the class name to retrieve.

ClassName

A pointer to a buffer that receives the NULL-terminated string that contains the name of the class that is specified by the pointer in the ClassGuid parameter.

ClassNameSize

The size, in characters, of the buffer that is pointed to by the ClassName parameter. The maximum size, in characters, of a NULL-terminated class name is MAX_CLASS_NAME_LEN. For more information about the class name size, see the following Comments section.

RequiredSize

A pointer to a variable that receives the number of characters that are required to store the requested NULL-terminated class name. This pointer is optional and can be NULL.

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

  StringBuilder className = null;
  uint classNameLen;
  SetupDiClassNameFromGuid(setupClass, className, 0, out classNameLen);
  className = new StringBuilder((int)classNameLen);
  if (!SetupDiClassNameFromGuid(setupClass, className, classNameLen, out classNameLen))
  {
    // Handle the error.
  }
  else
  {
    // Use the class name, e.g. Console.WriteLine(className.ToString());
  }

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