[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetupDiClassNameFromGuid(
Guid ClassGuid,
StringBuilder ClassName,
UInt32 ClassNameSize,
out UInt32 RequiredSize);
Parameters
The class GUID for the class name to retrieve.
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.
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.
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.
None.
Do you know one? Please contribute it!
None.
Please add some!
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());
}