Announcement

Collapse
No announcement yet.

My first serial communications app

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

  • Rick McNeely
    replied
    oops

    close should be in a different place.

    Code:
    #COMPILE EXE
    #DIM ALL
    
    FUNCTION PBMAIN () AS LONG
        DIM i AS LONG
        DIM hcomm AS LONG
        DIM a AS STRING
        
        FOR i = 1 TO 9
          hComm = FREEFILE
          ERRCLEAR
          COMM OPEN "COM" & TRIM$(STR$(i)) AS #hComm
    
          IF ERR THEN
            COLOR  7,0
            STDOUT "COM Port#" & TRIM$(STR$(i)) & " NOT available. ErrCode =" & STR$(ERR)
            ERRCLEAR
          ELSE
            COLOR 14,4
            STDOUT "COM Port#" & TRIM$(STR$(i)) & " IS  available.   "
          END IF
          COMM CLOSE #hComm
        NEXT i
    
        STDOUT "Press any key to continue...
        DO
          a = INKEY$
          IF a <> "" THEN EXIT LOOP
        LOOP
    
    END FUNCTION

    Leave a comment:


  • Rick McNeely
    replied
    simple routine

    I have used this in the past to return a list of available ports.

    written for Console Compiler.

    Code:
    #COMPILE EXE
    #DIM ALL
    
    FUNCTION PBMAIN () AS LONG
        DIM i AS LONG
        DIM hcomm AS LONG
        DIM a AS STRING
        
        FOR i = 1 TO 9
        hComm = FREEFILE
        ERRCLEAR
        COMM OPEN "COM" & TRIM$(STR$(i)) AS #hComm
        'A = waitkey$
          IF ERR THEN
            COLOR  7,0
            STDOUT "COM Port#" & TRIM$(STR$(i)) & " NOT available. ErrCode =" & STR$(ERR)
            ERRCLEAR
          ELSE
            COLOR 14,4
            STDOUT "COM Port#" & TRIM$(STR$(i)) & " IS  available.   "
          END IF
        NEXT i
    
        COMM CLOSE #hComm
        
        STDOUT "Press any key to continue...
        DO
          a = INKEY$
          IF a <> "" THEN EXIT LOOP
        LOOP
    
    END FUNCTION

    Leave a comment:


  • Cliff Nichols
    replied
    Although not supposed to be in Source Code Forum

    Although not supposed to be in the Source Code Forum, still a nice bit of Info
    Paul Franks wrote:
    Wmi
    You may want to look into using WMI to get this (and a whole lot more). WMI is Microsoft's version of CIM.

    Pierre Bellisle put together an execellent application in PB, using Jose Roca's WMI wrapper, that lets you get information on serial ports and just about anything else on your PC:

    WMI System Information
    __________________

    --pdf
    Although the most EXCELLENT and simplest example I have seen to date involving COM (not Serial Port "COM"), I shy away from ActiveX type of concepts since my VB days and learning that although good for most cases, not good for all cases. (For example "MSCOMM " which is M$ ActiveX wrapper to the Serial port, and although good for most cases, it is SERIOUSLY flawed in some areas such as speed, or certain port configurations)
    (Probably why I also dislike 3rd party solutions unless I seriously need it and do not have time to research how to do it myself)

    Anyways WMI is usually quite confusing, but I will admit Pierre and Jose have always been able to show a "Complex" idea in a "Simple" matter, so in this case I may have to take a second look at concepts that I may be "Re-Inventing the Wheel" just because "The Wheel" is ActiveX, does not always mean it is a bad wheel.

    (Although personally, I find great satisfaction in learning the concept of how things work, rather than just blindly using the tool at hand. but that is just me)

    Leave a comment:


  • Cliff Nichols
    replied
    Code in Source Code

    Jeffrey,
    I trimmed things down to just Serial Port info (just the basic "Does it exist?, Can I use it?") code, and posted in the Source Code forum. You should be able to get a grasp of that much sooner than all the code I posted above.

    Cliff

    Leave a comment:


  • Jeffrey W Smith
    replied
    Holy crap Cliff! I never thought it would be that much. Thank you.

    It looks like I'm going to have to sift through some code and find what I need for right now.

    Jeff

    Leave a comment:


  • Cliff Nichols
    replied
    On to the Header Files

    On to the header files....and again I am sorry it is so huge, but I think I broke it down fairly well so you can strip out what you do not need. (In this case I would say 90% that could be ripped is the RTF stuff)

    DlgAbout.h
    Code:
    DECLARE FUNCTION About_Dialog_Proc( _
        BYVAL hWnd    AS DWORD, _ ' window handle
        BYVAL uMsg    AS DWORD, _ ' type of message
        BYVAL wParam  AS DWORD, _ ' first message parameter
        BYVAL lParam  AS LONG _   ' second message parameter
        ) AS LONG
    
    DECLARE FUNCTION LoadAbout ALIAS "LoadAbout"(HwndOwner AS LONG) AS LONG
    DECLARE FUNCTION UnLoadAbout ALIAS "UnLoadAbout"() AS LONG
    DECLARE FUNCTION ShowAbout ALIAS "ShowAbout"() AS LONG
    DECLARE FUNCTION HideAbout ALIAS "HideAbout"() AS LONG
    DECLARE FUNCTION ShowRtfTextAbout ALIAS "ShowRtfTextAbout"() AS LONG
    DECLARE FUNCTION BuildRtfTextAboutComputer ALIAS "BuildRtfTextAboutComputer"() AS LONG
    DECLARE FUNCTION BuildRtfTextAboutSoftware ALIAS "BuildRtfTextAboutSoftware"() AS LONG
    
    DECLARE FUNCTION BuildRtfTextAboutUsbDriver ALIAS "BuildRtfTextAboutUsbDriver"() AS LONG
    DECLARE FUNCTION BuildRtfTextAboutSerialDriver ALIAS "BuildRtfTextAboutSerialDriver"() AS LONG
    
    
    
    GLOBAL hInst AS LONG                         'Instance handle
    
    
    GLOBAL HwndAbout AS LONG
    GLOBAL RichEditAbout AS LONG
    GLOBAL OldDlgAboutRichEdProc AS DWORD   'Original Proc for Richedit
    GLOBAL hAbout AS LONG
    GLOBAL RtfTextAbout AS STRING
    
    %RichEditAbout = %WM_USER + 1
    DlgFunctions.h
    Code:
    DECLARE FUNCTION GetDeskTopX ALIAS "GetDeskTopX"()AS LONG
    DECLARE FUNCTION GetDeskTopY ALIAS "GetDeskTopY"()AS LONG
    DECLARE FUNCTION ShowWindowState ALIAS "ShowWindowState"(HwndParent AS LONG, HwndWindow AS LONG, ShowState AS LONG)AS LONG
    DECLARE FUNCTION GetWindowState ALIAS "GetWindowState"(WindowToCheck AS LONG) AS LONG
    
    DECLARE FUNCTION AddLineRtf ALIAS "AddLineRtf"(HwndRtf AS LONG, StringToAdd AS STRING) AS LONG
    
         GLOBAL AppX AS LONG
         GLOBAL AppY AS LONG
    Dlls.h
    Code:
    DECLARE FUNCTION Load_Dlls() AS LONG
    GLOBAL RichEditLib AS LONG
    FileFolderPaths.h
    Code:
    DECLARE FUNCTION FileExist ALIAS "FileExist"(BYVAL sfName AS STRING) AS LONG
    DECLARE FUNCTION FilePath ALIAS "FilePath"(BYVAL Src AS STRING) AS STRING
    DECLARE FUNCTION FilePathName ALIAS "FilePathName"(BYVAL Src AS STRING) AS STRING
    ListDevices.h
    Code:
    DECLARE FUNCTION ListDevicesSerial ALIAS "ListDevicesSerial"() AS LONG
    
    TYPE DeviceInfo
         Name AS ASCIIZ * %MAX_PATH
         Port AS LONG
    END TYPE
    
    GLOBAL DeviceSerial() AS DeviceInfo
    OpSysInfo.h
    Code:
    'Windows < Win95
    '--------------------------------------------------------------------------------
    '
    '               Win 3.1
    'PlatformID     0
    'Major Version
    'Minor Version
    'Build
    '
    '--------------------------------------------------------------------------------
    'Windows 95/98/ME
    '--------------------------------------------------------------------------------
    '               Win     Win     Win
    '               95      98      Me
    '               ---     ---     ---
    'PlatformID     1       1       1
    'Major Version  4       4       4
    'Minor Version  0       10      90
    'Build          950*    1111    1998
    '
    '--------------------------------------------------------------------------------
    'Old Windows NT
    '--------------------------------------------------------------------------------
    '
    '               Win     Win     Win     Win
    '               NT      NT      NT      2000
    '               3.0     3.1     4
    '               ---     ---     ---     ----
    'PlatformID     2       2       2       2
    'Major Version  3       3       4       5
    'Minor Version  0       1       0       0
    'Build                          1381    2195
    '
    '--------------------------------------------------------------------------------
    'Windows NT
    '--------------------------------------------------------------------------------
    '
    '               Win     Win     Win
    '               2003    XP      VISTA
    'PlatformID     2       2       2
    'Major Version  5       5       6
    'Minor Version  2       1       0
    'Build          3790    2600    TBD
    '
    '--------------------------------------------------------------------------------
    
    DECLARE SUB GetOsInfo()
    DECLARE FUNCTION GetWindowsOs() AS STRING
    DECLARE FUNCTION GetWindowsBuildNumber() AS STRING
    DECLARE FUNCTION GetWindowsBuildName() AS STRING
    DECLARE FUNCTION GetWindowsServicePack() AS STRING
    GLOBAL OsInfo AS OSVERSIONINFO
    Register.h
    Code:
    DECLARE FUNCTION Register_Dialogs() AS LONG
    DECLARE FUNCTION Register_Mdi_Dialog( _
              ClassName AS STRING, _        'Class Name
              BYVAL ClassCallBack AS DWORD, _     'Callback Function
              ClassInstance AS LONG, _      'Instance
              ClassIcon AS ASCIIZ, _        'Icon
              ClassBackGround AS LONG _    'Background
              ) AS LONG
    
    DECLARE FUNCTION Register_Modal( _
              ClassName AS STRING, _        'Class Name
              BYVAL ClassCallBack AS DWORD, _     'Callback Function
              ClassInstance AS LONG, _      'Instance
              ClassIcon AS ASCIIZ, _        'Icon
              ClassBackGround AS LONG _    'Background
              ) AS LONG
    
    DECLARE FUNCTION Register_Modeless( _
              ClassName AS STRING, _        'Class Name
              BYVAL ClassCallBack AS DWORD, _     'Callback Function
              ClassInstance AS LONG, _      'Instance
              ClassIcon AS ASCIIZ, _        'Icon
              ClassBackGround AS LONG _    'Background
              ) AS LONG
    
    DECLARE FUNCTION Register_Rebar( _
              ClassName AS STRING, _        'Class Name
              BYVAL ClassCallBack AS DWORD, _     'Callback Function
              ClassInstance AS LONG, _      'Instance
              ClassIcon AS ASCIIZ, _        'Icon
              ClassBackGround AS LONG _    'Background
              ) AS LONG
    
         GLOBAL szClassName   AS ASCIIZ * %MAX_PATH   ' class name
         GLOBAL twcx          AS WNDCLASSEX           ' class information
    RTF.h
    Code:
    DECLARE FUNCTION RichEditStreamInString (BYVAL dwCookie AS DWORD, BYVAL pbBuff AS BYTE PTR, _
                                     BYVAL cb AS LONG, pcb AS LONG) AS DWORD
    
    GLOBAL gPos AS LONG, gPtr AS Long, gTxt AS STRING
    
    DECLARE FUNCTION RtfCommandsStart() AS STRING
    DECLARE FUNCTION RtfCommandsEnd() AS STRING
    
    DECLARE FUNCTION RtfCommandsEndOfLine() AS STRING
    
    DECLARE FUNCTION RtfReplaceCr(CommandString AS STRING) AS STRING
    
    DECLARE FUNCTION RtfFontCourier() AS STRING
    DECLARE FUNCTION RtfFontTimesNewRoman() AS STRING
    DECLARE FUNCTION RtfFontAndale() AS STRING
    DECLARE FUNCTION RtfFontLucidia() AS STRING
    DECLARE FUNCTION RtfFontGeorgia() AS STRING
    
    DECLARE FUNCTION RtfFontBold() AS STRING
    DECLARE FUNCTION RtfFontUnBold() AS STRING
    DECLARE FUNCTION RtfFontItalic() AS STRING
    DECLARE FUNCTION RtfFontUnItalic() AS STRING
    DECLARE FUNCTION RtfFontUnderline() AS STRING
    DECLARE FUNCTION RtfFontUnUnderline() AS STRING
    
    DECLARE FUNCTION RtfFontSize(SizeForFont AS LONG) AS STRING
    
    DECLARE FUNCTION RtfFontMaroon() AS STRING
    DECLARE FUNCTION RtfFontGreen() AS STRING
    DECLARE FUNCTION RtfFontOlive() AS STRING
    DECLARE FUNCTION RtfFontNavy() AS STRING
    DECLARE FUNCTION RtfFontPurple() AS STRING
    DECLARE FUNCTION RtfFontTeal() AS STRING
    DECLARE FUNCTION RtfFontGrey() AS STRING
    DECLARE FUNCTION RtfFontSilver() AS STRING
    DECLARE FUNCTION RtfFontRed() AS STRING
    DECLARE FUNCTION RtfFontLime() AS STRING
    DECLARE FUNCTION RtfFontYellow() AS STRING
    DECLARE FUNCTION RtfFontBlue() AS STRING
    DECLARE FUNCTION RtfFontFuchsia() AS STRING
    DECLARE FUNCTION RtfFontAqua() AS STRING
    DECLARE FUNCTION RtfFontWhite() AS STRING
    SetupClassInfo.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
    SoftwareInfo.h
    Code:
    DECLARE FUNCTION GetSoftwarePath ALIAS "GetSoftwarePath"() AS STRING
    DECLARE FUNCTION GetSoftwarePathName ALIAS "GetSoftwarePathName"() AS STRING
    DECLARE FUNCTION GetSoftwareParentPath ALIAS "GetSoftwareParentPath"() AS STRING
    DECLARE FUNCTION GetSoftwareParentPathName ALIAS "GetSoftwareParentPathName"() AS STRING
    
    DECLARE FUNCTION GetSoftwareCompanyName ALIAS "GetSoftwareCompanyName"() AS STRING
    DECLARE FUNCTION GetSoftwareFileDescription ALIAS "GetSoftwareFileDescription"() AS STRING
    DECLARE FUNCTION GetSoftwareFileVersion ALIAS "GetSoftwareFileVersion"() AS STRING
    DECLARE FUNCTION GetSoftwareInternalName ALIAS "GetSoftwareInternalName"() AS STRING
    DECLARE FUNCTION GetSoftwareOriginalFilename ALIAS "GetSoftwareOriginalFilename"() AS STRING
    DECLARE FUNCTION GetSoftwareLegalCopyright ALIAS "GetSoftwareLegalCopyright"() AS STRING
    DECLARE FUNCTION GetSoftwareProductName ALIAS "GetSoftwareProductName"() AS STRING
    DECLARE FUNCTION GetSoftwareProductVersion ALIAS "GetSoftwareProductVersion"() AS STRING
    DECLARE FUNCTION GetSoftwareComments ALIAS "GetSoftwareComments"() AS STRING

    Thanks for living through this, and if there are any that I may have missed, let me know and I will post those too....(I think I got them all though)


    <--- Note to self...Start SERIOUSLY thinking about rethinking the global vs local debate before writing the next app from scratch

    Leave a comment:


  • Cliff Nichols
    replied
    This may help then....Uncomment any information you want to look into that I commented out. (I was busy commenting in case you did not want all this info)

    Warning: One bug that is in there (I just have not had time to look to see where it is).....You have to "Cntrl-Alt-Delete" and go to Processes, and kill the Process of the program before you can recompile....(simple fix I know, but just to get the info out there I will look into it later and post now)

    My particular style up till late involved GLOBALS...(Hold the "Holy-Wars" debate about global vs local there people), so to allow a compile where one INC may need a variable declared, I put the globals into .h files....but you will see what I mean.

    Sorry there are so many of them, but I tried to rip out of a MUCH larger project, and fit your needs....but I think most of it is self explanatory (if it isn't just ask and I will fill you in)

    OsInfoSerialPorts.bas......The main EXE
    Code:
    #COMPILE EXE
    #DIM ALL
    
    #INCLUDE "WIN32API.INC"            'Define Windows OS variables and functions
    #INCLUDE "SetupApi.INC"            'Windows Setup Api
    '********* HEADERS **********
    #INCLUDE "Dlls.h"                  'Load and unload any support dll's
    #INCLUDE "Register.h"              'Register Class types with Windows
    #INCLUDE "RTF.h"                   'RTF Commands
    #INCLUDE "DlgFunctions.h"          'Hide/Show Windows, and other functions
    #INCLUDE "FileFolderPaths.h"       'File and Folder Paths
    #INCLUDE "SetupApiClassInfo.h"     'Wrapper for SetupApi
    #INCLUDE "OpSysInfo.h"             'Operating System Information
    #INCLUDE "SoftwareInfo.h"          'Software Information
    #INCLUDE "ListDevices.h"           'List Devices
    #INCLUDE "DlgAbout.h"              'About Window
    
    '********* INCLUDES *********
    #INCLUDE "Dlls.INC"                'Load and unload any support dll's
    #INCLUDE "Register.INC"            'Register Class types with Windows
    #INCLUDE "RichEdit.INC"            'Richedit routines
    #INCLUDE "RTF.INC"                 'RTF Commands
    #INCLUDE "DlgFunctions.INC"        'Hide/Show Windows, and other functions
    #INCLUDE "FileFolderPaths.INC"     'File and Folder Paths
    #INCLUDE "SetupApiClassInfo.INC"   'Wrapper for SetupApi
    #INCLUDE "OpSysInfo.INC"           'Operating System Information
    #INCLUDE "SoftwareInfo.INC"        'Software Information
    #INCLUDE "ListDevices.INC"         'List Devices
    #INCLUDE "DlgAbout.INC"            'About Window
    
    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
         Load_Dlls                'Load any support dll's
         Register_Dialogs         'Register Window Dialog Classes
         ShowAbout                'Show the About Window
    '*** 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
    About.INC..... Also shows all the devices you could look for if you want to develop later
    Code:
    'The complete list of devices that could be listed
    'Device = "1394/1394debug/61883/adapter/apmsupport/avc/battery/biometric/" & _
    '         "bluetooth/cdrom/computer/decoder/diskdrive/display/"            & _
    '         "dot4print/enum1394/fdc/floppydisk/gps/hdc/hidclass/image/"      & _
    '         "infrared/keyboard/legacydriver/media/mediumchanger/mtd/modem/"  & _
    '         "monitor/mouse/multifunction/multiportserial/net/netclient/"     & _
    '         "netservice/nettrans/nodriver/pcmcia/ports/printer/"             & _
    '         "printer upgrade/pnpprinters/processor/sbp2/scsiadapter/"        & _
    '         "security accelerator/smartcardreader/sound/system/tapedrive/"   & _
    '         "unknown/usb/volume/volumesnapshot/wceusbs"
    
    FUNCTION About_Dialog_Proc( _
        BYVAL hWnd    AS DWORD, _ ' window handle
        BYVAL uMsg    AS DWORD, _ ' type of message
        BYVAL wParam  AS DWORD, _ ' first message parameter
        BYVAL lParam  AS LONG _   ' second message parameter
        ) AS LONG
         DIM HwndRect AS RECT
    
         SELECT CASE uMsg
              CASE %WM_CTLCOLORSTATIC
                   EXIT FUNCTION
              CASE %WM_SIZE
              CASE %WM_COMMAND
                   SELECT CASE LO(DWORD,wParam)                      'Get the Control
                        CASE RichEditAbout
                             SELECT CASE HI(DWORD,wParam)            'Get the Message
                                  CASE %WM_KEYDOWN
                                       FUNCTION = %True
                                       EXIT FUNCTION
                                  CASE ELSE
                             END SELECT
                   END SELECT
              CASE %WM_CLOSE
         END SELECT
         FUNCTION = DefWindowProc(hWnd, uMsg, wParam, lParam)        'Need this if Window is to show
    END FUNCTION
    
    FUNCTION LoadAbout ALIAS "LoadAbout"(HwndOwner AS LONG) EXPORT AS LONG
    '*** Create the Window
         HwndAbout = CreateWindowEx( _
              BYVAL %NULL, _                                         ' Extended Window Style
              "Dialog_About", _                                      ' Window Class Name
              "About", _                                             ' Window Caption
              %WS_SYSMENU OR %WS_CAPTION _
              OR %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX _
              OR %WS_THICKFRAME OR %WS_DLGFRAME OR %WS_BORDER, _     ' Window Style
              %CW_USEDEFAULT, _                                      ' initial x position
              %CW_USEDEFAULT, _                                      ' initial y position
              685,  _                                                ' initial x size
              300, _                                                 ' initial y size
              HwndOwner, _                                           ' parent window handle
              BYVAL %NULL, _                                         ' menu or child window handle 'HwndAboutMenu
              hInst, _                                               ' program instance handle
              BYVAL %NULL)                                           ' creation parameters
    '*** Create the RichEdit Window
         RichEditAbout = CreateWindowEx( _
              %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, _          ' Extended Window Style
              $RICHEDIT_CLASS, _                                                    ' Window Class Name
              "", _           ' Window Caption
              %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL _              ' window styles
              OR %WS_HSCROLL OR %WS_EX_MDICHILD  OR %WS_EX_CLIENTEDGE _             ' window styles
              OR %ES_MULTILINE OR %ES_AUTOVSCROLL OR %ES_AUTOHSCROLL _              ' class styles
              OR %ES_WANTRETURN OR %ES_NOHIDESEL  OR %ES_LEFT OR %ES_READONLY, _    ' class styles
              0, _                                                                  ' initial x position
              0, _                                                                  ' initial y position
              675,  _                                                               ' initial x size
              265, _                                                                ' initial y size
              HwndAbout, _                                                          ' parent window handle
              %RichEditAbout, _                                                     ' menu or child window (control) handle
              hInst, _                                                              ' program instance handle
              BYVAL %NULL)                                                          ' creation parameters
    
    '     DIM lResult AS LONG
    '     DIM ErrorBuf AS ASCIIZ * %MAX_PATH
    '      lResult = GetLastError()
    '     FormatMessage %FORMAT_MESSAGE_FROM_SYSTEM, BYVAL %NULL, lResult, %NULL, ErrorBuf, SIZEOF(ErrorBuf), BYVAL %NULL
    'MSGBOX ErrorBuf
    'MSGBOX FUNCNAME$ + $CR + STR$(HwndAbout) + $CR +STR$(%RichEditAbout) + $CR + STR$(RichEditAbout) + $CR + STR$(Hinst) + $CR + $RICHEDIT_CLASS
         SendMessage RichEditAbout, %EM_SETBKGNDCOLOR, 0, RGB(0,0,0)      'Set the background color to black
         SendMessage RichEditAbout, %EM_EXLIMITTEXT, 0, 0       'Set Limit to the max allowed
         RtfTextAbout = RtfCommandsStart
    END FUNCTION
    
    FUNCTION ShowAbout ALIAS "ShowAbout"() EXPORT AS LONG
         SELECT CASE IsWindow(HwndAbout)
              CASE 0         'Does not exist
                   LoadAbout %HWND_DESKTOP       'Create the Windows
              CASE ELSE
         END SELECT
         ShowWindowState %HWND_DESKTOP, HwndAbout, %SW_SHOW
    '*** Format what is seen on the screen
         RtfTextAbout = RtfCommandsStart
         RtfTextAbout = RtfTextAbout + RtfFontSize(12) + RtfFontBold
         RtfTextAbout = RtfTextAbout + RtfFontRed + STRING$(41, "*") + RtfCommandsEndOfLine
         RtfTextAbout = RtfTextAbout + RtfFontRed + "***** Gathering System Information  *****" + RtfCommandsEndOfLine
         RtfTextAbout = RtfTextAbout + RtfFontRed + "***** " + STRING$(29, $SPC) + " *****" + RtfCommandsEndOfLine
         RtfTextAbout = RtfTextAbout + RtfFontRed + "***** " + STRING$(29, $SPC) + " *****" + RtfCommandsEndOfLine
         RtfTextAbout = RtfTextAbout + RtfFontRed + "***** " + STRING$(9, $SPC) + "Please Wait" + STRING$(9, $SPC) + " *****" + RtfCommandsEndOfLine
         RtfTextAbout = RtfTextAbout + RtfFontRed + STRING$(41, "*") + RtfCommandsEndOfLine
         AddLineRtf RichEditAbout, RtfTextAbout       'Display the formatted text
         SLEEP 1000          'Just to keep the Please Wait screen seen for a moment
         ShowRtfTextAbout    'Start Gathering System Information
    END FUNCTION
    
    FUNCTION HideAbout ALIAS "HideAbout"() EXPORT AS LONG
         ShowWindowState %HWND_DESKTOP, HwndAbout, %SW_HIDE
    END FUNCTION
    
    FUNCTION ShowRtfTextAbout ALIAS "ShowRtfTextAbout"() EXPORT AS LONG
         DIM i AS LONG
         DIM TempRtf AS STRING
         DIM StartTime AS CURRENCY
    '*** Show Computer Info being gathered
         TempRtf = RtfCommandsStart
         TempRtf = TempRtf + RtfFontSize(12) + RtfFontBold + RtfFontRed + "Getting Computer Info..." + RtfCommandsEndOfLine
         AddLineRtf RichEditAbout, TempRtf
    '*** Actually get the Computer Info
         RtfTextAbout = RtfCommandsStart
         RtfTextAbout = RtfTextAbout + RtfFontSize(12) + RtfFontBold
         BuildRtfTextAboutComputer
    '*** Show Software info being gathered
         REPLACE RtfCommandsStart WITH "" IN TempRtf
         TempRtf = RtfCommandsStart + TempRtf
         TempRtf = TempRtf + RtfFontSize(12) + RtfFontBold + RtfFontRed + "Getting Software Info..." + RtfCommandsEndOfLine
         AddLineRtf RichEditAbout, TempRtf
    '*** Actually gather Software info
         RtfTextAbout = RtfTextAbout + RtfFontAqua + RtfCommandsEndOfLine + RtfCommandsEndOfLine
         BuildRtfTextAboutSoftware
    '*** Show gathering USB PORT Devices
         REPLACE RtfCommandsStart WITH "" IN TempRtf
         TempRtf = RtfCommandsStart + TempRtf
         TempRtf = TempRtf + RtfFontSize(12) + RtfFontBold + RtfFontRed + "Getting USB Port Devices..." + RtfCommandsEndOfLine
         AddLineRtf RichEditAbout, TempRtf
    '*** Show gathering USB PORT Devices
         ListUsbDrivers
         BuildRtfTextAboutUsbDriver
    '*** Show gathering Serial Port Devices
         REPLACE RtfCommandsStart WITH "" IN TempRtf
         TempRtf = RtfCommandsStart + TempRtf
         TempRtf = TempRtf + RtfFontSize(12) + RtfFontBold + RtfFontRed + "Getting Serial Port Devices..." + RtfCommandsEndOfLine
         AddLineRtf RichEditAbout, TempRtf
    '*** Actually gather Serial Port Info
         RtfTextAbout = RtfTextAbout + RtfFontAqua + RtfCommandsEndOfLine + RtfCommandsEndOfLine
         ListSerialDrivers
         BuildRtfTextAboutSerialDriver
    '*** Show the results
         AddLineRtf RichEditAbout, RtfTextAbout
         SendMessage RichEditAbout, %WM_SETTEXT, 0, STRPTR(RtfTextAbout)       'Set position back to top of RTF window
    END FUNCTION
    
    FUNCTION BuildRtfTextAboutComputer ALIAS "BuildRtfTextAboutComputer"() EXPORT AS LONG
         RtfTextAbout = RtfTextAbout + RtfFontRed + "***** Computer *****"+ RtfCommandsEndOfLine
         IF GetWindowsOs <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Operating System: " + RtfFontWhite + GetWindowsOs + RtfCommandsEndOfLine
         IF GetWindowsBuildNumber <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Build: " + RtfFontWhite + GetWindowsBuildNumber + GetWindowsBuildName + RtfCommandsEndOfLine
         IF GetWindowsServicePack <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Service Pack: " + RtfFontWhite + GetWindowsServicePack + RtfCommandsEndOfLine
         RtfTextAbout = RtfTextAbout + RtfFontAqua + RtfCommandsEndOfLine
    END FUNCTION
    
    FUNCTION BuildRtfTextAboutSoftware ALIAS "BuildRtfTextAboutSoftware"() EXPORT AS LONG
         RtfTextAbout = RtfTextAbout + RtfFontRed + "***** Software *****" + RtfCommandsEndOfLine
         IF GetSoftwareParentPath <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Parent Path: " + RtfFontWhite + GetSoftwareParentPath + RtfCommandsEndOfLine
         IF GetSoftwareParentPathName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Parent Name: " + RtfFontWhite + GetSoftwareParentPathName + RtfCommandsEndOfLine
         IF GetSoftwarePath <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Running As Path: " + RtfFontWhite + GetSoftwarePath + RtfCommandsEndOfLine
         IF GetSoftwarePathName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Running As Name: " + RtfFontWhite + GetSoftwarePathName + RtfCommandsEndOfLine
    '     IF GetSoftwareCompanyName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Company Name: " + RtfFontWhite + GetSoftwareCompanyName + RtfCommandsEndOfLine
    '     IF GetSoftwareFileDescription <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Description: " + RtfFontWhite + GetSoftwareFileDescription + RtfCommandsEndOfLine
    '     IF GetSoftwareFileVersion <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "File Version: " + RtfFontWhite + GetSoftwareFileVersion + RtfCommandsEndOfLine
    '     IF GetSoftwareInternalName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Internal Name: " + RtfFontWhite + GetSoftwareInternalName + RtfCommandsEndOfLine
    '     IF GetSoftwareOriginalFilename <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Original Name: " + RtfFontWhite + GetSoftwareOriginalFilename + RtfCommandsEndOfLine
    '     IF GetSoftwareLegalCopyright <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Copyright: " + RtfFontWhite + GetSoftwareLegalCopyright + RtfCommandsEndOfLine
    '     IF GetSoftwareProductVersion <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Product Name: " + RtfFontWhite + GetSoftwareProductVersion + RtfCommandsEndOfLine
    '     IF GetSoftwareComments <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Comments: " + RtfFontWhite + GetSoftwareComments + RtfCommandsEndOfLine
         RtfTextAbout = RtfTextAbout + RtfFontAqua + RtfCommandsEndOfLine
    END FUNCTION
    
    FUNCTION BuildRtfTextAboutUsbDriver ALIAS "BuildRtfTextAboutUsbDriver"() EXPORT AS LONG
         DIM i AS LONG
         DIM j AS LONG
         RtfTextAbout = RtfTextAbout + RtfFontRed + "***** Usb Port Devices *****" + RtfCommandsEndOfLine
         FOR i = LBOUND(InfoUsbDriver) TO UBOUND(InfoUsbDriver)
              FOR j = 0 TO 3
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).ClassName
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).FriendlyName
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).DeviceDesc
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).HardwareId
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).CompatibleId
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Unused0
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Service
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Unused1
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Unused2
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).ClassGuid
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Driver
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).ConfigFlags
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Mfg
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Location
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).ObjectName
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Capabilities
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).UiNumber
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).UpperFilters
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).LowerFilters
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).BusTypeGuid
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).LegacyBusType
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).BusNumber
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).EnumeratorName
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).SecurityBinary
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).SecuritySelfDirectedSearch
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).DeviceType
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Exclusive
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Characteristics
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).Address
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).UiNumberDescFormat
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).MaximumProperty
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).RemovalPolicy
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).RemovalPolicyDefault
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).RemovalPolicyOverride
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).InstallState
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).LocationPaths
                   REPLACE CHR$(j) WITH "" IN InfoUsbDriver(i).PowerData
              NEXT j
              IF InfoUsbDriver(i).ClassName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Class Name: " + RtfFontWhite + InfoUsbDriver(i).ClassName + RtfCommandsEndOfLine
              IF InfoUsbDriver(i).FriendlyName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Friendly Name: " + RtfFontWhite + InfoUsbDriver(i).FriendlyName + RtfCommandsEndOfLine
              IF InfoUsbDriver(i).DeviceDesc <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Device Description: " + RtfFontWhite + InfoUsbDriver(i).DeviceDesc + RtfCommandsEndOfLine
              IF InfoUsbDriver(i).HardwareId <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Hardware ID: " + RtfFontWhite + InfoUsbDriver(i).HardwareId + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).CompatibleId <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Compatible ID: " + RtfFontWhite + InfoUsbDriver(i).CompatibleId + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Unused0 <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Unused 0: " + RtfFontWhite + InfoUsbDriver(i).Unused0 + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Service <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Service: " + RtfFontWhite + InfoUsbDriver(i).Service + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Unused1 <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Unused 1: " + RtfFontWhite + InfoUsbDriver(i).Unused1 + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Unused2 <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Unused 2: " + RtfFontWhite + InfoUsbDriver(i).Unused2 + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).ClassGuid <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Guid: " + RtfFontWhite + InfoUsbDriver(i).ClassGuid + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Driver <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Driver: " + RtfFontWhite + InfoUsbDriver(i).Driver + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).ConfigFlags <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Config Flags: " + RtfFontWhite + InfoUsbDriver(i).ConfigFlags + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Mfg <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Mfg: " + RtfFontWhite + InfoUsbDriver(i).Mfg + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Location <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Location: " + RtfFontWhite + InfoUsbDriver(i).Location + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).ObjectName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "ObjectName: " + RtfFontWhite + InfoUsbDriver(i).ObjectName + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Capabilities <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Capabilities: " + RtfFontWhite + InfoUsbDriver(i).Capabilities + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).UiNumber <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "UI Number: " + RtfFontWhite + InfoUsbDriver(i).UiNumber + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).UpperFilters <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Upper Filters: " + RtfFontWhite + InfoUsbDriver(i).UpperFilters + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).LowerFilters <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Lower Filters: " + RtfFontWhite + InfoUsbDriver(i).LowerFilters + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).BusTypeGuid <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Bus Type GUID: " + RtfFontWhite + InfoUsbDriver(i).BusTypeGuid + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).LegacyBusType <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Legacy Bus Type: " + RtfFontWhite + InfoUsbDriver(i).LegacyBusType + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).BusNumber <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Bus Number: " + RtfFontWhite + InfoUsbDriver(i).BusNumber + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).EnumeratorName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Enumerator Name: " + RtfFontWhite + InfoUsbDriver(i).EnumeratorName + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).SecurityBinary <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Security Binary: " + RtfFontWhite + InfoUsbDriver(i).SecurityBinary + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).SecuritySelfDirectedSearch <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Security SDS: " + RtfFontWhite + InfoUsbDriver(i).SecuritySelfDirectedSearch + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).DeviceType <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Device Type: " + RtfFontWhite + InfoUsbDriver(i).DeviceType + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Exclusive <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Exclusive: " + RtfFontWhite + InfoUsbDriver(i).Exclusive + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Characteristics <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Characteristics: " + RtfFontWhite + InfoUsbDriver(i).Characteristics + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).Address <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Address: " + RtfFontWhite + InfoUsbDriver(i).Address + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).UiNumberDescFormat <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "UI Number Description Format: " + RtfFontWhite + InfoUsbDriver(i).UiNumberDescFormat + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).MaximumProperty <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Maximum Property: " + RtfFontWhite + InfoUsbDriver(i).MaximumProperty + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).RemovalPolicy <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Removal Policy: " + RtfFontWhite + InfoUsbDriver(i).RemovalPolicy + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).RemovalPolicyDefault <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Removal Policy Default: " + RtfFontWhite + InfoUsbDriver(i).RemovalPolicyDefault + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).RemovalPolicyOverride <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Removal Policy Override: " + RtfFontWhite + InfoUsbDriver(i).RemovalPolicyOverride + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).InstallState <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Install State: " + RtfFontWhite + InfoUsbDriver(i).InstallState + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).LocationPaths <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Location Paths: " + RtfFontWhite + InfoUsbDriver(i).LocationPaths + RtfCommandsEndOfLine
    '          IF InfoUsbDriver(i).PowerData <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Power Data: " + RtfFontWhite + InfoUsbDriver(i).PowerData + RtfCommandsEndOfLine
              RtfTextAbout = RtfTextAbout + RtfFontAqua + RtfCommandsEndOfLine + RtfCommandsEndOfLine
         NEXT i
    END FUNCTION
    
    FUNCTION BuildRtfTextAboutSerialDriver ALIAS "BuildRtfTextAboutSerialDriver"() EXPORT AS LONG
         DIM i AS LONG
         DIM j AS LONG
         RtfTextAbout = RtfTextAbout + RtfFontRed + "***** Serial Port Devices *****" + RtfCommandsEndOfLine
         FOR i = LBOUND(InfoSerialDriver) TO UBOUND(InfoSerialDriver)
              FOR j = 0 TO 3
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).ClassName
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).FriendlyName
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).DeviceDesc
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).HardwareId
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).CompatibleId
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Unused0
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Service
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Unused1
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Unused2
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).ClassGuid
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Driver
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).ConfigFlags
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Mfg
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Location
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).ObjectName
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Capabilities
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).UiNumber
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).UpperFilters
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).LowerFilters
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).BusTypeGuid
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).LegacyBusType
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).BusNumber
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).EnumeratorName
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).SecurityBinary
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).SecuritySelfDirectedSearch
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).DeviceType
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Exclusive
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Characteristics
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).Address
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).UiNumberDescFormat
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).MaximumProperty
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).RemovalPolicy
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).RemovalPolicyDefault
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).RemovalPolicyOverride
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).InstallState
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).LocationPaths
                   REPLACE CHR$(j) WITH "" IN InfoSerialDriver(i).PowerData
              NEXT j
              IF InfoSerialDriver(i).ClassName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Class Name: " + RtfFontWhite + InfoSerialDriver(i).ClassName + RtfCommandsEndOfLine
              IF InfoSerialDriver(i).FriendlyName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Friendly Name: " + RtfFontWhite + InfoSerialDriver(i).FriendlyName + RtfCommandsEndOfLine
              IF InfoSerialDriver(i).DeviceDesc <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Device Description: " + RtfFontWhite + InfoSerialDriver(i).DeviceDesc + RtfCommandsEndOfLine
              IF InfoSerialDriver(i).HardwareId <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Hardware ID: " + RtfFontWhite + InfoSerialDriver(i).HardwareId + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).CompatibleId <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Compatible ID: " + RtfFontWhite + InfoSerialDriver(i).CompatibleId + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Unused0 <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Unused 0: " + RtfFontWhite + InfoSerialDriver(i).Unused0 + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Service <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Service: " + RtfFontWhite + InfoSerialDriver(i).Service + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Unused1 <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Unused 1: " + RtfFontWhite + InfoSerialDriver(i).Unused1 + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Unused2 <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Unused 2: " + RtfFontWhite + InfoSerialDriver(i).Unused2 + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).ClassGuid <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Guid: " + RtfFontWhite + InfoSerialDriver(i).ClassGuid + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Driver <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Driver: " + RtfFontWhite + InfoSerialDriver(i).Driver + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).ConfigFlags <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Config Flags: " + RtfFontWhite + InfoSerialDriver(i).ConfigFlags + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Mfg <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Mfg: " + RtfFontWhite + InfoSerialDriver(i).Mfg + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Location <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Location: " + RtfFontWhite + InfoSerialDriver(i).Location + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).ObjectName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "ObjectName: " + RtfFontWhite + InfoSerialDriver(i).ObjectName + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Capabilities <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Capabilities: " + RtfFontWhite + InfoSerialDriver(i).Capabilities + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).UiNumber <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "UI Number: " + RtfFontWhite + InfoSerialDriver(i).UiNumber + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).UpperFilters <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Upper Filters: " + RtfFontWhite + InfoSerialDriver(i).UpperFilters + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).LowerFilters <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Lower Filters: " + RtfFontWhite + InfoSerialDriver(i).LowerFilters + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).BusTypeGuid <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Bus Type GUID: " + RtfFontWhite + InfoSerialDriver(i).BusTypeGuid + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).LegacyBusType <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Legacy Bus Type: " + RtfFontWhite + InfoSerialDriver(i).LegacyBusType + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).BusNumber <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Bus Number: " + RtfFontWhite + InfoSerialDriver(i).BusNumber + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).EnumeratorName <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Enumerator Name: " + RtfFontWhite + InfoSerialDriver(i).EnumeratorName + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).SecurityBinary <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Security Binary: " + RtfFontWhite + InfoSerialDriver(i).SecurityBinary + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).SecuritySelfDirectedSearch <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Security SDS: " + RtfFontWhite + InfoSerialDriver(i).SecuritySelfDirectedSearch + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).DeviceType <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Device Type: " + RtfFontWhite + InfoSerialDriver(i).DeviceType + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Exclusive <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Exclusive: " + RtfFontWhite + InfoSerialDriver(i).Exclusive + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Characteristics <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Characteristics: " + RtfFontWhite + InfoSerialDriver(i).Characteristics + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).Address <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Address: " + RtfFontWhite + InfoSerialDriver(i).Address + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).UiNumberDescFormat <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "UI Number Description Format: " + RtfFontWhite + InfoSerialDriver(i).UiNumberDescFormat + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).MaximumProperty <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Maximum Property: " + RtfFontWhite + InfoSerialDriver(i).MaximumProperty + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).RemovalPolicy <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Removal Policy: " + RtfFontWhite + InfoSerialDriver(i).RemovalPolicy + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).RemovalPolicyDefault <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Removal Policy Default: " + RtfFontWhite + InfoSerialDriver(i).RemovalPolicyDefault + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).RemovalPolicyOverride <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Removal Policy Override: " + RtfFontWhite + InfoSerialDriver(i).RemovalPolicyOverride + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).InstallState <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Install State: " + RtfFontWhite + InfoSerialDriver(i).InstallState + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).LocationPaths <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Location Paths: " + RtfFontWhite + InfoSerialDriver(i).LocationPaths + RtfCommandsEndOfLine
    '          IF InfoSerialDriver(i).PowerData <> "" THEN RtfTextAbout = RtfTextAbout + RtfFontAqua + "Power Data: " + RtfFontWhite + InfoSerialDriver(i).PowerData + RtfCommandsEndOfLine
              RtfTextAbout = RtfTextAbout + RtfFontAqua + RtfCommandsEndOfLine + RtfCommandsEndOfLine
         NEXT i
    END FUNCTION
    DlgFunctions.INC....Functions to affect Window Display
    Code:
    FUNCTION GetDeskTopX ALIAS "GetDeskTopX"() EXPORT AS LONG
         FUNCTION = GetSystemMetrics(%SM_CXSCREEN)
    END FUNCTION
    
    FUNCTION GetDeskTopY ALIAS "GetDeskTopY"() EXPORT AS LONG
         FUNCTION = GetSystemMetrics(%SM_CYSCREEN)
    END FUNCTION
    
    FUNCTION ShowWindowState ALIAS "ShowWindowState"(HwndParent AS LONG, HwndWindow AS LONG, ShowState AS LONG)EXPORT AS LONG
         SELECT CASE GetWindowState(HwndWindow)
              CASE ShowState      'Already in the right state
              CASE ELSE
                   SetParent HwndWindow, HwndParent   'Added to allow window parent to change
                   ShowWindow HwndWindow, ShowState
                   SetFocus HwndWindow
         END SELECT
    END FUNCTION
    
    FUNCTION GetWindowState ALIAS "GetWindowState"(WindowToCheck AS LONG) EXPORT AS LONG
         SELECT CASE IsWindow(WindowToCheck)     'Does the window exist?
              CASE 0                             'No then exit
                   FUNCTION = %False
                   EXIT FUNCTION
              CASE ELSE                          'Yes so check state and adjust to new state if not the same
                   SELECT CASE IsWindowVisible(WindowToCheck)
                        CASE 0         'Not Visible = 0
                             FUNCTION = %SW_HIDE
                        CASE ELSE      'Visible
                             SELECT CASE IsZoomed(WindowToCheck)
                                  CASE 0         'Not Maximized
                                       SELECT CASE IsIconic(WindowToCheck)
                                            CASE 0    'Not Minimized (Normal) = 1
                                                 FUNCTION = %SW_SHOWNORMAL
                                            CASE ELSE      'Minimized = 6
                                                 FUNCTION = %SW_MINIMIZE
                                       END SELECT
                                  CASE ELSE      'Maximized = 3
                                       FUNCTION = %SW_MAXIMIZE
                             END SELECT
                   END SELECT
         END SELECT
    END FUNCTION
    
    FUNCTION AddLineRtf ALIAS "AddLineRtf"(HwndRtf AS LONG, StringToAdd AS STRING)EXPORT AS LONG
         DIM eStream AS EDITSTREAM
         eStream.pfnCallback = CODEPTR(RichEditStreamInString) 'pointer to RichEdit callback procedure
         gTxt = StringToAdd
         gPos = 1
         gPtr = STRPTR(gTxt)
    
         SendMessage HwndRtf, %EM_STREAMIN, %SF_RTF, VARPTR(eStream) 'stream in text
         InvalidateRect HwndRtf, BYVAL %NULL, 0
         UpdateWindow HwndRtf
         FUNCTION = %True
    END FUNCTION
    Dlls.INC......Support DLL's....In this case just Richedit used for display purposes
    Code:
    FUNCTION Load_Dlls() AS LONG
         RichEditLib = LoadLibrary("RICHED32.DLL")      'Load the Richedit Dll
         SELECT CASE RichEditLib
              CASE 0
                   FUNCTION = %False
              CASE ELSE
                   FUNCTION = %True
         END SELECT
    END FUNCTION
    FileFolderPaths.INC...File and Folder Paths
    Code:
    '------------------------------------------------------------------------------
    ' FileExist - make sure a file or folder exists
    '------------------------------------------------------------------------------
    FUNCTION FileExist ALIAS "FileExist"(BYVAL sfName AS STRING) EXPORT AS LONG
      LOCAL hRes AS DWORD, tWFD AS WIN32_FIND_DATA
    
      IF LEN(sfName) = 0 THEN EXIT FUNCTION       'no need to continue then..
      IF ASC(sfName, -1) = 92 THEN                'if a path with trailing backslash
         sfName = LEFT$(sfName, LEN(sfName) - 1)  'remove trailing backslash
      END IF
    
      hRes = FindFirstFile(BYVAL STRPTR(sfName), tWFD)
      IF hRes <> %INVALID_HANDLE_VALUE THEN
         FUNCTION = %TRUE
         FindClose hRes
      END IF
    END FUNCTION
    
    '------------------------------------------------------------------------------
    ' Get path -part of given path & name
    '------------------------------------------------------------------------------
    FUNCTION FilePath ALIAS "FilePath"(BYVAL Src AS STRING) EXPORT AS STRING
         LOCAL x AS LONG
         x = INSTR(-1, Src, ANY ":\/")
         IF x THEN FUNCTION = LEFT$(Src, x)
    END FUNCTION
    
    '------------------------------------------------------------------------------
    ' Get file name part of given path & name
    '------------------------------------------------------------------------------
    FUNCTION FilePathName ALIAS "FilePathName"(BYVAL Src AS STRING) EXPORT AS STRING
         LOCAL x AS LONG
         x = INSTR(-1, Src, ANY ":/\")
         IF x THEN
              FUNCTION = MID$(Src, x + 1)
         ELSE
              FUNCTION = Src
         END IF
    END FUNCTION
    List Devices.INC.....I can not remember why I made this one separate, but oh well
    Code:
    FUNCTION ListDevicesSerial ALIAS "ListDevicesSerial"() EXPORT AS LONG
         REDIM DeviceSerial(LBOUND(DeviceSerial))                         'Clear the array
         DIM i AS LONG
         DIM j AS LONG
         DIM zText AS ASCIIZ * %MAX_PATH
         DIM StartParse AS LONG
         DIM LenParse AS LONG
         hDeviceInfo = GetDeviceList                                      'Get the list of serial devices
         spdi.cbSize = GetDeviceListSize                                  'Get the size of the list
         DO UNTIL SetupDiEnumDeviceInfo(hDeviceInfo, i, spdi) = 0
              SELECT CASE UCASE$(GetDeviceClass)
                   CASE "PORTS"                                           'If class is not a port, then skip it for this example
                        zText = GetDeviceFriendlyName
                        SELECT CASE INSTR(UCASE$(zText), "LPT")           'If a port, but not a serial port, skip it for this example
                             CASE 0    'Not a parallel port
                                  StartParse = INSTR(zText, "(") + 1      'It is a serial port so start parsing data
                                  LenParse = INSTR(zText, ")") - StartParse
                                  DeviceSerial(UBOUND(DeviceSerial)).NAME = MID$(zText, StartParse, LenParse)
                                  FOR j = 1 TO LEN(DeviceSerial(UBOUND(DeviceSerial)).NAME)
                                       SELECT CASE ASC(MID$(DeviceSerial(UBOUND(DeviceSerial)).NAME, j, 1))
                                            CASE 48 TO 57       'Acii 0 to 9
                                                 DeviceSerial(UBOUND(DeviceSerial)).PORT = VAL(MID$(DeviceSerial(UBOUND(DeviceSerial)).NAME, j, LEN(DeviceSerial(UBOUND(DeviceSerial)).NAME)))
                                                 EXIT FOR
                                       END SELECT
                                  NEXT j
                                  REDIM PRESERVE DeviceSerial(UBOUND(DeviceSerial) + 1)
                        END SELECT
              END SELECT
              INCR i
         LOOP
         REDIM PRESERVE DeviceSerial(UBOUND(DeviceSerial) - 1)       'Remove empty array element
         FUNCTION = %True
    END FUNCTION
    OpSysInfo.inc...Use for Operating System Info (probably not needed for this example, but could be useful in determining what RichEdit version to use)
    Code:
    SUB GetOsInfo()
        OsInfo.dwOSVersionInfoSize = 148    'Unsure why 148 works but %MAX_PATH comes back as 0
        OsInfo.szCsdVersion = SPACE$(128)
        GetVersionEx(OsInfo)       'Get the information
    END SUB
    
    FUNCTION GetWindowsOs() AS STRING
        SELECT CASE OsInfo.dwPlatformId
            CASE 0
                GetOsInfo
        END SELECT
        SELECT CASE OsInfo.dwPlatformId
            CASE 0      'Platform is < Win95
                FUNCTION = "Windows 3.1"
            CASE 1      'Platform is Win 95/98/ME
                SELECT CASE OsInfo.dwMajorVersion
                    CASE 4  'Win 95/98/ME
                        SELECT CASE OsInfo.dwMinorVersion
                            CASE 0  'Win 95
                                FUNCTION = "Windows 95"
                            CASE 10  'Win 98
                                FUNCTION = "Windows 98"
                            CASE 90  'Win ME
                                FUNCTION = "Windows ME"
                        END SELECT
                END SELECT
            CASE 2      'Platform is Win NT 3/4/5/6
                SELECT CASE OsInfo.dwMajorVersion
                    CASE 3  'Win NT 3
                        SELECT CASE OsInfo.dwMinorVersion
                            CASE 0  'Win NT 3
                                FUNCTION = "Windows NT 3.0"
                            CASE 1  'Win NT 3.1
                                FUNCTION = "Windows NT 3.1"
                        END SELECT
                    CASE 4  'Win NT 4
                        SELECT CASE OsInfo.dwMinorVersion
                            CASE 0  'Win NT 4
                                FUNCTION = "Windows NT 4.0"
                        END SELECT
                    CASE 5  'Win NT 5
                        SELECT CASE OsInfo.dwMinorVersion
                            CASE 0  'Win 2000
                                FUNCTION = "Windows 2000"
                            CASE 1  'Win XP
                                FUNCTION = "Windows XP"
                            CASE 2  'Windows 2003 Server"
                                FUNCTION = "Windows 2003 Server"
                        END SELECT
                    CASE 6  'Win NT 6
                        SELECT CASE OsInfo.dwMinorVersion
                            CASE 0  'Win Vista
                                FUNCTION = "Windows Vista"
                        END SELECT
                END SELECT
        END SELECT
    END FUNCTION
    
    FUNCTION GetWindowsBuildNumber() AS STRING
        SELECT CASE OsInfo.dwBuildNumber
            CASE 0
                GetOsInfo
        END SELECT
        FUNCTION = STR$(OsInfo.dwBuildNumber)
    END FUNCTION
    
    FUNCTION GetWindowsBuildName() AS STRING
        SELECT CASE OsInfo.dwBuildNumber
            CASE 0
                GetOsInfo
        END SELECT
        SELECT CASE OsInfo.dwBuildNumber
            CASE 950    'Win 95
                FUNCTION = " "
            CASE 1111   'Win 98 OSR2
                FUNCTION = STR$(OsInfo.dwBuildNumber) + " OSR2"
            CASE 1998   'Win ME
                FUNCTION = " "
            CASE 1381   'Win NT 4
                FUNCTION = " "
            CASE 2195   'Win 2000
                FUNCTION = " "
            CASE 3790   'Win 2003 Server
                FUNCTION = " "
            CASE 2600   'Win XP
                FUNCTION = " "
        END SELECT
    END FUNCTION
    
    FUNCTION GetWindowsServicePack() AS STRING
        SELECT CASE OsInfo.szCSDVersion
            CASE ""
                GetOsInfo
        END SELECT
        FUNCTION = OsInfo.szCSDVersion
    END FUNCTION
    Register.INC....Used for registering Window Classes (I still have no clue why a modeless window is registered as "#32770")
    Code:
    DECLARE FUNCTION CreateMenuClass(BYVAL hParent AS LONG) AS LONG
    DECLARE FUNCTION CreateMenuBar(BYVAL hWndParent AS LONG) AS LONG
    DECLARE SUB CreateMyMenu()
    
    FUNCTION Register_Dialogs() AS LONG
         LOCAL tccs AS CLIENTCREATESTRUCT   ' window menu and first child info
         SELECT CASE Register_Modal("Dialog_About", BYVAL CODEPTR(About_Dialog_Proc), hInst, "ABOUTICON", GetSysColorBrush(%COLOR_3DFACE))
              CASE %True
              CASE %False
                   FUNCTION = %False
         END SELECT
    END FUNCTION
    
    FUNCTION Register_Mdi_Dialog( _
              ClassName AS STRING, _        'Class Name
              BYVAL ClassCallBack AS DWORD, _     'Callback Function
              ClassInstance AS LONG, _      'Instance
              ClassIcon AS ASCIIZ, _        'Icon
              ClassBackGround AS LONG _    'Background
              ) AS LONG
         DIM lResult AS LONG
         DIM ErrorBuf AS ASCIIZ * %MAX_PATH
         szClassName        = ClassName
         twcx.cbSize        = SIZEOF(twcx)                               ' size of WNDCLASSEX structure
         twcx.style         = %CS_DBLCLKS                                ' class styles
         twcx.lpfnWndProc   = ClassCallBack                  ' address of window procedure used by class
         twcx.cbClsExtra    = 0                                          ' extra class bytes
    '     twcx.cbWndExtra    = %DLGWINDOWEXTRA                                          ' extra window bytes
         twcx.hInstance     = ClassInstance                                  ' instance of the EXE/DLL that is registering the window
         twcx.hIcon         = LoadIcon(ClassInstance, ClassIcon)    ' handle of class icon
         twcx.hCursor       = LoadCursor(%NULL, BYVAL %IDC_ARROW)        ' handle of class cursor
         twcx.hbrBackground = ClassBackGround                    ' brush used to fill background of window's client area
         twcx.lpszMenuName  = %NULL                                      ' resource identifier of the class menu
         twcx.lpszClassName = VARPTR(szClassName)                        ' class name
         twcx.hIconSm       = LoadIcon(%NULL, ClassIcon)    ' handle of small icon shown in caption/system Taskbar
         SELECT CASE RegisterClassEx(twcx)
              CASE 0
                   FUNCTION = %FALSE
              CASE ELSE
                   FUNCTION = %TRUE
         END SELECT
    END FUNCTION
    
    FUNCTION Register_Modal( _
              ClassName AS STRING, _        'Class Name
              BYVAL ClassCallBack AS DWORD, _     'Callback Function
              ClassInstance AS LONG, _      'Instance
              ClassIcon AS ASCIIZ, _        'Icon
              ClassBackGround AS LONG _    'Background
              ) AS LONG
         szClassName        = ClassName
         twcx.cbSize        = SIZEOF(twcx)                               ' size of WNDCLASSEX structure
         twcx.style         = %CS_DBLCLKS                                ' class styles
         twcx.lpfnWndProc   = ClassCallBack                  ' address of window procedure used by class
         twcx.cbClsExtra    = 0                                          ' extra class bytes
         twcx.cbWndExtra    = %DLGWINDOWEXTRA                                          ' extra window bytes
         twcx.hInstance     = ClassInstance                                  ' instance of the EXE/DLL that is registering the window
         twcx.hIcon         = LoadIcon(ClassInstance, ClassIcon)    ' handle of class icon
         twcx.hCursor       = LoadCursor(%NULL, BYVAL %IDC_ARROW)        ' handle of class cursor
         twcx.hbrBackground = ClassBackGround                    ' brush used to fill background of window's client area
         twcx.lpszMenuName  = %NULL                                      ' resource identifier of the class menu
         twcx.lpszClassName = VARPTR(szClassName)                        ' class name
         twcx.hIconSm       = LoadIcon(%NULL, ClassIcon)    ' handle of small icon shown in caption/system Taskbar
         SELECT CASE RegisterClassEx(twcx)
              CASE 0
                   FUNCTION = %FALSE
              CASE ELSE
                   FUNCTION = %TRUE
         END SELECT
    END FUNCTION
    
    FUNCTION Register_Modeless( _
              ClassName AS STRING, _        'Class Name
              BYVAL ClassCallBack AS DWORD, _     'Callback Function
              ClassInstance AS LONG, _      'Instance
              ClassIcon AS ASCIIZ, _        'Icon
              ClassBackGround AS LONG _    'Background
              ) AS LONG
        GetClassInfoEx(GetModuleHandle(BYVAL %NULL), "#32770", twcx)      'copy dialog class (modeless) into ports class
         szClassName        = ClassName
         twcx.cbSize        = SIZEOF(twcx)                               ' size of WNDCLASSEX structure
         twcx.style         = %CS_DBLCLKS                                ' class styles
         twcx.lpfnWndProc   = ClassCallBack                  ' address of window procedure used by class
         twcx.cbClsExtra    = 0                                          ' extra class bytes
         twcx.cbWndExtra    = %DLGWINDOWEXTRA                                          ' extra window bytes
         twcx.hInstance     = ClassInstance                                  ' instance of the EXE/DLL that is registering the window
         twcx.hIcon         = LoadIcon(ClassInstance, ClassIcon)    ' handle of class icon
         twcx.hCursor       = LoadCursor(%NULL, BYVAL %IDC_ARROW)        ' handle of class cursor
         twcx.hbrBackground = ClassBackGround                    ' brush used to fill background of window's client area
         twcx.lpszMenuName  = %NULL                                      ' resource identifier of the class menu
         twcx.lpszClassName = VARPTR(szClassName)                        ' class name
         twcx.hIconSm       = LoadIcon(%NULL, ClassIcon)    ' handle of small icon shown in caption/system Taskbar
         SELECT CASE RegisterClassEx(twcx)
              CASE 0
                   FUNCTION = %FALSE
              CASE ELSE
                   FUNCTION = %TRUE
         END SELECT
    END FUNCTION
    RichEdit.INC....(I believe came directly from PB, but would have to look, so you may not need this one)
    Code:
    '------------------------------------------------------------------------------
    '
    '  32-bit RICHEDIT declarations for PowerBASIC for Windows
    '
    '  Copyright (c) 1997-2002 PowerBASIC, Inc.
    '  Portions copyright (c) 1993-1999 Microsoft Corporation
    '  All Rights Reserved.
    '
    '  This file contains only the Equate, Type, and Declare statements for
    '  RichEdit APIs, based on the richedit.h include file from the Windows SDK.
    '
    '  You have a royalty-free right to use, modify, reproduce and distribute
    '  this file (and/or any modified version) in any way you find useful,
    '  provided that you agree that both PowerBASIC and Microsoft have no
    '  warranty, obligation or liability for its contents.
    '
    '  Based on richedit.h of 11 April 2001
    '
    '  Last Update: 07 November 2002
    '
    '------------------------------------------------------------------------------
    
    
    
    #IF NOT %DEF(%RICHEDIT_INC) '==================================================
    
    %RICHEDIT_INC = 1
    
    '
    ' Pull in Windows includes if necessary
    '
    #IF NOT %DEF(%WINAPI)
      #INCLUDE "Win32API.inc"
    #ENDIF
    
    
    ' To mimic older RichEdit behavior, set %RICHEDIT_VER to appropriate value
    '    Version 1.0   &H0100
    '    Version 2.0   &H0200
    '    Version 2.1   &H0210
    #IF NOT %DEF(%RICHEDIT_VER)
      %RICHEDIT_VER = &H0300
    #ENDIF
    
    #IF (%RICHEDIT_VER - &H0100)
      ' %RICHEDIT_VER presumed > &H0100
      $RICHEDIT_CLASS = "RichEdit20A"
    #ELSE
      $RICHEDIT_CLASS = "RICHEDIT"
    #ENDIF
    
    %cchTextLimitDefault = 32767
    
    ' RichEdit messages
    
    #IF NOT %DEF(%WM_CONTEXTMENU)
      %WM_CONTEXTMENU = &H007B
    #ENDIF
    
    #IF NOT %DEF(%WM_PRINTCLIENT)
      %WM_PRINTCLIENT = &H0318
    #ENDIF
    
    #IF NOT %DEF(%EM_GETLIMITTEXT)
      %EM_GETLIMITTEXT = %WM_USER + 37
    #ENDIF
    
    #IF NOT %DEF(%EM_POSFROMCHAR)
      %EM_POSFROMCHAR = %WM_USER + 38
      %EM_CHARFROMPOS = %WM_USER + 39
    #ENDIF
    
    #IF NOT %DEF(%EM_SCROLLCARET)
      %EM_SCROLLCARET = %WM_USER + 49
    #ENDIF
    
    %EM_CANPASTE           = %WM_USER + 50
    %EM_DISPLAYBAND        = %WM_USER + 51
    %EM_EXGETSEL           = %WM_USER + 52
    %EM_EXLIMITTEXT        = %WM_USER + 53
    %EM_EXLINEFROMCHAR     = %WM_USER + 54
    %EM_EXSETSEL           = %WM_USER + 55
    %EM_FINDTEXT           = %WM_USER + 56
    %EM_FORMATRANGE        = %WM_USER + 57
    %EM_GETCHARFORMAT      = %WM_USER + 58
    %EM_GETEVENTMASK       = %WM_USER + 59
    %EM_GETOLEINTERFACE    = %WM_USER + 60
    %EM_GETPARAFORMAT      = %WM_USER + 61
    %EM_GETSELTEXT         = %WM_USER + 62
    %EM_HIDESELECTION      = %WM_USER + 63
    %EM_PASTESPECIAL       = %WM_USER + 64
    %EM_REQUESTRESIZE      = %WM_USER + 65
    %EM_SELECTIONTYPE      = %WM_USER + 66
    %EM_SETBKGNDCOLOR      = %WM_USER + 67
    %EM_SETCHARFORMAT      = %WM_USER + 68
    %EM_SETEVENTMASK       = %WM_USER + 69
    %EM_SETOLECALLBACK     = %WM_USER + 70
    %EM_SETPARAFORMAT      = %WM_USER + 71
    %EM_SETTARGETDEVICE    = %WM_USER + 72
    %EM_STREAMIN           = %WM_USER + 73
    %EM_STREAMOUT          = %WM_USER + 74
    %EM_GETTEXTRANGE       = %WM_USER + 75
    %EM_FINDWORDBREAK      = %WM_USER + 76
    %EM_SETOPTIONS         = %WM_USER + 77
    %EM_GETOPTIONS         = %WM_USER + 78
    %EM_FINDTEXTEX         = %WM_USER + 79
    %EM_GETWORDBREAKPROCEX = %WM_USER + 80
    %EM_SETWORDBREAKPROCEX = %WM_USER + 81
    
    ' RichEdit 2.0 messages
    %EM_SETUNDOLIMIT       = %WM_USER + 82
    %EM_REDO               = %WM_USER + 84
    %EM_CANREDO            = %WM_USER + 85
    %EM_GETUNDONAME        = %WM_USER + 86
    %EM_GETREDONAME        = %WM_USER + 87
    %EM_STOPGROUPTYPING    = %WM_USER + 88
    
    %EM_SETTEXTMODE        = %WM_USER + 89
    %EM_GETTEXTMODE        = %WM_USER + 90
    
    ' from enumerated type TEXTMODE, for use with EM_GET/SETTEXTMODE
    %TM_PLAINTEXT       = 1
    %TM_RICHTEXT        = 2     ' default behavior
    %TM_SINGLELEVELUNDO = 4
    %TM_MULTILEVELUNDO  = 8     ' default behavior
    %TM_SINGLECODEPAGE  = 16
    %TM_MULTICODEPAGE   = 32    ' default behavior
    
    %EM_AUTOURLDETECT      = %WM_USER + 91
    %EM_GETAUTOURLDETECT   = %WM_USER + 92
    %EM_SETPALETTE         = %WM_USER + 93
    %EM_GETTEXTEX          = %WM_USER + 94
    %EM_GETTEXTLENGTHEX    = %WM_USER + 95
    %EM_SHOWSCROLLBAR      = %WM_USER + 96
    %EM_SETTEXTEX          = %WM_USER + 97
    
    ' Far East specific messages
    %EM_SETPUNCTUATION  = %WM_USER + 100
    %EM_GETPUNCTUATION  = %WM_USER + 101
    %EM_SETWORDWRAPMODE = %WM_USER + 102
    %EM_GETWORDWRAPMODE = %WM_USER + 103
    %EM_SETIMECOLOR     = %WM_USER + 104
    %EM_GETIMECOLOR     = %WM_USER + 105
    %EM_SETIMEOPTIONS   = %WM_USER + 106
    %EM_GETIMEOPTIONS   = %WM_USER + 107
    %EM_CONVPOSITION    = %WM_USER + 108
    
    %EM_SETLANGOPTIONS       = %WM_USER + 120
    %EM_GETLANGOPTIONS       = %WM_USER + 121
    %EM_GETIMECOMPMODE       = %WM_USER + 122
    
    %EM_FINDTEXTW            = %WM_USER + 123
    %EM_FINDTEXTEXW          = %WM_USER + 124
    
    ' RE3.0 FE messages
    %EM_RECONVERSION         = %WM_USER + 125
    %EM_SETIMEMODEBIAS       = %WM_USER + 126
    %EM_GETIMEMODEBIAS       = %WM_USER + 127
    
    ' BiDi specific messages
    %EM_SETBIDIOPTIONS       = %WM_USER + 200
    %EM_GETBIDIOPTIONS       = %WM_USER + 201
    
    %EM_SETTYPOGRAPHYOPTIONS = %WM_USER + 202
    %EM_GETTYPOGRAPHYOPTIONS = %WM_USER + 203
    
    ' Extended edit style specific messages
    %EM_SETEDITSTYLE         = %WM_USER + 204
    %EM_GETEDITSTYLE         = %WM_USER + 205
    
    ' Extended edit style masks
    %SES_EMULATESYSEDIT     = 1
    %SES_BEEPONMAXTEXT      = 2
    %SES_EXTENDBACKCOLOR    = 4
    %SES_MAPCPS             = 8
    %SES_EMULATE10          = 16
    %SES_USECRLF            = 32
    %SES_USEAIMM            = 64
    %SES_NOIME              = 128
    
    %SES_ALLOWBEEPS         = 256
    %SES_UPPERCASE          = 512
    %SES_LOWERCASE          = 1024
    %SES_NOINPUTSEQUENCECHK = 2048
    %SES_BIDI               = 4096
    %SES_SCROLLONKILLFOCUS  = 8192
    %SES_XLTCRCRLFTOCR      = 16384
    
    
    ' Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS
    %IMF_AUTOKEYBOARD        = &H0001
    %IMF_AUTOFONT            = &H0002
    %IMF_IMECANCELCOMPLETE   = &H0004  ' high completes comp string when aborting, low cancels.
    %IMF_IMEALWAYSSENDNOTIFY = &H0008
    %IMF_AUTOFONTSIZEADJUST  = &H0010
    %IMF_UIFONTS             = &H0020
    %IMF_DUALFONT            = &H0080
    
    ' Values for EM_GETIMECOMPMODE
    %ICM_NOTOPEN    = &H0000
    %ICM_LEVEL3     = &H0001
    %ICM_LEVEL2     = &H0002
    %ICM_LEVEL2_5   = &H0003
    %ICM_LEVEL2_SUI = &H0004
    
    ' Options for EM_SETTYPOGRAPHYOPTIONS
    %TO_ADVANCEDTYPOGRAPHY = 1
    %TO_SIMPLELINEBREAK    = 2
    
    ' Pegasus outline mode messages (RE 3.0)
    
    ' Outline mode message
    %EM_OUTLINE      = %WM_USER + 220
    ' Message for getting and restoring scroll pos
    %EM_GETSCROLLPOS = %WM_USER + 221
    %EM_SETSCROLLPOS = %WM_USER + 222
    ' Change fontsize in current selection by wParam
    %EM_SETFONTSIZE  = %WM_USER + 223
    %EM_GETZOOM      = %WM_USER + 224
    %EM_SETZOOM      = %WM_USER + 225
    
    ' Outline mode wparam values
    %EMO_EXIT            = 0       ' enter normal mode,  lparam ignored
    %EMO_ENTER           = 1       ' enter outline mode, lparam ignored
    %EMO_PROMOTE         = 2       ' LOWORD(lparam) == 0 ==>
                                   ' promote  to body-text
                                   ' LOWORD(lparam) != 0 ==>
                                   ' promote/demote current selection
                                   ' by indicated number of levels
    %EMO_EXPAND          = 3       ' HIWORD(lparam) = EMO_EXPANDSELECTION
                                   ' -> expands selection to level
                                   ' indicated in LOWORD(lparam)
                                   ' LOWORD(lparam) = -1/+1 corresponds
                                   ' to collapse/expand button presses
                                   ' in winword (other values are
                                   ' equivalent to having pressed these
                                   ' buttons more than once)
                                   ' HIWORD(lparam) = EMO_EXPANDDOCUMENT
                                   ' -> expands whole document to
                                   ' indicated level
    %EMO_MOVESELECTION   = 4       ' LOWORD(lparam) != 0 -> move current
                                   ' selection up/down by indicated
                                   ' amount
    %EMO_GETVIEWMODE     = 5       ' Returns VM_NORMAL or VM_OUTLINE
    
    ' EMO_EXPAND options
    %EMO_EXPANDSELECTION = 0
    %EMO_EXPANDDOCUMENT  = 1
    %VM_NORMAL           = 4       ' Agrees with RTF \viewkindN
    %VM_OUTLINE          = 2
    
    ' new notifications
    %EN_MSGFILTER         = &H0700
    %EN_REQUESTRESIZE     = &H0701
    %EN_SELCHANGE         = &H0702
    %EN_DROPFILES         = &H0703
    %EN_PROTECTED         = &H0704
    %EN_CORRECTTEXT       = &H0705     ' PenWin specific
    %EN_STOPNOUNDO        = &H0706
    %EN_IMECHANGE         = &H0707     ' Far East specific
    %EN_SAVECLIPBOARD     = &H0708
    %EN_OLEOPFAILED       = &H0709
    %EN_OBJECTPOSITIONS   = &H070a
    %EN_LINK              = &H070b
    %EN_DRAGDROPDONE      = &H070c
    %EN_PARAGRAPHEXPANDED = &H070d
    
    ' BiDi specific notifications
    %EN_ALIGNLTR          = &H0710
    %EN_ALIGNRTL          = &H0711
    
    ' event notification masks
    %ENM_NONE              = &H00000000
    %ENM_CHANGE            = &H00000001
    %ENM_UPDATE            = &H00000002
    %ENM_SCROLL            = &H00000004
    %ENM_KEYEVENTS         = &H00010000
    %ENM_MOUSEEVENTS       = &H00020000
    %ENM_REQUESTRESIZE     = &H00040000
    %ENM_SELCHANGE         = &H00080000
    %ENM_DROPFILES         = &H00100000
    %ENM_PROTECTED         = &H00200000
    %ENM_CORRECTTEXT       = &H00400000    ' PenWin specific
    %ENM_SCROLLEVENTS      = &H00000008
    %ENM_DRAGDROPDONE      = &H00000010
    %ENM_PARAGRAPHEXPANDED = &H00000020
    
    ' Far East specific notification mask
    %ENM_IMECHANGE         = &H00800000    ' unused by RE2.0
    %ENM_LANGCHANGE        = &H01000000
    %ENM_OBJECTPOSITIONS   = &H02000000
    %ENM_LINK              = &H04000000
    
    ' new edit control styles
    %ES_SAVESEL         = &H00008000
    %ES_SUNKEN          = &H00004000
    %ES_DISABLENOSCROLL = &H00002000
    ' same as WS_MAXIMIZE, but that doesn't make sense so we re-use the value
    %ES_SELECTIONBAR    = &H01000000
    ' same as ES_UPPERCASE, but re-used to completely disable OLE drag'n'drop
    %ES_NOOLEDRAGDROP   = &H00000008
    
    ' Edit control extended style
    '#if (%WIN32_WINNT > &H0400) OR (%WINVER > &H0400)
    '%ES_EX_NOCALLOLEINIT   = &H00000000    ' Not supported in RE 2.0/3.0
    '#else
    %ES_EX_NOCALLOLEINIT   = &H01000000
    '#endif
    
    ' These flag are used in FE Windows
    %ES_VERTICAL           = &H00400000
    %ES_NOIME              = &H00080000    ' Not supported in RE 2.0/3.0
    %ES_SELFIME            = &H00040000
    
    ' Edit control options
    %ECO_AUTOWORDSELECTION = &H00000001
    %ECO_AUTOVSCROLL       = &H00000040
    %ECO_AUTOHSCROLL       = &H00000080
    %ECO_NOHIDESEL         = &H00000100
    %ECO_READONLY          = &H00000800
    %ECO_WANTRETURN        = &H00001000
    %ECO_SAVESEL           = &H00008000
    %ECO_SELECTIONBAR      = &H01000000
    %ECO_VERTICAL          = &H00400000    ' FE specific
    
    ' ECO operations
    %ECOOP_SET = &H0001
    %ECOOP_OR  = &H0002
    %ECOOP_AND = &H0003
    %ECOOP_XOR = &H0004
    
    ' new word break function actions
    %WB_CLASSIFY      = 3
    %WB_MOVEWORDLEFT  = 4
    %WB_MOVEWORDRIGHT = 5
    %WB_LEFTBREAK     = 6
    %WB_RIGHTBREAK    = 7
    
    ' Far East specific flags
    %WB_MOVEWORDPREV  = 4
    %WB_MOVEWORDNEXT  = 5
    %WB_PREVBREAK     = 6
    %WB_NEXTBREAK     = 7
    
    %PC_FOLLOWING  = 1
    %PC_LEADING    = 2
    %PC_OVERFLOW   = 3
    %PC_DELIMITER  = 4
    %WBF_WORDWRAP  = &H010
    %WBF_WORDBREAK = &H020
    %WBF_OVERFLOW  = &H040
    %WBF_LEVEL1    = &H080
    %WBF_LEVEL2    = &H100
    %WBF_CUSTOM    = &H200
    
    ' Far East specific flags
    %IMF_FORCENONE         = &H0001
    %IMF_FORCEENABLE       = &H0002
    %IMF_FORCEDISABLE      = &H0004
    %IMF_CLOSESTATUSWINDOW = &H0008
    %IMF_VERTICAL          = &H0020
    %IMF_FORCEACTIVE       = &H0040
    %IMF_FORCEINACTIVE     = &H0080
    %IMF_FORCEREMEMBER     = &H0100
    %IMF_MULTIPLEEDIT      = &H0400
    
    ' word break flags (used with WB_CLASSIFY)
    %WBF_CLASS      = &H0F
    %WBF_ISWHITE    = &H10
    %WBF_BREAKLINE  = &H20
    %WBF_BREAKAFTER = &H40
    
    ' new data types
    
    ' All character format measurements are in twips
    TYPE CHARFORMAT BYTE
      cbSize AS DWORD
      dwMask AS DWORD
      dwEffects AS DWORD
      yHeight AS LONG
      yOffset AS LONG
      crTextColor AS DWORD
      bCharSet AS BYTE
      bPitchAndFamily AS BYTE
      szFaceName AS ASCIIZ * %LF_FACESIZE
      wFiller AS WORD
    END TYPE
    
    ' CHARFORMAT masks
    %CFM_BOLD      = &H00000001
    %CFM_ITALIC    = &H00000002
    %CFM_UNDERLINE = &H00000004
    %CFM_STRIKEOUT = &H00000008
    %CFM_PROTECTED = &H00000010
    %CFM_LINK      = &H00000020    ' Exchange hyperlink extension
    %CFM_SIZE      = &H80000000
    %CFM_COLOR     = &H40000000
    %CFM_FACE      = &H20000000
    %CFM_OFFSET    = &H10000000
    %CFM_CHARSET   = &H08000000
    
    ' CHARFORMAT effects
    %CFE_BOLD      = &H0001
    %CFE_ITALIC    = &H0002
    %CFE_UNDERLINE = &H0004
    %CFE_STRIKEOUT = &H0008
    %CFE_PROTECTED = &H0010
    %CFE_LINK      = &H0020
    
    %CFE_AUTOCOLOR = &H40000000 ' NOTE: this corresponds to CFM_COLOR, which controls it
    
    %yHeightCharPtsMost = 1638
    
    ' %EM_SETCHARFORMAT wParam masks
    %SCF_SELECTION     = &H0001
    %SCF_WORD          = &H0002
    %SCF_DEFAULT       = &H0000    ' Set default charformat or paraformat
    %SCF_ALL           = &H0004    ' Not valid with SCF_SELECTION or SCF_WORD
    %SCF_USEUIRULES    = &H0008    ' Modifier for SCF_SELECTION; says that
                                   '  format came from a toolbar, etc., and
                                   '  hence UI formatting rules should be
                                   '  used instead of literal formatting
    %SCF_ASSOCIATEFONT = &H0010    ' Associate fontname with bCharSet (one
                                   '  possible for each of Western, ME, FE, Thai)
    %SCF_NOKBUPDATE    = &H0020    ' Do not update the KB layput for this change
                                   ' even if autokeyboard is on.
    
    TYPE CHARRANGE DWORD
      cpMin AS LONG
      cpMax AS LONG
    END TYPE
    
    TYPE TEXTRANGE DWORD
      chrg AS CHARRANGE
      lpstrText AS ASCIIZ PTR  ' allocated by caller, zero terminated by RichEdit
    END TYPE
    
    TYPE EDITSTREAM DWORD
      dwCookie AS DWORD    ' user value passed to callback as first parameter
      dwError AS DWORD     ' last error
      pfnCallback AS DWORD
    END TYPE
    
    ' Stream formats. Flags are all in low word, since high word gives
    ' possible codepage choice.
    
    %SF_TEXT         = &H0001
    %SF_RTF          = &H0002
    %SF_RTFNOOBJS    = &H0003    ' Write only
    %SF_TEXTIZED     = &H0004    ' Write only
    
    %SF_UNICODE      = &H0010    ' Unicode file (UCS2 little endian)
    %SF_USECODEPAGE  = &H0020    ' CodePage given by high word
    %SF_NCRFORNONASCII = &H40    ' Output /uN for nonASCII
    
    ' Flag telling stream operations to operate on the selection only
    ' EM_STREAMIN will replace the current selection
    ' EM_STREAMOUT will stream out the current selection
    %SFF_SELECTION = &H08000
    
    ' Flag telling stream operations to operate on the common RTF keyword only
    ' EM_STREAMIN will accept the only common RTF keyword
    ' EM_STREAMOUT will stream out the only common RTF keyword
    %SFF_PLAINRTF = &H04000
    
    ' Flag telling file stream output (%SFF_SELECTION flag not set) to persist
    ' \viewscaleN control word.
    %SFF_PERSISTVIEWSCALE = &H02000
    
    ' Flag telling file stream input with %SFF_SELECTION flag not set not to
    ' close the document
    %SFF_KEEPDOCINFO = &H01000
    
    ' Flag telling stream operations to output in Pocket Word format
    %SFF_PWD         = &H00800
    
    ' 3-bit field specifying the value of N - 1 to use for \rtfN or \pwdN
    %SF_RTFVAL       = &H0700
    
    TYPE FINDTEXTAPI DWORD
      chrg AS CHARRANGE
      lpstrText AS ASCIIZ PTR
    END TYPE
    
    TYPE FINDTEXTEX DWORD
      chrg AS CHARRANGE
      lpstrText AS ASCIIZ PTR
      chrgText AS CHARRANGE
    END TYPE
    
    TYPE FORMATRANGE DWORD
      hdc AS DWORD
      hdcTarget AS DWORD
      rc AS RECT
      rcPage AS RECT
      chrg AS CHARRANGE
    END TYPE
    
    ' All paragraph measurements are in twips
    
    %MAX_TAB_STOPS = 32
    %lDefaultTab   = 720
    
    #IF (%RICHEDIT_VER - &H100) '---------------------------------------------
    ' version > 1.0
    TYPE PARAFORMAT BYTE
      cbSize AS DWORD
      dwMask AS DWORD
      wNumbering AS WORD
      wEffects AS WORD
      dxStartIndent AS LONG
      dxRightIndent AS LONG
      dxOffset AS LONG
      wAlignment AS WORD
      cTabCount AS INTEGER
      rgxTabs(0 TO %MAX_TAB_STOPS - 1) AS LONG
    END TYPE
    #ELSE '----------------------------------------
    ' version = 1.0
    TYPE PARAFORMAT BYTE
      cbSize AS DWORD
      dwMask AS DWORD
      wNumbering AS WORD
      wReserved AS WORD
      dxStartIndent AS LONG
      dxRightIndent AS LONG
      dxOffset AS LONG
      wAlignment AS WORD
      cTabCount AS INTEGER
      rgxTabs(0 TO %MAX_TAB_STOPS - 1) AS LONG
    END TYPE
    #ENDIF ' #IF (%RICHEDIT_VER - &H100) -------------------------------------
    
    ' PARAFORMAT mask values
    %PFM_STARTINDENT  = &H00000001
    %PFM_RIGHTINDENT  = &H00000002
    %PFM_OFFSET       = &H00000004
    %PFM_ALIGNMENT    = &H00000008
    %PFM_TABSTOPS     = &H00000010
    %PFM_NUMBERING    = &H00000020
    %PFM_OFFSETINDENT = &H80000000
    
    ' PARAFORMAT numbering options
    %PFN_BULLET = &H0001
    
    ' PARAFORMAT alignment options
    %PFA_LEFT   = &H0001
    %PFA_RIGHT  = &H0002
    %PFA_CENTER = &H0003
    
    ' CHARFORMAT2 and PARAFORMAT2 structures
    
    TYPE CHARFORMAT2 BYTE
      cbSize AS DWORD
      dwMask AS DWORD
      dwEffects AS DWORD
      yHeight AS LONG
      yOffset AS LONG                ' > 0 for superscript, < 0 for subscript
      crTextColor AS DWORD
      bCharSet AS BYTE
      bPitchAndFamily AS BYTE
      szFaceName AS ASCIIZ * %LF_FACESIZE
      wFiller AS WORD
      wWeight AS WORD                ' Font weight (LOGFONT value)
      sSpacing AS INTEGER              ' Amount to space between letters
      crBackColor AS DWORD           ' Background color
      lcid AS DWORD                  ' Locale ID
      dwReserved AS DWORD            ' Reserved. Must be 0
      sStyle AS INTEGER              ' Style handle
      wKerning AS WORD               ' Twip size above which to kern char pair
      bUnderlineType AS BYTE         ' Underline type
      bAnimation AS BYTE             ' Animated text like marching ants
      bRevAuthor AS BYTE             ' Revision author index
    END TYPE
    
    %CHARFORMATDELTA = 23 ' SIZEOF(CHARFORMAT2) - SIZEOF(CHARFORMAT)
    
    ' PARAFORMAT 2.0 masks and effects
    
    %PFM_SPACEBEFORE     = &H00000040
    %PFM_SPACEAFTER      = &H00000080
    %PFM_LINESPACING     = &H00000100
    %PFM_STYLE           = &H00000400
    %PFM_BORDER          = &H00000800  ' (*)
    %PFM_SHADING         = &H00001000  ' (*)
    %PFM_NUMBERINGSTYLE  = &H00002000  ' RE 3.0
    %PFM_NUMBERINGTAB    = &H00004000  ' RE 3.0
    %PFM_NUMBERINGSTART  = &H00008000  ' RE 3.0
    
    %PFM_RTLPARA         = &H00010000
    %PFM_KEEP            = &H00020000  ' (*)
    %PFM_KEEPNEXT        = &H00040000  ' (*)
    %PFM_PAGEBREAKBEFORE = &H00080000  ' (*)
    %PFM_NOLINENUMBER    = &H00100000  ' (*)
    %PFM_NOWIDOWCONTROL  = &H00200000  ' (*)
    %PFM_DONOTHYPHEN     = &H00400000  ' (*)
    %PFM_SIDEBYSIDE      = &H00800000  ' (*)
    %PFM_TABLE           = &H40000000  ' RE 3.0
    
    ' The following three properties are read only
    %PFM_COLLAPSED       = &H01000000  ' RE 3.0
    %PFM_OUTLINELEVEL    = &H02000000  ' RE 3.0
    %PFM_BOX             = &H04000000  ' RE 3.0
    
    
    ' Note: PARAFORMAT has no effects
    %PFM_EFFECTS = %PFM_RTLPARA OR %PFM_KEEP OR %PFM_KEEPNEXT OR %PFM_TABLE _
                       OR %PFM_PAGEBREAKBEFORE OR %PFM_NOLINENUMBER  _
                       OR %PFM_NOWIDOWCONTROL OR %PFM_DONOTHYPHEN OR %PFM_SIDEBYSIDE _
                       OR %PFM_TABLE
    
    ' CHARFORMAT and PARAFORMAT "ALL" masks
    ' %CFM_COLOR mirrors %CFE_AUTOCOLOR, a little hack to easily deal with autocolor
    
    %CFM_EFFECTS = %CFM_BOLD OR %CFM_ITALIC OR %CFM_UNDERLINE OR %CFM_COLOR OR _
                       %CFM_STRIKEOUT OR %CFE_PROTECTED OR %CFM_LINK
    %CFM_ALL = %CFM_EFFECTS OR %CFM_SIZE OR %CFM_FACE OR %CFM_OFFSET OR %CFM_CHARSET
    
    %PFM_ALL = %PFM_STARTINDENT OR %PFM_RIGHTINDENT OR %PFM_OFFSET OR _
                   %PFM_ALIGNMENT OR %PFM_TABSTOPS OR %PFM_NUMBERING OR _
                   %PFM_OFFSETINDENT OR %PFM_RTLPARA
    
    %PFM_ALL2 = %PFM_ALL OR %PFM_EFFECTS OR %PFM_SPACEBEFORE OR %PFM_SPACEAFTER _
                    OR %PFM_LINESPACING OR %PFM_STYLE OR %PFM_SHADING OR %PFM_BORDER _
                    OR %PFM_NUMBERINGTAB OR %PFM_NUMBERINGSTART OR %PFM_NUMBERINGSTYLE
    
    ' New masks and effects -- a parenthesized asterisk indicates that
    ' the data is stored by RichEdit 2.0/3.0, but not displayed
    
    %CFM_SMALLCAPS     = &H0040        ' (*)
    %CFM_ALLCAPS       = &H0080        ' Displayed by 3.0
    %CFM_HIDDEN        = &H0100        ' Hidden by 3.0
    %CFM_OUTLINE       = &H0200        ' (*)
    %CFM_SHADOW        = &H0400        ' (*)
    %CFM_EMBOSS        = &H0800        ' (*)
    %CFM_IMPRINT       = &H1000        ' (*)
    %CFM_DISABLED      = &H2000
    %CFM_REVISED       = &H4000
    
    %CFM_BACKCOLOR     = &H04000000
    %CFM_LCID          = &H02000000
    %CFM_UNDERLINETYPE = &H00800000    ' Many displayed by 3.0
    %CFM_WEIGHT        = &H00400000
    %CFM_SPACING       = &H00200000    ' Displayed by 3.0
    %CFM_KERNING       = &H00100000    ' (*)
    %CFM_STYLE         = &H00080000    ' (*)
    %CFM_ANIMATION     = &H00040000    ' (*)
    %CFM_REVAUTHOR     = &H00008000
    
    %CFE_SUBSCRIPT     = &H00010000    ' Superscript and subscript are
    %CFE_SUPERSCRIPT   = &H00020000    '  mutually exclusive
    
    %CFM_SUBSCRIPT     = %CFE_SUBSCRIPT OR %CFE_SUPERSCRIPT
    %CFM_SUPERSCRIPT   = %CFM_SUBSCRIPT
    
    %CFM_EFFECTS2 = %CFM_EFFECTS OR %CFM_DISABLED OR %CFM_SMALLCAPS OR %CFM_ALLCAPS _
                        OR %CFM_HIDDEN  OR %CFM_OUTLINE OR %CFM_SHADOW OR %CFM_EMBOSS _
                        OR %CFM_IMPRINT OR %CFM_DISABLED OR %CFM_REVISED _
                        OR %CFM_SUBSCRIPT OR %CFM_SUPERSCRIPT OR %CFM_BACKCOLOR
    
    %CFM_ALL2 = %CFM_ALL OR %CFM_EFFECTS2 OR %CFM_BACKCOLOR OR %CFM_LCID _
                    OR %CFM_UNDERLINETYPE OR %CFM_WEIGHT OR %CFM_REVAUTHOR _
                    OR %CFM_SPACING OR %CFM_KERNING OR %CFM_STYLE OR %CFM_ANIMATION
    
    %CFE_SMALLCAPS     = %CFM_SMALLCAPS
    %CFE_ALLCAPS       = %CFM_ALLCAPS
    %CFE_HIDDEN        = %CFM_HIDDEN
    %CFE_OUTLINE       = %CFM_OUTLINE
    %CFE_SHADOW        = %CFM_SHADOW
    %CFE_EMBOSS        = %CFM_EMBOSS
    %CFE_IMPRINT       = %CFM_IMPRINT
    %CFE_DISABLED      = %CFM_DISABLED
    %CFE_REVISED       = %CFM_REVISED
    
    ' NOTE: %CFE_AUTOCOLOR and %CFE_AUTOBACKCOLOR correspond to %CFM_COLOR and
    ' %CFM_BACKCOLOR, respectively, which control them
    
    %CFE_AUTOBACKCOLOR = %CFM_BACKCOLOR
    
    ' Underline types. RE 1.0 displays only CFU_UNDERLINE
    %CFU_CF1UNDERLINE        = &HFF  ' map charformat's bit underline to CF2.
    %CFU_INVERT              = &HFE  ' For IME composition fake a selection.
    %CFU_UNDERLINEHAIRLINE   = 10    ' (*) displayed as ordinary underline
    %CFU_UNDERLINETHICK      = 9
    %CFU_UNDERLINEWAVE       = 8
    %CFU_UNDERLINEDASHDOTDOT = 7
    %CFU_UNDERLINEDASHDOT    = 6
    %CFU_UNDERLINEDASH       = 5
    %CFU_UNDERLINEDOTTED     = 4
    %CFU_UNDERLINEDOUBLE     = 3     ' (*) displayed as ordinary underline
    %CFU_UNDERLINEWORD       = 2     ' (*) displayed as ordinary underline
    %CFU_UNDERLINE           = 1
    %CFU_UNDERLINENONE       = 0
    
    TYPE PARAFORMAT2 BYTE
      cbSize AS DWORD
      dwMask AS DWORD
      wNumbering AS WORD
      wReserved AS WORD
      dxStartIndent AS LONG
      dxRightIndent AS LONG
      dxOffset AS LONG
      wAlignment AS WORD
      cTabCount AS INTEGER
      rgxTabs(0 TO %MAX_TAB_STOPS - 1) AS LONG
      dySpaceBefore AS LONG       ' Vertical spacing before para
      dySpaceAfter AS LONG        ' Vertical spacing after para
      dyLineSpacing AS LONG       ' Line spacing depending on Rule
      sStyle AS INTEGER           ' Style handle
      bLineSpacingRule AS BYTE    ' Rule for line spacing (see tom.doc)
      bOutlineLevel AS BYTE       ' Outline Level
      wShadingWeight AS WORD      ' Shading in hundredths of a per cent
      wShadingStyle AS WORD       ' Byte 0: style, nib 2: cfpat, 3: cbpat
      wNumberingStart AS WORD     ' Starting value for numbering
      wNumberingStyle AS WORD     ' Alignment, Roman/Arabic, (), ), ., etc.
      wNumberingTab AS WORD       ' Space bet 1st indent and 1st-line text
      wBorderSpace AS WORD        ' Border-text spaces (nbl/bdr in pts)
      wBorderWidth AS WORD        ' Pen widths (nbl/bdr in half twips)
      wBorders AS WORD            ' Border styles (nibble/border)
    END TYPE
    
    
    %PFE_RTLPARA         = %PFM_RTLPARA         \ 65536
    %PFE_KEEP            = %PFM_KEEP            \ 65536  ' (*)
    %PFE_KEEPNEXT        = %PFM_KEEPNEXT        \ 65536  ' (*)
    %PFE_PAGEBREAKBEFORE = %PFM_PAGEBREAKBEFORE \ 65536  ' (*)
    %PFE_NOLINENUMBER    = %PFM_NOLINENUMBER    \ 65536  ' (*)
    %PFE_NOWIDOWCONTROL  = %PFM_NOWIDOWCONTROL  \ 65536  ' (*)
    %PFE_DONOTHYPHEN     = %PFM_DONOTHYPHEN     \ 65536  ' (*)
    %PFE_SIDEBYSIDE      = %PFM_SIDEBYSIDE      \ 65536  ' (*)
    
    ' The following four effects are read only
    %PFE_OUTLINELEVEL    = %PFM_OUTLINELEVEL \ 65536  ' (+)
    %PFE_COLLAPSED       = %PFM_COLLAPSED    \ 65536  ' (+)
    %PFE_BOX             = %PFM_BOX          \ 65536  ' (+)
    %PFE_TABLE           = &H4000      ' Para is a table row. RE 3.0
    
    ' PARAFORMAT2 wNumbering options (see also PFN_BULLET)
    %PFN_ARABIC   = 2    ' tomListNumberAsArabic:   0, 1, 2,    ...
    %PFN_LCLETTER = 3    ' tomListNumberAsLCLetter: a, b, c,    ...
    %PFN_UCLETTER = 4    ' tomListNumberAsUCLetter: A, B, C,    ...
    %PFN_LCROMAN  = 5    ' tomListNumberAsLCRoman:  i, ii, iii, ...
    %PFN_UCROMAN  = 6    ' tomListNumberAsUCRoman:  I, II, III, ...
    
    ' PARAFORMAT2 wNumberingStyle options
    %PFNS_PAREN    = &H000   ' default, e.g.,                 1)
    %PFNS_PARENS   = &H100   ' tomListParentheses/256, e.g., (1)
    %PFNS_PERIOD   = &H200   ' tomListPeriod/256, e.g.,       1.
    %PFNS_PLAIN    = &H300   ' tomListPlain/256, e.g.,        1
    %PFNS_NONUMBER = &H400   ' Used for continuation w/o number
    
    %PFA_JUSTIFY          = 4  ' New paragraph-alignment option 2.0 (*)
    %PFA_FULL_INTERWORD   = 4
    %PFA_FULL_INTERLETTER = 5
    %PFA_FULL_SCALED      = 6
    %PFA_FULL_GLYPHS      = 7
    %PFA_SNAP_GRID        = 8
    
    ' Notification structures
    
    #IF NOT %DEF(%WM_NOTIFY) '-------------------------------
    %WM_NOTIFY = &H004E
    
    TYPE NMHDR DWORD
      hwndFrom AS DWORD
      idFrom AS DWORD
      code AS DWORD
    END TYPE
    #ENDIF  ' #IF NOT %DEF(%WM_NOTIFY) ----------------------
    
    ' notification structures
    TYPE MSGFILTER DWORD
      hdr AS NMHDR
      msg AS DWORD
      wParam AS LONG
      lParam AS LONG
    END TYPE
    
    TYPE REQRESIZE DWORD
      hdr AS NMHDR
      rc AS RECT
    END TYPE
    
    TYPE SELCHANGE BYTE
      hdr AS NMHDR
      chrg AS CHARRANGE
      seltyp AS WORD
    END TYPE
    
    %SEL_EMPTY       = &H0000
    %SEL_TEXT        = &H0001
    %SEL_OBJECT      = &H0002
    %SEL_MULTICHAR   = &H0004
    %SEL_MULTIOBJECT = &H0008
    
    ' Used with IRichEditOleCallback::GetContextMenu, this flag will be
    ' passed as a "selection type".  It indicates that a context menu for
    ' a right-mouse drag drop should be generated.  The IOleObject parameter
    ' will really be the IDataObject for the drop
    '
    %GCM_RIGHTMOUSEDROP = &H8000
    
    TYPE ENDROPFILES DWORD
      hdr AS NMHDR
      hDrop AS DWORD
      cp AS LONG
      fProtected AS LONG
    END TYPE
    
    TYPE ENPROTECTED DWORD
      hdr AS NMHDR
      msg AS DWORD
      wParam AS LONG
      lParam AS LONG
      chrg AS CHARRANGE
    END TYPE
    
    TYPE ENSAVECLIPBOARD DWORD
      hdr AS NMHDR
      cObjectCount AS LONG
      cch AS LONG
    END TYPE
    
    TYPE ENOLEOPFAILED DWORD
      hdr AS NMHDR
      iob AS LONG
      lOper AS LONG
      hr AS DWORD
    END TYPE
    
    %OLEOP_DOVERB  = 1
    
    TYPE OBJECTPOSITIONS DWORD
      nmhdr AS NMHDR
      cObjectCount AS LONG
      pcpPositions AS LONG PTR
    END TYPE
    
    TYPE ENLINK DWORD
      nmhdr AS NMHDR
      msg AS DWORD
      wParam AS LONG
      lParam AS LONG
      chrg AS CHARRANGE
    END TYPE
    
    ' PenWin specific
    TYPE ENCORRECTTEXT BYTE
      hdr AS NMHDR
      chrg AS CHARRANGE
      seltyp AS WORD
    END TYPE
    
    ' Far East specific
    TYPE PUNCTUATION DWORD
      iSize AS DWORD
      szPunctuation AS ASCIIZ PTR
    END TYPE
    
    ' Far East specific
    TYPE COMPCOLOR DWORD
      crText AS DWORD
      crBackground AS DWORD
      dwEffects AS DWORD
    END TYPE
    
    
    ' Clipboard formats - use as parameter to RegisterClipboardFormat()
    $CF_RTF       = "Rich Text Format"
    $CF_RTFNOOBJS = "Rich Text Format Without Objects"
    $CF_RETEXTOBJ = "RichEdit Text and Objects"
    
    ' Paste Special
    TYPE REPASTESPECIAL DWORD
      dwAspect AS DWORD
      dwParam AS DWORD
    END TYPE
    
    ' UndoName info (enumerated type UNDONAMEID)
    %UID_UNKNOWN  = 0
    %UID_TYPING   = 1
    %UID_DELETE   = 2
    %UID_DRAGDROP = 3
    %UID_CUT      = 4
    %UID_PASTE    = 5
    
    ' Flags for the SETEXTEX data structure
    %ST_DEFAULT   = 0
    %ST_KEEPUNDO  = 1
    %ST_SELECTION = 2
    
    ' EM_SETTEXTEX info; this struct is passed in the wparam of the message
    TYPE SETTEXTEX DWORD
      flags AS DWORD       ' flags (see the ST_XXX defines
      codepage AS DWORD    ' code page for translation (CP_ACP for sys default;
                           ' 1200 for Unicode, -1 for control default
    END TYPE
    
    ' Flags for the GETEXTEX data structure
    %GT_DEFAULT   = 0
    %GT_USECRLF   = 1
    %GT_SELECTION = 2
    
    ' EM_GETTEXTEX info; this struct is passed in the wparam of the message
    TYPE GETTEXTEX DWORD
      cb AS DWORD                  ' count of bytes in the string
      flags AS DWORD               ' flags (see the GT_XXX defines
      codepage AS DWORD            ' code page for translation (CP_ACP for sys default,
                                   ' 1200 for Unicode, -1 for control default
      lpDefaultChar AS ASCIIZ PTR  ' replacement for unmappable chars
      lpUsedDefChar AS LONG PTR    ' pointer to flag set when def char used
    END TYPE
    
    ' Flags for the GETTEXTLENGTHEX data structure
    %GTL_DEFAULT  = 0    ' do the default (return # of chars)
    %GTL_USECRLF  = 1    ' compute answer using CRLFs for paragraphs
    %GTL_PRECISE  = 2    ' compute a precise answer
    %GTL_CLOSE    = 4    ' fast computation of a "close" answer
    %GTL_NUMCHARS = 8    ' return the number of characters
    %GTL_NUMBYTES = 16   ' return the number of _bytes_
    
    ' EM_GETTEXTLENGTHEX info; this struct is passed in the wparam of the msg
    TYPE GETTEXTLENGTHEX DWORD
      flags AS DWORD       ' flags (see GTL_XXX defines)
      codepage AS DWORD    ' code page for translation (CP_ACP for default,
                           ' 1200 for Unicode
    END TYPE
    
    ' BiDi specific features
    TYPE BIDIOPTIONS BYTE
      cbSize AS DWORD
      wMask AS WORD
      wEffects AS WORD
    END TYPE
    
    ' BIDIOPTIONS masks
    #IF (%RICHEDIT_VER - &H0100)
    #ELSE
      ' version 1.0
      %BOM_DEFPARADIR       = &H0001  ' Default paragraph direction (implies alignment) (obsolete)
      %BOM_PLAINTEXT        = &H0002  ' Use plain text layout (obsolete)
    #ENDIF
    
    %BOM_NEUTRALOVERRIDE  = &H0004  ' Override neutral layout (obsolete)
    %BOM_CONTEXTREADING   = &H0008  ' Context reading order
    %BOM_CONTEXTALIGNMENT = &H0010  ' Context alignment
    
    ' BIDIOPTIONS effects
    #IF (%RICHEDIT_VER - &H0100)
    #ELSE
      ' version 1.0
      %BOE_RTLDIR           = &H0001  ' Default paragraph direction (implies alignment) (obsolete)
      %BOE_PLAINTEXT        = &H0002  ' Use plain text layout (obsolete)
    #ENDIF
    
    %BOE_NEUTRALOVERRIDE  = &H0004  ' Override neutral layout (obsolete)
    %BOE_CONTEXTREADING   = &H0008  ' Context reading order
    %BOE_CONTEXTALIGNMENT = &H0010  ' Context alignment
    
    ' Additional EM_FINDTEXT[EX] flags
    %FR_MATCHDIAC      = &H20000000
    %FR_MATCHKASHIDA   = &H40000000
    %FR_MATCHALEFHAMZA = &H80000000
    
    #ENDIF ' #IF NOT %DEF(%RICHEDIT_INC) ==========================================
    RTF.INC....(My wrapper for making sense of RTF commands)
    Code:
    FUNCTION RtfCommandsStart() AS STRING
        LOCAL st$
    '*** Start RTF Header
        st$ = "{"   'Start Header
        st$ = st$ + "\rtf1"  'RTF version 1
        st$ = st$ + "\ansi" 'Ansi language
        st$ = st$ + "\ansicpg1252"  'No idea what this one is
        st$ = st$ + "\deff0"        'Default Font = Font 0
        st$ = st$ + "\deflang1033"  'Default Language = English
        st$ = st$ + "\deflangfe1033"    'Not sure but probably Default English
        st$ = st$ + $CRLF
    '*** Start Font Selections
        st$ = st$ + "{"     'Start Block
        st$ = st$ + "\fonttbl"     'Font Block
    '*** Courier New
        st$ = st$ + "{"
        st$ = st$ + "\f0"   'Font 0
        st$ = st$ + "\fmodern"
        st$ = st$ + "\fprq1"
        st$ = st$ + "\fcharset0 Courier New;"
        st$ = st$ + "}"
        st$ = st$ + $CRLF
    '*** Times New Roman
        st$ = st$ + "{
        st$ = st$ + "\f1"   'Font 1
        st$ = st$ + "\fnil
        st$ = st$ + "\fcharset0 Times New Roman;"
        st$ = st$ + "}"
        st$ = st$ + $CRLF
    '*** Andale
        st$ = st$ + "{
        st$ = st$ + "\f2"   'Font 2
        st$ = st$ + "\fmodern"
        st$ = st$ + "\fprq1"
        st$ = st$ + "\fcharset0 Andale Mono;"
        st$ = st$ + "}"
        st$ = st$ + $CRLF
    '*** Lucida
        st$ = st$ + "{
        st$ = st$ + "\f3"   'Font 3
        st$ = st$ + "\fmodern"
        st$ = st$ + "\fprq1"
        st$ = st$ + "\fcharset0 Lucida CONSOLE;
        st$ = st$ + "}"
        st$ = st$ + $CRLF
    '*** Georgia
        st$ = st$ + "{"
        st$ = st$ + "\f4"   'Font 4
        st$ = st$ + "\froman"
        st$ = st$ + "\fprq2\fcharset0 Georgia;"
        st$ = st$ + "}"
        st$ = st$ + "}"
    '*** End Font Block
        st$ = st$ + $CRLF
    '*** Start Color Block
        st$ = st$ + "{"
        st$ = st$ + "\colortbl "
        st$ = st$ + $CRLF
        st$ = st$ + ";\red128\green0\blue0"+ $CRLF      'MAROON Brownish Red
        st$ = st$ + ";\red0\green128\blue0"+ $CRLF      'TEAL Dark Green
        st$ = st$ + ";\red128\green128\blue0"+ $CRLF    'GREEN Cammo Green
        st$ = st$ + ";\red0\green0\blue128"+ $CRLF      'NAVY Dark Purple
        st$ = st$ + ";\red128\green0\blue128"+ $CRLF    'PURPLE Purple
        st$ = st$ + ";\red0\green128\blue128"+ $CRLF    'TEAL Swatch Green
        st$ = st$ + ";\red128\green128\blue128"+ $CRLF  'GREY Dark Grey
        st$ = st$ + ";\red192\green192\blue192"+ $CRLF  'SILVER Light Grey
        st$ = st$ + ";\red255\green0\blue0"+ $CRLF      'RED Bright Red
        st$ = st$ + ";\red0\green255\blue0"+ $CRLF      'LIME Bright Green
        st$ = st$ + ";\red255\green255\blue0"+ $CRLF    'YELLOW Bright Yellow
        st$ = st$ + ";\red0\green0\blue255"+ $CRLF      'BLUE Bright Blue
        st$ = st$ + ";\red255\green0\blue255"+ $CRLF    'PINK Bright Pink
        st$ = st$ + ";\red0\green255\blue255"+ $CRLF    'AQUA Blue Green
        st$ = st$ + ";\red255\green255\blue255"+ $CRLF  'WHITE White
        st$ = st$ + ";"
        st$ = st$ + "}"
    '*** End Color Block
        st$ = st$ + $CRLF
        st$ = st$ + "\cf1"      'Default Color 1
        st$ = st$ + "\f0"       'Default Font 0
        st$ = st$ + "\fs11 "    'Default Font Size 11
        st$ = st$ + $CRLF
    '*** Commands after this are part of this header until the end closing bracket found
        FUNCTION = st$
    END FUNCTION
    
    FUNCTION RtfCommandsEnd() AS STRING
        FUNCTION = "}"
    END FUNCTION
    
    FUNCTION RtfCommandsEndOfLine() AS STRING
        FUNCTION = "\line "
    END FUNCTION
    
    FUNCTION RtfReplaceCr(CommandString AS STRING) AS STRING
        REPLACE $CR WITH CHR$(174) IN CommandString
        FUNCTION = CommandString
    END FUNCTION
    
    FUNCTION RtfFontCourier() AS STRING
        FUNCTION = "\f0"
    END FUNCTION
    
    FUNCTION RtfFontTimesNewRoman() AS STRING
        FUNCTION = "\f1"
    END FUNCTION
    
    FUNCTION RtfFontAndale() AS STRING
        FUNCTION = "\f2"
    END FUNCTION
    
    FUNCTION RtfFontLucidia() AS STRING
        FUNCTION = "\f3"
    END FUNCTION
    
    FUNCTION RtfFontGeorgia() AS STRING
        FUNCTION = "\f4"
    END FUNCTION
    
    FUNCTION RtfFontBold() AS STRING
        FUNCTION = "\b "
    END FUNCTION
    
    FUNCTION RtfFontUnBold() AS STRING
        FUNCTION = "\b0 "
    END FUNCTION
    
    FUNCTION RtfFontItalic() AS STRING
        FUNCTION = "\i "
    END FUNCTION
    
    FUNCTION RtfFontUnItalic() AS STRING
        FUNCTION = "\i0 "
    END FUNCTION
    
    FUNCTION RtfFontUnderline() AS STRING
        FUNCTION = "\ul "
    END FUNCTION
    
    FUNCTION RtfFontUnUnderline() AS STRING
        FUNCTION = "\ul0 "
    END FUNCTION
    
    FUNCTION RtfFontSize(SizeForFont AS LONG) AS STRING
        FUNCTION = "\fs" + TRIM$(STR$(SizeForFont*2)) + " "
    END FUNCTION
    
    FUNCTION RtfFontMaroon() AS STRING
        FUNCTION = "\cf1 "
    END FUNCTION
    
    FUNCTION RtfFontGreen() AS STRING
        FUNCTION = "\cf2 "
    END FUNCTION
    
    FUNCTION RtfFontOlive() AS STRING
        FUNCTION = "\cf3 "
    END FUNCTION
    
    FUNCTION RtfFontNavy() AS STRING
        FUNCTION = "\cf4 "
    END FUNCTION
    
    FUNCTION RtfFontPurple() AS STRING
        FUNCTION = "\cf5 "
    END FUNCTION
    
    FUNCTION RtfFontTeal() AS STRING
        FUNCTION = "\cf6 "
    END FUNCTION
    
    FUNCTION RtfFontGrey() AS STRING
        FUNCTION = "\cf7 "
    END FUNCTION
    
    FUNCTION RtfFontSilver() AS STRING
        FUNCTION = "\cf8 "
    END FUNCTION
    
    FUNCTION RtfFontRed() AS STRING
        FUNCTION = "\cf9 "
    END FUNCTION
    
    FUNCTION RtfFontLime() AS STRING
        FUNCTION = "\cf10 "
    END FUNCTION
    
    FUNCTION RtfFontYellow() AS STRING
        FUNCTION = "\cf11 "
    END FUNCTION
    
    FUNCTION RtfFontBlue() AS STRING
        FUNCTION = "\cf12 "
    END FUNCTION
    
    FUNCTION RtfFontFuchsia() AS STRING
        FUNCTION = "\cf13 "
    END FUNCTION
    
    FUNCTION RtfFontAqua() AS STRING
        FUNCTION = "\cf14 "
    END FUNCTION
    
    FUNCTION RtfFontWhite() AS STRING
        FUNCTION = "\cf15 "
    END FUNCTION
    
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    ' Rich Edit stream in callback - for streaming in string contents
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    FUNCTION RichEditStreamInString (BYVAL dwCookie AS DWORD, BYVAL pbBuff AS BYTE PTR, _
                                     BYVAL cb AS LONG, pcb AS LONG) AS DWORD
    '    pcb = cb 'number of bytes to copy                                     '<--- Original Example
        pcb = MIN&(cb, LEN(gTxt) - (gPos - 1))   'number of bytes to copy      '<--- Corrected code...Thanx MCM :-)
        IF pcb > 0 THEN                          'copy block from global string directly into Richedit's buffer.
            CopyMemory pbBuff, (gPtr + gPos - 1), pcb      'could use POKE$ too, but this is a bit faster
            gPos = gPos + pcb                              'incr pos for next callback position.
        ELSE
            FUNCTION = %True    'Break the action
        END IF
    END FUNCTION
    SetupAPI.INC....(I wasn't going to include this, because I thought PB did, but a quick look I do not see it...so here goes (sorry about the size)
    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
    SetupApiClassInfo.INC.....(My wrapper to the setupapi...again sorry about the size)
    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)
         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          '<--- NEVER use a hardcoded value you will forget later
         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                          '<--- Supposedly UnUsed
    '                    InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused1 = GetDeviceUnused1                          '<--- Supposedly UnUsed
    '                    InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused2 = GetDeviceUnused2                          '<--- Supposedly UnUsed
    '*** The following replacements are for RTF to display properly
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ClassName
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).FriendlyName
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).DeviceDesc
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).HardwareId
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).CompatibleId
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Service
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ClassGuid
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Driver
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ConfigFlags
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Mfg
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Location
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ObjectName
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Capabilities
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UiNumber
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UpperFilters
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LowerFilters
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).BusTypeGuid
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LegacyBusType
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).BusNumber
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).EnumeratorName
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).SecurityBinary
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).SecuritySelfDirectedSearch
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).DeviceType
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Exclusive
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Characteristics
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Address
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UiNumberDescFormat
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).MaximumProperty
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicy
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicyDefault
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicyOverride
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).InstallState
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LocationPaths
                        REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).PowerData
    '                    REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused0                          '<--- Supposedly UnUsed
    '                    REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused1                          '<--- Supposedly UnUsed
    '                    REPLACE "\" WITH "/" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused2                          '<--- Supposedly UnUsed
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ClassName
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).FriendlyName
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).DeviceDesc
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).HardwareId
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).CompatibleId
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Service
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ClassGuid
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Driver
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ConfigFlags
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Mfg
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Location
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ObjectName
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Capabilities
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UiNumber
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UpperFilters
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LowerFilters
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).BusTypeGuid
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LegacyBusType
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).BusNumber
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).EnumeratorName
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).SecurityBinary
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).SecuritySelfDirectedSearch
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).DeviceType
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Exclusive
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Characteristics
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Address
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UiNumberDescFormat
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).MaximumProperty
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicy
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicyDefault
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicyOverride
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).InstallState
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LocationPaths
                        REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).PowerData
    '                    REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused0                          '<--- Supposedly UnUsed
    '                    REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused1                          '<--- Supposedly UnUsed
    '                    REPLACE "{" WITH "[" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused2                          '<--- Supposedly UnUsed
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ClassName
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).FriendlyName
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).DeviceDesc
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).HardwareId
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).CompatibleId
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Service
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ClassGuid
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Driver
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ConfigFlags
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Mfg
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Location
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).ObjectName
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Capabilities
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UiNumber
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UpperFilters
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LowerFilters
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).BusTypeGuid
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LegacyBusType
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).BusNumber
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).EnumeratorName
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).SecurityBinary
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).SecuritySelfDirectedSearch
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).DeviceType
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Exclusive
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Characteristics
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Address
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).UiNumberDescFormat
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).MaximumProperty
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicy
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicyDefault
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).RemovalPolicyOverride
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).InstallState
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).LocationPaths
                        REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).PowerData
    '                    REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused0                          '<--- Supposedly UnUsed
    '                    REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused1                          '<--- Supposedly UnUsed
    '                    REPLACE "}" WITH "]" IN InfoUsbDriver(UBOUND(InfoUsbDriver)).Unused2                          '<--- Supposedly UnUsed
                        REDIM PRESERVE InfoUsbDriver(UBOUND(InfoUsbDriver) + 1)
                   CASE ELSE
              END SELECT
              INCR i
         LOOP
         DestroyDeviceList
         REDIM PRESERVE InfoUsbDriver(UBOUND(InfoUsbDriver) - 1)                    'Get rid of top UnUsed Element
         FUNCTION = %True
    END FUNCTION
    
    FUNCTION ListSerialDrivers ALIAS "ListSerialDrivers"() EXPORT AS LONG
    '     LOCAL i AS LONG, zText AS ASCIIZ * 1024                         '<--- NEVER use a hardcoded value you will forget later
         LOCAL i AS LONG, zText AS ASCIIZ * %MAX_PATH
    'Default arrays
         REDIM InfoSerialDriver(LBOUND(InfoSerialDriver))
    ' Enumerate devices using SETUPAPI.DLL...
         hDeviceInfo = GetDeviceList
         spdi.cbSize = GetDeviceListSize
         DO UNTIL SetupDiEnumDeviceInfo(hDeviceInfo, i, spdi) = 0
              SELECT CASE UCASE$(GetDeviceClass)
                   CASE "PORTS"
                        SELECT CASE INSTR(UCASE$(GetDeviceFriendlyName), "LPT")
                             CASE 0    'Not a parallel port
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).ClassName = GetDeviceClass
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).FriendlyName = GetDeviceFriendlyName
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).DeviceDesc = GetDeviceDesc
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).HardwareId = GetDeviceHardwareId
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).CompatibleId = GetDeviceCompatibleId
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).Service = GetDeviceService
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).ClassGuid = GetDeviceClassGuid
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).Driver = GetDeviceDriver
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).ConfigFlags = GetDeviceConfigFlags
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).Mfg = GetDeviceMfg
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).Location = GetDeviceLocation
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).ObjectName = GetDeviceObjectName
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).Capabilities = GetDeviceCapabilities
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).UiNumber = GetDeviceUiNumber
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).UpperFilters = GetDeviceUpperFilters
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).LowerFilters = GetDeviceLowerFilters
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).BusTypeGuid = GetDeviceBusTypeGuid
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).LegacyBusType = GetDeviceCompatibleId
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).BusNumber = GetDeviceCompatibleId
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).EnumeratorName = GetDeviceCompatibleId
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).SecurityBinary = GetDeviceCompatibleId
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).SecuritySelfDirectedSearch = GetDeviceSecuritySelfDirectedSearch
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).DeviceType = GetDeviceType
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).Exclusive = GetDeviceExclusive
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).Characteristics = GetDeviceCharacteristics
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).Address = GetDeviceAddress
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).UiNumberDescFormat = GetDeviceUiNumberDescFormat
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).MaximumProperty = GetDeviceMaximumProperty
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicy = GetDeviceRemovalPolicy
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicyDefault = GetDeviceRemovalPolicyDefault
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicyOverride = GetDeviceRemovalPolicyOverride
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).InstallState = GetDeviceInstallState
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).LocationPaths = GetDeviceLocationPaths
                                  InfoSerialDriver(UBOUND(InfoSerialDriver)).PowerData = GetDevicePowerData
    '                              InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused0 = GetDeviceUnused0
    '                              InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused1 = GetDeviceUnused1
    '                              InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused2 = GetDeviceUnused2
    '*** The following replacements are for RTF to display properly
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ClassName
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).FriendlyName
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).DeviceDesc
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).HardwareId
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).CompatibleId
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Service
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ClassGuid
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Driver
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ConfigFlags
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Mfg
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Location
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ObjectName
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Capabilities
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UiNumber
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UpperFilters
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LowerFilters
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).BusTypeGuid
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LegacyBusType
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).BusNumber
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).EnumeratorName
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).SecurityBinary
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).SecuritySelfDirectedSearch
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).DeviceType
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Exclusive
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Characteristics
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Address
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UiNumberDescFormat
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).MaximumProperty
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicy
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicyDefault
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicyOverride
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).InstallState
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LocationPaths
                                  REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).PowerData
    '                              REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused0
    '                              REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused1
    '                              REPLACE "\" WITH "/" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused2
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ClassName
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).FriendlyName
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).DeviceDesc
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).HardwareId
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).CompatibleId
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Service
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ClassGuid
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Driver
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ConfigFlags
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Mfg
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Location
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ObjectName
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Capabilities
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UiNumber
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UpperFilters
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LowerFilters
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).BusTypeGuid
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LegacyBusType
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).BusNumber
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).EnumeratorName
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).SecurityBinary
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).SecuritySelfDirectedSearch
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).DeviceType
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Exclusive
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Characteristics
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Address
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UiNumberDescFormat
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).MaximumProperty
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicy
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicyDefault
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicyOverride
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).InstallState
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LocationPaths
                                  REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).PowerData
    '                              REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused0
    '                              REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused1
    '                              REPLACE "{" WITH "[" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused2
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ClassName
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).FriendlyName
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).DeviceDesc
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).HardwareId
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).CompatibleId
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Service
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ClassGuid
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Driver
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ConfigFlags
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Mfg
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Location
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).ObjectName
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Capabilities
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UiNumber
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UpperFilters
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LowerFilters
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).BusTypeGuid
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LegacyBusType
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).BusNumber
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).EnumeratorName
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).SecurityBinary
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).SecuritySelfDirectedSearch
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).DeviceType
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Exclusive
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Characteristics
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Address
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).UiNumberDescFormat
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).MaximumProperty
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicy
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicyDefault
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).RemovalPolicyOverride
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).InstallState
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).LocationPaths
                                  REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).PowerData
    '                              REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused0
    '                              REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused1
    '                              REPLACE "}" WITH "]" IN InfoSerialDriver(UBOUND(InfoSerialDriver)).Unused2
                                  REDIM PRESERVE InfoSerialDriver(UBOUND(InfoSerialDriver) + 1)
                             CASE ELSE      'Parallel port
                        END SELECT
                   CASE ELSE
              END SELECT
              INCR i
         LOOP
         DestroyDeviceList
         REDIM PRESERVE InfoSerialDriver(UBOUND(InfoSerialDriver) - 1)
         FUNCTION = %True
    END FUNCTION
    and Last (but not least) "SoftwareInfo.INC"
    Code:
    FUNCTION GetSoftwarePath ALIAS "GetSoftwarePath"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM i AS LONG
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         aExeName = FilePath(aExeName)
         REPLACE "\" WITH "/" IN aExeName                       'Added because "\" is an escape code for RTF commands
         FUNCTION = aExeName
    END FUNCTION
    
    FUNCTION GetSoftwarePathName ALIAS "GetSoftwarePathName"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM i AS LONG
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         FUNCTION = FilePathName(aExeName)
    END FUNCTION
    
    FUNCTION GetSoftwareParentPath ALIAS "GetSoftwareParentPath"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM i AS LONG
         GetModuleFileName(BYVAL %NULL, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         aExeName = FilePath(aExeName)
         REPLACE "\" WITH "/" IN aExeName                            'Added because "\" is an escape code for RTF commands
         FUNCTION = aExeName
    END FUNCTION
    
    FUNCTION GetSoftwareParentPathName ALIAS "GetSoftwareParentPathName"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM i AS LONG
         GetModuleFileName(BYVAL %NULL, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         FUNCTION = FilePathName(aExeName)
    END FUNCTION
    
    FUNCTION GetSoftwareCompanyName ALIAS "GetSoftwareCompanyName"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\CompanyName", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION
    
    FUNCTION GetSoftwareFileDescription ALIAS "GetSoftwareFileDescription"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\FileDescription", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION
    
    FUNCTION GetSoftwareFileVersion ALIAS "GetSoftwareFileVersion"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
    
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\FileVersion", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION
    
    FUNCTION GetSoftwareInternalName ALIAS "GetSoftwareInternalName"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
    
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\InternalName", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION
    
    FUNCTION GetSoftwareOriginalFilename ALIAS "GetSoftwareOriginalFilename"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
    
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\OriginalFilename", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION
    
    
    FUNCTION GetSoftwareLegalCopyright ALIAS "GetSoftwareLegalCopyright"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
    
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\LegalCopyright", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION
    
    FUNCTION GetSoftwareProductName ALIAS "GetSoftwareProductName"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
    
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\ProductName", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION
    
    FUNCTION GetSoftwareProductVersion ALIAS "GetSoftwareProductVersion"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\ProductVersion", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION
    
    FUNCTION GetSoftwareComments ALIAS "GetSoftwareComments"()EXPORT AS STRING
         DIM aEXEName AS ASCIIZ * %MAX_PATH
         DIM lDummy AS LONG, lBufferLen AS LONG, i AS LONG
         DIM bBuffer() AS BYTE ,sBuffer AS STRING, pReceive AS ASCIIZ PTR ,lReceive AS LONG
         GetModuleFileName(hInst, aExeName, %MAX_PATH)       'Get Exe/Dll Path and Name
         lBufferlen = GetFileVersionInfoSize(aExeName, lDummy)
         REDIM bBuffer(lBufferlen)
         GetFileVersionInfo(aExeName, 0&, lBufferLen, bBuffer(0))
         FOR i = 0 TO lBufferlen - 1        'Setup for VerQueryValue
              sBuffer=sBuffer + CHR$(bBuffer(i))
         NEXT
         VerQueryValue(BYVAL STRPTR(sBuffer), "\StringFileInfo\040904B0\Comments", pReceive, lReceive) ' 040904E4
         IF pReceive THEN FUNCTION = @pReceive
    END FUNCTION

    Give me a few minutes and I will start posting the header files (should be less painful)

    Leave a comment:


  • Jeffrey W Smith
    replied
    To answer your questions Cliff: I work with all kinds of serial devices to collect temperature, acoustics, and GPS to name a few. Most of these manufactures have software to download the data or record incoming NMEA strings. But, there are a few that have a serious deficiency in features or don't suit my needs. I've been wanting to create serial utilities for a while. A couple of years ago, our company bought a program called Hypack; we only needed it for one feature, and that doesn't work that well. I won't be able to replace that immediately, but I am going to start with this small program.

    My immediate needs are to read in the NMEA strings from a couple of devices, parse the data, and record it in a useable format.

    I like Peter's CheckComm routine and I think it will get me started. I'm looking into the SetupAPI and I'll take the mod offered by Dave Biggs.

    I'm always looking for better ways to do things, including being able to get the description for COM devices out of the registry that are shown in Device Manager. I can see that there are registery entries for the COM devices, but the Key names are rather cryptic. I'll probably have to search through lower level keys to find the ones listed for Com ports.

    On Windows XP Pro:

    To find the USB Com port and Description:
    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Enum\USB\Vid_067b&Pid_2303\5&29c7aec0&0&2

    To find the list of available Com Ports:
    HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM

    Maybe to find the internal Com Ports:
    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Class\{4D36E978-E325-11CE-BFC1-08002BE10318}
    There are several keys below this:
    0000 - usb to serial
    0001 - usb to serial
    0002 - Communications port
    0003 - printer port

    The key 0002 has a binary data value called PortSubClass with a value of 01. My question is, could I assume that means Com port 1?

    Either way, I'm going to have to learn more about how different OS save the serial information in the registry.

    Thanks everybody.

    Leave a comment:


  • Dave Biggs
    replied
    Nice Peter ,

    Just a small mod:
    Code:
    SComm = "\\.\COM" + Format$(LPort)  '"\\.\COMxx" form for ports numbered > 9
    More info on listing installed ports:

    Leave a comment:


  • Peter Lameijn
    replied
    Small modification to detect in-use ports:
    Code:
    #Include "WIN32API.INC"
        
    Function CheckComm (ByVal LPort As Long) As Long
        Local L As Long, Result As Long
        Select Case LPort
          Case < 1
            L = 0
          Case Else
            Local DHandle As Dword, LStatus As Long, SComm As String, L1 As Long
            SComm = "COM" + Format$(LPort)
            DHandle = CreateFile(ByVal StrPtr(SComm), %GENERIC_READ Or %GENERIC_WRITE, 0, _
            ByVal 0, %OPEN_EXISTING, 0, %NULL)
            Result = GetLastError
            If DHandle <> %INVALID_HANDLE_VALUE Then
              L1 = GetCommModemStatus(DHandle, LStatus)
              Sleep 10
              CloseHandle DHandle
              If L1 Then Function = 1 Else Function = 0
            Else
              If Result = %ERROR_ACCESS_DENIED Then Function = 2 Else Function = 0
            End If
        End Select
    End Function
      
    Function PBMain
        Local L1 As Long, S As String
        For L1 = 1 To 10
            S = S & "Com" & Format$(L1) & $Tab & Choose$(CheckComm(L1)+1, "No","Yes", "Yes (In use)") & Chr$(13, 10)
        Next
        #If %Def(%Pb_Win32)
          MsgBox S
        #ElseIf %Def(%Pb_Cc32)
          StdOut S
        WaitKey$
        #EndIf
    End Function

    Leave a comment:


  • Cliff Nichols
    replied
    Gary and Peter have the right concept for "Ports Available", but ports that are exist because some other app or driver or process already has that port open will not show when you run your process in these cases.

    So before I post Jeff (since mine turned out really confusing unless you can follow all the files), are you looking for "Just the Fact Maaaam'...Just the facts" like in Control panel, "Just list the ports", forget the properties until asked for them?

    Leave a comment:


  • Gary Peek
    replied
    Here is another simple example

    Another idea for those of you thinking of adding this feature to programs you already have is to make a subroutine that checks for existing Com Ports and simply pops up and says "Com Ports found: 1,2,5" (or something like that) right before you select the port. Then you don't need to change the selection of the ports in your program.

    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "win32api.inc"
    
    FUNCTION PBMAIN () AS LONG
    
      LOCAL handlecomm AS LONG
      LOCAL c AS LONG
      DIM commexist(1:10) AS LONG  ' array containing info about the exisance of comm port
    
      ' fill array with zero or one depending on whether comm port exists
      handlecomm = FREEFILE
      FOR c = 1 TO 10
        COMM OPEN "COM" + FORMAT$(c) AS #handlecomm
        IF ERR <> 0 THEN
          ERRCLEAR
          commexist(c) = 0
        ELSE
          commexist(c) = 1
          COMM CLOSE #handlecomm
        END IF
      NEXT c
    
      ' this is a quick crude way to display the array
      FOR c = 1 TO 10
        MSGBOX "Com Port " + FORMAT$(c) + "=" + FORMAT$(commexist(c))
      NEXT c
    
    END FUNCTION
    Last edited by Gary Peek; 15 Nov 2007, 04:15 PM. Reason: Another idea...

    Leave a comment:


  • Cliff Nichols
    replied
    Jeff I got it...but a LOT larger than I first thought (mostly because I could not strip it all back to the basics as easily as I 1st thought)

    The differences in the programs you mentioned "Hyperterminal" vs "Some OTHER program" are a matter of the programmers choice (not like they have one *LOL*)
    AKA...Hyperteminal lists what is likely to be used, some others go a lil beyond and list what is existing in the control panel
    (COM1 to COM4) does not equal (OH I have 9 COM ports sort of thing)

    I do not want to dissuade you from what you are trying to do, but if willing to "Take things 1 step farther" so that you get a "It just works" sort of application then maybe you can bare with me...if not then "Comm.bas" is what you need (to start up to COM9 that is, but USB adapters through a whole new twist into that example)

    Your core concept though I will fess up the keywords to look for (in case I can not make a simple example, or can not find time) would be "SetupAPI" but on that concept I do not know what your background for programming is, so it may be a lil overwhelming

    "SetupAPI" for the USB to RS232 concepts (where a USB to RS232 adapter is involved and for lack of a better word "Virtual COM")

    "Comm.bas" is an EXCELLENT example to start with as far as "It will just work" in most cases though and Peter's 1st "Createfile" concept would be a beginning step

    Leave a comment:


  • Jeffrey W Smith
    replied
    Thanks Peter for the quick response. I looked at both sections of code.

    I can't say that the WMI code is easy to understand. I had to find the TB_WMILIB.INC with the WMI helper functions before I could use it. It only returned one of the two available ports (Com1). Com4 is a USB to serial port.

    The API code is clear and I think it helps me get on the way. I'm just wondering if there is another API call I can use to get the long description that was returned in the WMI code. I'm still learning the API.


    If you come up with anything Cliff, I'd like to see it.

    Jeff

    Leave a comment:


  • Peter Lameijn
    replied
    Or through WMI:

    Code:
    ' ========================================================================================
    ' WMI example - Retrieving Com port information
    ' ========================================================================================
        
    #Compile Exe
    #Dim All
    #Include "TB_WMILIB.INC"    ' // WMI helper functions
                                ' see [url]http://www.powerbasic.com/support/pbforums/showpost.php?p=171374&postcount=3[/url]
        
    ' ========================================================================================
    ' Main
    ' ========================================================================================
    Function PBMain
        
       Local hr As Long                   ' // HRESULT
       Local oServices As Dispatch        ' // Services object
       Local vServices As Variant         ' // Services object reference
       Local oItems As Dispatch           ' // Generic collection object
       Local vItems As Variant            ' // Generic collection object reference
       Local oItem As Dispatch            ' // Generic item object
       Local vItem As Variant             ' // Generic item object reference
       Local penum As Dword               ' // Collection's enumerator reference
       Local vCount As Variant            ' // Number of items in the collection
       Local vVar As Variant              ' // General purpose variant
       Local vRes As Variant              ' // General purpose variant
       Local i As Long                    ' // Loop counter
       Local x As Long                    ' // Loop counter
       Dim vArray(0) As Variant           ' // General purpose array of variants
      
       ' // Connect to WMI using a moniker
       hr = WmiGetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2", vServices)
       If hr <> %S_OK Then GoTo Terminate
       Set oServices = vServices
       vServices = Empty
       If IsFalse IsObject(oServices) Then GoTo Terminate
      
       ' // Execute a query to get a reference to the collection of running processes
       vVar = "SELECT * FROM Win32_SerialPort"
       Object Call oServices.ExecQuery(vVar) To vItems
       If ObjResult Then GoTo Terminate
       Set oItems = vItems
       vItems = Empty
       If IsFalse IsObject(oItems) Then GoTo Terminate
      
       ' // Retrieve the number of items in the collection
       Object Get oItems.Count To vCount
       
       ' // Retrieve a reference to the collection's enumerator
       hr = Wmi_NewEnum(ObjPtr(oItems), penum)
       If hr <> %S_OK Or penum = %NULL Then GoTo Terminate
       
       ' // Iterate throught the collection of objects.
       For i = 1 To Variant#(vCount)
          ' // Retrieve a reference to the next object in the collection
          hr = WmiEnum_NextItem(penum, vItem)
          If hr <> %S_OK Then Exit For
          Set oItem = vItem
          If IsFalse IsObject(oItem) Then Exit For
       
          Object Get oItem.Caption To vRes
          ? "Port name: " & Variant$(vRes)
        
       Next
      
       ' // Release the collection enumerator
       WmiRelease penum
       ' // Release the collection object
       If IsObject(oItems) Then Set oItems = Nothing
      
    Terminate:
         
       If IsObject(oServices) Then Set oServices = Nothing
       WaitKey$
         
    End Function
    ' ========================================================================================

    Leave a comment:


  • Cliff Nichols
    replied
    Sounds a bit up my alley, since I am always working with Serial Ports and my next Major version of my software will have to include USB as well. So I have been doing some researching on and off about showing only what is shown in the control panel (meaning Windows knows its connected and ready for use) vs What may be plugged in, but Windows did not recognize it plugged in and can not use it.

    I will poke around my snippets and see what I can glue together for you tonight after work

    Leave a comment:


  • Peter Lameijn
    replied
    Something like this:

    Code:
    #Include "WIN32API.INC"
    
    Function CheckComm (ByVal LPort As Long) As Long
        Local L As Long
        Select Case LPort
          Case < 1
              L = 0
          Case Else
              Local DHandle As Dword, LStatus As Long, SComm As String, L1 As Long
              SComm = "COM" + Format$(LPort)
              DHandle = CreateFile(ByVal StrPtr(SComm), %GENERIC_READ Or %GENERIC_WRITE, 0, _
              ByVal 0, %OPEN_EXISTING, 0, %NULL)
              If DHandle <> %INVALID_HANDLE_VALUE Then
                L1 = GetCommModemStatus(DHandle, LStatus)
                Sleep 10
                CloseHandle DHandle
                If L1 Then Function = 1 Else Function = 0
              End If
        End Select
    End Function
    
    Function PBMain
        Local L1 As Long, S As String
        For L1 = 1 To 10
            S = S & "Com" & Format$(L1) & $Tab & Choose$(CheckComm(L1)+1, "No","Yes") & Chr$(13, 10)
        Next
        #If %Def(%Pb_Win32)
          MsgBox S
        #ElseIf %Def(%Pb_Cc32)
          StdOut S
        WaitKey$
        #EndIf
    End Function

    Leave a comment:


  • Jeffrey W Smith
    started a topic My first serial communications app

    My first serial communications app

    I'm trying to write a little App that reads the NMEA string from a depth sounder so I can display it on a laptop and record the data. I've been looking at the PB sample "Comm.bas".

    I've noticed on programs like Hyperterminal that they show a list of available comm ports, and other programs will show the name of any USB to serial devices. Can anyone point me in the right direction to get a list of available ports that show in the device manager.

    Any advice or code that you could share would be greatly appreciated!

    Jeff
Working...
X