{"id":210,"date":"2020-08-20T01:13:11","date_gmt":"2020-08-20T01:13:11","guid":{"rendered":"https:\/\/michaeljohnsteiner.com\/?p=210"},"modified":"2020-08-20T01:13:11","modified_gmt":"2020-08-20T01:13:11","slug":"nativewin32-cs","status":"publish","type":"post","link":"https:\/\/michaeljohnsteiner.com\/index.php\/2020\/08\/20\/nativewin32-cs\/","title":{"rendered":"NativeWin32.cs"},"content":{"rendered":"\n<p>Contains some native Windows and SetupDi API calls<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">using System;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\n\/\/\/ &lt;summary>\n\/\/\/     Contains some native Windows and SetupDi API calls\n\/\/\/ &lt;\/summary>\npublic class NativeWin32\n{\n    [Flags]\n    public enum DeviceCapabilities\n    {\n        Unknown           = 0x00000000,\n        LockSupported     = 0x00000001,\n        EjectSupported    = 0x00000002,\n        Removable         = 0x00000004,\n        DockDevice        = 0x00000008,\n        UniqueId          = 0x00000010,\n        SilentInstall     = 0x00000020,\n        RawDeviceOk       = 0x00000040,\n        SurpriseRemovalOk = 0x00000080,\n        HardwareDisabled  = 0x00000100,\n        NonDynamic        = 0x00000200\n    }\n\n    [Flags]\n    public enum DICFG\n    {\n        \/\/\/ &lt;summary>\n        \/\/\/     Return only the device that is associated with the system default device interface, if one is set.\n        \/\/\/ &lt;\/summary>\n        DEFAULT = 0x00000001,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Return only devices that are currently present in a system.\n        \/\/\/ &lt;\/summary>\n        PRESENT = 0x00000002,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Return a list of installed devices for all device setup classes or all device interface classes.\n        \/\/\/ &lt;\/summary>\n        ALLCLASSES = 0x00000004,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Return only devices that are a part of the current hardware profile.\n        \/\/\/ &lt;\/summary>\n        PROFILE = 0x00000008,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Return devices that support device interfaces for the specified device interface classes.\n        \/\/\/ &lt;\/summary>\n        DEVICEINTERFACE = 0x00000010\n    }\n\n    public enum PNP_VETO_TYPE\n    {\n        Ok,\n        TypeUnknown,\n        LegacyDevice,\n        PendingClose,\n        WindowsApp,\n        WindowsService,\n        OutstandingOpen,\n        Device,\n        Driver,\n        IllegalDeviceRequest,\n        InsufficientPower,\n        NonDisableable,\n        LegacyDriver\n    }\n\n    \/\/\/ &lt;summary>\n    \/\/\/     SEE: https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/hardware\/ff542548(v=vs.85).aspx\n    \/\/\/ &lt;\/summary>\n    [Flags]\n    public enum SPDRP\n    {\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests a string describing the device, such as \"Microsoft PS\/2 Port Mouse\", typically defined by the\n        \/\/\/     manufacturer.\n        \/\/\/     String\n        \/\/\/ &lt;\/summary>\n        DeviceDesc = 0x00000000,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the hardware IDs provided by the device that identify the device.\n        \/\/\/     String[]\n        \/\/\/ &lt;\/summary>\n        HardwareId = 0x00000001,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the compatible IDs reported by the device.\n        \/\/\/     string[]\n        \/\/\/ &lt;\/summary>\n        CompatibleIds = 0x00000002,\n        Unused0 = 0x00000003,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Service device property represents the name of the service that is installed for a device instance.\n        \/\/\/     string\n        \/\/\/ &lt;\/summary>\n        Service = 0x00000004,\n        Unused1 = 0x00000005,\n        Unused2 = 0x00000006,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the name of the device's setup class, in text format.\n        \/\/\/     string\n        \/\/\/ &lt;\/summary>\n        Class = 0x00000007,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the GUID for the device's setup class.\n        \/\/\/     GUID\n        \/\/\/ &lt;\/summary>\n        ClassGuid = 0x00000008,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the name of the driver-specific registry key.\n        \/\/\/     string\n        \/\/\/ &lt;\/summary>\n        Driver = 0x00000009,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     ConfigFlags device property represents the configuration flags that are set for a device instance.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        ConfigFlags = 0x0000000A,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests a string identifying the manufacturer of the device.\n        \/\/\/     string\n        \/\/\/ &lt;\/summary>\n        Mfg = 0x0000000B,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests a string that can be used to distinguish between two similar devices, typically defined by the class\n        \/\/\/     installer.\n        \/\/\/     string\n        \/\/\/ &lt;\/summary>\n        FriendlyName = 0x0000000C,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests information about the device's location on the bus; the interpretation of this information is\n        \/\/\/     bus-specific.\n        \/\/\/     string\n        \/\/\/ &lt;\/summary>\n        LocationInformation = 0x0000000D,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the name of the PDO for this device.\n        \/\/\/     Binary\n        \/\/\/ &lt;\/summary>\n        PhysicalDeviceObjectName = 0x0000000E,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Capabilities device property represents the capabilities of a device instance.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        Capabilities = 0x0000000F,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests a number associated with the device that can be displayed in the user interface.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        UiNumber = 0x00000010,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     UpperFilters device property represents a list of the service names of the upper-level filter drivers that are\n        \/\/\/     installed for a device instance.\n        \/\/\/     string[]\n        \/\/\/ &lt;\/summary>\n        UpperFilters = 0x00000011,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     LowerFilters device property represents a list of the service names of the lower-level filter drivers that are\n        \/\/\/     installed for a device instance.\n        \/\/\/     string[]\n        \/\/\/ &lt;\/summary>\n        LowerFilters = 0x00000012,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the GUID for the bus that the device is connected to.\n        \/\/\/     GUID\n        \/\/\/ &lt;\/summary>\n        BusTypeGuid = 0x00000013,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the bus type, such as PCIBus or PCMCIABus.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        LegacyBusType = 0x00000014,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the legacy bus number of the bus the device is connected to.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        BusNumber = 0x00000015,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the name of the enumerator for the device, such as \"USB\".\n        \/\/\/     string\n        \/\/\/ &lt;\/summary>\n        EnumeratorName = 0x00000016,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Security device property represents a security descriptor structure for a device instance.\n        \/\/\/     SECURITY_DESCRIPTOR\n        \/\/\/ &lt;\/summary>\n        Security = 0x00000017,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     SecuritySDS device property represents a security descriptor string for a device instance.\n        \/\/\/ &lt;\/summary>\n        Security_SDS = 0x00000018,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     DevType device property represents the device type of a device instance.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        DevType = 0x00000019,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Exclusive device property represents a Boolean value that determines whether a device instance can be opened for\n        \/\/\/     exclusive use.\n        \/\/\/     bool\n        \/\/\/ &lt;\/summary>\n        Exclusive = 0x0000001A,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Characteristics device property represents the characteristics of a device instance.\n        \/\/\/     INt32\n        \/\/\/ &lt;\/summary>\n        Characteristics = 0x0000001B,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Requests the address of the device on the bus.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        Address = 0x0000001C,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     UINumberDescFormat device property represents a printf-compatible format string that you should use to display\n        \/\/\/     the value of the DEVPKEY_DEVICE_UINumber device property for a device instance.\n        \/\/\/     string\n        \/\/\/ &lt;\/summary>\n        UI_Number_Desc_Format = 0x0000001D,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     PowerData device property represents power information about a device instance.\n        \/\/\/     Binary\n        \/\/\/ &lt;\/summary>\n        Device_Power_Data = 0x0000001E,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     (Windows XP and later.) Requests the device's current removal policy. The operating system uses this value as a\n        \/\/\/     hint to determine how the device is normally removed.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        RemovalPolicy = 0x0000001F,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     RemovalPolicyDefault device property represents the default removal policy for a device instance.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        Removal_Policy_Defualt = 0x00000020,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     RemovalPolicyOverride device property represents the removal policy override for a device instance.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        Removal_Policy_Override = 0x00000021,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     Windows XP and later.) Requests the device's installation state.\n        \/\/\/     Int32\n        \/\/\/ &lt;\/summary>\n        InstallState = 0x00000022,\n\n        \/\/\/ &lt;summary>\n        \/\/\/     LocationPaths device property represents the location of a device instance in the device tree.\n        \/\/\/     string[]\n        \/\/\/ &lt;\/summary>\n        LocationPaths = 0x00000023\n    }\n\n    public const int INVALID_HANDLE_VALUE                = -1;\n    public const int MAX_DEV_LEN                         = 200;\n    public const int DEVICE_NOTIFY_WINDOW_HANDLE         = 0x00000000;\n    public const int DEVICE_NOTIFY_SERVICE_HANDLE        = 0x00000001;\n    public const int DEVICE_NOTIFY_ALL_INTERFACE_CLASSES = 0x00000004;\n    public const int DBT_DEVTYP_DEVICEINTERFACE          = 0x00000005;\n    public const int DBT_DEVNODES_CHANGED                = 0x0007;\n    public const int WM_DEVICECHANGE                     = 0x0219;\n    public const int DIF_PROPERTYCHANGE                  = 0x00000012;\n    public const int DICS_FLAG_GLOBAL                    = 0x00000001;\n    public const int DICS_FLAG_CONFIGSPECIFIC            = 0x00000002;\n    public const int DICS_ENABLE                         = 0x00000001;\n    public const int DICS_DISABLE                        = 0x00000002;\n\n    public const int ERROR_INVALID_DATA                   = 13;\n    public const int ERROR_NO_MORE_ITEMS                  = 259;\n    public const int ERROR_INSUFFICIENT_BUFFER            = 122;\n    public const int GENERIC_READ                         = unchecked((int) 0x80000000);\n    public const int FILE_SHARE_READ                      = 0x00000001;\n    public const int FILE_SHARE_WRITE                     = 0x00000002;\n    public const int OPEN_EXISTING                        = 3;\n    public const int IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS = 0x00560000;\n\n    [DllImport(\"setupapi.dll\")]\n    public static extern bool SetupDiOpenDeviceInfo(\n        IntPtr              deviceInfoSet,\n        string              deviceInstanceId,\n        IntPtr              hwndParent,\n        int                 openFlags,\n        ref SP_DEVINFO_DATA deviceInfoData\n    );\n\n    [DllImport(\"Kernel32.dll\", SetLastError = true)]\n    internal static extern IntPtr CreateFile(string lpFileName,           int dwDesiredAccess,       int dwShareMode,\n        IntPtr                                      lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile);\n\n    [DllImport(\"Kernel32.dll\", SetLastError = true)]\n    internal static extern bool DeviceIoControl(IntPtr hDevice,       int    dwIoControlCode, IntPtr lpInBuffer,\n        int                                            nInBufferSize, IntPtr lpOutBuffer,     int    nOutBufferSize, out int lpBytesReturned, IntPtr lpOverlapped);\n\n    [DllImport(\"Kernel32.dll\", SetLastError = true)]\n    internal static extern bool CloseHandle(IntPtr hObject);\n\n    [DllImport(\"kernel32\", CharSet = CharSet.Auto, SetLastError = true)]\n    internal static extern bool GetVolumeNameForVolumeMountPoint(\n        string        volumeName,\n        StringBuilder uniqueVolumeName,\n        int           uniqueNameBufferCapacity);\n\n    [DllImport(\"user32.dll\", CharSet = CharSet.Auto)]\n    public static extern IntPtr RegisterDeviceNotification(IntPtr hRecipient,\n        DEV_BROADCAST_DEVICEINTERFACE                             NotificationFilter, uint Flags);\n\n    [DllImport(\"user32.dll\", CharSet = CharSet.Auto)]\n    public static extern uint UnregisterDeviceNotification(IntPtr hHandle);\n\n    [DllImport(\"setupapi.dll\", SetLastError = true)]\n    public static extern IntPtr SetupDiGetClassDevs(ref Guid   ClassGuid,\n        [MarshalAs(UnmanagedType.LPStr)]                string Enumerator, IntPtr hwndParent, DICFG Flags);\n\n    [DllImport(\"setupapi.dll\")]\n    public static extern IntPtr SetupDiGetClassDevsEx(ref Guid   ClassGuid,\n        [MarshalAs(UnmanagedType.LPStr)]                  string Enumerator,\n        IntPtr                                                   hwndParent, int Flags, IntPtr DeviceInfoSet,\n        [MarshalAs(UnmanagedType.LPStr)] string                  MachineName,\n        IntPtr                                                   Reserved);\n\n    [DllImport(@\"setupapi.dll\", SetLastError = true)]\n    public static extern bool SetupDiEnumDeviceInterfaces(\n        IntPtr                       hDevInfo,\n        IntPtr                       devInfo,\n        Guid                         interfaceClassGuid,\n        uint                         memberIndex,\n        ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData\n    );\n\n    [DllImport(@\"setupapi.dll\", SetLastError = true)]\n    public static extern bool SetupDiEnumDeviceInterfaces(\n        IntPtr                       hDevInfo,\n        ref SP_DEVINFO_DATA          devInfo,\n        Guid                         interfaceClassGuid,\n        uint                         memberIndex,\n        ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData\n    );\n\n    [DllImport(@\"setupapi.dll\", SetLastError = true)]\n    public static extern bool SetupDiGetDeviceInterfaceDetail(\n        IntPtr                              hDevInfo,\n        ref SP_DEVICE_INTERFACE_DATA        deviceInterfaceData,\n        ref SP_DEVICE_INTERFACE_DETAIL_DATA deviceInterfaceDetailData,\n        uint                                deviceInterfaceDetailDataSize,\n        ref uint                            requiredSize,\n        ref SP_DEVINFO_DATA                 deviceInfoData\n    );\n\n    [DllImport(\"setupapi.dll\", SetLastError = true)]\n    public static extern int SetupDiDestroyDeviceInfoList(IntPtr lpInfoSet);\n\n    [DllImport(\"setupapi.dll\", SetLastError = true)]\n    public static extern bool SetupDiEnumDeviceInfo(IntPtr lpInfoSet, int dwIndex, ref SP_DEVINFO_DATA devInfoData);\n\n    [DllImport(\"setupapi.dll\", SetLastError = true)]\n    public static extern bool SetupDiGetDeviceRegistryProperty(IntPtr lpInfoSet, ref SP_DEVINFO_DATA DeviceInfoData,\n        uint                                                          Property,\n        uint                                                          PropertyRegDataType, StringBuilder PropertyBuffer, uint PropertyBufferSize, IntPtr RequiredSize);\n\n    [DllImport(\"setupapi.dll\", SetLastError = true)]\n    public static extern bool SetupDiGetDeviceRegistryProperty(IntPtr lpInfoSet, ref SP_DEVINFO_DATA DeviceInfoData,\n        uint                                                          Property,\n        uint                                                          PropertyRegDataType, IntPtr propertyBuffer, uint PropertyBufferSize, IntPtr RequiredSize);\n\n    [DllImport(\"setupapi.dll\", SetLastError = true, CharSet = CharSet.Auto)]\n    public static extern bool SetupDiSetClassInstallParams(IntPtr DeviceInfoSet,      ref SP_DEVINFO_DATA DeviceInfoData,\n        SP_PROPCHANGE_PARAMS                                      ClassInstallParams, int                 ClassInstallParamsSize);\n\n    [DllImport(\"setupapi.dll\", CharSet = CharSet.Auto)]\n    public static extern bool SetupDiCallClassInstaller(uint InstallFunction, IntPtr DeviceInfoSet,\n        ref SP_DEVINFO_DATA                                  DeviceInfoData);\n\n    [DllImport(\"setupapi.dll\", CharSet = CharSet.Auto)]\n    public static extern bool SetupDiClassNameFromGuid(ref Guid ClassGuid,     StringBuilder className,\n        int                                                     ClassNameSize, ref int       RequiredSize);\n\n    [DllImport(\"setupapi.dll\", CharSet = CharSet.Auto)]\n    public static extern bool SetupDiGetClassDescription(ref Guid ClassGuid,            StringBuilder classDescription,\n        int                                                       ClassDescriptionSize, ref int       RequiredSize);\n\n    [DllImport(\"setupapi.dll\", CharSet = CharSet.Auto)]\n    public static extern bool SetupDiGetDeviceInstanceId(IntPtr DeviceInfoSet,    ref SP_DEVINFO_DATA DeviceInfoData,\n        StringBuilder                                           DeviceInstanceId, int                 DeviceInstanceIdSize, ref int RequiredSize);\n\n    [DllImport(\"setupapi.dll\")]\n    public static extern int CM_Get_Parent(\n        out uint pdnDevInst,\n        uint     dnDevInst,\n        int      ulFlags\n    );\n\n    [DllImport(\"setupapi.dll\")]\n    public static extern int CM_Get_Device_ID(\n        uint          dnDevInst,\n        StringBuilder buffer,\n        uint          bufferLen,\n        int           ulFlags);\n\n    [DllImport(\"setupapi.dll\")]\n    public static extern int CM_Request_Device_Eject(\n        uint              dnDevInst,\n        out PNP_VETO_TYPE pVetoType,\n        StringBuilder     pszVetoName,\n        int               ulNameLength,\n        uint              ulFlags\n    );\n\n    [DllImport(\"setupapi.dll\", EntryPoint = \"CM_Request_Device_Eject\")]\n    public static extern int CM_Request_Device_Eject_NoUi(\n        uint          dnDevInst,\n        IntPtr        pVetoType,\n        StringBuilder pszVetoName,\n        uint          ulNameLength,\n        uint          ulFlags\n    );\n\n    public class GUID_DEVINTERFACE\n    {\n        public static Guid BUS1394_CLASS_GUID                   = new Guid(\"6BDD1FC1-810F-11d0-BEC7-08002BE2092F\");\n        public static Guid GUID_61883_CLASS                     = new Guid(\"7EBEFBC0-3200-11d2-B4C2-00A0C9697D07\");\n        public static Guid GUID_DEVICE_APPLICATIONLAUNCH_BUTTON = new Guid(\"629758EE-986E-4D9E-8E47-DE27F8AB054D\");\n        public static Guid GUID_DEVICE_BATTERY                  = new Guid(\"72631E54-78A4-11D0-BCF7-00AA00B7B32A\");\n        public static Guid GUID_DEVICE_LID                      = new Guid(\"4AFA3D52-74A7-11d0-be5e-00A0C9062857\");\n        public static Guid GUID_DEVICE_MEMORY                   = new Guid(\"3FD0F03D-92E0-45FB-B75C-5ED8FFB01021\");\n        public static Guid GUID_DEVICE_MESSAGE_INDICATOR        = new Guid(\"CD48A365-FA94-4CE2-A232-A1B764E5D8B4\");\n        public static Guid GUID_DEVICE_PROCESSOR                = new Guid(\"97FADB10-4E33-40AE-359C-8BEF029DBDD0\");\n        public static Guid GUID_DEVICE_SYS_BUTTON               = new Guid(\"4AFA3D53-74A7-11d0-be5e-00A0C9062857\");\n        public static Guid GUID_DEVICE_THERMAL_ZONE             = new Guid(\"4AFA3D51-74A7-11d0-be5e-00A0C9062857\");\n        public static Guid GUID_BTHPORT_DEVICE_INTERFACE        = new Guid(\"0850302A-B344-4fda-9BE9-90576B8D46F0\");\n        public static Guid GUID_DEVINTERFACE_BRIGHTNESS         = new Guid(\"FDE5BBA4-B3F9-46FB-BDAA-0728CE3100B4\");\n        public static Guid GUID_DEVINTERFACE_DISPLAY_ADAPTER    = new Guid(\"5B45201D-F2F2-4F3B-85BB-30FF1F953599\");\n        public static Guid GUID_DEVINTERFACE_I2C                = new Guid(\"2564AA4F-DDDB-4495-B497-6AD4A84163D7\");\n        public static Guid GUID_DEVINTERFACE_IMAGE              = new Guid(\"6BDD1FC6-810F-11D0-BEC7-08002BE2092F\");\n        public static Guid GUID_DEVINTERFACE_MONITOR            = new Guid(\"E6F07B5F-EE97-4a90-B076-33F57BF4EAA7\");\n        public static Guid GUID_DEVINTERFACE_OPM                = new Guid(\"BF4672DE-6B4E-4BE4-A325-68A91EA49C09\");\n\n        public static Guid GUID_DEVINTERFACE_VIDEO_OUTPUT_ARRIVAL =\n            new Guid(\"1AD9E4F0-F88D-4360-BAB9-4C2D55E564CD\");\n\n        public static Guid GUID_DISPLAY_DEVICE_ARRIVAL = new Guid(\"1CA05180-A699-450A-9A0C-DE4FBE3DDD89\");\n        public static Guid GUID_DEVINTERFACE_HID       = new Guid(\"4D1E55B2-F16F-11CF-88CB-001111000030\");\n        public static Guid GUID_DEVINTERFACE_KEYBOARD  = new Guid(\"884b96c3-56ef-11d1-bc8c-00a0c91405dd\");\n        public static Guid GUID_DEVINTERFACE_MOUSE     = new Guid(\"378DE44C-56EF-11D1-BC8C-00A0C91405DD\");\n        public static Guid GUID_DEVINTERFACE_MODEM     = new Guid(\"2C7089AA-2E0E-11D1-B114-00C04FC2AAE4\");\n        public static Guid GUID_DEVINTERFACE_NET       = new Guid(\"CAC88484-7515-4C03-82E6-71A87ABAC361\");\n\n        public static Guid GUID_DEVINTERFACE_SENSOR = new Guid(0XBA1BB692, 0X9B7A, 0X4833, 0X9A, 0X1E, 0X52, 0X5E,\n            0XD1, 0X34, 0XE7, 0XE2);\n\n        public static Guid GUID_DEVINTERFACE_COMPORT  = new Guid(\"86E0D1E0-8089-11D0-9CE4-08003E301F73\");\n        public static Guid GUID_DEVINTERFACE_PARALLEL = new Guid(\"97F76EF0-F883-11D0-AF1F-0000F800845C\");\n        public static Guid GUID_DEVINTERFACE_PARCLASS = new Guid(\"811FC6A5-F728-11D0-A537-0000F8753ED1\");\n\n        public static Guid GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR =\n            new Guid(\"4D36E978-E325-11CE-BFC1-08002BE10318\");\n\n        public static Guid GUID_DEVINTERFACE_CDCHANGER           = new Guid(\"53F56312-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_CDROM               = new Guid(\"53F56308-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_DISK                = new Guid(\"53F56307-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_FLOPPY              = new Guid(\"53F56311-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_MEDIUMCHANGER       = new Guid(\"53F56310-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_PARTITION           = new Guid(\"53F5630A-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_STORAGEPORT         = new Guid(\"2ACCFE60-C130-11D2-B082-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_TAPE                = new Guid(\"53F5630B-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_VOLUME              = new Guid(\"53F5630D-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_DEVINTERFACE_WRITEONCEDISK       = new Guid(\"53F5630C-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_IO_VOLUME_DEVICE_INTERFACE       = new Guid(\"53F5630D-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid MOUNTDEV_MOUNTED_DEVICE_GUID          = new Guid(\"53F5630D-B6BF-11D0-94F2-00A0C91EFB8B\");\n        public static Guid GUID_AVC_CLASS                        = new Guid(\"095780C3-48A1-4570-BD95-46707F78C2DC\");\n        public static Guid GUID_VIRTUAL_AVC_CLASS                = new Guid(\"616EF4D0-23CE-446D-A568-C31EB01913D0\");\n        public static Guid KSCATEGORY_ACOUSTIC_ECHO_CANCEL       = new Guid(\"BF963D80-C559-11D0-8A2B-00A0C9255AC1\");\n        public static Guid KSCATEGORY_AUDIO                      = new Guid(\"6994AD04-93EF-11D0-A3CC-00A0C9223196\");\n        public static Guid KSCATEGORY_AUDIO_DEVICE               = new Guid(\"FBF6F530-07B9-11D2-A71E-0000F8004788\");\n        public static Guid KSCATEGORY_AUDIO_GFX                  = new Guid(\"9BAF9572-340C-11D3-ABDC-00A0C90AB16F\");\n        public static Guid KSCATEGORY_AUDIO_SPLITTER             = new Guid(\"9EA331FA-B91B-45F8-9285-BD2BC77AFCDE\");\n        public static Guid KSCATEGORY_BDA_IP_SINK                = new Guid(\"71985F4A-1CA1-11d3-9CC8-00C04F7971E0\");\n        public static Guid KSCATEGORY_BDA_NETWORK_EPG            = new Guid(\"71985F49-1CA1-11d3-9CC8-00C04F7971E0\");\n        public static Guid KSCATEGORY_BDA_NETWORK_PROVIDER       = new Guid(\"71985F4B-1CA1-11d3-9CC8-00C04F7971E0\");\n        public static Guid KSCATEGORY_BDA_NETWORK_TUNER          = new Guid(\"71985F48-1CA1-11d3-9CC8-00C04F7971E0\");\n        public static Guid KSCATEGORY_BDA_RECEIVER_COMPONENT     = new Guid(\"FD0A5AF4-B41D-11d2-9C95-00C04F7971E0\");\n        public static Guid KSCATEGORY_BDA_TRANSPORT_INFORMATION  = new Guid(\"A2E3074F-6C3D-11d3-B653-00C04F79498E\");\n        public static Guid KSCATEGORY_BRIDGE                     = new Guid(\"085AFF00-62CE-11CF-A5D6-28DB04C10000\");\n        public static Guid KSCATEGORY_CAPTURE                    = new Guid(\"65E8773D-8F56-11D0-A3B9-00A0C9223196\");\n        public static Guid KSCATEGORY_CLOCK                      = new Guid(\"53172480-4791-11D0-A5D6-28DB04C10000\");\n        public static Guid KSCATEGORY_COMMUNICATIONSTRANSFORM    = new Guid(\"CF1DDA2C-9743-11D0-A3EE-00A0C9223196\");\n        public static Guid KSCATEGORY_CROSSBAR                   = new Guid(\"A799A801-A46D-11D0-A18C-00A02401DCD4\");\n        public static Guid KSCATEGORY_DATACOMPRESSOR             = new Guid(\"1E84C900-7E70-11D0-A5D6-28DB04C10000\");\n        public static Guid KSCATEGORY_DATADECOMPRESSOR           = new Guid(\"2721AE20-7E70-11D0-A5D6-28DB04C10000\");\n        public static Guid KSCATEGORY_DATATRANSFORM              = new Guid(\"2EB07EA0-7E70-11D0-A5D6-28DB04C10000\");\n        public static Guid KSCATEGORY_DRM_DESCRAMBLE             = new Guid(\"FFBB6E3F-CCFE-4D84-90D9-421418B03A8E\");\n        public static Guid KSCATEGORY_ENCODER                    = new Guid(\"19689BF6-C384-48fd-AD51-90E58C79F70B\");\n        public static Guid KSCATEGORY_ESCALANTE_PLATFORM_DRIVER  = new Guid(\"74F3AEA8-9768-11D1-8E07-00A0C95EC22E\");\n        public static Guid KSCATEGORY_FILESYSTEM                 = new Guid(\"760FED5E-9357-11D0-A3CC-00A0C9223196\");\n        public static Guid KSCATEGORY_INTERFACETRANSFORM         = new Guid(\"CF1DDA2D-9743-11D0-A3EE-00A0C9223196\");\n        public static Guid KSCATEGORY_MEDIUMTRANSFORM            = new Guid(\"CF1DDA2E-9743-11D0-A3EE-00A0C9223196\");\n        public static Guid KSCATEGORY_MICROPHONE_ARRAY_PROCESSOR = new Guid(\"830A44F2-A32D-476B-BE97-42845673B35A\");\n        public static Guid KSCATEGORY_MIXER                      = new Guid(\"AD809C00-7B88-11D0-A5D6-28DB04C10000\");\n        public static Guid KSCATEGORY_MULTIPLEXER                = new Guid(\"7A5DE1D3-01A1-452c-B481-4FA2B96271E8\");\n        public static Guid KSCATEGORY_NETWORK                    = new Guid(\"67C9CC3C-69C4-11D2-8759-00A0C9223196\");\n        public static Guid KSCATEGORY_PREFERRED_MIDIOUT_DEVICE   = new Guid(\"D6C50674-72C1-11D2-9755-0000F8004788\");\n        public static Guid KSCATEGORY_PREFERRED_WAVEIN_DEVICE    = new Guid(\"D6C50671-72C1-11D2-9755-0000F8004788\");\n        public static Guid KSCATEGORY_PREFERRED_WAVEOUT_DEVICE   = new Guid(\"D6C5066E-72C1-11D2-9755-0000F8004788\");\n        public static Guid KSCATEGORY_PROXY                      = new Guid(\"97EBAACA-95BD-11D0-A3EA-00A0C9223196\");\n        public static Guid KSCATEGORY_QUALITY                    = new Guid(\"97EBAACB-95BD-11D0-A3EA-00A0C9223196\");\n        public static Guid KSCATEGORY_REALTIME                   = new Guid(\"EB115FFC-10C8-4964-831D-6DCB02E6F23F\");\n        public static Guid KSCATEGORY_RENDER                     = new Guid(\"65E8773E-8F56-11D0-A3B9-00A0C9223196\");\n        public static Guid KSCATEGORY_SPLITTER                   = new Guid(\"0A4252A0-7E70-11D0-A5D6-28DB04C10000\");\n        public static Guid KSCATEGORY_SYNTHESIZER                = new Guid(\"DFF220F3-F70F-11D0-B917-00A0C9223196\");\n        public static Guid KSCATEGORY_SYSAUDIO                   = new Guid(\"A7C7A5B1-5AF3-11D1-9CED-00A024BF0407\");\n        public static Guid KSCATEGORY_TEXT                       = new Guid(\"6994AD06-93EF-11D0-A3CC-00A0C9223196\");\n        public static Guid KSCATEGORY_TOPOLOGY                   = new Guid(\"DDA54A40-1E4C-11D1-A050-405705C10000\");\n        public static Guid KSCATEGORY_TVAUDIO                    = new Guid(\"A799A802-A46D-11D0-A18C-00A02401DCD4\");\n        public static Guid KSCATEGORY_TVTUNER                    = new Guid(\"A799A800-A46D-11D0-A18C-00A02401DCD4\");\n        public static Guid KSCATEGORY_VBICODEC                   = new Guid(\"07DAD660-22F1-11D1-A9F4-00C04FBBDE8F\");\n        public static Guid KSCATEGORY_VIDEO                      = new Guid(\"6994AD05-93EF-11D0-A3CC-00A0C9223196\");\n        public static Guid KSCATEGORY_VIRTUAL                    = new Guid(\"3503EAC4-1F26-11D1-8AB0-00A0C9223196\");\n        public static Guid KSCATEGORY_VPMUX                      = new Guid(\"A799A803-A46D-11D0-A18C-00A02401DCD4\");\n        public static Guid KSCATEGORY_WDMAUD                     = new Guid(\"3E227E76-690D-11D2-8161-0000F8775BF1\");\n        public static Guid KSMFT_CATEGORY_AUDIO_DECODER          = new Guid(\"9ea73fb4-ef7a-4559-8d5d-719d8f0426c7\");\n        public static Guid KSMFT_CATEGORY_AUDIO_EFFECT           = new Guid(\"11064c48-3648-4ed0-932e-05ce8ac811b7\");\n        public static Guid KSMFT_CATEGORY_AUDIO_ENCODER          = new Guid(\"91c64bd0-f91e-4d8c-9276-db248279d975\");\n        public static Guid KSMFT_CATEGORY_DEMULTIPLEXER          = new Guid(\"a8700a7a-939b-44c5-99d7-76226b23b3f1\");\n        public static Guid KSMFT_CATEGORY_MULTIPLEXER            = new Guid(\"059c561e-05ae-4b61-b69d-55b61ee54a7b\");\n        public static Guid KSMFT_CATEGORY_OTHER                  = new Guid(\"90175d57-b7ea-4901-aeb3-933a8747756f\");\n        public static Guid KSMFT_CATEGORY_VIDEO_DECODER          = new Guid(\"d6c02d4b-6833-45b4-971a-05a4b04bab91\");\n        public static Guid KSMFT_CATEGORY_VIDEO_EFFECT           = new Guid(\"12e17c21-532c-4a6e-8a1c-40825a736397\");\n        public static Guid KSMFT_CATEGORY_VIDEO_ENCODER          = new Guid(\"f79eac7d-e545-4387-bdee-d647d7bde42a\");\n        public static Guid KSMFT_CATEGORY_VIDEO_PROCESSOR        = new Guid(\"302ea3fc-aa5f-47f9-9f7a-c2188bb16302\");\n        public static Guid GUID_DEVINTERFACE_USB_DEVICE          = new Guid(\"A5DCBF10-6530-11D2-901F-00C04FB951ED\");\n        public static Guid GUID_DEVINTERFACE_USB_HOST_CONTROLLER = new Guid(\"3ABF6F2D-71C4-462A-8A92-1E6861E6AF27\");\n        public static Guid GUID_DEVINTERFACE_USB_HUB             = new Guid(\"F18A0E88-C30C-11D0-8815-00A0C906BED8\");\n        public static Guid GUID_DEVINTERFACE_WPD                 = new Guid(\"6AC27878-A6FA-4155-BA85-F98F491D4F33\");\n        public static Guid GUID_DEVINTERFACE_WPD_PRIVATE         = new Guid(\"BA0C718F-4DED-49B7-BDD3-FABE28661211\");\n        public static Guid GUID_DEVINTERFACE_SIDESHOW            = new Guid(\"152E5811-FEB9-4B00-90F4-D32947AE1681\");\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public struct DISK_EXTENT\n    {\n        internal uint  DiskNumber;\n        internal ulong StartingOffset;\n        internal ulong ExtentLength;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public class VOLUME_DISK_EXTENTS\n    {\n        public uint NumberOfDiskExtents;\n\n        public uint ZBUf;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public class DEV_BROADCAST_DEVICEINTERFACE\n    {\n        public int dbcc_devicetype;\n        public int dbcc_reserved;\n        public int dbcc_size;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public struct SP_DEVINFO_DATA\n    {\n        public uint    cbSize;\n        public Guid    classGuid;\n        public uint    devInst;\n        public UIntPtr reserved;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public class SP_DEVINSTALL_PARAMS\n    {\n        public int    cbSize;\n        public IntPtr ClassInstallReserved;\n\n        [MarshalAs(UnmanagedType.LPTStr)] public string DriverPath;\n\n        public IntPtr FileQueue;\n        public int    Flags;\n        public int    FlagsEx;\n        public IntPtr hwndParent;\n        public IntPtr InstallMsgHandler;\n        public IntPtr InstallMsgHandlerContext;\n        public int    Reserved;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public class SP_PROPCHANGE_PARAMS\n    {\n        public SP_CLASSINSTALL_HEADER ClassInstallHeader = new SP_CLASSINSTALL_HEADER();\n        public int                    HwProfile;\n        public int                    Scope;\n        public int                    StateChange;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public class SP_CLASSINSTALL_HEADER\n    {\n        public int cbSize;\n        public int InstallFunction;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public struct SP_DEVICE_INTERFACE_DETAIL_DATA\n    {\n        public uint cbSize;\n\n        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]\n        public string devicePath;\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public struct SP_DEVICE_INTERFACE_DATA\n    {\n        public uint    cbSize;\n        public uint    flags;\n        public Guid    interfaceClassGuid;\n        public UIntPtr reserved;\n    }\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Contains some native Windows and SetupDi API calls<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/posts\/210"}],"collection":[{"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/comments?post=210"}],"version-history":[{"count":1,"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/posts\/210\/revisions"}],"predecessor-version":[{"id":211,"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/posts\/210\/revisions\/211"}],"wp:attachment":[{"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/media?parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/categories?post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michaeljohnsteiner.com\/index.php\/wp-json\/wp\/v2\/tags?post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}