Announcement

Collapse
No announcement yet.

USB device attach

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cliff Nichols
    replied
    Nicely done Peter :top:

    @Mark Strickland
    sometimes see TWO messages for the insertion of a CRUZER drive.
    I don't typically see it with non U3 devices but I have not done extensive testing.
    More testing with other devices you will see that you will get multiple messages. (Something I am working on to determine whether to accept or ignore the message if it is the same message from the same device). My best guess so far is if you have multiple USB devices, then each time nodes change to organize the correct order, you get more messages.

    @Bill Eppler, like I said this is just a small part of what I have been working on to grab the VID and PID information, but should give a jump-start.

    ListUsbDevice.bas
    Code:
    #INCLUDE "WIN32API.INC"            'Define Windows OS variables and functions
    #INCLUDE "SetupApi.INC"            'Windows Setup Api                           '<--- Many thanx to Kev Peel for this
    
    #INCLUDE "SetupApiClassInfo.h"    'Header for SetupApi                         '<--- VB port from Cliff Nichols
    #INCLUDE "SetupApiClassInfo.INC"  'Wrapper for SetupApi
    
    DECLARE FUNCTION WINMAIN ( _
                                  BYVAL hInstance     AS LONG, _     ' handle of current instance
                                  BYVAL hPrevInstance AS LONG, _     ' handle of previous instance(not used in Win32)
                                  BYVAL pszCmdLine    AS ASCIIZ PTR, _     ' address of command line
                                  BYVAL nCmdShow      AS LONG _      ' show state of window
                             ) AS LONG
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    
    GLOBAL hInst AS LONG
    GLOBAL hDlg  AS DWORD
    %IDD_DIALOG1  =  101
    %IDC_TEXTBOX1 = 1001
    CALLBACK FUNCTION ShowDIALOG1Proc()
         LOCAL i AS LONG
         LOCAL PortInfo AS STRING
         LOCAL TempText AS STRING
         SELECT CASE AS LONG CBMSG
              CASE %WM_INITDIALOG
                   PortInfo = ""
                   ListUsbDrivers
                   FOR i = LBOUND(InfoUsbDriver) TO UBOUND(InfoUsbDriver)   'Get the status of each port
                        TempText = InfoUsbDriver(i).HardwareId
                        TempText = UCASE$(TempText)
                        PortInfo = PortInfo + TempText + $CRLF
                        REPLACE $NUL WITH "" IN TempText
    '*** PCI DEVICES
                        IF INSTR(TempText, "PCI\") THEN
                             PortInfo = PortInfo + "Device = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "PCI\") + LEN("PCI\") - 1) + $CRLF
                             TempText = MID$(TempText, INSTR(TempText, "PCI\") + LEN("PCI\"))
                             IF INSTR(TempText, "VEN_") THEN
                                  PortInfo = PortInfo + "Vendor Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
                             IF INSTR(TempText, "DEV_") THEN
                                  PortInfo = PortInfo + "Product Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
                             IF INSTR(TempText, "SUBSYS_") THEN
                                  PortInfo = PortInfo + "SubSystem Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
                             IF INSTR(TempText, "REV_") THEN
                                  PortInfo = PortInfo + "Revision = " + SPACE$(1) + TempText + $CRLF
                                  TempText = ""
                             END IF
                        END IF
    '*** USB ROOT HUB
                        IF INSTR(TempText, "USB\ROOT_HUB&") THEN
                             PortInfo = PortInfo + "Device = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "USB\ROOT_HUB&") + LEN("USB\ROOT_HUB&") - 1) + $CRLF
                             TempText = MID$(TempText, INSTR(TempText, "USB\ROOT_HUB&") + LEN("USB\ROOT_HUB&"))
                             IF INSTR(TempText, "VID") THEN
                                  PortInfo = PortInfo + "Vendor Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
                             IF INSTR(TempText, "PID") THEN
                                  PortInfo = PortInfo + "Product Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
    
                             IF INSTR(TempText, "REV") THEN
                                  PortInfo = PortInfo + "Revision = " + SPACE$(1) + TempText + $CRLF
                                  TempText = ""
                             END IF
                        END IF
    '*** ALSO USB ROOT HUB
                        IF INSTR(TempText, "USB\ROOT_HUB") THEN
                             PortInfo = PortInfo + "Device = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "USB\ROOT_HUB") + LEN("USB\ROOT_HUB") - 1) '+ $CRLF
                             TempText = MID$(TempText, INSTR(TempText, "USB\ROOT_HUB") + LEN("USB\ROOT_HUB"))
                             PortInfo = PortInfo + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                             TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             IF INSTR(TempText, "VID") THEN
                                  PortInfo = PortInfo + "Vendor Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
                             IF INSTR(TempText, "PID") THEN
                                  PortInfo = PortInfo + "Product Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
    
                             IF INSTR(TempText, "REV") THEN
                                  PortInfo = PortInfo + "Revision = " + SPACE$(1) + TempText + $CRLF
                                  TempText = ""
                             END IF
                        END IF
    '*** USB UNKNOWN DEVICE
                        IF INSTR(TempText, "USB\UNKNOWN") THEN
                             PortInfo = PortInfo + "Device = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "USB\UNKNOWN") + LEN("USB\UNKNOWN") - 1) + $CRLF
                             TempText = MID$(TempText, INSTR(TempText, "USB\UNKNOWN") + LEN("USB\UNKNOWN"))
                        END IF
    '*** USB DEVICES
                        IF INSTR(TempText, "USB\") THEN
                             PortInfo = PortInfo + "Device = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "USB\") + LEN("USB\") - 1) + $CRLF
                             TempText = MID$(TempText, INSTR(TempText, "USB\") + LEN("USB\"))
                             IF INSTR(TempText, "VID_") THEN
                                  PortInfo = PortInfo + "Vendor Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
                             IF INSTR(TempText, "PID") THEN
                                  PortInfo = PortInfo + "Product Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "&") + LEN("&") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "&") + LEN("&"))
                             END IF
                             IF INSTR(TempText, "REV") THEN
                                  PortInfo = PortInfo + "Revision = " + SPACE$(1) + TempText + $CRLF
                                  TempText = ""
                             END IF
                        END IF
    '*** USB PRINTERS
                        IF INSTR(TempText, "USBPRINT\") THEN
                             PortInfo = PortInfo + "Device = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "USBPRINT\") + LEN("USBPRINT\") - 1) + $CRLF
                             TempText = MID$(TempText, INSTR(TempText, "USBPRINT\") + LEN("USBPRINT\"))
                             IF INSTR(TempText, "HEWLETT-PACKARD") THEN
                                  PortInfo = PortInfo + "Vendor Id = " + SPACE$(1) + MID$(TempText, 1, INSTR(TempText, "HEWLETT-PACKARD") + LEN("HEWLETT-PACKARD") - 1) + $CRLF
                                  TempText = MID$(TempText, INSTR(TempText, "HEWLETT-PACKARD") + LEN("HEWLETT-PACKARD"))
                             END IF
                             PortInfo = PortInfo + "Product Id = " + SPACE$(1) + TempText + $CRLF
                        END IF
                        PortInfo = PortInfo  + $CRLF
                   NEXT i
    '                    REPLACE "\" WITH " " IN PortInfo
    '                    REPLACE "VEN_" WITH " VEN_" IN PortInfo
    '                    REPLACE "DEV_" WITH " DEV_" IN PortInfo
    '                    REPLACE "SUBSYS_" WITH " SUBSYS_" IN PortInfo
    ''                    REPLACE "REV_" WITH " REV_" IN PortInfo
    '
    ''                    REPLACE "VID_" WITH " VID_" IN PortInfo
    ''                    REPLACE "PID_" WITH " PID_" IN PortInfo
    '                    REPLACE "VID" WITH " VID" IN PortInfo
    '                    REPLACE "PID" WITH " PID" IN PortInfo
    '                    REPLACE "REV" WITH " REV" IN PortInfo
    ''                    REPLACE "ROOT_HUB&" WITH "" IN PortInfo
    '                    REPLACE "&" WITH "" IN PortInfo
    
                   CONTROL SET TEXT hDlg, %IDC_TEXTBOX1, PortInfo
                   CONTROL GET TEXT hDlg, %IDC_TEXTBOX1 TO TempText
                   CONTROL SEND hDlg, %IDC_TEXTBOX1, %EM_SETSEL, 1, 1
              CASE %WM_NCACTIVATE
                   STATIC hWndSaveFocus AS DWORD
                   IF ISFALSE CBWPARAM THEN
                        hWndSaveFocus = GetFocus()         ' Save control focus
                   ELSEIF hWndSaveFocus THEN
                        SetFocus(hWndSaveFocus)            'Restore control focus
                        hWndSaveFocus = 0
                   END IF
              CASE %WM_COMMAND
    '*** Process control notifications
                   SELECT CASE AS LONG CBCTL
                        CASE %IDC_TEXTBOX1
                        CASE ELSE
                   END SELECT
              CASE %WM_DESTROY
                   PostQuitMessage 0             'Stop the message pump
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    FUNCTION WINMAIN ( _
                        BYVAL hInstance     AS LONG, _     ' handle of current instance
                        BYVAL hPrevInstance AS LONG, _     ' handle of previous instance(not used in Win32)
                        BYVAL pszCmdLine    AS ASCIIZ PTR, _     ' address of command line
                        BYVAL nCmdShow      AS LONG _      ' show state of window
                     ) AS LONG
         LOCAL tmsg AS TagMsg
         hInst = hInstance        'Global for use when creating Windows
         DIALOG NEW %HWND_DESKTOP, "Dialog1", 70, 70, 201, 121, %WS_POPUP OR %WS_BORDER _
              OR %WS_DLGFRAME OR %WS_CAPTION OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR _
              %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR _
              %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR _
              %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
         CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX1, "TextBox1", 0, 0, 200, 120, _
              %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_HSCROLL OR _
              %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_AUTOHSCROLL OR _
              %ES_AUTOVSCROLL, %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR _
              %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
         DIALOG SHOW MODELESS hDlg, CALL ShowDIALOG1Proc
    '*** Acquire and dispatch messages until a WM_QUIT message is received.
         WHILE ISTRUE GetMessage(tmsg, BYVAL %NULL, 0, 0)
              TranslateMessage tmsg
              DispatchMessage tmsg
         WEND
    END FUNCTION
    SetupApiClassInfo.h
    Code:
    DECLARE FUNCTION GetDeviceList ALIAS "GetDeviceList"()  AS DWORD
    DECLARE FUNCTION GetDeviceListSize ALIAS "GetDeviceListSize"()  AS DWORD
    DECLARE FUNCTION GetDeviceClass ALIAS "GetDeviceClass"()  AS STRING
    DECLARE FUNCTION GetDeviceFriendlyName ALIAS "GetDeviceFriendlyName"()  AS STRING
    DECLARE FUNCTION GetDeviceDesc ALIAS "GetDeviceDesc"()  AS STRING
    DECLARE FUNCTION GetDeviceHardwareId ALIAS "GetDeviceHardwareId"()  AS STRING
    DECLARE FUNCTION GetDeviceCompatibleId ALIAS "GetDeviceCompatibleId"()  AS STRING
    DECLARE FUNCTION GetDeviceUnused0 ALIAS "GeDevicetUnused0"()  AS STRING
    DECLARE FUNCTION GetDeviceService ALIAS "GetDeviceService"()  AS STRING
    DECLARE FUNCTION GetDeviceUnused1 ALIAS "GetDeviceUnused1"()  AS STRING
    DECLARE FUNCTION GetDeviceUnused2 ALIAS "GetDeviceUnused2"()  AS STRING
    DECLARE FUNCTION GetDeviceClassGuid ALIAS "GetDeviceClassGuid"()  AS STRING
    DECLARE FUNCTION GetDeviceDriver ALIAS "GetDeviceDriver"()  AS STRING
    DECLARE FUNCTION GetDeviceConfigFlags ALIAS "GetDeviceConfigFlags"()  AS STRING
    DECLARE FUNCTION GetDeviceMfg ALIAS "GetDeviceMfg"()  AS STRING
    DECLARE FUNCTION GetDeviceLocation ALIAS "GetDeviceLocation"()  AS STRING
    DECLARE FUNCTION GetDeviceObjectName ALIAS "GetDeviceObjectName"()  AS STRING
    DECLARE FUNCTION GetDeviceCapabilities ALIAS "GetDeviceCapabilities"()  AS STRING
    DECLARE FUNCTION GetDeviceUiNumber ALIAS "GetDeviceUiNumber"()  AS STRING
    DECLARE FUNCTION GetDeviceUpperFilters ALIAS "GetDeviceUpperFilters"()  AS STRING
    DECLARE FUNCTION GetDeviceLowerFilters ALIAS "GetDeviceLowerFilters"()  AS STRING
    DECLARE FUNCTION GetDeviceBusTypeGuid ALIAS "GetDeviceBusTypeGuid"()  AS STRING
    DECLARE FUNCTION GetDeviceLegacyBusType ALIAS "GetDeviceLegacyBusType"()  AS STRING
    DECLARE FUNCTION GetDeviceBusNumber ALIAS "GetDeviceBusNumber"()  AS STRING
    DECLARE FUNCTION GetDeviceEnumeratorName ALIAS "GetDeviceEnumeratorName"()  AS STRING
    DECLARE FUNCTION GetDeviceSecurityBinary ALIAS "GetDeviceSecurityBinary"()  AS STRING
    DECLARE FUNCTION GetDeviceSecuritySelfDirectedSearch ALIAS "GetDeviceSecuritySelfDirectedSearch"()  AS STRING
    DECLARE FUNCTION GetDeviceType ALIAS "GetDeviceType"()  AS STRING
    DECLARE FUNCTION GetDeviceExclusive ALIAS "GetDeviceExclusive"()  AS STRING
    DECLARE FUNCTION GetDeviceCharacteristics ALIAS "GetDeviceCharacteristics"()  AS STRING
    DECLARE FUNCTION GetDeviceAddress ALIAS "GetDeviceAddress"()  AS STRING
    DECLARE FUNCTION GetDeviceUiNumberDescFormat ALIAS "GetDeviceUiNumberDescFormat"()  AS STRING
    DECLARE FUNCTION GetDeviceMaximumProperty ALIAS "GetDeviceMaximumProperty"()  AS STRING
    DECLARE FUNCTION GetDeviceRemovalPolicy ALIAS "GetDeviceRemovalPolicy"()  AS STRING
    DECLARE FUNCTION GetDeviceRemovalPolicyDefault ALIAS "GetDeviceRemovalPolicyDefault"()  AS STRING
    DECLARE FUNCTION GetDeviceRemovalPolicyOverride ALIAS "GetDeviceRemovalPolicyOverride"()  AS STRING
    DECLARE FUNCTION GetDeviceInstallState ALIAS "GetDeviceInstallState"()  AS STRING
    DECLARE FUNCTION GetDeviceLocationPaths ALIAS "GetDeviceLocationPaths"()  AS STRING
    DECLARE FUNCTION GetDevicePowerData ALIAS "GetDevicePowerData"()  AS STRING
    DECLARE FUNCTION DestroyDeviceList ALIAS "DestroyDeviceList"()  AS DWORD
    
    DECLARE FUNCTION ListUsbDrivers ALIAS "ListUsbDrivers"() AS LONG
    DECLARE FUNCTION ListSerialDrivers ALIAS "ListSerialDrivers"() AS LONG
    
    
    TYPE DeviceDriver
         ClassName AS ASCIIZ * %MAX_PATH
         FriendlyName AS ASCIIZ * %MAX_PATH
         DeviceDesc AS ASCIIZ * %MAX_PATH
         HardwareId AS ASCIIZ * %MAX_PATH
         CompatibleId AS ASCIIZ * %MAX_PATH
         Unused0 AS ASCIIZ * %MAX_PATH
         Service AS ASCIIZ * %MAX_PATH
         Unused1 AS ASCIIZ * %MAX_PATH
         Unused2 AS ASCIIZ * %MAX_PATH
         ClassGuid AS ASCIIZ * %MAX_PATH
         Driver AS ASCIIZ * %MAX_PATH
         ConfigFlags AS ASCIIZ * %MAX_PATH
         Mfg AS ASCIIZ * %MAX_PATH
         Location AS ASCIIZ * %MAX_PATH
         ObjectName AS ASCIIZ * %MAX_PATH
         Capabilities AS ASCIIZ * %MAX_PATH
         UiNumber AS ASCIIZ * %MAX_PATH
         UpperFilters AS ASCIIZ * %MAX_PATH
         LowerFilters AS ASCIIZ * %MAX_PATH
         BusTypeGuid AS ASCIIZ * %MAX_PATH
         LegacyBusType AS ASCIIZ * %MAX_PATH
         BusNumber AS ASCIIZ * %MAX_PATH
         EnumeratorName AS ASCIIZ * %MAX_PATH
         SecurityBinary AS ASCIIZ * %MAX_PATH
         SecuritySelfDirectedSearch AS ASCIIZ * %MAX_PATH
         DeviceType AS ASCIIZ * %MAX_PATH
         Exclusive AS ASCIIZ * %MAX_PATH
         Characteristics AS ASCIIZ * %MAX_PATH
         Address AS ASCIIZ * %MAX_PATH
         UiNumberDescFormat AS ASCIIZ * %MAX_PATH
         MaximumProperty AS ASCIIZ * %MAX_PATH
         RemovalPolicy AS ASCIIZ * %MAX_PATH
         RemovalPolicyDefault AS ASCIIZ * %MAX_PATH
         RemovalPolicyOverride AS ASCIIZ * %MAX_PATH
         InstallState AS ASCIIZ * %MAX_PATH
         LocationPaths AS ASCIIZ * %MAX_PATH
         PowerData AS ASCIIZ * %MAX_PATH
    END TYPE
    
    GLOBAL hDeviceInfo AS DWORD
    GLOBAL spdi AS SP_DEVINFO_DATA
    GLOBAL dwDevicetype AS DWORD
    
    GLOBAL InfoUsbDriver() AS DeviceDriver
    GLOBAL InfoSerialDriver() AS DeviceDriver
    SetupApiClassInfo.inc
    Code:
    ________________________________________________________________________________________
    '
    '  Device Viewer
    '  -------------
    '
    '  Win 95 must have IE4 installed and NT4 must have SP3 or later installed.
    '________________________________________________________________________________________
    
    ''  Note that SPDRP codes are zero based while CM_DRP codes are one based!
    '
    '%SPDRP_DEVICEDESC                  = (&H00000000)  '  DeviceDesc (R/W)
    '%SPDRP_HARDWAREID                  = (&H00000001)  '  HardwareID (R/W)
    '%SPDRP_COMPATIBLEIDS               = (&H00000002)  '  CompatibleIDs (R/W)
    '%SPDRP_UNUSED0                     = (&H00000003)  '  unused
    '%SPDRP_SERVICE                     = (&H00000004)  '  Service (R/W)
    '%SPDRP_UNUSED1                     = (&H00000005)  '  unused
    '%SPDRP_UNUSED2                     = (&H00000006)  '  unused
    '%SPDRP_CLASS                       = (&H00000007)  '  Class (R--tied to ClassGUID)
    '%SPDRP_CLASSGUID                   = (&H00000008)  '  ClassGUID (R/W)
    '%SPDRP_DRIVER                      = (&H00000009)  '  Driver (R/W)
    '%SPDRP_CONFIGFLAGS                 = (&H0000000A)  '  ConfigFlags (R/W)
    '%SPDRP_MFG                         = (&H0000000B)  '  Mfg (R/W)
    '%SPDRP_FRIENDLYNAME                = (&H0000000C)  '  FriendlyName (R/W)
    '%SPDRP_LOCATION_INFORMATION        = (&H0000000D)  '  LocationInformation (R/W)
    '%SPDRP_PHYSICAL_DEVICE_OBJECT_NAME  =(&H0000000E)  '  PhysicalDeviceObjectName (R)
    '%SPDRP_CAPABILITIES                = (&H0000000F)  '  Capabilities (R)
    '%SPDRP_UI_NUMBER                   = (&H00000010)  '  UiNumber (R)
    '%SPDRP_UPPERFILTERS                = (&H00000011)  '  UpperFilters (R/W)
    '%SPDRP_LOWERFILTERS                = (&H00000012)  '  LowerFilters (R/W)
    '%SPDRP_BUSTYPEGUID                 = (&H00000013)  '  BusTypeGUID (R)
    '%SPDRP_LEGACYBUSTYPE               = (&H00000014)  '  LegacyBusType (R)
    '%SPDRP_BUSNUMBER                   = (&H00000015)  '  BusNumber (R)
    '%SPDRP_ENUMERATOR_NAME             = (&H00000016)  '  Enumerator Name (R)
    '%SPDRP_SECURITY                    = (&H00000017)  '  Security (R/W, binary form)
    '%SPDRP_SECURITY_SDS                = (&H00000018)  '  Security (W, SDS form)
    '%SPDRP_DEVTYPE                     = (&H00000019)  '  Device Type (R/W)
    '%SPDRP_EXCLUSIVE                   = (&H0000001A)  '  Device is exclusive-access (R/W)
    '%SPDRP_CHARACTERISTICS             = (&H0000001B)  '  Device Characteristics (R/W)
    '%SPDRP_ADDRESS                     = (&H0000001C)  '  Device Address (R)
    '%SPDRP_UI_NUMBER_DESC_FORMAT       = (&H0000001D)  '  UiNumberDescFormat (R/W)
    '%SPDRP_DEVICE_POWER_DATA           = (&H0000001E)  '  Device Power Data (R)
    '%SPDRP_REMOVAL_POLICY              = (&H0000001F)  '  Removal Policy (R)
    '%SPDRP_REMOVAL_POLICY_HW_DEFAULT   = (&H00000020)  '  Hardware Removal Policy (R)
    '%SPDRP_REMOVAL_POLICY_OVERRIDE     = (&H00000021)  '  Removal Policy Override (RW)
    '%SPDRP_INSTALL_STATE               = (&H00000022)  '  Device Install State (R)
    '%SPDRP_LOCATION_PATHS              = (&H00000023)  '  Device Location Paths (R)
    '
    '%SPDRP_MAXIMUM_PROPERTY            = (&H00000024)  '  Upper bound on ordinals
    
    FUNCTION GetDeviceList ALIAS "GetDeviceList"() EXPORT AS DWORD
         FUNCTION = SetupDiGetClassDevs(BYVAL %NULL, BYVAL %NULL, BYVAL %NULL, %DIGCF_ALLCLASSES)       ' Get a handle to the device list...
    '*** Test to see if next line is for use with only present devices?
    '  hDeviceInfo = SetupDiGetClassDevs(BYVAL %NULL, BYVAL %NULL, byval %NULL, %DIGCF_PRESENT)
    END FUNCTION
    
    FUNCTION GetDeviceListSize ALIAS "GetDeviceListSize"() EXPORT AS DWORD
         FUNCTION = SIZEOF(spdi)
    END FUNCTION
    
    FUNCTION GetDeviceClass ALIAS "GetDeviceClass"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_CLASS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)
    '     IF (UCASE$(zText) = UCASE$(REMOVE$(DeviceType, " "))) OR (LEN(DeviceType) = 0) THEN zText = ""
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceFriendlyName ALIAS "GetDeviceFriendlyName"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_FRIENDLYNAME, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)    ' Try and get friendly name...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceDesc ALIAS "GetDeviceDesc"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_DEVICEDESC, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceHardwareId ALIAS "GetDeviceHardwareId"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_HARDWAREID, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceCompatibleId ALIAS "GetDeviceCompatibleId"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_COMPATIBLEIDS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceUnused0 ALIAS "GeDevicetUnused0"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_UNUSED0, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceService ALIAS "GetDeviceService"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_SERVICE, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceUnused1 ALIAS "GetDeviceUnused1"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_UNUSED1, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceUnused2 ALIAS "GetDeviceUnused2"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_UNUSED2, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceClassGuid ALIAS "GetDeviceClassGuid"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_CLASSGUID, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceDriver ALIAS "GetDeviceDriver"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_DRIVER, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceConfigFlags ALIAS "GetDeviceConfigFlags"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_CONFIGFLAGS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceMfg ALIAS "GetDeviceMfg"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_MFG, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceLocation ALIAS "GetDeviceLocation"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_LOCATION_INFORMATION, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceObjectName ALIAS "GetDeviceObjectName"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_PHYSICAL_DEVICE_OBJECT_NAME, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceCapabilities ALIAS "GetDeviceCapabilities"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_CAPABILITIES, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceUiNumber ALIAS "GetDeviceUiNumber"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_UI_NUMBER, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceUpperFilters ALIAS "GetDeviceUpperFilters"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_UPPERFILTERS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceLowerFilters ALIAS "GetDeviceLowerFilters"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_LOWERFILTERS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceBusTypeGuid ALIAS "GetDeviceBusTypeGuid"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_BUSTYPEGUID, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceLegacyBusType ALIAS "GetDeviceLegacyBusType"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_LEGACYBUSTYPE, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceBusNumber ALIAS "GetDeviceBusNumber"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_BUSNUMBER, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceEnumeratorName ALIAS "GetDeviceEnumeratorName"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_ENUMERATOR_NAME, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceSecurityBinary ALIAS "GetDeviceSecurityBinary"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_SECURITY, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceSecuritySelfDirectedSearch ALIAS "GetDeviceSecuritySelfDirectedSearch"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_SECURITY_SDS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceType ALIAS "GetDeviceType"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_DEVTYPE, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceExclusive ALIAS "GetDeviceExclusive"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_EXCLUSIVE, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceCharacteristics ALIAS "GetDeviceCharacteristics"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_CHARACTERISTICS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceAddress ALIAS "GetDeviceAddress"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_ADDRESS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceUiNumberDescFormat ALIAS "GetDeviceUiNumberDescFormat"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_UI_NUMBER_DESC_FORMAT, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceMaximumProperty ALIAS "GetDeviceMaximumProperty"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_MAXIMUM_PROPERTY, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceRemovalPolicy ALIAS "GetDeviceRemovalPolicy"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_REMOVAL_POLICY, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceRemovalPolicyDefault ALIAS "GetDeviceRemovalPolicyDefault"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_REMOVAL_POLICY_HW_DEFAULT, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceRemovalPolicyOverride ALIAS "GetDeviceRemovalPolicyOverride"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_REMOVAL_POLICY_OVERRIDE, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceInstallState ALIAS "GetDeviceInstallState"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_INSTALL_STATE, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDeviceLocationPaths ALIAS "GetDeviceLocationPaths"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_LOCATION_PATHS, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION GetDevicePowerData ALIAS "GetDevicePowerData"() EXPORT AS STRING
         DIM zText AS ASCIIZ * %MAX_PATH
         SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_DEVICE_POWER_DATA, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)      ' Just get description...
         FUNCTION = zText
    END FUNCTION
    
    FUNCTION DestroyDeviceList ALIAS "DestroyDeviceList"() EXPORT AS DWORD
         FUNCTION = SetupDiDestroyDeviceInfoList(hDeviceInfo)        ' Tidy up...
    '*** Test to see if next line is for use with only present devices?
    '  hDeviceInfo = SetupDiGetClassDevs(BYVAL %NULL, BYVAL %NULL, byval %NULL, %DIGCF_PRESENT)
    END FUNCTION
    
    FUNCTION ListUsbDrivers ALIAS "ListUsbDrivers"() EXPORT AS LONG
    '     LOCAL i AS LONG, zText AS ASCIIZ * 1024
         LOCAL i AS LONG, zText AS ASCIIZ * %MAX_PATH
    'Default arrays
         REDIM InfoUsbDriver(LBOUND(InfoUsbDriver))
    ' Enumerate devices using SETUPAPI.DLL...
         hDeviceInfo = GetDeviceList
         spdi.cbSize = GetDeviceListSize
         DO UNTIL SetupDiEnumDeviceInfo(hDeviceInfo, i, spdi) = 0
              SELECT CASE UCASE$(GetDeviceClass)
                   CASE "USB"
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).ClassName = GetDeviceClass
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).FriendlyName = GetDeviceFriendlyName
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).DeviceDesc = GetDeviceDesc
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).HardwareId = GetDeviceHardwareId
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).CompatibleId = GetDeviceCompatibleId
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).Service = GetDeviceService
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).ClassGuid = GetDeviceClassGuid
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).Driver = GetDeviceDriver
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).ConfigFlags = GetDeviceConfigFlags
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).Mfg = GetDeviceMfg
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).Location = GetDeviceLocation
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).ObjectName = GetDeviceObjectName
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).Capabilities = GetDeviceCapabilities
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).UiNumber = GetDeviceUiNumber
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).UpperFilters = GetDeviceUpperFilters
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).LowerFilters = GetDeviceLowerFilters
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).BusTypeGuid = GetDeviceBusTypeGuid
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).LegacyBusType = GetDeviceCompatibleId
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).BusNumber = GetDeviceCompatibleId
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).EnumeratorName = GetDeviceCompatibleId
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).SecurityBinary = GetDeviceCompatibleId
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).SecuritySelfDirectedSearch = GetDeviceSecuritySelfDirectedSearch
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).DeviceType = GetDeviceType
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).Exclusive = GetDeviceExclusive
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).Characteristics = GetDeviceCharacteristics
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).Address = GetDeviceAddress
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).UiNumberDescFormat = GetDeviceUiNumberDescFormat
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).MaximumProperty = GetDeviceMaximumProperty
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicy = GetDeviceRemovalPolicy
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicyDefault = GetDeviceRemovalPolicyDefault
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicyOverride = GetDeviceRemovalPolicyOverride
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).InstallState = GetDeviceInstallState
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).LocationPaths = GetDeviceLocationPaths
                        InfoUsbDriver(UBOUND(InfoUsbDriver)).PowerData = GetDevicePowerData
    '                    InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused0 = GetDeviceUnused0
    '                    InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused1 = GetDeviceUnused1
    '                    InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused2 = GetDeviceUnused2
    
              'SetupDiGetDeviceRegistryProperty(hDeviceInfo, spdi, %SPDRP_HARDWAREID, BYVAL %NULL, zText, SIZEOF(zText), BYVAL %NULL)
                                  REDIM PRESERVE InfoUsbDriver(UBOUND(InfoUsbDriver) + 1)
                   CASE ELSE
              END SELECT
              INCR i
         LOOP
         DestroyDeviceList
         REDIM PRESERVE InfoUsbDriver(UBOUND(InfoUsbDriver) - 1)
         FUNCTION = %True
    END FUNCTION
    SetupApi.Inc
    Code:
    '  SETUPAPI.DLL is available on Win95/NT4 SP3 and later versions.
    '  Define %UNICODE to enable unicode support (default is ANSI).
    '  Define %SETUPAPI_VER to predefine the DLL version, (default is Win98 or IE4).
    '
    
    #IF NOT %DEF(%WINAPI)
        #INCLUDE "win32api.inc"
    #ENDIF
    
    
    #IF NOT %DEF(%SETUPAPI)
    
    %SETUPAPI = 1
    
    
    '  determine version of setupapi based on _WIN32_WINDOWS and _WIN32_WINNT
    
    '  NT4 version of setupapi (&H0400) is earliest, and installed onto Win95 by IE.
    '  Win2k version of setupapi (&H0500) also shipped in WinME
    '  we'll use "&H0410" to indicate version of setupapi shipped with Win98
    
    #IF NOT %DEF(%SETUPAPI_VER)
    '    %SETUPAPI_VER = &H0410
        %SETUPAPI_VER = &H0400      'Go with earliest version to cover all
    #ENDIF
    
    '
    ' Define maximum string length constants
    '
    %LINE_LEN                     = 256     ' Windows 9x-compatible maximum for
                                            ' displayable strings coming from a
                                            ' device INF.
    %MAX_INF_STRING_LENGTH        = 4096    ' Actual maximum size of an INF string
                                            ' (including string substitutions).
    %MAX_INF_SECTION_NAME_LENGTH  = 255     ' For Windows 9x compatibility, INF
                                            ' section names should be constrained
                                            ' to 32 characters.
    
    %MAX_TITLE_LEN                = 60
    %MAX_INSTRUCTION_LEN          = 256
    %MAX_LABEL_LEN                = 30
    %MAX_SERVICE_NAME_LEN         = 256
    %MAX_SUBTITLE_LEN             = 256
    
    
    '  Define maximum length of a machine name in the format expected by ConfigMgr32
    '  CM_Connect_Machine (i.e., "\\\\MachineName\0").
    
    %SP_MAX_MACHINENAME_LENGTH   = (%MAX_PATH + 3)
    
    
    '  Define type for reference to loaded inf file
    MACRO HINF = DWORD
    
    
    '  Inf context structure. Applications must not interpret or
    '  overwrite values in these structures.
    
    TYPE INFCONTEXT
         Inf AS DWORD
         CurrentInf AS DWORD
         Section AS DWORD
         dwLine AS DWORD
    END TYPE
    
    
    '  Inf file information structure.
    
    TYPE SP_INF_INFORMATION
         InfStyle AS DWORD
         InfCount AS DWORD
         VersionData AS BYTE PTR     ' Array of byte values follow.
    END TYPE
    
    
    
    ' Define structure for passing alternate platform info into
    ' SetupSetFileQueueAlternatePlatform and SetupQueryInfOriginalFileInformation.
    
    TYPE SP_ALTPLATFORM_INFO_V2
    
         Platform AS DWORD
    
    '  major and minor version numbers to use
    
         MajorVersion AS DWORD
         MinorVersion AS DWORD
    
    '  processor architecture to use (PROCESSOR_ARCHITECTURE_INTEL,
    '  PROCESSOR_ARCHITECTURE_AMD64, or PROCESSOR_ARCHITECTURE_IA64.
    
         ProcessorArchitecture AS WORD
         Reserved AS WORD                      '  for compatibility with V1 structure
         Flags AS WORD                         '  indicates validity of non V1 fields
    
    '  specify SP_ALTPLATFORM_FLAGS_VERSION_RANGE in Flags
    '  to use FirstValidatedMajorVersion and FirstValidatedMinorVersion
    
    '  Major and minor versions of the oldest previous OS for which this
    '  package's digital signature may be considered valid.  For example, say
    '  the alternate platform is VER_PLATFORM_WIN32_NT, version 5.1.  However,
    '  it is wished that driver packages signed with a 5.0 osattr also be
    '  considered valid.  In this case, you'd have a  MajorVersion/MinorVersion
    '  of 5.1, and a FirstValidatedMajorVersion/FirstValidatedMinorVersion of
    '  5.0.  To validate packages signed for any previous OS release, specify
    '  0 for these fields.  To only validate against the target alternate
    '  platform, specify the same values as those in the MajorVersion and
    '  MinorVersion fields.
    
         FirstValidatedMajorVersion AS DWORD
         FirstValidatedMinorVersion AS DWORD
    
    END TYPE
    
    
    TYPE SP_ALTPLATFORM_INFO_V1
         cbSize AS DWORD
                                               '
                                               '  platform to use (VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT)
                                               '
         Platform AS DWORD
                                               '
                                               '  major and minor version numbers to use
                                               '
         MajorVersion AS DWORD
         MinorVersion AS DWORD
                                               '
                                               '  processor architecture to use (PROCESSOR_ARCHITECTURE_INTEL,
                                               '  PROCESSOR_ARCHITECTURE_AMD64, or PROCESSOR_ARCHITECTURE_IA64.
                                               '
         ProcessorArchitecture AS WORD
         Reserved AS WORD                      '  must be zero.
    END TYPE
    
    
    #IF %DEF(%USE_SP_ALTPLATFORM_INFO_V1) AND (%SETUPAPI_VER < &H0501) '  use version 1 altplatform info data structure
    
        MACRO SP_ALTPLATFORM_INFO  = SP_ALTPLATFORM_INFO_V1
        MACRO PSP_ALTPLATFORM_INFO = PSP_ALTPLATFORM_INFO_V1
    
    #ELSE                          ' use version 2 altplatform info data structure
    
        MACRO SP_ALTPLATFORM_INFO  = SP_ALTPLATFORM_INFO_V2
        MACRO PSP_ALTPLATFORM_INFO = PSP_ALTPLATFORM_INFO_V2
    
        '  the following flags are available to SP_ALTPLATFORM_INFO_V2
        %SP_ALTPLATFORM_FLAGS_VERSION_RANGE = (&H0001)     ' FirstValidatedMajor/MinorVersion
    
    #ENDIF  ' use current version of altplatform info data structure
    
    
    
    '  Define structure that is filled in by SetupQueryInfOriginalFileInformation
    '  to indicate the INF's original name and the original name of the (potentially
    '  platform-specific) catalog file specified by that INF.
    
    TYPE SP_ORIGINAL_FILE_INFO_A
         cbSize AS DWORD
         OriginalInfName AS ASCIIZ * %MAX_PATH
         OriginalCatalogName AS ASCIIZ * %MAX_PATH
    END TYPE
    
    TYPE SP_ORIGINAL_FILE_INFO_W
         cbSize AS DWORD
         OriginalInfName AS STRING * %MAX_PATH * 2
         OriginalCatalogName AS STRING * %MAX_PATH * 2
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_ORIGINAL_FILE_INFO  = SP_ORIGINAL_FILE_INFO_W
    #ELSE
        MACRO SP_ORIGINAL_FILE_INFO  = SP_ORIGINAL_FILE_INFO_A
    #ENDIF
    
    
    '  SP_INF_INFORMATION.InfStyle values
    
    %INF_STYLE_NONE           = &H00000000       '  unrecognized or non-existent
    %INF_STYLE_OLDNT          = &H00000001       '  winnt 3.x
    %INF_STYLE_WIN4           = &H00000002       '  Win95
    
    
    '  Additional InfStyle flags that may be specified when calling SetupOpenInfFile.
    
    %INF_STYLE_CACHE_ENABLE   = &H00000010 '  always cache INF, even outside of %windir%\Inf
    %INF_STYLE_CACHE_DISABLE  = &H00000020 '  delete cached INF information
    #IF (%SETUPAPI_VER >= &H0502)
        %INF_STYLE_CACHE_IGNORE   = &H00000040 '  ignore any cached INF information
    #ENDIF
    
    
    '
    '  Target directory specs.
    '
    %DIRID_ABSOLUTE          = -1             '  real 32-bit -1
    %DIRID_ABSOLUTE_16BIT    = &Hffff         '  16-bit -1 for compat w/setupx
    %DIRID_NULL              = 0
    %DIRID_SRCPATH           = 1
    %DIRID_WINDOWS           = 10
    %DIRID_SYSTEM            = 11              '  system32
    %DIRID_DRIVERS           = 12
    %DIRID_IOSUBSYS          = %DIRID_DRIVERS
    %DIRID_INF               = 17
    %DIRID_HELP              = 18
    %DIRID_FONTS             = 20
    %DIRID_VIEWERS           = 21
    %DIRID_COLOR             = 23
    %DIRID_APPS              = 24
    %DIRID_SHARED            = 25
    %DIRID_BOOT              = 30
    
    %DIRID_SYSTEM16          = 50
    %DIRID_SPOOL             = 51
    %DIRID_SPOOLDRIVERS      = 52
    %DIRID_USERPROFILE       = 53
    %DIRID_LOADER            = 54
    %DIRID_PRINTPROCESSOR    = 55
    
    %DIRID_DEFAULT           = %DIRID_SYSTEM
    
    '
    '  The following DIRIDs are for commonly-used shell "special folders".  The
    '  complete list of such folders is contained in shlobj.h.  In that headerfile,
    '  each folder is assigned a CSIDL_* value.  The DIRID values below are created
    '  by taking the CSIDL value in shlobj.h and OR'ing it with &H4000.  Thus, if
    '  an INF needs to reference other special folders not defined below, it may
    '  generate one using the above mechanism, and setupapi will automatically deal
    '  with it and use the corresponding shell's path where appropriate.  (Remember
    '  that DIRIDs must be specified in decimal, not hex, in an INF when used for
    '  string substitution.)
    '
    
    %DIRID_COMMON_STARTMENU        = 16406  '  All Users\Start Menu
    %DIRID_COMMON_PROGRAMS         = 16407  '  All Users\Start Menu\Programs
    %DIRID_COMMON_STARTUP          = 16408  '  All Users\Start Menu\Programs\Startup
    %DIRID_COMMON_DESKTOPDIRECTORY = 16409  '  All Users\Desktop
    %DIRID_COMMON_FAVORITES        = 16415  '  All Users\Favorites
    %DIRID_COMMON_APPDATA          = 16419  '  All Users\Application Data
    
    %DIRID_PROGRAM_FILES           = 16422  '  Program Files
    %DIRID_SYSTEM_X86              = 16425  '  system32 on RISC
    %DIRID_PROGRAM_FILES_X86       = 16426  '  Program Files on RISC
    %DIRID_PROGRAM_FILES_COMMON    = 16427  '  Program Files\Common
    %DIRID_PROGRAM_FILES_COMMONX86  =16428  '  x86 Program Files\Common on RISC
    
    %DIRID_COMMON_TEMPLATES        = 16429  '  All Users\Templates
    %DIRID_COMMON_DOCUMENTS        = 16430  '  All Users\Documents
    
    
    
    '  First user-definable dirid. See SetupSetDirectoryId().
    
    %DIRID_USER              = &H8000
    
    
    
    '  Setup callback notification routine type
    
    DECLARE FUNCTION PSP_FILE_CALLBACK(BYVAL dwContext AS DWORD, BYVAL dwNotification AS DWORD, BYVAL dwParam1 AS DWORD, BYVAL dwParam2 AS DWORD) AS DWORD
    
    
    '  Operation/queue start/end notification. These are ordinal values.
    
    %SPFILENOTIFY_STARTQUEUE         = &H00000001
    %SPFILENOTIFY_ENDQUEUE           = &H00000002
    %SPFILENOTIFY_STARTSUBQUEUE      = &H00000003
    %SPFILENOTIFY_ENDSUBQUEUE        = &H00000004
    %SPFILENOTIFY_STARTDELETE        = &H00000005
    %SPFILENOTIFY_ENDDELETE          = &H00000006
    %SPFILENOTIFY_DELETEERROR        = &H00000007
    %SPFILENOTIFY_STARTRENAME        = &H00000008
    %SPFILENOTIFY_ENDRENAME          = &H00000009
    %SPFILENOTIFY_RENAMEERROR        = &H0000000a
    %SPFILENOTIFY_STARTCOPY          = &H0000000b
    %SPFILENOTIFY_ENDCOPY            = &H0000000c
    %SPFILENOTIFY_COPYERROR          = &H0000000d
    %SPFILENOTIFY_NEEDMEDIA          = &H0000000e
    %SPFILENOTIFY_QUEUESCAN          = &H0000000f
    
    '  These are used with SetupIterateCabinet().
    
    %SPFILENOTIFY_CABINETINFO        = &H00000010
    %SPFILENOTIFY_FILEINCABINET      = &H00000011
    %SPFILENOTIFY_NEEDNEWCABINET     = &H00000012
    %SPFILENOTIFY_FILEEXTRACTED      = &H00000013
    %SPFILENOTIFY_FILEOPDELAYED      = &H00000014
    
    '  These are used for backup operations
    
    %SPFILENOTIFY_STARTBACKUP        = &H00000015
    %SPFILENOTIFY_BACKUPERROR        = &H00000016
    %SPFILENOTIFY_ENDBACKUP          = &H00000017
    
    '  Extended notification for SetupScanFileQueue(Flags=SPQ_SCAN_USE_CALLBACKEX)
    
    %SPFILENOTIFY_QUEUESCAN_EX       = &H00000018
    
    %SPFILENOTIFY_STARTREGISTRATION  = &H00000019
    %SPFILENOTIFY_ENDREGISTRATION    = &H00000020
    
    #IF (%SETUPAPI_VER >= &H0501)
    
    '  Extended notification for SetupScanFileQueue(Flags=SPQ_SCAN_USE_CALLBACK_SIGNERINFO)
    %SPFILENOTIFY_QUEUESCAN_SIGNERINFO = &H00000040
    
    #ENDIF
    
    
    '  Copy notification. These are bit flags that may be combined.
    
    %SPFILENOTIFY_LANGMISMATCH       = &H00010000
    %SPFILENOTIFY_TARGETEXISTS       = &H00020000
    %SPFILENOTIFY_TARGETNEWER        = &H00040000
    
    
    '  File operation codes and callback outcomes.
    
    %FILEOP_COPY                     = 0
    %FILEOP_RENAME                   = 1
    %FILEOP_DELETE                   = 2
    %FILEOP_BACKUP                   = 3
    
    %FILEOP_ABORT                    = 0
    %FILEOP_DOIT                     = 1
    %FILEOP_SKIP                     = 2
    %FILEOP_RETRY                    = %FILEOP_DOIT
    %FILEOP_NEWPATH                  = 4
    
    
    '  Flags in inf copy sections
    
    %COPYFLG_WARN_IF_SKIP            = &H00000001  '  warn if user tries to skip file
    %COPYFLG_NOSKIP                  = &H00000002  '  disallow skipping this file
    %COPYFLG_NOVERSIONCHECK          = &H00000004  '  ignore versions and overwrite target
    %COPYFLG_FORCE_FILE_IN_USE       = &H00000008  '  force file-in-use behavior
    %COPYFLG_NO_OVERWRITE            = &H00000010  '  do not copy if file exists on target
    %COPYFLG_NO_VERSION_DIALOG       = &H00000020  '  do not copy if target is newer
    %COPYFLG_OVERWRITE_OLDER_ONLY    = &H00000040  '  leave target alone if version same as source
    %COPYFLG_REPLACEONLY             = &H00000400  '  copy only if file exists on target
    %COPYFLG_NODECOMP                = &H00000800  '  don't attempt to decompress file; copy as-is
    %COPYFLG_REPLACE_BOOT_FILE       = &H00001000  '  file must be present upon reboot (i.e., it's
                                                   '  needed by the loader); this flag implies a reboot
    %COPYFLG_NOPRUNE                 = &H00002000  '  never prune this file
    
    
    '  Flags in inf delete sections
    '  New flags go in high word
    
    %DELFLG_IN_USE                   = &H00000001  '  queue in-use file for delete
    %DELFLG_IN_USE1                  = &H00010000  '  high-word version of DELFLG_IN_USE
    
    
    '  Source and file paths. Used when notifying queue callback
    '  of SPFILENOTIFY_STARTxxx, SPFILENOTIFY_ENDxxx, and SPFILENOTIFY_xxxERROR.
    
    TYPE FILEPATHS
         Target AS DWORD                       '  ANSI or UNICODE Strings
         Source AS DWORD                       '  not used for delete operations
         Win32Error AS DWORD
         Flags AS DWORD                        '  such as SP_COPY_NOSKIP for copy errors
    END TYPE
    
    
    #IF %SETUPAPI_VER >= &H0501
    
    TYPE FILEPATHS_SIGNERINFO
         Target AS DWORD                       '  ANSI or UNICODE Strings
         Source AS DWORD                       '  not used for delete operations
         Win32Error AS DWORD
         Flags AS DWORD                        '  such as SP_COPY_NOSKIP for copy errors
         DigitalSigner AS DWORD
         Version AS DWORD
         CatalogFile AS DWORD
    END TYPE
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    '
    '  Structure used with SPFILENOTIFY_NEEDMEDIA
    '
    TYPE SOURCE_MEDIA
         Reserved AS DWORD                     '  ANSI or UNICODE Strings
         Tagfile AS DWORD                      '  may be NULL
         Description AS DWORD
    
        '  Pathname part and filename part of source file
        '  that caused us to need the media.
    
         SourcePath AS DWORD                   '  ANSI or UNICODE Strings
         SourceFile AS DWORD                   '  ANSI or UNICODE Strings
         Flags AS DWORD                        '  subset of SP_COPY_xxx
    END TYPE
    
    '  Structure used with SPFILENOTIFY_CABINETINFO and
    '  SPFILENOTIFY_NEEDNEWCABINET
    
    TYPE CABINET_INFO
         CabinetPath AS DWORD                  '  ANSI or UNICODE Strings
         CabinetFile AS DWORD                  '  ANSI or UNICODE Strings
         DiskName AS DWORD
         SetId AS WORD
         CabinetNumber AS WORD
    END TYPE
    
    '
    '  Structure used with SPFILENOTIFY_FILEINCABINET
    '
    TYPE FILE_IN_CABINET_INFO
         NameInCabinet AS DWORD                '  ANSI or UNICODE Strings
         FileSize AS DWORD
         Win32Error AS DWORD
         DosDate AS WORD
         DosTime AS WORD
         DosAttribs AS WORD
         FullTargetName AS ASCIIZ * %MAX_PATH
    END TYPE
    
    
    '  Structure used for SPFILENOTIFY_REGISTRATION
    '  callback
    
    TYPE SP_REGISTER_CONTROL_STATUS
         cbSize AS DWORD
         FileName AS DWORD                     '  ANSI or UNICODE Strings
         Win32Error AS DWORD
         FailureCode AS DWORD
    END TYPE
    
    
    '  valid values for SP_REGISTER_CONTROL_STATUS.FailureCode field
    
    
    %SPREG_SUCCESS      = &H00000000
    %SPREG_LOADLIBRARY  = &H00000001
    %SPREG_GETPROCADDR  = &H00000002
    %SPREG_REGSVR       = &H00000003
    %SPREG_DLLINSTALL   = &H00000004
    %SPREG_TIMEOUT      = &H00000005
    %SPREG_UNKNOWN      = &HFFFFFFFF
    
    
    '  Define type for setup file queue
    
    MACRO HSPFILEQ = DWORD
    
    
    '  Structure used with SetupQueueCopyIndirect
    
    TYPE SP_FILE_COPY_PARAMS_A
         cbSize AS DWORD
         QueueHandle AS HSPFILEQ
         SourceRootPath AS DWORD               '  ANSI Strings
         SourcePath AS DWORD                   '  ANSI Strings
         SourceFilename AS DWORD               '  ANSI Strings
         SourceDescription AS DWORD            '  ANSI Strings
         SourceTagfile AS DWORD                '  ANSI Strings
         TargetDirectory AS DWORD              '  ANSI Strings
         TargetFilename AS DWORD               '  ANSI Strings
         CopyStyle AS DWORD
         LayoutInf AS HINF
         SecurityDescriptor AS DWORD           '  ANSI Strings
    END TYPE
    
    TYPE SP_FILE_COPY_PARAMS_W
         cbSize AS DWORD
         QueueHandle AS HSPFILEQ
         SourceRootPath AS DWORD               '  UNICODE Strings
         SourcePath AS DWORD                   '  UNICODE Strings
         SourceFilename AS DWORD               '  UNICODE Strings
         SourceDescription AS DWORD            '  UNICODE Strings
         SourceTagfile AS DWORD                '  UNICODE Strings
         TargetDirectory AS DWORD              '  UNICODE Strings
         TargetFilename AS DWORD               '  UNICODE Strings
         CopyStyle AS DWORD
         LayoutInf AS HINF
         SecurityDescriptor AS DWORD           '  UNICODE Strings
    END TYPE
    
    
    '  Define type for setup disk space list
    
    MACRO HDSKSPC = DWORD
    
    
    
    '  Define type for reference to device information set
    
    MACRO HDEVINFO = DWORD
    
    
    TYPE SP_DEVINFO_DATA
         cbSize AS DWORD
         ClassGuid AS GUID
         DevInst AS DWORD                      '  DEVINST handle
         Reserved AS DWORD
    END TYPE
    
    
    '  Device interface information structure (references a device
    '  interface that is associated with the device information
    '  element that owns it).
    
    TYPE SP_DEVICE_INTERFACE_DATA
         cbSize AS DWORD
         InterfaceClassGuid AS GUID
         Flags AS DWORD
         Reserved AS DWORD
    END TYPE
    
    
    '  Flags for SP_DEVICE_INTERFACE_DATA.Flags field.
    
    %SPINT_ACTIVE  = &H00000001
    %SPINT_DEFAULT  =&H00000002
    %SPINT_REMOVED  =&H00000004
    
    
    '  Backward compatibility--do not use.
    
    MACRO SP_INTERFACE_DEVICE_DATA = SP_DEVICE_INTERFACE_DATA
    
    %SPID_ACTIVE              = %SPINT_ACTIVE
    %SPID_DEFAULT             = %SPINT_DEFAULT
    %SPID_REMOVED             = %SPINT_REMOVED
    
    TYPE SP_DEVICE_INTERFACE_DETAIL_DATA
         cbSize AS DWORD
         DevicePath AS BYTE PTR       ' Byte array. ANSI or UNICODE strings.
    END TYPE
    
    MACRO SP_DEVICE_INTERFACE_DETAIL_DATA_A = SP_DEVICE_INTERFACE_DETAIL_DATA
    MACRO SP_DEVICE_INTERFACE_DETAIL_DATA_W = SP_DEVICE_INTERFACE_DETAIL_DATA
    
    
    '  Structure for detailed information on a device information set (used for
    '  SetupDiGetDeviceInfoListDetail which supercedes the functionality of
    '  SetupDiGetDeviceInfoListClass).
    
    TYPE SP_DEVINFO_LIST_DETAIL_DATA_A
         cbSize AS DWORD
         ClassGuid AS GUID
         RemoteMachineHandle AS DWORD
         RemoteMachineName AS ASCIIZ * %SP_MAX_MACHINENAME_LENGTH
    END TYPE
    
    TYPE SP_DEVINFO_LIST_DETAIL_DATA_W
         cbSize AS DWORD
         ClassGuid AS GUID
         RemoteMachineHandle AS DWORD
         RemoteMachineName AS STRING * (%SP_MAX_MACHINENAME_LENGTH*2)  ' Must use fixed string for this UNICODE.
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_DEVINFO_LIST_DETAIL_DATA = SP_DEVINFO_LIST_DETAIL_DATA_W
    #ELSE
        MACRO SP_DEVINFO_LIST_DETAIL_DATA = SP_DEVINFO_LIST_DETAIL_DATA_A
    #ENDIF
    
    
    '  Class installer function codes
    
    %DIF_SELECTDEVICE                   = &H00000001
    %DIF_INSTALLDEVICE                  = &H00000002
    %DIF_ASSIGNRESOURCES                = &H00000003
    %DIF_PROPERTIES                     = &H00000004
    %DIF_REMOVE                         = &H00000005
    %DIF_FIRSTTIMESETUP                 = &H00000006
    %DIF_FOUNDDEVICE                    = &H00000007
    %DIF_SELECTCLASSDRIVERS             = &H00000008
    %DIF_VALIDATECLASSDRIVERS           = &H00000009
    %DIF_INSTALLCLASSDRIVERS            = &H0000000A
    %DIF_CALCDISKSPACE                  = &H0000000B
    %DIF_DESTROYPRIVATEDATA             = &H0000000C
    %DIF_VALIDATEDRIVER                 = &H0000000D
    %DIF_DETECT                         = &H0000000F
    %DIF_INSTALLWIZARD                  = &H00000010
    %DIF_DESTROYWIZARDDATA              = &H00000011
    %DIF_PROPERTYCHANGE                 = &H00000012
    %DIF_ENABLECLASS                    = &H00000013
    %DIF_DETECTVERIFY                   = &H00000014
    %DIF_INSTALLDEVICEFILES             = &H00000015
    %DIF_UNREMOVE                       = &H00000016
    %DIF_SELECTBESTCOMPATDRV            = &H00000017
    %DIF_ALLOW_INSTALL                  = &H00000018
    %DIF_REGISTERDEVICE                 = &H00000019
    %DIF_NEWDEVICEWIZARD_PRESELECT      = &H0000001A
    %DIF_NEWDEVICEWIZARD_SELECT         = &H0000001B
    %DIF_NEWDEVICEWIZARD_PREANALYZE     = &H0000001C
    %DIF_NEWDEVICEWIZARD_POSTANALYZE    = &H0000001D
    %DIF_NEWDEVICEWIZARD_FINISHINSTALL  = &H0000001E
    %DIF_UNUSED1                        = &H0000001F
    %DIF_INSTALLINTERFACES              = &H00000020
    %DIF_DETECTCANCEL                   = &H00000021
    %DIF_REGISTER_COINSTALLERS          = &H00000022
    %DIF_ADDPROPERTYPAGE_ADVANCED       = &H00000023
    %DIF_ADDPROPERTYPAGE_BASIC          = &H00000024
    %DIF_RESERVED1                      = &H00000025
    %DIF_TROUBLESHOOTER                 = &H00000026
    %DIF_POWERMESSAGEWAKE               = &H00000027
    %DIF_ADDREMOTEPROPERTYPAGE_ADVANCED = &H00000028
    %DIF_UPDATEDRIVER_UI                = &H00000029
    %DIF_RESERVED2                      = &H00000030
    
    '
    '  Obsoleted DIF codes (do not use)
    '
    %DIF_MOVEDEVICE                     = &H0000000E
    
    
    MACRO DI_FUNCTION = DWORD   '  Function type for device installer
    
    
    '  Device installation parameters structure (associated with a
    '  particular device information element, or globally with a device
    '  information set)
    
    TYPE SP_DEVINSTALL_PARAMS_A
         cbSize AS DWORD
         Flags AS DWORD
         FlagsEx AS DWORD
         hwndParent AS LONG
         InstallMsgHandler AS DWORD        ' Code pointer to a PSP_FILE_CALLBACK function.
         InstallMsgHandlerContext AS LONG
         FileQueue AS HSPFILEQ
         ClassInstallReserved AS DWORD
         Reserved AS DWORD
         DriverPath AS ASCIIZ * %MAX_PATH
    END TYPE
    
    TYPE SP_DEVINSTALL_PARAMS_W
         cbSize AS DWORD
         Flags AS DWORD
         FlagsEx AS DWORD
         hwndParent AS LONG
         InstallMsgHandler AS DWORD        ' Code pointer to a PSP_FILE_CALLBACK function.
         InstallMsgHandlerContext AS LONG
         FileQueue AS HSPFILEQ
         ClassInstallReserved AS DWORD
         Reserved AS DWORD
         DriverPath AS STRING * %MAX_PATH * 2
    END TYPE
    
    
    #IF %DEF(%UNICODE)
        MACRO SP_DEVINSTALL_PARAMS = SP_DEVINSTALL_PARAMS_W
    #ELSE
        MACRO SP_DEVINSTALL_PARAMS = SP_DEVINSTALL_PARAMS_A
    #ENDIF
    
    
    '
    '  SP_DEVINSTALL_PARAMS.Flags values
    '
    '  Flags for choosing a device
    '
    %DI_SHOWOEM                  = &H00000001&     '  support Other... button
    %DI_SHOWCOMPAT               = &H00000002&     '  show compatibility list
    %DI_SHOWCLASS                = &H00000004&     '  show class list
    %DI_SHOWALL                  = &H00000007&     '  both class & compat list shown
    %DI_NOVCP                    = &H00000008&     '  don't create a new copy queue--use
                                                        '  caller-supplied FileQueue
    %DI_DIDCOMPAT                = &H00000010&     '  Searched for compatible devices
    %DI_DIDCLASS                 = &H00000020&     '  Searched for class devices
    %DI_AUTOASSIGNRES            = &H00000040&     '  No UI for resources if possible
    
    '  flags returned by DiInstallDevice to indicate need to reboot/restart
    %DI_NEEDRESTART              = &H00000080&     '  Reboot required to take effect
    %DI_NEEDREBOOT               = &H00000100&     '  ""
    
    '  flags for device installation
    %DI_NOBROWSE                 = &H00000200&     '  no Browse... in InsertDisk
    
    '  Flags set by DiBuildDriverInfoList
    %DI_MULTMFGS                 = &H00000400&     '  Set if multiple manufacturers in
                                                        '  class driver list
    
    '  Flag indicates that device is disabled
    %DI_DISABLED                 = &H00000800&     '  Set if device disabled
    
    '  Flags for Device/Class Properties
    %DI_GENERALPAGE_ADDED        = &H00001000&
    %DI_RESOURCEPAGE_ADDED       = &H00002000&
    
    '  Flag to indicate the setting properties for this Device (or class) caused a change
    '  so the Dev Mgr UI probably needs to be updatd.
    %DI_PROPERTIES_CHANGE        = &H00004000&
    
    '  Flag to indicate that the sorting from the INF file should be used.
    %DI_INF_IS_SORTED            = &H00008000&
    
    '  Flag to indicate that only the the INF specified by SP_DEVINSTALL_PARAMS.DriverPath
    '  should be searched.
    %DI_ENUMSINGLEINF            = &H00010000&
    
    '  Flag that prevents ConfigMgr from removing/re-enumerating devices during device
    '  registration, installation, and deletion.
    %DI_DONOTCALLCONFIGMG        = &H00020000&
    
    '  The following flag can be used to install a device disabled
    %DI_INSTALLDISABLED          = &H00040000&
    
    '  Flag that causes SetupDiBuildDriverInfoList to build a device's compatible driver
    '  list from its existing class driver list, instead of the normal INF search.
    %DI_COMPAT_FROM_CLASS        = &H00080000&
    
    '  This flag is set if the Class Install params should be used.
    %DI_CLASSINSTALLPARAMS       = &H00100000&
    
    '  This flag is set if the caller of DiCallClassInstaller does NOT
    '  want the internal default action performed if the Class installer
    '  returns ERROR_DI_DO_DEFAULT.
    %DI_NODI_DEFAULTACTION       = &H00200000&
    
    '  The setupx flag, DI_NOSYNCPROCESSING (&H00400000&) is not support in the Setup APIs.
    
    '  flags for device installation
    %DI_QUIETINSTALL             = &H00800000&     '  don't confuse the user with
    '  questions or excess info
    %DI_NOFILECOPY               = &H01000000&     '  No file Copy necessary
    %DI_FORCECOPY                = &H02000000&     '  Force files to be copied from install path
    %DI_DRIVERPAGE_ADDED         = &H04000000&     '  Prop provider added Driver page.
    %DI_USECI_SELECTSTRINGS      = &H08000000&     '  Use Class Installer Provided strings in the Select Device Dlg
    %DI_OVERRIDE_INFFLAGS        = &H10000000&     '  Override INF flags
    %DI_PROPS_NOCHANGEUSAGE      = &H20000000&     '  No Enable/Disable in General Props
    
    %DI_NOSELECTICONS            = &H40000000&     '  No small icons in select device dialogs
    
    %DI_NOWRITE_IDS              = &H80000000&     '  Don't write HW And Compat IDs on install
    
    
    
    '  SP_DEVINSTALL_PARAMS.FlagsEx values
    
    %DI_FLAGSEX_USEOLDINFSEARCH          = &H00000001&  '  Inf Search functions should not use Index Search
    %DI_FLAGSEX_RESERVED2                = &H00000002&  '  DI_FLAGSEX_AUTOSELECTRANK0 is obsolete
    %DI_FLAGSEX_CI_FAILED                = &H00000004&  '  Failed to Load/Call class installer
    
    %DI_FLAGSEX_DIDINFOLIST              = &H00000010&  '  Did the Class Info List
    %DI_FLAGSEX_DIDCOMPATINFO            = &H00000020&  '  Did the Compat Info List
    
    %DI_FLAGSEX_FILTERCLASSES            = &H00000040&
    %DI_FLAGSEX_SETFAILEDINSTALL         = &H00000080&
    %DI_FLAGSEX_DEVICECHANGE             = &H00000100&
    %DI_FLAGSEX_ALWAYSWRITEIDS           = &H00000200&
    %DI_FLAGSEX_PROPCHANGE_PENDING       = &H00000400&  '  One or more device property sheets have had changes made
    '  to them, and need to have a DIF_PROPERTYCHANGE occur.
    %DI_FLAGSEX_ALLOWEXCLUDEDDRVS        = &H00000800&
    %DI_FLAGSEX_NOUIONQUERYREMOVE        = &H00001000&
    %DI_FLAGSEX_USECLASSFORCOMPAT        = &H00002000&  '  Use the device's class when building compat drv list.
    '  (Ignored if DI_COMPAT_FROM_CLASS flag is specified.)
    %DI_FLAGSEX_RESERVED3                = &H00004000&
    %DI_FLAGSEX_NO_DRVREG_MODIFY         = &H00008000&  '  Don't run AddReg and DelReg for device's software (driver) key.
    %DI_FLAGSEX_IN_SYSTEM_SETUP          = &H00010000&  '  Installation is occurring during initial system setup.
    %DI_FLAGSEX_INET_DRIVER              = &H00020000&  '  Driver came from Windows Update
    %DI_FLAGSEX_APPENDDRIVERLIST         = &H00040000&  '  Cause SetupDiBuildDriverInfoList to append
    '  a new driver list to an existing list.
    %DI_FLAGSEX_PREINSTALLBACKUP         = &H00080000&  '  backup all files required by old inf before install
    %DI_FLAGSEX_BACKUPONREPLACE          = &H00100000&  '  backup files required by old inf as they are replaced
    %DI_FLAGSEX_DRIVERLIST_FROM_URL      = &H00200000&  '  build driver list from INF(s) retrieved from URL specified
    '  in SP_DEVINSTALL_PARAMS.DriverPath (empty string means
    '  Windows Update website)
    %DI_FLAGSEX_RESERVED1                = &H00400000&
    %DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS  =&H00800000&  '  Don't include old Internet drivers when building
    '  a driver list.
    %DI_FLAGSEX_POWERPAGE_ADDED          = &H01000000&  '  class installer added their own power page
    
    
    #IF %SETUPAPI_VER >= &H0501
    
    %DI_FLAGSEX_FILTERSIMILARDRIVERS     = &H02000000&  '  only include similar drivers in class list
    %DI_FLAGSEX_INSTALLEDDRIVER          = &H04000000&  '  only add the installed driver to the class or compat
    '  driver list.  Used in calls to SetupDiBuildDriverInfoList
    %DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE  = &H08000000&  '  Don't remove identical driver nodes from the class list
    %DI_FLAGSEX_ALTPLATFORM_DRVSEARCH    = &H10000000&  '  Build driver list based on alternate platform information
    '  specified in associated file queue
    %DI_FLAGSEX_RESTART_DEVICE_ONLY      = &H20000000&  '  only restart the device drivers are being installed on as
    '  opposed to restarting all devices using those drivers.
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Class installation parameters header.  This must be the first field of any
    '  class install parameter structure.  The InstallFunction field must be set to
    '  the function code corresponding to the structure, and the cbSize field must
    '  be set to the size of the header structure.  E.g.,
    
    '  SP_ENABLECLASS_PARAMS EnableClassParams
    
    '  EnableClassParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER)
    '  EnableClassParams.ClassInstallHeader.InstallFunction = DIF_ENABLECLASS
    
    TYPE SP_CLASSINSTALL_HEADER
         cbSize AS DWORD
         InstallFunction AS DI_FUNCTION
    END TYPE
    
    
    
    '  Structure corresponding to a DIF_ENABLECLASS install function.
    
    TYPE SP_ENABLECLASS_PARAMS
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         ClassGuid AS GUID
         EnableMessage AS DWORD
    END TYPE
    
    %ENABLECLASS_QUERY   = 0
    %ENABLECLASS_SUCCESS  =1
    %ENABLECLASS_FAILURE  =2
    
    
    
    '  Values indicating a change in a device's state
    
    %DICS_ENABLE      = &H00000001
    %DICS_DISABLE     = &H00000002
    %DICS_PROPCHANGE  = &H00000003
    %DICS_START       = &H00000004
    %DICS_STOP        = &H00000005
    
    '  Values specifying the scope of a device property change
    
    %DICS_FLAG_GLOBAL         = &H00000001  '  make change in all hardware profiles
    %DICS_FLAG_CONFIGSPECIFIC  =&H00000002  '  make change in specified profile only
    %DICS_FLAG_CONFIGGENERAL  = &H00000004  '  1 or more hardware profile-specific
    '  changes to follow.
    
    '  Structure corresponding to a DIF_PROPERTYCHANGE install function.
    
    TYPE SP_PROPCHANGE_PARAMS
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         StateChange AS DWORD
         Scope AS DWORD
         HwProfile AS DWORD
    END TYPE
    
    
    
    '  Structure corresponding to a DIF_REMOVE install function.
    
    TYPE SP_REMOVEDEVICE_PARAMS
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         Scope AS DWORD
         HwProfile AS DWORD
    END TYPE
    
    %DI_REMOVEDEVICE_GLOBAL                  = &H00000001
    %DI_REMOVEDEVICE_CONFIGSPECIFIC          = &H00000002
    
    
    
    '  Structure corresponding to a DIF_UNREMOVE install function.
    
    TYPE SP_UNREMOVEDEVICE_PARAMS
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         Scope AS DWORD
         HwProfile AS DWORD
    END TYPE
    
    %DI_UNREMOVEDEVICE_CONFIGSPECIFIC        = &H00000002
    
    
    
    '  Structure corresponding to a DIF_SELECTDEVICE install function.
    
    TYPE SP_SELECTDEVICE_PARAMS_A
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         Title AS ASCIIZ * %MAX_TITLE_LEN
         Instructions AS ASCIIZ * %MAX_INSTRUCTION_LEN
         ListLabel AS ASCIIZ * %MAX_LABEL_LEN
         SubTitle AS ASCIIZ * %MAX_SUBTITLE_LEN
         Reserved(2) AS BYTE                   '  DWORD size alignment
    END TYPE
    
    TYPE SP_SELECTDEVICE_PARAMS_W
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         Title AS STRING * %MAX_TITLE_LEN * 2
         Instructions AS STRING * %MAX_INSTRUCTION_LEN * 2
         ListLabel AS STRING * %MAX_LABEL_LEN * 2
         SubTitle AS STRING * %MAX_SUBTITLE_LEN * 2
    END TYPE
    
    
    #IF %DEF(%UNICODE)
        MACRO SP_SELECTDEVICE_PARAMS = SP_SELECTDEVICE_PARAMS_W
    #ELSE
        MACRO SP_SELECTDEVICE_PARAMS = SP_SELECTDEVICE_PARAMS_A
    #ENDIF
    
    
    '
    '  Callback routine for giving progress notification during detection
    '
    DECLARE FUNCTION DETECT_PROGRESS_NOTIFY(BYVAL ProgressNotifyParam AS DWORD, BYVAL DetectComplete AS DWORD) AS LONG
    
    '  where:
    '      ProgressNotifyParam - value supplied by caller requesting detection.
    '      DetectComplete - Percent completion, to be incremented by class
    '                       installer, as it steps thru its detection.
    '
    '  Return Value - If TRUE, then detection is cancelled.  Allows caller
    '                 requesting detection to stop detection asap.
    '
    
    
    '  Structure corresponding to a DIF_DETECT install function.
    
    TYPE SP_DETECTDEVICE_PARAMS
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         DetectProgressNotify AS DWORD ' Code pointer to DETECT_PROGRESS_NOTIFY function
         ProgressNotifyParam AS LONG
    END TYPE
    
    
    
    '  'Add New Device' installation wizard structure (backward-compatibility
    '  only--respond to DIF_NEWDEVICEWIZARD_* requests instead).
    
    '  Structure corresponding to a DIF_INSTALLWIZARD install function.
    '  (NOTE: This structure is also applicable for DIF_DESTROYWIZARDDATA,
    '  but DIF_INSTALLWIZARD is the associated function code in the class
    '  installation parameter structure in both cases.)
    
    '  Define maximum number of dynamic wizard pages that can be added to
    '  hardware install wizard.
    
    %MAX_INSTALLWIZARD_DYNAPAGES             = 20
    
    TYPE SP_INSTALLWIZARD_DATA
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         Flags AS DWORD
         DynamicPages(%MAX_INSTALLWIZARD_DYNAPAGES) AS DWORD
         NumDynamicPages AS DWORD
         DynamicPageFlags AS DWORD
         PrivateFlags AS DWORD
         PrivateData AS LONG
         hwndWizardDlg AS LONG
    END TYPE
    
    
    '  SP_INSTALLWIZARD_DATA.Flags values
    
    %NDW_INSTALLFLAG_DIDFACTDEFS         = &H00000001
    %NDW_INSTALLFLAG_HARDWAREALLREADYIN  = &H00000002
    %NDW_INSTALLFLAG_NEEDRESTART         = %DI_NEEDRESTART
    %NDW_INSTALLFLAG_NEEDREBOOT          = %DI_NEEDREBOOT
    %NDW_INSTALLFLAG_NEEDSHUTDOWN        = &H00000200
    %NDW_INSTALLFLAG_EXPRESSINTRO        = &H00000400
    %NDW_INSTALLFLAG_SKIPISDEVINSTALLED  = &H00000800
    %NDW_INSTALLFLAG_NODETECTEDDEVS      = &H00001000
    %NDW_INSTALLFLAG_INSTALLSPECIFIC     = &H00002000
    %NDW_INSTALLFLAG_SKIPCLASSLIST       = &H00004000
    %NDW_INSTALLFLAG_CI_PICKED_OEM       = &H00008000
    %NDW_INSTALLFLAG_PCMCIAMODE          = &H00010000
    %NDW_INSTALLFLAG_PCMCIADEVICE        = &H00020000
    %NDW_INSTALLFLAG_USERCANCEL          = &H00040000
    %NDW_INSTALLFLAG_KNOWNCLASS          = &H00080000
    
    
    
    '  SP_INSTALLWIZARD_DATA.DynamicPageFlags values
    
    '  This flag is set if a Class installer has added pages to the install wizard.
    
    %DYNAWIZ_FLAG_PAGESADDED             = &H00000001
    
    
    '  Set this flag if you jump to the analyze page, and want it to
    '  handle conflicts for you.  NOTE.  You will not get control back
    '  in the event of a conflict if you set this flag.
    
    %DYNAWIZ_FLAG_ANALYZE_HANDLECONFLICT  =&H00000008
    
    
    '  The following flags are not used by the Windows NT hardware wizard.
    
    %DYNAWIZ_FLAG_INSTALLDET_NEXT        = &H00000002
    %DYNAWIZ_FLAG_INSTALLDET_PREV        = &H00000004
    
    
    
    '  Reserve a range of wizard page resource IDs for internal use.  Some of
    '  these IDs are for use by class installers that respond to the obsolete
    '  DIF_INSTALLWIZARD/DIF_DESTROYWIZARDDATA messages.  These IDs are listed
    '  below.
    
    %MIN_IDD_DYNAWIZ_RESOURCE_ID             = 10000
    %MAX_IDD_DYNAWIZ_RESOURCE_ID             = 11000
    
    
    '  Define wizard page resource IDs to be used when adding custom pages to the
    '  hardware install wizard via DIF_INSTALLWIZARD.  Pages marked with
    '  (CLASS INSTALLER PROVIDED) _must_ be supplied by the class installer if it
    '  responds to the DIF_INSTALLWIZARD request.
    
    
    
    '  Resource ID for the first page that the install wizard will go to after
    '  adding the class installer pages.  (CLASS INSTALLER PROVIDED)
    
    %IDD_DYNAWIZ_FIRSTPAGE                   = 10000
    
    
    '  Resource ID for the page that the Select Device page will go back to.
    '  (CLASS INSTALLER PROVIDED)
    
    %IDD_DYNAWIZ_SELECT_PREVPAGE             = 10001
    
    
    '  Resource ID for the page that the Select Device page will go forward to.
    '  (CLASS INSTALLER PROVIDED)
    
    %IDD_DYNAWIZ_SELECT_NEXTPAGE             = 10002
    
    
    '  Resource ID for the page that the Analyze dialog should go back to
    '  This will only be used in the event that there is a problem, and the user
    '  selects Back from the analyze proc. (CLASS INSTALLER PROVIDED)
    
    %IDD_DYNAWIZ_ANALYZE_PREVPAGE            = 10003
    
    
    '  Resource ID for the page that the Analyze dialog should go to if it
    '  continues from the analyze proc. (CLASS INSTALLER PROVIDED)
    
    %IDD_DYNAWIZ_ANALYZE_NEXTPAGE            = 10004
    
    
    '  Resource ID of the hardware install wizard's select device page.
    '  This ID can be used to go directly to the hardware install wizard's select
    '  device page.  (This is the resource ID of the Select Device wizard page
    '  retrieved via SetupDiGetWizardPage when SPWPT_SELECTDEVICE is the requested
    '  PageType.)
    
    %IDD_DYNAWIZ_SELECTDEV_PAGE              = 10009
    
    
    '  Resource ID of the hardware install wizard's device analysis page.
    '  This ID can be use to go directly to the hardware install wizard's analysis
    '  page.
    
    %IDD_DYNAWIZ_ANALYZEDEV_PAGE             = 10010
    
    
    '  Resource ID of the hardware install wizard's install detected devices page.
    '  This ID can be use to go directly to the hardware install wizard's install
    '  detected devices page.
    
    %IDD_DYNAWIZ_INSTALLDETECTEDDEVS_PAGE    = 10011
    
    
    '  Resource ID of the hardware install wizard's select class page.
    '  This ID can be use to go directly to the hardware install wizard's select
    '  class page.
    
    %IDD_DYNAWIZ_SELECTCLASS_PAGE            = 10012
    
    
    '  The following class installer-provided wizard page resource IDs are not used
    '  by the Windows NT hardware wizard.
    
    %IDD_DYNAWIZ_INSTALLDETECTED_PREVPAGE    = 10006
    %IDD_DYNAWIZ_INSTALLDETECTED_NEXTPAGE    = 10007
    %IDD_DYNAWIZ_INSTALLDETECTED_NODEVS      = 10008
    
    
    
    '  Structure corresponding to the following DIF_NEWDEVICEWIZARD_* install
    '  functions:
    
    '      DIF_NEWDEVICEWIZARD_PRESELECT
    '      DIF_NEWDEVICEWIZARD_SELECT
    '      DIF_NEWDEVICEWIZARD_PREANALYZE
    '      DIF_NEWDEVICEWIZARD_POSTANALYZE
    '      DIF_NEWDEVICEWIZARD_FINISHINSTALL
    
    TYPE SP_NEWDEVICEWIZARD_DATA
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         Flags AS DWORD                        '  presently unused--must be zero.
         DynamicPages(%MAX_INSTALLWIZARD_DYNAPAGES) AS DWORD
         NumDynamicPages AS DWORD
         hwndWizardDlg AS LONG
    END TYPE
    
    
    '  The same structure is also used for retrieval of property pages via the
    '  following install functions:
    
    '      DIF_ADDPROPERTYPAGE_ADVANCED
    '      DIF_ADDPROPERTYPAGE_BASIC
    '      DIF_ADDREMOTEPROPERTYPAGE_ADVANCED
    
    MACRO SP_ADDPROPERTYPAGE_DATA = SP_NEWDEVICEWIZARD_DATA
    
    
    '
    '  Structure corresponding to the DIF_TROUBLESHOOTER install function
    '
    TYPE SP_TROUBLESHOOTER_PARAMS_A
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         ChmFile AS ASCIIZ * %MAX_PATH
         HtmlTroubleShooter AS ASCIIZ * %MAX_PATH
    END TYPE
    
    TYPE SP_TROUBLESHOOTER_PARAMS_W
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         ChmFile AS STRING * %MAX_PATH * 2
         HtmlTroubleShooter AS STRING * %MAX_PATH
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_TROUBLESHOOTER_PARAMS = SP_TROUBLESHOOTER_PARAMS_W
    #ELSE
        MACRO SP_TROUBLESHOOTER_PARAMS = SP_TROUBLESHOOTER_PARAMS_A
    #ENDIF
    
    
    '
    '  Structure corresponding to the DIF_POWERMESSAGEWAKE install function
    '
    TYPE SP_POWERMESSAGEWAKE_PARAMS_A
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         PowerMessageWake AS ASCIIZ * %LINE_LEN * 2
    END TYPE
    
    TYPE SP_POWERMESSAGEWAKE_PARAMS_W
         ClassInstallHeader AS SP_CLASSINSTALL_HEADER
         PowerMessageWake AS STRING * %LINE_LEN * 4
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_POWERMESSAGEWAKE_PARAMS = SP_POWERMESSAGEWAKE_PARAMS_W
    #ELSE
        MACRO SP_POWERMESSAGEWAKE_PARAMS = SP_POWERMESSAGEWAKE_PARAMS_A
    #ENDIF
    
    '
    '  Driver information structure (member of a driver info list that may be associated
    '  with a particular device instance, or (globally) with a device information set)
    '
    TYPE SP_DRVINFO_DATA_V2_A
         cbSize AS DWORD
         DriverType AS DWORD
         Reserved AS DWORD
         Description AS ASCIIZ * %LINE_LEN
         MfgName AS ASCIIZ * %LINE_LEN
         ProviderName AS ASCIIZ * %LINE_LEN
         DriverDate AS FILETIME
         DriverVersion AS DWORD
    END TYPE
    
    TYPE SP_DRVINFO_DATA_V2_W
         cbSize AS DWORD
         DriverType AS DWORD
         Reserved AS DWORD
         Description AS STRING * %LINE_LEN * 2
         MfgName AS STRING * %LINE_LEN * 2
         ProviderName AS STRING * %LINE_LEN * 2
         DriverDate AS FILETIME
         DriverVersion AS DWORD
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_DRVINFO_DATA_V2 = SP_DRVINFO_DATA_V2_W
    #ELSE
        MACRO SP_DRVINFO_DATA_V2 = SP_DRVINFO_DATA_V2_A
    #ENDIF
    
    
    '  Version 1 of the SP_DRVINFO_DATA structures, used only for compatibility
    '  with Windows NT 4.0/Windows 95/98 SETUPAPI.DLL
    
    TYPE SP_DRVINFO_DATA_V1_A
         cbSize AS DWORD
         DriverType AS DWORD
         Reserved AS DWORD
         Description AS ASCIIZ * %LINE_LEN
         MfgName AS ASCIIZ * %LINE_LEN
         ProviderName AS ASCIIZ * %LINE_LEN
    END TYPE
    
    TYPE SP_DRVINFO_DATA_V1_W
         cbSize AS DWORD
         DriverType AS DWORD
         Reserved AS DWORD
         Description AS STRING * %LINE_LEN * 2
         MfgName AS STRING * %LINE_LEN * 2
         ProviderName AS STRING * %LINE_LEN * 2
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_DRVINFO_DATA_V1 = SP_DRVINFO_DATA_V1_W
    #ELSE
        MACRO SP_DRVINFO_DATA_V1 = SP_DRVINFO_DATA_V1_A
    #ENDIF
    
    
    #IF (%SETUPAPI_VER < &H0500)  ' use version 1 driver info data structure
    
        MACRO SP_DRVINFO_DATA   = SP_DRVINFO_DATA_V1
        MACRO SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V1
        MACRO SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V1
    
    #ELSE                       ' use version 2 driver info data structure
    
        MACRO SP_DRVINFO_DATA   = SP_DRVINFO_DATA_V2
        MACRO SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V2
        MACRO SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V2
    
    #ENDIF  ' use current version of driver info data structure
    
    
    
    '  Driver information details structure (provides detailed information about a
    '  particular driver information structure)
    
    TYPE SP_DRVINFO_DETAIL_DATA_A
         cbSize AS DWORD
         InfDate AS FILETIME
         CompatIDsOffset AS DWORD
         CompatIDsLength AS DWORD
         Reserved AS DWORD
         SectionName AS ASCIIZ * %LINE_LEN
         InfFileName AS ASCIIZ * %MAX_PATH
         DrvDescription AS ASCIIZ * %LINE_LEN
         HardwareID AS ASCIIZ * %ANYSIZE_ARRAY
    END TYPE
    
    TYPE SP_DRVINFO_DETAIL_DATA_W
         cbSize AS DWORD
         InfDate AS FILETIME
         CompatIDsOffset AS DWORD
         CompatIDsLength AS DWORD
         Reserved AS DWORD
         SectionName AS STRING * %LINE_LEN * 2
         InfFileName AS STRING * %MAX_PATH * 2
         DrvDescription AS STRING * %LINE_LEN * 2
         HardwareID AS STRING * %ANYSIZE_ARRAY * 2
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_DRVINFO_DETAIL_DATA = SP_DRVINFO_DETAIL_DATA_W
    #ELSE
        MACRO SP_DRVINFO_DETAIL_DATA = SP_DRVINFO_DETAIL_DATA_A
    #ENDIF
    
    
    
    ' Driver installation parameters (associated with a particular driver
    ' information element)
    
    TYPE SP_DRVINSTALL_PARAMS
         cbSize AS DWORD
         Rank AS DWORD
         Flags AS DWORD
         PrivateData AS DWORD
         Reserved AS DWORD
    END TYPE
    
    
    '  SP_DRVINSTALL_PARAMS.Flags values
    
    %DNF_DUPDESC             = &H00000001  '  Multiple providers have same desc
    %DNF_OLDDRIVER           = &H00000002  '  Driver node specifies old/current driver
    %DNF_EXCLUDEFROMLIST     = &H00000004  '  If set, this driver node will not be
    '  displayed in any driver select dialogs.
    %DNF_NODRIVER            = &H00000008  '  if we want to install no driver
    '  (e.g no mouse drv)
    %DNF_LEGACYINF           = &H00000010  '  Driver node came from an old-style INF (obsolete)
    %DNF_CLASS_DRIVER        = &H00000020  '  Driver node represents a class driver
    %DNF_COMPATIBLE_DRIVER   = &H00000040  '  Driver node represents a compatible driver
    %DNF_INET_DRIVER         = &H00000080  '  Driver comes from an internet source
    %DNF_UNUSED1             = &H00000100
    %DNF_INDEXED_DRIVER      = &H00000200  '  Driver is contained in the Windows Driver Index
    %DNF_OLD_INET_DRIVER     = &H00000400  '  Driver came from the Internet, but we don't currently
    '  have access to it's source files.  Never attempt to
    '  install a driver with this flag!
    %DNF_BAD_DRIVER          = &H00000800  '  Driver node should not be used at all
    %DNF_DUPPROVIDER         = &H00001000  '  Multiple drivers have the same provider and desc
    
    #IF %SETUPAPI_VER >= &H0501
    %DNF_INF_IS_SIGNED       = &H00002000  '  If file is digitally signed
    %DNF_OEM_F6_INF          = &H00004000  '  INF specified from F6 during textmode setup.
    %DNF_DUPDRIVERVER        = &H00008000  '  Multipe drivers have the same desc, provider, and DriverVer values
    %DNF_BASIC_DRIVER        = &H00010000  '  Driver provides basic functionality, but should
    '  not be chosen if other signed drivers exist.
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    #IF %SETUPAPI_VER >= &H0502
        %DNF_AUTHENTICODE_SIGNED  =&H00020000  '  Inf file is signed by an Authenticode(tm) catalog.
    #ENDIF '  %SETUPAPI_VER >= &H0502
    
    
    '  Rank values (the lower the Rank number, the better the Rank)
    
    %DRIVER_HARDWAREID_RANK  = &H00000FFF  '  Any rank less than or equal to
    '  this value is a trusted
    '  HardwareID match
    
    %DRIVER_COMPATID_RANK    = &H00003FFF  '  Any rank less than or equal to
    '  this (and greater than
    '  DRIVER_HARDWAREID_RANK) is a
    '  trusted CompatibleID match
    
    %DRIVER_UNTRUSTED_RANK   = &H00008000  '  Any rank with this bit set is an
    '  "untrusted" rank, meaning that
    '  the INF was unsigned.
    
    %DRIVER_UNTRUSTED_HARDWAREID_RANK  = &H00008FFF  '  Any rank less than or equal to
    '  this value (and greater than
    '  or equal to DRIVER_UNTRUSTED_RANK)
    '  is an untrusted HardwareID match
    
    %DRIVER_UNTRUSTED_COMPATID_RANK    = &H0000BFFF  '  Any rank less than or equal to
    '  this value (and greater than
    '  DRIVER_UNTRUSTED_HARDWAREID_RANK)
    '  is an untrusted CompatibleID match
    
    %DRIVER_W9X_SUSPECT_RANK            = &H0000C000 '  Any rank that is greater than
    '  or equal to this value, and lesser
    '  than or equal to &HFFFF is suspected
    '  to be a Win9x-only driver, because
    '  (a) it isn't signed, and (b) there
    '  is no NT-specific decoration to
    '  explicitly indicate that the INF
    '  supports Windows NT/2000/XP
    
    %DRIVER_W9X_SUSPECT_HARDWAREID_RANK  =&H0000CFFF '  Any rank less than or equal to this
    '  (and greater than or equal to
    '  DRIVER_W9X_SUSPECT_RANK) is a
    '  hardware ID match suspected of being
    '  only for Windows 9x platforms.
    
    %DRIVER_W9X_SUSPECT_COMPATID_RANK   = &H0000FFFF '  Any rank less than or equal to
    '  this (and greater than
    '  DRIVER_W9X_SUSPECT_HARDWAREID_RANK)
    '  is a compatible ID match suspected
    '  of being only for Windows 9x
    '  platforms.
    
    
    '  Setup callback routine for comparing detection signatures
    
    DECLARE FUNCTION SP_DETSIG_CMPPROC(BYREF NewDeviceData AS SP_DEVINFO_DATA, BYREF ExistingDeviceData AS SP_DEVINFO_DATA, BYREF CompareContext AS ANY) AS DWORD
    
    
    TYPE COINSTALLER_CONTEXT_DATA
         PostProcessing AS LONG
         InstallResult AS DWORD
         PrivateData AS LONG
    END TYPE
    
    
    '  Structure containing class image list information.
    
    TYPE SP_CLASSIMAGELIST_DATA
         cbSize AS DWORD
         ImageList AS DWORD
         Reserved AS DWORD
    END TYPE
    
    
    '  Structure to be passed as first parameter (LPVOID lpv) to ExtensionPropSheetPageProc
    '  entry point in setupapi.dll or to "EnumPropPages32" or "BasicProperties32" entry
    '  points provided by class/device property page providers.  Used to retrieve a handle
    '  (or, potentially, multiple handles) to property pages for a specified property page type.
    
    TYPE SP_PROPSHEETPAGE_REQUEST
         cbSize AS DWORD
         PageRequested AS DWORD
         DeviceInfoSet AS HDEVINFO
         DeviceInfoData AS SP_DEVINFO_DATA PTR
    END TYPE
    
    
    '  Property sheet codes used in SP_PROPSHEETPAGE_REQUEST.PageRequested
    
    %SPPSR_SELECT_DEVICE_RESOURCES      = 1    '  supplied by setupapi.dll
    %SPPSR_ENUM_BASIC_DEVICE_PROPERTIES = 2    '  supplied by device's BasicProperties32 provider
    %SPPSR_ENUM_ADV_DEVICE_PROPERTIES   = 3    '  supplied by class and/or device's EnumPropPages32 provider
    
    
    '  Structure used with SetupGetBackupInformation/SetupSetBackupInformation
    
    TYPE SP_BACKUP_QUEUE_PARAMS_V2_A
         cbSize AS DWORD                       '  size of structure
         FullInfPath AS ASCIIZ * %MAX_PATH     '  buffer to hold ANSI pathname of INF file
         FilenameOffset AS LONG                '  offset in CHAR's of filename part (after '\')
         ReinstallInstance AS ASCIIZ * %MAX_PATH  '  Instance ID (if present)
    END TYPE
    
    TYPE SP_BACKUP_QUEUE_PARAMS_V2_W
         cbSize AS DWORD                       '  size of structure
         FullInfPath AS STRING * %MAX_PATH * 2 '  buffer to hold UNICODE pathname of INF file
         FilenameOffset AS LONG                '  offset in WCHAR's of filename part (after '\')
         ReinstallInstance AS STRING * %MAX_PATH * 2 '  Instance ID (if present)
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_BACKUP_QUEUE_PARAMS_V2 = SP_BACKUP_QUEUE_PARAMS_V2_W
    #ELSE
        MACRO SP_BACKUP_QUEUE_PARAMS_V2 = SP_BACKUP_QUEUE_PARAMS_V2_A
    #ENDIF
    
    
    '  Version 1 of the SP_BACKUP_QUEUE_PARAMS structures, used only for compatibility
    '  with Windows 2000/Windows 95/98/ME SETUPAPI.DLL
    
    TYPE SP_BACKUP_QUEUE_PARAMS_V1_A
         cbSize AS DWORD                       '  size of structure
         FullInfPath AS ASCIIZ * %MAX_PATH     '  buffer to hold ANSI pathname of INF file
         FilenameOffset AS LONG                '  offset in CHAR's of filename part (after '\')
    END TYPE
    
    TYPE SP_BACKUP_QUEUE_PARAMS_V1_W
         cbSize AS DWORD                       '  size of structure
         FullInfPath AS ASCIIZ * %MAX_PATH     '  buffer to hold UNICODE pathname of INF file
         FilenameOffset AS LONG                '  offset in WCHAR's of filename part (after '\')
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_BACKUP_QUEUE_PARAMS_V1 = SP_BACKUP_QUEUE_PARAMS_V1_W
    #ELSE
        MACRO SP_BACKUP_QUEUE_PARAMS_V1 = SP_BACKUP_QUEUE_PARAMS_V1_A
    #ENDIF
    
    
    #IF %SETUPAPI_VER < &H0501
        MACRO SP_BACKUP_QUEUE_PARAMS   = SP_BACKUP_QUEUE_PARAMS_V1
        MACRO SP_BACKUP_QUEUE_PARAMS_A = SP_BACKUP_QUEUE_PARAMS_V1
        MACRO SP_BACKUP_QUEUE_PARAMS_W = SP_BACKUP_QUEUE_PARAMS_V1
    #ELSE
        MACRO SP_BACKUP_QUEUE_PARAMS   = SP_BACKUP_QUEUE_PARAMS_V2
        MACRO SP_BACKUP_QUEUE_PARAMS_A = SP_BACKUP_QUEUE_PARAMS_V2
        MACRO SP_BACKUP_QUEUE_PARAMS_W = SP_BACKUP_QUEUE_PARAMS_V2
    #ENDIF
    
    
    '
    ' Setupapi-specific error codes
    '
    ' Inf parse outcomes
    '
    %ERROR_EXPECTED_SECTION_NAME  = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR 0)
    %ERROR_BAD_SECTION_NAME_LINE  = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR 1)
    %ERROR_SECTION_NAME_TOO_LONG  = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR 2)
    %ERROR_GENERAL_SYNTAX         = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR 3)
    
    '  Inf runtime errors
    
    %ERROR_WRONG_INF_STYLE        = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H100)
    %ERROR_SECTION_NOT_FOUND      = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H101)
    %ERROR_LINE_NOT_FOUND         = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H102)
    %ERROR_NO_BACKUP              = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H103)
    
    '  Device Installer/other errors
    
    %ERROR_NO_ASSOCIATED_CLASS                = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H200)
    %ERROR_CLASS_MISMATCH                     = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H201)
    %ERROR_DUPLICATE_FOUND                    = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H202)
    %ERROR_NO_DRIVER_SELECTED                 = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H203)
    %ERROR_KEY_DOES_NOT_EXIST                 = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H204)
    %ERROR_INVALID_DEVINST_NAME               = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H205)
    %ERROR_INVALID_CLASS                      = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H206)
    %ERROR_DEVINST_ALREADY_EXISTS             = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H207)
    %ERROR_DEVINFO_NOT_REGISTERED             = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H208)
    %ERROR_INVALID_REG_PROPERTY               = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H209)
    %ERROR_NO_INF                             = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20A)
    %ERROR_NO_SUCH_DEVINST                    = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20B)
    %ERROR_CANT_LOAD_CLASS_ICON               = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20C)
    %ERROR_INVALID_CLASS_INSTALLER            = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20D)
    %ERROR_DI_DO_DEFAULT                      = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20E)
    %ERROR_DI_NOFILECOPY                      = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20F)
    %ERROR_INVALID_HWPROFILE                  = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H210)
    %ERROR_NO_DEVICE_SELECTED                 = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H211)
    %ERROR_DEVINFO_LIST_LOCKED                = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H212)
    %ERROR_DEVINFO_DATA_LOCKED                = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H213)
    %ERROR_DI_BAD_PATH                        = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H214)
    %ERROR_NO_CLASSINSTALL_PARAMS             = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H215)
    %ERROR_FILEQUEUE_LOCKED                   = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H216)
    %ERROR_BAD_SERVICE_INSTALLSECT            = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H217)
    %ERROR_NO_CLASS_DRIVER_LIST               = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H218)
    %ERROR_NO_ASSOCIATED_SERVICE              = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H219)
    %ERROR_NO_DEFAULT_DEVICE_INTERFACE        = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21A)
    %ERROR_DEVICE_INTERFACE_ACTIVE            = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21B)
    %ERROR_DEVICE_INTERFACE_REMOVED           = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21C)
    %ERROR_BAD_INTERFACE_INSTALLSECT          = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21D)
    %ERROR_NO_SUCH_INTERFACE_CLASS            = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21E)
    %ERROR_INVALID_REFERENCE_STRING           = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21F)
    %ERROR_INVALID_MACHINENAME                = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H220)
    %ERROR_REMOTE_COMM_FAILURE                = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H221)
    %ERROR_MACHINE_UNAVAILABLE                = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H222)
    %ERROR_NO_CONFIGMGR_SERVICES              = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H223)
    %ERROR_INVALID_PROPPAGE_PROVIDER          = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H224)
    %ERROR_NO_SUCH_DEVICE_INTERFACE           = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H225)
    %ERROR_DI_POSTPROCESSING_REQUIRED         = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H226)
    %ERROR_INVALID_COINSTALLER                = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H227)
    %ERROR_NO_COMPAT_DRIVERS                  = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H228)
    %ERROR_NO_DEVICE_ICON                     = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H229)
    %ERROR_INVALID_INF_LOGCONFIG              = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22A)
    %ERROR_DI_DONT_INSTALL                    = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22B)
    %ERROR_INVALID_FILTER_DRIVER              = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22C)
    %ERROR_NON_WINDOWS_NT_DRIVER              = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22D)
    %ERROR_NON_WINDOWS_DRIVER                 = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22E)
    %ERROR_NO_CATALOG_FOR_OEM_INF             = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22F)
    %ERROR_DEVINSTALL_QUEUE_NONNATIVE         = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H230)
    %ERROR_NOT_DISABLEABLE                    = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H231)
    %ERROR_CANT_REMOVE_DEVINST                = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H232)
    %ERROR_INVALID_TARGET                     = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H233)
    %ERROR_DRIVER_NONNATIVE                   = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H234)
    %ERROR_IN_WOW64                           = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H235)
    %ERROR_SET_SYSTEM_RESTORE_POINT           = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H236)
    %ERROR_INCORRECTLY_COPIED_INF             = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H237)
    %ERROR_SCE_DISABLED                       = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H238)
    %ERROR_UNKNOWN_EXCEPTION                  = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H239)
    %ERROR_PNP_REGISTRY_ERROR                 = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23A)
    %ERROR_REMOTE_REQUEST_UNSUPPORTED         = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23B)
    %ERROR_NOT_AN_INSTALLED_OEM_INF           = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23C)
    %ERROR_INF_IN_USE_BY_DEVICES              = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23D)
    %ERROR_DI_FUNCTION_OBSOLETE               = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23E)
    %ERROR_NO_AUTHENTICODE_CATALOG            = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23F)
    %ERROR_AUTHENTICODE_DISALLOWED            = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H240)
    %ERROR_AUTHENTICODE_TRUSTED_PUBLISHER     = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H241)
    %ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED  =(%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H242)
    %ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED  =(%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H243)
    %ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH     = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H244)
    %ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE     = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H245)
    
    
    '  Setupapi exception codes
    
    %ERROR_UNRECOVERABLE_STACK_OVERFLOW  =(%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H300)
    %EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW  =%ERROR_UNRECOVERABLE_STACK_OVERFLOW
    
    
    '  Backward compatibility--do not use.
    
    %ERROR_NO_DEFAULT_INTERFACE_DEVICE  =%ERROR_NO_DEFAULT_DEVICE_INTERFACE
    %ERROR_INTERFACE_DEVICE_ACTIVE     = %ERROR_DEVICE_INTERFACE_ACTIVE
    %ERROR_INTERFACE_DEVICE_REMOVED    = %ERROR_DEVICE_INTERFACE_REMOVED
    %ERROR_NO_SUCH_INTERFACE_DEVICE    = %ERROR_NO_SUCH_DEVICE_INTERFACE
    
    
    '  Win9x migration DLL error code
    
    %ERROR_NOT_INSTALLED  =(%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H1000)
    
    
    '  SearchControl flags for SetupGetInfInformation
    
    %INFINFO_INF_SPEC_IS_HINF        = 1
    %INFINFO_INF_NAME_IS_ABSOLUTE    = 2
    %INFINFO_DEFAULT_SEARCH          = 3
    %INFINFO_REVERSE_DEFAULT_SEARCH  = 4
    %INFINFO_INF_PATH_LIST_SEARCH    = 5
    
    '  Compression types
    
    %FILE_COMPRESSION_NONE       = 0
    %FILE_COMPRESSION_WINLZA     = 1
    %FILE_COMPRESSION_MSZIP      = 2
    %FILE_COMPRESSION_NTCAB      = 3
    
    '  Define flags for SourceList APIs.
    
    %SRCLIST_TEMPORARY       = &H00000001
    %SRCLIST_NOBROWSE        = &H00000002
    %SRCLIST_SYSTEM          = &H00000010
    %SRCLIST_USER            = &H00000020
    %SRCLIST_SYSIFADMIN      = &H00000040
    %SRCLIST_SUBDIRS         = &H00000100
    %SRCLIST_APPEND          = &H00000200
    %SRCLIST_NOSTRIPPLATFORM  =&H00000400
    
    '  Styles for SetupPromptForDisk, SetupCopyError,
    '  SetupRenameError, SetupDeleteError
    
    %IDF_NOBROWSE                    = &H00000001
    %IDF_NOSKIP                      = &H00000002
    %IDF_NODETAILS                   = &H00000004
    %IDF_NOCOMPRESSED                = &H00000008
    %IDF_CHECKFIRST                  = &H00000100
    %IDF_NOBEEP                      = &H00000200
    %IDF_NOFOREGROUND                = &H00000400
    %IDF_WARNIFSKIP                  = &H00000800
    
    #IF %SETUPAPI_VER >= &H0501
    
    %IDF_NOREMOVABLEMEDIAPROMPT      = &H00001000
    %IDF_USEDISKNAMEASPROMPT         = &H00002000
    %IDF_OEMDISK                     = &H80000000
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Return values for SetupPromptForDisk, SetupCopyError,
    '  SetupRenameError, SetupDeleteError, SetupBackupError
    
    %DPROMPT_SUCCESS         = 0
    %DPROMPT_CANCEL          = 1
    %DPROMPT_SKIPFILE        = 2
    %DPROMPT_BUFFERTOOSMALL  = 3
    %DPROMPT_OUTOFMEMORY     = 4
    
    '  Flags for SetupSetDirectoryIdEx
    
    %SETDIRID_NOT_FULL_PATH      = &H00000001
    
    
    '  InfoDesired values for SetupGetSourceInfo
    
    %SRCINFO_PATH            = 1
    %SRCINFO_TAGFILE         = 2
    %SRCINFO_DESCRIPTION     = 3
    %SRCINFO_FLAGS           = 4
    
    #IF %SETUPAPI_VER >= &H0501
    
    '  SRC_FLAGS allow special treatment of source
    '  lower 4 bits are reserved for OS use
    '  the flags may determine what other parameters exist
    
    %SRCINFO_TAGFILE2        = 5  '  alternate tagfile, when SRCINFO_TAGFILE is a cabfile
    
    %SRC_FLAGS_CABFILE       = (&H0010) '  if set, treat SRCINFO_TAGFILE as a cabfile and specify alternate tagfile
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    '  CopyStyle values for copy and queue-related APIs
    
    %SP_COPY_DELETESOURCE        = &H0000001   '  delete source file on successful copy
    %SP_COPY_REPLACEONLY         = &H0000002   '  copy only if target file already present
    %SP_COPY_NEWER               = &H0000004   '  copy only if source newer than or same as target
    %SP_COPY_NEWER_OR_SAME       = %SP_COPY_NEWER
    %SP_COPY_NOOVERWRITE         = &H0000008   '  copy only if target doesn't exist
    %SP_COPY_NODECOMP            = &H0000010   '  don't decompress source file while copying
    %SP_COPY_LANGUAGEAWARE       = &H0000020   '  don't overwrite file of different language
    %SP_COPY_SOURCE_ABSOLUTE     = &H0000040   '  SourceFile is a full source path
    %SP_COPY_SOURCEPATH_ABSOLUTE  =&H0000080   '  SourcePathRoot is the full path
    %SP_COPY_IN_USE_NEEDS_REBOOT  =&H0000100   '  System needs reboot if file in use
    %SP_COPY_FORCE_IN_USE        = &H0000200   '  Force target-in-use behavior
    %SP_COPY_NOSKIP              = &H0000400   '  Skip is disallowed for this file or section
    %SP_FLAG_CABINETCONTINUATION  =&H0000800   '  Used with need media notification
    %SP_COPY_FORCE_NOOVERWRITE   = &H0001000   '  like NOOVERWRITE but no callback nofitication
    %SP_COPY_FORCE_NEWER         = &H0002000   '  like NEWER but no callback nofitication
    %SP_COPY_WARNIFSKIP          = &H0004000   '  system critical file: warn if user tries to skip
    %SP_COPY_NOBROWSE            = &H0008000   '  Browsing is disallowed for this file or section
    %SP_COPY_NEWER_ONLY          = &H0010000   '  copy only if source file newer than target
    %SP_COPY_SOURCE_SIS_MASTER   = &H0020000   '  source is single-instance store master
    %SP_COPY_OEMINF_CATALOG_ONLY  =&H0040000   '  (SetupCopyOEMInf only) don't copy INF--just catalog
    %SP_COPY_REPLACE_BOOT_FILE   = &H0080000   '  file must be present upon reboot (i.e., it's
    '  needed by the loader); this flag implies a reboot
    %SP_COPY_NOPRUNE             = &H0100000   '  never prune this file
    
    #IF %SETUPAPI_VER >= &H0501
    
    %SP_COPY_OEM_F6_INF          = &H0200000   '  Used when calling SetupCopyOemInf
    
    #ENDIF ' %SETUPAPI_VER >= &H0501
    
    #IF %SETUPAPI_VER >= &H0501
    
    
    '  Flags passed to Backup notification
    
    %SP_BACKUP_BACKUPPASS        = &H00000001  '  file backed up during backup pass
    %SP_BACKUP_DEMANDPASS        = &H00000002  '  file backed up on demand
    %SP_BACKUP_SPECIAL           = &H00000004  '  if set, special type of backup
    %SP_BACKUP_BOOTFILE          = &H00000008  '  file marked with COPYFLG_REPLACE_BOOT_FILE
    
    
    #ENDIF ' %SETUPAPI_VER >= &H0501
    
    
    '  Define flags for SetupScanFileQueue.
    
    %SPQ_SCAN_FILE_PRESENCE                  = &H00000001
    %SPQ_SCAN_FILE_VALIDITY                  = &H00000002
    %SPQ_SCAN_USE_CALLBACK                   = &H00000004
    %SPQ_SCAN_USE_CALLBACKEX                 = &H00000008
    %SPQ_SCAN_INFORM_USER                    = &H00000010
    %SPQ_SCAN_PRUNE_COPY_QUEUE               = &H00000020
    
    #IF %SETUPAPI_VER >= &H0501
    
    %SPQ_SCAN_USE_CALLBACK_SIGNERINFO        = &H00000040
    %SPQ_SCAN_PRUNE_DELREN                   = &H00000080 '  remote Delete/Rename queue
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Define flags used with Param2 for SPFILENOTIFY_QUEUESCAN
    
    %SPQ_DELAYED_COPY                        = &H00000001  '  file was in use; registered for delayed copy
    
    #IF %SETUPAPI_VER >= &H0501
    
    
    '  Flags/FlagMask for use with SetupSetFileQueueFlags and returned by SetupGetFileQueueFlags
    
    %SPQ_FLAG_BACKUP_AWARE      = &H00000001  '  If set, SetupCommitFileQueue will
    '  issue backup notifications.
    
    %SPQ_FLAG_ABORT_IF_UNSIGNED  =&H00000002  '  If set, SetupCommitFileQueue will
    '  fail with ERROR_SET_SYSTEM_RESTORE_POINT
    '  if the user elects to proceed with an
    '  unsigned queue committal.  This allows
    '  the caller to set a system restore point,
    '  then re-commit the file queue.
    
    %SPQ_FLAG_FILES_MODIFIED    = &H00000004  '  If set, at least one file was
    '  replaced by a different version
    
    %SPQ_FLAG_VALID             = &H00000007  '  mask of valid flags (can be passed as FlagMask)
    
    #ENDIF  '  %SETUPAPI_VER >= &H0501
    
    
    '  Define OEM Source Type values for use in SetupCopyOEMInf.
    
    %SPOST_NONE  = 0
    %SPOST_PATH  = 1
    %SPOST_URL   = 2
    %SPOST_MAX   = 3
    
    
    #IF %SETUPAPI_VER >= &H0501
    
    
    '  Flags used by SetupUninstallOEMInf
    
    %SUOI_FORCEDELETE   = &H00000001
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Flags for SetupCreateDiskSpaceList
    
    %SPDSL_IGNORE_DISK              = &H00000001  '  ignore deletes and on-disk files in copies
    %SPDSL_DISALLOW_NEGATIVE_ADJUST  =&H00000002
    
    
    '  Define flags that are returned by SetupPromptReboot
    
    %SPFILEQ_FILE_IN_USE         = &H00000001
    %SPFILEQ_REBOOT_RECOMMENDED  = &H00000002
    %SPFILEQ_REBOOT_IN_PROGRESS  = &H00000004
    
    
    '  Flags for AddReg section lines in INF.  The corresponding value
    '  is <ValueType> in the AddReg line format given below:
    
    '  <RegRootString>,<SubKey>,<ValueName>,<ValueType>,<Value>...
    
    '  The low word contains basic flags concerning the general data type
    '  and AddReg action. The high word contains values that more specifically
    '  identify the data type of the registry value.  The high word is ignored
    '  by the 16-bit Windows 95 SETUPX APIs.
    
    '  If <ValueType> has FLG_ADDREG_DELREG_BIT set, it will be ignored by AddReg
    '  (not supported by SetupX).
    
    
    #IF %SETUPAPI_VER >= &H0501
    
    %FLG_ADDREG_DELREG_BIT       = ( &H00008000 ) '  if set, interpret as DELREG, see below
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    %FLG_ADDREG_BINVALUETYPE     = ( &H00000001 )
    %FLG_ADDREG_NOCLOBBER        = ( &H00000002 )
    %FLG_ADDREG_DELVAL           = ( &H00000004 )
    %FLG_ADDREG_APPEND           = ( &H00000008 ) '  Currently supported only
    '  for REG_MULTI_SZ values.
    %FLG_ADDREG_KEYONLY          = ( &H00000010 ) '  Just create the key, ignore value
    %FLG_ADDREG_OVERWRITEONLY    = ( &H00000020 ) '  Set only if value already exists
    
    #IF %SETUPAPI_VER >= &H0501
    
    %FLG_ADDREG_64BITKEY         = ( &H00001000 ) '  make this change in the 64 bit registry.
    %FLG_ADDREG_KEYONLY_COMMON   = ( &H00002000 ) '  same as FLG_ADDREG_KEYONLY but also works for DELREG
    %FLG_ADDREG_32BITKEY         = ( &H00004000 ) '  make this change in the 32 bit registry.
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  The INF may supply any arbitrary data type ordinal in the highword except
    '  for the following: REG_NONE, REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ.  If this
    '  technique is used, then the data is given in binary format, one byte per
    '  field.
    
    %FLG_ADDREG_TYPE_MASK        = ( &HFFFF0000 OR %FLG_ADDREG_BINVALUETYPE )
    %FLG_ADDREG_TYPE_SZ          = ( &H00000000                           )
    %FLG_ADDREG_TYPE_MULTI_SZ    = ( &H00010000                           )
    %FLG_ADDREG_TYPE_EXPAND_SZ   = ( &H00020000                           )
    %FLG_ADDREG_TYPE_BINARY      = ( &H00000000 OR %FLG_ADDREG_BINVALUETYPE )
    %FLG_ADDREG_TYPE_DWORD       = ( &H00010000 OR %FLG_ADDREG_BINVALUETYPE )
    %FLG_ADDREG_TYPE_NONE        = ( &H00020000 OR %FLG_ADDREG_BINVALUETYPE )
    
    
    '  Flags for DelReg section lines in INF.  The corresponding value
    '  is <Operation> in the extended DelReg line format given below:
    
    '  <RegRootString>,<SubKey>,<ValueName>,<Operation>[,...]
    
    '  In SetupX and some versions of SetupAPI, <Operation> will be ignored and <ValueName> will
    '  be deleted. Use with care.
    
    '  The bits determined by mask FLG_DELREG_TYPE_MASK indicates type of data expected.
    '  <Operation> must have FLG_ADDREG_DELREG_BIT set, otherwise it is ignored and specified
    '  value will be deleted (allowing an AddReg section to also be used as a DelReg section)
    '  if <Operation> is not specified, <ValueName> will be deleted (if specified) otherwise
    '  <SubKey> will be deleted.
    
    '  the compatability flag
    
    %FLG_DELREG_VALUE            = (&H00000000)
    
    #IF %SETUPAPI_VER >= &H0501
    
    %FLG_DELREG_TYPE_MASK        = %FLG_ADDREG_TYPE_MASK        '  &HFFFF0001
    %FLG_DELREG_TYPE_SZ          = %FLG_ADDREG_TYPE_SZ          '  &H00000000
    %FLG_DELREG_TYPE_MULTI_SZ    = %FLG_ADDREG_TYPE_MULTI_SZ    '  &H00010000
    %FLG_DELREG_TYPE_EXPAND_SZ   = %FLG_ADDREG_TYPE_EXPAND_SZ   '  &H00020000
    %FLG_DELREG_TYPE_BINARY      = %FLG_ADDREG_TYPE_BINARY      '  &H00000001
    %FLG_DELREG_TYPE_DWORD       = %FLG_ADDREG_TYPE_DWORD       '  &H00010001
    %FLG_DELREG_TYPE_NONE        = %FLG_ADDREG_TYPE_NONE        '  &H00020001
    %FLG_DELREG_64BITKEY         = %FLG_ADDREG_64BITKEY         '  &H00001000
    %FLG_DELREG_KEYONLY_COMMON   = %FLG_ADDREG_KEYONLY_COMMON   '  &H00002000
    %FLG_DELREG_32BITKEY         = %FLG_ADDREG_32BITKEY         '  &H00004000
    
    
    '  <Operation> = FLG_DELREG_MULTI_SZ_DELSTRING
    '                <RegRootString>,<SubKey>,<ValueName>,&H00018002,<String>
    '                removes all entries matching <String> (case ignored) from multi-sz registry value
    
    
    %FLG_DELREG_OPERATION_MASK   = (&H000000FE)
    %FLG_DELREG_MULTI_SZ_DELSTRING ( = %FLG_DELREG_TYPE_MULTI_SZ OR %FLG_ADDREG_DELREG_BIT OR &H00000002 ) '  &H00018002
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Flags for BitReg section lines in INF.
    
    %FLG_BITREG_CLEARBITS        = ( &H00000000 )
    %FLG_BITREG_SETBITS          = ( &H00000001 )
    
    #IF %SETUPAPI_VER >= &H0501
    
    %FLG_BITREG_64BITKEY         = ( &H00001000 )
    %FLG_BITREG_32BITKEY         = ( &H00004000 )
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Flags for Ini2Reg section lines in INF.
    
    #IF %SETUPAPI_VER >= &H0501
    
    %FLG_INI2REG_64BITKEY        = ( &H00001000 )
    %FLG_INI2REG_32BITKEY        = ( &H00004000 )
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Flags for RegSvr section lines in INF
    
    %FLG_REGSVR_DLLREGISTER      = ( &H00000001 )
    %FLG_REGSVR_DLLINSTALL       = ( &H00000002 )
    
    
    '  Flags for RegSvr section lines in INF
    
    %FLG_PROFITEM_CURRENTUSER    = ( &H00000001 )
    %FLG_PROFITEM_DELETE         = ( &H00000002 )
    %FLG_PROFITEM_GROUP          = ( &H00000004 )
    %FLG_PROFITEM_CSIDL          = ( &H00000008 )
    
    
    '  Flags for SetupInstallFromInfSection
    
    %SPINST_LOGCONFIG                = &H00000001
    %SPINST_INIFILES                 = &H00000002
    %SPINST_REGISTRY                 = &H00000004
    %SPINST_INI2REG                  = &H00000008
    %SPINST_FILES                    = &H00000010
    %SPINST_BITREG                   = &H00000020
    %SPINST_REGSVR                   = &H00000040
    %SPINST_UNREGSVR                 = &H00000080
    %SPINST_PROFILEITEMS             = &H00000100
    
    #IF %SETUPAPI_VER >= &H0501
    
    %SPINST_COPYINF                  = &H00000200
    %SPINST_ALL                      = &H000003ff
    
    #ELSE
    
    %SPINST_ALL                      = &H000001ff
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    %SPINST_SINGLESECTION            = &H00010000
    %SPINST_LOGCONFIG_IS_FORCED      = &H00020000
    %SPINST_LOGCONFIGS_ARE_OVERRIDES  =&H00040000
    
    #IF %SETUPAPI_VER >= &H0501
    
    %SPINST_REGISTERCALLBACKAWARE    = &H00080000
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Flags for SetupInstallServicesFromInfSection(Ex).  These flags are also used
    '  in the flags field of AddService or DelService lines in a device INF.  Some
    '  of these flags are not permitted in the non-Ex API.  These flags are marked
    '  as such below.
    
    
    
    '  (AddService) move service's tag to front of its group order list
    
    %SPSVCINST_TAGTOFRONT               = (&H00000001)
    
    
    '  (AddService) **Ex API only** mark this service as the function driver for the
    '  device being installed
    
    %SPSVCINST_ASSOCSERVICE             = (&H00000002)
    
    
    '  (DelService) delete the associated event log entry for a service specified in
    '  a DelService entry
    
    %SPSVCINST_DELETEEVENTLOGENTRY      = (&H00000004)
    
    
    '  (AddService) don't overwrite display name if it already exists
    
    %SPSVCINST_NOCLOBBER_DISPLAYNAME    = (&H00000008)
    
    
    '  (AddService) don't overwrite start type value if service already exists
    
    %SPSVCINST_NOCLOBBER_STARTTYPE      = (&H00000010)
    
    
    '  (AddService) don't overwrite error control value if service already exists
    
    %SPSVCINST_NOCLOBBER_ERRORCONTROL   = (&H00000020)
    
    
    '  (AddService) don't overwrite load order group if it already exists
    
    %SPSVCINST_NOCLOBBER_LOADORDERGROUP  =(&H00000040)
    
    
    '  (AddService) don't overwrite dependencies list if it already exists
    
    %SPSVCINST_NOCLOBBER_DEPENDENCIES   = (&H00000080)
    
    
    '  (AddService) don't overwrite description if it already exists
    
    %SPSVCINST_NOCLOBBER_DESCRIPTION    = (&H00000100)
    
    '  (DelService) stop the associated service specified in
    '  a DelService entry before deleting the service
    
    %SPSVCINST_STOPSERVICE              = (&H00000200)
    
    #IF %SETUPAPI_VER >= &H0501
    
    '  (AddService) force overwrite of security settings
    
    %SPSVCINST_CLOBBER_SECURITY         = (&H00000400)
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Define handle type for Setup file log.
    
    MACRO HSPFILELOG = DWORD
    
    
    '  Flags for SetupInitializeFileLog
    
    %SPFILELOG_SYSTEMLOG     = &H00000001  '  use system log -- must be Administrator
    %SPFILELOG_FORCENEW      = &H00000002  '  not valid with SPFILELOG_SYSTEMLOG
    %SPFILELOG_QUERYONLY     = &H00000004  '  allows non-administrators to read system log
    
    
    '  Flags for SetupLogFile
    
    %SPFILELOG_OEMFILE   = &H00000001
    
    
    '  Items retrievable from SetupQueryFileLog()
    
    MACRO SetupFileLogSourceFilename        = 0
    MACRO SetupFileLogChecksum              = 1
    MACRO SetupFileLogDiskTagfile           = 2
    MACRO SetupFileLogDiskDescription       = 3
    MACRO SetupFileLogOtherInfo             = 4
    MACRO SetupFileLogMax                   = 5
    
    
    '  Text logging APIs
    
    MACRO LogSeverity            = DWORD
    %LogSevInformation           = &H00000000
    %LogSevWarning               = &H00000001
    %LogSevError                 = &H00000002
    %LogSevFatalError            = &H00000003
    %LogSevMaximum               = &H00000004
    
    
    '  Flags for SetupDiCreateDeviceInfo
    
    %DICD_GENERATE_ID        = &H00000001
    %DICD_INHERIT_CLASSDRVS  = &H00000002
    
    
    '  Flags for SetupDiOpenDeviceInfo
    
    %DIOD_INHERIT_CLASSDRVS  = &H00000002
    %DIOD_CANCEL_REMOVE      = &H00000004
    
    
    '  Flags for SetupDiOpenDeviceInterface
    
    %DIODI_NO_ADD    = &H00000001
    
    
    '  Flags for SetupDiRegisterDeviceInfo
    
    %SPRDI_FIND_DUPS        = &H00000001
    
    
    '  Ordinal values distinguishing between class drivers and
    '  device drivers.
    '  (Passed in 'DriverType' parameter of driver information list APIs)
    
    %SPDIT_NODRIVER           = &H00000000
    %SPDIT_CLASSDRIVER        = &H00000001
    %SPDIT_COMPATDRIVER       = &H00000002
    
    
    '  Flags controlling what is included in the device information set built
    '  by SetupDiGetClassDevs
    
    %DIGCF_DEFAULT           = &H00000001  '  only valid with DIGCF_DEVICEINTERFACE
    %DIGCF_PRESENT           = &H00000002
    %DIGCF_ALLCLASSES        = &H00000004
    %DIGCF_PROFILE           = &H00000008
    %DIGCF_DEVICEINTERFACE   = &H00000010
    
    
    '  Backward compatibility--do not use.
    
    %DIGCF_INTERFACEDEVICE  =%DIGCF_DEVICEINTERFACE
    
    
    '  Flags controlling exclusion from the class information list built
    '  by SetupDiBuildClassInfoList(Ex)
    
    %DIBCI_NOINSTALLCLASS   = &H00000001
    %DIBCI_NODISPLAYCLASS   = &H00000002
    
    
    '  KeyType values for SetupDiCreateDevRegKey, SetupDiOpenDevRegKey, and
    '  SetupDiDeleteDevRegKey.
    
    %DIREG_DEV       = &H00000001          '  Open/Create/Delete device key
    %DIREG_DRV       = &H00000002          '  Open/Create/Delete driver key
    %DIREG_BOTH      = &H00000004          '  Delete both driver and Device key
    
    
    '  Device registry property codes
    '  (Codes marked as read-only (R) may only be used for
    '  SetupDiGetDeviceRegistryProperty)
    
    '  These values should cover the same set of registry properties
    '  as defined by the CM_DRP codes in cfgmgr32.h.
    
    '  Note that SPDRP codes are zero based while CM_DRP codes are one based!
    
    %SPDRP_DEVICEDESC                  = (&H00000000)  '  DeviceDesc (R/W)
    %SPDRP_HARDWAREID                  = (&H00000001)  '  HardwareID (R/W)
    %SPDRP_COMPATIBLEIDS               = (&H00000002)  '  CompatibleIDs (R/W)
    %SPDRP_UNUSED0                     = (&H00000003)  '  unused
    %SPDRP_SERVICE                     = (&H00000004)  '  Service (R/W)
    %SPDRP_UNUSED1                     = (&H00000005)  '  unused
    %SPDRP_UNUSED2                     = (&H00000006)  '  unused
    %SPDRP_CLASS                       = (&H00000007)  '  Class (R--tied to ClassGUID)
    %SPDRP_CLASSGUID                   = (&H00000008)  '  ClassGUID (R/W)
    %SPDRP_DRIVER                      = (&H00000009)  '  Driver (R/W)
    %SPDRP_CONFIGFLAGS                 = (&H0000000A)  '  ConfigFlags (R/W)
    %SPDRP_MFG                         = (&H0000000B)  '  Mfg (R/W)
    %SPDRP_FRIENDLYNAME                = (&H0000000C)  '  FriendlyName (R/W)
    %SPDRP_LOCATION_INFORMATION        = (&H0000000D)  '  LocationInformation (R/W)
    %SPDRP_PHYSICAL_DEVICE_OBJECT_NAME  =(&H0000000E)  '  PhysicalDeviceObjectName (R)
    %SPDRP_CAPABILITIES                = (&H0000000F)  '  Capabilities (R)
    %SPDRP_UI_NUMBER                   = (&H00000010)  '  UiNumber (R)
    %SPDRP_UPPERFILTERS                = (&H00000011)  '  UpperFilters (R/W)
    %SPDRP_LOWERFILTERS                = (&H00000012)  '  LowerFilters (R/W)
    %SPDRP_BUSTYPEGUID                 = (&H00000013)  '  BusTypeGUID (R)
    %SPDRP_LEGACYBUSTYPE               = (&H00000014)  '  LegacyBusType (R)
    %SPDRP_BUSNUMBER                   = (&H00000015)  '  BusNumber (R)
    %SPDRP_ENUMERATOR_NAME             = (&H00000016)  '  Enumerator Name (R)
    %SPDRP_SECURITY                    = (&H00000017)  '  Security (R/W, binary form)
    %SPDRP_SECURITY_SDS                = (&H00000018)  '  Security (W, SDS form)
    %SPDRP_DEVTYPE                     = (&H00000019)  '  Device Type (R/W)
    %SPDRP_EXCLUSIVE                   = (&H0000001A)  '  Device is exclusive-access (R/W)
    %SPDRP_CHARACTERISTICS             = (&H0000001B)  '  Device Characteristics (R/W)
    %SPDRP_ADDRESS                     = (&H0000001C)  '  Device Address (R)
    %SPDRP_UI_NUMBER_DESC_FORMAT       = (&H0000001D)  '  UiNumberDescFormat (R/W)
    %SPDRP_DEVICE_POWER_DATA           = (&H0000001E)  '  Device Power Data (R)
    %SPDRP_REMOVAL_POLICY              = (&H0000001F)  '  Removal Policy (R)
    %SPDRP_REMOVAL_POLICY_HW_DEFAULT   = (&H00000020)  '  Hardware Removal Policy (R)
    %SPDRP_REMOVAL_POLICY_OVERRIDE     = (&H00000021)  '  Removal Policy Override (RW)
    %SPDRP_INSTALL_STATE               = (&H00000022)  '  Device Install State (R)
    %SPDRP_LOCATION_PATHS              = (&H00000023)  '  Device Location Paths (R)
    
    %SPDRP_MAXIMUM_PROPERTY            = (&H00000024)  '  Upper bound on ordinals
    
    
    '  Class registry property codes
    '  (Codes marked as read-only (R) may only be used for
    '  SetupDiGetClassRegistryProperty)
    
    '  These values should cover the same set of registry properties
    '  as defined by the CM_CRP codes in cfgmgr32.h.
    '  they should also have a 1:1 correspondence with Device registers, where applicable
    '  but no overlap otherwise
    
    %SPCRP_SECURITY                    = (&H00000017)  '  Security (R/W, binary form)
    %SPCRP_SECURITY_SDS                = (&H00000018)  '  Security (W, SDS form)
    %SPCRP_DEVTYPE                     = (&H00000019)  '  Device Type (R/W)
    %SPCRP_EXCLUSIVE                   = (&H0000001A)  '  Device is exclusive-access (R/W)
    %SPCRP_CHARACTERISTICS             = (&H0000001B)  '  Device Characteristics (R/W)
    %SPCRP_MAXIMUM_PROPERTY            = (&H0000001C)  '  Upper bound on ordinals
    
    
    '  Flags controlling the drawing of mini-icons
    
    %DMI_MASK      = &H00000001
    %DMI_BKCOLOR   = &H00000002
    %DMI_USERECT   = &H00000004
    
    
    '  PropertySheetType values for the SetupDiGetClassDevPropertySheets API
    
    %DIGCDP_FLAG_BASIC           = &H00000001
    %DIGCDP_FLAG_ADVANCED        = &H00000002
    
    #IF %SETUPAPI_VER >= &H0501
    
    %DIGCDP_FLAG_REMOTE_BASIC    = &H00000003  '  not presently implemented
    %DIGCDP_FLAG_REMOTE_ADVANCED  =&H00000004
    
    #ENDIF '  %SETUPAPI_VER >= &H0501
    
    
    '  Define ICON IDs publicly exposed from setupapi.
    
    %IDI_RESOURCEFIRST           = 159
    %IDI_RESOURCE                = 159
    %IDI_RESOURCELAST            = 161
    %IDI_RESOURCEOVERLAYFIRST    = 161
    %IDI_RESOURCEOVERLAYLAST     = 161
    %IDI_CONFLICT                = 161
    
    %IDI_CLASSICON_OVERLAYFIRST  = 500
    %IDI_CLASSICON_OVERLAYLAST   = 502
    %IDI_PROBLEM_OVL             = 500
    %IDI_DISABLED_OVL            = 501
    %IDI_FORCED_OVL              = 502
    
    
    
    '  PageType values for SetupDiGetWizardPage API
    
    %SPWPT_SELECTDEVICE      = &H00000001
    
    
    '  Flags for SetupDiGetWizardPage API
    
    %SPWP_USE_DEVINFO_DATA   = &H00000001
    
    
    
    '  SetupEnumInfSections is for low-level parsing of an INF
    
    TYPE SP_INF_SIGNER_INFO_A
         cbSize AS DWORD
         CatalogFile AS ASCIIZ * %MAX_PATH
         DigitalSigner AS ASCIIZ * %MAX_PATH
         DigitalSignerVersion AS ASCIIZ * %MAX_PATH
    END TYPE
    
    TYPE SP_INF_SIGNER_INFO_W
         cbSize AS DWORD
         CatalogFile AS STRING * %MAX_PATH * 2
         DigitalSigner AS STRING * %MAX_PATH * 2
         DigitalSignerVersion AS STRING * %MAX_PATH * 2
    END TYPE
    
    #IF %DEF(%UNICODE)
        MACRO SP_INF_SIGNER_INFO = SP_INF_SIGNER_INFO_W
    #ELSE
        MACRO SP_INF_SIGNER_INFO = PSP_INF_SIGNER_INFO_A
    #ENDIF
    
    
    #IF %SETUPAPI_VER >= &H0501
    
    '  Flags for use by SetupDiGetCustomDeviceProperty
    
    %DICUSTOMDEVPROP_MERGE_MULTISZ    = &H00000001
    
    #ENDIF ' %SETUPAPI_VER >= &H0501
    
    
    
    #IF %SETUPAPI_VER >= &H0502
    
    '  To configure WMI security for downlevel platforms where the [DDInstall.WMI]
    '  section isn't natively supported by setupapi, a redistributable co-installer
    '  is supplied in the DDK for use on those platforms.
    
    
    
    '  Flags for use by SetupConfigureWmiFromInfSection
    
    %SCWMI_CLOBBER_SECURITY  = &H00000001
    
    #ENDIF ' %SETUPAPI_VER >= &H0502
    
    
    
    
    
    #IF %DEF(%UNICODE) ' UNICODE specific functions...
    
    DECLARE FUNCTION SetupGetInfInformationW LIB "SETUPAPI.DLL" ALIAS "SetupGetInfInformationW" (BYREF InfSpec AS ANY, _
                                                                                                 BYVAL SearchControl AS DWORD, _
                                                                                                 BYREF ReturnBuffer AS SP_INF_INFORMATION, _
                                                                                                 BYVAL ReturnBufferSize AS DWORD, _
                                                                                                 BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetInfInformation(InfSpec, SearchControl, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetInfInformationW(InfSpec, SearchControl, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupQueryInfFileInformationW LIB "SETUPAPI.DLL" ALIAS "SetupQueryInfFileInformationW" (BYREF InfInformation AS SP_INF_INFORMATION, _
                                                                                                             BYVAL InfIndex AS DWORD, _
                                                                                                             BYREF ReturnBuffer AS ANY, _
                                                                                                             BYVAL ReturnBufferSize AS DWORD, _
                                                                                                             BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupQueryInfFileInformation(InfInformation, InfIndex, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupQueryInfFileInformationW(InfInformation, InfIndex, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupQueryInfOriginalFileInformationW LIB "SETUPAPI.DLL" ALIAS "SetupQueryInfOriginalFileInformationW" (BYREF InfInformation AS SP_INF_INFORMATION, _
                                                                                                                             BYVAL InfIndex AS DWORD, _
                                                                                                                             BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO, _
                                                                                                                             BYREF OriginalFileInfo AS SP_ORIGINAL_FILE_INFO_W) AS LONG
    MACRO SetupQueryInfOriginalFileInformation(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo) = SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)
    
    DECLARE FUNCTION SetupQueryInfVersionInformationW LIB "SETUPAPI.DLL" ALIAS "SetupQueryInfVersionInformationW" (BYREF InfInformation AS SP_INF_INFORMATION, _
                                                                                                                   BYVAL InfIndex AS DWORD, _
                                                                                                                   BYREF Key AS ANY, _
                                                                                                                   BYREF ReturnBuffer AS ANY, _
                                                                                                                   BYVAL ReturnBufferSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupQueryInfVersionInformation(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetInfFileListW LIB "SETUPAPI.DLL" ALIAS "SetupGetInfFileListW" (BYREF DirectoryPath AS ANY, _
                                                                                           BYVAL InfStyle AS DWORD, _
                                                                                           BYREF ReturnBuffer AS ANY, _
                                                                                           BYVAL ReturnBufferSize AS DWORD, _
                                                                                           BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetInfFileList(DirectoryPath, InfStyle, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetInfFileListW(DirectoryPath, InfStyle, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupOpenInfFileW LIB "SETUPAPI.DLL" ALIAS "SetupOpenInfFileW" (BYREF FileName AS ANY, _
                                                                                     BYREF InfClass AS ANY, _
                                                                                     BYVAL InfStyle AS DWORD, _
                                                                                     BYREF ErrorLine AS DWORD) AS HINF
    MACRO SetupOpenInfFile(FileName, InfClass, InfStyle, ErrorLine) = SetupOpenInfFileW(FileName, InfClass, InfStyle, ErrorLine)
    
    DECLARE FUNCTION SetupOpenAppendInfFileW LIB "SETUPAPI.DLL" ALIAS "SetupOpenAppendInfFileW" (BYREF FileName AS ANY, _
                                                                                                 BYVAL InfHandle AS HINF, _
                                                                                                 BYREF ErrorLine AS DWORD) AS LONG
    MACRO SetupOpenAppendInfFile(FileName, InfHandle, ErrorLine) = SetupOpenAppendInfFileW(FileName, InfHandle, ErrorLine)
    
    DECLARE FUNCTION SetupFindFirstLineW LIB "SETUPAPI.DLL" ALIAS "SetupFindFirstLineW" (BYVAL InfHandle AS HINF, _
                                                                                         BYREF Section AS ANY, _
                                                                                         BYREF Key AS ANY, _
                                                                                         BYREF inContext AS INFCONTEXT) AS LONG
    MACRO SetupFindFirstLine(InfHandle, Section, Key, inContext) = SetupFindFirstLineW(InfHandle, Section, Key, inContext)
    
    DECLARE FUNCTION SetupFindNextMatchLineW LIB "SETUPAPI.DLL" ALIAS "SetupFindNextMatchLineW" (BYREF ContextIn AS INFCONTEXT, _
                                                                                                 BYREF Key AS ANY, _
                                                                                                 BYREF ContextOut AS INFCONTEXT) AS LONG
    MACRO SetupFindNextMatchLine(ContextIn, Key, ContextOut) = SetupFindNextMatchLineW(ContextIn, Key, ContextOut)
    
    DECLARE FUNCTION SetupGetLineByIndexW LIB "SETUPAPI.DLL" ALIAS "SetupGetLineByIndexW" (BYVAL InfHandle AS HINF, _
                                                                                           BYREF Section AS ANY, _
                                                                                           BYVAL Index AS DWORD, _
                                                                                           BYREF inContext AS INFCONTEXT) AS LONG
    MACRO SetupGetLineByIndex(InfHandle, Section, Index, inContext) = SetupGetLineByIndexW(InfHandle, Section, Index, inContext)
    
    DECLARE FUNCTION SetupGetLineCountW LIB "SETUPAPI.DLL" ALIAS "SetupGetLineCountW" (BYVAL InfHandle AS HINF, _
                                                                                       BYREF Section AS ANY) AS LONG
    MACRO SetupGetLineCount(InfHandle, Section) = SetupGetLineCountW(InfHandle, Section)
    
    DECLARE FUNCTION SetupGetLineTextW LIB "SETUPAPI.DLL" ALIAS "SetupGetLineTextW" (BYREF inContext AS INFCONTEXT, _
                                                                                     BYVAL InfHandle AS HINF, _
                                                                                     BYREF Section AS ANY, _
                                                                                     BYREF Key AS ANY, _
                                                                                     BYREF ReturnBuffer AS ANY, _
                                                                                     BYVAL ReturnBufferSize AS DWORD, _
                                                                                     BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetLineText(inContext, InfHandle, Section, Key, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetLineTextW(inContext, InfHandle, Section, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetStringFieldW LIB "SETUPAPI.DLL" ALIAS "SetupGetStringFieldW" (BYREF inContext AS INFCONTEXT, _
                                                                                           BYVAL FieldIndex AS DWORD, _
                                                                                           BYREF ReturnBuffer AS ANY, _
                                                                                           BYVAL ReturnBufferSize AS DWORD, _
                                                                                           BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetStringField(inContext, FieldIndex, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetStringFieldW(inContext, FieldIndex, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetMultiSzFieldW LIB "SETUPAPI.DLL" ALIAS "SetupGetMultiSzFieldW" (BYREF inContext AS INFCONTEXT, _
                                                                                             BYVAL FieldIndex AS DWORD, _
                                                                                             BYREF ReturnBuffer AS ANY, _
                                                                                             BYVAL ReturnBufferSize AS DWORD, _
                                                                                             BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetMultiSzField(inContext, FieldIndex, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetMultiSzFieldW(inContext, FieldIndex, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetFileCompressionInfoW LIB "SETUPAPI.DLL" ALIAS "SetupGetFileCompressionInfoW" (BYREF SourceFileName AS ANY, _
                                                                                                           BYREF ActualSourceFileName AS ANY, _
                                                                                                           BYREF SourceFileSize AS DWORD, _
                                                                                                           BYREF TargetFileSize AS DWORD, _
                                                                                                           BYREF CompressionType AS DWORD) AS DWORD
    MACRO SetupGetFileCompressionInfo(SourceFileName, ActualSourceFileName, SourceFileSize, TargetFileSize, CompressionType) = SetupGetFileCompressionInfoW(SourceFileName, ActualSourceFileName, SourceFileSize, TargetFileSize, CompressionType)
    
    DECLARE FUNCTION SetupGetFileCompressionInfoExW LIB "SETUPAPI.DLL" ALIAS "SetupGetFileCompressionInfoExW" (BYREF SourceFileName AS ANY, _
                                                                                                               BYREF ActualSourceFileNameBuffer AS ANY, _
                                                                                                               BYVAL ActualSourceFileNameBufferLen AS DWORD, _
                                                                                                               BYREF RequiredBufferLen AS DWORD, _
                                                                                                               BYREF SourceFileSize AS DWORD, _
                                                                                                               BYREF TargetFileSize AS DWORD, _
                                                                                                               BYREF CompressionType AS DWORD) AS LONG
    MACRO SetupGetFileCompressionInfoEx(SourceFileName, ActualSourceFileNameBuffer, ActualSourceFileNameBufferLen, RequiredBufferLen, SourceFileSize, TargetFileSize, CompressionType) = _
    SetupGetFileCompressionInfoExW(SourceFileName, ActualSourceFileNameBuffer, ActualSourceFileNameBufferLen, RequiredBufferLen, SourceFileSize, TargetFileSize, CompressionType)
    
    DECLARE FUNCTION SetupDecompressOrCopyFileW LIB "SETUPAPI.DLL" ALIAS "SetupDecompressOrCopyFileW" (BYREF SourceFileName AS ANY, _
                                                                                                       BYREF TargetFileName AS ANY, _
                                                                                                       BYREF CompressionType AS DWORD) AS DWORD
    MACRO SetupDecompressOrCopyFile(SourceFileName, TargetFileName, CompressionType) = SetupDecompressOrCopyFileW(SourceFileName, TargetFileName, CompressionType)
    
    DECLARE FUNCTION SetupGetSourceFileLocationW LIB "SETUPAPI.DLL" ALIAS "SetupGetSourceFileLocationW" (BYVAL InfHandle AS HINF, _
                                                                                                         BYREF inContext AS INFCONTEXT, _
                                                                                                         BYREF FileName AS ANY, _
                                                                                                         BYREF SourceId AS DWORD, _
                                                                                                         BYREF ReturnBuffer AS ANY, _
                                                                                                         BYVAL ReturnBufferSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetSourceFileLocation(InfHandle, inContext, FileName, SourceId, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetSourceFileLocationW(InfHandle, inContext, FileName, SourceId, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetSourceFileSizeW LIB "SETUPAPI.DLL" ALIAS "SetupGetSourceFileSizeW" (BYVAL InfHandle AS HINF, _
                                                                                                 BYREF inContext AS INFCONTEXT, _
                                                                                                 BYREF FileName AS ANY, _
                                                                                                 BYREF Section AS ANY, _
                                                                                                 BYREF FileSize AS DWORD, _
                                                                                                 BYVAL RoundingFactor AS DWORD) AS LONG
    MACRO SetupGetSourceFileSize(InfHandle, inContext, FileName, Section, FileSize, RoundingFactor) = SetupGetSourceFileSizeW(InfHandle, inContext, FileName, Section, FileSize, RoundingFactor)
    
    DECLARE FUNCTION SetupGetTargetPathW LIB "SETUPAPI.DLL" ALIAS "SetupGetTargetPathW" (BYVAL InfHandle AS HINF, _
                                                                                         BYREF inContext AS INFCONTEXT, _
                                                                                         BYREF Section AS ANY, _
                                                                                         BYREF ReturnBuffer AS ANY, _
                                                                                         BYVAL ReturnBufferSize AS DWORD, _
                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetTargetPath(InfHandle, inContext, Section, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetTargetPathW(InfHandle, inContext, Section, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupSetSourceListW LIB "SETUPAPI.DLL" ALIAS "SetupSetSourceListW" (BYVAL Flags AS DWORD, _
                                                                                         BYREF SourceList AS ANY, _
                                                                                         BYVAL SourceCount AS DWORD) AS LONG
    MACRO SetupSetSourceList(Flags, SourceList, SourceCount) = SetupSetSourceListW(Flags, SourceList, SourceCount)
    
    DECLARE FUNCTION SetupAddToSourceListW LIB "SETUPAPI.DLL" ALIAS "SetupAddToSourceListW" (BYVAL Flags AS DWORD, _
                                                                                             BYREF Source AS ANY) AS LONG
    MACRO SetupAddToSourceList(Flags, Source) = SetupAddToSourceListW(Flags, Source)
    
    DECLARE FUNCTION SetupRemoveFromSourceListW LIB "SETUPAPI.DLL" ALIAS "SetupRemoveFromSourceListW" (BYVAL Flags AS DWORD, _
                                                                                                       BYREF Source AS ANY) AS LONG
    MACRO SetupRemoveFromSourceList(Flags, Source) = SetupRemoveFromSourceListW(Flags, Source)
    
    DECLARE FUNCTION SetupQuerySourceListW LIB "SETUPAPI.DLL" ALIAS "SetupQuerySourceListW" (BYVAL Flags AS DWORD, _
                                                                                             BYREF List AS ANY, _
                                                                                             BYREF Count AS DWORD) AS LONG
    MACRO SetupQuerySourceList(Flags, List, Count) = SetupQuerySourceListW(Flags, List, Count)
    
    DECLARE FUNCTION SetupFreeSourceListW LIB "SETUPAPI.DLL" ALIAS "SetupFreeSourceListW" (BYREF List AS ANY, _
                                                                                           BYVAL Count AS DWORD) AS LONG
    MACRO SetupFreeSourceList(List, Count) = SetupFreeSourceListW(List, Count)
    
    DECLARE FUNCTION SetupPromptForDiskW LIB "SETUPAPI.DLL" ALIAS "SetupPromptForDiskW" (BYVAL hwndParent AS DWORD, _
                                                                                         BYREF DialogTitle AS ANY, _
                                                                                         BYREF DiskName AS ANY, _
                                                                                         BYREF PathToSource AS ANY, _
                                                                                         BYREF FileSought AS ANY, _
                                                                                         BYREF TagFile AS ANY, _
                                                                                         BYVAL DiskPromptStyle AS DWORD, _
                                                                                         BYREF PathBuffer AS ANY, _
                                                                                         BYVAL PathBufferSize AS DWORD, _
                                                                                         BYREF PathRequiredSize AS DWORD) AS DWORD
    MACRO SetupPromptForDisk(hwndParent, DialogTitle, DiskName, PathToSource, FileSought, TagFile, DiskPromptStyle, PathBuffer, PathBufferSize, PathRequiredSize) = _
    SetupPromptForDiskW(hwndParent, DialogTitle, DiskName, PathToSource, FileSought, TagFile, DiskPromptStyle, PathBuffer, PathBufferSize, PathRequiredSize)
    
    DECLARE FUNCTION SetupCopyErrorW LIB "SETUPAPI.DLL" ALIAS "SetupCopyErrorW" (BYVAL hwndParent AS DWORD, _
                                                                                 BYREF DialogTitle AS ANY, _
                                                                                 BYREF DiskName AS ANY, _
                                                                                 BYREF PathToSource AS ANY, _
                                                                                 BYREF SourceFile AS ANY, _
                                                                                 BYREF TargetPathFile AS ANY, _
                                                                                 BYVAL Win32ErrorCode AS DWORD, _
                                                                                 BYVAL STYLE AS DWORD, _
                                                                                 BYREF PathBuffer AS ANY, _
                                                                                 BYVAL PathBufferSize AS DWORD, _
                                                                                 BYREF PathRequiredSize AS DWORD) AS DWORD
    MACRO SetupCopyError(hwndParent, DialogTitle, DiskName, PathToSource, SourceFile, TargetPathFile, Win32ErrorCode, STYLE, PathBuffer, PathBufferSize, PathRequiredSize) = _
    SetupCopyErrorW(hwndParent, DialogTitle, DiskName, PathToSource, SourceFile, TargetPathFile, Win32ErrorCode, STYLE, PathBuffer, PathBufferSize, PathRequiredSize)
    
    DECLARE FUNCTION SetupRenameErrorW LIB "SETUPAPI.DLL" ALIAS "SetupRenameErrorW" (BYVAL hwndParent AS DWORD, _
                                                                                     BYREF DialogTitle AS ANY, _
                                                                                     BYREF SourceFile AS ANY, _
                                                                                     BYREF TargetFile AS ANY, _
                                                                                     BYVAL Win32ErrorCode AS DWORD, _
                                                                                     BYVAL STYLE AS DWORD) AS DWORD
    MACRO SetupRenameError(hwndParent, DialogTitle, SourceFile, TargetFile, Win32ErrorCode, STYLE) = SetupRenameErrorW(hwndParent, DialogTitle, SourceFile, TargetFile, Win32ErrorCode, STYLE)
    
    DECLARE FUNCTION SetupDeleteErrorW LIB "SETUPAPI.DLL" ALIAS "SetupDeleteErrorW" (BYVAL hwndParent AS DWORD, _
                                                                                     BYREF DialogTitle AS ANY, _
                                                                                     BYREF File AS ANY, _
                                                                                     BYVAL Win32ErrorCode AS DWORD, _
                                                                                     BYVAL STYLE AS DWORD) AS DWORD
    MACRO SetupDeleteError(hwndParent, DialogTitle, File, Win32ErrorCode, STYLE) = SetupDeleteErrorW(hwndParent, DialogTitle, File, Win32ErrorCode, STYLE)
    
    DECLARE FUNCTION SetupBackupErrorW LIB "SETUPAPI.DLL" ALIAS "SetupBackupErrorW" (BYVAL hwndParent AS DWORD, _
                                                                                     BYREF DialogTitle AS ANY, _
                                                                                     BYREF SourceFile AS ANY, _
                                                                                     BYREF TargetFile AS ANY, _
                                                                                     BYVAL Win32ErrorCode AS DWORD, _
                                                                                     BYVAL STYLE AS DWORD) AS DWORD
    MACRO SetupBackupError(hwndParent, DialogTitle, SourceFile, TargetFile, Win32ErrorCode, STYLE) = SetupBackupErrorW(hwndParent, DialogTitle, SourceFile, TargetFile, Win32ErrorCode, STYLE)
    
    DECLARE FUNCTION SetupSetDirectoryIdW LIB "SETUPAPI.DLL" ALIAS "SetupSetDirectoryIdW" (BYVAL InfHandle AS HINF, _
                                                                                           BYVAL Id AS DWORD, _
                                                                                           BYREF Directory AS ANY) AS LONG
    MACRO SetupSetDirectoryId(InfHandle, Id, Directory) = SetupSetDirectoryIdW(InfHandle, Id, Directory)
    
    DECLARE FUNCTION SetupSetDirectoryIdExW LIB "SETUPAPI.DLL" ALIAS "SetupSetDirectoryIdExW" (BYVAL InfHandle AS HINF, _
                                                                                               BYVAL Id AS DWORD, _
                                                                                               BYREF Directory AS ANY, _
                                                                                               BYVAL Flags AS DWORD, _
                                                                                               BYVAL Reserved1 AS DWORD, _
                                                                                               BYREF Reserved2 AS ANY) AS LONG
    MACRO SetupSetDirectoryIdEx(InfHandle, Id, Directory, Flags, Reserved1, Reserved2) = SetupSetDirectoryIdExW(InfHandle, Id, Directory, Flags, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupGetSourceInfoW LIB "SETUPAPI.DLL" ALIAS "SetupGetSourceInfoW" (BYVAL InfHandle AS HINF, _
                                                                                         BYVAL SourceId AS DWORD, _
                                                                                         BYVAL InfoDesired AS DWORD, _
                                                                                         BYREF ReturnBuffer AS ANY, _
                                                                                         BYVAL ReturnBufferSize AS DWORD, _
                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetSourceInfo(InfHandle, SourceId, InfoDesired, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetSourceInfoW(InfHandle, SourceId, InfoDesired, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupInstallFileW LIB "SETUPAPI.DLL" ALIAS "SetupInstallFileW" (BYVAL InfHandle AS HINF, _
                                                                                     BYREF inContext AS INFCONTEXT, _
                                                                                     BYREF SourceFile AS ANY, _
                                                                                     BYREF SourcePathRoot AS ANY, _
                                                                                     BYREF DestinationName AS ANY, _
                                                                                     BYVAL CopyStyle AS DWORD, _
                                                                                     BYVAL CopyMsgHandler AS DWORD, _
                                                                                     BYREF inContext AS ANY) AS LONG
    MACRO SetupInstallFile(InfHandle, inContext, SourceFile, SourcePathRoot, DestinationName, CopyStyle, CopyMsgHandler, inContext) = SetupInstallFileW(InfHandle, inContext, SourceFile, SourcePathRoot, DestinationName, CopyStyle, CopyMsgHandler, inContext)
    
    DECLARE FUNCTION SetupInstallFileExW LIB "SETUPAPI.DLL" ALIAS "SetupInstallFileExW" (BYVAL InfHandle AS HINF, _
                                                                                         BYREF inContext AS INFCONTEXT, _
                                                                                         BYREF SourceFile AS ANY, _
                                                                                         BYREF SourcePathRoot AS ANY, _
                                                                                         BYREF DestinationName AS ANY, _
                                                                                         BYVAL CopyStyle AS DWORD, _
                                                                                         BYVAL CopyMsgHandler AS DWORD, _
                                                                                         BYREF inContext AS ANY, _
                                                                                         BYREF FileWasInUse AS LONG) AS LONG
    MACRO SetupInstallFileEx(InfHandle, inContext, SourceFile, SourcePathRoot, DestinationName, CopyStyle, CopyMsgHandler, inContext, FileWasInUse) = _
    SetupInstallFileExW(InfHandle, inContext, SourceFile, SourcePathRoot, DestinationName, CopyStyle, CopyMsgHandler, inContext, FileWasInUse)
    
    DECLARE FUNCTION SetupSetFileQueueAlternatePlatformW LIB "SETUPAPI.DLL" ALIAS "SetupSetFileQueueAlternatePlatformW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                                         BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO, _
                                                                                                                         BYREF AlternateDefaultCatalogFile AS ANY) AS LONG
    MACRO SetupSetFileQueueAlternatePlatform(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile) = SetupSetFileQueueAlternatePlatformW(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile)
    
    DECLARE FUNCTION SetupSetPlatformPathOverrideW LIB "SETUPAPI.DLL" ALIAS "SetupSetPlatformPathOverrideW" (BYREF Override AS ANY) AS LONG
    MACRO SetupSetPlatformPathOverride(Override) = SetupSetPlatformPathOverrideW(Override)
    
    DECLARE FUNCTION SetupQueueCopyW LIB "SETUPAPI.DLL" ALIAS "SetupQueueCopyW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                 BYREF SourceRootPath AS ANY, _
                                                                                 BYREF SourcePath AS ANY, _
                                                                                 BYREF SourceFilename AS ANY, _
                                                                                 BYREF SourceDescription AS ANY, _
                                                                                 BYREF SourceTagfile AS ANY, _
                                                                                 BYREF TargetDirectory AS ANY, _
                                                                                 BYREF TargetFilename AS ANY, _
                                                                                 BYVAL CopyStyle AS DWORD) AS LONG
    MACRO SetupQueueCopy(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle) = _
    SetupQueueCopyW(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle)
    
    DECLARE FUNCTION SetupQueueCopyIndirectW LIB "SETUPAPI.DLL" ALIAS "SetupQueueCopyIndirectW" (BYREF CopyParams AS SP_FILE_COPY_PARAMS_W) AS LONG
    MACRO SetupQueueCopyIndirect(CopyParams) = SetupQueueCopyIndirectW(CopyParams)
    
    DECLARE FUNCTION SetupQueueDefaultCopyW LIB "SETUPAPI.DLL" ALIAS "SetupQueueDefaultCopyW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                               BYVAL InfHandle AS HINF, _
                                                                                               BYREF SourceRootPath AS ANY, _
                                                                                               BYREF SourceFilename AS ANY, _
                                                                                               BYREF TargetFilename AS ANY, _
                                                                                               BYVAL CopyStyle AS DWORD) AS LONG
    MACRO SetupQueueDefaultCopy(QueueHandle, InfHandle, SourceRootPath, SourceFilename, TargetFilename, CopyStyle) = SetupQueueDefaultCopyW(QueueHandle, InfHandle, SourceRootPath, SourceFilename, TargetFilename, CopyStyle)
    
    DECLARE FUNCTION SetupQueueCopySectionW LIB "SETUPAPI.DLL" ALIAS "SetupQueueCopySectionW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                               BYREF SourceRootPath AS ANY, _
                                                                                               BYVAL InfHandle AS HINF, _
                                                                                               BYVAL ListInfHandle AS HINF, _
                                                                                               BYREF Section AS ANY, _
                                                                                               BYVAL CopyStyle AS DWORD) AS LONG
    MACRO SetupQueueCopySection(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle) = SetupQueueCopySectionW(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle)
    
    DECLARE FUNCTION SetupQueueDeleteW LIB "SETUPAPI.DLL" ALIAS "SetupQueueDeleteW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                     BYREF PathPart1 AS ANY, _
                                                                                     BYREF PathPart2 AS ANY) AS LONG
    MACRO SetupQueueDelete(QueueHandle, PathPart1, PathPart2) = SetupQueueDeleteW(QueueHandle, PathPart1, PathPart2)
    
    DECLARE FUNCTION SetupQueueDeleteSectionW LIB "SETUPAPI.DLL" ALIAS "SetupQueueDeleteSectionW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                   BYVAL InfHandle AS HINF, _
                                                                                                   BYVAL ListInfHandle AS HINF, _
                                                                                                   BYREF Section AS ANY) AS LONG
    MACRO SetupQueueDeleteSection(QueueHandle, InfHandle, ListInfHandle, Section) = SetupQueueDeleteSectionW(QueueHandle, InfHandle, ListInfHandle, Section)
    
    DECLARE FUNCTION SetupQueueRenameW LIB "SETUPAPI.DLL" ALIAS "SetupQueueRenameW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                     BYREF SourcePath AS ANY, _
                                                                                     BYREF SourceFilename AS ANY, _
                                                                                     BYREF TargetPath AS ANY, _
                                                                                     BYREF TargetFilename AS ANY) AS LONG
    MACRO SetupQueueRename(QueueHandle, SourcePath, SourceFilename, TargetPath, TargetFilename) = SetupQueueRenameW(QueueHandle, SourcePath, SourceFilename, TargetPath, TargetFilename)
    
    DECLARE FUNCTION SetupQueueRenameSectionW LIB "SETUPAPI.DLL" ALIAS "SetupQueueRenameSectionW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                   BYVAL InfHandle AS HINF, _
                                                                                                   BYVAL ListInfHandle AS HINF, _
                                                                                                   BYREF Section AS ANY) AS LONG
    MACRO SetupQueueRenameSection(QueueHandle, InfHandle, ListInfHandle, Section) = SetupQueueRenameSectionW(QueueHandle, InfHandle, ListInfHandle, Section)
    
    DECLARE FUNCTION SetupCommitFileQueueW LIB "SETUPAPI.DLL" ALIAS "SetupCommitFileQueueW" (BYVAL Owner AS DWORD, _
                                                                                             BYVAL QueueHandle AS HSPFILEQ, _
                                                                                             BYVAL MsgHandler AS DWORD, _
                                                                                             BYREF inContext AS ANY) AS LONG
    MACRO SetupCommitFileQueue(Owner, QueueHandle, MsgHandler, inContext) = SetupCommitFileQueueW(Owner, QueueHandle, MsgHandler, inContext)
    
    DECLARE FUNCTION SetupScanFileQueueW LIB "SETUPAPI.DLL" ALIAS "SetupScanFileQueueW" (BYVAL FileQueue AS HSPFILEQ, _
                                                                                         BYVAL Flags AS DWORD, _
                                                                                         BYVAL WINDOW AS DWORD, _
                                                                                         BYVAL CallbackRoutine AS DWORD, _
                                                                                         BYREF CallbackContext AS ANY, _
                                                                                         BYREF Result AS DWORD) AS LONG
    MACRO SetupScanFileQueue(FileQueue, Flags, WINDOW, CallbackRoutine, CallbackContext, Result) = SetupScanFileQueueW(FileQueue, Flags, WINDOW, CallbackRoutine, CallbackContext, Result)
    
    DECLARE FUNCTION SetupCopyOEMInfW LIB "SETUPAPI.DLL" ALIAS "SetupCopyOEMInfW" (BYREF SourceInfFileName AS ANY, _
                                                                                   BYREF OEMSourceMediaLocation AS ANY, _
                                                                                   BYVAL OEMSourceMediaType AS DWORD, _
                                                                                   BYVAL CopyStyle AS DWORD, _
                                                                                   BYREF DestinationInfFileName AS ANY, _
                                                                                   BYVAL DestinationInfFileNameSize AS DWORD, _
                                                                                   BYREF RequiredSize AS DWORD, _
                                                                                   BYREF DestinationInfFileNameComponent AS ANY) AS LONG
    MACRO SetupCopyOEMInf(SourceInfFileName, OEMSourceMediaLocation, OEMSourceMediaType, CopyStyle, DestinationInfFileName, DestinationInfFileNameSize, RequiredSize, DestinationInfFileNameComponent) = _
    SetupCopyOEMInfW(SourceInfFileName, OEMSourceMediaLocation, OEMSourceMediaType, CopyStyle, DestinationInfFileName, DestinationInfFileNameSize, RequiredSize, DestinationInfFileNameComponent)
    
    DECLARE FUNCTION SetupUninstallOEMInfW LIB "SETUPAPI.DLL" ALIAS "SetupUninstallOEMInfW" (BYREF InfFileName AS ANY, _
                                                                                             BYVAL Flags AS DWORD, _
                                                                                             BYREF Reserved AS ANY) AS LONG
    MACRO SetupUninstallOEMInf(InfFileName, Flags, Reserved) = SetupUninstallOEMInfW(InfFileName, Flags, Reserved)
    
    DECLARE FUNCTION SetupCreateDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupCreateDiskSpaceListW" (BYREF Reserved1 AS ANY, _
                                                                                                     BYVAL Reserved2 AS DWORD, _
                                                                                                     BYVAL Flags AS DWORD) AS HDSKSPC
    MACRO SetupCreateDiskSpaceList(Reserved1, Reserved2, Flags) = SetupCreateDiskSpaceListW(Reserved1, Reserved2, Flags)
    
    DECLARE FUNCTION SetupDuplicateDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupDuplicateDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                           BYREF Reserved1 AS ANY, _
                                                                                                           BYVAL Reserved2 AS DWORD, _
                                                                                                           BYVAL Flags AS DWORD) AS HDSKSPC
    MACRO SetupDuplicateDiskSpaceList(DiskSpace, Reserved1, Reserved2, Flags) = SetupDuplicateDiskSpaceListW(DiskSpace, Reserved1, Reserved2, Flags)
    
    DECLARE FUNCTION SetupQueryDrivesInDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupQueryDrivesInDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                   BYREF ReturnBuffer AS ANY, _
                                                                                                                   BYVAL ReturnBufferSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupQueryDrivesInDiskSpaceList(DiskSpace, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupQueryDrivesInDiskSpaceListW(DiskSpace, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupQuerySpaceRequiredOnDriveW LIB "SETUPAPI.DLL" ALIAS "SetupQuerySpaceRequiredOnDriveW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                 BYREF DriveSpec AS ANY, _
                                                                                                                 BYREF SpaceRequired AS QUAD, _
                                                                                                                 BYREF Reserved1 AS ANY, _
                                                                                                                 BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupQuerySpaceRequiredOnDrive(DiskSpace, DriveSpec, SpaceRequired, Reserved1, Reserved2) = SetupQuerySpaceRequiredOnDriveW(DiskSpace, DriveSpec, SpaceRequired, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupAdjustDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupAdjustDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                     BYREF DriveRoot AS ANY, _
                                                                                                     BYVAL Amount AS QUAD, _
                                                                                                     BYREF Reserved1 AS ANY, _
                                                                                                     BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupAdjustDiskSpaceList(DiskSpace, DriveRoot, Amount, Reserved1, Reserved2) = SetupAdjustDiskSpaceListW(DiskSpace, DriveRoot, Amount, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupAddToDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupAddToDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                   BYREF TargetFilespec AS ANY, _
                                                                                                   BYVAL FileSize AS QUAD, _
                                                                                                   BYVAL Operation AS DWORD, _
                                                                                                   BYREF Reserved1 AS ANY, _
                                                                                                   BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupAddToDiskSpaceList(DiskSpace, TargetFilespec, FileSize, Operation, Reserved1, Reserved2) = SetupAddToDiskSpaceListW(DiskSpace, TargetFilespec, FileSize, Operation, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupAddSectionToDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupAddSectionToDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                 BYVAL InfHandle AS HINF, _
                                                                                                                 BYVAL ListInfHandle AS HINF, _
                                                                                                                 BYREF SectionName AS ANY, _
                                                                                                                 BYVAL Operation AS DWORD, _
                                                                                                                 BYREF Reserved1 AS ANY, _
                                                                                                                 BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupAddSectionToDiskSpaceList(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2) = SetupAddSectionToDiskSpaceListW(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupAddInstallSectionToDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupAddInstallSectionToDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                               BYVAL InfHandle AS HINF, _
                                                                                                                               BYVAL LayoutInfHandle AS HINF, _
                                                                                                                               BYREF SectionName AS ANY, _
                                                                                                                               BYREF Reserved1 AS ANY, _
                                                                                                                               BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupAddInstallSectionToDiskSpaceList(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2) = SetupAddInstallSectionToDiskSpaceListW(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupRemoveFromDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupRemoveFromDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                             BYREF TargetFilespec AS ANY, _
                                                                                                             BYVAL Operation AS DWORD, _
                                                                                                             BYREF Reserved1 AS ANY, _
                                                                                                             BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupRemoveFromDiskSpaceList(DiskSpace, TargetFilespec, Operation, Reserved1, Reserved2) = SetupRemoveFromDiskSpaceListW(DiskSpace, TargetFilespec, Operation, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupRemoveSectionFromDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupRemoveSectionFromDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                           BYVAL InfHandle AS HINF, _
                                                                                                                           BYVAL ListInfHandle AS HINF, _
                                                                                                                           BYREF SectionName AS ANY, _
                                                                                                                           BYVAL Operation AS DWORD, _
                                                                                                                           BYREF Reserved1 AS ANY, _
                                                                                                                           BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupRemoveSectionFromDiskSpaceList(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2) = SetupRemoveSectionFromDiskSpaceListW(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupRemoveInstallSectionFromDiskSpaceListW LIB "SETUPAPI.DLL" ALIAS "SetupRemoveInstallSectionFromDiskSpaceListW" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                                         BYVAL InfHandle AS HINF, _
                                                                                                                                         BYVAL LayoutInfHandle AS HINF, _
                                                                                                                                         BYREF SectionName AS ANY, _
                                                                                                                                         BYREF Reserved1 AS ANY, _
                                                                                                                                         BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupRemoveInstallSectionFromDiskSpaceList(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2) = SetupRemoveInstallSectionFromDiskSpaceListW(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupIterateCabinetW LIB "SETUPAPI.DLL" ALIAS "SetupIterateCabinetW" (BYREF CabinetFile AS ANY, _
                                                                                           BYVAL Reserved AS DWORD, _
                                                                                           BYVAL MsgHandler AS DWORD, _
                                                                                           BYREF inContext AS ANY) AS LONG
    MACRO SetupIterateCabinet(CabinetFile, Reserved, MsgHandler, inContext) = SetupIterateCabinetW(CabinetFile, Reserved, MsgHandler, inContext)
    
    DECLARE FUNCTION SetupDefaultQueueCallbackW LIB "SETUPAPI.DLL" ALIAS "SetupDefaultQueueCallbackW" (BYREF inContext AS ANY, _
                                                                                                       BYVAL Notification AS DWORD, _
                                                                                                       BYREF Param1 AS DWORD, _
                                                                                                       BYREF Param2 AS DWORD) AS DWORD
    MACRO SetupDefaultQueueCallback(inContext, Notification, Param1, Param2) = SetupDefaultQueueCallbackW(inContext, Notification, Param1, Param2)
    
    DECLARE FUNCTION SetupInstallFromInfSectionW LIB "SETUPAPI.DLL" ALIAS "SetupInstallFromInfSectionW" (BYVAL Owner AS DWORD, _
                                                                                                         BYVAL InfHandle AS HINF, _
                                                                                                         BYREF SectionName AS ANY, _
                                                                                                         BYVAL Flags AS DWORD, _
                                                                                                         BYVAL RelativeKeyRoot AS DWORD, _
                                                                                                         BYREF SourceRootPath AS ANY, _
                                                                                                         BYVAL CopyFlags AS DWORD, _
                                                                                                         BYVAL MsgHandler AS DWORD, _
                                                                                                         BYREF inContext AS ANY, _
                                                                                                         BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF PSP_DEVINFO_DATA AS SP_DEVINFO_DATA) AS LONG
    MACRO SetupInstallFromInfSection(Owner, InfHandle, SectionName, Flags, RelativeKeyRoot, SourceRootPath, CopyFlags, MsgHandler, inContext, DeviceInfoSet, PSP_DEVINFO_DATA) = _
    SetupInstallFromInfSectionW(Owner, InfHandle, SectionName, Flags, RelativeKeyRoot, SourceRootPath, CopyFlags, MsgHandler, inContext, DeviceInfoSet, PSP_DEVINFO_DATA)
    
    DECLARE FUNCTION SetupInstallFilesFromInfSectionW LIB "SETUPAPI.DLL" ALIAS "SetupInstallFilesFromInfSectionW" (BYVAL InfHandle AS HINF, _
                                                                                                                   BYVAL LayoutInfHandle AS HINF, _
                                                                                                                   BYVAL FileQueue AS HSPFILEQ, _
                                                                                                                   BYREF SectionName AS ANY, _
                                                                                                                   BYREF SourceRootPath AS ANY, _
                                                                                                                   BYVAL CopyFlags AS DWORD) AS LONG
    MACRO SetupInstallFilesFromInfSection(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags) = SetupInstallFilesFromInfSectionW(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags)
    
    DECLARE FUNCTION SetupInstallServicesFromInfSectionW LIB "SETUPAPI.DLL" ALIAS "SetupInstallServicesFromInfSectionW" (BYVAL InfHandle AS HINF, _
                                                                                                                         BYREF SectionName AS ANY, _
                                                                                                                         BYVAL Flags AS DWORD) AS LONG
    MACRO SetupInstallServicesFromInfSection(InfHandle, SectionName, Flags) = SetupInstallServicesFromInfSectionW(InfHandle, SectionName, Flags)
    
    DECLARE FUNCTION SetupInstallServicesFromInfSectionExW LIB "SETUPAPI.DLL" ALIAS "SetupInstallServicesFromInfSectionExW" (BYVAL InfHandle AS HINF, _
                                                                                                                             BYREF SectionName AS ANY, _
                                                                                                                             BYVAL Flags AS DWORD, _
                                                                                                                             BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                                             BYREF Reserved1 AS ANY, _
                                                                                                                             BYREF Reserved2 AS ANY) AS LONG
    MACRO SetupInstallServicesFromInfSectionEx(InfHandle, SectionName, Flags, DeviceInfoSet, DeviceInfoData, Reserved1, Reserved2) = SetupInstallServicesFromInfSectionExW(InfHandle, SectionName, Flags, DeviceInfoSet, DeviceInfoData, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupInitializeFileLogW LIB "SETUPAPI.DLL" ALIAS "SetupInitializeFileLogW" (BYREF LogFileName AS ANY, _
                                                                                                 BYVAL Flags AS DWORD) AS HSPFILELOG
    MACRO SetupInitializeFileLog(LogFileName, Flags) = SetupInitializeFileLogW(LogFileName, Flags)
    
    DECLARE FUNCTION SetupLogFileW LIB "SETUPAPI.DLL" ALIAS "SetupLogFileW" (BYVAL FileLogHandle AS HSPFILELOG, _
                                                                             BYREF LogSectionName AS ANY, _
                                                                             BYREF SourceFilename AS ANY, _
                                                                             BYREF TargetFilename AS ANY, _
                                                                             BYVAL Checksum AS DWORD, _
                                                                             BYREF DiskTagfile AS ANY, _
                                                                             BYREF DiskDescription AS ANY, _
                                                                             BYREF OtherInfo AS ANY, _
                                                                             BYVAL Flags AS DWORD) AS LONG
    MACRO SetupLogFile(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags) = _
    SetupLogFileW(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags)
    
    DECLARE FUNCTION SetupRemoveFileLogEntryW LIB "SETUPAPI.DLL" ALIAS "SetupRemoveFileLogEntryW" (BYVAL FileLogHandle AS HSPFILELOG, _
                                                                                                   BYREF LogSectionName AS ANY, _
                                                                                                   BYREF TargetFilename AS ANY) AS LONG
    MACRO SetupRemoveFileLogEntry(FileLogHandle, LogSectionName, TargetFilename) = SetupRemoveFileLogEntryW(FileLogHandle, LogSectionName, TargetFilename)
    
    DECLARE FUNCTION SetupQueryFileLogW LIB "SETUPAPI.DLL" ALIAS "SetupQueryFileLogW" (BYVAL FileLogHandle AS HSPFILELOG, _
                                                                                       BYREF LogSectionName AS ANY, _
                                                                                       BYREF TargetFilename AS ANY, _
                                                                                       BYVAL DesiredInfo AS LONG, _
                                                                                       BYREF DataOut AS ANY, _
                                                                                       BYVAL ReturnBufferSize AS DWORD, _
                                                                                       BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupQueryFileLog(FileLogHandle, LogSectionName, TargetFilename, DesiredInfo, DataOut, ReturnBufferSize, RequiredSize) = SetupQueryFileLogW(FileLogHandle, LogSectionName, TargetFilename, DesiredInfo, DataOut, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupLogErrorW LIB "SETUPAPI.DLL" ALIAS "SetupLogErrorW" (BYREF MessageString AS ANY, _
                                                                               BYVAL Severity AS LogSeverity) AS LONG
    MACRO SetupLogError(MessageString, Severity) = SetupLogErrorW(MessageString, Severity)
    
    DECLARE FUNCTION SetupGetBackupInformationW LIB "SETUPAPI.DLL" ALIAS "SetupGetBackupInformationW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                       BYREF BackupParams AS SP_BACKUP_QUEUE_PARAMS_W) AS LONG
    MACRO SetupGetBackupInformation(QueueHandle, BackupParams) = SetupGetBackupInformationW(QueueHandle, BackupParams)
    
    DECLARE FUNCTION SetupPrepareQueueForRestoreW LIB "SETUPAPI.DLL" ALIAS "SetupPrepareQueueForRestoreW" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                           BYREF BackupPath AS ANY, _
                                                                                                           BYVAL RestoreFlags AS DWORD) AS LONG
    MACRO SetupPrepareQueueForRestore(QueueHandle, BackupPath, RestoreFlags) = SetupPrepareQueueForRestoreW(QueueHandle, BackupPath, RestoreFlags)
    
    DECLARE FUNCTION SetupDiCreateDeviceInfoListExW LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInfoListExW" (BYREF ClassGuid AS GUID, _
                                                                                                               BYVAL hwndParent AS DWORD, _
                                                                                                               BYREF MachineName AS ANY, _
                                                                                                               BYREF Reserved AS ANY) AS DWORD
    MACRO SetupDiCreateDeviceInfoListEx(ClassGuid, hwndParent, MachineName, Reserved) = SetupDiCreateDeviceInfoListExW(ClassGuid, hwndParent, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetDeviceInfoListDetailW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInfoListDetailW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                 BYREF DeviceInfoSetDetailData AS SP_DEVINFO_LIST_DETAIL_DATA_W) AS LONG
    MACRO SetupDiGetDeviceInfoListDetail(DeviceInfoSet, DeviceInfoSetDetailData) = SetupDiGetDeviceInfoListDetailW(DeviceInfoSet, DeviceInfoSetDetailData)
    
    DECLARE FUNCTION SetupDiCreateDeviceInfoW LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInfoW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                   BYREF DeviceName AS ANY, _
                                                                                                   BYREF ClassGuid AS GUID, _
                                                                                                   BYREF DeviceDescription AS ANY, _
                                                                                                   BYVAL hwndParent AS DWORD, _
                                                                                                   BYVAL CreationFlags AS DWORD, _
                                                                                                   BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    MACRO SetupDiCreateDeviceInfo(DeviceInfoSet, DeviceName, ClassGuid, DeviceDescription, hwndParent, CreationFlags, DeviceInfoData) = SetupDiCreateDeviceInfoW(DeviceInfoSet, DeviceName, ClassGuid, DeviceDescription, hwndParent, CreationFlags, DeviceInfoData)
    
    DECLARE FUNCTION SetupDiOpenDeviceInfoW LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenDeviceInfoW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                               BYREF DeviceInstanceId AS ANY, _
                                                                                               BYVAL hwndParent AS DWORD, _
                                                                                               BYVAL OpenFlags AS DWORD, _
                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    MACRO SetupDiOpenDeviceInfo(DeviceInfoSet, DeviceInstanceId, hwndParent, OpenFlags, DeviceInfoData) = SetupDiOpenDeviceInfoW(DeviceInfoSet, DeviceInstanceId, hwndParent, OpenFlags, DeviceInfoData)
    
    DECLARE FUNCTION SetupDiGetDeviceInstanceIdW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInstanceIdW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                         BYREF DeviceInstanceId AS ANY, _
                                                                                                         BYVAL DeviceInstanceIdSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetDeviceInstanceId(DeviceInfoSet, DeviceInfoData, DeviceInstanceId, DeviceInstanceIdSize, RequiredSize) = SetupDiGetDeviceInstanceIdW(DeviceInfoSet, DeviceInfoData, DeviceInstanceId, DeviceInstanceIdSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiCreateDeviceInterfaceW LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInterfaceW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                             BYREF InterfaceClassGuid AS GUID, _
                                                                                                             BYREF ReferenceString AS ANY, _
                                                                                                             BYVAL CreationFlags AS DWORD, _
                                                                                                             BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA) AS LONG
    MACRO SetupDiCreateDeviceInterface(DeviceInfoSet, DeviceInfoData, InterfaceClassGuid, ReferenceString, CreationFlags, DeviceInterfaceData) = _
    SetupDiCreateDeviceInterfaceW(DeviceInfoSet, DeviceInfoData, InterfaceClassGuid, ReferenceString, CreationFlags, DeviceInterfaceData)
    
    DECLARE FUNCTION SetupDiOpenDeviceInterfaceW LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenDeviceInterfaceW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF DevicePath AS ANY, _
                                                                                                         BYVAL OpenFlags AS DWORD, _
                                                                                                         BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA) AS LONG
    MACRO SetupDiOpenDeviceInterface(DeviceInfoSet, DevicePath, OpenFlags, DeviceInterfaceData) = SetupDiOpenDeviceInterfaceW(DeviceInfoSet, DevicePath, OpenFlags, DeviceInterfaceData)
    
    DECLARE FUNCTION SetupDiGetDeviceInterfaceDetailW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInterfaceDetailW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                   BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA, _
                                                                                                                   BYREF DeviceInterfaceDetailData AS SP_DEVICE_INTERFACE_DETAIL_DATA_W, _
                                                                                                                   BYVAL DeviceInterfaceDetailDataSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD, _
                                                                                                                   BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    MACRO SetupDiGetDeviceInterfaceDetail(DeviceInfoSet, DeviceInterfaceData, DeviceInterfaceDetailData, DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData) = _
    SetupDiGetDeviceInterfaceDetailW(DeviceInfoSet, DeviceInterfaceData, DeviceInterfaceDetailData, DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData)
    
    DECLARE FUNCTION SetupDiEnumDriverInfoW LIB "SETUPAPI.DLL" ALIAS "SetupDiEnumDriverInfoW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                               BYVAL DriverType AS DWORD, _
                                                                                               BYVAL MemberIndex AS DWORD, _
                                                                                               BYREF DriverInfoData AS SP_DRVINFO_DATA_W) AS LONG
    MACRO SetupDiEnumDriverInfo(DeviceInfoSet, DeviceInfoData, DriverType, MemberIndex, DriverInfoData) = SetupDiEnumDriverInfoW(DeviceInfoSet, DeviceInfoData, DriverType, MemberIndex, DriverInfoData)
    
    DECLARE FUNCTION SetupDiGetSelectedDriverW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetSelectedDriverW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                     BYREF DriverInfoData AS SP_DRVINFO_DATA_W) AS LONG
    MACRO SetupDiGetSelectedDriver(DeviceInfoSet, DeviceInfoData, DriverInfoData) = SetupDiGetSelectedDriverW(DeviceInfoSet, DeviceInfoData, DriverInfoData)
    
    DECLARE FUNCTION SetupDiSetSelectedDriverW LIB "SETUPAPI.DLL" ALIAS "SetupDiSetSelectedDriverW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                     BYREF DriverInfoData AS ANY) AS LONG
    MACRO SetupDiSetSelectedDriver(DeviceInfoSet, DeviceInfoData, DriverInfoData) = SetupDiSetSelectedDriverW(DeviceInfoSet, DeviceInfoData, DriverInfoData)
    
    DECLARE FUNCTION SetupDiGetDriverInfoDetailW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDriverInfoDetailW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                         BYREF DriverInfoData AS SP_DRVINFO_DATA_W, _
                                                                                                         BYREF DriverInfoDetailData AS SP_DRVINFO_DETAIL_DATA_W, _
                                                                                                         BYVAL DriverInfoDetailDataSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetDriverInfoDetail(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInfoDetailData, DriverInfoDetailDataSize, RequiredSize) = _
    SetupDiGetDriverInfoDetailW(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInfoDetailData, DriverInfoDetailDataSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiGetClassDevsW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDevsW" (BYREF ClassGuid AS GUID, _
                                                                                           BYREF Enumerator AS ANY, _
                                                                                           BYVAL hwndParent AS DWORD, _
                                                                                           BYVAL Flags AS DWORD) AS DWORD
    MACRO SetupDiGetClassDevs(ClassGuid, Enumerator, hwndParent, Flags) = SetupDiGetClassDevsW(ClassGuid, Enumerator, hwndParent, Flags)
    
    DECLARE FUNCTION SetupDiGetClassDevsExW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDevsExW" (BYREF ClassGuid AS GUID, _
                                                                                               BYREF Enumerator AS ANY, _
                                                                                               BYVAL hwndParent AS DWORD, _
                                                                                               BYVAL Flags AS DWORD, _
                                                                                               BYVAL DeviceInfoSet AS DWORD, _
                                                                                               BYREF MachineName AS ANY, _
                                                                                               BYREF Reserved AS ANY) AS DWORD
    MACRO SetupDiGetClassDevsEx(ClassGuid, Enumerator, hwndParent, Flags, DeviceInfoSet, MachineName, Reserved) = SetupDiGetClassDevsExW(ClassGuid, Enumerator, hwndParent, Flags, DeviceInfoSet, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetINFClassW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetINFClassW" (BYREF InfName AS ANY, _
                                                                                         BYREF ClassGuid AS GUID, _
                                                                                         BYREF ClassName AS ANY, _
                                                                                         BYVAL ClassNameSize AS DWORD, _
                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetINFClass(InfName, ClassGuid, ClassName, ClassNameSize, RequiredSize) = SetupDiGetINFClassW(InfName, ClassGuid, ClassName, ClassNameSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiBuildClassInfoListExW LIB "SETUPAPI.DLL" ALIAS "SetupDiBuildClassInfoListExW" (BYVAL Flags AS DWORD, _
                                                                                                           BYREF ClassGuidList AS GUID, _
                                                                                                           BYVAL ClassGuidListSize AS DWORD, _
                                                                                                           BYREF RequiredSize AS DWORD, _
                                                                                                           BYREF MachineName AS ANY, _
                                                                                                           BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiBuildClassInfoListEx(Flags, ClassGuidList, ClassGuidListSize, RequiredSize, MachineName, Reserved) = SetupDiBuildClassInfoListExW(Flags, ClassGuidList, ClassGuidListSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetClassDescriptionW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDescriptionW" (BYREF ClassGuid AS GUID, _
                                                                                                         BYREF ClassDescription AS ANY, _
                                                                                                         BYVAL ClassDescriptionSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetClassDescription(ClassGuid, ClassDescription, ClassDescriptionSize, RequiredSize) = SetupDiGetClassDescriptionW(ClassGuid, ClassDescription, ClassDescriptionSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiGetClassDescriptionExW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDescriptionExW" (BYREF ClassGuid AS GUID, _
                                                                                                             BYREF ClassDescription AS ANY, _
                                                                                                             BYVAL ClassDescriptionSize AS DWORD, _
                                                                                                             BYREF RequiredSize AS DWORD, _
                                                                                                             BYREF MachineName AS ANY, _
                                                                                                             BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetClassDescriptionEx(ClassGuid, ClassDescription, ClassDescriptionSize, RequiredSize, MachineName, Reserved) = SetupDiGetClassDescriptionExW(ClassGuid, ClassDescription, ClassDescriptionSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiInstallClassW LIB "SETUPAPI.DLL" ALIAS "SetupDiInstallClassW" (BYVAL hwndParent AS DWORD, _
                                                                                           BYREF InfFileName AS ANY, _
                                                                                           BYVAL Flags AS DWORD, _
                                                                                           BYVAL FileQueue AS HSPFILEQ) AS LONG
    MACRO SetupDiInstallClass(hwndParent, InfFileName, Flags, FileQueue) = SetupDiInstallClassW(hwndParent, InfFileName, Flags, FileQueue)
    
    DECLARE FUNCTION SetupDiInstallClassExW LIB "SETUPAPI.DLL" ALIAS "SetupDiInstallClassExW" (BYVAL hwndParent AS DWORD, _
                                                                                               BYREF InfFileName AS ANY, _
                                                                                               BYVAL Flags AS DWORD, _
                                                                                               BYVAL FileQueue AS HSPFILEQ, _
                                                                                               BYREF InterfaceClassGuid AS GUID, _
                                                                                               BYREF Reserved1 AS ANY, _
                                                                                               BYREF Reserved2 AS ANY) AS LONG
    MACRO SetupDiInstallClassEx(hwndParent, InfFileName, Flags, FileQueue, InterfaceClassGuid, Reserved1, Reserved2) = SetupDiInstallClassExW(hwndParent, InfFileName, Flags, FileQueue, InterfaceClassGuid, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupDiOpenClassRegKeyExW LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenClassRegKeyExW" (BYREF ClassGuid AS GUID, _
                                                                                                     BYVAL samDesired AS DWORD, _
                                                                                                     BYVAL Flags AS DWORD, _
                                                                                                     BYREF MachineName AS ANY, _
                                                                                                     BYREF Reserved AS ANY) AS DWORD
    MACRO SetupDiOpenClassRegKeyEx(ClassGuid, samDesired, Flags, MachineName, Reserved) = SetupDiOpenClassRegKeyExW(ClassGuid, samDesired, Flags, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiCreateDeviceInterfaceRegKeyW LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInterfaceRegKeyW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                         BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA, _
                                                                                                                         BYVAL Reserved AS DWORD, _
                                                                                                                         BYVAL samDesired AS DWORD, _
                                                                                                                         BYVAL InfHandle AS HINF, _
                                                                                                                         BYREF InfSectionName AS ANY) AS DWORD
    MACRO SetupDiCreateDeviceInterfaceRegKey(DeviceInfoSet, DeviceInterfaceData, Reserved, samDesired, InfHandle, InfSectionName) = SetupDiCreateDeviceInterfaceRegKeyW(DeviceInfoSet, DeviceInterfaceData, Reserved, samDesired, InfHandle, InfSectionName)
    
    DECLARE FUNCTION SetupDiCreateDevRegKeyW LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDevRegKeyW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                 BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                 BYVAL Scope AS DWORD, _
                                                                                                 BYVAL HwProfile AS DWORD, _
                                                                                                 BYVAL KeyType AS DWORD, _
                                                                                                 BYVAL InfHandle AS HINF, _
                                                                                                 BYREF InfSectionName AS ANY) AS DWORD
    MACRO SetupDiCreateDevRegKey(DeviceInfoSet, DeviceInfoData, Scope, HwProfile, KeyType, InfHandle, InfSectionName) = SetupDiCreateDevRegKeyW(DeviceInfoSet, DeviceInfoData, Scope, HwProfile, KeyType, InfHandle, InfSectionName)
    
    DECLARE FUNCTION SetupDiGetHwProfileListExW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetHwProfileListExW" (BYREF HwProfileList AS DWORD, _
                                                                                                       BYVAL HwProfileListSize AS DWORD, _
                                                                                                       BYREF RequiredSize AS DWORD, _
                                                                                                       BYREF CurrentlyActiveIndex AS DWORD, _
                                                                                                       BYREF MachineName AS ANY, _
                                                                                                       BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetHwProfileListEx(HwProfileList, HwProfileListSize, RequiredSize, CurrentlyActiveIndex, MachineName, Reserved) = SetupDiGetHwProfileListExW(HwProfileList, HwProfileListSize, RequiredSize, CurrentlyActiveIndex, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetDeviceRegistryPropertyW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceRegistryPropertyW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                                     BYVAL Property AS DWORD, _
                                                                                                                     BYREF PropertyRegDataType AS DWORD, _
                                                                                                                     BYREF PropertyBuffer AS ANY, _
                                                                                                                     BYVAL PropertyBufferSize AS DWORD, _
                                                                                                                     BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetDeviceRegistryProperty(DeviceInfoSet, DeviceInfoData, Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize) = _
    SetupDiGetDeviceRegistryPropertyW(DeviceInfoSet, DeviceInfoData, Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiGetClassRegistryPropertyW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassRegistryPropertyW" (BYREF ClassGuid AS GUID, _
                                                                                                                   BYVAL Property AS DWORD, _
                                                                                                                   BYREF PropertyRegDataType AS DWORD, _
                                                                                                                   BYREF PropertyBuffer AS ANY, _
                                                                                                                   BYVAL PropertyBufferSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD, _
                                                                                                                   BYREF MachineName AS ANY, _
                                                                                                                   BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetClassRegistryProperty(ClassGuid, Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize, MachineName, Reserved) = _
    SetupDiGetClassRegistryPropertyW(ClassGuid, Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiSetDeviceRegistryPropertyW LIB "SETUPAPI.DLL" ALIAS "SetupDiSetDeviceRegistryPropertyW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                     BYREF DeviceInfoData AS ANY, _
                                                                                                                     BYVAL Property AS DWORD, _
                                                                                                                     BYREF PropertyBuffer AS BYTE, _
                                                                                                                     BYVAL PropertyBufferSize AS DWORD) AS LONG
    MACRO SetupDiSetDeviceRegistryProperty(DeviceInfoSet, DeviceInfoData, Property, PropertyBuffer, PropertyBufferSize) = SetupDiSetDeviceRegistryPropertyW(DeviceInfoSet, DeviceInfoData, Property, PropertyBuffer, PropertyBufferSize)
    
    DECLARE FUNCTION SetupDiSetClassRegistryPropertyW LIB "SETUPAPI.DLL" ALIAS "SetupDiSetClassRegistryPropertyW" (BYREF ClassGuid AS GUID, _
                                                                                                                   BYVAL Property AS DWORD, _
                                                                                                                   BYREF PropertyBuffer AS BYTE, _
                                                                                                                   BYVAL PropertyBufferSize AS DWORD, _
                                                                                                                   BYREF MachineName AS ANY, _
                                                                                                                   BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiSetClassRegistryProperty(ClassGuid, Property, PropertyBuffer, PropertyBufferSize, MachineName, Reserved) = SetupDiSetClassRegistryPropertyW(ClassGuid, Property, PropertyBuffer, PropertyBufferSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetDeviceInstallParamsW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInstallParamsW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                               BYREF DeviceInstallParams AS SP_DEVINSTALL_PARAMS_W) AS LONG
    MACRO SetupDiGetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, DeviceInstallParams) = SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, DeviceInstallParams)
    
    DECLARE FUNCTION SetupDiGetClassInstallParamsW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassInstallParamsW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                             BYREF ClassInstallParams AS SP_CLASSINSTALL_HEADER, _
                                                                                                             BYVAL ClassInstallParamsSize AS DWORD, _
                                                                                                             BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetClassInstallParams(DeviceInfoSet, DeviceInfoData, ClassInstallParams, ClassInstallParamsSize, RequiredSize) = SetupDiGetClassInstallParamsW(DeviceInfoSet, DeviceInfoData, ClassInstallParams, ClassInstallParamsSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiSetDeviceInstallParamsW LIB "SETUPAPI.DLL" ALIAS "SetupDiSetDeviceInstallParamsW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                               BYREF DeviceInstallParams AS SP_DEVINSTALL_PARAMS_W) AS LONG
    MACRO SetupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, DeviceInstallParams) = SetupDiSetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, DeviceInstallParams)
    
    DECLARE FUNCTION SetupDiSetClassInstallParamsW LIB "SETUPAPI.DLL" ALIAS "SetupDiSetClassInstallParamsW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                             BYREF ClassInstallParams AS SP_CLASSINSTALL_HEADER, _
                                                                                                             BYVAL ClassInstallParamsSize AS DWORD) AS LONG
    MACRO SetupDiSetClassInstallParams(DeviceInfoSet, DeviceInfoData, ClassInstallParams, ClassInstallParamsSize) = SetupDiSetClassInstallParamsW(DeviceInfoSet, DeviceInfoData, ClassInstallParams, ClassInstallParamsSize)
    
    DECLARE FUNCTION SetupDiGetDriverInstallParamsW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDriverInstallParamsW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                               BYREF DriverInfoData AS SP_DRVINFO_DATA_W, _
                                                                                                               BYREF DriverInstallParams AS SP_DRVINSTALL_PARAMS) AS LONG
    MACRO SetupDiGetDriverInstallParams(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInstallParams) = SetupDiGetDriverInstallParamsW(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInstallParams)
    
    DECLARE FUNCTION SetupDiSetDriverInstallParamsW LIB "SETUPAPI.DLL" ALIAS "SetupDiSetDriverInstallParamsW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                               BYREF DriverInfoData AS SP_DRVINFO_DATA_W, _
                                                                                                               BYREF DriverInstallParams AS SP_DRVINSTALL_PARAMS) AS LONG
    MACRO SetupDiSetDriverInstallParams(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInstallParams) = SetupDiSetDriverInstallParamsW(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInstallParams)
    
    DECLARE FUNCTION SetupDiGetClassImageListExW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassImageListExW" (BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA, _
                                                                                                         BYREF MachineName AS ANY, _
                                                                                                         BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetClassImageListEx(ClassImageListData, MachineName, Reserved) = SetupDiGetClassImageListExW(ClassImageListData, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetClassDevPropertySheetsW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDevPropertySheetsW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                                     BYVAL PropertySheetHeader AS DWORD, _
                                                                                                                     BYVAL PropertySheetHeaderPageListSize AS DWORD, _
                                                                                                                     BYREF RequiredSize AS DWORD, _
                                                                                                                     BYVAL PropertySheetType AS DWORD) AS LONG
    MACRO SetupDiGetClassDevPropertySheets(DeviceInfoSet, DeviceInfoData, PropertySheetHeader, PropertySheetHeaderPageListSize, RequiredSize, PropertySheetType) = _
    SetupDiGetClassDevPropertySheetsW(DeviceInfoSet, DeviceInfoData, PropertySheetHeader, PropertySheetHeaderPageListSize, RequiredSize, PropertySheetType)
    
    DECLARE FUNCTION SetupDiClassNameFromGuidW LIB "SETUPAPI.DLL" ALIAS "SetupDiClassNameFromGuidW" (BYREF ClassGuid AS GUID, _
                                                                                                     BYREF ClassName AS ANY, _
                                                                                                     BYVAL ClassNameSize AS DWORD, _
                                                                                                     BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiClassNameFromGuid(ClassGuid, ClassName, ClassNameSize, RequiredSize) = SetupDiClassNameFromGuidW(ClassGuid, ClassName, ClassNameSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiClassNameFromGuidExW LIB "SETUPAPI.DLL" ALIAS "SetupDiClassNameFromGuidExW" (BYREF ClassGuid AS GUID, _
                                                                                                         BYREF ClassName AS ANY, _
                                                                                                         BYVAL ClassNameSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD, _
                                                                                                         BYREF MachineName AS ANY, _
                                                                                                         BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiClassNameFromGuidEx(ClassGuid, ClassName, ClassNameSize, RequiredSize, MachineName, Reserved) = SetupDiClassNameFromGuidExW(ClassGuid, ClassName, ClassNameSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiClassGuidsFromNameW LIB "SETUPAPI.DLL" ALIAS "SetupDiClassGuidsFromNameW" (BYREF ClassName AS ANY, _
                                                                                                       BYREF ClassGuidList AS GUID, _
                                                                                                       BYVAL ClassGuidListSize AS DWORD, _
                                                                                                       BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiClassGuidsFromName(ClassName, ClassGuidList, ClassGuidListSize, RequiredSize) = SetupDiClassGuidsFromNameW(ClassName, ClassGuidList, ClassGuidListSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiClassGuidsFromNameExW LIB "SETUPAPI.DLL" ALIAS "SetupDiClassGuidsFromNameExW" (BYREF ClassName AS ANY, _
                                                                                                           BYREF ClassGuidList AS GUID, _
                                                                                                           BYVAL ClassGuidListSize AS DWORD, _
                                                                                                           BYREF RequiredSize AS DWORD, _
                                                                                                           BYREF MachineName AS ANY, _
                                                                                                           BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiClassGuidsFromNameEx(ClassName, ClassGuidList, ClassGuidListSize, RequiredSize, MachineName, Reserved) = SetupDiClassGuidsFromNameExW(ClassName, ClassGuidList, ClassGuidListSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetHwProfileFriendlyNameW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetHwProfileFriendlyNameW" (BYVAL HwProfile AS DWORD, _
                                                                                                                   BYREF FriendlyName AS ANY, _
                                                                                                                   BYVAL FriendlyNameSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetHwProfileFriendlyName(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize) = SetupDiGetHwProfileFriendlyNameW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiGetHwProfileFriendlyNameExW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetHwProfileFriendlyNameExW" (BYVAL HwProfile AS DWORD, _
                                                                                                                       BYREF FriendlyName AS ANY, _
                                                                                                                       BYVAL FriendlyNameSize AS DWORD, _
                                                                                                                       BYREF RequiredSize AS DWORD, _
                                                                                                                       BYREF MachineName AS ANY, _
                                                                                                                       BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetHwProfileFriendlyNameEx(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved) = SetupDiGetHwProfileFriendlyNameExW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetActualSectionToInstallW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetActualSectionToInstallW" (BYVAL InfHandle AS HINF, _
                                                                                                                     BYREF InfSectionName AS ANY, _
                                                                                                                     BYREF InfSectionWithExt AS ANY, _
                                                                                                                     BYVAL InfSectionWithExtSize AS DWORD, _
                                                                                                                     BYREF RequiredSize AS DWORD, _
                                                                                                                     BYREF Extension AS ANY) AS LONG
    MACRO SetupDiGetActualSectionToInstall(InfHandle, InfSectionName, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension) = _
    SetupDiGetActualSectionToInstallW(InfHandle, InfSectionName, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension)
    
    DECLARE FUNCTION SetupDiGetActualSectionToInstallExW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetActualSectionToInstallExW" (BYVAL InfHandle AS HINF, _
                                                                                                                         BYREF InfSectionName AS ANY, _
                                                                                                                         BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO, _
                                                                                                                         BYREF InfSectionWithExt AS ANY, _
                                                                                                                         BYVAL InfSectionWithExtSize AS DWORD, _
                                                                                                                         BYREF RequiredSize AS DWORD, _
                                                                                                                         BYREF Extension AS ANY, _
                                                                                                                         BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetActualSectionToInstallEx(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved) = _
    SetupDiGetActualSectionToInstallExW(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved)
    
    DECLARE FUNCTION SetupEnumInfSectionsW LIB "SETUPAPI.DLL" ALIAS "SetupEnumInfSectionsW" (BYVAL InfHandle AS HINF, _
                                                                                             BYVAL Index AS DWORD, _
                                                                                             BYREF Buffer AS ANY, _
                                                                                             BYVAL SIZE AS DWORD, _
                                                                                             BYREF SizeNeeded AS DWORD) AS LONG
    MACRO SetupEnumInfSections(InfHandle, Index, Buffer, SIZE, SizeNeeded) = SetupEnumInfSectionsW(InfHandle, Index, Buffer, SIZE, SizeNeeded)
    
    DECLARE FUNCTION SetupVerifyInfFileW LIB "SETUPAPI.DLL" ALIAS "SetupVerifyInfFileW" (BYREF InfName AS ANY, _
                                                                                         BYREF AltPlatformInfo AS SP_ALTPLATFORM_INFO, _
                                                                                         BYREF InfSignerInfo AS SP_INF_SIGNER_INFO_W) AS LONG
    MACRO SetupVerifyInfFile(InfName, AltPlatformInfo, InfSignerInfo) = SetupVerifyInfFileW(InfName, AltPlatformInfo, InfSignerInfo)
    
    DECLARE FUNCTION SetupDiGetCustomDevicePropertyW LIB "SETUPAPI.DLL" ALIAS "SetupDiGetCustomDevicePropertyW" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                 BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                                 BYREF CustomPropertyName AS ANY, _
                                                                                                                 BYVAL Flags AS DWORD, _
                                                                                                                 BYREF PropertyRegDataType AS DWORD, _
                                                                                                                 BYREF PropertyBuffer AS ANY, _
                                                                                                                 BYVAL PropertyBufferSize AS DWORD, _
                                                                                                                 BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetCustomDeviceProperty(DeviceInfoSet, DeviceInfoData, CustomPropertyName, Flags, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize) = _
    SetupDiGetCustomDevicePropertyW(DeviceInfoSet, DeviceInfoData, CustomPropertyName, Flags, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupConfigureWmiFromInfSectionW LIB "SETUPAPI.DLL" ALIAS "SetupConfigureWmiFromInfSectionW" (BYVAL InfHandle AS HINF, _
                                                                                                                   BYREF SectionName AS ANY, _
                                                                                                                   BYVAL Flags AS DWORD) AS LONG
    MACRO SetupConfigureWmiFromInfSection(InfHandle, SectionName, Flags) = SetupConfigureWmiFromInfSectionW(InfHandle, SectionName, Flags)
    
    
    #ELSE ' ANSI specific function declarations...
    
    
    DECLARE FUNCTION SetupGetInfInformationA LIB "SETUPAPI.DLL" ALIAS "SetupGetInfInformationA" (BYREF InfSpec AS ANY, _
                                                                                                 BYVAL SearchControl AS DWORD, _
                                                                                                 BYREF ReturnBuffer AS SP_INF_INFORMATION, _
                                                                                                 BYVAL ReturnBufferSize AS DWORD, _
                                                                                                 BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetInfInformation(InfSpec, SearchControl, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetInfInformationA(InfSpec, SearchControl, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupQueryInfFileInformationA LIB "SETUPAPI.DLL" ALIAS "SetupQueryInfFileInformationA" (BYREF InfInformation AS SP_INF_INFORMATION, _
                                                                                                             BYVAL InfIndex AS DWORD, _
                                                                                                             BYREF ReturnBuffer AS ASCIIZ, _
                                                                                                             BYVAL ReturnBufferSize AS DWORD, _
                                                                                                             BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupQueryInfFileInformation(InfInformation, InfIndex, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupQueryInfFileInformationA(InfInformation, InfIndex, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupQueryInfOriginalFileInformationA LIB "SETUPAPI.DLL" ALIAS "SetupQueryInfOriginalFileInformationA" (BYREF InfInformation AS SP_INF_INFORMATION, _
                                                                                                                             BYVAL InfIndex AS DWORD, _
                                                                                                                             BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO, _
                                                                                                                             BYREF OriginalFileInfo AS SP_ORIGINAL_FILE_INFO_A) AS LONG
    MACRO SetupQueryInfOriginalFileInformation(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo) = SetupQueryInfOriginalFileInformationA(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)
    
    DECLARE FUNCTION SetupQueryInfVersionInformationA LIB "SETUPAPI.DLL" ALIAS "SetupQueryInfVersionInformationA" (BYREF InfInformation AS SP_INF_INFORMATION, _
                                                                                                                   BYVAL InfIndex AS DWORD, _
                                                                                                                   BYREF Key AS ASCIIZ, _
                                                                                                                   BYREF ReturnBuffer AS ASCIIZ, _
                                                                                                                   BYVAL ReturnBufferSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupQueryInfVersionInformation(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupQueryInfVersionInformationA(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetInfFileListA LIB "SETUPAPI.DLL" ALIAS "SetupGetInfFileListA" (BYREF DirectoryPath AS ASCIIZ, _
                                                                                           BYVAL InfStyle AS DWORD, _
                                                                                           BYREF ReturnBuffer AS ASCIIZ, _
                                                                                           BYVAL ReturnBufferSize AS DWORD, _
                                                                                           BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetInfFileList(DirectoryPath, InfStyle, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetInfFileListA(DirectoryPath, InfStyle, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupOpenInfFileA LIB "SETUPAPI.DLL" ALIAS "SetupOpenInfFileA" (BYREF FileName AS ASCIIZ, _
                                                                                     BYREF InfClass AS ASCIIZ, _
                                                                                     BYVAL InfStyle AS DWORD, _
                                                                                     BYREF ErrorLine AS DWORD) AS HINF
    MACRO SetupOpenInfFile(FileName, InfClass, InfStyle, ErrorLine) = SetupOpenInfFileA(FileName, InfClass, InfStyle, ErrorLine)
    
    DECLARE FUNCTION SetupOpenAppendInfFileA LIB "SETUPAPI.DLL" ALIAS "SetupOpenAppendInfFileA" (BYREF FileName AS ASCIIZ, _
                                                                                                 BYVAL InfHandle AS HINF, _
                                                                                                 BYREF ErrorLine AS DWORD) AS LONG
    MACRO SetupOpenAppendInfFile(FileName, InfHandle, ErrorLine) = SetupOpenAppendInfFileA(FileName, InfHandle, ErrorLine)
    
    DECLARE FUNCTION SetupFindFirstLineA LIB "SETUPAPI.DLL" ALIAS "SetupFindFirstLineA" (BYVAL InfHandle AS HINF, _
                                                                                         BYREF Section AS ASCIIZ, _
                                                                                         BYREF Key AS ASCIIZ, _
                                                                                         BYREF inContext AS INFCONTEXT) AS LONG
    MACRO SetupFindFirstLine(InfHandle, Section, Key, inContext) = SetupFindFirstLineA(InfHandle, Section, Key, inContext)
    
    DECLARE FUNCTION SetupFindNextMatchLineA LIB "SETUPAPI.DLL" ALIAS "SetupFindNextMatchLineA" (BYREF ContextIn AS INFCONTEXT, _
                                                                                                 BYREF Key AS ASCIIZ, _
                                                                                                 BYREF ContextOut AS INFCONTEXT) AS LONG
    MACRO SetupFindNextMatchLine(ContextIn, Key, ContextOut) = SetupFindNextMatchLineA(ContextIn, Key, ContextOut)
    
    DECLARE FUNCTION SetupGetLineByIndexA LIB "SETUPAPI.DLL" ALIAS "SetupGetLineByIndexA" (BYVAL InfHandle AS HINF, _
                                                                                           BYREF Section AS ASCIIZ, _
                                                                                           BYVAL Index AS DWORD, _
                                                                                           BYREF inContext AS INFCONTEXT) AS LONG
    MACRO SetupGetLineByIndex(InfHandle, Section, Index, inContext) = SetupGetLineByIndexA(InfHandle, Section, Index, inContext)
    
    DECLARE FUNCTION SetupGetLineCountA LIB "SETUPAPI.DLL" ALIAS "SetupGetLineCountA" (BYVAL InfHandle AS HINF, _
                                                                                       BYREF Section AS ASCIIZ) AS LONG
    MACRO SetupGetLineCount(InfHandle, Section) = SetupGetLineCountA(InfHandle, Section)
    
    DECLARE FUNCTION SetupGetLineTextA LIB "SETUPAPI.DLL" ALIAS "SetupGetLineTextA" (BYREF inContext AS INFCONTEXT, _
                                                                                     BYVAL InfHandle AS HINF, _
                                                                                     BYREF Section AS ASCIIZ, _
                                                                                     BYREF Key AS ASCIIZ, _
                                                                                     BYREF ReturnBuffer AS ASCIIZ, _
                                                                                     BYVAL ReturnBufferSize AS DWORD, _
                                                                                     BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetLineText(inContext, InfHandle, Section, Key, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetLineTextA(inContext, InfHandle, Section, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetStringFieldA LIB "SETUPAPI.DLL" ALIAS "SetupGetStringFieldA" (BYREF inContext AS INFCONTEXT, _
                                                                                           BYVAL FieldIndex AS DWORD, _
                                                                                           BYREF ReturnBuffer AS ASCIIZ, _
                                                                                           BYVAL ReturnBufferSize AS DWORD, _
                                                                                           BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetStringField(inContext, FieldIndex, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetStringFieldA(inContext, FieldIndex, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetMultiSzFieldA LIB "SETUPAPI.DLL" ALIAS "SetupGetMultiSzFieldA" (BYREF inContext AS INFCONTEXT, _
                                                                                             BYVAL FieldIndex AS DWORD, _
                                                                                             BYREF ReturnBuffer AS ASCIIZ, _
                                                                                             BYVAL ReturnBufferSize AS DWORD, _
                                                                                             BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetMultiSzField(inContext, FieldIndex, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetMultiSzFieldA(inContext, FieldIndex, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetFileCompressionInfoA LIB "SETUPAPI.DLL" ALIAS "SetupGetFileCompressionInfoA" (BYREF SourceFileName AS ASCIIZ, _
                                                                                                           BYREF ActualSourceFileName AS ASCIIZ, _
                                                                                                           BYREF SourceFileSize AS DWORD, _
                                                                                                           BYREF TargetFileSize AS DWORD, _
                                                                                                           BYREF CompressionType AS DWORD) AS DWORD
    MACRO SetupGetFileCompressionInfo(SourceFileName, ActualSourceFileName, SourceFileSize, TargetFileSize, CompressionType) = SetupGetFileCompressionInfoA(SourceFileName, ActualSourceFileName, SourceFileSize, TargetFileSize, CompressionType)
    
    DECLARE FUNCTION SetupGetFileCompressionInfoExA LIB "SETUPAPI.DLL" ALIAS "SetupGetFileCompressionInfoExA" (BYREF SourceFileName AS ASCIIZ, _
                                                                                                               BYREF ActualSourceFileNameBuffer AS ASCIIZ, _
                                                                                                               BYVAL ActualSourceFileNameBufferLen AS DWORD, _
                                                                                                               BYREF RequiredBufferLen AS DWORD, _
                                                                                                               BYREF SourceFileSize AS DWORD, _
                                                                                                               BYREF TargetFileSize AS DWORD, _
                                                                                                               BYREF CompressionType AS DWORD) AS LONG
    MACRO SetupGetFileCompressionInfoEx(SourceFileName, ActualSourceFileNameBuffer, ActualSourceFileNameBufferLen, RequiredBufferLen, SourceFileSize, TargetFileSize, CompressionType) = _
    SetupGetFileCompressionInfoExA(SourceFileName, ActualSourceFileNameBuffer, ActualSourceFileNameBufferLen, RequiredBufferLen, SourceFileSize, TargetFileSize, CompressionType)
    
    DECLARE FUNCTION SetupDecompressOrCopyFileA LIB "SETUPAPI.DLL" ALIAS "SetupDecompressOrCopyFileA" (BYREF SourceFileName AS ASCIIZ, _
                                                                                                       BYREF TargetFileName AS ASCIIZ, _
                                                                                                       BYREF CompressionType AS DWORD) AS DWORD
    MACRO SetupDecompressOrCopyFile(SourceFileName, TargetFileName, CompressionType) = SetupDecompressOrCopyFileA(SourceFileName, TargetFileName, CompressionType)
    
    DECLARE FUNCTION SetupGetSourceFileLocationA LIB "SETUPAPI.DLL" ALIAS "SetupGetSourceFileLocationA" (BYVAL InfHandle AS HINF, _
                                                                                                         BYREF inContext AS INFCONTEXT, _
                                                                                                         BYREF FileName AS ASCIIZ, _
                                                                                                         BYREF SourceId AS DWORD, _
                                                                                                         BYREF ReturnBuffer AS ASCIIZ, _
                                                                                                         BYVAL ReturnBufferSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetSourceFileLocation(InfHandle, inContext, FileName, SourceId, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetSourceFileLocationA(InfHandle, inContext, FileName, SourceId, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupGetSourceFileSizeA LIB "SETUPAPI.DLL" ALIAS "SetupGetSourceFileSizeA" (BYVAL InfHandle AS HINF, _
                                                                                                 BYREF inContext AS INFCONTEXT, _
                                                                                                 BYREF FileName AS ASCIIZ, _
                                                                                                 BYREF Section AS ASCIIZ, _
                                                                                                 BYREF FileSize AS DWORD, _
                                                                                                 BYVAL RoundingFactor AS DWORD) AS LONG
    MACRO SetupGetSourceFileSize(InfHandle, inContext, FileName, Section, FileSize, RoundingFactor) = SetupGetSourceFileSizeA(InfHandle, inContext, FileName, Section, FileSize, RoundingFactor)
    
    DECLARE FUNCTION SetupGetTargetPathA LIB "SETUPAPI.DLL" ALIAS "SetupGetTargetPathA" (BYVAL InfHandle AS HINF, _
                                                                                         BYREF inContext AS INFCONTEXT, _
                                                                                         BYREF Section AS ASCIIZ, _
                                                                                         BYREF ReturnBuffer AS ASCIIZ, _
                                                                                         BYVAL ReturnBufferSize AS DWORD, _
                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetTargetPath(InfHandle, inContext, Section, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetTargetPathA(InfHandle, inContext, Section, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupSetSourceListA LIB "SETUPAPI.DLL" ALIAS "SetupSetSourceListA" (BYVAL Flags AS DWORD, _
                                                                                         BYREF SourceList AS ASCIIZ, _
                                                                                         BYVAL SourceCount AS DWORD) AS LONG
    MACRO SetupSetSourceList(Flags, SourceList, SourceCount) = SetupSetSourceListA(Flags, SourceList, SourceCount)
    
    DECLARE FUNCTION SetupAddToSourceListA LIB "SETUPAPI.DLL" ALIAS "SetupAddToSourceListA" (BYVAL Flags AS DWORD, _
                                                                                             BYREF Source AS ASCIIZ) AS LONG
    MACRO SetupAddToSourceList(Flags, Source) = SetupAddToSourceListA(Flags, Source)
    
    DECLARE FUNCTION SetupRemoveFromSourceListA LIB "SETUPAPI.DLL" ALIAS "SetupRemoveFromSourceListA" (BYVAL Flags AS DWORD, _
                                                                                                       BYREF Source AS ASCIIZ) AS LONG
    MACRO SetupRemoveFromSourceList(Flags, Source) = SetupRemoveFromSourceListA(Flags, Source)
    
    DECLARE FUNCTION SetupQuerySourceListA LIB "SETUPAPI.DLL" ALIAS "SetupQuerySourceListA" (BYVAL Flags AS DWORD, _
                                                                                             BYREF List AS ASCIIZ, _
                                                                                             BYREF Count AS DWORD) AS LONG
    MACRO SetupQuerySourceList(Flags, List, Count) = SetupQuerySourceListA(Flags, List, Count)
    
    DECLARE FUNCTION SetupFreeSourceListA LIB "SETUPAPI.DLL" ALIAS "SetupFreeSourceListA" (BYREF List AS ANY, _
                                                                                           BYVAL Count AS DWORD) AS LONG
    MACRO SetupFreeSourceList(List, Count) = SetupFreeSourceListA(List, Count)
    
    DECLARE FUNCTION SetupPromptForDiskA LIB "SETUPAPI.DLL" ALIAS "SetupPromptForDiskA" (BYVAL hwndParent AS DWORD, _
                                                                                         BYREF DialogTitle AS ASCIIZ, _
                                                                                         BYREF DiskName AS ASCIIZ, _
                                                                                         BYREF PathToSource AS ASCIIZ, _
                                                                                         BYREF FileSought AS ASCIIZ, _
                                                                                         BYREF TagFile AS ASCIIZ, _
                                                                                         BYVAL DiskPromptStyle AS DWORD, _
                                                                                         BYREF PathBuffer AS ASCIIZ, _
                                                                                         BYVAL PathBufferSize AS DWORD, _
                                                                                         BYREF PathRequiredSize AS DWORD) AS DWORD
    MACRO SetupPromptForDisk(hwndParent, DialogTitle, DiskName, PathToSource, FileSought, TagFile, DiskPromptStyle, PathBuffer, PathBufferSize, PathRequiredSize) = _
    SetupPromptForDiskA(hwndParent, DialogTitle, DiskName, PathToSource, FileSought, TagFile, DiskPromptStyle, PathBuffer, PathBufferSize, PathRequiredSize)
    
    DECLARE FUNCTION SetupCopyErrorA LIB "SETUPAPI.DLL" ALIAS "SetupCopyErrorA" (BYVAL hwndParent AS DWORD, _
                                                                                 BYREF DialogTitle AS ASCIIZ, _
                                                                                 BYREF DiskName AS ASCIIZ, _
                                                                                 BYREF PathToSource AS ASCIIZ, _
                                                                                 BYREF SourceFile AS ASCIIZ, _
                                                                                 BYREF TargetPathFile AS ASCIIZ, _
                                                                                 BYVAL Win32ErrorCode AS DWORD, _
                                                                                 BYVAL STYLE AS DWORD, _
                                                                                 BYREF PathBuffer AS ASCIIZ, _
                                                                                 BYVAL PathBufferSize AS DWORD, _
                                                                                 BYREF PathRequiredSize AS DWORD) AS DWORD
    MACRO SetupCopyError(hwndParent, DialogTitle, DiskName, PathToSource, SourceFile, TargetPathFile, Win32ErrorCode, STYLE, PathBuffer, PathBufferSize, PathRequiredSize) = _
    SetupCopyErrorA(hwndParent, DialogTitle, DiskName, PathToSource, SourceFile, TargetPathFile, Win32ErrorCode, STYLE, PathBuffer, PathBufferSize, PathRequiredSize)
    
    DECLARE FUNCTION SetupRenameErrorA LIB "SETUPAPI.DLL" ALIAS "SetupRenameErrorA" (BYVAL hwndParent AS DWORD, _
                                                                                     BYREF DialogTitle AS ASCIIZ, _
                                                                                     BYREF SourceFile AS ASCIIZ, _
                                                                                     BYREF TargetFile AS ASCIIZ, _
                                                                                     BYVAL Win32ErrorCode AS DWORD, _
                                                                                     BYVAL STYLE AS DWORD) AS DWORD
    MACRO SetupRenameError(hwndParent, DialogTitle, SourceFile, TargetFile, Win32ErrorCode, STYLE) = SetupRenameErrorA(hwndParent, DialogTitle, SourceFile, TargetFile, Win32ErrorCode, STYLE)
    
    DECLARE FUNCTION SetupDeleteErrorA LIB "SETUPAPI.DLL" ALIAS "SetupDeleteErrorA" (BYVAL hwndParent AS DWORD, _
                                                                                     BYREF DialogTitle AS ASCIIZ, _
                                                                                     BYREF File AS ASCIIZ, _
                                                                                     BYVAL Win32ErrorCode AS DWORD, _
                                                                                     BYVAL STYLE AS DWORD) AS DWORD
    MACRO SetupDeleteError(hwndParent, DialogTitle, File, Win32ErrorCode, STYLE) = SetupDeleteErrorA(hwndParent, DialogTitle, File, Win32ErrorCode, STYLE)
    
    DECLARE FUNCTION SetupBackupErrorA LIB "SETUPAPI.DLL" ALIAS "SetupBackupErrorA" (BYVAL hwndParent AS DWORD, _
                                                                                     BYREF DialogTitle AS ASCIIZ, _
                                                                                     BYREF SourceFile AS ASCIIZ, _
                                                                                     BYREF TargetFile AS ASCIIZ, _
                                                                                     BYVAL Win32ErrorCode AS DWORD, _
                                                                                     BYVAL STYLE AS DWORD) AS DWORD
    MACRO SetupBackupError(hwndParent, DialogTitle, SourceFile, TargetFile, Win32ErrorCode, STYLE) = SetupBackupErrorA(hwndParent, DialogTitle, SourceFile, TargetFile, Win32ErrorCode, STYLE)
    
    DECLARE FUNCTION SetupSetDirectoryIdA LIB "SETUPAPI.DLL" ALIAS "SetupSetDirectoryIdA" (BYVAL InfHandle AS HINF, _
                                                                                           BYVAL Id AS DWORD, _
                                                                                           BYREF Directory AS ASCIIZ) AS LONG
    MACRO SetupSetDirectoryId(InfHandle, Id, Directory) = SetupSetDirectoryIdA(InfHandle, Id, Directory)
    
    DECLARE FUNCTION SetupSetDirectoryIdExA LIB "SETUPAPI.DLL" ALIAS "SetupSetDirectoryIdExA" (BYVAL InfHandle AS HINF, _
                                                                                               BYVAL Id AS DWORD, _
                                                                                               BYREF Directory AS ASCIIZ, _
                                                                                               BYVAL Flags AS DWORD, _
                                                                                               BYVAL Reserved1 AS DWORD, _
                                                                                               BYREF Reserved2 AS ANY) AS LONG
    MACRO SetupSetDirectoryIdEx(InfHandle, Id, Directory, Flags, Reserved1, Reserved2) = SetupSetDirectoryIdExA(InfHandle, Id, Directory, Flags, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupGetSourceInfoA LIB "SETUPAPI.DLL" ALIAS "SetupGetSourceInfoA" (BYVAL InfHandle AS HINF, _
                                                                                         BYVAL SourceId AS DWORD, _
                                                                                         BYVAL InfoDesired AS DWORD, _
                                                                                         BYREF ReturnBuffer AS ASCIIZ, _
                                                                                         BYVAL ReturnBufferSize AS DWORD, _
                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupGetSourceInfo(InfHandle, SourceId, InfoDesired, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupGetSourceInfoA(InfHandle, SourceId, InfoDesired, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupInstallFileA LIB "SETUPAPI.DLL" ALIAS "SetupInstallFileA" (BYVAL InfHandle AS HINF, _
                                                                                     BYREF inContext AS INFCONTEXT, _
                                                                                     BYREF SourceFile AS ASCIIZ, _
                                                                                     BYREF SourcePathRoot AS ASCIIZ, _
                                                                                     BYREF DestinationName AS ASCIIZ, _
                                                                                     BYVAL CopyStyle AS DWORD, _
                                                                                     BYVAL CopyMsgHandler AS DWORD, _
                                                                                     BYREF inContext AS ANY) AS LONG
    MACRO SetupInstallFile(InfHandle, inContext, SourceFile, SourcePathRoot, DestinationName, CopyStyle, CopyMsgHandler, inContext) = SetupInstallFileA(InfHandle, inContext, SourceFile, SourcePathRoot, DestinationName, CopyStyle, CopyMsgHandler, inContext)
    
    DECLARE FUNCTION SetupInstallFileExA LIB "SETUPAPI.DLL" ALIAS "SetupInstallFileExA" (BYVAL InfHandle AS HINF, _
                                                                                         BYREF inContext AS INFCONTEXT, _
                                                                                         BYREF SourceFile AS ASCIIZ, _
                                                                                         BYREF SourcePathRoot AS ASCIIZ, _
                                                                                         BYREF DestinationName AS ASCIIZ, _
                                                                                         BYVAL CopyStyle AS DWORD, _
                                                                                         BYVAL CopyMsgHandler AS DWORD, _
                                                                                         BYREF inContext AS ANY, _
                                                                                         BYREF FileWasInUse AS LONG) AS LONG
    MACRO SetupInstallFileEx(InfHandle, inContext, SourceFile, SourcePathRoot, DestinationName, CopyStyle, CopyMsgHandler, inContext, FileWasInUse) = _
    SetupInstallFileExA(InfHandle, inContext, SourceFile, SourcePathRoot, DestinationName, CopyStyle, CopyMsgHandler, inContext, FileWasInUse)
    
    DECLARE FUNCTION SetupSetFileQueueAlternatePlatformA LIB "SETUPAPI.DLL" ALIAS "SetupSetFileQueueAlternatePlatformA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                                         BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO, _
                                                                                                                         BYREF AlternateDefaultCatalogFile AS ASCIIZ) AS LONG
    MACRO SetupSetFileQueueAlternatePlatform(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile) = SetupSetFileQueueAlternatePlatformA(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile)
    
    DECLARE FUNCTION SetupSetPlatformPathOverrideA LIB "SETUPAPI.DLL" ALIAS "SetupSetPlatformPathOverrideA" (BYREF Override AS ASCIIZ) AS LONG
    MACRO SetupSetPlatformPathOverride(Override) = SetupSetPlatformPathOverrideA(Override)
    
    DECLARE FUNCTION SetupQueueCopyA LIB "SETUPAPI.DLL" ALIAS "SetupQueueCopyA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                 BYREF SourceRootPath AS ASCIIZ, _
                                                                                 BYREF SourcePath AS ASCIIZ, _
                                                                                 BYREF SourceFilename AS ASCIIZ, _
                                                                                 BYREF SourceDescription AS ASCIIZ, _
                                                                                 BYREF SourceTagfile AS ASCIIZ, _
                                                                                 BYREF TargetDirectory AS ASCIIZ, _
                                                                                 BYREF TargetFilename AS ASCIIZ, _
                                                                                 BYVAL CopyStyle AS DWORD) AS LONG
    MACRO SetupQueueCopy(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle) = _
    SetupQueueCopyA(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle)
    
    DECLARE FUNCTION SetupQueueCopyIndirectA LIB "SETUPAPI.DLL" ALIAS "SetupQueueCopyIndirectA" (BYREF CopyParams AS SP_FILE_COPY_PARAMS_A) AS LONG
    MACRO SetupQueueCopyIndirect(CopyParams) = SetupQueueCopyIndirectA(CopyParams)
    
    DECLARE FUNCTION SetupQueueDefaultCopyA LIB "SETUPAPI.DLL" ALIAS "SetupQueueDefaultCopyA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                               BYVAL InfHandle AS HINF, _
                                                                                               BYREF SourceRootPath AS ASCIIZ, _
                                                                                               BYREF SourceFilename AS ASCIIZ, _
                                                                                               BYREF TargetFilename AS ASCIIZ, _
                                                                                               BYVAL CopyStyle AS DWORD) AS LONG
    MACRO SetupQueueDefaultCopy(QueueHandle, InfHandle, SourceRootPath, SourceFilename, TargetFilename, CopyStyle) = SetupQueueDefaultCopyA(QueueHandle, InfHandle, SourceRootPath, SourceFilename, TargetFilename, CopyStyle)
    
    DECLARE FUNCTION SetupQueueCopySectionA LIB "SETUPAPI.DLL" ALIAS "SetupQueueCopySectionA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                               BYREF SourceRootPath AS ASCIIZ, _
                                                                                               BYVAL InfHandle AS HINF, _
                                                                                               BYVAL ListInfHandle AS HINF, _
                                                                                               BYREF Section AS ASCIIZ, _
                                                                                               BYVAL CopyStyle AS DWORD) AS LONG
    MACRO SetupQueueCopySection(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle) = SetupQueueCopySectionA(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle)
    
    DECLARE FUNCTION SetupQueueDeleteA LIB "SETUPAPI.DLL" ALIAS "SetupQueueDeleteA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                     BYREF PathPart1 AS ASCIIZ, _
                                                                                     BYREF PathPart2 AS ASCIIZ) AS LONG
    MACRO SetupQueueDelete(QueueHandle, PathPart1, PathPart2) = SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2)
    
    DECLARE FUNCTION SetupQueueDeleteSectionA LIB "SETUPAPI.DLL" ALIAS "SetupQueueDeleteSectionA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                   BYVAL InfHandle AS HINF, _
                                                                                                   BYVAL ListInfHandle AS HINF, _
                                                                                                   BYREF Section AS ASCIIZ) AS LONG
    MACRO SetupQueueDeleteSection(QueueHandle, InfHandle, ListInfHandle, Section) = SetupQueueDeleteSectionA(QueueHandle, InfHandle, ListInfHandle, Section)
    
    DECLARE FUNCTION SetupQueueRenameA LIB "SETUPAPI.DLL" ALIAS "SetupQueueRenameA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                     BYREF SourcePath AS ASCIIZ, _
                                                                                     BYREF SourceFilename AS ASCIIZ, _
                                                                                     BYREF TargetPath AS ASCIIZ, _
                                                                                     BYREF TargetFilename AS ASCIIZ) AS LONG
    MACRO SetupQueueRename(QueueHandle, SourcePath, SourceFilename, TargetPath, TargetFilename) = SetupQueueRenameA(QueueHandle, SourcePath, SourceFilename, TargetPath, TargetFilename)
    
    DECLARE FUNCTION SetupQueueRenameSectionA LIB "SETUPAPI.DLL" ALIAS "SetupQueueRenameSectionA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                   BYVAL InfHandle AS HINF, _
                                                                                                   BYVAL ListInfHandle AS HINF, _
                                                                                                   BYREF Section AS ASCIIZ) AS LONG
    MACRO SetupQueueRenameSection(QueueHandle, InfHandle, ListInfHandle, Section) = SetupQueueRenameSectionA(QueueHandle, InfHandle, ListInfHandle, Section)
    
    DECLARE FUNCTION SetupCommitFileQueueA LIB "SETUPAPI.DLL" ALIAS "SetupCommitFileQueueA" (BYVAL Owner AS DWORD, _
                                                                                             BYVAL QueueHandle AS HSPFILEQ, _
                                                                                             BYVAL MsgHandler AS DWORD, _
                                                                                             BYREF inContext AS ANY) AS LONG
    MACRO SetupCommitFileQueue(Owner, QueueHandle, MsgHandler, inContext) = SetupCommitFileQueueA(Owner, QueueHandle, MsgHandler, inContext)
    
    DECLARE FUNCTION SetupScanFileQueueA LIB "SETUPAPI.DLL" ALIAS "SetupScanFileQueueA" (BYVAL FileQueue AS HSPFILEQ, _
                                                                                         BYVAL Flags AS DWORD, _
                                                                                         BYVAL WINDOW AS DWORD, _
                                                                                         BYVAL CallbackRoutine AS DWORD, _
                                                                                         BYREF CallbackContext AS ANY, _
                                                                                         BYREF Result AS DWORD) AS LONG
    MACRO SetupScanFileQueue(FileQueue, Flags, WINDOW, CallbackRoutine, CallbackContext, Result) = SetupScanFileQueueA(FileQueue, Flags, WINDOW, CallbackRoutine, CallbackContext, Result)
    
    DECLARE FUNCTION SetupCopyOEMInfA LIB "SETUPAPI.DLL" ALIAS "SetupCopyOEMInfA" (BYREF SourceInfFileName AS ASCIIZ, _
                                                                                   BYREF OEMSourceMediaLocation AS ASCIIZ, _
                                                                                   BYVAL OEMSourceMediaType AS DWORD, _
                                                                                   BYVAL CopyStyle AS DWORD, _
                                                                                   BYREF DestinationInfFileName AS ASCIIZ, _
                                                                                   BYVAL DestinationInfFileNameSize AS DWORD, _
                                                                                   BYREF RequiredSize AS DWORD, _
                                                                                   BYREF DestinationInfFileNameComponent AS ASCIIZ) AS LONG
    MACRO SetupCopyOEMInf(SourceInfFileName, OEMSourceMediaLocation, OEMSourceMediaType, CopyStyle, DestinationInfFileName, DestinationInfFileNameSize, RequiredSize, DestinationInfFileNameComponent) = _
    SetupCopyOEMInfA(SourceInfFileName, OEMSourceMediaLocation, OEMSourceMediaType, CopyStyle, DestinationInfFileName, DestinationInfFileNameSize, RequiredSize, DestinationInfFileNameComponent)
    
    DECLARE FUNCTION SetupUninstallOEMInfA LIB "SETUPAPI.DLL" ALIAS "SetupUninstallOEMInfA" (BYREF InfFileName AS ASCIIZ, _
                                                                                             BYVAL Flags AS DWORD, _
                                                                                             BYREF Reserved AS ANY) AS LONG
    MACRO SetupUninstallOEMInf(InfFileName, Flags, Reserved) = SetupUninstallOEMInfA(InfFileName, Flags, Reserved)
    
    DECLARE FUNCTION SetupCreateDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupCreateDiskSpaceListA" (BYREF Reserved1 AS ANY, _
                                                                                                     BYVAL Reserved2 AS DWORD, _
                                                                                                     BYVAL Flags AS DWORD) AS HDSKSPC
    MACRO SetupCreateDiskSpaceList(Reserved1, Reserved2, Flags) = SetupCreateDiskSpaceListA(Reserved1, Reserved2, Flags)
    
    DECLARE FUNCTION SetupDuplicateDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupDuplicateDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                           BYREF Reserved1 AS ANY, _
                                                                                                           BYVAL Reserved2 AS DWORD, _
                                                                                                           BYVAL Flags AS DWORD) AS HDSKSPC
    MACRO SetupDuplicateDiskSpaceList(DiskSpace, Reserved1, Reserved2, Flags) = SetupDuplicateDiskSpaceListA(DiskSpace, Reserved1, Reserved2, Flags)
    
    DECLARE FUNCTION SetupQueryDrivesInDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupQueryDrivesInDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                   BYREF ReturnBuffer AS ASCIIZ, _
                                                                                                                   BYVAL ReturnBufferSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupQueryDrivesInDiskSpaceList(DiskSpace, ReturnBuffer, ReturnBufferSize, RequiredSize) = SetupQueryDrivesInDiskSpaceListA(DiskSpace, ReturnBuffer, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupQuerySpaceRequiredOnDriveA LIB "SETUPAPI.DLL" ALIAS "SetupQuerySpaceRequiredOnDriveA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                 BYREF DriveSpec AS ASCIIZ, _
                                                                                                                 BYREF SpaceRequired AS QUAD, _
                                                                                                                 BYREF Reserved1 AS ANY, _
                                                                                                                 BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupQuerySpaceRequiredOnDrive(DiskSpace, DriveSpec, SpaceRequired, Reserved1, Reserved2) = SetupQuerySpaceRequiredOnDriveA(DiskSpace, DriveSpec, SpaceRequired, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupAdjustDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupAdjustDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                     BYREF DriveRoot AS ASCIIZ, _
                                                                                                     BYVAL Amount AS QUAD, _
                                                                                                     BYREF Reserved1 AS ANY, _
                                                                                                     BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupAdjustDiskSpaceList(DiskSpace, DriveRoot, Amount, Reserved1, Reserved2) = SetupAdjustDiskSpaceListA(DiskSpace, DriveRoot, Amount, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupAddToDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupAddToDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                   BYREF TargetFilespec AS ASCIIZ, _
                                                                                                   BYVAL FileSize AS QUAD, _
                                                                                                   BYVAL Operation AS DWORD, _
                                                                                                   BYREF Reserved1 AS ANY, _
                                                                                                   BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupAddToDiskSpaceList(DiskSpace, TargetFilespec, FileSize, Operation, Reserved1, Reserved2) = SetupAddToDiskSpaceListA(DiskSpace, TargetFilespec, FileSize, Operation, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupAddSectionToDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupAddSectionToDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                 BYVAL InfHandle AS HINF, _
                                                                                                                 BYVAL ListInfHandle AS HINF, _
                                                                                                                 BYREF SectionName AS ASCIIZ, _
                                                                                                                 BYVAL Operation AS DWORD, _
                                                                                                                 BYREF Reserved1 AS ANY, _
                                                                                                                 BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupAddSectionToDiskSpaceList(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2) = SetupAddSectionToDiskSpaceListA(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupAddInstallSectionToDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupAddInstallSectionToDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                               BYVAL InfHandle AS HINF, _
                                                                                                                               BYVAL LayoutInfHandle AS HINF, _
                                                                                                                               BYREF SectionName AS ASCIIZ, _
                                                                                                                               BYREF Reserved1 AS ANY, _
                                                                                                                               BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupAddInstallSectionToDiskSpaceList(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2) = SetupAddInstallSectionToDiskSpaceListA(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupRemoveFromDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupRemoveFromDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                             BYREF TargetFilespec AS ASCIIZ, _
                                                                                                             BYVAL Operation AS DWORD, _
                                                                                                             BYREF Reserved1 AS ANY, _
                                                                                                             BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupRemoveFromDiskSpaceList(DiskSpace, TargetFilespec, Operation, Reserved1, Reserved2) = SetupRemoveFromDiskSpaceListA(DiskSpace, TargetFilespec, Operation, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupRemoveSectionFromDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupRemoveSectionFromDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                           BYVAL InfHandle AS HINF, _
                                                                                                                           BYVAL ListInfHandle AS HINF, _
                                                                                                                           BYREF SectionName AS ASCIIZ, _
                                                                                                                           BYVAL Operation AS DWORD, _
                                                                                                                           BYREF Reserved1 AS ANY, _
                                                                                                                           BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupRemoveSectionFromDiskSpaceList(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2) = SetupRemoveSectionFromDiskSpaceListA(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupRemoveInstallSectionFromDiskSpaceListA LIB "SETUPAPI.DLL" ALIAS "SetupRemoveInstallSectionFromDiskSpaceListA" (BYVAL DiskSpace AS HDSKSPC, _
                                                                                                                                         BYVAL InfHandle AS HINF, _
                                                                                                                                         BYVAL LayoutInfHandle AS HINF, _
                                                                                                                                         BYREF SectionName AS ASCIIZ, _
                                                                                                                                         BYREF Reserved1 AS ANY, _
                                                                                                                                         BYVAL Reserved2 AS DWORD) AS LONG
    MACRO SetupRemoveInstallSectionFromDiskSpaceList(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2) = SetupRemoveInstallSectionFromDiskSpaceListA(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupIterateCabinetA LIB "SETUPAPI.DLL" ALIAS "SetupIterateCabinetA" (BYREF CabinetFile AS ASCIIZ, _
                                                                                           BYVAL Reserved AS DWORD, _
                                                                                           BYVAL MsgHandler AS DWORD, _
                                                                                           BYREF inContext AS ANY) AS LONG
    MACRO SetupIterateCabinet(CabinetFile, Reserved, MsgHandler, inContext) = SetupIterateCabinetA(CabinetFile, Reserved, MsgHandler, inContext)
    
    DECLARE FUNCTION SetupDefaultQueueCallbackA LIB "SETUPAPI.DLL" ALIAS "SetupDefaultQueueCallbackA" (BYREF inContext AS ANY, _
                                                                                                       BYVAL Notification AS DWORD, _
                                                                                                       BYREF Param1 AS DWORD, _
                                                                                                       BYREF Param2 AS DWORD) AS DWORD
    MACRO SetupDefaultQueueCallback(inContext, Notification, Param1, Param2) = SetupDefaultQueueCallbackA(inContext, Notification, Param1, Param2)
    
    DECLARE FUNCTION SetupInstallFromInfSectionA LIB "SETUPAPI.DLL" ALIAS "SetupInstallFromInfSectionA" (BYVAL Owner AS DWORD, _
                                                                                                         BYVAL InfHandle AS HINF, _
                                                                                                         BYREF SectionName AS ASCIIZ, _
                                                                                                         BYVAL Flags AS DWORD, _
                                                                                                         BYVAL RelativeKeyRoot AS DWORD, _
                                                                                                         BYREF SourceRootPath AS ASCIIZ, _
                                                                                                         BYVAL CopyFlags AS DWORD, _
                                                                                                         BYVAL MsgHandler AS DWORD, _
                                                                                                         BYREF inContext AS ANY, _
                                                                                                         BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF PSP_DEVINFO_DATA AS SP_DEVINFO_DATA) AS LONG
    MACRO SetupInstallFromInfSection(Owner, InfHandle, SectionName, Flags, RelativeKeyRoot, SourceRootPath, CopyFlags, MsgHandler, inContext, DeviceInfoSet, PSP_DEVINFO_DATA) = _
    SetupInstallFromInfSectionA(Owner, InfHandle, SectionName, Flags, RelativeKeyRoot, SourceRootPath, CopyFlags, MsgHandler, inContext, DeviceInfoSet, PSP_DEVINFO_DATA)
    
    DECLARE FUNCTION SetupInstallFilesFromInfSectionA LIB "SETUPAPI.DLL" ALIAS "SetupInstallFilesFromInfSectionA" (BYVAL InfHandle AS HINF, _
                                                                                                                   BYVAL LayoutInfHandle AS HINF, _
                                                                                                                   BYVAL FileQueue AS HSPFILEQ, _
                                                                                                                   BYREF SectionName AS ASCIIZ, _
                                                                                                                   BYREF SourceRootPath AS ASCIIZ, _
                                                                                                                   BYVAL CopyFlags AS DWORD) AS LONG
    MACRO SetupInstallFilesFromInfSection(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags) = SetupInstallFilesFromInfSectionA(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags)
    
    DECLARE FUNCTION SetupInstallServicesFromInfSectionA LIB "SETUPAPI.DLL" ALIAS "SetupInstallServicesFromInfSectionA" (BYVAL InfHandle AS HINF, _
                                                                                                                         BYREF SectionName AS ASCIIZ, _
                                                                                                                         BYVAL Flags AS DWORD) AS LONG
    MACRO SetupInstallServicesFromInfSection(InfHandle, SectionName, Flags) = SetupInstallServicesFromInfSectionA(InfHandle, SectionName, Flags)
    
    DECLARE FUNCTION SetupInstallServicesFromInfSectionExA LIB "SETUPAPI.DLL" ALIAS "SetupInstallServicesFromInfSectionExA" (BYVAL InfHandle AS HINF, _
                                                                                                                             BYREF SectionName AS ASCIIZ, _
                                                                                                                             BYVAL Flags AS DWORD, _
                                                                                                                             BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                                             BYREF Reserved1 AS ANY, _
                                                                                                                             BYREF Reserved2 AS ANY) AS LONG
    MACRO SetupInstallServicesFromInfSectionEx(InfHandle, SectionName, Flags, DeviceInfoSet, DeviceInfoData, Reserved1, Reserved2) = SetupInstallServicesFromInfSectionExA(InfHandle, SectionName, Flags, DeviceInfoSet, DeviceInfoData, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupLogFileA LIB "SETUPAPI.DLL" ALIAS "SetupLogFileA" (BYVAL FileLogHandle AS HSPFILELOG, _
                                                                             BYREF LogSectionName AS ASCIIZ, _
                                                                             BYREF SourceFilename AS ASCIIZ, _
                                                                             BYREF TargetFilename AS ASCIIZ, _
                                                                             BYVAL Checksum AS DWORD, _
                                                                             BYREF DiskTagfile AS ASCIIZ, _
                                                                             BYREF DiskDescription AS ASCIIZ, _
                                                                             BYREF OtherInfo AS ASCIIZ, _
                                                                             BYVAL Flags AS DWORD) AS LONG
    MACRO SetupLogFile(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags) = _
    SetupLogFileA(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags)
    
    DECLARE FUNCTION SetupRemoveFileLogEntryA LIB "SETUPAPI.DLL" ALIAS "SetupRemoveFileLogEntryA" (BYVAL FileLogHandle AS HSPFILELOG, _
                                                                                                   BYREF LogSectionName AS ASCIIZ, _
                                                                                                   BYREF TargetFilename AS ASCIIZ) AS LONG
    MACRO SetupRemoveFileLogEntry(FileLogHandle, LogSectionName, TargetFilename) = SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename)
    
    DECLARE FUNCTION SetupQueryFileLogA LIB "SETUPAPI.DLL" ALIAS "SetupQueryFileLogA" (BYVAL FileLogHandle AS HSPFILELOG, _
                                                                                       BYREF LogSectionName AS ASCIIZ, _
                                                                                       BYREF TargetFilename AS ASCIIZ, _
                                                                                       BYVAL DesiredInfo AS LONG, _
                                                                                       BYREF DataOut AS ASCIIZ, _
                                                                                       BYVAL ReturnBufferSize AS DWORD, _
                                                                                       BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupQueryFileLog(FileLogHandle, LogSectionName, TargetFilename, DesiredInfo, DataOut, ReturnBufferSize, RequiredSize) = SetupQueryFileLogA(FileLogHandle, LogSectionName, TargetFilename, DesiredInfo, DataOut, ReturnBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupLogErrorA LIB "SETUPAPI.DLL" ALIAS "SetupLogErrorA" (BYREF MessageString AS ASCIIZ, _
                                                                               BYVAL Severity AS LogSeverity) AS LONG
    MACRO SetupLogError(MessageString, Severity) = SetupLogErrorA(MessageString, Severity)
    
    DECLARE FUNCTION SetupGetBackupInformationA LIB "SETUPAPI.DLL" ALIAS "SetupGetBackupInformationA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                       BYREF BackupParams AS SP_BACKUP_QUEUE_PARAMS_A) AS LONG
    MACRO SetupGetBackupInformation(QueueHandle, BackupParams) = SetupGetBackupInformationA(QueueHandle, BackupParams)
    
    DECLARE FUNCTION SetupPrepareQueueForRestoreA LIB "SETUPAPI.DLL" ALIAS "SetupPrepareQueueForRestoreA" (BYVAL QueueHandle AS HSPFILEQ, _
                                                                                                           BYREF BackupPath AS ASCIIZ, _
                                                                                                           BYVAL RestoreFlags AS DWORD) AS LONG
    MACRO SetupPrepareQueueForRestore(QueueHandle, BackupPath, RestoreFlags) = SetupPrepareQueueForRestoreA(QueueHandle, BackupPath, RestoreFlags)
    
    DECLARE FUNCTION SetupDiCreateDeviceInfoListExA LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInfoListExA" (BYREF ClassGuid AS GUID, _
                                                                                                               BYVAL hwndParent AS DWORD, _
                                                                                                               BYREF MachineName AS ASCIIZ, _
                                                                                                               BYREF Reserved AS ANY) AS DWORD
    MACRO SetupDiCreateDeviceInfoListEx(ClassGuid, hwndParent, MachineName, Reserved) = SetupDiCreateDeviceInfoListExA(ClassGuid, hwndParent, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetDeviceInfoListDetailA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInfoListDetailA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                 BYREF DeviceInfoSetDetailData AS SP_DEVINFO_LIST_DETAIL_DATA_A) AS LONG
    MACRO SetupDiGetDeviceInfoListDetail(DeviceInfoSet, DeviceInfoSetDetailData) = SetupDiGetDeviceInfoListDetailA(DeviceInfoSet, DeviceInfoSetDetailData)
    
    DECLARE FUNCTION SetupDiCreateDeviceInfoA LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInfoA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                   BYREF DeviceName AS ASCIIZ, _
                                                                                                   BYREF ClassGuid AS GUID, _
                                                                                                   BYREF DeviceDescription AS ASCIIZ, _
                                                                                                   BYVAL hwndParent AS DWORD, _
                                                                                                   BYVAL CreationFlags AS DWORD, _
                                                                                                   BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    MACRO SetupDiCreateDeviceInfo(DeviceInfoSet, DeviceName, ClassGuid, DeviceDescription, hwndParent, CreationFlags, DeviceInfoData) = SetupDiCreateDeviceInfoA(DeviceInfoSet, DeviceName, ClassGuid, DeviceDescription, hwndParent, CreationFlags, DeviceInfoData)
    
    DECLARE FUNCTION SetupDiOpenDeviceInfoA LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenDeviceInfoA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                               BYREF DeviceInstanceId AS ASCIIZ, _
                                                                                               BYVAL hwndParent AS DWORD, _
                                                                                               BYVAL OpenFlags AS DWORD, _
                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    MACRO SetupDiOpenDeviceInfo(DeviceInfoSet, DeviceInstanceId, hwndParent, OpenFlags, DeviceInfoData) = SetupDiOpenDeviceInfoA(DeviceInfoSet, DeviceInstanceId, hwndParent, OpenFlags, DeviceInfoData)
    
    DECLARE FUNCTION SetupDiGetDeviceInstanceIdA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInstanceIdA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                         BYREF DeviceInstanceId AS ASCIIZ, _
                                                                                                         BYVAL DeviceInstanceIdSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetDeviceInstanceId(DeviceInfoSet, DeviceInfoData, DeviceInstanceId, DeviceInstanceIdSize, RequiredSize) = SetupDiGetDeviceInstanceIdA(DeviceInfoSet, DeviceInfoData, DeviceInstanceId, DeviceInstanceIdSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiCreateDeviceInterfaceA LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInterfaceA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                             BYREF InterfaceClassGuid AS GUID, _
                                                                                                             BYREF ReferenceString AS ASCIIZ, _
                                                                                                             BYVAL CreationFlags AS DWORD, _
                                                                                                             BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA) AS LONG
    MACRO SetupDiCreateDeviceInterface(DeviceInfoSet, DeviceInfoData, InterfaceClassGuid, ReferenceString, CreationFlags, DeviceInterfaceData) = _
    SetupDiCreateDeviceInterfaceA(DeviceInfoSet, DeviceInfoData, InterfaceClassGuid, ReferenceString, CreationFlags, DeviceInterfaceData)
    
    DECLARE FUNCTION SetupDiOpenDeviceInterfaceA LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenDeviceInterfaceA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF DevicePath AS ASCIIZ, _
                                                                                                         BYVAL OpenFlags AS DWORD, _
                                                                                                         BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA) AS LONG
    MACRO SetupDiOpenDeviceInterface(DeviceInfoSet, DevicePath, OpenFlags, DeviceInterfaceData) = SetupDiOpenDeviceInterfaceA(DeviceInfoSet, DevicePath, OpenFlags, DeviceInterfaceData)
    
    DECLARE FUNCTION SetupDiGetDeviceInterfaceDetailA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInterfaceDetailA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                   BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA, _
                                                                                                                   BYREF DeviceInterfaceDetailData AS SP_DEVICE_INTERFACE_DETAIL_DATA_A, _
                                                                                                                   BYVAL DeviceInterfaceDetailDataSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD, _
                                                                                                                   BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    MACRO SetupDiGetDeviceInterfaceDetail(DeviceInfoSet, DeviceInterfaceData, DeviceInterfaceDetailData, DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData) = _
    SetupDiGetDeviceInterfaceDetailA(DeviceInfoSet, DeviceInterfaceData, DeviceInterfaceDetailData, DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData)
    
    DECLARE FUNCTION SetupDiEnumDriverInfoA LIB "SETUPAPI.DLL" ALIAS "SetupDiEnumDriverInfoA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                               BYVAL DriverType AS DWORD, _
                                                                                               BYVAL MemberIndex AS DWORD, _
                                                                                               BYREF DriverInfoData AS SP_DRVINFO_DATA_A) AS LONG
    MACRO SetupDiEnumDriverInfo(DeviceInfoSet, DeviceInfoData, DriverType, MemberIndex, DriverInfoData) = SetupDiEnumDriverInfoA(DeviceInfoSet, DeviceInfoData, DriverType, MemberIndex, DriverInfoData)
    
    DECLARE FUNCTION SetupDiGetSelectedDriverA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetSelectedDriverA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                     BYREF DriverInfoData AS SP_DRVINFO_DATA_A) AS LONG
    MACRO SetupDiGetSelectedDriver(DeviceInfoSet, DeviceInfoData, DriverInfoData) = SetupDiGetSelectedDriverA(DeviceInfoSet, DeviceInfoData, DriverInfoData)
    
    DECLARE FUNCTION SetupDiSetSelectedDriverA LIB "SETUPAPI.DLL" ALIAS "SetupDiSetSelectedDriverA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                     BYREF DriverInfoData AS ANY) AS LONG
    MACRO SetupDiSetSelectedDriver(DeviceInfoSet, DeviceInfoData, DriverInfoData) = SetupDiSetSelectedDriverA(DeviceInfoSet, DeviceInfoData, DriverInfoData)
    
    DECLARE FUNCTION SetupDiGetDriverInfoDetailA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDriverInfoDetailA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                         BYREF DriverInfoData AS SP_DRVINFO_DATA_A, _
                                                                                                         BYREF DriverInfoDetailData AS SP_DRVINFO_DETAIL_DATA_A, _
                                                                                                         BYVAL DriverInfoDetailDataSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetDriverInfoDetail(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInfoDetailData, DriverInfoDetailDataSize, RequiredSize) = _
    SetupDiGetDriverInfoDetailA(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInfoDetailData, DriverInfoDetailDataSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiGetClassDevsA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDevsA" (BYREF ClassGuid AS GUID, _
                                                                                           BYREF Enumerator AS ASCIIZ, _
                                                                                           BYVAL hwndParent AS DWORD, _
                                                                                           BYVAL Flags AS DWORD) AS DWORD
    MACRO SetupDiGetClassDevs(ClassGuid, Enumerator, hwndParent, Flags) = SetupDiGetClassDevsA(ClassGuid, Enumerator, hwndParent, Flags)
    
    DECLARE FUNCTION SetupDiGetClassDevsExA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDevsExA" (BYREF ClassGuid AS GUID, _
                                                                                               BYREF Enumerator AS ASCIIZ, _
                                                                                               BYVAL hwndParent AS DWORD, _
                                                                                               BYVAL Flags AS DWORD, _
                                                                                               BYVAL DeviceInfoSet AS DWORD, _
                                                                                               BYREF MachineName AS ASCIIZ, _
                                                                                               BYREF Reserved AS ANY) AS DWORD
    MACRO SetupDiGetClassDevsEx(ClassGuid, Enumerator, hwndParent, Flags, DeviceInfoSet, MachineName, Reserved) = SetupDiGetClassDevsExA(ClassGuid, Enumerator, hwndParent, Flags, DeviceInfoSet, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetINFClassA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetINFClassA" (BYREF InfName AS ASCIIZ, _
                                                                                         BYREF ClassGuid AS GUID, _
                                                                                         BYREF ClassName AS ASCIIZ, _
                                                                                         BYVAL ClassNameSize AS DWORD, _
                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetINFClass(InfName, ClassGuid, ClassName, ClassNameSize, RequiredSize) = SetupDiGetINFClassA(InfName, ClassGuid, ClassName, ClassNameSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiBuildClassInfoListExA LIB "SETUPAPI.DLL" ALIAS "SetupDiBuildClassInfoListExA" (BYVAL Flags AS DWORD, _
                                                                                                           BYREF ClassGuidList AS GUID, _
                                                                                                           BYVAL ClassGuidListSize AS DWORD, _
                                                                                                           BYREF RequiredSize AS DWORD, _
                                                                                                           BYREF MachineName AS ASCIIZ, _
                                                                                                           BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiBuildClassInfoListEx(Flags, ClassGuidList, ClassGuidListSize, RequiredSize, MachineName, Reserved) = SetupDiBuildClassInfoListExA(Flags, ClassGuidList, ClassGuidListSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetClassDescriptionA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDescriptionA" (BYREF ClassGuid AS GUID, _
                                                                                                         BYREF ClassDescription AS ASCIIZ, _
                                                                                                         BYVAL ClassDescriptionSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetClassDescription(ClassGuid, ClassDescription, ClassDescriptionSize, RequiredSize) = SetupDiGetClassDescriptionA(ClassGuid, ClassDescription, ClassDescriptionSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiGetClassDescriptionExA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDescriptionExA" (BYREF ClassGuid AS GUID, _
                                                                                                             BYREF ClassDescription AS ASCIIZ, _
                                                                                                             BYVAL ClassDescriptionSize AS DWORD, _
                                                                                                             BYREF RequiredSize AS DWORD, _
                                                                                                             BYREF MachineName AS ASCIIZ, _
                                                                                                             BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetClassDescriptionEx(ClassGuid, ClassDescription, ClassDescriptionSize, RequiredSize, MachineName, Reserved) = SetupDiGetClassDescriptionExA(ClassGuid, ClassDescription, ClassDescriptionSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiInstallClassA LIB "SETUPAPI.DLL" ALIAS "SetupDiInstallClassA" (BYVAL hwndParent AS DWORD, _
                                                                                           BYREF InfFileName AS ASCIIZ, _
                                                                                           BYVAL Flags AS DWORD, _
                                                                                           BYVAL FileQueue AS HSPFILEQ) AS LONG
    MACRO SetupDiInstallClass(hwndParent, InfFileName, Flags, FileQueue) = SetupDiInstallClassA(hwndParent, InfFileName, Flags, FileQueue)
    
    DECLARE FUNCTION SetupDiInstallClassExA LIB "SETUPAPI.DLL" ALIAS "SetupDiInstallClassExA" (BYVAL hwndParent AS DWORD, _
                                                                                               BYREF InfFileName AS ASCIIZ, _
                                                                                               BYVAL Flags AS DWORD, _
                                                                                               BYVAL FileQueue AS HSPFILEQ, _
                                                                                               BYREF InterfaceClassGuid AS GUID, _
                                                                                               BYREF Reserved1 AS ANY, _
                                                                                               BYREF Reserved2 AS ANY) AS LONG
    MACRO SetupDiInstallClassEx(hwndParent, InfFileName, Flags, FileQueue, InterfaceClassGuid, Reserved1, Reserved2) = SetupDiInstallClassExA(hwndParent, InfFileName, Flags, FileQueue, InterfaceClassGuid, Reserved1, Reserved2)
    
    DECLARE FUNCTION SetupDiOpenClassRegKeyExA LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenClassRegKeyExA" (BYREF ClassGuid AS GUID, _
                                                                                                     BYVAL samDesired AS DWORD, _
                                                                                                     BYVAL Flags AS DWORD, _
                                                                                                     BYREF MachineName AS ASCIIZ, _
                                                                                                     BYREF Reserved AS ANY) AS DWORD
    MACRO SetupDiOpenClassRegKeyEx(ClassGuid, samDesired, Flags, MachineName, Reserved) = SetupDiOpenClassRegKeyExA(ClassGuid, samDesired, Flags, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiCreateDeviceInterfaceRegKeyA LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInterfaceRegKeyA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                         BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA, _
                                                                                                                         BYVAL Reserved AS DWORD, _
                                                                                                                         BYVAL samDesired AS DWORD, _
                                                                                                                         BYVAL InfHandle AS HINF, _
                                                                                                                         BYREF InfSectionName AS ASCIIZ) AS DWORD
    MACRO SetupDiCreateDeviceInterfaceRegKey(DeviceInfoSet, DeviceInterfaceData, Reserved, samDesired, InfHandle, InfSectionName) = SetupDiCreateDeviceInterfaceRegKeyA(DeviceInfoSet, DeviceInterfaceData, Reserved, samDesired, InfHandle, InfSectionName)
    
    DECLARE FUNCTION SetupDiCreateDevRegKeyA LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDevRegKeyA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                 BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                 BYVAL Scope AS DWORD, _
                                                                                                 BYVAL HwProfile AS DWORD, _
                                                                                                 BYVAL KeyType AS DWORD, _
                                                                                                 BYVAL InfHandle AS HINF, _
                                                                                                 BYREF InfSectionName AS ASCIIZ) AS DWORD
    MACRO SetupDiCreateDevRegKey(DeviceInfoSet, DeviceInfoData, Scope, HwProfile, KeyType, InfHandle, InfSectionName) = SetupDiCreateDevRegKeyA(DeviceInfoSet, DeviceInfoData, Scope, HwProfile, KeyType, InfHandle, InfSectionName)
    
    DECLARE FUNCTION SetupDiGetHwProfileListExA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetHwProfileListExA" (BYREF HwProfileList AS DWORD, _
                                                                                                       BYVAL HwProfileListSize AS DWORD, _
                                                                                                       BYREF RequiredSize AS DWORD, _
                                                                                                       BYREF CurrentlyActiveIndex AS DWORD, _
                                                                                                       BYREF MachineName AS ASCIIZ, _
                                                                                                       BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetHwProfileListEx(HwProfileList, HwProfileListSize, RequiredSize, CurrentlyActiveIndex, MachineName, Reserved) = SetupDiGetHwProfileListExA(HwProfileList, HwProfileListSize, RequiredSize, CurrentlyActiveIndex, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetDeviceRegistryPropertyA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceRegistryPropertyA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                                     BYVAL Property AS DWORD, _
                                                                                                                     BYREF PropertyRegDataType AS DWORD, _
                                                                                                                     BYREF PropertyBuffer AS ANY, _
                                                                                                                     BYVAL PropertyBufferSize AS DWORD, _
                                                                                                                     BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetDeviceRegistryProperty(DeviceInfoSet, DeviceInfoData, Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize) = _
    SetupDiGetDeviceRegistryPropertyA(DeviceInfoSet, DeviceInfoData, Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiGetClassRegistryPropertyA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassRegistryPropertyA" (BYREF ClassGuid AS GUID, _
                                                                                                                   BYVAL Property AS DWORD, _
                                                                                                                   BYREF PropertyRegDataType AS DWORD, _
                                                                                                                   BYREF PropertyBuffer AS ANY, _
                                                                                                                   BYVAL PropertyBufferSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD, _
                                                                                                                   BYREF MachineName AS ASCIIZ, _
                                                                                                                   BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetClassRegistryProperty(ClassGuid, Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize, MachineName, Reserved) = _
    SetupDiGetClassRegistryPropertyA(ClassGuid, Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiSetDeviceRegistryPropertyA LIB "SETUPAPI.DLL" ALIAS "SetupDiSetDeviceRegistryPropertyA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                     BYREF DeviceInfoData AS ANY, _
                                                                                                                     BYVAL Property AS DWORD, _
                                                                                                                     BYREF PropertyBuffer AS BYTE, _
                                                                                                                     BYVAL PropertyBufferSize AS DWORD) AS LONG
    MACRO SetupDiSetDeviceRegistryProperty(DeviceInfoSet, DeviceInfoData, Property, PropertyBuffer, PropertyBufferSize) = SetupDiSetDeviceRegistryPropertyA(DeviceInfoSet, DeviceInfoData, Property, PropertyBuffer, PropertyBufferSize)
    
    DECLARE FUNCTION SetupDiSetClassRegistryPropertyA LIB "SETUPAPI.DLL" ALIAS "SetupDiSetClassRegistryPropertyA" (BYREF ClassGuid AS GUID, _
                                                                                                                   BYVAL Property AS DWORD, _
                                                                                                                   BYREF PropertyBuffer AS BYTE, _
                                                                                                                   BYVAL PropertyBufferSize AS DWORD, _
                                                                                                                   BYREF MachineName AS ASCIIZ, _
                                                                                                                   BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiSetClassRegistryProperty(ClassGuid, Property, PropertyBuffer, PropertyBufferSize, MachineName, Reserved) = SetupDiSetClassRegistryPropertyA(ClassGuid, Property, PropertyBuffer, PropertyBufferSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetDeviceInstallParamsA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInstallParamsA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                               BYREF DeviceInstallParams AS SP_DEVINSTALL_PARAMS_A) AS LONG
    MACRO SetupDiGetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, DeviceInstallParams) = SetupDiGetDeviceInstallParamsA(DeviceInfoSet, DeviceInfoData, DeviceInstallParams)
    
    DECLARE FUNCTION SetupDiGetClassInstallParamsA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassInstallParamsA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                             BYREF ClassInstallParams AS SP_CLASSINSTALL_HEADER, _
                                                                                                             BYVAL ClassInstallParamsSize AS DWORD, _
                                                                                                             BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetClassInstallParams(DeviceInfoSet, DeviceInfoData, ClassInstallParams, ClassInstallParamsSize, RequiredSize) = SetupDiGetClassInstallParamsA(DeviceInfoSet, DeviceInfoData, ClassInstallParams, ClassInstallParamsSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiSetDeviceInstallParamsA LIB "SETUPAPI.DLL" ALIAS "SetupDiSetDeviceInstallParamsA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                               BYREF DeviceInstallParams AS SP_DEVINSTALL_PARAMS_A) AS LONG
    MACRO SetupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, DeviceInstallParams) = SetupDiSetDeviceInstallParamsA(DeviceInfoSet, DeviceInfoData, DeviceInstallParams)
    
    DECLARE FUNCTION SetupDiSetClassInstallParamsA LIB "SETUPAPI.DLL" ALIAS "SetupDiSetClassInstallParamsA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                             BYREF ClassInstallParams AS SP_CLASSINSTALL_HEADER, _
                                                                                                             BYVAL ClassInstallParamsSize AS DWORD) AS LONG
    MACRO SetupDiSetClassInstallParams(DeviceInfoSet, DeviceInfoData, ClassInstallParams, ClassInstallParamsSize) = SetupDiSetClassInstallParamsA(DeviceInfoSet, DeviceInfoData, ClassInstallParams, ClassInstallParamsSize)
    
    DECLARE FUNCTION SetupDiGetDriverInstallParamsA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDriverInstallParamsA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                               BYREF DriverInfoData AS SP_DRVINFO_DATA_A, _
                                                                                                               BYREF DriverInstallParams AS SP_DRVINSTALL_PARAMS) AS LONG
    MACRO SetupDiGetDriverInstallParams(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInstallParams) = SetupDiGetDriverInstallParamsA(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInstallParams)
    
    DECLARE FUNCTION SetupDiSetDriverInstallParamsA LIB "SETUPAPI.DLL" ALIAS "SetupDiSetDriverInstallParamsA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                               BYREF DriverInfoData AS SP_DRVINFO_DATA_A, _
                                                                                                               BYREF DriverInstallParams AS SP_DRVINSTALL_PARAMS) AS LONG
    MACRO SetupDiSetDriverInstallParams(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInstallParams) = SetupDiSetDriverInstallParamsA(DeviceInfoSet, DeviceInfoData, DriverInfoData, DriverInstallParams)
    
    DECLARE FUNCTION SetupDiGetClassImageListExA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassImageListExA" (BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA, _
                                                                                                         BYREF MachineName AS ASCIIZ, _
                                                                                                         BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetClassImageListEx(ClassImageListData, MachineName, Reserved) = SetupDiGetClassImageListExA(ClassImageListData, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetClassDevPropertySheetsA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassDevPropertySheetsA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                                     BYVAL PropertySheetHeader AS DWORD, _
                                                                                                                     BYVAL PropertySheetHeaderPageListSize AS DWORD, _
                                                                                                                     BYREF RequiredSize AS DWORD, _
                                                                                                                     BYVAL PropertySheetType AS DWORD) AS LONG
    MACRO SetupDiGetClassDevPropertySheets(DeviceInfoSet, DeviceInfoData, PropertySheetHeader, PropertySheetHeaderPageListSize, RequiredSize, PropertySheetType) = _
    SetupDiGetClassDevPropertySheetsA(DeviceInfoSet, DeviceInfoData, PropertySheetHeader, PropertySheetHeaderPageListSize, RequiredSize, PropertySheetType)
    
    DECLARE FUNCTION SetupDiClassNameFromGuidA LIB "SETUPAPI.DLL" ALIAS "SetupDiClassNameFromGuidA" (BYREF ClassGuid AS GUID, _
                                                                                                     BYREF ClassName AS ASCIIZ, _
                                                                                                     BYVAL ClassNameSize AS DWORD, _
                                                                                                     BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiClassNameFromGuid(ClassGuid, ClassName, ClassNameSize, RequiredSize) = SetupDiClassNameFromGuidA(ClassGuid, ClassName, ClassNameSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiClassNameFromGuidExA LIB "SETUPAPI.DLL" ALIAS "SetupDiClassNameFromGuidExA" (BYREF ClassGuid AS GUID, _
                                                                                                         BYREF ClassName AS ASCIIZ, _
                                                                                                         BYVAL ClassNameSize AS DWORD, _
                                                                                                         BYREF RequiredSize AS DWORD, _
                                                                                                         BYREF MachineName AS ASCIIZ, _
                                                                                                         BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiClassNameFromGuidEx(ClassGuid, ClassName, ClassNameSize, RequiredSize, MachineName, Reserved) = SetupDiClassNameFromGuidExA(ClassGuid, ClassName, ClassNameSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiClassGuidsFromNameA LIB "SETUPAPI.DLL" ALIAS "SetupDiClassGuidsFromNameA" (BYREF ClassName AS ASCIIZ, _
                                                                                                       BYREF ClassGuidList AS GUID, _
                                                                                                       BYVAL ClassGuidListSize AS DWORD, _
                                                                                                       BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiClassGuidsFromName(ClassName, ClassGuidList, ClassGuidListSize, RequiredSize) = SetupDiClassGuidsFromNameA(ClassName, ClassGuidList, ClassGuidListSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiClassGuidsFromNameExA LIB "SETUPAPI.DLL" ALIAS "SetupDiClassGuidsFromNameExA" (BYREF ClassName AS ASCIIZ, _
                                                                                                           BYREF ClassGuidList AS GUID, _
                                                                                                           BYVAL ClassGuidListSize AS DWORD, _
                                                                                                           BYREF RequiredSize AS DWORD, _
                                                                                                           BYREF MachineName AS ASCIIZ, _
                                                                                                           BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiClassGuidsFromNameEx(ClassName, ClassGuidList, ClassGuidListSize, RequiredSize, MachineName, Reserved) = SetupDiClassGuidsFromNameExA(ClassName, ClassGuidList, ClassGuidListSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetHwProfileFriendlyNameA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetHwProfileFriendlyNameA" (BYVAL HwProfile AS DWORD, _
                                                                                                                   BYREF FriendlyName AS ASCIIZ, _
                                                                                                                   BYVAL FriendlyNameSize AS DWORD, _
                                                                                                                   BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetHwProfileFriendlyName(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize) = SetupDiGetHwProfileFriendlyNameA(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize)
    
    DECLARE FUNCTION SetupDiGetHwProfileFriendlyNameExA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetHwProfileFriendlyNameExA" (BYVAL HwProfile AS DWORD, _
                                                                                                                       BYREF FriendlyName AS ASCIIZ, _
                                                                                                                       BYVAL FriendlyNameSize AS DWORD, _
                                                                                                                       BYREF RequiredSize AS DWORD, _
                                                                                                                       BYREF MachineName AS ASCIIZ, _
                                                                                                                       BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetHwProfileFriendlyNameEx(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved) = SetupDiGetHwProfileFriendlyNameExA(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
    
    DECLARE FUNCTION SetupDiGetActualSectionToInstallA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetActualSectionToInstallA" (BYVAL InfHandle AS HINF, _
                                                                                                                     BYREF InfSectionName AS ASCIIZ, _
                                                                                                                     BYREF InfSectionWithExt AS ASCIIZ, _
                                                                                                                     BYVAL InfSectionWithExtSize AS DWORD, _
                                                                                                                     BYREF RequiredSize AS DWORD, _
                                                                                                                     BYREF Extension AS ASCIIZ) AS LONG
    MACRO SetupDiGetActualSectionToInstall(InfHandle, InfSectionName, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension) = _
    SetupDiGetActualSectionToInstallA(InfHandle, InfSectionName, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension)
    
    DECLARE FUNCTION SetupDiGetActualSectionToInstallExA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetActualSectionToInstallExA" (BYVAL InfHandle AS HINF, _
                                                                                                                         BYREF InfSectionName AS ASCIIZ, _
                                                                                                                         BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO, _
                                                                                                                         BYREF InfSectionWithExt AS ASCIIZ, _
                                                                                                                         BYVAL InfSectionWithExtSize AS DWORD, _
                                                                                                                         BYREF RequiredSize AS DWORD, _
                                                                                                                         BYREF Extension AS ASCIIZ, _
                                                                                                                         BYREF Reserved AS ANY) AS LONG
    MACRO SetupDiGetActualSectionToInstallEx(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved) = _
    SetupDiGetActualSectionToInstallExA(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved)
    
    DECLARE FUNCTION SetupEnumInfSectionsA LIB "SETUPAPI.DLL" ALIAS "SetupEnumInfSectionsA" (BYVAL InfHandle AS HINF, _
                                                                                             BYVAL Index AS DWORD, _
                                                                                             BYREF Buffer AS ASCIIZ, _
                                                                                             BYVAL SIZE AS DWORD, _
                                                                                             BYREF SizeNeeded AS DWORD) AS LONG
    MACRO SetupEnumInfSections(InfHandle, Index, Buffer, SIZE, SizeNeeded) = SetupEnumInfSectionsA(InfHandle, Index, Buffer, SIZE, SizeNeeded)
    
    DECLARE FUNCTION SetupDiGetCustomDevicePropertyA LIB "SETUPAPI.DLL" ALIAS "SetupDiGetCustomDevicePropertyA" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                 BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                                 BYREF CustomPropertyName AS ASCIIZ, _
                                                                                                                 BYVAL Flags AS DWORD, _
                                                                                                                 BYREF PropertyRegDataType AS DWORD, _
                                                                                                                 BYREF PropertyBuffer AS ANY, _
                                                                                                                 BYVAL PropertyBufferSize AS DWORD, _
                                                                                                                 BYREF RequiredSize AS DWORD) AS LONG
    MACRO SetupDiGetCustomDeviceProperty(DeviceInfoSet, DeviceInfoData, CustomPropertyName, Flags, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize) = _
    SetupDiGetCustomDevicePropertyA(DeviceInfoSet, DeviceInfoData, CustomPropertyName, Flags, PropertyRegDataType, PropertyBuffer, PropertyBufferSize, RequiredSize)
    
    DECLARE FUNCTION SetupConfigureWmiFromInfSectionA LIB "SETUPAPI.DLL" ALIAS "SetupConfigureWmiFromInfSectionA" (BYVAL InfHandle AS HINF, _
                                                                                                                   BYREF SectionName AS ASCIIZ, _
                                                                                                                   BYVAL Flags AS DWORD) AS LONG
    MACRO SetupConfigureWmiFromInfSection(InfHandle, SectionName, Flags) = SetupConfigureWmiFromInfSectionA(InfHandle, SectionName, Flags)
    
    
    #ENDIF ' UNICODE or ANSI declares.
    
    
    DECLARE FUNCTION SetupOpenMasterInf LIB "SETUPAPI.DLL" ALIAS "SetupOpenMasterInf" () AS HINF
    DECLARE SUB SetupCloseInfFile LIB "SETUPAPI.DLL" ALIAS "SetupCloseInfFile" (BYVAL InfHandle AS HINF)
    DECLARE FUNCTION SetupFindNextLine LIB "SETUPAPI.DLL" ALIAS "SetupFindNextLine" (BYREF ContextIn AS INFCONTEXT, _
                                                                                     BYREF ContextOut AS INFCONTEXT) AS LONG
    DECLARE FUNCTION SetupGetFieldCount LIB "SETUPAPI.DLL" ALIAS "SetupGetFieldCount" (BYREF inContext AS INFCONTEXT) AS DWORD
    DECLARE FUNCTION SetupGetIntField LIB "SETUPAPI.DLL" ALIAS "SetupGetIntField" (BYREF inContext AS INFCONTEXT, _
                                                                                   BYVAL FieldIndex AS DWORD, _
                                                                                   BYREF IntegerValue AS LONG) AS LONG
    DECLARE FUNCTION SetupGetBinaryField LIB "SETUPAPI.DLL" ALIAS "SetupGetBinaryField" (BYREF inContext AS INFCONTEXT, _
                                                                                         BYVAL FieldIndex AS DWORD, _
                                                                                         BYREF ReturnBuffer AS ANY, _
                                                                                         BYVAL ReturnBufferSize AS DWORD, _
                                                                                         BYREF RequiredSize AS DWORD) AS LONG
    DECLARE FUNCTION SetupCancelTemporarySourceList LIB "SETUPAPI.DLL" ALIAS "SetupCancelTemporarySourceList" () AS LONG
    DECLARE FUNCTION SetupOpenFileQueue LIB "SETUPAPI.DLL" ALIAS "SetupOpenFileQueue" () AS HSPFILEQ
    DECLARE FUNCTION SetupCloseFileQueue LIB "SETUPAPI.DLL" ALIAS "SetupCloseFileQueue" (BYVAL QueueHandle AS HSPFILEQ) AS LONG
    DECLARE FUNCTION SetupGetFileQueueCount LIB "SETUPAPI.DLL" ALIAS "SetupGetFileQueueCount" (BYVAL FileQueue AS HSPFILEQ, _
                                                                                               BYVAL SubQueueFileOp AS DWORD, _
                                                                                               BYREF NumOperations AS DWORD) AS LONG
    DECLARE FUNCTION SetupGetFileQueueFlags LIB "SETUPAPI.DLL" ALIAS "SetupGetFileQueueFlags" (BYVAL FileQueue AS HSPFILEQ, _
                                                                                               BYREF Flags AS DWORD) AS LONG
    DECLARE FUNCTION SetupSetFileQueueFlags LIB "SETUPAPI.DLL" ALIAS "SetupSetFileQueueFlags" (BYVAL FileQueue AS HSPFILEQ, _
                                                                                               BYVAL FlagMask AS DWORD, _
                                                                                               BYVAL Flags AS DWORD) AS LONG
    DECLARE FUNCTION SetupUninstallNewlyCopiedInfs LIB "SETUPAPI.DLL" ALIAS "SetupUninstallNewlyCopiedInfs" (BYVAL FileQueue AS HSPFILEQ, _
                                                                                                             BYVAL Flags AS DWORD, _
                                                                                                             BYREF Reserved AS ANY) AS LONG
    DECLARE FUNCTION SetupDestroyDiskSpaceList LIB "SETUPAPI.DLL" ALIAS "SetupDestroyDiskSpaceList" (BYREF DiskSpace AS ANY) AS LONG
    DECLARE FUNCTION SetupPromptReboot LIB "SETUPAPI.DLL" ALIAS "SetupPromptReboot" (BYVAL FileQueue AS HSPFILEQ, _
                                                                                     BYVAL Owner AS DWORD, _
                                                                                     BYVAL ScanOnly AS LONG) AS LONG
    DECLARE FUNCTION SetupInitDefaultQueueCallback LIB "SETUPAPI.DLL" ALIAS "SetupInitDefaultQueueCallback" (BYVAL OwnerWindow AS DWORD) AS DWORD
    DECLARE FUNCTION SetupInitDefaultQueueCallbackEx LIB "SETUPAPI.DLL" ALIAS "SetupInitDefaultQueueCallbackEx" (BYVAL OwnerWindow AS DWORD, _
                                                                                                                 BYVAL AlternateProgressWindow AS DWORD, _
                                                                                                                 BYVAL ProgressMessage AS DWORD, _
                                                                                                                 BYVAL Reserved1 AS DWORD, _
                                                                                                                 BYREF Reserved2 AS ANY) AS DWORD
    DECLARE SUB SetupTermDefaultQueueCallback LIB "SETUPAPI.DLL" ALIAS "SetupTermDefaultQueueCallback" (BYREF inContext AS ANY)
    DECLARE FUNCTION SetupTerminateFileLog LIB "SETUPAPI.DLL" ALIAS "SetupTerminateFileLog" (BYVAL FileLogHandle AS HSPFILELOG) AS LONG
    DECLARE FUNCTION SetupOpenLog LIB "SETUPAPI.DLL" ALIAS "SetupOpenLog" (BYVAL bErase AS LONG) AS LONG
    DECLARE SUB SetupCloseLog LIB "SETUPAPI.DLL" ALIAS "SetupCloseLog"
    DECLARE FUNCTION SetupSetNonInteractiveMode LIB "SETUPAPI.DLL" ALIAS "SetupSetNonInteractiveMode" (BYVAL NonInteractiveFlag AS LONG) AS LONG
    DECLARE FUNCTION SetupGetNonInteractiveMode LIB "SETUPAPI.DLL" ALIAS "SetupGetNonInteractiveMode" () AS LONG
    DECLARE FUNCTION SetupDiCreateDeviceInfoList LIB "SETUPAPI.DLL" ALIAS "SetupDiCreateDeviceInfoList" (BYREF ClassGuid AS GUID, _
                                                                                                         BYVAL hwndParent AS DWORD) AS DWORD
    DECLARE FUNCTION SetupDiGetDeviceInfoListClass LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInfoListClass" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                             BYREF ClassGuid AS GUID) AS LONG
    DECLARE FUNCTION SetupDiDeleteDeviceInfo LIB "SETUPAPI.DLL" ALIAS "SetupDiDeleteDeviceInfo" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                 BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiEnumDeviceInfo LIB "SETUPAPI.DLL" ALIAS "SetupDiEnumDeviceInfo" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                             BYVAL MemberIndex AS DWORD, _
                                                                                             BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiDestroyDeviceInfoList LIB "SETUPAPI.DLL" ALIAS "SetupDiDestroyDeviceInfoList" (BYVAL DeviceInfoSet AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiEnumDeviceInterfaces LIB "SETUPAPI.DLL" ALIAS "SetupDiEnumDeviceInterfaces" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                         BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                         BYREF InterfaceClassGuid AS GUID, _
                                                                                                         BYVAL MemberIndex AS DWORD, _
                                                                                                         BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA) AS LONG
    DECLARE FUNCTION SetupDiGetDeviceInterfaceAlias LIB "SETUPAPI.DLL" ALIAS "SetupDiGetDeviceInterfaceAlias" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA, _
                                                                                                               BYREF AliasInterfaceClassGuid AS GUID, _
                                                                                                               BYREF AliasDeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA) AS LONG
    DECLARE FUNCTION SetupDiDeleteDeviceInterfaceData LIB "SETUPAPI.DLL" ALIAS "SetupDiDeleteDeviceInterfaceData" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                   BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA) AS LONG
    DECLARE FUNCTION SetupDiRemoveDeviceInterface LIB "SETUPAPI.DLL" ALIAS "SetupDiRemoveDeviceInterface" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                           BYREF DeviceInterfaceData AS ANY) AS LONG
    DECLARE FUNCTION SetupDiInstallDeviceInterfaces LIB "SETUPAPI.DLL" ALIAS "SetupDiInstallDeviceInterfaces" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiSetDeviceInterfaceDefault LIB "SETUPAPI.DLL" ALIAS "SetupDiSetDeviceInterfaceDefault" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                   BYREF DeviceInterfaceData AS ANY, _
                                                                                                                   BYVAL Flags AS DWORD, _
                                                                                                                   BYREF Reserved AS ANY) AS LONG
    DECLARE FUNCTION SetupDiRegisterDeviceInfo LIB "SETUPAPI.DLL" ALIAS "SetupDiRegisterDeviceInfo" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                     BYREF DeviceInfoData AS ANY, _
                                                                                                     BYVAL Flags AS DWORD, _
                                                                                                     BYVAL CompareProc AS DWORD, _
                                                                                                     BYREF CompareContext AS ANY, _
                                                                                                     BYREF DupDeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiBuildDriverInfoList LIB "SETUPAPI.DLL" ALIAS "SetupDiBuildDriverInfoList" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                       BYREF DeviceInfoData AS ANY, _
                                                                                                       BYVAL DriverType AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiCancelDriverInfoSearch LIB "SETUPAPI.DLL" ALIAS "SetupDiCancelDriverInfoSearch" (BYVAL DeviceInfoSet AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiDestroyDriverInfoList LIB "SETUPAPI.DLL" ALIAS "SetupDiDestroyDriverInfoList" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                           BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                                           BYVAL DriverType AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiBuildClassInfoList LIB "SETUPAPI.DLL" ALIAS "SetupDiBuildClassInfoList" (BYVAL Flags AS DWORD, _
                                                                                                     BYREF ClassGuidList AS GUID, _
                                                                                                     BYVAL ClassGuidListSize AS DWORD, _
                                                                                                     BYREF RequiredSize AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiCallClassInstaller LIB "SETUPAPI.DLL" ALIAS "SetupDiCallClassInstaller" (BYVAL InstallFunction AS DI_FUNCTION, _
                                                                                                     BYVAL DeviceInfoSet AS DWORD, _
                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiSelectDevice LIB "SETUPAPI.DLL" ALIAS "SetupDiSelectDevice" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                         BYREF DeviceInfoData AS ANY) AS LONG
    DECLARE FUNCTION SetupDiSelectBestCompatDrv LIB "SETUPAPI.DLL" ALIAS "SetupDiSelectBestCompatDrv" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                       BYREF DeviceInfoData AS ANY) AS LONG
    DECLARE FUNCTION SetupDiInstallDevice LIB "SETUPAPI.DLL" ALIAS "SetupDiInstallDevice" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                           BYREF DeviceInfoData AS ANY) AS LONG
    DECLARE FUNCTION SetupDiInstallDriverFiles LIB "SETUPAPI.DLL" ALIAS "SetupDiInstallDriverFiles" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiRegisterCoDeviceInstallers LIB "SETUPAPI.DLL" ALIAS "SetupDiRegisterCoDeviceInstallers" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                     BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiRemoveDevice LIB "SETUPAPI.DLL" ALIAS "SetupDiRemoveDevice" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                         BYREF DeviceInfoData AS ANY) AS LONG
    DECLARE FUNCTION SetupDiUnremoveDevice LIB "SETUPAPI.DLL" ALIAS "SetupDiUnremoveDevice" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                             BYREF DeviceInfoData AS ANY) AS LONG
    DECLARE FUNCTION SetupDiChangeState LIB "SETUPAPI.DLL" ALIAS "SetupDiChangeState" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                       BYREF DeviceInfoData AS ANY) AS LONG
    DECLARE FUNCTION SetupDiOpenClassRegKey LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenClassRegKey" (BYREF ClassGuid AS GUID, _
                                                                                               BYVAL samDesired AS DWORD) AS DWORD
    DECLARE FUNCTION SetupDiOpenDeviceInterfaceRegKey LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenDeviceInterfaceRegKey" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                   BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA, _
                                                                                                                   BYVAL Reserved AS DWORD, _
                                                                                                                   BYVAL samDesired AS DWORD) AS DWORD
    DECLARE FUNCTION SetupDiDeleteDeviceInterfaceRegKey LIB "SETUPAPI.DLL" ALIAS "SetupDiDeleteDeviceInterfaceRegKey" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                                       BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA, _
                                                                                                                       BYVAL Reserved AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiOpenDevRegKey LIB "SETUPAPI.DLL" ALIAS "SetupDiOpenDevRegKey" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                           BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                           BYVAL Scope AS DWORD, _
                                                                                           BYVAL HwProfile AS DWORD, _
                                                                                           BYVAL KeyType AS DWORD, _
                                                                                           BYVAL samDesired AS DWORD) AS DWORD
    DECLARE FUNCTION SetupDiDeleteDevRegKey LIB "SETUPAPI.DLL" ALIAS "SetupDiDeleteDevRegKey" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                               BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                               BYVAL Scope AS DWORD, _
                                                                                               BYVAL HwProfile AS DWORD, _
                                                                                               BYVAL KeyType AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiGetHwProfileList LIB "SETUPAPI.DLL" ALIAS "SetupDiGetHwProfileList" (BYREF HwProfileList AS DWORD, _
                                                                                                 BYVAL HwProfileListSize AS DWORD, _
                                                                                                 BYREF RequiredSize AS DWORD, _
                                                                                                 BYREF CurrentlyActiveIndex AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiLoadClassIcon LIB "SETUPAPI.DLL" ALIAS "SetupDiLoadClassIcon" (BYREF ClassGuid AS GUID, _
                                                                                           BYREF LargeIcon AS DWORD, _
                                                                                           BYREF MiniIconIndex AS LONG) AS LONG
    DECLARE FUNCTION SetupDiDrawMiniIcon LIB "SETUPAPI.DLL" ALIAS "SetupDiDrawMiniIcon" (BYVAL hdc AS DWORD, _
                                                                                         BYVAL rc AS RECT, _
                                                                                         BYVAL MiniIconIndex AS LONG, _
                                                                                         BYVAL Flags AS DWORD) AS LONG
    DECLARE FUNCTION SetupDiGetClassBitmapIndex LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassBitmapIndex" (BYREF ClassGuid AS GUID, _
                                                                                                       BYREF MiniIconIndex AS LONG) AS LONG
    DECLARE FUNCTION SetupDiGetClassImageList LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassImageList" (BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA) AS LONG
    DECLARE FUNCTION SetupDiGetClassImageIndex LIB "SETUPAPI.DLL" ALIAS "SetupDiGetClassImageIndex" (BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA, _
                                                                                                     BYREF ClassGuid AS GUID, _
                                                                                                     BYREF ImageIndex AS LONG) AS LONG
    DECLARE FUNCTION SetupDiDestroyClassImageList LIB "SETUPAPI.DLL" ALIAS "SetupDiDestroyClassImageList" (BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA) AS LONG
    DECLARE FUNCTION SetupDiAskForOEMDisk LIB "SETUPAPI.DLL" ALIAS "SetupDiAskForOEMDisk" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                           BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiSelectOEMDrv LIB "SETUPAPI.DLL" ALIAS "SetupDiSelectOEMDrv" (BYVAL hwndParent AS DWORD, _
                                                                                         BYVAL DeviceInfoSet AS DWORD, _
                                                                                         BYREF DeviceInfoData AS ANY) AS LONG
    DECLARE FUNCTION SetupDiGetWizardPage LIB "SETUPAPI.DLL" ALIAS "SetupDiGetWizardPage" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                           BYREF DeviceInfoData AS SP_DEVINFO_DATA, _
                                                                                           BYREF InstallWizardData AS SP_INSTALLWIZARD_DATA, _
                                                                                           BYVAL PageType AS DWORD, _
                                                                                           BYVAL Flags AS DWORD) AS DWORD
    DECLARE FUNCTION SetupDiGetSelectedDevice LIB "SETUPAPI.DLL" ALIAS "SetupDiGetSelectedDevice" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                   BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    DECLARE FUNCTION SetupDiSetSelectedDevice LIB "SETUPAPI.DLL" ALIAS "SetupDiSetSelectedDevice" (BYVAL DeviceInfoSet AS DWORD, _
                                                                                                   BYREF DeviceInfoData AS SP_DEVINFO_DATA) AS LONG
    
    
    #ENDIF '  %SETUPAPI

    Leave a comment:


  • Mark Strickland
    replied
    Something to watch out for

    I have had pretty good luck with processing these messages but I sometimes see TWO messages for the insertion of a CRUZER drive. That is a U3 device and it is actually formated to have a "dummy" CD and a flash drive.

    When I get the extra message it is NOT the "dummy" CD device but the flash drive letter appearing twice.

    I don't typically see it with non U3 devices but I have not done extensive testing.

    If you need more examples post a request on this thread and I will post my FireFly example.

    Leave a comment:


  • Peter Lameijn
    replied
    This should work for detecting arrival and removal of USB HID devices:
    Code:
    '======================================================================================================================
    ' USBTEST.BAS - Shows the arrival / removal of USB HID devices.
    '======================================================================================================================
    #Dim All
    #Compile Exe
    #Include "Win32Api.inc"
    #Include "UsbHid.inc"
    #Include "dbt.inc"
    
    %IDC_LIST       = 1001
    
    Global hDlg         As Long
    Global dbdi         As DEV_BROADCAST_DEVICEINTERFACE
    Global dbdiptr      As DEV_BROADCAST_DEVICEINTERFACE Ptr
    Global RegHandle    As Dword
    
    Sub AddToList (ByVal LbString As String)
      Local Result As Long
      ListBox Add  hDlg, %IDC_LIST, LbString
      Control Send hDlg, %IDC_LIST, %LB_GETCOUNT, 0, 0 To Result
      If Result => 300 Then ListBox Delete hDlg, %IDC_LIST, 1
      Control Send hDlg, %IDC_LIST, %LB_GETCOUNT, 0, 0 To Result
      Control Send hDlg, %IDC_LIST, %LB_SETCURSEL, Result-1, 0
    End Sub
    
    '==================================================================================================
    CallBack Function CbMain()
      Local HidGuid As GUIDAPI, Vendor As String, Product As String, Temp As String
      
      Select Case CbMsg
        Case %WM_INITDIALOG
          Call HidD_GetHidGuid(HidGuid)
          dbdi.dbcc_size        = SizeOf (dbdi)
          dbdi.dbcc_devicetype  = %DBT_DEVTYP_DEVICEINTERFACE
          dbdi.dbcc_classguid   = HidGuid
          RegHandle             = RegisterDeviceNotification (hDlg, ByVal VarPtr(dbdi), %DEVICE_NOTIFY_WINDOW_HANDLE)
          AddToList "Started..."
        Case %WM_DESTROY
          UnRegisterDeviceNotification RegHandle
        Case %WM_COMMAND
        Case %WM_DEVICECHANGE
          If CbLParam Then
            dbdiptr = CbLParam
            Select Case CbWParam
              Case %DBT_DEVICEARRIVAL
                AddToList "Arrival of HID device"
              Case %DBT_DEVICEREMOVECOMPLETE
                AddToList "Removal of HID device"
            End Select
            Temp = UCase$(@dbdiptr.dbcc_name)
            Vendor = "0x" & Mid$(Temp, InStr(Temp,"VID") + 4, 4)
            Product = "0x" & Mid$(Temp, InStr(Temp,"PID") + 4, 4)
            AddToList "        Vendor ID=" & Vendor & ", Product ID=" & Product
          End If
      End Select
    End Function
     
    '==================================================================================================
    Function PBMain()
    '==================================================================================================
      Dialog New 0, "USB HID Test",,, 200, 250, %WS_SYSMENU To hDlg
      Control Add ListBox, hDlg, %IDC_LIST,, 5, 5, 190, 225, %LBS_USETABSTOPS Or %LBS_NOTIFY Or _
                                 %WS_VSCROLL Or %LBS_DISABLENOSCROLL, %WS_EX_CLIENTEDGE
      Dialog Show Modal hDlg, Call CbMain
    End Function
    The UsbHID.inc file:
    Code:
    '======================================================================================================================
    ' USBHID.INC - Include file for USB H(uman) I(nterface) D(evices)
    '
    '======================================================================================================================
    #If Not %Def(%USBHID_INC)
      %USBHID_INC = 1
      #Include "Win32Api.inc"
    
    '======================================================================================================================
    ' Constants
    '----------------------------------------------------------------------------------------------------------------------
    %DIGCF_DEFAULT                      = &h00000001
    %DIGCF_PRESENT                      = &h00000002
    %DIGCF_ALLCLASSES                   = &h00000004
    %DIGCF_PROFILE                      = &h00000008
    %DIGCF_DEVICEINTERFACE              = &h00000010
    
    %HIDP_INPUT                         = 0
    %HIDP_OUTPUT                        = 1
    %HIDP_FEATURE                       = 2
    %HIDP_LINK_COLLECTION_ROOT          = &hFFFF??
    %HIDP_LINK_COLLECTION_UNSPECIFIED   = &h0000??
    %HIDP_KEYBOARD_BREAK                = 0
    %HIDP_KEYBOARD_MAKE                 = 1
    
    '----------------------------------------------------------------------------------------------------------------------
    ' Type declarations
    '----------------------------------------------------------------------------------------------------------------------
    Type HIDD_ATTRIBUTES
      Size                      As Dword
      VendorID                  As Word
      ProductID                 As Word
      VersionNumber             As Word
    End Type
    '..............................................................................
    Type SP_DEVINFO_DATA
      cbSize                    As Dword
      ClassGuid                 As GUIDAPI
      DevInst                   As Dword
      Reserved                  As Dword
    End Type
    '..............................................................................
    Type SP_DEVICE_INTERFACE_DETAIL_DATA
      cbSize                    As Dword
      DevicePath                As String * 512     'Variable sized in C
    End Type
    '..............................................................................
    Type SP_DEVICE_INTERFACE_DATA
      cbSize                    As Dword
      InterfaceClassGuid        As GUIDAPI
      Flags                     As Dword
      Reserved                  As Dword
    End Type
    '..............................................................................
    Type HIDD_CONFIGURATION
      Cookie            As Long
      Size              As Long
      RingBufferSize    As Long
    End Type
    '..............................................................................
    Type USAGE_AND_PAGE
      Usage             As Word
      UsagePage         As Word
    End Type
    '..............................................................................
    Type Range
      UsageMin          As Word
      UsageMax          As Word
      StringMin         As Word
      StringMax         As Word
      DesignatorMin     As Word
      DesignatorMax     As Word
      DataIndexMin      As Word
      DataIndexMax      As Word
    End Type
    '..............................................................................
    Type NotRange
      Usage             As Word
      Reserved1         As Word
      StringIndex       As Word
      Reserved2         As Word
      DesignatorIndex   As Word
      Reserved3         As Word
      DataIndex         As Word
      Reserved4         As Word
    End Type            As Word
    '..............................................................................
    Union RangeOrNot
      Range
      NotRange
    End Union
    '..............................................................................
    Type HIDP_BUTTON_CAPS
      UsagePage         As Word
      ReportID          As Byte
      IsAlias           As Long
      BitField          As Word
      LinkCollection    As Word
      LinkUsage         As Word
      LinkUsagePage     As Word
      IsRange           As Long
      IsStringRange     As Long
      IsDesignatorRange As Long
      IsAbsolute        As Long
      Reserved(9)       As Dword
      RangeOrNot
    End Type
    '..............................................................................
    Type HIDP_LINK_COLLECTION_NODE
      LinkUsage         As Word
      LinkUsagePage     As Word
      Parent            As Dword
      NumberOfChildren  As Dword
      NextSibling       As Dword
      FirstChild        As Dword
      CollectionType    As Bit * 8 In Dword
      IsAlias           As Bit * 1
      Reserved          As Bit * 23
      UserContext       As Dword '// The User can hang his coat here.
    End Type
    '..............................................................................
    Type HIDP_CAPS
      Usage                     As Word
      UsagePage                 As Word
      InputReportByteLength     As Word
      OutputReportByteLength    As Word
      FeatureReportByteLength   As Word
      Reserved(16)              As Word
      NumberLinkCollectionNodes As Word
      NumberInputButtonCaps     As Word
      NumberInputValueCaps      As Word
      NumberInputDataIndices    As Word
      NumberOutputButtonCaps    As Word
      NumberOutputValueCaps     As Word
      NumberOutputDataIndices   As Word
      NumberFeatureButtonCaps   As Word
      NumberFeatureValueCaps    As Word
      NumberFeatureDataIndices  As Word
    End Type
    '..............................................................................
    Type HIDP_VALUE_CAPS
      UsagePage         As Word
      ReportID          As Byte
      IsAlias           As Long
      BitField          As Word
      LinkCollection    As Word
      LinkUsage         As Word
      LinkUsagePage     As Word
      IsRange           As Long
      IsStringRange     As Long
      IsDesignatorRange As Long
      IsAbsolute        As Long
      HasNull           As Long
      Reserved          As Byte
      BitSize           As Word
      ReportCount       As Word
      Reserved(4)       As Word
      LogicalMin        As Dword
      LogicalMax        As Dword
      PhysicalMin       As Long
      PhysicalMax       As Long
      UsageMin          As Word
      UsageMax          As Word
      StringMin         As Word
      StringMax         As Word
      DesignatorMin     As Word
      DesignatorMax     As Word
      DataIndexMin      As Word
      DataIndexMax      As Word
    End Type
    '..............................................................................
    Type HIDP_DATA
      DataIndex         As Word
      Reserved          As Word
      ValueOn           As Dword
    End Type
    '..............................................................................
    Type HIDP_UNKNOWN_TOKEN
      Token             As Byte
      Reserved(2)       As Byte
      BitField          As Dword
    End Type
    '..............................................................................
    Type HIDP_EXTENDED_ATTRIBUTES
      NumGlobalUnknowns As Byte
      Reserved (2)      As Byte
      GlobalUnknowns    As HIDP_UNKNOWN_TOKEN
      nData             As String * 128             'Variable sizes in C...
    End Type
    '..............................................................................
    Type KEYBOARD_MODIFIER_BITS
      LeftControl   As Bit * 1 In Dword
      LeftShift     As Bit * 1
      LeftAlt       As Bit * 1
      LeftGUI       As Bit * 1
      RightControl  As Bit * 1
      RightShift    As Bit * 1
      RightAlt      As Bit * 1
      RigthGUI      As Bit * 1
      CapsLock      As Bit * 1
      ScollLock     As Bit * 1
      NumLock       As Bit * 1
      Reserved      As Bit * 21
    End Type
    '..............................................................................
    Union HIDP_KEYBOARD_MODIFIER_STATE
      KEYBOARD_MODIFIER_BITS
      ul As Dword
    End Union
    
    '======================================================================================================================
    ' API Function declarations
    '----------------------------------------------------------------------------------------------------------------------
    Declare Function CancelIo Lib "kernel32.dll" Alias "CancelIo" (ByVal hFile As Long) As Long
    Declare Function HidD_FreePreparsedData Lib "hid.dll" Alias "HidD_FreePreparsedData" (PreparsedData As Dword) As Long
    Declare Function HidD_GetAttributes Lib "hid.dll" Alias "HidD_GetAttributes" (ByVal HidDeviceObject As Long, Attributes As HIDD_ATTRIBUTES) As Long
    Declare Sub      HidD_GetHidGuid Lib "hid.dll" Alias "HidD_GetHidGuid" (HidGuid As GUIDAPI)
    Declare Function HidD_GetPreparsedData Lib "hid.dll" Alias "HidD_GetPreparsedData" (ByVal HidDeviceObject As Long, PreparsedData As Dword) As Long
    Declare Function HidP_GetCaps Lib "hid.dll" Alias "HidP_GetCaps" (PreparsedData As Dword, Capabilities As HIDP_CAPS) As Long
    Declare Function HidP_GetValueCaps Lib "hid.dll" Alias "HidP_GetValueCaps" (ByVal ReportType As Integer, ValueCaps As Byte, ValueCapsLength As Integer, PreparsedData As Dword) As Long
    Declare Function HidD_GetManufacturerString Lib "hid.dll" Alias "HidD_GetManufacturerString"(ByVal HidDeviceObject As Long, UBuff As String, ByVal UBuffLen As Long) As Long
    Declare Function HidD_GetProductString Lib "hid.dll" Alias "HidD_GetProductString"(ByVal HidDeviceObject As Long, UBuff As String, ByVal UBuffLen As Long) As Long
    Declare Function HidD_GetSerialNumberString Lib "hid.dll" Alias "HidD_GetSerialNumberString"(ByVal HidDeviceObject As Long, UBuff As String, ByVal UBuffLen As Long) As Long
    Declare Function HidD_GetFeature Lib "hid.dll" Alias "HidD_GetFeature"(ByVal HidDeviceObject As Long, ReportBuffer As Any, ByVal ReportBufferLength As Long) As Long
    Declare Function HidD_SetFeature Lib "hid.dll" Alias "HidD_SetFeature"(ByVal HidDeviceObject As Long, ReportBuffer As Any, ByVal ReportBufferLength As Long) As Long
    Declare Function HidD_GetIndexedString Lib "hid.dll" Alias "HidD_GetIndexedString"(ByVal HidDeviceObject As Long, ByVal StringIndex As Long, Buffer As Any, ByVal BufferLength As Long) As Long
    Declare Function HidD_FlushQueue Lib "Hid.dll" Alias "HidD_FlushQueue" (ByVal HidDeviceObject As Dword) As Long
    Declare Function HidD_GetConfiguration Lib "Hid.dll" Alias "HidD_GetConfiguration" (ByVal HidDeviceObject As Dword, Configuration As HIDD_CONFIGURATION, ByVal ConfigurationLength As Dword) As Long
    Declare Function HidD_SetConfiguration Lib "Hid.dll" Alias "HidD_SetConfiguration" (ByVal HidDeviceObject As Dword, Configuration As HIDD_CONFIGURATION, ByVal ConfigurationLength As Dword) As Long
    Declare Function HidD_GetNumInputBuffers Lib "Hid.dll" Alias "HidD_GetNumInputBuffers" (ByVal HidDeviceObject As Dword, ByVal NumberBuffers As Dword) As Long
    Declare Function HidD_SetNumInputBuffers Lib "Hid.dll" Alias "HidD_SetNumInputBuffers" (ByVal HidDeviceObject As Dword, ByVal NumberBuffers As Dword) As Long
    Declare Function HidD_GetPhysicalDescriptor Lib "Hid.dll" Alias "HidD_GetPhysicalDescriptor" (ByVal HidDeviceObject As Dword, Buffer As Dword, ByVal BufferLength As Dword) As Long
    
    Declare Function SetupDiCreateDeviceInfoList Lib "setupapi.dll" Alias "SetupDiCreateDeviceInfoList" (ClassGuid As GUIDAPI, ByVal hwndParent As Long) As Long
    Declare Function SetupDiDestroyDeviceInfoList Lib "setupapi.dll" Alias "SetupDiDestroyDeviceInfoList" (ByVal DeviceInfoSet As Long) As Long
    Declare Function SetupDiEnumDeviceInterfaces Lib "setupapi.dll" Alias "SetupDiEnumDeviceInterfaces" (ByVal DeviceInfoSet As Long, ByVal DeviceInfoData As Long, _
                                    InterfaceClassGuid As GUIDAPI, ByVal MemberIndex As Long, DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA) As Long
    Declare Function SetupDiGetClassDevs Lib "setupapi.dll" Alias "SetupDiGetClassDevsA" (ClassGuid As GUIDAPI, Enumerator As Asciiz, ByVal hwndParent As Long, _
                                    ByVal Flags As Long) As Long
    Declare Function SetupDiGetDeviceInterfaceDetail Lib "setupapi.dll" Alias "SetupDiGetDeviceInterfaceDetailA" (ByVal DeviceInfoSet As Long, DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA, _
                                    DeviceInterfaceDetailData As SP_DEVICE_INTERFACE_DETAIL_DATA, ByVal DeviceInterfaceDetailDataSize As Long, RequiredSize As Long, DeviceInfoData As SP_DEVINFO_DATA) As Long
    
    Declare Function HidP_GetButtonCaps Lib "Hid.dll" Alias "HidP_GetButtonCaps" (ByVal ReportType As Dword, ButtonCaps As HIDP_BUTTON_CAPS , ButtonCapsLength As Word, PreparsedData As Dword) As Long
    Declare Function HidP_GetSpecificButtonCaps Lib "Hid.dll" Alias "HidP_GetSpecificButtonCaps" (ByVal ReportType As Dword, ByVal UsagePage As Word, ByVal LinkCollection As Word, ByVal Usage As Word, _
                     ButtonCaps As HIDP_BUTTON_CAPS , ButtonCapsLength As Word, PreparsedData As Dword) As Long
    Declare Function HidP_GetSpecificValueCaps Lib "Hid.dll" Alias "HidP_GetSpecificValueCaps" (ByVal ReportType As Dword, ByVal UsagePage As Word, ByVal LinkCollection As Word, ByVal Usage As Word, _
                     ValueCaps As HIDP_VALUE_CAPS, ValueCapsLength As Word, PreparsedData As Dword) As Long
    Declare Function HidP_GetExtendedAttributes Lib "Hid.dll" Alias "HidP_GetExtendedAttributes" (ByVal ReportType As Dword, ByVal DataIndex As Word, PreparsedData As Dword, _
                     Attributes As HIDP_EXTENDED_ATTRIBUTES, LengthAttributes As Dword) As Long
    Declare Function HidP_InitializeReportForID Lib "Hid.dll" Alias "HidP_InitializeReportForID" (ByVal ReportType As Dword, ByVal ReportID As Byte, PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    Declare Function HidP_SetData Lib "Hid.dll" Alias "HidP_SetData" (ByVal ReportType As Dword, DataList As HIDP_DATA, DataLength As Dword, PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    Declare Function HidP_GetData Lib "Hid.dll" Alias "HidP_GetData" (ByVal ReportType As Dword, DataList As HIDP_DATA, DataLength As Dword, PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    Declare Function HidP_MaxDataListLength Lib "Hid.dll" Alias "HidP_MaxDataListLength" (ByVal ReportType As Dword, PreparsedData As Dword) As Dword
    Declare Function HidP_SetUsages Lib "Hid.dll" Alias "HidP_SetUsages" (ByVal ReportType As Dword, ByVal UsagePage As Word, ByVal LinkCollection As Word, UsageList As Word, UsageLength As Dword, _
                     PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    Declare Function HidP_UnsetUsages Lib "Hid.dll" Alias "HidP_UnsetUsages" (ByVal ReportType As Dword, ByVal UsagePage As Word, ByVal LinkCollection As Word, UsageList As Word, UsageLength As Dword, _
                     PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    Declare Function HidP_GetUsages Lib "Hid.dll" Alias "HidP_GetUsages" (ByVal ReportType As Dword, ByVal UsagePage As Word, ByVal LinkCollection As Word, UsageList As Word,  UsageLength As Dword, _
                     PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    Declare Function HidP_GetUsagesEx Lib "Hid.dll" Alias "HidP_GetUsagesEx" (ByVal ReportType As Dword, ByVal LinkCollection As Word, ButtonList As USAGE_AND_PAGE,  UsageLength As Dword, _
                     PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    Declare Function HidP_SetUsageValue Lib "Hid.dll" Alias "HidP_SetUsageValue" (ByVal ReportType As Dword, ByVal UsagePage As Word, ByVal LinkCollection As Word, ByVal Usage As Word, ByVal UsageValue As Dword, _
                     PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    Declare Function HidP_GetUsageValue Lib "Hid.dll" Alias "HidP_GetUsageValue" (ByVal ReportType As Dword, ByVal UsagePage As Word, ByVal LinkCollection As Word, ByVal Usage As Word, UsageValue As Dword, _
                     PreparsedData As Dword, Report As Any, ByVal ReportLength As Dword) As Long
    
    #EndIf
    '======================================================================================================================
    The dbt.inc file: (device_broadcast declarations from dbt.h)

    Code:
    '==================================================================================================
    ' Title:      DBT.INC - Equates for WM_DEVICECHANGE and BroadcastSystemMessage
    ' Version:    4.00
    ' Date:       24-May-1993
    ' Pb version: Peter Lameijn, 11 dec 2007
    '==================================================================================================
    
    #If Not %Def(%DBT_INC)
      %DBT_INC = 1
    
    %WM_DEVICECHANGE         = &h0219
    
    '--------------------------------------------------------------------------------------------------
    ' Broadcast message and receipient flags.
    ' Note that there is a third "flag". If the wParam has:
    ' - bit 15 On:   lparam is pointer and bit 14 is meaningfull, Off:  lparam is just a DWORD.
    ' - bit 14 on:   lparam is pointer to an ASCIIZ string, Off:  lparam is pointer to a binary struct.
    '                starting with a dword describing the length of the structure.
    '--------------------------------------------------------------------------------------------------
    %BSF_QUERY              = &h00000001
    %BSF_IGNORECURRENTTASK  = &h00000002            'Meaningless for VxDs
    %BSF_FLUSHDISK          = &h00000004            'Shouldn't be used by VxDs
    %BSF_NOHANG             = &h00000008
    %BSF_POSTMESSAGE        = &h00000010
    %BSF_FORCEIFHUNG        = &h00000020
    %BSF_NOTIMEOUTIFNOTHUNG = &h00000040
    %BSF_MSGSRV32ISOK       = &h80000000            'Called synchronously from PM API
    %BSF_MSGSRV32ISOK_BIT   = 31                    'Called synchronously from PM API
    
    %BSM_ALLCOMPONENTS      = &h00000000
    %BSM_VXDS               = &h00000001
    %BSM_NETDRIVER          = &h00000002
    %BSM_INSTALLABLEDRIVERS = &h00000004
    %BSM_APPLICATIONS       = &h00000008
    
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam  = DBT_APPYBEGIN, lParam  = (not used)
    ' 'Appy-time is now available.  This message is itself sent at 'Appy-time.
    %DBT_APPYBEGIN          = &h0000
    '
    ' Message = WM_DEVICECHANGE, wParam  = DBT_APPYEND, lParam  = (not used)
    ' 'Appy-time is no longer available.  This message is *NOT* sent at 'Appy-time.
    ' (It cannot be, because 'Appy-time is gone.)
    %DBT_APPYEND            = &h0001
    '
    ' NOTE! It is possible for DBT_APPYBEGIN and DBT_APPYEND to be sent multiple times during a single
    ' Windows session. Each appearance of 'Appy-time is bracketed by these two messages, but 'Appy-time
    ' may momentarily become unavailable during otherwise normal Windows processing. The current status
    ' of 'Appy-time availability can always be obtained from a call to _SHELL_QueryAppyTimeAvailable.
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam  = DBT_DEVNODES_CHANGED, lParam  = 0
    ' send when configmg finished a process tree batch. Some devnodes may have been added or removed.
    ' This is used by ring3 people which need to be refreshed whenever any devnode changed occur (like
    ' device manager). People specific to certain devices should use DBT_DEVICE* instead.
    %DBT_DEVNODES_CHANGED   = &h0007
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam  = DBT_QUERYCHANGECONFIG, lParam  = 0
    ' sent to ask if a config change is allowed
    %DBT_QUERYCHANGECONFIG  = &h0017
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam  = DBT_CONFIGCHANGED, lParam  = 0
    ' sent when a config has changed
    %DBT_CONFIGCHANGED      = &h0018
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam  = DBT_CONFIGCHANGECANCELED, lParam  = 0
    ' someone cancelled the config change
    %DBT_CONFIGCHANGECANCELED = &h0019
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam = DBT_MONITORCHANGE, lParam  = new resolution to use(LO=x,HI=y)
    ' if 0, use the default res for current config
    ' message is sent when the display monitor changed and the system should change the mode to match.
    %DBT_MONITORCHANGE      = &h001B
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam = DBT_SHELLLOGGEDON, lParam  = 0
    ' The shell has finished login on: VxD can now do Shell_EXEC.
    %DBT_SHELLLOGGEDON      = &h0020
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam = DBT_CONFIGMGAPI, lParam = CONFIGMG API Packet
    ' CONFIGMG ring 3 call.
    %DBT_CONFIGMGAPI32      = &h0022
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam = DBT_VXDINITCOMPLETE, lParam  = 0
    ' CONFIGMG ring 3 call.
    %DBT_VXDINITCOMPLETE    = &h0023
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam = DBT_VOLLOCK(ByRef), lParam  = VolLockBroadcast struct(ByRef)
    ' Messages issued by IFSMGR for volume locking purposes on WM_DEVICECHANGE. All these messages
    ' pass a pointer to a struct which has no pointers.
    %DBT_VOLLOCKQUERYLOCK       = &h8041
    %DBT_VOLLOCKLOCKTAKEN       = &h8042
    %DBT_VOLLOCKLOCKFAILED      = &h8043
    %DBT_VOLLOCKQUERYUNLOCK     = &h8044
    %DBT_VOLLOCKLOCKRELEASED    = &h8045
    %DBT_VOLLOCKUNLOCKFAILED    = &h8046
    
    '--------------------------------------------------------------------------------------------------
    Type DEV_BROADCAST_HDR                          'Device broadcast header
      dbch_size         As Dword
      dbch_devicetype   As Dword
      dbch_reserved     As Dword
    End Type
    '--------------------------------------------------------------------------------------------------
    Type VolLockBroadcast                           'Structure for volume Lock broadcast
      vlb_dbh           As DEV_BROADCAST_HDR
      vlb_owner         As Dword                    'Thread on which Lock request is being issued
      vlb_perms         As Byte                     'Lock permission flags defined below
      vlb_lockType      As Byte                     'Type of Lock
      vlb_drive         As Byte                     'Drive on which Lock is issued
      vlb_flags         As Byte                     'Miscellaneous flags
    End Type
    '--------------------------------------------------------------------------------------------------
    ' Values for vlb_perms
    %LOCKP_ALLOW_WRITES         = &h01              'Bit 0 set - allow writes
    %LOCKP_FAIL_WRITES          = &h00              'Bit 0 clear - fail writes
    %LOCKP_FAIL_MEM_MAPPING     = &h02              'Bit 1 set - fail memory mappings
    %LOCKP_ALLOW_MEM_MAPPING    = &h00              'Bit 1 clear - allow memory mappings
    %LOCKP_USER_MASK            = &h03              'Mask for user lock flags
    %LOCKP_LOCK_FOR_FORMAT      = &h04              'Level 0 lock for format
    '--------------------------------------------------------------------------------------------------
    ' Values for vlb_flags
    %LOCKF_LOGICAL_LOCK         = &h00              'Bit 0 clear - logical lock
    %LOCKF_PHYSICAL_LOCK        = &h01              'Bit 0 set - physical lock
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam = DBT_NODISKSPACE, lParam = nr of drive that's out of diskspace (1-based)
    ' Message issued by IFS manager when it detects that a drive is run out of free space.
    %DBT_NO_DISK_SPACE          = &h0047
    '--------------------------------------------------------------------------------------------------
    ' Message = WM_DEVICECHANGE, wParam = DBT_LOW_DISK_SPACE, lParam = nr of drive that's low on diskspace (1-based)
    ' Message issued by VFAT when it detects that a drive it has mounted has the remaning free space
    ' below a threshold specified by the registry or by a disk space management application.
    ' The broadcast is issued by VFAT ONLY when space is either allocated or freed by VFAT.
    %DBT_LOW_DISK_SPACE         = &h0048
    %DBT_CONFIGMGPRIVATE        = &h7FFF
    '--------------------------------------------------------------------------------------------------
    ' The following messages are for WM_DEVICECHANGE. The immediate list is for the wParam. ALL THESE
    ' MESSAGES PASS A POINTER TO A STRUCT STARTING WITH A DWORD SIZE AND HAVING NO POINTER IN THE STRUCT.
    %DBT_DEVICEARRIVAL              = &h8000???        'system detected a new device
    %DBT_DEVICEQUERYREMOVE          = &h8001???        'wants to remove, may fail
    %DBT_DEVICEQUERYREMOVEFAILED    = &h8002???        'removal aborted
    %DBT_DEVICEREMOVEPENDING        = &h8003???        'about to remove, still avail.
    %DBT_DEVICEREMOVECOMPLETE       = &h8004???        'device is gone
    %DBT_DEVICETYPESPECIFIC         = &h8005???        'type specific event
    %DBT_CUSTOMEVENT                = &h8006???        'user-defined event
    
    %DBT_DEVTYP_OEM                 = &h00000000    'oem-defined device type
    %DBT_DEVTYP_DEVNODE             = &h00000001    'devnode number
    %DBT_DEVTYP_VOLUME              = &h00000002    'logical volume
    %DBT_DEVTYP_PORT                = &h00000003    'serial, parallel
    %DBT_DEVTYP_NET                 = &h00000004    'network resource
    
    %DBT_DEVTYP_DEVICEINTERFACE     = &h00000005    'device interface class
    %DBT_DEVTYP_HANDLE              = &h00000006    'file system handle
    
    Type DEV_BROADCAST_HEADER
      dbcd_size         As Dword
      dbcd_devicetype   As Dword
      dbcd_reserved     As Dword
    End Type
    
    Type DEV_BROADCAST_OEM
      dbco_size         As Dword
      dbco_devicetype   As Dword
      dbco_reserved     As Dword
      dbco_identifier   As Dword
      dbco_suppfunc     As Dword
    End Type
    
    Type DEV_BROADCAST_DEVNODE
      dbcd_size         As Dword
      dbcd_devicetype   As Dword
      dbcd_reserved     As Dword
      dbcd_devnode      As Dword
    End Type
    
    Type DEV_BROADCAST_VOLUME
      dbcv_size         As Dword
      dbcv_devicetype   As Dword
      dbcv_reserved     As Dword
      dbcv_unitmask     As Dword
      dbcv_flags        As Word
    End Type
    
    %DBTF_MEDIA         = &h0001                    'media comings and goings
    %DBTF_NET           = &h0002                    'network volume
    
    Type DEV_BROADCAST_PORT_A
      dbcp_size         As Dword
      dbcp_devicetype   As Dword
      dbcp_reserved     As Dword
      dbcp_name         As String * 128
    End Type
    
    Type DEV_BROADCAST_PORT_W
      dbcp_size         As Dword
      dbcp_devicetype   As Dword
      dbcp_reserved     As Dword
      dbcp_name         As String * 256
    End Type
    
    Type DEV_BROADCAST_PORT
      DEV_BROADCAST_PORT_A
    End Type
    
    Type DEV_BROADCAST_NET
      dbcn_size         As Dword
      dbcn_devicetype   As Dword
      dbcn_reserved     As Dword
      dbcn_resource     As Dword
      dbcn_flags        As Dword
    End Type
    
    Type DEV_BROADCAST_DEVICEINTERFACE_A
      dbcc_size         As Dword
      dbcc_devicetype   As Dword
      dbcc_reserved     As Dword
      dbcc_classguid    As GuidAPI
      dbcc_name         As String * 128
    End Type
    
    Type DEV_BROADCAST_DEVICEINTERFACE_W
      dbcc_size         As Dword
      dbcc_devicetype   As Dword
      dbcc_reserved     As Dword
      dbcc_classguid    As GuidAPI
      dbcc_name         As String * 256
    End Type
    
    
    Type DEV_BROADCAST_DEVICEINTERFACE
      DEV_BROADCAST_DEVICEINTERFACE_A
    End Type
    
    Type DEV_BROADCAST_HANDLE
      dbch_size         As Dword
      dbch_devicetype   As Dword
      dbch_reserved     As Dword
      dbch_handle       As Dword                    'File handle used in call to RegisterDeviceNotification
      dbch_hdevnotify   As Dword                    'HDEVNOTIFY returned from RegisterDeviceNotification
      dbch_eventguid    As GuidAPI
      dbch_nameoffset   As Long                     'offset (bytes) variable-length string buffer (-1 if none)
      dbch_data         As String * 128             'vari-sized buff, containing binary and/or text data
    End Type
    
    %DBTF_RESOURCE      = &h00000001                'network resource
    %DBTF_XPORT         = &h00000002                'new transport coming or going
    %DBTF_SLOWNET       = &h00000004                'new incoming transport is slow
                                                    '(dbcn_resource undefined for now)
    
    %DBT_VPOWERDAPI     = &h8100                    'VPOWERD API for Win95
    
    '--------------------------------------------------------------------------------------------------
    ' User-defined message types all use wParam = 0xFFFF with the lParam a pointer to the struct below.
    ' dbud_dbh - DEV_BROADCAST_HEADER must be filled in as usual.
    ' dbud_szName contains a case-sensitive ASCIIZ name which names the message. The message name
    ' consists of the vendor name, a backslash, then arbitrary user-defined ASCIIZ text. For example:
    ' "WidgetWare\QueryScannerShutdown"
    ' "WidgetWare\Video Q39S\AdapterReady"
    ' After the ASCIIZ name, arbitrary information may be provided. Make sure that dbud_dbh.dbch_size
    ' is big enough to encompass all the data. And remember nothing in the struct may contain pointers.
    %DBT_USERDEFINED    = &hFFFF
    
    Type DEV_BROADCAST_USERDEFINED
      dbud_dbh              As DEV_BROADCAST_HDR
      dbud_szName           As String * 128         'ASCIIZ name
      dbud_rgbUserDefined   As String * 128         'User-defined contents
    End Type
    
    #EndIf                  'DBT.INC
    Last edited by Peter Lameijn; 11 Dec 2007, 01:10 PM.

    Leave a comment:


  • Pierre Bellisle
    replied
    Also, for WMI USB info, one can put "USB" in the search box of wmi info ...
    Win32_USBControllerDevice give interesting result.
    Last edited by Pierre Bellisle; 11 Dec 2007, 12:42 PM.

    Leave a comment:


  • Peter Lameijn
    replied
    Thanks,

    I'll try the examples.

    It seems you can also use RegisterDeviceNotification, but I'm not really sure yet how to use it...

    Leave a comment:


  • Bill Eppler
    replied
    Cliff,

    I would really be interested in the part of your code which grabs "the Vendor / Product ID" if you would care to share.

    Thanks

    Leave a comment:


  • Cliff Nichols
    replied
    Pierre's sample is almost an exact match to mine. with some minor differences like he used a List where I used messageboxes (I like his better...less annoying, and you see what order they fired in)

    According to the docs I have seen, there is no guarantees as to what order the events fire though. (*HINT HINT*)

    I will have to look closer at Pierre's example and compare with mine (maybe I have some he doesn't have defined, or vice versa).

    All in all polling for a device attach or detach would really be a waste of time and resources since Windows already does it for you. Although the more I research USB the more minor situations I find that you could possibly miss an event. (So far PB samples have caught them all, so I have a lot of research left to do).

    Peter, part of the code I was working on (work in progress) does grab the Vendor / Product ID, but still a work in progress...but if you would like I could see if I could break it down to an example to help get you going.

    Leave a comment:


  • Michael Mattias
    replied
    I thought there was a WM_something notification message broadcast when this happens but I could not find it yesterday when I looked. Hell, there's a WM_something broadcast for just about every 'event.'

    I tried eight or ten 'search' keys but for some reason but never even considered the word "device."

    Well, I'll remember it now. At least until lunchtime anyway.

    Leave a comment:


  • Pierre Bellisle
    replied
    Hey Peter,

    How about this one ?

    or this one...

    also
    Code:
    #COMPILE EXE '#Win 804#
    #REGISTER NONE
    #DIM ALL
    #INCLUDE "Win32Api.Inc" '2003-05-27
     
    GLOBAL hList AS DWORD
     
    %Listbox = 101
    %Button  = 201
     
    'From DBT.H - Equates for WM_DEVICECHANGE and BroadcastSystemMessage
    %WM_DEVICECHANGE             = &H0219
     
    'DEV_BROADCAST_HDR Structure
    %DBT_DEVTYP_OEM              = 0 'OEM- or IHV-defined device type.
    %DBT_DEVTYP_VOLUME           = 2 'Logical volume
    %DBT_DEVTYP_PORT             = 3 'Port device (serial or parallel).
    %DBT_DEVTYP_DEVICEINTERFACE  = 5 'Class of devices.
    %DBT_DEVTYP_HANDLE           = 6 'File system handle.
     
    '%WM_DEVICECHANGE/CBWPARAM specifies the event/CBLPARAM specifies data
    %DBT_DEVNODES_CHANGED        = &H0007& 'Device has been added or removed CBLPARAM = zero
    %DBT_QUERYCHANGECONFIG       = &H0017& '
    %DBT_CONFIGCHANGED           = &H0018& '
    %DBT_CONFIGCHANGECANCELED    = &H0019& '
    %DBT_DEVICEARRIVAL           = &H8000& 'System detected a new device
    %DBT_DEVICEQUERYREMOVE       = &H8001& 'Wants to remove, may fail
    %DBT_DEVICEQUERYREMOVEFAILED = &H8002& 'Removal aborted
    %DBT_DEVICEREMOVEPENDING     = &H8003& 'About to remove, still available
    %DBT_DEVICEREMOVECOMPLETE    = &H8004& 'Device is gone
    %DBT_DEVICETYPESPECIFIC      = &H8005& 'Type specific event
    %DBT_CUSTOMEVENT             = &H8006& '
    %DBT_USERDEFINED             = &HFFFF& '
     
    'Drive or media, networked or not
    %DBTF_MEDIA                  = 1     'Media comings and goings
    %DBTF_NET                    = 2     'Network volume
     
    TYPE DEV_BROADCAST_HDR
      dbch_size       AS DWORD
      dbch_devicetype AS DWORD
      dbch_reserved   AS DWORD
    END TYPE
     
    TYPE DEV_BROADCAST_OEM
      dbco_size       AS DWORD 'Specifies the size of this structure, in bytes.
      dbco_devicetype AS DWORD 'Set to the device type DBT_DEVTYPE_OEM.
      dbco_reserved   AS DWORD 'Reserved; do not use.
      dbco_identifier AS DWORD 'An OEM-specific identifier for the device.
      dbco_suppfunc   AS DWORD 'An OEM-specific function value. Possible values depend on the device.
    END TYPE
     
    TYPE DEV_BROADCAST_VOLUME
      dbch_size       AS DWORD 'Specifies the size of this structure, in bytes.
      dbch_devicetype AS DWORD 'Set to the device type DBT_DEVTYP_VOLUME.
      dbch_reserved   AS DWORD 'Reserved; do not use.
      dbcv_unitmask   AS DWORD 'Logical drive, bit 0 is A:, bit 1 is B:...
      dbcv_flags      AS WORD  'Specifies whether drive or media is affected.
                               'This parameter can be one of the following values.
                               ' %DBTF_MEDIA Change affects media in drive. If not set,
                               '             change affects physical device or drive.
    END TYPE                   ' %DBTF_NET   Indicated logical volume is a network volume.
     
    TYPE DEV_BROADCAST_PORT
      dbcp_size       AS DWORD 'Specifies the size of this structure, in bytes.
      dbcp_devicetype AS DWORD 'Set to the device type DBT_DEVTYP_PORT.
      dbcp_reserved   AS DWORD 'Reserved; do not use.
      dbcp_name(0)    AS BYTE  'A null-terminated string specifying the friendly name of the port/device.
    END TYPE
     
    TYPE DEV_BROADCAST_DEVICEINTERFACE
      dbcc_size       AS DWORD 'Specifies the size, in bytes, of this structure.
      dbcc_devicetype AS DWORD 'Set to the device type DBT_DEVTYP_DEVICEINTERFACE
      dbcc_reserved   AS DWORD 'Reserved; do not use.
      dbcc_classguid  AS DWORD 'A globally unique identifier (GUID) for the interface device class.
      dbcc_name(0)    AS BYTE  'A null-terminated string specifying the name of the device.
    END TYPE
     
    TYPE DEV_BROADCAST_HANDLE
      dbch_size       AS DWORD 'Specifies the size, in bytes, of this structure.
      dbch_devicetype AS DWORD 'Set to the DBT_DEVTYP_HANDLE device type.
      dbch_reserved   AS DWORD 'Reserved; do not use.
      dbch_handle     AS DWORD 'Handle specified in the call to the RegisterDeviceNotification function.
      dbch_hdevnotify AS DWORD 'Handle to device notification, returned by the RegisterDeviceNotification.
      'The following are valid only for DBT_CUSTOMEVENT
      dbch_eventguid  AS GUID  'A globally unique identifier (GUID) for the custom event.
      dbch_nameoffset AS LONG  'The offset of an optional string buffer.
      dbch_data(0)    AS BYTE  'Optional binary data.
    END TYPE
     
    '______________________________________________________________________________
     
    FUNCTION LA(sItem AS STRING) AS LONG 'ListAdd
     LOCAL LastItem AS LONG
     
     LastItem = SendMessage(hList, %LB_ADDSTRING, 0, BYVAL STRPTR(sItem))
     SendMessage hList, %LB_SETCURSEL, LastItem, 0  'Select an item and scroll it to view
     SendMessage hList, %LB_SETCURSEL, -1, 0        'UnHighlight item
     
    END FUNCTION
    '______________________________________________________________________________
     
    CALLBACK FUNCTION DlgProc
     LOCAL Device_HDR    AS DEV_BROADCAST_HDR POINTER
     LOCAL Device_Volume AS DEV_BROADCAST_VOLUME POINTER
     LOCAL sDriveLetter  AS STRING
     LOCAL sBuffer       AS STRING
     
     SELECT CASE AS LONG CBMSG
     
       CASE %WM_DEVICECHANGE
         SELECT CASE CBWPARAM
     
           CASE %DBT_DEVICEARRIVAL, %DBT_DEVICEREMOVECOMPLETE
             IF CBWPARAM = %DBT_DEVICEARRIVAL THEN
               LA "%DBT_DEVICEARRIVAL"
             ELSE
               LA "%DBT_DEVICEREMOVECOMPLETE"
             END IF
             Device_HDR = CBLPARAM
             SELECT CASE @Device_HDR.dbch_devicetype
     
               CASE %DBT_DEVTYP_OEM             'OEM- or IHV-defined device type.
                 IF CBWPARAM = %DBT_DEVICEARRIVAL THEN
                   sBuffer = "%DBT_DEVTYP_OEM inserted."
                 ELSE
                   sBuffer = "%DBT_DEVTYP_OEM removed."
                 END IF
                 LA sBuffer
     
               CASE %DBT_DEVTYP_VOLUME          'Logical volume
                 Device_Volume = CBLPARAM
                 IF (@Device_Volume.dbcv_flags AND %DBTF_MEDIA) THEN
                   sBuffer = "Media "
                 ELSE
                   sBuffer = "Physical device "
                 END IF
                 IF (@Device_Volume.dbcv_flags AND %DBTF_NET) THEN
                   sBuffer = "Networked " & sBuffer
                 END IF
                 sDriveLetter = CHR$((26 - INSTR(BIN$(@Device_Volume.dbcv_unitmask, 26), "1")) + 65) & ":"
                 IF CBWPARAM = %DBT_DEVICEARRIVAL THEN
                   sBuffer = sBuffer & sDriveLetter & " inserted."
                 ELSE
                   sBuffer = sBuffer & sDriveLetter & " removed."
                 END IF
                 LA sBuffer
     
               CASE %DBT_DEVTYP_PORT            'Port device (serial or parallel).
                 IF CBWPARAM = %DBT_DEVICEARRIVAL THEN
                   sBuffer = "%DBT_DEVTYP_PORT inserted."
                 ELSE
                   sBuffer = "%DBT_DEVTYP_PORT removed."
                 END IF
                 LA sBuffer
     
               CASE %DBT_DEVTYP_DEVICEINTERFACE 'Class of devices.
                 sBuffer = "%DBT_DEVTYP_DEVICEINTERFACE"
                 LA sBuffer
     
               CASE %DBT_DEVTYP_HANDLE          'File system handle.
                 sBuffer = "%DBT_DEVTYP_HANDLE"
                 LA sBuffer
     
             END SELECT
     
           CASE %DBT_DEVNODES_CHANGED        'Device has been added or removed CBLPARAM = zero
             LA "%DBT_DEVNODES_CHANGED"
           CASE %DBT_QUERYCHANGECONFIG       '
             LA "%DBT_QUERYCHANGECONFIG"
           CASE %DBT_CONFIGCHANGED           '
             LA "%DBT_CONFIGCHANGED"
           CASE %DBT_CONFIGCHANGECANCELED    '
             LA "%DBT_CONFIGCHANGECANCELED"
           CASE %DBT_DEVICEARRIVAL           'System detected a new device
             LA "%DBT_DEVICEARRIVAL"
           CASE %DBT_DEVICEQUERYREMOVE       'Wants to remove, may fail
             LA "%DBT_DEVICEQUERYREMOVE"
           CASE %DBT_DEVICEQUERYREMOVEFAILED 'Removal aborted
             LA "%DBT_DEVICEQUERYREMOVEFAILED"
           CASE %DBT_DEVICEREMOVEPENDING     'About to remove, still available
             LA "%DBT_DEVICEREMOVEPENDING"
           CASE %DBT_DEVICEREMOVECOMPLETE    'Device is gone
             LA "%DBT_DEVICEREMOVECOMPLETE"
           CASE %DBT_DEVICETYPESPECIFIC      'Type specific event
             LA "%DBT_DEVICETYPESPECIFIC"
           CASE %DBT_CUSTOMEVENT             '
             LA "%DBT_CUSTOMEVENT"
           CASE %DBT_USERDEFINED             '
             LA "%DBT_USERDEFINED"
           CASE ELSE
             LA "%WM_DEVICECHANGE " & HEX$(CBWPARAM)
     
         END SELECT
     
      END SELECT
     
    END FUNCTION
    '______________________________________________________________________________
     
    FUNCTION PBMAIN()
     LOCAL hDlg AS DWORD
     
     DIALOG NEW %HWND_DESKTOP ,"WM_DEVICECHANGE - notify", , , 200, 200, _
       %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU, %WS_EX_TOPMOST TO hDlg
     SetClassLong hDlg, %GCL_HICON, LoadIcon(BYVAL %NULL, BYVAL %IDI_INFORMATION) 'Set a nice icon
     
     CONTROL ADD LISTBOX, hDlg, %Listbox, , 5, 5, 190, 190, %LBS_NOTIFY OR %WS_TABSTOP OR %WS_VSCROLL, %WS_EX_LEFT
     hList = GetDlgItem(hDlg, %ListBox)
     LA "Insert or remove a device"
     
     DIALOG SHOW MODAL hDlg CALL DlgProc
     
    END FUNCTION
    '______________________________________________________________________________
    Last edited by Pierre Bellisle; 8 Dec 2007, 07:16 PM.

    Leave a comment:


  • Peter Lameijn
    started a topic USB device attach

    USB device attach

    Is it possible for a program to receive a message if a USB device attaches itself? (If possible with a certain Vendor / Product ID)

    Or is the only way polling / enumerating continously until it's found?...
Working...
X