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

Search Results for "GUID" in [All]

ntdsapi

.

      // String-ized GUID as returned by IIDFromString().

.
Summary
.

    internal static extern void DsFreeSchemaGuidMap(

.

        IntPtr pGuidMap);

.

Declare Function DsFreeSchemaGuidMap Lib "ntdsapi.dll" (TODO) As TODO

.

        result = DsMapSchemaGuids(phDS, (uint)myGuids.Length, myGuids, out guidMap);

.

        DsFreeSchemaGuidMap(guidMap);

.
Documentation
[DsFreeSchemaGuidMap] on MSDN
.

    public struct GUID

.

        public GUID SiteObjectGuid;

.

        public GUID ComputerObjectGuid;

.

        public GUID ServerObjectGuid;

.

        public GUID NtdsDsaObjectGuid;

.

    internal static extern uint DsMapSchemaGuids(

.

        uint cGuids,

.

        Guid[] rGuids,

.

        out IntPtr ppGuidMap);

.

    Friend Shared Function DsMapSchemaGuids(hDs As IntPtr, cGuids As UInteger, rGuids As Guid(), ByRef ppGuidMap As IntPtr) As UInteger

.

Requires DsBind, recommend DsUnBind and DsFreeSchemaGuidMap

.

        IntPtr guidMap = new IntPtr(0);

.

        Guid[] myGuids = {

.

        new Guid("{e0fa1e69-9b45-11d0-afdd-00c04fd930c9}"),

.

        new Guid("{771727b1-31b8-4cdf-ae62-4fe39fadf89e}"),

.

        new Guid("{d5eb2eb7-be4e-463b-a214-634a44d7392e}"),

.

        new Guid("{e0fa1e8c-9b45-11d0-afdd-00c04fd930c9}")

.

        result = DsMapSchemaGuids(phDS, (uint)myGuids.Length, myGuids, out guidMap);

.

        DS_SCHEMA_GUID_MAP[] guidMapResult = parseGuids(guidMap, myGuids.Length, true);

.

        for (int i = 0; i < guidMapResult.Length; i++)

.

            Console.WriteLine("{0} = {1}", myGuids[i], guidMapResult[i].pName);

.

    internal static extern uint DsMapSchemaGuids(

.

        uint cGuids,

.

        Guid[] rGuids,

.

        out IntPtr ppGuidMap);

.

    internal static extern void DsFreeSchemaGuidMap(

.

        IntPtr pGuidMap);

.

    internal class GUID

.

    internal struct DS_SCHEMA_GUID_MAP

.

        internal GUID guid;

.

        internal uint guidType;

.

    private static DS_SCHEMA_GUID_MAP[] parseGuids(IntPtr guidMap, int numGuids, bool freePointer)

.

        int typeSize = Marshal.SizeOf(typeof(DS_SCHEMA_GUID_MAP));

.

        DS_SCHEMA_GUID_MAP[] schemaMap = new DS_SCHEMA_GUID_MAP[numGuids];

.

        IntPtr guidPointer = guidMap;

.

        for (int i = 0; i < numGuids; i++)

.

        schemaMap[i] = (DS_SCHEMA_GUID_MAP)Marshal.PtrToStructure(

.

                (long)guidPointer + i * typeSize

.

                typeof(DS_SCHEMA_GUID_MAP)

.

        DsFreeSchemaGuidMap(guidPointer);

.
Documentation
[DsMapSchemaGuids] on MSDN

rpcrt4

.

static extern int UuidCreateSequential(out Guid guid);

.

Declare Function UuidCreateSequential Lib "rpcrt4.dll" (ByRef id As Guid) As Integer

.

Microsoft changed the UuidCreate function so it no longer uses the machine's MAC address as part of the UUID. Since CoCreateGuid calls UuidCreate to get its GUID, its output also changed. If you still like the GUIDs to be generated in sequential order (helpful for keeping a related group of GUIDs together in the system registry), you can use the UuidCreateSequential function.

.

CoCreateGuid generates random-looking GUIDs like these:

.

UuidCreateSequential generates sequential GUIDs like these:

.
  • Several GUIDs generated in a row are sequential
.

static Guid UuidCreateSequential()

.

   Guid g;

.

   Dim myId As Guid

.

static extern int UuidCreateSequential(out Guid guid);

.

Declare Function UuidCreateSequential Lib "rpcrt4.dll" (ByRef id As Guid) As Integer

.

Microsoft changed the UuidCreate function so it no longer uses the machine's MAC address as part of the UUID. Since CoCreateGuid calls UuidCreate to get its GUID, its output also changed. If you still like the GUIDs to be generated in sequential order (helpful for keeping a related group of GUIDs together in the system registry), you can use the UuidCreateSequential function.

.

CoCreateGuid generates random-looking GUIDs like these:

.

UuidCreateSequential generates sequential GUIDs like these:

.
  • Several GUIDs generated in a row are sequential
.

static Guid UuidCreateSequential()

.

   Guid g;

.

   Dim myId As Guid

.

typedef struct _GUID {

Enums

.

    public static PropertyKey UI_PKEY_Enabled = new PropertyKey(new Guid(Convert.ToString(1, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_BOOL);

.

    public static PropertyKey UI_PKEY_LabelDescription = new PropertyKey(new Guid(Convert.ToString(2, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_Keytip = new PropertyKey(new Guid(Convert.ToString(3, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_Label = new PropertyKey(new Guid(Convert.ToString(4, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_TooltipDescription = new PropertyKey(new Guid(Convert.ToString(5, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_TooltipTitle = new PropertyKey(new Guid(Convert.ToString(6, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_LargeImage = new PropertyKey(new Guid(Convert.ToString(7, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IUIImage

.

    public static PropertyKey UI_PKEY_LargeHighContrastImage = new PropertyKey(new Guid(Convert.ToString(8, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IUIImage

.

    public static PropertyKey UI_PKEY_SmallImage = new PropertyKey(new Guid(Convert.ToString(9, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IUIImage

.

    public static PropertyKey UI_PKEY_SmallHighContrastImage = new PropertyKey(new Guid(Convert.ToString(10, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IUIImage

.

    internal static PropertyKey UI_PKEY_CommandId = new PropertyKey(new Guid(Convert.ToString(100, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4);

.

    internal static PropertyKey UI_PKEY_ItemsSource = new PropertyKey(new Guid(Convert.ToString(101, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IEnumUnknown or IUICollection

.

    internal static PropertyKey UI_PKEY_Categories = new PropertyKey(new Guid(Convert.ToString(102, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IEnumUnknown or IUICollection

.

    internal static PropertyKey UI_PKEY_CategoryId = new PropertyKey(new Guid(Convert.ToString(103, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4);

.

    internal static PropertyKey UI_PKEY_SelectedItem = new PropertyKey(new Guid(Convert.ToString(104, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4);

.

    internal static PropertyKey UI_PKEY_CommandType = new PropertyKey(new Guid(Convert.ToString(105, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4);

.

    internal static PropertyKey UI_PKEY_ItemImage = new PropertyKey(new Guid(Convert.ToString(106, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IUIImage

.

    public static PropertyKey UI_PKEY_BooleanValue = new PropertyKey(new Guid(Convert.ToString(200, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_BOOL);

.

    public static PropertyKey UI_PKEY_DecimalValue = new PropertyKey(new Guid(Convert.ToString(201, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_DECIMAL);

.

    public static PropertyKey UI_PKEY_StringValue = new PropertyKey(new Guid(Convert.ToString(202, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_MaxValue = new PropertyKey(new Guid(Convert.ToString(203, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_DECIMAL);

.

    public static PropertyKey UI_PKEY_MinValue = new PropertyKey(new Guid(Convert.ToString(204, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_DECIMAL);

.

    public static PropertyKey UI_PKEY_Increment = new PropertyKey(new Guid(Convert.ToString(205, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_DECIMAL);

.

    public static PropertyKey UI_PKEY_DecimalPlaces = new PropertyKey(new Guid(Convert.ToString(206, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4);

.

    public static PropertyKey UI_PKEY_FormatString = new PropertyKey(new Guid(Convert.ToString(207, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_RepresentativeString = new PropertyKey(new Guid(Convert.ToString(208, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_FontProperties = new PropertyKey(new Guid(Convert.ToString(300, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IPropertyStore

.

    public static PropertyKey UI_PKEY_FontProperties_Family = new PropertyKey(new Guid(Convert.ToString(301, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_FontProperties_Size = new PropertyKey(new Guid(Convert.ToString(302, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_DECIMAL);

.

    public static PropertyKey UI_PKEY_FontProperties_Bold = new PropertyKey(new Guid(Convert.ToString(303, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_FONTPROPERTIES

.

    public static PropertyKey UI_PKEY_FontProperties_Italic = new PropertyKey(new Guid(Convert.ToString(304, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_FONTPROPERTIES

.

    public static PropertyKey UI_PKEY_FontProperties_Underline = new PropertyKey(new Guid(Convert.ToString(305, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_FONTPROPERTIES

.

    public static PropertyKey UI_PKEY_FontProperties_Strikethrough = new PropertyKey(new Guid(Convert.ToString(306, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_FONTPROPERTIES

.

    public static PropertyKey UI_PKEY_FontProperties_VerticalPositioning = new PropertyKey(new Guid(Convert.ToString(307, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_FONTVERTICALPOSITION

.

    public static PropertyKey UI_PKEY_FontProperties_ForegroundColor = new PropertyKey(new Guid(Convert.ToString(308, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // COLORREF

.

    public static PropertyKey UI_PKEY_FontProperties_BackgroundColor = new PropertyKey(new Guid(Convert.ToString(309, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // COLORREF

.

    public static PropertyKey UI_PKEY_FontProperties_ForegroundColorType = new PropertyKey(new Guid(Convert.ToString(310, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_SWATCHCOLORTYPE

.

    public static PropertyKey UI_PKEY_FontProperties_BackgroundColorType = new PropertyKey(new Guid(Convert.ToString(311, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_SWATCHCOLORTYPE

.

    public static PropertyKey UI_PKEY_FontProperties_ChangedProperties = new PropertyKey(new Guid(Convert.ToString(312, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UNKNOWN); // IPropertyStore

.

    public static PropertyKey UI_PKEY_FontProperties_DeltaSize = new PropertyKey(new Guid(Convert.ToString(313, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UINT); // UI_FONTDELTASIZE

.

    public static PropertyKey UI_PKEY_RecentItems = new PropertyKey(new Guid(Convert.ToString(350, 16).PadLeft(8, '0') + UI_PropertyKey), (int)(VarEnum.VT_ARRAY | VarEnum.VT_UNKNOWN));

.

    public static PropertyKey UI_PKEY_Pinned = new PropertyKey(new Guid(Convert.ToString(351, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_BOOL);

.

    public static PropertyKey UI_PKEY_Color = new PropertyKey(new Guid(Convert.ToString(400, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // COLORREF

.

    public static PropertyKey UI_PKEY_ColorType = new PropertyKey(new Guid(Convert.ToString(401, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_SWATCHCOLORTYPE

.

    public static PropertyKey UI_PKEY_ColorMode = new PropertyKey(new Guid(Convert.ToString(402, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_SWATCHCOLORMODE

.

    public static PropertyKey UI_PKEY_ThemeColorsCategoryLabel = new PropertyKey(new Guid(Convert.ToString(403, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_StandardColorsCategoryLabel = new PropertyKey(new Guid(Convert.ToString(404, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_RecentColorsCategoryLabel = new PropertyKey(new Guid(Convert.ToString(405, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_AutomaticColorLabel = new PropertyKey(new Guid(Convert.ToString(406, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_NoColorLabel = new PropertyKey(new Guid(Convert.ToString(407, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_MoreColorsLabel = new PropertyKey(new Guid(Convert.ToString(408, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_LPWSTR);

.

    public static PropertyKey UI_PKEY_ThemeColors = new PropertyKey(new Guid(Convert.ToString(409, 16).PadLeft(8, '0') + UI_PropertyKey), (int)(VarEnum.VT_VECTOR | VarEnum.VT_UI4));

.

    public static PropertyKey UI_PKEY_StandardColors = new PropertyKey(new Guid(Convert.ToString(400, 16).PadLeft(8, '0') + UI_PropertyKey), (int)(VarEnum.VT_VECTOR | VarEnum.VT_UI4));

.

    public static PropertyKey UI_PKEY_ThemeColorsTooltips = new PropertyKey(new Guid(Convert.ToString(411, 16).PadLeft(8, '0') + UI_PropertyKey), (int)(VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR));

.

    public static PropertyKey UI_PKEY_StandardColorsTooltips = new PropertyKey(new Guid(Convert.ToString(412, 16).PadLeft(8, '0') + UI_PropertyKey), (int)(VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR));

.

    public static PropertyKey UI_PKEY_Viewable = new PropertyKey(new Guid(Convert.ToString(1000, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_BOOL);

.

    public static PropertyKey UI_PKEY_Minimized = new PropertyKey(new Guid(Convert.ToString(1001, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_BOOL);

.

    public static PropertyKey UI_PKEY_QuickAccessToolbarDock = new PropertyKey(new Guid(Convert.ToString(1002, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4);

.

    public static PropertyKey UI_PKEY_ContextAvailable = new PropertyKey(new Guid(Convert.ToString(1100, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4);

.

    public static PropertyKey UI_PKEY_GlobalBackgroundColor = new PropertyKey(new Guid(Convert.ToString(2000, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_HSBCOLOR

.

    public static PropertyKey UI_PKEY_GlobalHighlightColor = new PropertyKey(new Guid(Convert.ToString(2001, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_HSBCOLOR

.

    public static PropertyKey UI_PKEY_GlobalTextColor = new PropertyKey(new Guid(Convert.ToString(2002, 16).PadLeft(8, '0') + UI_PropertyKey), (int)VarEnum.VT_UI4); // UI_HSBCOLOR

.

  // String-ized GUID as returned by IIDFromString().

.

    ///The Active Directory GUID is unavailable and cannot be added to the Subject Alternate name.

.

    [Description("The Active Directory GUID is unavailable and cannot be added to the Subject Alternate name.")]

.

    public const int CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED = unchecked((int)0x8009480E);

.

    ///A CLSID with the same GUID as the new application ID is already installed on this machine

.

    [Description("A CLSID with the same GUID as the new application ID is already installed on this machine")]

.

    '''The Active Directory GUID is unavailable and cannot be added to the Subject Alternate name.

.

    <Description("The Active Directory GUID is unavailable and cannot be added to the Subject Alternate name.")> _

.

    Public Const CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED As Integer = CInt(&H8009480eUI)

.

    '''A CLSID with the same GUID as the new application ID is already installed on this machine

.

    <Description("A CLSID with the same GUID as the new application ID is already installed on this machine")> _

.

    TooManyGuidsRequested = 0xc0000082,

.

    GuidsExhausted = 0xc0000083,

.

    GuidPartitionTable = 1,

.

   /// user policy. See Print Management Step-by-Step Guide.

.

   /// computer policy. See Print Management Step-by-Step Guide.

.

    SE_WMIGUID_OBJECT,

.

    SE_WMIGUID_OBJECT

15: SPDRP
.

    /// Class (R--tied to ClassGUID)

.

    /// ClassGUID (R/W)

.

    SPDRP_CLASSGUID = 0x00000008,

.

    /// BusTypeGUID (R)

.

    SPDRP_BUSTYPEGUID = 0x00000013,

16: SPDRP
.

    SPDRP_CLASSGUID = 0x8,

.

    SPDRP_BUSTYPEGUID = 0x13,

.

    SPDRP_CLASSGUID = &H8

.

    SPDRP_BUSTYPEGUID = &H13

setupapi

.

Guid DiskGUID = new Guid(GUID_DEVINTERFACE_DISK);

.

// devices that match the interface GUID of a disk

.

IntPtr h = SetupDiGetClassDevs(ref DiskGUID, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);

.

     Success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref DiskGUID, i, ref dia);

.

Private Type GUID

.

InterfaceClassGuid As GUID

.

Alias “SetupDiGetClassDevsA” (GuidPtr As Long, _

.

ByVal InfoPtr As Long, GuidPtr As Long, _

.

Dim PrnGuid As GUID

.

PrnGuid.Data1 = &H28D78FAD

.

PrnGuid.Data2 = &H5A12

.

PrnGuid.Data3 = &H11D1

.

PrnGuid.Data4(0) = &HAE

.

PrnGuid.Data4(1) = &H5B

.

PrnGuid.Data4(2) = &H0

.

PrnGuid.Data4(3) = &H0

.

PrnGuid.Data4(4) = &HF8

.

PrnGuid.Data4(5) = &H3

.

PrnGuid.Data4 = &HA8

.

PrnGuid.Data4(7) = &HC2

.

PnPHandle = SetupDiGetClassDevs(PrnGuid.Data1, 0, 0, _

.

If SetupDiEnumDeviceInterfaces(PnPHandle, 0, PrnGuid.Data1, _

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

        [In, Out] Guid[] ClassGuidList,

.

        UInt32 ClassGuidListSize,

.

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.

.

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.

.

  Guid[] setupClasses = null;

.

  setupClasses = new Guid[setupClassNum];

.

  foreach (Guid setupClass in setupClasses)

.

    // Do something with the class, e.g. get class name using SetupDiClassNameFromGuid() and

.
Summary
Retrieves the Class GUID for a device based on the name
.

static extern bool SetupDiClassGuidsFromName(string ClassName, ref Guid ClassGuidArray1stItem, UInt32 ClassGuidArraySize, out UInt32 RequiredSize);

.

    Private Shared Function SetupDiClassGuidsFromName( _

.

    ByRef ClassGuids As Guid, _

.

    ByVal ClassGuidSize As Integer, _

.

    ByRef ClassGuidRequiredSize As Integer) As Boolean

.

    Guid[] GuidArray = new Guid[1];

.

    // read Guids

.

    bool Status = SetupDiClassGuidsFromName("class name here", ref GuidArray[0], 1, out RequiredSize);

.

        GuidArray = new Guid[RequiredSize];

.

        SetupDiClassGuidsFromName("class name here", ref GuidArray[0], RequiredSize, out RequiredSize);

.

    Dim ClassGuid As Guid

.

    Dim GuidSize As Integer = 0

.

    Dim GuidReqtSize As Integer

.

    intRtrn = SetupDiClassGuidsFromName(ClassName, ClassGuid, GuidSize, GuidReqtSize)

.

    GuidSize = GuidReqtSize

.

    intRtrn = SetupDiClassGuidsFromName(ClassName, ClassGuid, GuidSize, GuidReqtSize)

.

    MsgBox(ClassGuid.ToString)

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

static extern bool SetupDiClassNameFromGuid(

.

    Guid ClassGuid,

.

ClassGuid

.

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.

.

  SetupDiClassNameFromGuid(setupClass, className, 0, out classNameLen);

.

  if (!SetupDiClassNameFromGuid(setupClass, className, classNameLen, out classNameLen))

.
Documentation
[SetupDiClassNameFromGuid] on MSDN
.

   ref Guid interfaceClassGuid,

.

   ref Guid interfaceClassGuid,

.

    ByRef devInfo As SP_DEVICE_INTERFACE_DATA, ByRef interfaceClassGuid As Guid, _

.

    ByRef InterfaceClassGuid As Guid, _

.

bool result = Win32Calls.SetupDiEnumDeviceInterfaces(ipDeviceHndl, iLU, ref DeviceGUID, 0, ref devData);

.

The DeviceGUID parameter will be device dependent. Look in the Manufacturer's SDK or API for the correct guid for your device.

.

    public static extern IntPtr SetupDiGetClassDevs(ref Guid classGuid, IntPtr enumerator, IntPtr hwndParent, UInt32 flags);

.

    public static extern Boolean SetupDiEnumDeviceInterfaces(IntPtr hDevInfo, IntPtr devInfo, ref Guid interfaceClassGuid, UInt32 memberIndex, ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData);

.

Guid DiskGUID = new Guid(GUID_DEVINTERFACE_DISK);

.

// devices that match the interface GUID of a disk

.

IntPtr h = SetupDiGetClassDevs(ref DiskGUID, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);

.

     Success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref DiskGUID, i, ref dia);

.

                                              ref Guid ClassGuid,

.

This signature has the drawback that it does not allow passing a null pointer as the first parameter, which is one of the common usages cited at [SetupDiGetClassDevs]: "To return devices for all device setup classes, set the DIGCF_ALLCLASSES flag, and set the ClassGuid parameter to NULL."

.

static extern IntPtr SetupDiGetClassDevs(           // 1st form using a ClassGUID only, with null Enumerator

.

   ref Guid ClassGuid,

.

[DllImport("setupapi.dll", CharSet = CharSet.Auto)]     // 2nd form uses an Enumerator only, with null ClassGUID

.

   IntPtr ClassGuid,

.

The signatures above allow substitution of a null by specifying IntPtr.Zero as one of the first two parameters. They must use IntPtrs for the Enumerator and ClassGuid parameters, instead of int or Int32, or they will not work on 64-bit platforms.

.

    ByRef ClassGuid As GUID, _

.

    ByRef ClassGuid As GUID, _

.

    ByRef ClassGuid As Guid, _

.

Guid GUID_DEVINTERFACE_DISK = new Guid(0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);

.

Guid DiskGUID = new Guid(GUID_DEVINTERFACE_DISK);

.

// devices that match the interface GUID of a disk

.

IntPtr h = SetupDiGetClassDevs(ref DiskGUID, IntPtr.Zero, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);

.

     Success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref DiskGUID, i, ref dia);

.

        Public ClassGuid As Guid

.

Guid DiskGUID = new Guid(GUID_DEVINTERFACE_DISK);

.

// devices that match the interface GUID of a disk

.

IntPtr h = SetupDiGetClassDevs(ref DiskGUID, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);

.

     Success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref DiskGUID, i, ref dia);

.

'goes through all devices matching the HID guid and finds one with a registry entry string matching the name of the desired HID device, in this case a Midi device

.

    Dim myGuid As Guid

.

    Call HidD_GetHidGuid(myGuid)

.

    h = SetupDiGetClassDevs(myGuid, 0, IntPtr.Zero, DIGCF_PRESENT + DIGCF_DEVICEINTERFACE) '

.

        devEnumInterfaceResult = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, myGuid, i, dia)

.

     SPDRP_CLASS               = 0x00000007, // Class (R--tied to ClassGUID)

.

     SPDRP_CLASSGUID           = 0x00000008, // ClassGUID (R/W)

.

     SPDRP_BUSTYPEGUID         = 0x00000013, // BusTypeGUID (R)

.

Guid DiskGUID = new Guid(GUID_DEVINTERFACE_DISK);

.

// devices that match the interface GUID of a disk

.

IntPtr h = SetupDiGetClassDevs(ref DiskGUID, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);

.

     Success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref DiskGUID, i, ref dia);

.

    ByRef ClassGuid As GUID, _

.

    public Guid ClassGuid;

.

    public Guid ClassGuid;

.
InfClass Optional pointer to a null-terminated string containing the class of INF file desired. This string must match the Class value of the Version section (for example, Class=Net). If there is no entry in the Class value, but there is an entry for ClassGUID in the Version section, the corresponding class name for that GUID is retrieved and used for the comparison.
.

Since there may be more than one class GUID with the same class name, callers interested in INF files of a particular class (that is, a particular class GUID) should retrieve the ClassGUID value from the INF file by calling SetupQueryInfVersionInformation.

rasapi32

.

    public Guid guidEntry;

.

    public Guid luid;                                                    

.

          public Guid    guidId;

oleaut32

.

static extern int GetActiveObject(ref Guid rclsid, IntPtr pvReserved,

.

static extern void GetActiveObject(ref Guid rclsid, IntPtr pvReserved,

.

   ByRef rclsid As Guid, pvReserved As IntPtr, _

.

        ref Guid libID,

.

Declare Unicode Function UnRegisterTypeLib Lib "oleaut32.dll" (ByRef LibID As System.Guid, ByVal nVerMajor As Short, ByVal nVerMinor As Short, ByVal lCID As Integer, ByVal tSysKind As System.Runtime.InteropServices.ComTypes.SYSKIND) As Integer

.

Declare Function UnRegisterTypeLib Lib "oleaut32.dll" (LibID As tGUID, ByVal nVerMajor As Integer, ByVal nVerMinor As Integer, ByVal lCID As Long, ByVal tSysKind As eSYSKIND) As Long

.

Type tGUID

.

    Private Declare Unicode Function UnRegisterTypeLib Lib "oleaut32.dll" (ByRef LibID As System.Guid, ByVal nVerMajor As Short, ByVal nVerMinor As Short, ByVal lCID As Integer, ByVal tSysKind As ComTypes.SYSKIND) As Integer

.

                    nResult = UnRegisterTypeLib(tlbAttr.guid, tlbAttr.wMajorVerNum, tlbAttr.wMinorVerNum, tlbAttr.lcid, tlbAttr.syskind)

propsys

.

static extern int PSGetItemPropertyHandler(IShellItem punkItem, bool fReadWrite, ref Guid riid, out IPropertyStore ppv);

.

     Guid iPropStoreGuid = new Guid("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99");

.

     int hr = PSGetItemPropertyHandler(shellitem, fReadWrite, ref iPropStoreGuid, out result);    

userenv

.

        IntPtr pGuidExtension,

.

  __in      GUID* pGuidExtension,

ws2_32

.

    public GUID ProviderId;

ole32

.

   [In] ref Guid iidResult, [MarshalAs(UnmanagedType.Interface)] out Object

.

   <[In]> ByRef iidResult As Guid, <MarshalAs(UnmanagedType.Interface), Out> ByRef _

.

static extern Guid CLSIDFromProgIDEx(string lpszProgID);

.

  Friend Shared Function CLSIDFromProgIDEx(ByVal lpszProgID As String) As Guid

.

static extern Guid CLSIDFromProgIDEx(string lpszProgID);

.

  Friend Shared Function CLSIDFromProgIDEx(ByVal lpszProgID As String) As Guid

.

static extern Guid CLSIDFromString(string lpsz);

.

static extern int CLSIDFromString(string lpsz, out Guid guid);

.

One of the constructors of [Guid] accepts a string.

.
Summary
.

static extern Guid CoCreateGuid();

.

If you like the old-style GUIDs that are generated in sequential order and contain the machine's MAC address, try UuidCreateSequential.

.

System.Guid.NewGuid()

.
Documentation
[CoCreateGuid] on MSDN
.

   [In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,

.

Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-C000-000000000046");

.

Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-C000-000000000046");

.

   [In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,

.

Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-C000-000000000046");

.

Type shellDesktopType = Type.GetTypeFromCLSID(CLSID_ShellDesktop, true); // (Guid, serverName, throwOnError)

.

static extern object CoGetCallContext([In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);

.

   [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);

.

[GuidAttribute("00000029-0000-0000-C000-000000000046")]

.

   [In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,

.

   [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);

.

    (<[In](), MarshalAs(UnmanagedType.LPStruct)> ByVal rclsid As Guid, _

.

    <[In](), MarshalAs(UnmanagedType.LPStruct)> ByVal riid As Guid) _

.

static extern int CoGetInstanceFromFile(IntPtr pServerInfo, [In] ref Guid

.

   Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);

.

   [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);

.

static extern int CoMarshalInterface(UCOMIStream pStm, [In] ref Guid riid,

.

static extern int CoMarshalInterThreadInterfaceInStream([In] ref Guid riid,

.

    [MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,

.

static extern int CoUnmarshalInterface(UCOMIStream pStm, [In] ref Guid riid,

.

static extern int CoUnmarshalInterface(System.Runtime.InteropServices.ComTypes.IStream pStm, [In] ref Guid riid,

.

static extern int CreateClassMoniker([In] ref Guid rclsid,

.

static extern IMoniker CreateClassMoniker([In, MarshalAs(UnmanagedType.LPStruct)]Guid guid);

.

The ref modifier or the [MarshalAs(LPStruct)] attribute are required on the guid parameter; otherwise it is marshaled incorrectly and the call will fail with an access violation.

.

    public bool PersistLoadComObject(object objComCtrl, string strGUID, byte[] buffer)

.

        Guid    IID_IPersistStreamInit = new Guid("7FD52380-4E07-101B-AE2D-08002B2EC713");

.

            if (CheckGUIDS(pPersistStream, strGUID))

.

     public bool CheckGUIDS(IPersistStreamInit pPersistStream, string strCtrlGUID)

.

          Guid ptrClsId = new Guid();

.

          string strStreamGUID = ptrClsId.ToString().ToUpper();

.

          if (strStreamGUID != strCtrlGUID.ToUpper())

.

          _strErrorMsg = strStreamGUID + " " + strCtrlGUID + " mismatch";

.

static extern int FmtIdToPropStgName([In] ref Guid pfmtid,

.

    <[In]()> ByRef FMTID As Guid, _

. .

   out Guid lpiid);

.

static extern Guid IIDFromString(string lpsz);

.

    static extern int IIDFromString(string lpsz, out Guid lpiid);

.

       Guid   g;

.

    static extern Guid IIDFromString(string lpsz);

.

       Guid   g = IIDFromString(iid);

.

[System.Guid] - overloaded constructor that takes a string.

.

    int cPages, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] Guid[] lpPageClsID,

.

        Guid[] guidarray = cauuid.ToGuidArray();

.

        int nelements = guidarray.Length;

.

            o, nelements, guidarray, 0, 0, 0);

.

        [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] Guid[] lpPageClsID,

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: