' ########################################################################################
' Microsoft Windows
' File: SetupAPI.inc
' Contents: Public header file for Windows NT Setup and Device Installer services Dll.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_SetupAPI_PBI)
#DEFINE PBX_SetupAPI_PBI
%EQUATE `SETUPAPI_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
#INCLUDE ONCE "Legacy/System/PrSht.inc"
' //
' // determine version of setupapi based on _WIN32_WINDOWS and _WIN32_WINNT
' //
' // NT4 version of setupapi (0x0400) is earliest, and installed onto Win95 by IE.
' // Win2k version of setupapi (0x0500) also shipped in WinME
' // we'll use "0x0410" to indicate version of setupapi shipped with Win98
' //
'#ifndef _SETUPAPI_VER
'#if defined(_WIN32_WINNT) && (!defined(_WIN32_WINDOWS) || (_WIN32_WINNT < _WIN32_WINDOWS))
'#define _SETUPAPI_VER _WIN32_WINNT // SetupAPI version follows Windows NT version
'#elif defined(_WIN32_WINDOWS)
'#if _WIN32_WINDOWS >= 0x0490
'#define _SETUPAPI_VER _WIN32_WINNT_WIN2K // WinME uses same version of SetupAPI as Win2k
'#elif _WIN32_WINDOWS >= 0x0410
'#define _SETUPAPI_VER 0x0410 // Indicates version of SetupAPI shipped with Win98
'#else
'#define _SETUPAPI_VER _WIN32_WINNT_NT4 // Earliest SetupAPI version
'#endif // _WIN32_WINDOWS
'#else // _WIN32_WINNT/_WIN32_WINDOWS
'#define _SETUPAPI_VER _WIN32_WINNT_WINXP
'#endif // _WIN32_WINNT/_WIN32_WINDOWS
'#endif // !_SETUPAPI_VER
#IF NOT %DEF(%WIN32_WINDOWS)
%EQUATE `WIN32_WINDOWS = %WINVER
#ENDIF
#IF NOT %DEF(%SETUPAPI_VER)
'#IF %DEF(%WIN32_WINNT) AND (NOT %DEF(%WIN32_WINDOWS) OR (%WIN32_WINNT < %WIN32_WINDOWS))
#IF %DEF(%WIN32_WINNT) AND (NOT %DEF(%WIN32_WINDOWS) OR (%WIN32_WINNT < %WIN32_WINDOWS))
%EQUATE `SETUPAPI_VER = %WIN32_WINNT ' // SetupAPI version follows Windows NT version
#ELSEIF %DEF(%WIN32_WINDOWS)
'#IF %WIN32_WINDOWS >= &H0490
#IF %WIN32_WINDOWS >= &H0490 AND %WIN32_WINDOWS < %WIN32_WINNT_WINXP
%EQUATE `SETUPAPI_VER = %WIN32_WINNT_WIN2K ' // WinME uses same version of SetupAPI as Win2k
'#ELSEIF %WIN32_WINDOWS >= &H0410
#ELSEIF %WIN32_WINDOWS >= &H0410 AND %WIN32_WINDOWS < %WIN32_WINNT_WINXP
%EQUATE `SETUPAPI_VER = &H0410 ' // Indicates version of SetupAPI shipped with Win98
#ELSEIF %WIN32_WINDOWS >= %WIN32_WINNT_WINXP
%EQUATE `SETUPAPI_VER = %WIN32_WINNT_WINXP
#ELSE
%EQUATE `SETUPAPI_VER = %WIN32_WINNT_NT4 ' // Earliest SetupAPI version
#ENDIF ' %WIN32_WINDOWS
#ELSE ' %WIN32_WINNT/%WIN32_WINDOWS
%EQUATE `SETUPAPI_VER = %WIN32_WINNT_WINXP
#ENDIF ' %WIN32_WINNT/%WIN32_WINDOWS
#ENDIF ' not %SETUPAPI_VER
'#ifndef __LPGUID_DEFINED__
'#define __LPGUID_DEFINED__
'typedef GUID *LPGUID;
'#endif
'//
'// Include spapidef.h for basic definitions and flags
'//
#INCLUDE ONCE "Legacy/System/spapidef.inc"
' //
' // Include commctrl.h for our use of HIMAGELIST and wizard support.
' //
#INCLUDE ONCE "Legacy/COM/CommCtrl.inc"
'//
'// Include devpropdef.h for our use of DEVPROPERTYKEY and DEVPROPTYPE.
'//
#INCLUDE ONCE "Legacy/System/devpropdef.inc"
'#ifdef _WIN64
'#include <pshpack8.h> ' // Assume 8-byte (64-bit) packing throughout
'#else
'#include <pshpack1.h> ' // Assume byte packing throughout (32-bit processor)
'#endif
' //
' // Define maximum string length constants
' //
%EQUATE `LINE_LEN = 256 ' // Windows 9x-compatible maximum for
 ' // displayable strings coming from a
 ' // device INF.
%EQUATE `MAX_INF_STRING_LENGTH = 4096 ' // Actual maximum size of an INF string
 ' // (including string substitutions).
%EQUATE `MAX_INF_SECTION_NAME_LENGTH = 255 ' // For Windows 9x compatibility, INF
 ' // section names should be constrained
 ' // to 32 characters.
%EQUATE `MAX_TITLE_LEN = 60
%EQUATE `MAX_INSTRUCTION_LEN = 256
%EQUATE `MAX_LABEL_LEN = 30
%EQUATE `MAX_SERVICE_NAME_LEN = 256
%EQUATE `MAX_SUBTITLE_LEN = 256
' //
' // Define maximum length of a machine name in the format expected by ConfigMgr32
' // CM_Connect_Machine (i.e., "\\\\MachineName\0").
' //
%EQUATE `SP_MAX_MACHINENAME_LENGTH = (%MAX_PATH + 3)
' //
' // Define type for reference to loaded inf file
' //
'typedef PVOID HINF;
' //
' // Inf context structure. Applications must not interpret or
' // overwrite values in these structures.
' //
' // Size = 16 bytes
TYPE INFCONTEXT DWORD
 Inf AS DWORD
 CurrentInf AS DWORD
 Section AS DWORD ' UINT
 Line AS DWORD ' UINT
END TYPE
' //
' // Inf file information structure.
' //
' // Size = 9 bytes
TYPE SP_INF_INFORMATION BYTE
 InfStyle AS DWORD
 InfCount AS DWORD
 VersionData(0) AS BYTE ' [ANYSIZE_ARRAY]
END TYPE
' //
' // Define structure for passing alternate platform info into
' // SetupSetFileQueueAlternatePlatform and SetupQueryInfOriginalFileInformation.
' //
'typedef struct _SP_ALTPLATFORM_INFO_V2 {
' DWORD cbSize;
' ' //
' ' // platform to use (VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT)
' ' //
' DWORD Platform;
' ' //
' ' // major and minor version numbers to use
' ' //
' DWORD MajorVersion;
' DWORD MinorVersion;
' ' //
' ' // processor architecture to use (PROCESSOR_ARCHITECTURE_INTEL,
' ' // PROCESSOR_ARCHITECTURE_AMD64, or PROCESSOR_ARCHITECTURE_IA64.
' ' //
' WORD ProcessorArchitecture;
' union {
' WORD Reserved; ' // for compatibility with V1 structure
' WORD Flags; ' // indicates validity of non V1 fields
' } DUMMYUNIONNAME;
' ' //
' ' // 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.
' ' //
' DWORD FirstValidatedMajorVersion;
' DWORD FirstValidatedMinorVersion;
'} SP_ALTPLATFORM_INFO_V2, *PSP_ALTPLATFORM_INFO_V2;
' // Size = 2 bytes
UNION SP_ALTPLATFORM_INFO_V2_UNION
 Reserved AS WORD ' // for compatibility with V1 structure
 Flags AS WORD ' // indicates validity of non V1 fields
END UNION
' // Size = 28 bytes
TYPE SP_ALTPLATFORM_INFO_V2 DWORD FILL
 cbSize AS DWORD
 Platform AS DWORD
 MajorVersion AS DWORD
 MinorVersion AS DWORD
 ProcessorArchitecture AS WORD
 SP_ALTPLATFORM_INFO_V2_UNION
 FirstValidatedMajorVersion AS DWORD
 FirstValidatedMinorVersion AS DWORD
END TYPE
'typedef struct _SP_ALTPLATFORM_INFO_V1 {
' DWORD cbSize;
' ' //
' ' // platform to use (VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT)
' ' //
' DWORD Platform;
' ' //
' ' // major and minor version numbers to use
' ' //
' DWORD MajorVersion;
' DWORD MinorVersion;
' ' //
' ' // processor architecture to use (PROCESSOR_ARCHITECTURE_INTEL,
' ' // PROCESSOR_ARCHITECTURE_AMD64, or PROCESSOR_ARCHITECTURE_IA64.
' ' //
' WORD ProcessorArchitecture;
' WORD Reserved; ' // must be zero.
'} SP_ALTPLATFORM_INFO_V1, *PSP_ALTPLATFORM_INFO_V1;
' // Size = 20 bytes
TYPE SP_ALTPLATFORM_INFO_V1 DWORD FILL
 cbSize AS DWORD
 Platform AS DWORD
 MajorVersion AS DWORD
 MinorVersion AS DWORD
 ProcessorArchitecture AS WORD
 Reserved AS WORD
END TYPE
'#if USE_SP_ALTPLATFORM_INFO_V1 || (_SETUPAPI_VER < _WIN32_WINNT_WINXP) // use version 1 altplatform info data structure
#IF %DEF(%USE_SP_ALTPLATFORM_INFO_V1) OR (%SETUPAPI_VER < %WIN32_WINNT_WINXP) ' // use version 1 altplatform info data structure
'typedef SP_ALTPLATFORM_INFO_V1 SP_ALTPLATFORM_INFO;
'typedef PSP_ALTPLATFORM_INFO_V1 PSP_ALTPLATFORM_INFO;
MACRO SP_ALTPLATFORM_INFO = SP_ALTPLATFORM_INFO_V1
'#else ' // use version 2 altplatform info data structure
#ELSE
'typedef SP_ALTPLATFORM_INFO_V2 SP_ALTPLATFORM_INFO;
'typedef PSP_ALTPLATFORM_INFO_V2 PSP_ALTPLATFORM_INFO;
MACRO SP_ALTPLATFORM_INFO = SP_ALTPLATFORM_INFO_V2
' //
' // the following flags are available to SP_ALTPLATFORM_INFO_V2
' //
%EQUATE `SP_ALTPLATFORM_FLAGS_VERSION_RANGE = &H0001 ' // FirstValidatedMajor/MinorVersion
'#endif ' // use current version of altplatform info data structure
#ENDIF
' //
' // 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.
' //
' // Size = 524 bytes
TYPE SP_ORIGINAL_FILE_INFO_A BYTE
 cbSize AS DWORD
 OriginalInfName AS ASCIIZ * %MAX_PATH ' CHAR
 OriginalCatalogName AS ASCIIZ * %MAX_PATH ' CHAR
END TYPE
' // Size = 1044 bytes
TYPE SP_ORIGINAL_FILE_INFO_W BYTE
 cbSize AS DWORD
 OriginalInfName AS WSTRINGZ * %MAX_PATH ' WCHAR
 OriginalCatalogName AS WSTRINGZ * %MAX_PATH ' WCHAR
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
' //
%EQUATE `INF_STYLE_NONE = &H00000000 ' // unrecognized or non-existent
%EQUATE `INF_STYLE_OLDNT = &H00000001 ' // winnt 3.x
%EQUATE `INF_STYLE_WIN4 = &H00000002 ' // Win95
' //
' // Additional InfStyle flags that may be specified when calling SetupOpenInfFile.
' //
' //
%EQUATE `INF_STYLE_CACHE_ENABLE = &H00000010 ' // always cache INF, even outside of %windir%\Inf
%EQUATE `INF_STYLE_CACHE_DISABLE = &H00000020 ' // delete cached INF information
#IF %SETUPAPI_VER >= %WIN32_WINNT_WS03
%EQUATE `INF_STYLE_CACHE_IGNORE = &H00000040 ' // ignore any cached INF information
#ENDIF
' //
' // Target directory specs.
' //
%EQUATE `DIRID_ABSOLUTE = -1 ' // real 32-bit -1
%EQUATE `DIRID_ABSOLUTE_16BIT = &Hffff% ' // 16-bit -1 for compat w/setupx
%EQUATE `DIRID_NULL = 0
%EQUATE `DIRID_SRCPATH = 1
%EQUATE `DIRID_WINDOWS = 10
%EQUATE `DIRID_SYSTEM = 11 ' // system32
%EQUATE `DIRID_DRIVERS = 12
%EQUATE `DIRID_IOSUBSYS = %DIRID_DRIVERS
%EQUATE `DIRID_INF = 17
%EQUATE `DIRID_HELP = 18
%EQUATE `DIRID_FONTS = 20
%EQUATE `DIRID_VIEWERS = 21
%EQUATE `DIRID_COLOR = 23
%EQUATE `DIRID_APPS = 24
%EQUATE `DIRID_SHARED = 25
%EQUATE `DIRID_BOOT = 30
%EQUATE `DIRID_SYSTEM16 = 50
%EQUATE `DIRID_SPOOL = 51
%EQUATE `DIRID_SPOOLDRIVERS = 52
%EQUATE `DIRID_USERPROFILE = 53
%EQUATE `DIRID_LOADER = 54
%EQUATE `DIRID_PRINTPROCESSOR = 55
%EQUATE `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 0x4000. 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.)
' //
%EQUATE `DIRID_COMMON_STARTMENU = 16406 ' // All Users\Start Menu
%EQUATE `DIRID_COMMON_PROGRAMS = 16407 ' // All Users\Start Menu\Programs
%EQUATE `DIRID_COMMON_STARTUP = 16408 ' // All Users\Start Menu\Programs\Startup
%EQUATE `DIRID_COMMON_DESKTOPDIRECTORY = 16409 ' // All Users\Desktop
%EQUATE `DIRID_COMMON_FAVORITES = 16415 ' // All Users\Favorites
%EQUATE `DIRID_COMMON_APPDATA = 16419 ' // All Users\Application Data
%EQUATE `DIRID_PROGRAM_FILES = 16422 ' // Program Files
%EQUATE `DIRID_SYSTEM_X86 = 16425 ' // system32 on RISC
%EQUATE `DIRID_PROGRAM_FILES_X86 = 16426 ' // Program Files on RISC
%EQUATE `DIRID_PROGRAM_FILES_COMMON = 16427 ' // Program Files\Common
%EQUATE `DIRID_PROGRAM_FILES_COMMONX86 = 16428 ' // x86 Program Files\Common on RISC
%EQUATE `DIRID_COMMON_TEMPLATES = 16429 ' // All Users\Templates
%EQUATE `DIRID_COMMON_DOCUMENTS = 16430 ' // All Users\Documents
' //
' // First user-definable dirid. See SetupSetDirectoryId().
' //
%EQUATE `DIRID_USER = &H8000
' //
' // Setup callback notification routine type
' //
'typedef UINT (CALLBACK* PSP_FILE_CALLBACK_A)(
' IN PVOID Context,
' IN UINT Notification,
' IN UINT_PTR Param1,
' IN UINT_PTR Param2
' );
'FUNCTION PSP_FILE_CALLBACK_A ( ' BYVAL DWORD ' IN PVOID Context
' , BYVAL DWORD ' IN UINT Notification
' , BYVAL DWORD ' IN UINT_PTR Param1
' , BYVAL DWORD ' IN UINT_PTR Param2
' ) AS DWORD ' UINT
'typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(
' IN PVOID Context,
' IN UINT Notification,
' IN UINT_PTR Param1,
' IN UINT_PTR Param2
' );
'FUNCTION PSP_FILE_CALLBACK_W ( ' BYVAL DWORD ' IN PVOID Context
' , BYVAL DWORD ' IN UINT Notification
' , BYVAL DWORD ' IN UINT_PTR Param1
' , BYVAL DWORD ' IN UINT_PTR Param2
' ) AS DWORD ' UINT
' //
' // Operation/queue start/end notification. These are ordinal values.
' //
%EQUATE `SPFILENOTIFY_STARTQUEUE = &H00000001
%EQUATE `SPFILENOTIFY_ENDQUEUE = &H00000002
%EQUATE `SPFILENOTIFY_STARTSUBQUEUE = &H00000003
%EQUATE `SPFILENOTIFY_ENDSUBQUEUE = &H00000004
%EQUATE `SPFILENOTIFY_STARTDELETE = &H00000005
%EQUATE `SPFILENOTIFY_ENDDELETE = &H00000006
%EQUATE `SPFILENOTIFY_DELETEERROR = &H00000007
%EQUATE `SPFILENOTIFY_STARTRENAME = &H00000008
%EQUATE `SPFILENOTIFY_ENDRENAME = &H00000009
%EQUATE `SPFILENOTIFY_RENAMEERROR = &H0000000a
%EQUATE `SPFILENOTIFY_STARTCOPY = &H0000000b
%EQUATE `SPFILENOTIFY_ENDCOPY = &H0000000c
%EQUATE `SPFILENOTIFY_COPYERROR = &H0000000d
%EQUATE `SPFILENOTIFY_NEEDMEDIA = &H0000000e
%EQUATE `SPFILENOTIFY_QUEUESCAN = &H0000000f
' //
' // These are used with SetupIterateCabinet().
' //
%EQUATE `SPFILENOTIFY_CABINETINFO = &H00000010
%EQUATE `SPFILENOTIFY_FILEINCABINET = &H00000011
%EQUATE `SPFILENOTIFY_NEEDNEWCABINET = &H00000012
%EQUATE `SPFILENOTIFY_FILEEXTRACTED = &H00000013
%EQUATE `SPFILENOTIFY_FILEOPDELAYED = &H00000014
' //
' // These are used for backup operations
' //
%EQUATE `SPFILENOTIFY_STARTBACKUP = &H00000015
%EQUATE `SPFILENOTIFY_BACKUPERROR = &H00000016
%EQUATE `SPFILENOTIFY_ENDBACKUP = &H00000017
' //
' // Extended notification for SetupScanFileQueue(Flags=SPQ_SCAN_USE_CALLBACKEX)
' //
%EQUATE `SPFILENOTIFY_QUEUESCAN_EX = &H00000018
%EQUATE `SPFILENOTIFY_STARTREGISTRATION = &H00000019
%EQUATE `SPFILENOTIFY_ENDREGISTRATION = &H00000020
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // Extended notification for SetupScanFileQueue(Flags=SPQ_SCAN_USE_CALLBACK_SIGNERINFO)
' //
%EQUATE `SPFILENOTIFY_QUEUESCAN_SIGNERINFO = &H00000040
#ENDIF
'#endif
' //
' // Copy notification. These are bit flags that may be combined.
' //
%EQUATE `SPFILENOTIFY_LANGMISMATCH = &H00010000
%EQUATE `SPFILENOTIFY_TARGETEXISTS = &H00020000
%EQUATE `SPFILENOTIFY_TARGETNEWER = &H00040000
' //
' // File operation codes and callback outcomes.
' //
%EQUATE `FILEOP_COPY = 0
%EQUATE `FILEOP_RENAME = 1
%EQUATE `FILEOP_DELETE = 2
%EQUATE `FILEOP_BACKUP = 3
%EQUATE `FILEOP_ABORT = 0
%EQUATE `FILEOP_DOIT = 1
%EQUATE `FILEOP_SKIP = 2
%EQUATE `FILEOP_RETRY = %FILEOP_DOIT
%EQUATE `FILEOP_NEWPATH = 4
' //
' // Flags in inf copy sections
' //
%EQUATE `COPYFLG_WARN_IF_SKIP = &H00000001 ' // warn if user tries to skip file
%EQUATE `COPYFLG_NOSKIP = &H00000002 ' // disallow skipping this file
%EQUATE `COPYFLG_NOVERSIONCHECK = &H00000004 ' // ignore versions and overwrite target
%EQUATE `COPYFLG_FORCE_FILE_IN_USE = &H00000008 ' // force file-in-use behavior
%EQUATE `COPYFLG_NO_OVERWRITE = &H00000010 ' // do not copy if file exists on target
%EQUATE `COPYFLG_NO_VERSION_DIALOG = &H00000020 ' // do not copy if target is newer
%EQUATE `COPYFLG_OVERWRITE_OLDER_ONLY = &H00000040 ' // leave target alone if version same as source
%EQUATE `COPYFLG_PROTECTED_WINDOWS_DRIVER_FILE = &H00000100 ' // a Windows driver file to be
 ' // protected as other Windows system files
%EQUATE `COPYFLG_REPLACEONLY = &H00000400 ' // copy only if file exists on target
%EQUATE `COPYFLG_NODECOMP = &H00000800 ' // don't attempt to decompress file; copy as-is
%EQUATE `COPYFLG_REPLACE_BOOT_FILE = &H00001000 ' // file must be present upon reboot (i.e., it's
 ' // needed by the loader); this flag implies a reboot
%EQUATE `COPYFLG_NOPRUNE = &H00002000 ' // never prune this file
%EQUATE `COPYFLG_IN_USE_TRY_RENAME = &H00004000 ' // If file in use, try to rename the target first
' //
' // Flags in inf delete sections
' // New flags go in high word
' //
%EQUATE `DELFLG_IN_USE = &H00000001 ' // queue in-use file for delete
%EQUATE `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.
' //
' // Size = 16 bytes
TYPE FILEPATHS_A DWORD
 Target AS ASCIIZ PTR
 Source AS ASCIIZ PTR ' PCSTR // not used for delete operations
 Win32Error AS DWORD ' UINT
 Flags AS DWORD ' DWORD // such as SP_COPY_NOSKIP for copy errors
END TYPE
' // Size = 16 bytes
TYPE FILEPATHS_W DWORD
 Target AS WSTRINGZ PTR
 Source AS WSTRINGZ PTR ' PCWSTR // not used for delete operations
 Win32Error AS DWORD ' UINT
 Flags AS DWORD ' DWORD // such as SP_COPY_NOSKIP for copy errors
END TYPE
#IF %DEF(%UNICODE)
 MACRO FILEPATHS = FILEPATHS_W
#ELSE
 MACRO FILEPATHS = FILEPATHS_A
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' // Size = 28 bytes
TYPE FILEPATHS_SIGNERINFO_A DWORD
 Target AS ASCIIZ PTR
 Source AS ASCIIZ PTR ' PCSTR // not used for delete operations
 Win32Error AS DWORD ' UINT
 Flags AS DWORD ' DWORD // such as SP_COPY_NOSKIP for copy errors
 DigitalSigner AS ASCIIZ PTR
 Version AS ASCIIZ PTR
 CatalogFile AS ASCIIZ PTR
END TYPE
' // Size = 28 bytes
TYPE FILEPATHS_SIGNERINFO_W DWORD
 Target AS WSTRINGZ PTR
 Source AS WSTRINGZ PTR ' PCWSTR // not used for delete operations
 Win32Error AS DWORD ' UINT
 Flags AS DWORD ' DWORD // such as SP_COPY_NOSKIP for copy errors
 DigitalSigner AS WSTRINGZ PTR
 Version AS WSTRINGZ PTR
 CatalogFile AS WSTRINGZ PTR
END TYPE
#IF %DEF(%UNICODE)
 MACRO FILEPATHS_SIGNERINFO = FILEPATHS_SIGNERINFO_W
#ELSE
 MACRO FILEPATHS_SIGNERINFO = FILEPATHS_SIGNERINFO_A
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#ENDIF ' // _SETUPAPI_VER >= 0x0501
' //
' // Structure used with SPFILENOTIFY_NEEDMEDIA
' //
' // Size = 24 bytes
TYPE SOURCE_MEDIA_A DWORD
 Reserved AS ASCIIZ PTR
 Tagfile AS ASCIIZ PTR ' PCSTR // may be NULL
 Description AS ASCIIZ PTR
 ' //
 ' // Pathname part and filename part of source file
 ' // that caused us to need the media.
 ' //
 SourcePath AS ASCIIZ PTR
 SourceFile AS ASCIIZ PTR
 Flags AS DWORD ' DWORD // subset of SP_COPY_xxx
END TYPE
' // Size = 24 bytes
TYPE SOURCE_MEDIA_W DWORD
 Reserved AS WSTRINGZ PTR
 Tagfile AS WSTRINGZ PTR ' PCWSTR // may be NULL
 Description AS WSTRINGZ PTR
 ' //
 ' // Pathname part and filename part of source file
 ' // that caused us to need the media.
 ' //
 SourcePath AS WSTRINGZ PTR
 SourceFile AS WSTRINGZ PTR
 Flags AS DWORD ' DWORD // subset of SP_COPY_xxx
END TYPE
#IF %DEF(%UNICODE)
 MACRO SOURCE_MEDIA = SOURCE_MEDIA_W
#ELSE
 MACRO SOURCE_MEDIA = SOURCE_MEDIA_A
#ENDIF
' //
' // Structure used with SPFILENOTIFY_CABINETINFO and
' // SPFILENOTIFY_NEEDNEWCABINET
' //
' // Size = 16 bytes
TYPE CABINET_INFO_A DWORD FILL
 CabinetPath AS ASCIIZ PTR
 CabinetFile AS ASCIIZ PTR
 DiskName AS ASCIIZ PTR
 SetId AS WORD ' USHORT
 CabinetNumber AS WORD ' USHORT
END TYPE
' // Size = 16 bytes
TYPE CABINET_INFO_W DWORD FILL
 CabinetPath AS WSTRINGZ PTR
 CabinetFile AS WSTRINGZ PTR
 DiskName AS WSTRINGZ PTR
 SetId AS WORD ' USHORT
 CabinetNumber AS WORD ' USHORT
END TYPE
#IF %DEF(%UNICODE)
 MACRO CABINET_INFO = CABINET_INFO_W
#ELSE
 MACRO CABINET_INFO = CABINET_INFO_A
#ENDIF
' //
' // Structure used with SPFILENOTIFY_FILEINCABINET
' //
' // Size = 278 bytes
TYPE FILE_IN_CABINET_INFO_A DWORD FILL
 NameInCabinet AS ASCIIZ PTR
 FileSize AS DWORD
 Win32Error AS DWORD
 DosDate AS WORD ' WORD
 DosTime AS WORD ' WORD
 DosAttribs AS WORD ' WORD
 FullTargetName AS ASCIIZ * %MAX_PATH ' CHAR
END TYPE
' // Size = 538 bytes
TYPE FILE_IN_CABINET_INFO_W DWORD FILL
 NameInCabinet AS WSTRINGZ PTR
 FileSize AS DWORD
 Win32Error AS DWORD
 DosDate AS WORD ' WORD
 DosTime AS WORD ' WORD
 DosAttribs AS WORD ' WORD
 FullTargetName AS WSTRINGZ * %MAX_PATH ' WCHAR
END TYPE
#IF %DEF(%UNICODE)
 MACRO FILE_IN_CABINET_INFO = FILE_IN_CABINET_INFO_W
#ELSE
 MACRO FILE_IN_CABINET_INFO = FILE_IN_CABINET_INFO_A
#ENDIF
' //
' // Structure used for SPFILENOTIFY_***REGISTRATION
' // callback
' //
' // Size = 16 bytes
TYPE SP_REGISTER_CONTROL_STATUSA DWORD
 cbSize AS DWORD
 FileName AS ASCIIZ PTR
 Win32Error AS DWORD
 FailureCode AS DWORD
END TYPE
' // Size = 16 bytes
TYPE SP_REGISTER_CONTROL_STATUSW DWORD
 cbSize AS DWORD
 FileName AS WSTRINGZ PTR
 Win32Error AS DWORD
 FailureCode AS DWORD
END TYPE
' //
' // valid values for SP_REGISTER_CONTROL_STATUS.FailureCode field
' //
%EQUATE `SPREG_SUCCESS = &H00000000
%EQUATE `SPREG_LOADLIBRARY = &H00000001
%EQUATE `SPREG_GETPROCADDR = &H00000002
%EQUATE `SPREG_REGSVR = &H00000003
%EQUATE `SPREG_DLLINSTALL = &H00000004
%EQUATE `SPREG_TIMEOUT = &H00000005
%EQUATE `SPREG_UNKNOWN = &HFFFFFFFF
' //
' // Define type for setup file queue
' //
'typedef PVOID HSPFILEQ;
' //
' // Structure used with SetupQueueCopyIndirect
' //
' // Size = 48 bytes
TYPE SP_FILE_COPY_PARAMS_A DWORD
 cbSize AS DWORD
 QueueHandle AS DWORD ' HSPFILEQ
 SourceRootPath AS ASCIIZ PTR ' PCSTR OPTIONAL
 SourcePath AS ASCIIZ PTR ' PCSTR OPTIONAL
 SourceFilename AS ASCIIZ PTR
 SourceDescription AS ASCIIZ PTR ' PCSTR OPTIONAL
 SourceTagfile AS ASCIIZ PTR ' PCSTR OPTIONAL
 TargetDirectory AS ASCIIZ PTR
 TargetFilename AS ASCIIZ PTR ' PCSTR OPTIONAL
 CopyStyle AS DWORD
 LayoutInf AS DWORD ' HINF OPTIONAL
 SecurityDescriptor AS ASCIIZ PTR ' PCSTR OPTIONAL
END TYPE
' // Size = 48 bytes
TYPE SP_FILE_COPY_PARAMS_W DWORD
 cbSize AS DWORD
 QueueHandle AS DWORD ' HSPFILEQ
 SourceRootPath AS WSTRINGZ PTR ' PCWSTR OPTIONAL
 SourcePath AS WSTRINGZ PTR ' PCWSTR OPTIONAL
 SourceFilename AS WSTRINGZ PTR
 SourceDescription AS WSTRINGZ PTR ' PCWSTR OPTIONAL
 SourceTagfile AS WSTRINGZ PTR ' PCWSTR OPTIONAL
 TargetDirectory AS WSTRINGZ PTR
 TargetFilename AS WSTRINGZ PTR ' PCWSTR OPTIONAL
 CopyStyle AS DWORD
 LayoutInf AS DWORD ' HINF OPTIONAL
 SecurityDescriptor AS WSTRINGZ PTR ' PCSTR OPTIONAL
END TYPE
#IF %DEF(%UNICODE)
 MACRO SP_FILE_COPY_PARAMS = SP_FILE_COPY_PARAMS_W
#ELSE
 MACRO SP_FILE_COPY_PARAMS = SP_FILE_COPY_PARAMS_A
#ENDIF
' //
' // Define type for setup disk space list
' //
'typedef PVOID HDSKSPC;
' //
' // Define type for reference to device information set
' //
'typedef PVOID HDEVINFO;
' //
' // Device information structure (references a device instance
' // that is a member of a device information set)
' //
' // Size = 28 bytes
TYPE SP_DEVINFO_DATA DWORD
 cbSize AS DWORD
 ClassGuid AS GUID ' GUID
 DevInst AS DWORD ' DWORD // DEVINST handle
 Reserved AS DWORD ' ULONG_PTR
END TYPE
' //
' // Device interface information structure (references a device
' // interface that is associated with the device information
' // element that owns it).
' //
' // Size = 28 bytes
TYPE SP_DEVICE_INTERFACE_DATA DWORD
 cbSize AS DWORD
 InterfaceClassGuid AS GUID ' GUID
 Flags AS DWORD
 Reserved AS DWORD ' ULONG_PTR
END TYPE
' //
' // Flags for SP_DEVICE_INTERFACE_DATA.Flags field.
' //
%EQUATE `SPINT_ACTIVE = &H00000001
%EQUATE `SPINT_DEFAULT = &H00000002
%EQUATE `SPINT_REMOVED = &H00000004
' //
' // Backward compatibility--do not use.
' //
'typedef SP_DEVICE_INTERFACE_DATA SP_INTERFACE_DEVICE_DATA;
'typedef PSP_DEVICE_INTERFACE_DATA PSP_INTERFACE_DEVICE_DATA;
'#define SPID_ACTIVE SPINT_ACTIVE
'#define SPID_DEFAULT SPINT_DEFAULT
'#define SPID_REMOVED SPINT_REMOVED
' // Size = 5 bytes
TYPE SP_DEVICE_INTERFACE_DETAIL_DATA_A BYTE
 cbSize AS DWORD
 DevicePath(0) AS BYTE ' [ANYSIZE_ARRAY] CHAR
END TYPE
' // Size = 6 bytes
TYPE SP_DEVICE_INTERFACE_DETAIL_DATA_W WORD
 cbSize AS DWORD
 DevicePath(0) AS WORD ' [ANYSIZE_ARRAY] WCHAR
END TYPE
#IF %DEF(%UNICODE)
 MACRO SP_DEVICE_INTERFACE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_W
#ELSE
 MACRO SP_DEVICE_INTERFACE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_A
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'typedef SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DATA_W;
'typedef PSP_DEVICE_INTERFACE_DETAIL_DATA_W PSP_INTERFACE_DEVICE_DETAIL_DATA_W;
'typedef SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_INTERFACE_DEVICE_DETAIL_DATA_A;
'typedef PSP_DEVICE_INTERFACE_DETAIL_DATA_A PSP_INTERFACE_DEVICE_DETAIL_DATA_A;
' //
' // Structure for detailed information on a device information set (used for
' // SetupDiGetDeviceInfoListDetail which supercedes the functionality of
' // SetupDiGetDeviceInfoListClass).
' //
' // Size = 287 bytes
TYPE SP_DEVINFO_LIST_DETAIL_DATA_A BYTE
 cbSize AS DWORD
 ClassGuid AS GUID ' GUID
 RemoteMachineHandle AS DWORD
 RemoteMachineName AS ASCIIZ * %SP_MAX_MACHINENAME_LENGTH ' CHAR
END TYPE
' // Size = 550 bytes
TYPE SP_DEVINFO_LIST_DETAIL_DATA_W BYTE
 cbSize AS DWORD
 ClassGuid AS GUID ' GUID
 RemoteMachineHandle AS DWORD
 RemoteMachineName AS WSTRINGZ * %SP_MAX_MACHINENAME_LENGTH ' WCHAR
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
' //
%EQUATE `DIF_SELECTDEVICE = &H00000001
%EQUATE `DIF_INSTALLDEVICE = &H00000002
%EQUATE `DIF_ASSIGNRESOURCES = &H00000003
%EQUATE `DIF_PROPERTIES = &H00000004
%EQUATE `DIF_REMOVE = &H00000005
%EQUATE `DIF_FIRSTTIMESETUP = &H00000006
%EQUATE `DIF_FOUNDDEVICE = &H00000007
%EQUATE `DIF_SELECTCLASSDRIVERS = &H00000008
%EQUATE `DIF_VALIDATECLASSDRIVERS = &H00000009
%EQUATE `DIF_INSTALLCLASSDRIVERS = &H0000000A
%EQUATE `DIF_CALCDISKSPACE = &H0000000B
%EQUATE `DIF_DESTROYPRIVATEDATA = &H0000000C
%EQUATE `DIF_VALIDATEDRIVER = &H0000000D
%EQUATE `DIF_DETECT = &H0000000F
%EQUATE `DIF_INSTALLWIZARD = &H00000010
%EQUATE `DIF_DESTROYWIZARDDATA = &H00000011
%EQUATE `DIF_PROPERTYCHANGE = &H00000012
%EQUATE `DIF_ENABLECLASS = &H00000013
%EQUATE `DIF_DETECTVERIFY = &H00000014
%EQUATE `DIF_INSTALLDEVICEFILES = &H00000015
%EQUATE `DIF_UNREMOVE = &H00000016
%EQUATE `DIF_SELECTBESTCOMPATDRV = &H00000017
%EQUATE `DIF_ALLOW_INSTALL = &H00000018
%EQUATE `DIF_REGISTERDEVICE = &H00000019
%EQUATE `DIF_NEWDEVICEWIZARD_PRESELECT = &H0000001A
%EQUATE `DIF_NEWDEVICEWIZARD_SELECT = &H0000001B
%EQUATE `DIF_NEWDEVICEWIZARD_PREANALYZE = &H0000001C
%EQUATE `DIF_NEWDEVICEWIZARD_POSTANALYZE = &H0000001D
%EQUATE `DIF_NEWDEVICEWIZARD_FINISHINSTALL = &H0000001E
%EQUATE `DIF_UNUSED1 = &H0000001F
%EQUATE `DIF_INSTALLINTERFACES = &H00000020
%EQUATE `DIF_DETECTCANCEL = &H00000021
%EQUATE `DIF_REGISTER_COINSTALLERS = &H00000022
%EQUATE `DIF_ADDPROPERTYPAGE_ADVANCED = &H00000023
%EQUATE `DIF_ADDPROPERTYPAGE_BASIC = &H00000024
%EQUATE `DIF_RESERVED1 = &H00000025
%EQUATE `DIF_TROUBLESHOOTER = &H00000026
%EQUATE `DIF_POWERMESSAGEWAKE = &H00000027
%EQUATE `DIF_ADDREMOTEPROPERTYPAGE_ADVANCED = &H00000028
%EQUATE `DIF_UPDATEDRIVER_UI = &H00000029
%EQUATE `DIF_FINISHINSTALL_ACTION = &H0000002A
%EQUATE `DIF_RESERVED2 = &H00000030
' //
' // Obsoleted DIF codes (do not use)
' //
%EQUATE `DIF_MOVEDEVICE = &H0000000E
'typedef UINT DI_FUNCTION; ' // Function type for device installer
' //
' // Device installation parameters structure (associated with a
' // particular device information element, or globally with a device
' // information set)
' //
' // Size = 296 bytes
TYPE SP_DEVINSTALL_PARAMS_A DWORD
 cbSize AS DWORD
 Flags AS DWORD
 FlagsEx AS DWORD
 hwndParent AS DWORD
 InstallMsgHandler AS DWORD ' PSP_FILE_CALLBACK
 InstallMsgHandlerContext AS DWORD
 FileQueue AS DWORD ' HSPFILEQ
 ClassInstallReserved AS DWORD ' ULONG_PTR
 Reserved AS DWORD
 DriverPath AS ASCIIZ * %MAX_PATH ' CHAR
END TYPE
' // Size = 556 bytes
TYPE SP_DEVINSTALL_PARAMS_W DWORD
 cbSize AS DWORD
 Flags AS DWORD
 FlagsEx AS DWORD
 hwndParent AS DWORD
 InstallMsgHandler AS DWORD ' PSP_FILE_CALLBACK
 InstallMsgHandlerContext AS DWORD
 FileQueue AS DWORD ' HSPFILEQ
 ClassInstallReserved AS DWORD ' ULONG_PTR
 Reserved AS DWORD
 DriverPath AS WSTRINGZ * %MAX_PATH ' WCHAR
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
' //
%EQUATE `DI_SHOWOEM = &H00000001 ' // support Other... button
%EQUATE `DI_SHOWCOMPAT = &H00000002 ' // show compatibility list
%EQUATE `DI_SHOWCLASS = &H00000004 ' // show class list
%EQUATE `DI_SHOWALL = &H00000007 ' // both class & compat list shown
%EQUATE `DI_NOVCP = &H00000008 ' // don't create a new copy queue--use
 ' // caller-supplied FileQueue
%EQUATE `DI_DIDCOMPAT = &H00000010 ' // Searched for compatible devices
%EQUATE `DI_DIDCLASS = &H00000020 ' // Searched for class devices
%EQUATE `DI_AUTOASSIGNRES = &H00000040 ' // No UI for resources if possible
' // flags returned by DiInstallDevice to indicate need to reboot/restart
%EQUATE `DI_NEEDRESTART = &H00000080 ' // Reboot required to take effect
%EQUATE `DI_NEEDREBOOT = &H00000100 ' // ""
' // flags for device installation
%EQUATE `DI_NOBROWSE = &H00000200 ' // no Browse... in InsertDisk
' // Flags set by DiBuildDriverInfoList
%EQUATE `DI_MULTMFGS = &H00000400 ' // Set if multiple manufacturers in
 ' // class driver list
' // Flag indicates that device is disabled
%EQUATE `DI_DISABLED = &H00000800 ' // Set if device disabled
' // Flags for Device/Class Properties
%EQUATE `DI_GENERALPAGE_ADDED = &H00001000
%EQUATE `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.
%EQUATE `DI_PROPERTIES_CHANGE = &H00004000
' // Flag to indicate that the sorting from the INF file should be used.
%EQUATE `DI_INF_IS_SORTED = &H00008000
' // Flag to indicate that only the the INF specified by SP_DEVINSTALL_PARAMS.DriverPath
' // should be searched.
%EQUATE `DI_ENUMSINGLEINF = &H00010000
' // Flag that prevents ConfigMgr from removing/re-enumerating devices during device
' // registration, installation, and deletion.
%EQUATE `DI_DONOTCALLCONFIGMG = &H00020000
' // The following flag can be used to install a device disabled
%EQUATE `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.
%EQUATE `DI_COMPAT_FROM_CLASS = &H00080000
' // This flag is set if the Class Install params should be used.
%EQUATE `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.
%EQUATE `DI_NODI_DEFAULTACTION = &H00200000
' // The setupx flag, DI_NOSYNCPROCESSING (0x00400000L) is not support in the Setup APIs.
' // flags for device installation
%EQUATE `DI_QUIETINSTALL = &H00800000 ' // don't confuse the user with
 ' // questions or excess info
%EQUATE `DI_NOFILECOPY = &H01000000 ' // No file Copy necessary
%EQUATE `DI_FORCECOPY = &H02000000 ' // Force files to be copied from install path
%EQUATE `DI_DRIVERPAGE_ADDED = &H04000000 ' // Prop provider added Driver page.
%EQUATE `DI_USECI_SELECTSTRINGS = &H08000000 ' // Use Class Installer Provided strings in the Select Device Dlg
%EQUATE `DI_OVERRIDE_INFFLAGS = &H10000000 ' // Override INF flags
%EQUATE `DI_PROPS_NOCHANGEUSAGE = &H20000000 ' // No Enable/Disable in General Props
%EQUATE `DI_NOSELECTICONS = &H40000000 ' // No small icons in select device dialogs
%EQUATE `DI_NOWRITE_IDS = &H80000000 ' // Don't write HW & Compat IDs on install
' //
' // SP_DEVINSTALL_PARAMS.FlagsEx values
' //
'%DI_FLAGSEX_USEOLDINFSEARCH = &H00000001 ' Windows XP // Inf Search functions should not use Index Search
'%DI_FLAGSEX_RESERVED2 = &H00000002 ' Windows XP // DI_FLAGSEX_AUTOSELECTRANK0 is obsolete
%EQUATE `DI_FLAGSEX_RESERVED2 = &H00000001 ' Windows Vista // DI_FLAGSEX_USEOLDINFSEARCH is obsolete
%EQUATE `DI_FLAGSEX_RESERVED3 = &H00000002 ' Windows Vista // DI_FLAGSEX_AUTOSELECTRANK0 is obsolete
%EQUATE `DI_FLAGSEX_CI_FAILED = &H00000004 ' // Failed to Load/Call class installer
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN //
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `DI_FLAGSEX_FINISHINSTALL_ACTION = &H00000008 ' // Class/co-installer wants to get a DIF_FINISH_INSTALL action in client context.
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN //
%EQUATE `DI_FLAGSEX_DIDINFOLIST = &H00000010 ' // Did the Class Info List
%EQUATE `DI_FLAGSEX_DIDCOMPATINFO = &H00000020 ' // Did the Compat Info List
%EQUATE `DI_FLAGSEX_FILTERCLASSES = &H00000040
%EQUATE `DI_FLAGSEX_SETFAILEDINSTALL = &H00000080
%EQUATE `DI_FLAGSEX_DEVICECHANGE = &H00000100
%EQUATE `DI_FLAGSEX_ALWAYSWRITEIDS = &H00000200
%EQUATE `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.
%EQUATE `DI_FLAGSEX_ALLOWEXCLUDEDDRVS = &H00000800
%EQUATE `DI_FLAGSEX_NOUIONQUERYREMOVE = &H00001000
%EQUATE `DI_FLAGSEX_USECLASSFORCOMPAT = &H00002000 ' // Use the device's class when building compat drv list.
 ' // (Ignored if DI_COMPAT_FROM_CLASS flag is specified.)
%EQUATE `DI_FLAGSEX_RESERVED4 = &H00004000 ' // DI_FLAGSEX_OLDINF_IN_CLASSLIST is obsolete
%EQUATE `DI_FLAGSEX_NO_DRVREG_MODIFY = &H00008000 ' // Don't run AddReg and DelReg for device's software (driver) key.
%EQUATE `DI_FLAGSEX_IN_SYSTEM_SETUP = &H00010000 ' // Installation is occurring during initial system setup.
%EQUATE `DI_FLAGSEX_INET_DRIVER = &H00020000 ' // Driver came from Windows Update
%EQUATE `DI_FLAGSEX_APPENDDRIVERLIST = &H00040000 ' // Cause SetupDiBuildDriverInfoList to append
 ' // a new driver list to an existing list.
%EQUATE `DI_FLAGSEX_PREINSTALLBACKUP = &H00080000 ' // backup all files required by old inf before install
%EQUATE `DI_FLAGSEX_BACKUPONREPLACE = &H00100000 ' // backup files required by old inf as they are replaced
%EQUATE `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)
%EQUATE `DI_FLAGSEX_RESERVED1 = &H00400000
%EQUATE `DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS = &H00800000 ' // Don't include old Internet drivers when building
 ' // a driver list.
%EQUATE `DI_FLAGSEX_POWERPAGE_ADDED = &H01000000 ' // class installer added their own power page
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `DI_FLAGSEX_FILTERSIMILARDRIVERS = &H02000000 ' // only include similar drivers in class list
%EQUATE `DI_FLAGSEX_INSTALLEDDRIVER = &H04000000 ' // only add the installed driver to the class or compat
 ' // driver list. Used in calls to SetupDiBuildDriverInfoList
%EQUATE `DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE = &H08000000 ' // Don't remove identical driver nodes from the class list
%EQUATE `DI_FLAGSEX_ALTPLATFORM_DRVSEARCH = &H10000000 ' // Build driver list based on alternate platform information
 ' // specified in associated file queue
%EQUATE `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
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `DI_FLAGSEX_RECURSIVESEARCH = &H40000000 ' // Tell SetupDiBuildDriverInfoList to do a recursive search
%EQUATE `DI_FLAGSEX_SEARCH_PUBLISHED_INFS = &H80000000 ' // Tell SetupDiBuildDriverInfoList to do a "published INF" search
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
' //
' // 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;
' //
' // Size = 8 bytes
TYPE SP_CLASSINSTALL_HEADER DWORD
 cbSize AS DWORD
 InstallFunction AS DWORD ' DI_FUNCTION
END TYPE
' //
' // Structure corresponding to a DIF_ENABLECLASS install function.
' //
' // Size = 28 bytes
TYPE SP_ENABLECLASS_PARAMS DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 ClassGuid AS GUID
 EnableMessage AS DWORD
END TYPE
%EQUATE `ENABLECLASS_QUERY = 0
%EQUATE `ENABLECLASS_SUCCESS = 1
%EQUATE `ENABLECLASS_FAILURE = 2
' //
' // Values indicating a change in a device's state
' //
%EQUATE `DICS_ENABLE = &H00000001
%EQUATE `DICS_DISABLE = &H00000002
%EQUATE `DICS_PROPCHANGE = &H00000003
%EQUATE `DICS_START = &H00000004
%EQUATE `DICS_STOP = &H00000005
' //
' // Values specifying the scope of a device property change
' //
%EQUATE `DICS_FLAG_GLOBAL = &H00000001 ' // make change in all hardware profiles
%EQUATE `DICS_FLAG_CONFIGSPECIFIC = &H00000002 ' // make change in specified profile only
%EQUATE `DICS_FLAG_CONFIGGENERAL = &H00000004 ' // 1 or more hardware profile-specific
 ' // changes to follow.
' //
' // Structure corresponding to a DIF_PROPERTYCHANGE install function.
' //
' // Size = 20 bytes
TYPE SP_PROPCHANGE_PARAMS DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 StateChange AS DWORD
 Scope AS DWORD
 HwProfile AS DWORD
END TYPE
' //
' // Structure corresponding to a DIF_REMOVE install function.
' //
' // Size = 16 bytes
TYPE SP_REMOVEDEVICE_PARAMS DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 Scope AS DWORD
 HwProfile AS DWORD
END TYPE
%EQUATE `DI_REMOVEDEVICE_GLOBAL = &H00000001
%EQUATE `DI_REMOVEDEVICE_CONFIGSPECIFIC = &H00000002
' //
' // Structure corresponding to a DIF_UNREMOVE install function.
' //
' // Size = 16 bytes
TYPE SP_UNREMOVEDEVICE_PARAMS DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 Scope AS DWORD
 HwProfile AS DWORD
END TYPE
%EQUATE `DI_UNREMOVEDEVICE_CONFIGSPECIFIC = &H00000002
' //
' // Structure corresponding to a DIF_SELECTDEVICE install function.
' //
' // Size = 612 bytes
TYPE SP_SELECTDEVICE_PARAMS_A BYTE
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 Title AS ASCIIZ * %MAX_TITLE_LEN ' CHAR
 Instructions AS ASCIIZ * %MAX_INSTRUCTION_LEN ' CHAR
 ListLabel AS ASCIIZ * %MAX_LABEL_LEN ' CHAR
 SubTitle AS ASCIIZ * %MAX_SUBTITLE_LEN ' CHAR
 Reserved(1) AS BYTE ' // DWORD size alignment
END TYPE
' // Size = 1212 bytes
TYPE SP_SELECTDEVICE_PARAMS_W BYTE
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 Title AS WSTRINGZ * %MAX_TITLE_LEN ' WCHAR
 Instructions AS WSTRINGZ * %MAX_INSTRUCTION_LEN ' WCHAR
 ListLabel AS WSTRINGZ * %MAX_LABEL_LEN ' WCHAR
 SubTitle AS WSTRINGZ * %MAX_SUBTITLE_LEN ' WCHAR
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
' //
'typedef BOOL (CALLBACK* PDETECT_PROGRESS_NOTIFY)(
' IN PVOID ProgressNotifyParam,
' IN DWORD DetectComplete
' );
'FUNCTION DETECT_PROGRESS_NOTIFY ( ' BYVAL DWORD ' IN PVOID ProgressNotifyParam
' , BYVAL DWORD ' IN DWORD DetectComplete
' ) 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.
' //
' // Size = 16 bytes
TYPE SP_DETECTDEVICE_PARAMS DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 DetectProgressNotify AS DWORD ' PDETECT_PROGRESS_NOTIFY
 ProgressNotifyParam AS DWORD
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.
' //
%EQUATE `MAX_INSTALLWIZARD_DYNAPAGES = 20
' // Size = 112 bytes
TYPE SP_INSTALLWIZARD_DATA DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 Flags AS DWORD
 DynamicPages(%MAX_INSTALLWIZARD_DYNAPAGES - 1) AS DWORD ' HPROPSHEETPAGE
 NumDynamicPages AS DWORD
 DynamicPageFlags AS DWORD
 PrivateFlags AS DWORD
 PrivateData AS LONG
 hwndWizardDlg AS DWORD
END TYPE
' //
' // SP_INSTALLWIZARD_DATA.Flags values
' //
%EQUATE `NDW_INSTALLFLAG_DIDFACTDEFS = &H00000001
%EQUATE `NDW_INSTALLFLAG_HARDWAREALLREADYIN = &H00000002
%EQUATE `NDW_INSTALLFLAG_NEEDRESTART = %DI_NEEDRESTART
%EQUATE `NDW_INSTALLFLAG_NEEDREBOOT = %DI_NEEDREBOOT
%EQUATE `NDW_INSTALLFLAG_NEEDSHUTDOWN = &H00000200
%EQUATE `NDW_INSTALLFLAG_EXPRESSINTRO = &H00000400
%EQUATE `NDW_INSTALLFLAG_SKIPISDEVINSTALLED = &H00000800
%EQUATE `NDW_INSTALLFLAG_NODETECTEDDEVS = &H00001000
%EQUATE `NDW_INSTALLFLAG_INSTALLSPECIFIC = &H00002000
%EQUATE `NDW_INSTALLFLAG_SKIPCLASSLIST = &H00004000
%EQUATE `NDW_INSTALLFLAG_CI_PICKED_OEM = &H00008000
%EQUATE `NDW_INSTALLFLAG_PCMCIAMODE = &H00010000
%EQUATE `NDW_INSTALLFLAG_PCMCIADEVICE = &H00020000
%EQUATE `NDW_INSTALLFLAG_USERCANCEL = &H00040000
%EQUATE `NDW_INSTALLFLAG_KNOWNCLASS = &H00080000
' //
' // SP_INSTALLWIZARD_DATA.DynamicPageFlags values
' //
' // This flag is set if a Class installer has added pages to the install wizard.
' //
%EQUATE `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.
' //
%EQUATE `DYNAWIZ_FLAG_ANALYZE_HANDLECONFLICT = &H00000008
' //
' // The following flags are not used by the Windows NT hardware wizard.
' //
%EQUATE `DYNAWIZ_FLAG_INSTALLDET_NEXT = &H00000002
%EQUATE `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.
' //
%EQUATE `MIN_IDD_DYNAWIZ_RESOURCE_ID = 10000
%EQUATE `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)
' //
%EQUATE `IDD_DYNAWIZ_FIRSTPAGE = 10000
' //
' // Resource ID for the page that the Select Device page will go back to.
' // (CLASS INSTALLER PROVIDED)
' //
%EQUATE `IDD_DYNAWIZ_SELECT_PREVPAGE = 10001
' //
' // Resource ID for the page that the Select Device page will go forward to.
' // (CLASS INSTALLER PROVIDED)
' //
%EQUATE `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)
' //
%EQUATE `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)
' //
%EQUATE `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.)
' //
%EQUATE `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.
' //
%EQUATE `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.
' //
%EQUATE `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.
' //
%EQUATE `IDD_DYNAWIZ_SELECTCLASS_PAGE = 10012
' //
' // The following class installer-provided wizard page resource IDs are not used
' // by the Windows NT hardware wizard.
' //
%EQUATE `IDD_DYNAWIZ_INSTALLDETECTED_PREVPAGE = 10006
%EQUATE `IDD_DYNAWIZ_INSTALLDETECTED_NEXTPAGE = 10007
%EQUATE `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
' //
' // Size = 100 bytes
TYPE SP_NEWDEVICEWIZARD_DATA DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 Flags AS DWORD ' DWORD // presently unused--must be zero.
 DynamicPages(%MAX_INSTALLWIZARD_DYNAPAGES - 1) AS DWORD ' HPROPSHEETPAGE
 NumDynamicPages AS DWORD
 hwndWizardDlg AS DWORD
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
' //
'typedef SP_NEWDEVICEWIZARD_DATA SP_ADDPROPERTYPAGE_DATA;
'typedef PSP_NEWDEVICEWIZARD_DATA PSP_ADDPROPERTYPAGE_DATA;
' //
' // Structure corresponding to the DIF_TROUBLESHOOTER install function
' //
' // Size = 528 bytes
TYPE SP_TROUBLESHOOTER_PARAMS_A DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 ChmFile AS ASCIIZ * %MAX_PATH ' CHAR
 HtmlTroubleShooter AS ASCIIZ * %MAX_PATH ' CHAR
END TYPE
' // Size = 1048 bytes
TYPE SP_TROUBLESHOOTER_PARAMS_W DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 ChmFile AS WSTRINGZ * %MAX_PATH ' WCHAR
 HtmlTroubleShooter AS WSTRINGZ * %MAX_PATH ' WCHAR
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
' //
' // Size = 520 bytes
TYPE SP_POWERMESSAGEWAKE_PARAMS_A DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 PowerMessageWake AS ASCIIZ * %LINE_LEN * 2 ' CHAR
END TYPE
' // Size = 1032 bytes
TYPE SP_POWERMESSAGEWAKE_PARAMS_W DWORD
 ClassInstallHeader AS SP_CLASSINSTALL_HEADER
 PowerMessageWake AS WSTRINGZ * %LINE_LEN * 2 ' WCHAR
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)
' //
' // Size = 796 bytes
TYPE SP_DRVINFO_DATA_V2_A BYTE
 cbSize AS DWORD
 DriverType AS DWORD
 Reserved AS DWORD ' ULONG_PTR
 Description AS ASCIIZ * %LINE_LEN ' CHAR
 MfgName AS ASCIIZ * %LINE_LEN ' CHAR
 ProviderName AS ASCIIZ * %LINE_LEN ' CHAR
 DriverDate AS FILETIME ' FILETIME
 DriverVersion AS QUAD ' DWORDLONG
END TYPE
' // Size = 1564 bytes
TYPE SP_DRVINFO_DATA_V2_W BYTE
 cbSize AS DWORD
 DriverType AS DWORD
 Reserved AS DWORD ' ULONG_PTR
 Description AS WSTRINGZ * %LINE_LEN ' WCHAR
 MfgName AS WSTRINGZ * %LINE_LEN ' WCHAR
 ProviderName AS WSTRINGZ * %LINE_LEN ' WCHAR
 DriverDate AS FILETIME ' FILETIME
 DriverVersion AS QUAD ' DWORDLONG
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
' //
' // Size = 780 bytes
TYPE SP_DRVINFO_DATA_V1_A BYTE
 cbSize AS DWORD
 DriverType AS DWORD
 Reserved AS DWORD ' ULONG_PTR
 Description AS ASCIIZ * %LINE_LEN ' CHAR
 MfgName AS ASCIIZ * %LINE_LEN ' CHAR
 ProviderName AS ASCIIZ * %LINE_LEN ' CHAR
END TYPE
' // Size = 1548 bytes
TYPE SP_DRVINFO_DATA_V1_W BYTE
 cbSize AS DWORD
 DriverType AS DWORD
 Reserved AS DWORD ' ULONG_PTR
 Description AS WSTRINGZ * %LINE_LEN ' WCHAR
 MfgName AS WSTRINGZ * %LINE_LEN ' WCHAR
 ProviderName AS WSTRINGZ * %LINE_LEN ' WCHAR
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 %DEF(%USE_SP_DRVINFO_DATA_V1) OR (%SETUPAPI_VER < %WIN32_WINNT_WIN2K) ' // use version 1 driver info data structure
'typedef SP_DRVINFO_DATA_V1_A SP_DRVINFO_DATA_A;
'typedef PSP_DRVINFO_DATA_V1_A PSP_DRVINFO_DATA_A;
'typedef SP_DRVINFO_DATA_V1_W SP_DRVINFO_DATA_W;
'typedef PSP_DRVINFO_DATA_V1_W PSP_DRVINFO_DATA_W;
'typedef SP_DRVINFO_DATA_V1 SP_DRVINFO_DATA;
'typedef PSP_DRVINFO_DATA_V1 PSP_DRVINFO_DATA;
MACRO SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V1_A
MACRO SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V1_W
#IF %DEF(%UNICODE)
 MACRO SP_DRVINFO_DATA = SP_DRVINFO_DATA_V1_W
#ELSE
 MACRO SP_DRVINFO_DATA = SP_DRVINFO_DATA_V1_A
#ENDIF
#ELSE ' // use version 2 driver info data structure
'typedef SP_DRVINFO_DATA_V2_A SP_DRVINFO_DATA_A;
'typedef PSP_DRVINFO_DATA_V2_A PSP_DRVINFO_DATA_A;
'typedef SP_DRVINFO_DATA_V2_W SP_DRVINFO_DATA_W;
'typedef PSP_DRVINFO_DATA_V2_W PSP_DRVINFO_DATA_W;
'typedef SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA;
'typedef PSP_DRVINFO_DATA_V2 PSP_DRVINFO_DATA;
MACRO SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V2_A
MACRO SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V2_W
#IF %DEF(%UNICODE)
 MACRO SP_DRVINFO_DATA = SP_DRVINFO_DATA_V2_W
#ELSE
 MACRO SP_DRVINFO_DATA = SP_DRVINFO_DATA_V2_A
#ENDIF
#ENDIF ' // use current version of driver info data structure
' //
' // Driver information details structure (provides detailed information about a
' // particular driver information structure)
' //
' // Size = 797 bytes
TYPE SP_DRVINFO_DETAIL_DATA_A BYTE
 cbSize AS DWORD
 InfDate AS FILETIME ' FILETIME
 CompatIDsOffset AS DWORD
 CompatIDsLength AS DWORD
 Reserved AS DWORD ' ULONG_PTR
 SectionName AS ASCIIZ * %LINE_LEN ' CHAR
 InfFileName AS ASCIIZ * %MAX_PATH ' CHAR
 DrvDescription AS ASCIIZ * %LINE_LEN ' CHAR
 HardwareID(0) AS BYTE ' [ANYSIZE_ARRAY] CHAR
END TYPE
' // Size = 1570 bytes
TYPE SP_DRVINFO_DETAIL_DATA_W BYTE
 cbSize AS DWORD
 InfDate AS FILETIME ' FILETIME
 CompatIDsOffset AS DWORD
 CompatIDsLength AS DWORD
 Reserved AS DWORD ' ULONG_PTR
 SectionName AS WSTRINGZ * %LINE_LEN ' WCHAR
 InfFileName AS WSTRINGZ * %MAX_PATH ' WCHAR
 DrvDescription AS WSTRINGZ * %LINE_LEN ' WCHAR
 HardwareID(0) AS WORD ' [ANYSIZE_ARRAY] WCHAR
END TYPE
' //
' // Driver installation parameters (associated with a particular driver
' // information element)
' //
' // Size = 20 bytes
TYPE SP_DRVINSTALL_PARAMS DWORD
 cbSize AS DWORD
 Rank AS DWORD
 Flags AS DWORD
 PrivateData AS DWORD ' DWORD_PTR
 Reserved AS DWORD
END TYPE
' //
' // SP_DRVINSTALL_PARAMS.Flags values
' //
%EQUATE `DNF_DUPDESC = &H00000001 ' // Multiple providers have same desc
%EQUATE `DNF_OLDDRIVER = &H00000002 ' // Driver node specifies old/current driver
%EQUATE `DNF_EXCLUDEFROMLIST = &H00000004 ' // If set, this driver node will not be
 ' // displayed in any driver select dialogs.
%EQUATE `DNF_NODRIVER = &H00000008 ' // if we want to install no driver
 ' // (e.g no mouse drv)
%EQUATE `DNF_LEGACYINF = &H00000010 ' // Driver node came from an old-style INF (obsolete)
%EQUATE `DNF_CLASS_DRIVER = &H00000020 ' // Driver node represents a class driver
%EQUATE `DNF_COMPATIBLE_DRIVER = &H00000040 ' // Driver node represents a compatible driver
%EQUATE `DNF_INET_DRIVER = &H00000080 ' // Driver comes from an internet source
%EQUATE `DNF_UNUSED1 = &H00000100
%EQUATE `DNF_INDEXED_DRIVER = &H00000200 ' // Driver is contained in the Windows Driver Index
%EQUATE `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!
%EQUATE `DNF_BAD_DRIVER = &H00000800 ' // Driver node should not be used at all
%EQUATE `DNF_DUPPROVIDER = &H00001000 ' // Multiple drivers have the same provider and desc
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `DNF_INF_IS_SIGNED = &H00002000 ' // If file is digitally signed
%EQUATE `DNF_OEM_F6_INF = &H00004000 ' // INF specified from F6 during textmode setup.
%EQUATE `DNF_DUPDRIVERVER = &H00008000 ' // Multipe drivers have the same desc, provider, and DriverVer values
%EQUATE `DNF_BASIC_DRIVER = &H00010000 ' // Driver provides basic functionality, but should
 ' // not be chosen if other signed drivers exist.
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_WS03
#IF %SETUPAPI_VER >= %WIN32_WINNT_WS03
%EQUATE `DNF_AUTHENTICODE_SIGNED = &H00020000 ' // Inf file is signed by an Authenticode(tm) catalog.
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WS03
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `DNF_INSTALLEDDRIVER = &H00040000 ' // This driver node is currently installed on the device.
%EQUATE `DNF_ALWAYSEXCLUDEFROMLIST = &H00080000 ' // If set, this driver is not even displayed in
 ' // alternative platform either.
%EQUATE `DNF_INBOX_DRIVER = &H00100000 ' // This driver node came from an INF that shipped with Windows.
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
'#if _SETUPAPI_VER >= _WIN32_WINNT_WIN7
#IF %SETUPAPI_VER >= %WIN32_WINNT_WIN7
%EQUATE `DNF_REQUESTADDITIONALSOFTWARE = &H00200000 ' // This driver is only part of a software solution needed
 ' // by this device
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WIN7
%EQUATE `DNF_UNUSED_22 = &H00400000
%EQUATE `DNF_UNUSED_23 = &H00800000
%EQUATE `DNF_UNUSED_24 = &H01000000
%EQUATE `DNF_UNUSED_25 = &H02000000
%EQUATE `DNF_UNUSED_26 = &H04000000
%EQUATE `DNF_UNUSED_27 = &H08000000
%EQUATE `DNF_UNUSED_28 = &H10000000
%EQUATE `DNF_UNUSED_29 = &H20000000
%EQUATE `DNF_UNUSED_30 = &H40000000
%EQUATE `DNF_UNUSED_31 = &H80000000
' //
' // Rank values (the lower the Rank number, the better the Rank)
' //
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `DRIVER_HARDWAREID_RANK = &H00000FFF ' // Any rank less than or equal to
 ' // this value is a trusted
 ' // HardwareID match
%EQUATE `DRIVER_HARDWAREID_MASK = &H80000FFF ' // If you mask these bits off (AND)
 ' // from the Rank and the result is 0
 ' // then the Rank is a trusted HardwareID match
%EQUATE `DRIVER_UNTRUSTED_RANK = &H00008000 ' // Any rank with this bit set is an
 ' // "untrusted" rank, meaning that
 ' // the INF was unsigned.
%EQUATE `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
#ELSE
%EQUATE `DRIVER_HARDWAREID_RANK = &H00000FFF ' // Any rank less than or equal to
 ' // this value is a trusted
 ' // HardwareID match
%EQUATE `DRIVER_COMPATID_RANK = &H00003FFF ' // Any rank less than or equal to
 ' // this (and greater than
 ' // DRIVER_HARDWAREID_RANK) is a
 ' // trusted CompatibleID match
%EQUATE `DRIVER_UNTRUSTED_RANK = &H00008000 ' // Any rank with this bit set is an
 ' // "untrusted" rank, meaning that
 ' // the INF was unsigned.
%EQUATE `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
%EQUATE `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
%EQUATE `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
%EQUATE `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.
%EQUATE `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.
#ENDIF
'#endif // _SETUPAPI_VER < _WIN32_WINNT_LONGHORN
' //
' // Setup callback routine for comparing detection signatures
' //
'typedef DWORD (CALLBACK* PSP_DETSIG_CMPPROC)(
' IN HDEVINFO DeviceInfoSet,
' IN PSP_DEVINFO_DATA NewDeviceData,
' IN PSP_DEVINFO_DATA ExistingDeviceData,
' IN PVOID CompareContext OPTIONAL
' );
'FUNCTION SP_DETSIG_CMPPROC ( ' BYVAL DWORD ' IN HDEVINFO DeviceInfoSet
' , BYREF SP_DEVINFO_DATA ' IN PSP_DEVINFO_DATA NewDeviceData
' , BYREF SP_DEVINFO_DATA ' IN PSP_DEVINFO_DATA ExistingDeviceData
' , BYVAL DWORD ' IN PVOID CompareContext OPTIONAL
' ) AS DWORD
' //
' // Define context structure handed to co-installers
' //
' // Size = 12 bytes
TYPE COINSTALLER_CONTEXT_DATA DWORD
 PostProcessing AS LONG
 InstallResult AS DWORD
 PrivateData AS DWORD
END TYPE
' //
' // Structure containing class image list information.
' //
' // Size = 12 bytes
TYPE SP_CLASSIMAGELIST_DATA DWORD
 cbSize AS DWORD
 ImageList AS DWORD ' HIMAGELIST
 Reserved AS DWORD ' ULONG_PTR
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.
' //
' // Size = 16 bytes
TYPE SP_PROPSHEETPAGE_REQUEST DWORD
 cbSize AS DWORD
 PageRequested AS DWORD
 DeviceInfoSet AS DWORD ' HDEVINFO
 DeviceInfoData AS SP_DEVINFO_DATA PTR ' PSP_DEVINFO_DATA
END TYPE
' //
' // Property sheet codes used in SP_PROPSHEETPAGE_REQUEST.PageRequested
' //
%EQUATE `SPPSR_SELECT_DEVICE_RESOURCES = 1 ' // supplied by setupapi.dll
%EQUATE `SPPSR_ENUM_BASIC_DEVICE_PROPERTIES = 2 ' // supplied by device's BasicProperties32 provider
%EQUATE `SPPSR_ENUM_ADV_DEVICE_PROPERTIES = 3 ' // supplied by class and/or device's EnumPropPages32 provider
' //
' // Structure used with SetupGetBackupInformation/SetupSetBackupInformation
' //
' // Size = 528 bytes
TYPE SP_BACKUP_QUEUE_PARAMS_V2_A BYTE
 cbSize AS DWORD ' DWORD // size of structure
 FullInfPath AS ASCIIZ * %MAX_PATH ' CHAR // buffer to hold ANSI pathname of INF file
 FilenameOffset AS LONG ' INT // offset in CHAR's of filename part (after '\')
 ReinstallInstance AS ASCIIZ * %MAX_PATH ' CHAR // Instance ID (if present)
END TYPE
' // Size = 1048 bytes
TYPE SP_BACKUP_QUEUE_PARAMS_V2_W BYTE
 cbSize AS DWORD ' DWORD // size of structure
 FullInfPath AS WSTRINGZ * %MAX_PATH ' WCHAR // buffer to hold ANSI pathname of INF file
 FilenameOffset AS LONG ' INT // offset in CHAR's of filename part (after '\')
 ReinstallInstance AS WSTRINGZ * %MAX_PATH ' WCHAR // Instance ID (if present)
END TYPE
' //
' // Version 1 of the SP_BACKUP_QUEUE_PARAMS structures, used only for compatibility
' // with Windows 2000/Windows 95/98/ME SETUPAPI.DLL
' //
' // Size = 268 bytes
TYPE SP_BACKUP_QUEUE_PARAMS_V1_A BYTE
 cbSize AS DWORD ' DWORD // size of structure
 FullInfPath AS ASCIIZ * %MAX_PATH ' CHAR // buffer to hold ANSI pathname of INF file
 FilenameOffset AS LONG ' INT // offset in CHAR's of filename part (after '\')
END TYPE
' // Size = 528 bytes
TYPE SP_BACKUP_QUEUE_PARAMS_V1_W BYTE
 cbSize AS DWORD ' DWORD // size of structure
 FullInfPath AS WSTRINGZ * %MAX_PATH ' WCHAR // buffer to hold ANSI pathname of INF file
 FilenameOffset AS LONG ' INT // offset in CHAR'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 %DEF(%USE_SP_BACKUP_QUEUE_PARAMS_V1) OR (%SETUPAPI_VER < &H0501) ' // use version 1 driver info data structure
'typedef SP_BACKUP_QUEUE_PARAMS_V1_A SP_BACKUP_QUEUE_PARAMS_A;
'typedef PSP_BACKUP_QUEUE_PARAMS_V1_A PSP_BACKUP_QUEUE_PARAMS_A;
'typedef SP_BACKUP_QUEUE_PARAMS_V1_W SP_BACKUP_QUEUE_PARAMS_W;
'typedef PSP_BACKUP_QUEUE_PARAMS_V1_W PSP_BACKUP_QUEUE_PARAMS_W;
'typedef SP_BACKUP_QUEUE_PARAMS_V1 SP_BACKUP_QUEUE_PARAMS;
'typedef PSP_BACKUP_QUEUE_PARAMS_V1 PSP_BACKUP_QUEUE_PARAMS;
MACRO SP_BACKUP_QUEUE_PARAMS_A = SP_BACKUP_QUEUE_PARAMS_V1_A
MACRO SP_BACKUP_QUEUE_PARAMS_W = SP_BACKUP_QUEUE_PARAMS_V1_W
#IF %DEF(%UNICODE)
 MACRO SP_BACKUP_QUEUE_PARAMS = SP_BACKUP_QUEUE_PARAMS_V1_W
#ELSE
 MACRO SP_BACKUP_QUEUE_PARAMS = SP_BACKUP_QUEUE_PARAMS_V1_A
#ENDIF
#ELSE ' // use version 2 driver info data structure
'typedef SP_BACKUP_QUEUE_PARAMS_V2_A SP_BACKUP_QUEUE_PARAMS_A;
'typedef PSP_BACKUP_QUEUE_PARAMS_V2_A PSP_BACKUP_QUEUE_PARAMS_A;
'typedef SP_BACKUP_QUEUE_PARAMS_V2_W SP_BACKUP_QUEUE_PARAMS_W;
'typedef PSP_BACKUP_QUEUE_PARAMS_V2_W PSP_BACKUP_QUEUE_PARAMS_W;
'typedef SP_BACKUP_QUEUE_PARAMS_V2 SP_BACKUP_QUEUE_PARAMS;
'typedef PSP_BACKUP_QUEUE_PARAMS_V2 PSP_BACKUP_QUEUE_PARAMS;
MACRO SP_BACKUP_QUEUE_PARAMS_A = SP_BACKUP_QUEUE_PARAMS_V2_A
MACRO SP_BACKUP_QUEUE_PARAMS_W = SP_BACKUP_QUEUE_PARAMS_V2_W
#IF %DEF(%UNICODE)
 MACRO SP_BACKUP_QUEUE_PARAMS = SP_BACKUP_QUEUE_PARAMS_V2_W
#ELSE
 MACRO SP_BACKUP_QUEUE_PARAMS = SP_BACKUP_QUEUE_PARAMS_V2_A
#ENDIF
#ENDIF ' // use current version of driver info data structure
' //
' // Setupapi-specific error codes
' //
' // Inf parse outcomes
' //
%EQUATE `ERROR_EXPECTED_SECTION_NAME = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR 0)
%EQUATE `ERROR_BAD_SECTION_NAME_LINE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR 1)
%EQUATE `ERROR_SECTION_NAME_TOO_LONG = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR 2)
%EQUATE `ERROR_GENERAL_SYNTAX = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR 3)
' //
' // Inf runtime errors
' //
%EQUATE `ERROR_WRONG_INF_STYLE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H100)
%EQUATE `ERROR_SECTION_NOT_FOUND = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H101)
%EQUATE `ERROR_LINE_NOT_FOUND = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H102)
%EQUATE `ERROR_NO_BACKUP = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H103)
' //
' // Device Installer/other errors
' //
%EQUATE `ERROR_NO_ASSOCIATED_CLASS = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H200)
%EQUATE `ERROR_CLASS_MISMATCH = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H201)
%EQUATE `ERROR_DUPLICATE_FOUND = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H202)
%EQUATE `ERROR_NO_DRIVER_SELECTED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H203)
%EQUATE `ERROR_KEY_DOES_NOT_EXIST = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H204)
%EQUATE `ERROR_INVALID_DEVINST_NAME = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H205)
%EQUATE `ERROR_INVALID_CLASS = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H206)
%EQUATE `ERROR_DEVINST_ALREADY_EXISTS = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H207)
%EQUATE `ERROR_DEVINFO_NOT_REGISTERED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H208)
%EQUATE `ERROR_INVALID_REG_PROPERTY = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H209)
%EQUATE `ERROR_NO_INF = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20A)
%EQUATE `ERROR_NO_SUCH_DEVINST = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20B)
%EQUATE `ERROR_CANT_LOAD_CLASS_ICON = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20C)
%EQUATE `ERROR_INVALID_CLASS_INSTALLER = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20D)
%EQUATE `ERROR_DI_DO_DEFAULT = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20E)
%EQUATE `ERROR_DI_NOFILECOPY = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H20F)
%EQUATE `ERROR_INVALID_HWPROFILE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H210)
%EQUATE `ERROR_NO_DEVICE_SELECTED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H211)
%EQUATE `ERROR_DEVINFO_LIST_LOCKED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H212)
%EQUATE `ERROR_DEVINFO_DATA_LOCKED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H213)
%EQUATE `ERROR_DI_BAD_PATH = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H214)
%EQUATE `ERROR_NO_CLASSINSTALL_PARAMS = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H215)
%EQUATE `ERROR_FILEQUEUE_LOCKED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H216)
%EQUATE `ERROR_BAD_SERVICE_INSTALLSECT = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H217)
%EQUATE `ERROR_NO_CLASS_DRIVER_LIST = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H218)
%EQUATE `ERROR_NO_ASSOCIATED_SERVICE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H219)
%EQUATE `ERROR_NO_DEFAULT_DEVICE_INTERFACE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21A)
%EQUATE `ERROR_DEVICE_INTERFACE_ACTIVE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21B)
%EQUATE `ERROR_DEVICE_INTERFACE_REMOVED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21C)
%EQUATE `ERROR_BAD_INTERFACE_INSTALLSECT = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21D)
%EQUATE `ERROR_NO_SUCH_INTERFACE_CLASS = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21E)
%EQUATE `ERROR_INVALID_REFERENCE_STRING = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H21F)
%EQUATE `ERROR_INVALID_MACHINENAME = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H220)
%EQUATE `ERROR_REMOTE_COMM_FAILURE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H221)
%EQUATE `ERROR_MACHINE_UNAVAILABLE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H222)
%EQUATE `ERROR_NO_CONFIGMGR_SERVICES = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H223)
%EQUATE `ERROR_INVALID_PROPPAGE_PROVIDER = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H224)
%EQUATE `ERROR_NO_SUCH_DEVICE_INTERFACE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H225)
%EQUATE `ERROR_DI_POSTPROCESSING_REQUIRED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H226)
%EQUATE `ERROR_INVALID_COINSTALLER = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H227)
%EQUATE `ERROR_NO_COMPAT_DRIVERS = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H228)
%EQUATE `ERROR_NO_DEVICE_ICON = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H229)
%EQUATE `ERROR_INVALID_INF_LOGCONFIG = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22A)
%EQUATE `ERROR_DI_DONT_INSTALL = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22B)
%EQUATE `ERROR_INVALID_FILTER_DRIVER = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22C)
%EQUATE `ERROR_NON_WINDOWS_NT_DRIVER = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22D)
%EQUATE `ERROR_NON_WINDOWS_DRIVER = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22E)
%EQUATE `ERROR_NO_CATALOG_FOR_OEM_INF = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H22F)
%EQUATE `ERROR_DEVINSTALL_QUEUE_NONNATIVE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H230)
%EQUATE `ERROR_NOT_DISABLEABLE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H231)
%EQUATE `ERROR_CANT_REMOVE_DEVINST = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H232)
%EQUATE `ERROR_INVALID_TARGET = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H233)
%EQUATE `ERROR_DRIVER_NONNATIVE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H234)
%EQUATE `ERROR_IN_WOW64 = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H235)
%EQUATE `ERROR_SET_SYSTEM_RESTORE_POINT = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H236)
%EQUATE `ERROR_INCORRECTLY_COPIED_INF = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H237) ' Removed in Windows Vista
%EQUATE `ERROR_SCE_DISABLED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H238)
%EQUATE `ERROR_UNKNOWN_EXCEPTION = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H239)
%EQUATE `ERROR_PNP_REGISTRY_ERROR = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23A)
%EQUATE `ERROR_REMOTE_REQUEST_UNSUPPORTED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23B)
%EQUATE `ERROR_NOT_AN_INSTALLED_OEM_INF = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23C)
%EQUATE `ERROR_INF_IN_USE_BY_DEVICES = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23D)
%EQUATE `ERROR_DI_FUNCTION_OBSOLETE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23E)
%EQUATE `ERROR_NO_AUTHENTICODE_CATALOG = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H23F)
%EQUATE `ERROR_AUTHENTICODE_DISALLOWED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H240)
%EQUATE `ERROR_AUTHENTICODE_TRUSTED_PUBLISHER = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H241)
%EQUATE `ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H242)
%EQUATE `ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H243)
%EQUATE `ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H244)
%EQUATE `ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H245)
%EQUATE `ERROR_DEVICE_INSTALLER_NOT_READY = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H246)
%EQUATE `ERROR_DRIVER_STORE_ADD_FAILED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H247)
%EQUATE `ERROR_DEVICE_INSTALL_BLOCKED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H248)
%EQUATE `ERROR_DRIVER_INSTALL_BLOCKED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H249)
%EQUATE `ERROR_WRONG_INF_TYPE = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H24A)
%EQUATE `ERROR_FILE_HASH_NOT_IN_CATALOG = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H24B)
%EQUATE `ERROR_DRIVER_STORE_DELETE_FAILED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H24C)
' //
' // Setupapi exception codes
' //
%EQUATE `ERROR_UNRECOVERABLE_STACK_OVERFLOW = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H300)
%EQUATE `EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW = %ERROR_UNRECOVERABLE_STACK_OVERFLOW
' //
' // Backward compatibility--do not use.
' //
%EQUATE `ERROR_NO_DEFAULT_INTERFACE_DEVICE = %ERROR_NO_DEFAULT_DEVICE_INTERFACE
%EQUATE `ERROR_INTERFACE_DEVICE_ACTIVE = %ERROR_DEVICE_INTERFACE_ACTIVE
%EQUATE `ERROR_INTERFACE_DEVICE_REMOVED = %ERROR_DEVICE_INTERFACE_REMOVED
%EQUATE `ERROR_NO_SUCH_INTERFACE_DEVICE = %ERROR_NO_SUCH_DEVICE_INTERFACE
' //
' // Win9x migration DLL error code
' //
%EQUATE `ERROR_NOT_INSTALLED = (%APPLICATION_ERROR_MASK OR %ERROR_SEVERITY_ERROR OR &H1000)
DECLARE FUNCTION SetupGetInfInformationA LIB "setupapi.dll" ALIAS "SetupGetInfInformationA" ( BYREF InfSpec AS ANY , BYVAL SearchControl AS QUAD , BYVAL ReturnBuffer AS SP_INF_INFORMATION PTR , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetInfInformationW LIB "setupapi.dll" ALIAS "SetupGetInfInformationW" ( BYREF InfSpec AS ANY
 , BYVAL SearchControl AS DWORD
 , BYVAL ReturnBuffer AS SP_INF_INFORMATION PTR
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetInfInformation = SetupGetInfInformationW
#ELSE
 MACRO SetupGetInfInformation = SetupGetInfInformationA
#ENDIF
' //
' // SearchControl flags for SetupGetInfInformation
' //
%EQUATE `INFINFO_INF_SPEC_IS_HINF = 1
%EQUATE `INFINFO_INF_NAME_IS_ABSOLUTE = 2
%EQUATE `INFINFO_DEFAULT_SEARCH = 3
%EQUATE `INFINFO_REVERSE_DEFAULT_SEARCH = 4
%EQUATE `INFINFO_INF_PATH_LIST_SEARCH = 5
DECLARE FUNCTION SetupQueryInfFileInformationA LIB "setupapi.dll" ALIAS "SetupQueryInfFileInformationA" ( BYVAL InfInformation AS SP_INF_INFORMATION PTR , BYVAL InfIndex AS QUAD , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupQueryInfFileInformationW LIB "setupapi.dll" ALIAS "SetupQueryInfFileInformationW" ( BYVAL InfInformation AS SP_INF_INFORMATION PTR
 , BYVAL InfIndex AS DWORD
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueryInfFileInformation = SetupQueryInfFileInformationW
#ELSE
 MACRO SetupQueryInfFileInformation = SetupQueryInfFileInformationA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupQueryInfOriginalFileInformationA LIB "SetupApi.dll" ALIAS "SetupQueryInfOriginalFileInformationA" ( BYVAL InfInformation AS SP_INF_INFORMATION PTR, BYVAL InfIndex AS QUAD, BYVAL AlternatePlatformInfo AS SP_ALTPLATFORM_INFO PTR, BYVAL OriginalFileInfo AS SP_ORIGINAL_FILE_INFO_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupQueryInfOriginalFileInformationA LIB "setupapi.dll" ALIAS "SetupQueryInfOriginalFileInformationA" ( BYVAL InfInformation AS SP_INF_INFORMATION PTR , BYVAL InfIndex AS QUAD , BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO , BYREF OriginalFileInfo AS SP_ORIGINAL_FILE_INFO_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupQueryInfOriginalFileInformationW LIB "SetupApi.dll" ALIAS "SetupQueryInfOriginalFileInformationW" ( BYVAL InfInformation AS SP_INF_INFORMATION PTR, BYVAL InfIndex AS QUAD, BYVAL AlternatePlatformInfo AS SP_ALTPLATFORM_INFO PTR, BYVAL OriginalFileInfo AS SP_ORIGINAL_FILE_INFO_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupQueryInfOriginalFileInformationW LIB "setupapi.dll" ALIAS "SetupQueryInfOriginalFileInformationW" ( BYVAL InfInformation AS SP_INF_INFORMATION PTR , BYVAL InfIndex AS QUAD , BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO , BYREF OriginalFileInfo AS SP_ORIGINAL_FILE_INFO_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupQueryInfOriginalFileInformation = SetupQueryInfOriginalFileInformationW
#ELSE
 MACRO SetupQueryInfOriginalFileInformation = SetupQueryInfOriginalFileInformationA
#ENDIF
DECLARE FUNCTION SetupQueryInfVersionInformationA LIB "setupapi.dll" ALIAS "SetupQueryInfVersionInformationA" ( BYVAL InfInformation AS SP_INF_INFORMATION PTR , BYVAL InfIndex AS QUAD , BYREF Key AS ASCIIZ , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupQueryInfVersionInformationW LIB "setupapi.dll" ALIAS "SetupQueryInfVersionInformationW" ( BYVAL InfInformation AS SP_INF_INFORMATION PTR
 , BYVAL InfIndex AS DWORD
 , BYREF Key AS WSTRINGZ
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueryInfVersionInformation = SetupQueryInfVersionInformationW
#ELSE
 MACRO SetupQueryInfVersionInformation = SetupQueryInfVersionInformationA
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupGetInfDriverStoreLocationA LIB "SetupApi.dll" ALIAS "SetupGetInfDriverStoreLocationA" ( FileName AS ASCIIZ, BYVAL AlternatePlatformInfo AS SP_ALTPLATFORM_INFO PTR, LocaleName AS ASCIIZ, ReturnBuffer AS ASCIIZ, BYVAL ReturnBufferSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupGetInfDriverStoreLocationA LIB "setupapi.dll" ALIAS "SetupGetInfDriverStoreLocationA" ( BYREF FileName AS ASCIIZ , BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO , BYREF LocaleName AS ASCIIZ , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupGetInfDriverStoreLocationW LIB "SetupApi.dll" ALIAS "SetupGetInfDriverStoreLocationW" ( FileName AS WSTRINGZ, BYVAL AlternatePlatformInfo AS SP_ALTPLATFORM_INFO PTR, LocaleName AS WSTRINGZ, ReturnBuffer AS WSTRINGZ, BYVAL ReturnBufferSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupGetInfDriverStoreLocationW LIB "setupapi.dll" ALIAS "SetupGetInfDriverStoreLocationW" ( BYREF FileName AS WSTRINGZ , BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO , BYREF LocaleName AS WSTRINGZ , BYREF ReturnBuffer AS WSTRINGZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupGetInfDriverStoreLocation = SetupGetInfDriverStoreLocationW
#ELSE
 MACRO SetupGetInfDriverStoreLocation = SetupGetInfDriverStoreLocationA
#ENDIF
DECLARE FUNCTION SetupGetInfPublishedNameA LIB "setupapi.dll" ALIAS "SetupGetInfPublishedNameA" ( BYREF DriverStoreLocation AS ASCIIZ , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetInfPublishedNameW LIB "setupapi.dll" ALIAS "SetupGetInfPublishedNameW" ( BYREF DriverStoreLocation AS WSTRINGZ
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetInfPublishedName = SetupGetInfPublishedNameW
#ELSE
 MACRO SetupGetInfPublishedName = SetupGetInfPublishedNameA
#ENDIF
#ENDIF ' %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
DECLARE FUNCTION SetupGetInfFileListA LIB "setupapi.dll" ALIAS "SetupGetInfFileListA" ( BYREF DirectoryPath AS ASCIIZ , BYVAL InfStyle AS QUAD , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetInfFileListW LIB "setupapi.dll" ALIAS "SetupGetInfFileListW" ( BYREF DirectoryPath AS WSTRINGZ
 , BYVAL InfStyle AS DWORD
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetInfFileList = SetupGetInfFileListW
#ELSE
 MACRO SetupGetInfFileList = SetupGetInfFileListA
#ENDIF
DECLARE FUNCTION SetupOpenInfFileA LIB "setupapi.dll" ALIAS "SetupOpenInfFileA" ( BYREF FileName AS ASCIIZ , BYREF InfClass AS ASCIIZ , BYVAL InfStyle AS QUAD , OPTIONAL BYREF ErrorLine AS QUAD ) AS QUAD ' HINF
DECLARE FUNCTION SetupOpenInfFileW LIB "setupapi.dll" ALIAS "SetupOpenInfFileW" ( BYREF FileName AS WSTRINGZ , BYREF InfClass AS WSTRINGZ , BYVAL InfStyle AS QUAD , OPTIONAL BYREF ErrorLine AS QUAD ) AS QUAD ' HINF
#IF %DEF(%UNICODE)
 MACRO SetupOpenInfFile = SetupOpenInfFileW
#ELSE
 MACRO SetupOpenInfFile = SetupOpenInfFileA
#ENDIF
DECLARE FUNCTION SetupOpenMasterInf LIB "setupapi.dll" ALIAS "SetupOpenMasterInf" ( ) AS QUAD ' HINF
DECLARE FUNCTION SetupOpenAppendInfFileA LIB "setupapi.dll" ALIAS "SetupOpenAppendInfFileA" ( BYREF FileName AS ASCIIZ , BYVAL InfHandle AS QUAD , OPTIONAL BYREF ErrorLine AS QUAD ) AS LONG
DECLARE FUNCTION SetupOpenAppendInfFileW LIB "setupapi.dll" ALIAS "SetupOpenAppendInfFileW" ( BYREF FileName AS WSTRINGZ
 , BYVAL InfHandle AS DWORD
 , OPTIONAL BYREF ErrorLine AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupOpenAppendInfFile = SetupOpenAppendInfFileW
#ELSE
 MACRO SetupOpenAppendInfFile = SetupOpenAppendInfFileA
#ENDIF
DECLARE SUB SetupCloseInfFile LIB "setupapi.dll" ALIAS "SetupCloseInfFile" ( BYVAL InfHandle AS QUAD ) ' void
DECLARE FUNCTION SetupFindFirstLineA LIB "setupapi.dll" ALIAS "SetupFindFirstLineA" ( BYVAL InfHandle AS QUAD , BYREF Section AS ASCIIZ , BYREF Key AS ASCIIZ , BYREF Context AS INFCONTEXT ) AS LONG
DECLARE FUNCTION SetupFindFirstLineW LIB "setupapi.dll" ALIAS "SetupFindFirstLineW" ( BYVAL InfHandle AS QUAD
 , BYREF Section AS WSTRINGZ
 , BYREF Key AS WSTRINGZ
 , BYREF Context AS INFCONTEXT
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupFindFirstLine = SetupFindFirstLineW
#ELSE
 MACRO SetupFindFirstLine = SetupFindFirstLineA
#ENDIF
DECLARE FUNCTION SetupFindNextLine LIB "setupapi.dll" ALIAS "SetupFindNextLine" ( BYREF ContextIn AS INFCONTEXT , BYREF Context AS INFCONTEXT ) AS LONG
DECLARE FUNCTION SetupFindNextMatchLineA LIB "setupapi.dll" ALIAS "SetupFindNextMatchLineA" ( BYREF ContextIn AS INFCONTEXT
 , BYREF Key AS ASCIIZ
 , BYREF Context AS INFCONTEXT
 ) AS LONG
DECLARE FUNCTION SetupFindNextMatchLineW LIB "setupapi.dll" ALIAS "SetupFindNextMatchLineW" ( BYREF ContextIn AS INFCONTEXT
 , BYREF Key AS WSTRINGZ
 , BYREF Context AS INFCONTEXT
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupFindNextMatchLine = SetupFindNextMatchLineW
#ELSE
 MACRO SetupFindNextMatchLine = SetupFindNextMatchLineA
#ENDIF
DECLARE FUNCTION SetupGetLineByIndexA LIB "setupapi.dll" ALIAS "SetupGetLineByIndexA" ( BYVAL InfHandle AS QUAD , BYREF Section AS ASCIIZ , BYVAL Index AS QUAD , BYREF Context AS INFCONTEXT ) AS LONG
DECLARE FUNCTION SetupGetLineByIndexW LIB "setupapi.dll" ALIAS "SetupGetLineByIndexW" ( BYVAL InfHandle AS QUAD
 , BYREF Section AS WSTRINGZ
 , BYVAL Index AS DWORD
 , BYREF Context AS INFCONTEXT
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetLineByIndex = SetupGetLineByIndexW
#ELSE
 MACRO SetupGetLineByIndex = SetupGetLineByIndexA
#ENDIF
DECLARE FUNCTION SetupGetLineCountA LIB "setupapi.dll" ALIAS "SetupGetLineCountA" ( BYVAL InfHandle AS QUAD , BYREF Section AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupGetLineCountW LIB "setupapi.dll" ALIAS "SetupGetLineCountW" ( BYVAL InfHandle AS QUAD
 , BYREF Section AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetLineCount = SetupGetLineCountW
#ELSE
 MACRO SetupGetLineCount = SetupGetLineCountA
#ENDIF
DECLARE FUNCTION SetupGetLineTextA LIB "setupapi.dll" ALIAS "SetupGetLineTextA" ( BYREF Context AS INFCONTEXT , BYVAL InfHandle AS QUAD , BYREF Section AS ASCIIZ , BYREF Key AS ASCIIZ , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetLineTextW LIB "setupapi.dll" ALIAS "SetupGetLineTextW" ( BYREF Context AS INFCONTEXT
 , BYVAL InfHandle AS DWORD
 , BYREF Section AS WSTRINGZ
 , BYREF Key AS WSTRINGZ
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetLineText = SetupGetLineTextW
#ELSE
 MACRO SetupGetLineText = SetupGetLineTextA
#ENDIF
DECLARE FUNCTION SetupGetFieldCount LIB "setupapi.dll" ALIAS "SetupGetFieldCount" ( BYREF Context AS INFCONTEXT ) AS QUAD
DECLARE FUNCTION SetupGetStringFieldA LIB "setupapi.dll" ALIAS "SetupGetStringFieldA" ( BYREF Context AS INFCONTEXT
 , BYVAL FieldIndex AS DWORD
 , BYREF ReturnBuffer AS ASCIIZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
DECLARE FUNCTION SetupGetStringFieldW LIB "setupapi.dll" ALIAS "SetupGetStringFieldW" ( BYREF Context AS INFCONTEXT
 , BYVAL FieldIndex AS DWORD
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetStringField = SetupGetStringFieldW
#ELSE
 MACRO SetupGetStringField = SetupGetStringFieldA
#ENDIF
DECLARE FUNCTION SetupGetIntField LIB "setupapi.dll" ALIAS "SetupGetIntField" ( BYREF Context AS INFCONTEXT , BYVAL FieldIndex AS QUAD , BYREF IntegerValue AS LONG ) AS LONG
DECLARE FUNCTION SetupGetMultiSzFieldA LIB "setupapi.dll" ALIAS "SetupGetMultiSzFieldA" ( BYREF Context AS INFCONTEXT
 , BYVAL FieldIndex AS DWORD
 , BYREF ReturnBuffer AS ASCIIZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
DECLARE FUNCTION SetupGetMultiSzFieldW LIB "setupapi.dll" ALIAS "SetupGetMultiSzFieldW" ( BYREF Context AS INFCONTEXT
 , BYVAL FieldIndex AS DWORD
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetMultiSzField = SetupGetMultiSzFieldW
#ELSE
 MACRO SetupGetMultiSzField = SetupGetMultiSzFieldA
#ENDIF
DECLARE FUNCTION SetupGetBinaryField LIB "setupapi.dll" ALIAS "SetupGetBinaryField" ( BYREF Context AS INFCONTEXT , BYVAL FieldIndex AS QUAD , BYVAL ReturnBuffer AS BYTE PTR , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
' //
' // SetupGetFileCompressionInfo is depreciated
' // use SetupGetFileCompressionInfoEx instead
' //
' // ActualSourceFileName returned by SetupGetFileCompressionInfo
' // must be freed by the export setupapi!MyFree (NT4+ Win95+)
' // or LocalFree (Win2k+)
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupGetFileCompressionInfoA LIB "SetupApi.dll" ALIAS "SetupGetFileCompressionInfoA" ( SourceFileName AS ASCIIZ, BYVAL ActualSourceFileName AS QUAD, ' PSTR *
 SourceFileSize AS DWORD, TargetFileSize AS DWORD, CompressionType AS DWORD ) AS DWORD
#ELSE
DECLARE FUNCTION SetupGetFileCompressionInfoA LIB "setupapi.dll" ALIAS "SetupGetFileCompressionInfoA" ( BYREF SourceFileName AS ASCIIZ , BYREF ActualSourceFileName AS QUAD , BYREF SourceFileSize AS QUAD , BYREF TargetFileSize AS QUAD , BYREF CompressionType AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupGetFileCompressionInfoW LIB "SetupApi.dll" ALIAS "SetupGetFileCompressionInfoW" ( SourceFileName AS WSTRINGZ, BYVAL ActualSourceFileName AS QUAD, ' PWSTR *
 SourceFileSize AS DWORD, TargetFileSize AS DWORD, CompressionType AS DWORD ) AS DWORD
#ELSE
DECLARE FUNCTION SetupGetFileCompressionInfoW LIB "setupapi.dll" ALIAS "SetupGetFileCompressionInfoW" ( BYREF SourceFileName AS WSTRINGZ , BYREF ActualSourceFileName AS QUAD , BYREF SourceFileSize AS QUAD , BYREF TargetFileSize AS QUAD , BYREF CompressionType AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupGetFileCompressionInfo = SetupGetFileCompressionInfoW
#ELSE
 MACRO SetupGetFileCompressionInfo = SetupGetFileCompressionInfoA
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // SetupGetFileCompressionInfoEx is the preferred API over
' // SetupGetFileCompressionInfo. It follows the normal
' // conventions of returning BOOL and writing to user-supplied
' // buffer.
' //
DECLARE FUNCTION SetupGetFileCompressionInfoExA LIB "setupapi.dll" ALIAS "SetupGetFileCompressionInfoExA" ( BYREF SourceFileName AS ASCIIZ , BYREF ActualSourceFileNameBuffer AS ASCIIZ , BYVAL ActualSourceFileNameBufferLen AS QUAD , BYREF RequiredBufferLen AS QUAD , BYREF SourceFileSize AS QUAD , BYREF TargetFileSize AS QUAD , BYREF CompressionType AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetFileCompressionInfoExW LIB "setupapi.dll" ALIAS "SetupGetFileCompressionInfoExW" ( BYREF SourceFileName AS WSTRINGZ
 , BYREF ActualSourceFileNameBuffer AS WSTRINGZ
 , BYVAL ActualSourceFileNameBufferLen AS DWORD
 , BYREF RequiredBufferLen AS DWORD
 , BYREF SourceFileSize AS DWORD
 , BYREF TargetFileSize AS DWORD
 , BYREF CompressionType AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetFileCompressionInfoEx = SetupGetFileCompressionInfoExW
#ELSE
 MACRO SetupGetFileCompressionInfoEx = SetupGetFileCompressionInfoExA
#ENDIF
#ENDIF ' %SETUPAPI_VER >= %WIN32_WINNT_WINXP
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Compression types
' //
%EQUATE `FILE_COMPRESSION_NONE = 0
%EQUATE `FILE_COMPRESSION_WINLZA = 1
%EQUATE `FILE_COMPRESSION_MSZIP = 2
%EQUATE `FILE_COMPRESSION_NTCAB = 3
DECLARE FUNCTION SetupDecompressOrCopyFileA LIB "setupapi.dll" ALIAS "SetupDecompressOrCopyFileA" ( BYREF SourceFileName AS ASCIIZ , BYREF TargetFileName AS ASCIIZ , OPTIONAL BYREF CompressionType AS QUAD ) AS QUAD
DECLARE FUNCTION SetupDecompressOrCopyFileW LIB "setupapi.dll" ALIAS "SetupDecompressOrCopyFileW" ( BYREF SourceFileName AS WSTRINGZ
 , BYREF TargetFileName AS WSTRINGZ
 , OPTIONAL BYREF CompressionType AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO SetupDecompressOrCopyFile = SetupDecompressOrCopyFileW
#ELSE
 MACRO SetupDecompressOrCopyFile = SetupDecompressOrCopyFileA
#ENDIF
DECLARE FUNCTION SetupGetSourceFileLocationA LIB "setupapi.dll" ALIAS "SetupGetSourceFileLocationA" ( BYVAL InfHandle AS QUAD , BYREF InfContext AS INFCONTEXT , BYREF FileName AS ASCIIZ , BYREF SourceId AS QUAD , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetSourceFileLocationW LIB "setupapi.dll" ALIAS "SetupGetSourceFileLocationW" ( BYVAL InfHandle AS QUAD
 , BYREF InfContext AS INFCONTEXT
 , BYREF FileName AS WSTRINGZ
 , BYREF SourceId AS DWORD
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetSourceFileLocation = SetupGetSourceFileLocationW
#ELSE
 MACRO SetupGetSourceFileLocation = SetupGetSourceFileLocationA
#ENDIF
DECLARE FUNCTION SetupGetSourceFileSizeA LIB "setupapi.dll" ALIAS "SetupGetSourceFileSizeA" ( BYVAL InfHandle AS QUAD , BYREF InfContext AS INFCONTEXT , BYREF FileName AS ASCIIZ , BYREF Section AS ASCIIZ , BYREF FileSize AS QUAD , BYVAL RoundingFactor AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetSourceFileSizeW LIB "setupapi.dll" ALIAS "SetupGetSourceFileSizeW" ( BYVAL InfHandle AS QUAD
 , BYREF InfContext AS INFCONTEXT
 , BYREF FileName AS WSTRINGZ
 , BYREF Section AS WSTRINGZ
 , BYREF FileSize AS DWORD
 , BYVAL RoundingFactor AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetSourceFileSize = SetupGetSourceFileSizeW
#ELSE
 MACRO SetupGetSourceFileSize = SetupGetSourceFileSizeA
#ENDIF
DECLARE FUNCTION SetupGetTargetPathA LIB "setupapi.dll" ALIAS "SetupGetTargetPathA" ( BYVAL InfHandle AS QUAD , BYREF InfContext AS INFCONTEXT , BYREF Section AS ASCIIZ , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetTargetPathW LIB "setupapi.dll" ALIAS "SetupGetTargetPathW" ( BYVAL InfHandle AS QUAD
 , BYREF InfContext AS INFCONTEXT
 , BYREF Section AS WSTRINGZ
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetTargetPath = SetupGetTargetPathW
#ELSE
 MACRO SetupGetTargetPath = SetupGetTargetPathA
#ENDIF
' //
' // Define flags for SourceList APIs.
' //
%EQUATE `SRCLIST_TEMPORARY = &H00000001
%EQUATE `SRCLIST_NOBROWSE = &H00000002
%EQUATE `SRCLIST_SYSTEM = &H00000010
%EQUATE `SRCLIST_USER = &H00000020
%EQUATE `SRCLIST_SYSIFADMIN = &H00000040
%EQUATE `SRCLIST_SUBDIRS = &H00000100
%EQUATE `SRCLIST_APPEND = &H00000200
%EQUATE `SRCLIST_NOSTRIPPLATFORM = &H00000400
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupSetSourceListA LIB "SetupApi.dll" ALIAS "SetupSetSourceListA" ( BYVAL Flags AS QUAD, BYVAL SourceList AS QUAD, ' PCSTR *
 BYVAL SourceCount AS DWORD ) AS LONG
#ELSE
DECLARE FUNCTION SetupSetSourceListA LIB "setupapi.dll" ALIAS "SetupSetSourceListA" ( BYVAL Flags AS QUAD , BYREF SourceList AS ASCIIZ , BYVAL SourceCount AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupSetSourceListW LIB "SetupApi.dll" ALIAS "SetupSetSourceListW" ( BYVAL Flags AS QUAD, BYVAL SourceList AS QUAD, ' PCWSTR *
 BYVAL SourceCount AS DWORD ) AS LONG
#ELSE
DECLARE FUNCTION SetupSetSourceListW LIB "setupapi.dll" ALIAS "SetupSetSourceListW" ( BYVAL Flags AS QUAD , BYREF SourceList AS WSTRINGZ , BYVAL SourceCount AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupSetSourceList = SetupSetSourceListW
#ELSE
 MACRO SetupSetSourceList = SetupSetSourceListA
#ENDIF
DECLARE FUNCTION SetupCancelTemporarySourceList LIB "setupapi.dll" ALIAS "SetupCancelTemporarySourceList" ( ) AS LONG
DECLARE FUNCTION SetupAddToSourceListA LIB "setupapi.dll" ALIAS "SetupAddToSourceListA" ( BYVAL Flags AS QUAD , BYREF Source AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION SetupAddToSourceListW LIB "setupapi.dll" ALIAS "SetupAddToSourceListW" ( BYVAL Flags AS DWORD
 , BYREF Source AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupAddToSourceList = SetupAddToSourceListW
#ELSE
 MACRO SetupAddToSourceList = SetupAddToSourceListA
#ENDIF
DECLARE FUNCTION SetupRemoveFromSourceListA LIB "setupapi.dll" ALIAS "SetupRemoveFromSourceListA" ( BYVAL Flags AS QUAD , BYREF Source AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupRemoveFromSourceListW LIB "setupapi.dll" ALIAS "SetupRemoveFromSourceListW" ( BYVAL Flags AS QUAD
 , BYREF Source AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupRemoveFromSourceList = SetupRemoveFromSourceListW
#ELSE
 MACRO SetupRemoveFromSourceList = SetupRemoveFromSourceListA
#ENDIF
DECLARE FUNCTION SetupQuerySourceListA LIB "setupapi.dll" ALIAS "SetupQuerySourceListA" ( BYVAL Flags AS QUAD , BYREF List AS QUAD , BYREF Count AS QUAD ) AS LONG
DECLARE FUNCTION SetupQuerySourceListW LIB "setupapi.dll" ALIAS "SetupQuerySourceListW" ( BYVAL Flags AS QUAD
 , BYREF List AS DWORD
 , BYREF Count AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQuerySourceList = SetupQuerySourceListW
#ELSE
 MACRO SetupQuerySourceList = SetupQuerySourceListA
#ENDIF
DECLARE FUNCTION SetupFreeSourceListA LIB "setupapi.dll" ALIAS "SetupFreeSourceListA" ( BYREF List AS QUAD , BYVAL Count AS QUAD ) AS LONG
DECLARE FUNCTION SetupFreeSourceListW LIB "setupapi.dll" ALIAS "SetupFreeSourceListW" ( BYREF List AS QUAD
 , BYVAL Count AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupFreeSourceList = SetupFreeSourceListW
#ELSE
 MACRO SetupFreeSourceList = SetupFreeSourceListA
#ENDIF
DECLARE FUNCTION SetupPromptForDiskA LIB "setupapi.dll" ALIAS "SetupPromptForDiskA" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS ASCIIZ , BYREF DiskName AS ASCIIZ , BYREF PathToSource AS ASCIIZ , BYREF FileSought AS ASCIIZ , BYREF TagFile AS ASCIIZ , BYVAL DiskPromptStyle AS QUAD , BYREF PathBuffer AS ASCIIZ , BYVAL PathBufferSize AS QUAD , OPTIONAL BYREF PathRequiredSize AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION SetupPromptForDiskW LIB "setupapi.dll" ALIAS "SetupPromptForDiskW" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS WSTRINGZ , BYREF DiskName AS WSTRINGZ , BYREF PathToSource AS WSTRINGZ , BYREF FileSought AS WSTRINGZ , BYREF TagFile AS WSTRINGZ , BYVAL DiskPromptStyle AS QUAD , BYREF PathBuffer AS WSTRINGZ , BYVAL PathBufferSize AS QUAD , OPTIONAL BYREF PathRequiredSize AS QUAD ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO SetupPromptForDisk = SetupPromptForDiskW
#ELSE
 MACRO SetupPromptForDisk = SetupPromptForDiskA
#ENDIF
DECLARE FUNCTION SetupCopyErrorA LIB "setupapi.dll" ALIAS "SetupCopyErrorA" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS ASCIIZ , BYREF DiskName AS ASCIIZ , BYREF PathToSource AS ASCIIZ , BYREF SourceFile AS ASCIIZ , BYREF TargetPathFile AS ASCIIZ , BYVAL Win32ErrorCode AS QUAD , BYVAL Style AS QUAD , BYREF PathBuffer AS ASCIIZ , BYVAL PathBufferSize AS QUAD , OPTIONAL BYREF PathRequiredSize AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION SetupCopyErrorW LIB "setupapi.dll" ALIAS "SetupCopyErrorW" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS WSTRINGZ , BYREF DiskName AS WSTRINGZ , BYREF PathToSource AS WSTRINGZ , BYREF SourceFile AS WSTRINGZ , BYREF TargetPathFile AS WSTRINGZ , BYVAL Win32ErrorCode AS QUAD , BYVAL Style AS QUAD , BYREF PathBuffer AS WSTRINGZ , BYVAL PathBufferSize AS QUAD , OPTIONAL BYREF PathRequiredSize AS QUAD ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO SetupCopyError = SetupCopyErrorW
#ELSE
 MACRO SetupCopyError = SetupCopyErrorA
#ENDIF
DECLARE FUNCTION SetupRenameErrorA LIB "setupapi.dll" ALIAS "SetupRenameErrorA" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS ASCIIZ , BYREF SourceFile AS ASCIIZ , BYREF TargetFile AS ASCIIZ , BYVAL Win32ErrorCode AS QUAD , BYVAL Style AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION SetupRenameErrorW LIB "setupapi.dll" ALIAS "SetupRenameErrorW" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS WSTRINGZ , BYREF SourceFile AS WSTRINGZ , BYREF TargetFile AS WSTRINGZ , BYVAL Win32ErrorCode AS QUAD , BYVAL Style AS QUAD ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO SetupRenameError = SetupRenameErrorW
#ELSE
 MACRO SetupRenameError = SetupRenameErrorA
#ENDIF
DECLARE FUNCTION SetupDeleteErrorA LIB "setupapi.dll" ALIAS "SetupDeleteErrorA" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS ASCIIZ , BYREF File AS ASCIIZ , BYVAL Win32ErrorCode AS QUAD , BYVAL Style AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION SetupDeleteErrorW LIB "setupapi.dll" ALIAS "SetupDeleteErrorW" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS WSTRINGZ , BYREF File AS WSTRINGZ , BYVAL Win32ErrorCode AS QUAD , BYVAL Style AS QUAD ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO SetupDeleteError = SetupDeleteErrorW
#ELSE
 MACRO SetupDeleteError = SetupDeleteErrorA
#ENDIF
DECLARE FUNCTION SetupBackupErrorA LIB "setupapi.dll" ALIAS "SetupBackupErrorA" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS ASCIIZ , BYREF SourceFile AS ASCIIZ , BYREF TargetFile AS ASCIIZ , BYVAL Win32ErrorCode AS QUAD , BYVAL Style AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION SetupBackupErrorW LIB "setupapi.dll" ALIAS "SetupBackupErrorW" ( BYVAL hwndParent AS QUAD , BYREF DialogTitle AS WSTRINGZ , BYREF SourceFile AS WSTRINGZ , BYREF TargetFile AS WSTRINGZ , BYVAL Win32ErrorCode AS QUAD , BYVAL Style AS QUAD ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO SetupBackupError = SetupBackupErrorW
#ELSE
 MACRO SetupBackupError = SetupBackupErrorA
#ENDIF
' //
' // Styles for SetupPromptForDisk, SetupCopyError,
' // SetupRenameError, SetupDeleteError
' //
%EQUATE `IDF_NOBROWSE = &H00000001
%EQUATE `IDF_NOSKIP = &H00000002
%EQUATE `IDF_NODETAILS = &H00000004
%EQUATE `IDF_NOCOMPRESSED = &H00000008
%EQUATE `IDF_CHECKFIRST = &H00000100
%EQUATE `IDF_NOBEEP = &H00000200
%EQUATE `IDF_NOFOREGROUND = &H00000400
%EQUATE `IDF_WARNIFSKIP = &H00000800
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `IDF_NOREMOVABLEMEDIAPROMPT = &H00001000
%EQUATE `IDF_USEDISKNAMEASPROMPT = &H00002000
%EQUATE `IDF_OEMDISK = &H80000000
#ENDIF ' %SETUPAPI_VER >= %WIN32_WINNT_WINXP
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Return values for SetupPromptForDisk, SetupCopyError,
' // SetupRenameError, SetupDeleteError, SetupBackupError
' //
%EQUATE `DPROMPT_SUCCESS = 0
%EQUATE `DPROMPT_CANCEL = 1
%EQUATE `DPROMPT_SKIPFILE = 2
%EQUATE `DPROMPT_BUFFERTOOSMALL = 3
%EQUATE `DPROMPT_OUTOFMEMORY = 4
DECLARE FUNCTION SetupSetDirectoryIdA LIB "setupapi.dll" ALIAS "SetupSetDirectoryIdA" ( BYVAL InfHandle AS QUAD , BYVAL Id AS QUAD , OPTIONAL BYREF Directory AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupSetDirectoryIdW LIB "setupapi.dll" ALIAS "SetupSetDirectoryIdW" ( BYVAL InfHandle AS QUAD
 , BYVAL Id AS DWORD
 , OPTIONAL BYREF Directory AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupSetDirectoryId = SetupSetDirectoryIdW
#ELSE
 MACRO SetupSetDirectoryId = SetupSetDirectoryIdA
#ENDIF
DECLARE FUNCTION SetupSetDirectoryIdExA LIB "setupapi.dll" ALIAS "SetupSetDirectoryIdExA" ( BYVAL InfHandle AS QUAD , BYVAL Id AS QUAD , BYREF Directory AS ASCIIZ , BYVAL Flags AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupSetDirectoryIdExW LIB "setupapi.dll" ALIAS "SetupSetDirectoryIdExW" ( BYVAL InfHandle AS QUAD
 , BYVAL Id AS DWORD
 , BYREF Directory AS WSTRINGZ
 , BYVAL Flags AS DWORD
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupSetDirectoryIdEx = SetupSetDirectoryIdExW
#ELSE
 MACRO SetupSetDirectoryIdEx = SetupSetDirectoryIdExA
#ENDIF
' //
' // Flags for SetupSetDirectoryIdEx
' //
%EQUATE `SETDIRID_NOT_FULL_PATH = &H00000001
DECLARE FUNCTION SetupGetSourceInfoA LIB "setupapi.dll" ALIAS "SetupGetSourceInfoA" ( BYVAL InfHandle AS QUAD , BYVAL SourceId AS QUAD , BYVAL InfoDesired AS QUAD , BYREF ReturnBuffer AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetSourceInfoW LIB "setupapi.dll" ALIAS "SetupGetSourceInfoW" ( BYVAL InfHandle AS QUAD
 , BYVAL SourceId AS DWORD
 , BYVAL InfoDesired AS DWORD
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupGetSourceInfo = SetupGetSourceInfoW
#ELSE
 MACRO SetupGetSourceInfo = SetupGetSourceInfoA
#ENDIF
' //
' // InfoDesired values for SetupGetSourceInfo
' //
%EQUATE `SRCINFO_PATH = 1
%EQUATE `SRCINFO_TAGFILE = 2
%EQUATE `SRCINFO_DESCRIPTION = 3
%EQUATE `SRCINFO_FLAGS = 4
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // SRC_FLAGS allow special treatment of source
' // lower 4 bits are reserved for OS use
' // the flags may determine what other parameters exist
' //
%EQUATE `SRCINFO_TAGFILE2 = 5 ' // alternate tagfile, when SRCINFO_TAGFILE is a cabfile
%EQUATE `SRC_FLAGS_CABFILE = &H0010 ' // if set, treat SRCINFO_TAGFILE as a cabfile and specify alternate tagfile
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#ENDIF ' %SETUPAPI_VER >= %WIN32_WINNT_WINXP
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupInstallFileA LIB "SetupApi.dll" ALIAS "SetupInstallFileA" ( BYVAL InfHandle AS QUAD, InfContext AS INFCONTEXT, SourceFile AS ASCIIZ, SourcePathRoot AS ASCIIZ, DestinationName AS ASCIIZ, BYVAL CopyStyle AS QUAD, BYVAL CopyMsgHandler AS QUAD, ' PSP_FILE_CALLBACK_A
 Context AS ANY ) AS LONG ' BOOOL
#ELSE
DECLARE FUNCTION SetupInstallFileA LIB "setupapi.dll" ALIAS "SetupInstallFileA" ( BYVAL InfHandle AS QUAD , BYREF InfContext AS INFCONTEXT , BYREF SourceFile AS ASCIIZ , BYREF SourcePathRoot AS ASCIIZ , BYREF DestinationName AS ASCIIZ , BYVAL CopyStyle AS QUAD , OPTIONAL BYVAL CopyMsgHandler AS QUAD , OPTIONAL BYVAL Context AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupInstallFileW LIB "SetupApi.dll" ALIAS "SetupInstallFileW" ( BYVAL InfHandle AS QUAD, InfContext AS INFCONTEXT, SourceFile AS WSTRINGZ, SourcePathRoot AS WSTRINGZ, DestinationName AS WSTRINGZ, BYVAL CopyStyle AS QUAD, BYVAL CopyMsgHandler AS QUAD, ' PSP_FILE_CALLBACK_W
 Context AS ANY ) AS LONG
#ELSE
DECLARE FUNCTION SetupInstallFileW LIB "setupapi.dll" ALIAS "SetupInstallFileW" ( BYVAL InfHandle AS QUAD , BYREF InfContext AS INFCONTEXT , BYREF SourceFile AS WSTRINGZ , BYREF SourcePathRoot AS WSTRINGZ , BYREF DestinationName AS WSTRINGZ , BYVAL CopyStyle AS QUAD , OPTIONAL BYVAL CopyMsgHandler AS QUAD , OPTIONAL BYVAL Context AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupInstallFile = SetupInstallFileW
#ELSE
 MACRO SetupInstallFile = SetupInstallFileA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupInstallFileExA LIB "SetupApi.dll" ALIAS "SetupInstallFileExA" ( BYVAL InfHandle AS QUAD, InfContext AS INFCONTEXT, SourceFile AS ASCIIZ, SourcePathRoot AS ASCIIZ, DestinationName AS ASCIIZ, BYVAL CopyStyle AS QUAD, BYVAL CopyMsgHandler AS QUAD, ' PSP_FILE_CALLBACK_A
 Context AS ANY, FileWasInUse AS LONG
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupInstallFileExA LIB "setupapi.dll" ALIAS "SetupInstallFileExA" ( BYVAL InfHandle AS QUAD , BYREF InfContext AS INFCONTEXT , BYREF SourceFile AS ASCIIZ , BYREF SourcePathRoot AS ASCIIZ , BYREF DestinationName AS ASCIIZ , BYVAL CopyStyle AS QUAD , BYVAL CopyMsgHandler AS QUAD , BYVAL Context AS QUAD , BYREF FileWasInUse AS LONG ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupInstallFileExW LIB "SetupApi.dll" ALIAS "SetupInstallFileExW" ( BYVAL InfHandle AS QUAD, InfContext AS INFCONTEXT, SourceFile AS WSTRINGZ, SourcePathRoot AS WSTRINGZ, DestinationName AS WSTRINGZ, BYVAL CopyStyle AS QUAD, BYVAL CopyMsgHandler AS QUAD, ' PSP_FILE_CALLBACK_W
 Context AS ANY, FileWasInUse AS LONG
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupInstallFileExW LIB "setupapi.dll" ALIAS "SetupInstallFileExW" ( BYVAL InfHandle AS QUAD , BYREF InfContext AS INFCONTEXT , BYREF SourceFile AS WSTRINGZ , BYREF SourcePathRoot AS WSTRINGZ , BYREF DestinationName AS WSTRINGZ , BYVAL CopyStyle AS QUAD , BYVAL CopyMsgHandler AS QUAD , BYVAL Context AS QUAD , BYREF FileWasInUse AS LONG ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupInstallFileEx = SetupInstallFileExW
#ELSE
 MACRO SetupInstallFileEx = SetupInstallFileExA
#ENDIF
' //
' // CopyStyle values for copy and queue-related APIs
' //
%EQUATE `SP_COPY_DELETESOURCE = &H0000001 ' // delete source file on successful copy
%EQUATE `SP_COPY_REPLACEONLY = &H0000002 ' // copy only if target file already present
%EQUATE `SP_COPY_NEWER = &H0000004 ' // copy only if source newer than or same as target
%EQUATE `SP_COPY_NEWER_OR_SAME = %SP_COPY_NEWER
%EQUATE `SP_COPY_NOOVERWRITE = &H0000008 ' // copy only if target doesn't exist
%EQUATE `SP_COPY_NODECOMP = &H0000010 ' // don't decompress source file while copying
%EQUATE `SP_COPY_LANGUAGEAWARE = &H0000020 ' // don't overwrite file of different language
%EQUATE `SP_COPY_SOURCE_ABSOLUTE = &H0000040 ' // SourceFile is a full source path
%EQUATE `SP_COPY_SOURCEPATH_ABSOLUTE = &H0000080 ' // SourcePathRoot is the full path
%EQUATE `SP_COPY_IN_USE_NEEDS_REBOOT = &H0000100 ' // System needs reboot if file in use
%EQUATE `SP_COPY_FORCE_IN_USE = &H0000200 ' // Force target-in-use behavior
%EQUATE `SP_COPY_NOSKIP = &H0000400 ' // Skip is disallowed for this file or section
%EQUATE `SP_FLAG_CABINETCONTINUATION = &H0000800 ' // Used with need media notification
%EQUATE `SP_COPY_FORCE_NOOVERWRITE = &H0001000 ' // like NOOVERWRITE but no callback nofitication
%EQUATE `SP_COPY_FORCE_NEWER = &H0002000 ' // like NEWER but no callback nofitication
%EQUATE `SP_COPY_WARNIFSKIP = &H0004000 ' // system critical file: warn if user tries to skip
%EQUATE `SP_COPY_NOBROWSE = &H0008000 ' // Browsing is disallowed for this file or section
%EQUATE `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
%EQUATE `SP_COPY_RESERVED = &H0020000 ' // was: SP_COPY_SOURCE_SIS_MASTER (deprecated)
%EQUATE `SP_COPY_OEMINF_CATALOG_ONLY = &H0040000 ' // (SetupCopyOEMInf only) don't copy INF--just catalog
%EQUATE `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
%EQUATE `SP_COPY_NOPRUNE = &H0100000 ' // never prune this file
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `SP_COPY_OEM_F6_INF = &H0200000 ' // Used when calling SetupCopyOemInf
#ENDIF
'#endif //_SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `SP_COPY_ALREADYDECOMP = &H0400000 ' // similar to SP_COPY_NODECOMP
#ENDIF
'#endif //_SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `SP_COPY_WINDOWS_SIGNED = &H1000000 ' // BuildLab or WinSE signed
%EQUATE `SP_COPY_PNPLOCKED = &H2000000 ' // Used with the signature flag
%EQUATE `SP_COPY_IN_USE_TRY_RENAME = &H4000000 ' // If file in use, try to rename the target first
%EQUATE `SP_COPY_INBOX_INF = &H8000000 ' // Referred by CopyFiles of inbox inf
#ENDIF '%SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
'#endif //_SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
'#if _SETUPAPI_VER >= _WIN32_WINNT_WIN7
#IF %SETUPAPI_VER >= %WIN32_WINNT_WIN7
%EQUATE `SP_COPY_HARDLINK = &H10000000 ' // Copy using hardlink, if possible
#ENDIF
'#endif
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // Flags passed to Backup notification
' //
%EQUATE `SP_BACKUP_BACKUPPASS = &H00000001 ' // file backed up during backup pass
%EQUATE `SP_BACKUP_DEMANDPASS = &H00000002 ' // file backed up on demand
%EQUATE `SP_BACKUP_SPECIAL = &H00000004 ' // if set, special type of backup
%EQUATE `SP_BACKUP_BOOTFILE = &H00000008 ' // file marked with COPYFLG_REPLACE_BOOT_FILE
#ENDIF
'#endif //_SETUPAPI_VER >= _WIN32_WINNT_WINXP
DECLARE FUNCTION SetupOpenFileQueue LIB "setupapi.dll" ALIAS "SetupOpenFileQueue" ( ) AS QUAD ' HSPFILEQ
DECLARE FUNCTION SetupCloseFileQueue LIB "setupapi.dll" ALIAS "SetupCloseFileQueue" ( BYVAL QueueHandle AS QUAD ) AS LONG
DECLARE FUNCTION SetupSetFileQueueAlternatePlatformA LIB "setupapi.dll" ALIAS "SetupSetFileQueueAlternatePlatformA" ( BYVAL QueueHandle AS QUAD
 , OPTIONAL BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO
 , OPTIONAL BYREF AlternateDefaultCatalogFile AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION SetupSetFileQueueAlternatePlatformW LIB "setupapi.dll" ALIAS "SetupSetFileQueueAlternatePlatformW" ( BYVAL QueueHandle AS DWORD
 , OPTIONAL BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO
 , OPTIONAL BYREF AlternateDefaultCatalogFile AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupSetFileQueueAlternatePlatform = SetupSetFileQueueAlternatePlatformW
#ELSE
 MACRO SetupSetFileQueueAlternatePlatform = SetupSetFileQueueAlternatePlatformA
#ENDIF
DECLARE FUNCTION SetupSetPlatformPathOverrideA LIB "setupapi.dll" ALIAS "SetupSetPlatformPathOverrideA" ( OPTIONAL BYREF Override AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupSetPlatformPathOverrideW LIB "setupapi.dll" ALIAS "SetupSetPlatformPathOverrideW" ( OPTIONAL BYREF Override AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupSetPlatformPathOverride = SetupSetPlatformPathOverrideW
#ELSE
 MACRO SetupSetPlatformPathOverride = SetupSetPlatformPathOverrideA
#ENDIF
DECLARE FUNCTION SetupQueueCopyA LIB "setupapi.dll" ALIAS "SetupQueueCopyA" ( BYVAL QueueHandle AS QUAD , 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 QUAD ) AS LONG
DECLARE FUNCTION SetupQueueCopyW LIB "setupapi.dll" ALIAS "SetupQueueCopyW" ( BYVAL QueueHandle AS QUAD
 , BYREF SourceRootPath AS WSTRINGZ
 , BYREF SourcePath AS WSTRINGZ
 , BYREF SourceFilename AS WSTRINGZ
 , BYREF SourceDescription AS WSTRINGZ
 , BYREF SourceTagfile AS WSTRINGZ
 , BYREF TargetDirectory AS WSTRINGZ
 , BYREF TargetFilename AS WSTRINGZ
 , BYVAL CopyStyle AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueueCopy = SetupQueueCopyW
#ELSE
 MACRO SetupQueueCopy = SetupQueueCopyA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupQueueCopyIndirectA LIB "SetupApi.dll" ALIAS "SetupQueueCopyIndirectA" ( BYVAL CopyParams AS SP_FILE_COPY_PARAMS_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupQueueCopyIndirectA LIB "setupapi.dll" ALIAS "SetupQueueCopyIndirectA" ( BYREF CopyParams AS SP_FILE_COPY_PARAMS_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupQueueCopyIndirectW LIB "SetupApi.dll" ALIAS "SetupQueueCopyIndirectW" ( BYVAL CopyParams AS SP_FILE_COPY_PARAMS_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupQueueCopyIndirectW LIB "setupapi.dll" ALIAS "SetupQueueCopyIndirectW" ( BYREF CopyParams AS SP_FILE_COPY_PARAMS_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupQueueCopyIndirect = SetupQueueCopyIndirectW
#ELSE
 MACRO SetupQueueCopyIndirect = SetupQueueCopyIndirectA
#ENDIF
DECLARE FUNCTION SetupQueueDefaultCopyA LIB "setupapi.dll" ALIAS "SetupQueueDefaultCopyA" ( BYVAL QueueHandle AS QUAD , BYVAL InfHandle AS QUAD , BYREF SourceRootPath AS ASCIIZ , BYREF SourceFilename AS ASCIIZ , BYREF TargetFilename AS ASCIIZ , BYVAL CopyStyle AS QUAD ) AS LONG
DECLARE FUNCTION SetupQueueDefaultCopyW LIB "setupapi.dll" ALIAS "SetupQueueDefaultCopyW" ( BYVAL QueueHandle AS QUAD
 , BYVAL InfHandle AS DWORD
 , BYREF SourceRootPath AS WSTRINGZ
 , BYREF SourceFilename AS WSTRINGZ
 , BYREF TargetFilename AS WSTRINGZ
 , BYVAL CopyStyle AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueueDefaultCopy = SetupQueueDefaultCopyW
#ELSE
 MACRO SetupQueueDefaultCopy = SetupQueueDefaultCopyA
#ENDIF
DECLARE FUNCTION SetupQueueCopySectionA LIB "setupapi.dll" ALIAS "SetupQueueCopySectionA" ( BYVAL QueueHandle AS QUAD , BYREF SourceRootPath AS ASCIIZ , BYVAL InfHandle AS QUAD , BYVAL ListInfHandle AS QUAD , BYREF Section AS ASCIIZ , BYVAL CopyStyle AS QUAD ) AS LONG
DECLARE FUNCTION SetupQueueCopySectionW LIB "setupapi.dll" ALIAS "SetupQueueCopySectionW" ( BYVAL QueueHandle AS QUAD
 , BYREF SourceRootPath AS WSTRINGZ
 , BYVAL InfHandle AS DWORD
 , BYVAL ListInfHandle AS DWORD
 , BYREF Section AS WSTRINGZ
 , BYVAL CopyStyle AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueueCopySection = SetupQueueCopySectionW
#ELSE
 MACRO SetupQueueCopySection = SetupQueueCopySectionA
#ENDIF
DECLARE FUNCTION SetupQueueDeleteA LIB "setupapi.dll" ALIAS "SetupQueueDeleteA" ( BYVAL QueueHandle AS QUAD , BYREF PathPart1 AS ASCIIZ , OPTIONAL BYREF PathPart2 AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupQueueDeleteW LIB "setupapi.dll" ALIAS "SetupQueueDeleteW" ( BYVAL QueueHandle AS QUAD
 , BYREF PathPart1 AS WSTRINGZ
 , OPTIONAL BYREF PathPart2 AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueueDelete = SetupQueueDeleteW
#ELSE
 MACRO SetupQueueDelete = SetupQueueDeleteA
#ENDIF
DECLARE FUNCTION SetupQueueDeleteSectionA LIB "setupapi.dll" ALIAS "SetupQueueDeleteSectionA" ( BYVAL QueueHandle AS QUAD , BYVAL InfHandle AS QUAD , BYVAL ListInfHandle AS QUAD , BYREF Section AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupQueueDeleteSectionW LIB "setupapi.dll" ALIAS "SetupQueueDeleteSectionW" ( BYVAL QueueHandle AS QUAD
 , BYVAL InfHandle AS DWORD
 , BYVAL ListInfHandle AS DWORD
 , BYREF Section AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueueDeleteSection = SetupQueueDeleteSectionW
#ELSE
 MACRO SetupQueueDeleteSection = SetupQueueDeleteSectionA
#ENDIF
DECLARE FUNCTION SetupQueueRenameA LIB "setupapi.dll" ALIAS "SetupQueueRenameA" ( BYVAL QueueHandle AS QUAD , BYREF SourcePath AS ASCIIZ , BYREF SourceFilename AS ASCIIZ , BYREF TargetPath AS ASCIIZ , BYREF TargetFilename AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupQueueRenameW LIB "setupapi.dll" ALIAS "SetupQueueRenameW" ( BYVAL QueueHandle AS QUAD
 , BYREF SourcePath AS WSTRINGZ
 , BYREF SourceFilename AS WSTRINGZ
 , BYREF TargetPath AS WSTRINGZ
 , BYREF TargetFilename AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueueRename = SetupQueueRenameW
#ELSE
 MACRO SetupQueueRename = SetupQueueRenameA
#ENDIF
DECLARE FUNCTION SetupQueueRenameSectionA LIB "setupapi.dll" ALIAS "SetupQueueRenameSectionA" ( BYVAL QueueHandle AS QUAD , BYVAL InfHandle AS QUAD , BYVAL ListInfHandle AS QUAD , BYREF Section AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupQueueRenameSectionW LIB "setupapi.dll" ALIAS "SetupQueueRenameSectionW" ( BYVAL QueueHandle AS QUAD
 , BYVAL InfHandle AS DWORD
 , BYVAL ListInfHandle AS DWORD
 , BYREF Section AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueueRenameSection = SetupQueueRenameSectionW
#ELSE
 MACRO SetupQueueRenameSection = SetupQueueRenameSectionA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupCommitFileQueueA LIB "SetupApi.dll" ALIAS "SetupCommitFileQueueA" ( BYVAL Owner AS QUAD,
 BYVAL QueueHandle AS QUAD, BYVAL MsgHandler AS QUAD, ' PSP_FILE_CALLBACK_A
 Context AS ANY ) AS LONG
#ELSE
DECLARE FUNCTION SetupCommitFileQueueA LIB "setupapi.dll" ALIAS "SetupCommitFileQueueA" ( BYVAL Owner AS QUAD , BYVAL QueueHandle AS QUAD , BYVAL MsgHandler AS QUAD , BYVAL Context AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupCommitFileQueueW LIB "SetupApi.dll" ALIAS "SetupCommitFileQueueW" ( BYVAL Owner AS QUAD,
 BYVAL QueueHandle AS QUAD, BYVAL MsgHandler AS QUAD, ' PSP_FILE_CALLBACK_W
 Context AS ANY ) AS LONG
#ELSE
DECLARE FUNCTION SetupCommitFileQueueW LIB "setupapi.dll" ALIAS "SetupCommitFileQueueW" ( BYVAL Owner AS QUAD , BYVAL QueueHandle AS QUAD , BYVAL MsgHandler AS QUAD , BYVAL Context AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupCommitFileQueue = SetupCommitFileQueueW
#ELSE
 MACRO SetupCommitFileQueue = SetupCommitFileQueueA
#ENDIF
DECLARE FUNCTION SetupScanFileQueueA LIB "setupapi.dll" ALIAS "SetupScanFileQueueA" ( BYVAL FileQueue AS QUAD , BYVAL Flags AS QUAD , BYVAL Window AS QUAD , BYVAL CallbackRoutine AS QUAD , BYVAL CallbackContext AS QUAD , BYREF Result AS QUAD ) AS LONG
DECLARE FUNCTION SetupScanFileQueueW LIB "setupapi.dll" ALIAS "SetupScanFileQueueW" ( BYVAL FileQueue AS QUAD
 , BYVAL Flags AS DWORD
 , BYVAL Window AS DWORD
 , BYVAL CallbackRoutine AS DWORD
 , BYVAL CallbackContext AS DWORD
 , BYREF Result AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupScanFileQueue = SetupScanFileQueueW
#ELSE
 MACRO SetupScanFileQueue = SetupScanFileQueueA
#ENDIF
' //
' // Define flags for SetupScanFileQueue.
' //
%EQUATE `SPQ_SCAN_FILE_PRESENCE = &H00000001
%EQUATE `SPQ_SCAN_FILE_VALIDITY = &H00000002
%EQUATE `SPQ_SCAN_USE_CALLBACK = &H00000004
%EQUATE `SPQ_SCAN_USE_CALLBACKEX = &H00000008
%EQUATE `SPQ_SCAN_INFORM_USER = &H00000010
%EQUATE `SPQ_SCAN_PRUNE_COPY_QUEUE = &H00000020
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `SPQ_SCAN_USE_CALLBACK_SIGNERINFO = &H00000040
%EQUATE `SPQ_SCAN_PRUNE_DELREN = &H00000080 ' // remote Delete/Rename queue
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `SPQ_SCAN_FILE_PRESENCE_WITHOUT_SOURCE = &H00000100
%EQUATE `SPQ_SCAN_FILE_COMPARISON = &H00000200
%EQUATE `SPQ_SCAN_ACTIVATE_DRP = &H00000400
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
' //
' // Define flags used with Param2 for SPFILENOTIFY_QUEUESCAN
' //
%EQUATE `SPQ_DELAYED_COPY = &H00000001 ' // file was in use; registered for delayed copy
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
DECLARE FUNCTION SetupGetFileQueueCount LIB "setupapi.dll" ALIAS "SetupGetFileQueueCount" ( BYVAL FileQueue AS QUAD , BYVAL SubQueueFileOp AS QUAD , BYREF NumOperations AS QUAD ) AS LONG
DECLARE FUNCTION SetupGetFileQueueFlags LIB "setupapi.dll" ALIAS "SetupGetFileQueueFlags" ( BYVAL FileQueue AS QUAD
 , BYREF Flags AS DWORD
 ) AS LONG
DECLARE FUNCTION SetupSetFileQueueFlags LIB "setupapi.dll" ALIAS "SetupSetFileQueueFlags" ( BYVAL FileQueue AS DWORD
 , BYVAL FlagMask AS DWORD
 , BYVAL Flags AS DWORD
 ) AS LONG
' //
' // Flags/FlagMask for use with SetupSetFileQueueFlags and returned by SetupGetFileQueueFlags
' //
%EQUATE `SPQ_FLAG_BACKUP_AWARE = &H00000001 ' // If set, SetupCommitFileQueue will
 ' // issue backup notifications.
%EQUATE `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.
%EQUATE `SPQ_FLAG_FILES_MODIFIED = &H00000004 ' // If set, at least one file was
 ' // replaced by a different version
%EQUATE `SPQ_FLAG_DO_SHUFFLEMOVE = &H00000008 ' // If set then always do a shuffle move. A shuffle
 ' // move will first try to copy the source over the
 ' // destination file, but if the destination file is
 ' // in use it will rename the destination file to a
 ' // temp name and queue the temp name for deletion.
 ' // It will then be free to copy the source to the
 ' // destination name. It is considered an error if
 ' // the destination file can't be renamed for some
 ' // reason.
'%SPQ_FLAG_VALID = &H00000007 ' Windows XP SDK // mask of valid flags (can be passed as FlagMask)
%EQUATE `SPQ_FLAG_VALID = &H0000000F ' Windows Vista SDK // mask of valid flags (can be passed as FlagMask)
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Define OEM Source Type values for use in SetupCopyOEMInf.
' //
%EQUATE `SPOST_NONE = 0
%EQUATE `SPOST_PATH = 1
%EQUATE `SPOST_URL = 2
%EQUATE `SPOST_MAX = 3
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupCopyOEMInfA LIB "SetupApi.dll" ALIAS "SetupCopyOEMInfA" ( SourceInfFileName AS ASCIIZ, OEMSourceMediaLocation AS ASCIIZ, BYVAL OEMSourceMediaType AS QUAD, BYVAL CopyStyle AS QUAD, DestinationInfFileName AS ASCIIZ, BYVAL DestinationInfFileNameSize AS QUAD, RequiredSize AS QUAD, BYVAL DestinationInfFileNameComponent AS QUAD ) AS LONG ' PSTR *
#ELSE
DECLARE FUNCTION SetupCopyOEMInfA LIB "setupapi.dll" ALIAS "SetupCopyOEMInfA" ( BYREF SourceInfFileName AS ASCIIZ , BYREF OEMSourceMediaLocation AS ASCIIZ , BYVAL OEMSourceMediaType AS QUAD , BYVAL CopyStyle AS QUAD , BYREF DestinationInfFileName AS ASCIIZ , BYVAL DestinationInfFileNameSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF DestinationInfFileNameComponent AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupCopyOEMInfW LIB "SetupApi.dll" ALIAS "SetupCopyOEMInfW" ( SourceInfFileName AS WSTRINGZ, OEMSourceMediaLocation AS WSTRINGZ, BYVAL OEMSourceMediaType AS QUAD, BYVAL CopyStyle AS QUAD, DestinationInfFileName AS WSTRINGZ, BYVAL DestinationInfFileNameSize AS QUAD, RequiredSize AS QUAD, BYVAL DestinationInfFileNameComponent AS QUAD ) AS LONG ' PWSTR *
#ELSE
DECLARE FUNCTION SetupCopyOEMInfW LIB "setupapi.dll" ALIAS "SetupCopyOEMInfW" ( BYREF SourceInfFileName AS WSTRINGZ , BYREF OEMSourceMediaLocation AS WSTRINGZ , BYVAL OEMSourceMediaType AS QUAD , BYVAL CopyStyle AS QUAD , BYREF DestinationInfFileName AS WSTRINGZ , BYVAL DestinationInfFileNameSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF DestinationInfFileNameComponent AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupCopyOEMInf = SetupCopyOEMInfW
#ELSE
 MACRO SetupCopyOEMInf = SetupCopyOEMInfA
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // Flags used by SetupUninstallOEMInf
' //
%EQUATE `SUOI_FORCEDELETE = &H00000001
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `SUOI_INTERNAL1 = &H00000002
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
DECLARE FUNCTION SetupUninstallOEMInfA LIB "setupapi.dll" ALIAS "SetupUninstallOEMInfA" ( BYREF InfFileName AS ASCIIZ , BYVAL Flags AS QUAD , BYVAL Reserved AS QUAD ) AS LONG
DECLARE FUNCTION SetupUninstallOEMInfW LIB "setupapi.dll" ALIAS "SetupUninstallOEMInfW" ( BYREF InfFileName AS WSTRINGZ
 , BYVAL Flags AS DWORD
 , BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupUninstallOEMInf = SetupUninstallOEMInfW
#ELSE
 MACRO SetupUninstallOEMInf = SetupUninstallOEMInfA
#ENDIF
DECLARE FUNCTION SetupUninstallNewlyCopiedInfs LIB "setupapi.dll" ALIAS "SetupUninstallNewlyCopiedInfs" ( BYVAL FileQueue AS QUAD , BYVAL Flags AS QUAD , BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Disk space list APIs
' //
DECLARE FUNCTION SetupCreateDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupCreateDiskSpaceListA" ( BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD , BYVAL Flags AS QUAD ) AS QUAD ' HDSKSPC
DECLARE FUNCTION SetupCreateDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupCreateDiskSpaceListW" ( BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD , BYVAL Flags AS QUAD ) AS QUAD ' HDSKSPC
#IF %DEF(%UNICODE)
 MACRO SetupCreateDiskSpaceList = SetupCreateDiskSpaceListW
#ELSE
 MACRO SetupCreateDiskSpaceList = SetupCreateDiskSpaceListA
#ENDIF
' //
' // Flags for SetupCreateDiskSpaceList
' //
%EQUATE `SPDSL_IGNORE_DISK = &H00000001 ' // ignore deletes and on-disk files in copies
%EQUATE `SPDSL_DISALLOW_NEGATIVE_ADJUST = &H00000002
DECLARE FUNCTION SetupDuplicateDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupDuplicateDiskSpaceListA" ( BYVAL DiskSpace AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD , BYVAL Flags AS QUAD ) AS QUAD ' HDSKSPC
DECLARE FUNCTION SetupDuplicateDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupDuplicateDiskSpaceListW" ( BYVAL DiskSpace AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD , BYVAL Flags AS QUAD ) AS QUAD ' HDSKSPC
#IF %DEF(%UNICODE)
 MACRO SetupDuplicateDiskSpaceList = SetupDuplicateDiskSpaceListW
#ELSE
 MACRO SetupDuplicateDiskSpaceList = SetupDuplicateDiskSpaceListA
#ENDIF
DECLARE FUNCTION SetupDestroyDiskSpaceList LIB "setupapi.dll" ALIAS "SetupDestroyDiskSpaceList" ( BYVAL DiskSpace AS QUAD ) AS LONG
DECLARE FUNCTION SetupQueryDrivesInDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupQueryDrivesInDiskSpaceListA" ( BYVAL DiskSpace AS QUAD
 , BYREF ReturnBuffer AS ASCIIZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
DECLARE FUNCTION SetupQueryDrivesInDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupQueryDrivesInDiskSpaceListW" ( BYVAL DiskSpace AS DWORD
 , BYREF ReturnBuffer AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueryDrivesInDiskSpaceList = SetupQueryDrivesInDiskSpaceListW
#ELSE
 MACRO SetupQueryDrivesInDiskSpaceList = SetupQueryDrivesInDiskSpaceListA
#ENDIF
DECLARE FUNCTION SetupQuerySpaceRequiredOnDriveA LIB "setupapi.dll" ALIAS "SetupQuerySpaceRequiredOnDriveA" ( BYVAL DiskSpace AS QUAD , BYREF DriveSpec AS ASCIIZ , BYREF SpaceRequired AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupQuerySpaceRequiredOnDriveW LIB "setupapi.dll" ALIAS "SetupQuerySpaceRequiredOnDriveW" ( BYVAL DiskSpace AS QUAD
 , BYREF DriveSpec AS WSTRINGZ
 , BYREF SpaceRequired AS QUAD
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQuerySpaceRequiredOnDrive = SetupQuerySpaceRequiredOnDriveW
#ELSE
 MACRO SetupQuerySpaceRequiredOnDrive = SetupQuerySpaceRequiredOnDriveA
#ENDIF
DECLARE FUNCTION SetupAdjustDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupAdjustDiskSpaceListA" ( BYVAL DiskSpace AS QUAD , BYREF DriveRoot AS ASCIIZ , BYVAL Amount AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupAdjustDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupAdjustDiskSpaceListW" ( BYVAL DiskSpace AS QUAD
 , BYREF DriveRoot AS WSTRINGZ
 , BYVAL Amount AS QUAD
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupAdjustDiskSpaceList = SetupAdjustDiskSpaceListW
#ELSE
 MACRO SetupAdjustDiskSpaceList = SetupAdjustDiskSpaceListA
#ENDIF
DECLARE FUNCTION SetupAddToDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupAddToDiskSpaceListA" ( BYVAL DiskSpace AS QUAD , BYREF TargetFilespec AS ASCIIZ , BYVAL FileSize AS QUAD , BYVAL Operation AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupAddToDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupAddToDiskSpaceListW" ( BYVAL DiskSpace AS QUAD
 , BYREF TargetFilespec AS WSTRINGZ
 , BYVAL FileSize AS QUAD
 , BYVAL Operation AS DWORD
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupAddToDiskSpaceList = SetupAddToDiskSpaceListW
#ELSE
 MACRO SetupAddToDiskSpaceList = SetupAddToDiskSpaceListA
#ENDIF
DECLARE FUNCTION SetupAddSectionToDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupAddSectionToDiskSpaceListA" ( BYVAL DiskSpace AS QUAD , BYVAL InfHandle AS QUAD , BYVAL ListInfHandle AS QUAD , BYREF SectionName AS ASCIIZ , BYVAL Operation AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupAddSectionToDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupAddSectionToDiskSpaceListW" ( BYVAL DiskSpace AS QUAD
 , BYVAL InfHandle AS DWORD
 , BYVAL ListInfHandle AS DWORD
 , BYREF SectionName AS WSTRINGZ
 , BYVAL Operation AS DWORD
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupAddSectionToDiskSpaceList = SetupAddSectionToDiskSpaceListW
#ELSE
 MACRO SetupAddSectionToDiskSpaceList = SetupAddSectionToDiskSpaceListA
#ENDIF
DECLARE FUNCTION SetupAddInstallSectionToDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupAddInstallSectionToDiskSpaceListA" ( BYVAL DiskSpace AS QUAD , BYVAL InfHandle AS QUAD , BYVAL LayoutInfHandle AS QUAD , BYREF SectionName AS ASCIIZ , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupAddInstallSectionToDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupAddInstallSectionToDiskSpaceListW" ( BYVAL DiskSpace AS QUAD
 , BYVAL InfHandle AS DWORD
 , BYVAL LayoutInfHandle AS DWORD
 , BYREF SectionName AS WSTRINGZ
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupAddInstallSectionToDiskSpaceList = SetupAddInstallSectionToDiskSpaceListW
#ELSE
 MACRO SetupAddInstallSectionToDiskSpaceList = SetupAddInstallSectionToDiskSpaceListA
#ENDIF
DECLARE FUNCTION SetupRemoveFromDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupRemoveFromDiskSpaceListA" ( BYVAL DiskSpace AS QUAD , BYREF TargetFilespec AS ASCIIZ , BYVAL Operation AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupRemoveFromDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupRemoveFromDiskSpaceListW" ( BYVAL DiskSpace AS QUAD
 , BYREF TargetFilespec AS WSTRINGZ
 , BYVAL Operation AS DWORD
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupRemoveFromDiskSpaceList = SetupRemoveFromDiskSpaceListW
#ELSE
 MACRO SetupRemoveFromDiskSpaceList = SetupRemoveFromDiskSpaceListA
#ENDIF
DECLARE FUNCTION SetupRemoveSectionFromDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupRemoveSectionFromDiskSpaceListA" ( BYVAL DiskSpace AS QUAD , BYVAL InfHandle AS QUAD , BYVAL ListInfHandle AS QUAD , BYREF SectionName AS ASCIIZ , BYVAL Operation AS QUAD , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupRemoveSectionFromDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupRemoveSectionFromDiskSpaceListW" ( BYVAL DiskSpace AS QUAD
 , BYVAL InfHandle AS DWORD
 , BYVAL ListInfHandle AS DWORD
 , BYREF SectionName AS WSTRINGZ
 , BYVAL Operation AS DWORD
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupRemoveSectionFromDiskSpaceList = SetupRemoveSectionFromDiskSpaceListW
#ELSE
 MACRO SetupRemoveSectionFromDiskSpaceList = SetupRemoveSectionFromDiskSpaceListA
#ENDIF
DECLARE FUNCTION SetupRemoveInstallSectionFromDiskSpaceListA LIB "setupapi.dll" ALIAS "SetupRemoveInstallSectionFromDiskSpaceListA" ( BYVAL DiskSpace AS QUAD , BYVAL InfHandle AS QUAD , BYVAL LayoutInfHandle AS QUAD , BYREF SectionName AS ASCIIZ , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupRemoveInstallSectionFromDiskSpaceListW LIB "setupapi.dll" ALIAS "SetupRemoveInstallSectionFromDiskSpaceListW" ( BYVAL DiskSpace AS QUAD
 , BYVAL InfHandle AS DWORD
 , BYVAL LayoutInfHandle AS DWORD
 , BYREF SectionName AS WSTRINGZ
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupRemoveInstallSectionFromDiskSpaceList = SetupRemoveInstallSectionFromDiskSpaceListW
#ELSE
 MACRO SetupRemoveInstallSectionFromDiskSpaceList = SetupRemoveInstallSectionFromDiskSpaceListA
#ENDIF
' //
' // Cabinet APIs
' //
#IF %DEF(%USEOBDECL)
DECLARE FUNCTION SetupIterateCabinetA LIB "SetupApi.dll" ALIAS "SetupIterateCabinetA" ( CabinetFile AS ASCIIZ, BYVAL Reserved AS QUAD, BYVAL MsgHandler AS QUAD, ' PSP_FILE_CALLBACK_A
 Context AS ANY ) AS LONG
#ELSE
DECLARE FUNCTION SetupIterateCabinetA LIB "setupapi.dll" ALIAS "SetupIterateCabinetA" ( BYREF CabinetFile AS ASCIIZ , BYVAL Reserved AS QUAD , BYVAL MsgHandler AS QUAD , BYVAL Context AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEOBDECL)
DECLARE FUNCTION SetupIterateCabinetW LIB "SetupApi.dll" ALIAS "SetupIterateCabinetW" ( CabinetFile AS WSTRINGZ, BYVAL Reserved AS QUAD, BYVAL MsgHandler AS QUAD, ' PSP_FILE_CALLBACK_W
 Context AS ANY ) AS LONG
#ELSE
DECLARE FUNCTION SetupIterateCabinetW LIB "setupapi.dll" ALIAS "SetupIterateCabinetW" ( BYREF CabinetFile AS WSTRINGZ , BYVAL Reserved AS QUAD , BYVAL MsgHandler AS QUAD , BYVAL Context AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupIterateCabinet = SetupIterateCabinetW
#ELSE
 MACRO SetupIterateCabinet = SetupIterateCabinetA
#ENDIF
DECLARE FUNCTION SetupPromptReboot LIB "setupapi.dll" ALIAS "SetupPromptReboot" ( BYVAL FileQueue AS QUAD , BYVAL Owner AS QUAD , BYVAL ScanOnly AS LONG ) AS LONG ' INT
' //
' // Define flags that are returned by SetupPromptReboot
' //
%EQUATE `SPFILEQ_FILE_IN_USE = &H00000001
%EQUATE `SPFILEQ_REBOOT_RECOMMENDED = &H00000002
%EQUATE `SPFILEQ_REBOOT_IN_PROGRESS = &H00000004
DECLARE FUNCTION SetupInitDefaultQueueCallback LIB "setupapi.dll" ALIAS "SetupInitDefaultQueueCallback" ( BYVAL OwnerWindow AS QUAD ) AS QUAD
DECLARE FUNCTION SetupInitDefaultQueueCallbackEx LIB "setupapi.dll" ALIAS "SetupInitDefaultQueueCallbackEx" ( BYVAL OwnerWindow AS QUAD
 , BYVAL AlternateProgressWindow AS DWORD
 , BYVAL ProgressMessage AS DWORD
 , BYVAL Reserved1 AS DWORD
 , BYVAL Reserved2 AS DWORD
 ) AS DWORD
#IF %DEF(%USEPBDECL)
DECLARE SUB SetupTermDefaultQueueCallback LIB "SetupApi.dll" ALIAS "SetupTermDefaultQueueCallback" (Context AS ANY)
#ELSE
DECLARE SUB SetupTermDefaultQueueCallback LIB "setupapi.dll" ALIAS "SetupTermDefaultQueueCallback" ( BYVAL Context AS QUAD ) ' void
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDefaultQueueCallbackA LIB "SetupApi.dll" ALIAS "SetupDefaultQueueCallbackA" ( Context AS ANY, BYVAL Notification AS QUAD, BYVAL Param1 AS QUAD, ) AS QUAD ' UINT_PTR, BYVAL Param2 AS QUAD ' UINT_PTR,
#ELSE
DECLARE FUNCTION SetupDefaultQueueCallbackA LIB "setupapi.dll" ALIAS "SetupDefaultQueueCallbackA" ( BYVAL Context AS QUAD , BYVAL Notification AS QUAD , BYVAL Param1 AS QUAD , BYVAL Param2 AS QUAD ) AS QUAD ' UINT
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDefaultQueueCallbackW LIB "SetupApi.dll" ALIAS "SetupDefaultQueueCallbackW" ( Context AS ANY, BYVAL Notification AS QUAD, BYVAL Param1 AS QUAD, ) AS QUAD ' UINT_PTR, BYVAL Param2 AS QUAD ' UINT_PTR,
#ELSE
DECLARE FUNCTION SetupDefaultQueueCallbackW LIB "setupapi.dll" ALIAS "SetupDefaultQueueCallbackW" ( BYVAL Context AS QUAD , BYVAL Notification AS QUAD , BYVAL Param1 AS QUAD , BYVAL Param2 AS QUAD ) AS QUAD ' UINT
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDefaultQueueCallback = SetupDefaultQueueCallbackW
#ELSE
 MACRO SetupDefaultQueueCallback = SetupDefaultQueueCallbackA
#ENDIF
' //
' // 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 >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `FLG_ADDREG_DELREG_BIT = &H00008000 ' // if set, interpret as DELREG, see below
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
%EQUATE `FLG_ADDREG_BINVALUETYPE = &H00000001
%EQUATE `FLG_ADDREG_NOCLOBBER = &H00000002
%EQUATE `FLG_ADDREG_DELVAL = &H00000004
%EQUATE `FLG_ADDREG_APPEND = &H00000008 ' // Currently supported only
 ' // for REG_MULTI_SZ values.
%EQUATE `FLG_ADDREG_KEYONLY = &H00000010 ' // Just create the key, ignore value
%EQUATE `FLG_ADDREG_OVERWRITEONLY = &H00000020 ' // Set only if value already exists
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `FLG_ADDREG_64BITKEY = &H00001000 ' // make this change in the 64 bit registry.
%EQUATE `FLG_ADDREG_KEYONLY_COMMON = &H00002000 ' // same as FLG_ADDREG_KEYONLY but also works for DELREG
%EQUATE `FLG_ADDREG_32BITKEY = &H00004000 ' // make this change in the 32 bit registry.
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // 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.
' //
%EQUATE `FLG_ADDREG_TYPE_MASK = &HFFFF0000 OR %FLG_ADDREG_BINVALUETYPE
%EQUATE `FLG_ADDREG_TYPE_SZ = &H00000000
%EQUATE `FLG_ADDREG_TYPE_MULTI_SZ = &H00010000
%EQUATE `FLG_ADDREG_TYPE_EXPAND_SZ = &H00020000
%EQUATE `FLG_ADDREG_TYPE_BINARY = &H00000000 OR %FLG_ADDREG_BINVALUETYPE
%EQUATE `FLG_ADDREG_TYPE_DWORD = &H00010000 OR %FLG_ADDREG_BINVALUETYPE
%EQUATE `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
' //
%EQUATE `FLG_DELREG_VALUE = &H00000000
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `FLG_DELREG_TYPE_MASK = %FLG_ADDREG_TYPE_MASK ' // 0xFFFF0001
%EQUATE `FLG_DELREG_TYPE_SZ = %FLG_ADDREG_TYPE_SZ ' // 0x00000000
%EQUATE `FLG_DELREG_TYPE_MULTI_SZ = %FLG_ADDREG_TYPE_MULTI_SZ ' // 0x00010000
%EQUATE `FLG_DELREG_TYPE_EXPAND_SZ = %FLG_ADDREG_TYPE_EXPAND_SZ ' // 0x00020000
%EQUATE `FLG_DELREG_TYPE_BINARY = %FLG_ADDREG_TYPE_BINARY ' // 0x00000001
%EQUATE `FLG_DELREG_TYPE_DWORD = %FLG_ADDREG_TYPE_DWORD ' // 0x00010001
%EQUATE `FLG_DELREG_TYPE_NONE = %FLG_ADDREG_TYPE_NONE ' // 0x00020001
%EQUATE `FLG_DELREG_64BITKEY = %FLG_ADDREG_64BITKEY ' // 0x00001000
%EQUATE `FLG_DELREG_KEYONLY_COMMON = %FLG_ADDREG_KEYONLY_COMMON ' // 0x00002000
%EQUATE `FLG_DELREG_32BITKEY = %FLG_ADDREG_32BITKEY ' // 0x00004000
' //
' // <Operation> = FLG_DELREG_MULTI_SZ_DELSTRING
' // <RegRootString>,<SubKey>,<ValueName>,0x00018002,<String>
' // removes all entries matching <String> (case ignored) from multi-sz registry value
' //
%EQUATE `FLG_DELREG_OPERATION_MASK = &H000000FE
%EQUATE `FLG_DELREG_MULTI_SZ_DELSTRING = %FLG_DELREG_TYPE_MULTI_SZ OR %FLG_ADDREG_DELREG_BIT OR &H00000002 ' // 0x00018002
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Flags for BitReg section lines in INF.
' //
%EQUATE `FLG_BITREG_CLEARBITS = &H00000000
%EQUATE `FLG_BITREG_SETBITS = &H00000001
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `FLG_BITREG_64BITKEY = &H00001000
%EQUATE `FLG_BITREG_32BITKEY = &H00004000
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Flags for Ini2Reg section lines in INF.
' //
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `FLG_INI2REG_64BITKEY = &H00001000
%EQUATE `FLG_INI2REG_32BITKEY = &H00004000
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Flags for RegSvr section lines in INF
' //
%EQUATE `FLG_REGSVR_DLLREGISTER = &H00000001
%EQUATE `FLG_REGSVR_DLLINSTALL = &H00000002
' // Flags for RegSvr section lines in INF
' //
%EQUATE `FLG_PROFITEM_CURRENTUSER = &H00000001
%EQUATE `FLG_PROFITEM_DELETE = &H00000002
%EQUATE `FLG_PROFITEM_GROUP = &H00000004
%EQUATE `FLG_PROFITEM_CSIDL = &H00000008
'//
'// Flags for AddProperty section lines in the INF
'//
%EQUATE `FLG_ADDPROPERTY_NOCLOBBER = &H00000001
%EQUATE `FLG_ADDPROPERTY_OVERWRITEONLY = &H00000002
%EQUATE `FLG_ADDPROPERTY_APPEND = &H00000004
%EQUATE `FLG_ADDPROPERTY_OR = &H00000008
%EQUATE `FLG_ADDPROPERTY_AND = &H00000010
'//
'// Flags for DelProperty section lines in the INF
'//
%EQUATE `FLG_DELPROPERTY_MULTI_SZ_DELSTRING = &H00000001
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupInstallFromInfSectionA LIB "SetupApi.dll" ALIAS "SetupInstallFromInfSectionA" ( BYVAL Owner AS QUAD,
 BYVAL InfHandle AS QUAD, SectionName AS ASCIIZ, BYVAL Flags AS QUAD, BYVAL RelativeKeyRoot AS QUAD, ' HKEY
 SourceRootPath AS ASCIIZ, BYVAL CopyFlags AS DWORD, BYVAL MsgHandler AS DWORD, ' PSP_FILE_CALLBACK_A
 Context AS ANY, BYVAL DeviceInfoSet AS DWORD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupInstallFromInfSectionA LIB "setupapi.dll" ALIAS "SetupInstallFromInfSectionA" ( BYVAL Owner AS QUAD , BYVAL InfHandle AS QUAD , BYREF SectionName AS ASCIIZ , BYVAL Flags AS QUAD , BYVAL RelativeKeyRoot AS QUAD , BYREF SourceRootPath AS ASCIIZ , BYVAL CopyFlags AS QUAD , OPTIONAL BYVAL MsgHandler AS QUAD , OPTIONAL BYVAL Context AS QUAD , OPTIONAL BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupInstallFromInfSectionW LIB "SetupApi.dll" ALIAS "SetupInstallFromInfSectionW" ( BYVAL Owner AS QUAD,
 BYVAL InfHandle AS QUAD, SectionName AS WSTRINGZ, BYVAL Flags AS QUAD, BYVAL RelativeKeyRoot AS QUAD, ' HKEY
 SourceRootPath AS WSTRINGZ, BYVAL CopyFlags AS DWORD, BYVAL MsgHandler AS DWORD, ' PSP_FILE_CALLBACK_W
 Context AS ANY, BYVAL DeviceInfoSet AS DWORD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupInstallFromInfSectionW LIB "setupapi.dll" ALIAS "SetupInstallFromInfSectionW" ( BYVAL Owner AS QUAD , BYVAL InfHandle AS QUAD , BYREF SectionName AS WSTRINGZ , BYVAL Flags AS QUAD , BYVAL RelativeKeyRoot AS QUAD , BYREF SourceRootPath AS WSTRINGZ , BYVAL CopyFlags AS QUAD , OPTIONAL BYVAL MsgHandler AS QUAD , OPTIONAL BYVAL Context AS QUAD , OPTIONAL BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupInstallFromInfSection = SetupInstallFromInfSectionW
#ELSE
 MACRO SetupInstallFromInfSection = SetupInstallFromInfSectionA
#ENDIF
' //
' // Flags for SetupInstallFromInfSection
' //
%EQUATE `SPINST_LOGCONFIG = &H00000001
%EQUATE `SPINST_INIFILES = &H00000002
%EQUATE `SPINST_REGISTRY = &H00000004
%EQUATE `SPINST_INI2REG = &H00000008
%EQUATE `SPINST_FILES = &H00000010
%EQUATE `SPINST_BITREG = &H00000020
%EQUATE `SPINST_REGSVR = &H00000040
%EQUATE `SPINST_UNREGSVR = &H00000080
%EQUATE `SPINST_PROFILEITEMS = &H00000100
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `SPINST_COPYINF = &H00000200
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `SPINST_PROPERTIES = &H00000400
%EQUATE `SPINST_ALL = &H000007ff
#ELSE
%EQUATE `SPINST_ALL = &H000003ff
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#ELSE
%EQUATE `SPINST_ALL = &H000001ff
#ENDIF ' // _SETUPAPI_VER >= WIN32_WINNT_WINXP
%EQUATE `SPINST_SINGLESECTION = &H00010000
%EQUATE `SPINST_LOGCONFIG_IS_FORCED = &H00020000
%EQUATE `SPINST_LOGCONFIGS_ARE_OVERRIDES = &H00040000
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `SPINST_REGISTERCALLBACKAWARE = &H00080000
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
%EQUATE `SPINST_DEVICEINSTALL = &H00100000
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
DECLARE FUNCTION SetupInstallFilesFromInfSectionA LIB "setupapi.dll" ALIAS "SetupInstallFilesFromInfSectionA" ( BYVAL InfHandle AS QUAD , BYVAL LayoutInfHandle AS QUAD , BYVAL FileQueue AS QUAD , BYREF SectionName AS ASCIIZ , BYREF SourceRootPath AS ASCIIZ , BYVAL CopyFlags AS QUAD ) AS LONG
DECLARE FUNCTION SetupInstallFilesFromInfSectionW LIB "setupapi.dll" ALIAS "SetupInstallFilesFromInfSectionW" ( BYVAL InfHandle AS QUAD
 , BYVAL LayoutInfHandle AS DWORD
 , BYVAL FileQueue AS DWORD
 , BYREF SectionName AS WSTRINGZ
 , BYREF SourceRootPath AS WSTRINGZ
 , BYVAL CopyFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupInstallFilesFromInfSection = SetupInstallFilesFromInfSectionW
#ELSE
 MACRO SetupInstallFilesFromInfSection = SetupInstallFilesFromInfSectionA
#ENDIF
' //
' // 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
' //
%EQUATE `SPSVCINST_TAGTOFRONT = &H00000001
' //
' // (AddService) **Ex API only** mark this service as the function driver for the
' // device being installed
' //
%EQUATE `SPSVCINST_ASSOCSERVICE = &H00000002
' //
' // (DelService) delete the associated event log entry for a service specified in
' // a DelService entry
' //
%EQUATE `SPSVCINST_DELETEEVENTLOGENTRY = &H00000004
' //
' // (AddService) don't overwrite display name if it already exists
' //
%EQUATE `SPSVCINST_NOCLOBBER_DISPLAYNAME = &H00000008
' //
' // (AddService) don't overwrite start type value if service already exists
' //
%EQUATE `SPSVCINST_NOCLOBBER_STARTTYPE = &H00000010
' //
' // (AddService) don't overwrite error control value if service already exists
' //
%EQUATE `SPSVCINST_NOCLOBBER_ERRORCONTROL = &H00000020
' //
' // (AddService) don't overwrite load order group if it already exists
' //
%EQUATE `SPSVCINST_NOCLOBBER_LOADORDERGROUP = &H00000040
' //
' // (AddService) don't overwrite dependencies list if it already exists
' //
%EQUATE `SPSVCINST_NOCLOBBER_DEPENDENCIES = &H00000080
' //
' // (AddService) don't overwrite description if it already exists
' //
%EQUATE `SPSVCINST_NOCLOBBER_DESCRIPTION = &H00000100
' //
' // (DelService) stop the associated service specified in
' // a DelService entry before deleting the service
' //
%EQUATE `SPSVCINST_STOPSERVICE = &H00000200
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // (AddService) force overwrite of security settings
' //
%EQUATE `SPSVCINST_CLOBBER_SECURITY = &H00000400
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
'//
'// (Start Service) start a service manually after install
'//
%EQUATE `SPSVCINST_STARTSERVICE = &H00000800
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
'#if _SETUPAPI_VER >= _WIN32_WINNT_WIN7
#IF %SETUPAPI_VER >= %WIN32_WINNT_WIN7
'//
'// (AddService) don't overwrite required privileges list if it already exists
'//
%EQUATE `SPSVCINST_NOCLOBBER_REQUIREDPRIVILEGES = &H00001000
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WIN7
DECLARE FUNCTION SetupInstallServicesFromInfSectionA LIB "setupapi.dll" ALIAS "SetupInstallServicesFromInfSectionA" ( BYVAL InfHandle AS QUAD , BYREF SectionName AS ASCIIZ , BYVAL Flags AS QUAD ) AS LONG
DECLARE FUNCTION SetupInstallServicesFromInfSectionW LIB "setupapi.dll" ALIAS "SetupInstallServicesFromInfSectionW" ( BYVAL InfHandle AS QUAD
 , BYREF SectionName AS WSTRINGZ
 , BYVAL Flags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupInstallServicesFromInfSection = SetupInstallServicesFromInfSectionW
#ELSE
 MACRO SetupInstallServicesFromInfSection = SetupInstallServicesFromInfSectionA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupInstallServicesFromInfSectionExA LIB "SetupApi.dll" ALIAS "SetupInstallServicesFromInfSectionExA" ( BYVAL InfHandle AS QUAD, SectionName AS ASCIIZ, BYVAL Flags AS QUAD, BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL Reserved1 AS QUAD,
 BYVAL Reserved2 AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupInstallServicesFromInfSectionExA LIB "setupapi.dll" ALIAS "SetupInstallServicesFromInfSectionExA" ( BYVAL InfHandle AS QUAD , BYREF SectionName AS ASCIIZ , BYVAL Flags AS QUAD , BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupInstallServicesFromInfSectionExW LIB "SetupApi.dll" ALIAS "SetupInstallServicesFromInfSectionExW" ( BYVAL InfHandle AS QUAD, SectionName AS WSTRINGZ, BYVAL Flags AS QUAD, BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL Reserved1 AS QUAD,
 BYVAL Reserved2 AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupInstallServicesFromInfSectionExW LIB "setupapi.dll" ALIAS "SetupInstallServicesFromInfSectionExW" ( BYVAL InfHandle AS QUAD , BYREF SectionName AS WSTRINGZ , BYVAL Flags AS QUAD , BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Reserved1 AS QUAD , BYVAL Reserved2 AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupInstallServicesFromInfSectionEx = SetupInstallServicesFromInfSectionExW
#ELSE
 MACRO SetupInstallServicesFromInfSectionEx = SetupInstallServicesFromInfSectionExA
#ENDIF
' //
' // High level routine, usually used via rundll32.dll
' // to perform right-click install action on INFs
' // May be called directly:
' //
' // wsprintf(CmdLineBuffer,TEXT("DefaultInstall 132 %s"),InfPath);
' // InstallHinfSection(NULL,NULL,CmdLineBuffer,0);
' //
DECLARE SUB InstallHinfSectionA LIB "setupapi.dll" ALIAS "InstallHinfSectionA" ( BYVAL Window AS QUAD , BYVAL ModuleHandle AS QUAD , BYREF CommandLine AS ASCIIZ , BYVAL ShowCommand AS LONG ) ' void
DECLARE SUB InstallHinfSectionW LIB "setupapi.dll" ALIAS "InstallHinfSectionW" ( BYVAL Window AS QUAD , BYVAL ModuleHandle AS QUAD , BYREF CommandLine AS WSTRINGZ , BYVAL ShowCommand AS LONG ) ' void
#IF %DEF(%UNICODE)
 MACRO InstallHinfSection = InstallHinfSectionW
#ELSE
 MACRO InstallHinfSection = InstallHinfSectionA
#ENDIF
' //
' // Define handle type for Setup file log.
' //
'typedef PVOID HSPFILELOG;
DECLARE FUNCTION SetupInitializeFileLogA LIB "setupapi.dll" ALIAS "SetupInitializeFileLogA" ( BYREF LogFileName AS ASCIIZ , BYVAL Flags AS QUAD ) AS QUAD ' HSPFILELOG
DECLARE FUNCTION SetupInitializeFileLogW LIB "setupapi.dll" ALIAS "SetupInitializeFileLogW" ( BYREF LogFileName AS WSTRINGZ , BYVAL Flags AS QUAD ) AS QUAD ' HSPFILELOG
#IF %DEF(%UNICODE)
 MACRO SetupInitializeFileLog = SetupInitializeFileLogW
#ELSE
 MACRO SetupInitializeFileLog = SetupInitializeFileLogA
#ENDIF
' //
' // Flags for SetupInitializeFileLog
' //
%EQUATE `SPFILELOG_SYSTEMLOG = &H00000001 ' // use system log -- must be Administrator
%EQUATE `SPFILELOG_FORCENEW = &H00000002 ' // not valid with SPFILELOG_SYSTEMLOG
%EQUATE `SPFILELOG_QUERYONLY = &H00000004 ' // allows non-administrators to read system log
DECLARE FUNCTION SetupTerminateFileLog LIB "setupapi.dll" ALIAS "SetupTerminateFileLog" ( BYVAL FileLogHandle AS QUAD ) AS LONG
DECLARE FUNCTION SetupLogFileA LIB "setupapi.dll" ALIAS "SetupLogFileA" ( BYVAL FileLogHandle AS QUAD
 , 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
DECLARE FUNCTION SetupLogFileW LIB "setupapi.dll" ALIAS "SetupLogFileW" ( BYVAL FileLogHandle AS DWORD
 , BYREF LogSectionName AS WSTRINGZ
 , BYREF SourceFilename AS WSTRINGZ
 , BYREF TargetFilename AS WSTRINGZ
 , BYVAL Checksum AS DWORD
 , BYREF DiskTagfile AS WSTRINGZ
 , BYREF DiskDescription AS WSTRINGZ
 , BYREF OtherInfo AS WSTRINGZ
 , BYVAL Flags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupLogFile = SetupLogFileW
#ELSE
 MACRO SetupLogFile = SetupLogFileA
#ENDIF
' //
' // Flags for SetupLogFile
' //
%EQUATE `SPFILELOG_OEMFILE = &H00000001
DECLARE FUNCTION SetupRemoveFileLogEntryA LIB "setupapi.dll" ALIAS "SetupRemoveFileLogEntryA" ( BYVAL FileLogHandle AS QUAD , OPTIONAL BYREF LogSectionName AS ASCIIZ , OPTIONAL BYREF TargetFilename AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetupRemoveFileLogEntryW LIB "setupapi.dll" ALIAS "SetupRemoveFileLogEntryW" ( BYVAL FileLogHandle AS QUAD
 , OPTIONAL BYREF LogSectionName AS WSTRINGZ
 , OPTIONAL BYREF TargetFilename AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupRemoveFileLogEntry = SetupRemoveFileLogEntryW
#ELSE
 MACRO SetupRemoveFileLogEntry = SetupRemoveFileLogEntryA
#ENDIF
' //
' // Items retrievable from SetupQueryFileLog()
' //
' enum SetupFileLogInfo
%EQUATE `SetupFileLogSourceFilename = 0
%EQUATE `SetupFileLogChecksum = 1
%EQUATE `SetupFileLogDiskTagfile = 2
%EQUATE `SetupFileLogDiskDescription = 3
%EQUATE `SetupFileLogOtherInfo = 4
%EQUATE `SetupFileLogMax = 5
DECLARE FUNCTION SetupQueryFileLogA LIB "setupapi.dll" ALIAS "SetupQueryFileLogA" ( BYVAL FileLogHandle AS QUAD , BYREF LogSectionName AS ASCIIZ , BYREF TargetFilename AS ASCIIZ , BYVAL DesiredInfo AS LONG , BYREF DataOut AS ASCIIZ , BYVAL ReturnBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupQueryFileLogW LIB "setupapi.dll" ALIAS "SetupQueryFileLogW" ( BYVAL FileLogHandle AS QUAD
 , BYREF LogSectionName AS WSTRINGZ
 , BYREF TargetFilename AS WSTRINGZ
 , BYVAL DesiredInfo AS LONG
 , BYREF DataOut AS WSTRINGZ
 , BYVAL ReturnBufferSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupQueryFileLog = SetupQueryFileLogW
#ELSE
 MACRO SetupQueryFileLog = SetupQueryFileLogA
#ENDIF
' //
' // Text logging APIs
' //
'#define LogSeverity DWORD
%EQUATE `LogSevInformation = &H00000000
%EQUATE `LogSevWarning = &H00000001
%EQUATE `LogSevError = &H00000002
%EQUATE `LogSevFatalError = &H00000003
%EQUATE `LogSevMaximum = &H00000004
DECLARE FUNCTION SetupOpenLog LIB "setupapi.dll" ALIAS "SetupOpenLog" ( BYVAL Erase AS LONG ) AS LONG
DECLARE FUNCTION SetupLogErrorA LIB "setupapi.dll" ALIAS "SetupLogErrorA" ( BYREF MessageString AS ASCIIZ
 , BYVAL Severity AS LONG
 ) AS LONG
DECLARE FUNCTION SetupLogErrorW LIB "setupapi.dll" ALIAS "SetupLogErrorW" ( BYREF MessageString AS WSTRINGZ
 , BYVAL Severity AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupLogError = SetupLogErrorW
#ELSE
 MACRO SetupLogError = SetupLogErrorA
#ENDIF
DECLARE SUB SetupCloseLog LIB "setupapi.dll" ALIAS "SetupCloseLog" ( ) ' void
'//
'// Text log for INF debugging
'//
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
DECLARE FUNCTION SetupGetThreadLogToken LIB "setupapi.dll" ALIAS "SetupGetThreadLogToken" ( ) AS QUAD ' SP_LOG_TOKEN
DECLARE SUB SetupSetThreadLogToken LIB "setupapi.dll" ALIAS "SetupSetThreadLogToken" ( BYVAL LogToken AS QUAD ) ' void
DECLARE SUB SetupWriteTextLog CDECL LIB "setupapi.dll" ALIAS "SetupWriteTextLog" ( BYVAL LogToken AS QUAD , BYVAL Category AS QUAD , BYVAL Flags AS QUAD , BYREF MessageStr AS ASCIIZ , OPTIONAL BYREF ANY ' Optional parameters , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY ) ' void
DECLARE SUB SetupWriteTextLogError CDECL LIB "setupapi.dll" ALIAS "SetupWriteTextLogError" ( BYVAL LogToken AS QUAD , BYVAL Category AS QUAD , BYVAL LogFlags AS QUAD , BYVAL Error AS QUAD , BYREF MessageStr AS ASCIIZ , OPTIONAL BYREF ANY ' Optional parameters , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY , BYREF ANY ) ' void
DECLARE SUB SetupWriteTextLogInfLine LIB "setupapi.dll" ALIAS "SetupWriteTextLogInfLine" ( BYVAL LogToken AS QUAD , BYVAL Flags AS QUAD , BYVAL InfHandle AS QUAD , BYREF Context AS INFCONTEXT ) ' void
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
' //
' // Backup Information API's
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupGetBackupInformationA LIB "SetupApi.dll" ALIAS "SetupGetBackupInformationA" ( BYVAL QueueHandle AS QUAD, BYVAL BackupParams AS SP_BACKUP_QUEUE_PARAMS_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupGetBackupInformationA LIB "setupapi.dll" ALIAS "SetupGetBackupInformationA" ( BYVAL QueueHandle AS QUAD , BYREF BackupParams AS SP_BACKUP_QUEUE_PARAMS_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupGetBackupInformationW LIB "SetupApi.dll" ALIAS "SetupGetBackupInformationW" ( BYVAL QueueHandle AS QUAD, BYVAL BackupParams AS SP_BACKUP_QUEUE_PARAMS_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupGetBackupInformationW LIB "setupapi.dll" ALIAS "SetupGetBackupInformationW" ( BYVAL QueueHandle AS QUAD , BYREF BackupParams AS SP_BACKUP_QUEUE_PARAMS_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupGetBackupInformation = SetupGetBackupInformationW
#ELSE
 MACRO SetupGetBackupInformation = SetupGetBackupInformationA
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
DECLARE FUNCTION SetupPrepareQueueForRestoreA LIB "setupapi.dll" ALIAS "SetupPrepareQueueForRestoreA" ( BYVAL QueueHandle AS QUAD , BYREF BackupPath AS ASCIIZ , BYVAL RestoreFlags AS QUAD ) AS LONG
DECLARE FUNCTION SetupPrepareQueueForRestoreW LIB "setupapi.dll" ALIAS "SetupPrepareQueueForRestoreW" ( BYVAL QueueHandle AS QUAD
 , BYREF BackupPath AS WSTRINGZ
 , BYVAL RestoreFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupPrepareQueueForRestore = SetupPrepareQueueForRestoreW
#ELSE
 MACRO SetupPrepareQueueForRestore = SetupPrepareQueueForRestoreA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // Control forcing of Non-Interactive Mode
' // Overriden if SetupAPI is run in non-interactive window session
' //
DECLARE FUNCTION SetupSetNonInteractiveMode LIB "setupapi.dll" ALIAS "SetupSetNonInteractiveMode" ( BYVAL NonInteractiveFlag AS LONG ) AS LONG
DECLARE FUNCTION SetupGetNonInteractiveMode LIB "setupapi.dll" ALIAS "SetupGetNonInteractiveMode" ( ) AS LONG
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Device Installer APIs
' //
DECLARE FUNCTION SetupDiCreateDeviceInfoList LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInfoList" ( OPTIONAL BYREF ClassGuid AS GUID , OPTIONAL BYVAL hwndParent AS QUAD ) AS QUAD ' HDEVINFO
DECLARE FUNCTION SetupDiCreateDeviceInfoListExA LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInfoListExA" ( OPTIONAL BYREF ClassGuid AS GUID , OPTIONAL BYVAL hwndParent AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS QUAD ' HDEVINFO
DECLARE FUNCTION SetupDiCreateDeviceInfoListExW LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInfoListExW" ( OPTIONAL BYREF ClassGuid AS GUID , OPTIONAL BYVAL hwndParent AS QUAD , OPTIONAL BYREF MachineName AS WSTRINGZ , OPTIONAL BYVAL Reserved AS QUAD ) AS QUAD ' HDEVINFO
#IF %DEF(%UNICODE)
 MACRO SetupDiCreateDeviceInfoListEx = SetupDiCreateDeviceInfoListExW
#ELSE
 MACRO SetupDiCreateDeviceInfoListEx = SetupDiCreateDeviceInfoListExA
#ENDIF
DECLARE FUNCTION SetupDiGetDeviceInfoListClass LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInfoListClass" ( BYVAL DeviceInfoSet AS QUAD , BYREF ClassGuid AS GUID ) AS LONG
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInfoListDetailA LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInfoListDetailA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoSetDetailData AS SP_DEVINFO_LIST_DETAIL_DATA_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInfoListDetailA LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInfoListDetailA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoSetDetailData AS SP_DEVINFO_LIST_DETAIL_DATA_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInfoListDetailW LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInfoListDetailW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoSetDetailData AS SP_DEVINFO_LIST_DETAIL_DATA_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInfoListDetailW LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInfoListDetailW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoSetDetailData AS SP_DEVINFO_LIST_DETAIL_DATA_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetDeviceInfoListDetail = SetupDiGetDeviceInfoListDetailW
#ELSE
 MACRO SetupDiGetDeviceInfoListDetail = SetupDiGetDeviceInfoListDetailA
#ENDIF
' //
' // Flags for SetupDiCreateDeviceInfo
' //
%EQUATE `DICD_GENERATE_ID = &H00000001
%EQUATE `DICD_INHERIT_CLASSDRVS = &H00000002
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCreateDeviceInfoA LIB "SetupApi.dll" ALIAS "SetupDiCreateDeviceInfoA" ( BYVAL DeviceInfoSet AS QUAD, DeviceName AS ASCIIZ, ClassGuid AS GUID, DeviceDescription AS ASCIIZ, BYVAL hwndParent AS QUAD,
 BYVAL CreationFlags AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiCreateDeviceInfoA LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInfoA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceName AS ASCIIZ , BYREF ClassGuid AS GUID , BYREF DeviceDescription AS ASCIIZ , BYVAL hwndParent AS QUAD , BYVAL CreationFlags AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCreateDeviceInfoW LIB "SetupApi.dll" ALIAS "SetupDiCreateDeviceInfoW" ( BYVAL DeviceInfoSet AS QUAD, DeviceName AS WSTRINGZ, ClassGuid AS GUID, DeviceDescription AS WSTRINGZ, BYVAL hwndParent AS QUAD,
 BYVAL CreationFlags AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiCreateDeviceInfoW LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInfoW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceName AS WSTRINGZ , BYREF ClassGuid AS GUID , BYREF DeviceDescription AS WSTRINGZ , BYVAL hwndParent AS QUAD , BYVAL CreationFlags AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiCreateDeviceInfo = SetupDiCreateDeviceInfoW
#ELSE
 MACRO SetupDiCreateDeviceInfo = SetupDiCreateDeviceInfoA
#ENDIF
' //
' // Flags for SetupDiOpenDeviceInfo
' //
%EQUATE `DIOD_INHERIT_CLASSDRVS = &H00000002
%EQUATE `DIOD_CANCEL_REMOVE = &H00000004
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiOpenDeviceInfoA LIB "SetupApi.dll" ALIAS "SetupDiOpenDeviceInfoA" ( BYVAL DeviceInfoSet AS QUAD, DeviceInstanceId AS ASCIIZ, BYVAL hwndParent AS QUAD,
 BYVAL OpenFlags AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiOpenDeviceInfoA LIB "setupapi.dll" ALIAS "SetupDiOpenDeviceInfoA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInstanceId AS ASCIIZ , BYVAL hwndParent AS QUAD , BYVAL OpenFlags AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiOpenDeviceInfoW LIB "SetupApi.dll" ALIAS "SetupDiOpenDeviceInfoW" ( BYVAL DeviceInfoSet AS QUAD, DeviceInstanceId AS WSTRINGZ, BYVAL hwndParent AS QUAD,
 BYVAL OpenFlags AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiOpenDeviceInfoW LIB "setupapi.dll" ALIAS "SetupDiOpenDeviceInfoW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInstanceId AS WSTRINGZ , BYVAL hwndParent AS QUAD , BYVAL OpenFlags AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiOpenDeviceInfo = SetupDiOpenDeviceInfoW
#ELSE
 MACRO SetupDiOpenDeviceInfo = SetupDiOpenDeviceInfoA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInstanceIdA LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInstanceIdA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, DeviceInstanceId AS ASCIIZ, BYVAL DeviceInstanceIdSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInstanceIdA LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInstanceIdA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DeviceInstanceId AS ASCIIZ , BYVAL DeviceInstanceIdSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInstanceIdW LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInstanceIdW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, DeviceInstanceId AS WSTRINGZ, BYVAL DeviceInstanceIdSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInstanceIdW LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInstanceIdW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DeviceInstanceId AS WSTRINGZ , BYVAL DeviceInstanceIdSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetDeviceInstanceId = SetupDiGetDeviceInstanceIdW
#ELSE
 MACRO SetupDiGetDeviceInstanceId = SetupDiGetDeviceInstanceIdA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiDeleteDeviceInfo LIB "SetupApi.dll" ALIAS "SetupDiDeleteDeviceInfo" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiDeleteDeviceInfo LIB "setupapi.dll" ALIAS "SetupDiDeleteDeviceInfo" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiEnumDeviceInfo LIB "SetupApi.dll" ALIAS "SetupDiEnumDeviceInfo" ( BYVAL DeviceInfoSet AS QUAD, BYVAL MemberIndex AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiEnumDeviceInfo LIB "setupapi.dll" ALIAS "SetupDiEnumDeviceInfo" ( BYVAL DeviceInfoSet AS QUAD , BYVAL MemberIndex AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
DECLARE FUNCTION SetupDiDestroyDeviceInfoList LIB "setupapi.dll" ALIAS "SetupDiDestroyDeviceInfoList" ( BYVAL DeviceInfoSet AS QUAD ) AS LONG
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiEnumDeviceInterfaces LIB "SetupApi.dll" ALIAS "SetupDiEnumDeviceInterfaces" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, InterfaceClassGuid AS GUID, BYVAL MemberIndex AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiEnumDeviceInterfaces LIB "setupapi.dll" ALIAS "SetupDiEnumDeviceInterfaces" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF InterfaceClassGuid AS GUID , BYVAL MemberIndex AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA ) AS LONG
#ENDIF
' //
' // Backward compatibility--do not use
' //
'#define SetupDiEnumInterfaceDevice SetupDiEnumDeviceInterfaces
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCreateDeviceInterfaceA LIB "SetupApi.dll" ALIAS "SetupDiCreateDeviceInterfaceA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, InterfaceClassGuid AS GUID, ReferenceString AS ASCIIZ, BYVAL CreationFlags AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiCreateDeviceInterfaceA LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInterfaceA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF InterfaceClassGuid AS GUID , BYREF ReferenceString AS ASCIIZ , BYVAL CreationFlags AS QUAD , OPTIONAL BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCreateDeviceInterfaceW LIB "SetupApi.dll" ALIAS "SetupDiCreateDeviceInterfaceW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, InterfaceClassGuid AS GUID, ReferenceString AS WSTRINGZ, BYVAL CreationFlags AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiCreateDeviceInterfaceW LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInterfaceW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF InterfaceClassGuid AS GUID , BYREF ReferenceString AS WSTRINGZ , BYVAL CreationFlags AS QUAD , OPTIONAL BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiCreateDeviceInterface = SetupDiCreateDeviceInterfaceW
#ELSE
 MACRO SetupDiCreateDeviceInterface = SetupDiCreateDeviceInterfaceA
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiCreateInterfaceDeviceW SetupDiCreateDeviceInterfaceW
'#define SetupDiCreateInterfaceDeviceA SetupDiCreateDeviceInterfaceA
' //
' // Flags for SetupDiOpenDeviceInterface
' //
%EQUATE `DIODI_NO_ADD = &H00000001
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiOpenDeviceInterfaceA LIB "SetupApi.dll" ALIAS "SetupDiOpenDeviceInterfaceA" ( BYVAL DeviceInfoSet AS QUAD, DevicePath AS ASCIIZ, BYVAL OpenFlags AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiOpenDeviceInterfaceA LIB "setupapi.dll" ALIAS "SetupDiOpenDeviceInterfaceA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DevicePath AS ASCIIZ , BYVAL OpenFlags AS QUAD , OPTIONAL BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiOpenDeviceInterfaceW LIB "SetupApi.dll" ALIAS "SetupDiOpenDeviceInterfaceW" ( BYVAL DeviceInfoSet AS QUAD, DevicePath AS WSTRINGZ, BYVAL OpenFlags AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiOpenDeviceInterfaceW LIB "setupapi.dll" ALIAS "SetupDiOpenDeviceInterfaceW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DevicePath AS WSTRINGZ , BYVAL OpenFlags AS QUAD , OPTIONAL BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiOpenDeviceInterface = SetupDiOpenDeviceInterfaceW
#ELSE
 MACRO SetupDiOpenDeviceInterface = SetupDiOpenDeviceInterfaceA
#ENDIF
' //
' // Backward compatibility--do not use
' //
'#define SetupDiOpenInterfaceDeviceW SetupDiOpenDeviceInterfaceW
'#define SetupDiOpenInterfaceDeviceA SetupDiOpenDeviceInterfaceA
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInterfaceAlias LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInterfaceAlias" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, AliasInterfaceClassGuid AS GUID, BYVAL AliasDeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInterfaceAlias LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInterfaceAlias" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYREF AliasInterfaceClassGuid AS GUID , BYREF AliasDeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA ) AS LONG
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiGetInterfaceDeviceAlias SetupDiGetDeviceInterfaceAlias
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiDeleteDeviceInterfaceData LIB "SetupApi.dll" ALIAS "SetupDiDeleteDeviceInterfaceData" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiDeleteDeviceInterfaceData LIB "setupapi.dll" ALIAS "SetupDiDeleteDeviceInterfaceData" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA ) AS LONG
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiDeleteInterfaceDeviceData SetupDiDeleteDeviceInterfaceData
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiRemoveDeviceInterface LIB "SetupApi.dll" ALIAS "SetupDiRemoveDeviceInterface" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiRemoveDeviceInterface LIB "setupapi.dll" ALIAS "SetupDiRemoveDeviceInterface" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA ) AS LONG
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiRemoveInterfaceDevice SetupDiRemoveDeviceInterface
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInterfaceDetailA LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInterfaceDetailA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL DeviceInterfaceDetailData AS SP_DEVICE_INTERFACE_DETAIL_DATA_A PTR, BYVAL DeviceInterfaceDetailDataSize AS QUAD, RequiredSize AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInterfaceDetailA LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInterfaceDetailA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYREF DeviceInterfaceDetailData AS ANY , BYVAL DeviceInterfaceDetailDataSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInterfaceDetailW LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInterfaceDetailW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL DeviceInterfaceDetailData AS SP_DEVICE_INTERFACE_DETAIL_DATA_W PTR, BYVAL DeviceInterfaceDetailDataSize AS QUAD, RequiredSize AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInterfaceDetailW LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInterfaceDetailW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYREF DeviceInterfaceDetailData AS ANY , BYVAL DeviceInterfaceDetailDataSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetDeviceInterfaceDetail = SetupDiGetDeviceInterfaceDetailW
#ELSE
 MACRO SetupDiGetDeviceInterfaceDetail = SetupDiGetDeviceInterfaceDetailA
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiGetInterfaceDeviceDetailW SetupDiGetDeviceInterfaceDetailW
'#define SetupDiGetInterfaceDeviceDetailA SetupDiGetDeviceInterfaceDetailA
' //
' // Default install handler for DIF_INSTALLINTERFACES.
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiInstallDeviceInterfaces LIB "SetupApi.dll" ALIAS "SetupDiInstallDeviceInterfaces" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiInstallDeviceInterfaces LIB "setupapi.dll" ALIAS "SetupDiInstallDeviceInterfaces" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiInstallInterfaceDevices SetupDiInstallDeviceInterfaces
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
DECLARE FUNCTION SetupDiSetDeviceInterfaceDefault LIB "setupapi.dll" ALIAS "SetupDiSetDeviceInterfaceDefault" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYVAL Flags AS QUAD , BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
' //
' // Default install handler for DIF_REGISTERDEVICE
' //
' //
' // Flags for SetupDiRegisterDeviceInfo
' //
%EQUATE `SPRDI_FIND_DUPS = &H00000001
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiRegisterDeviceInfo LIB "SetupApi.dll" ALIAS "SetupDiRegisterDeviceInfo" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL Flags AS QUAD, BYVAL CompareProc AS QUAD, ' PSP_DETSIG_CMPPROC callback
 BYVAL CompareContext AS DWORD,
 BYVAL DupDeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiRegisterDeviceInfo LIB "setupapi.dll" ALIAS "SetupDiRegisterDeviceInfo" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Flags AS QUAD , OPTIONAL BYVAL CompareProc AS QUAD , OPTIONAL BYVAL CompareContext AS QUAD , OPTIONAL BYREF DupDeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Ordinal values distinguishing between class drivers and
' // device drivers.
' // (Passed in 'DriverType' parameter of driver information list APIs)
' //
%EQUATE `SPDIT_NODRIVER = &H00000000
%EQUATE `SPDIT_CLASSDRIVER = &H00000001
%EQUATE `SPDIT_COMPATDRIVER = &H00000002
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiBuildDriverInfoList LIB "SetupApi.dll" ALIAS "SetupDiBuildDriverInfoList" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverType AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiBuildDriverInfoList LIB "setupapi.dll" ALIAS "SetupDiBuildDriverInfoList" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL DriverType AS QUAD ) AS LONG
#ENDIF
DECLARE FUNCTION SetupDiCancelDriverInfoSearch LIB "setupapi.dll" ALIAS "SetupDiCancelDriverInfoSearch" ( BYVAL DeviceInfoSet AS QUAD ) AS LONG
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiEnumDriverInfoA LIB "SetupApi.dll" ALIAS "SetupDiEnumDriverInfoA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverType AS QUAD, BYVAL MemberIndex AS QUAD, BYVAL DriverInfoData AS SP_DRVINFO_DATA_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiEnumDriverInfoA LIB "setupapi.dll" ALIAS "SetupDiEnumDriverInfoA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL DriverType AS QUAD , BYVAL MemberIndex AS QUAD , BYREF DriverInfoData AS SP_DRVINFO_DATA_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiEnumDriverInfoW LIB "SetupApi.dll" ALIAS "SetupDiEnumDriverInfoW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverType AS QUAD, BYVAL MemberIndex AS QUAD, BYVAL DriverInfoData AS SP_DRVINFO_DATA_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiEnumDriverInfoW LIB "setupapi.dll" ALIAS "SetupDiEnumDriverInfoW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL DriverType AS QUAD , BYVAL MemberIndex AS QUAD , BYREF DriverInfoData AS SP_DRVINFO_DATA_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiEnumDriverInfo = SetupDiEnumDriverInfoW
#ELSE
 MACRO SetupDiEnumDriverInfo = SetupDiEnumDriverInfoA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetSelectedDriverA LIB "SetupApi.dll" ALIAS "SetupDiGetSelectedDriverA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetSelectedDriverA LIB "setupapi.dll" ALIAS "SetupDiGetSelectedDriverA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DriverInfoData AS SP_DRVINFO_DATA_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetSelectedDriverW LIB "SetupApi.dll" ALIAS "SetupDiGetSelectedDriverW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetSelectedDriverW LIB "setupapi.dll" ALIAS "SetupDiGetSelectedDriverW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DriverInfoData AS SP_DRVINFO_DATA_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetSelectedDriver = SetupDiGetSelectedDriverW
#ELSE
 MACRO SetupDiGetSelectedDriver = SetupDiGetSelectedDriverA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetSelectedDriverA LIB "SetupApi.dll" ALIAS "SetupDiSetSelectedDriverA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetSelectedDriverA LIB "setupapi.dll" ALIAS "SetupDiSetSelectedDriverA" ( BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA , OPTIONAL BYREF DriverInfoData AS SP_DRVINFO_DATA_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetSelectedDriverW LIB "SetupApi.dll" ALIAS "SetupDiSetSelectedDriverW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetSelectedDriverW LIB "setupapi.dll" ALIAS "SetupDiSetSelectedDriverW" ( BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA , OPTIONAL BYREF DriverInfoData AS SP_DRVINFO_DATA_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiSetSelectedDriver = SetupDiSetSelectedDriverW
#ELSE
 MACRO SetupDiSetSelectedDriver = SetupDiSetSelectedDriverA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDriverInfoDetailA LIB "SetupApi.dll" ALIAS "SetupDiGetDriverInfoDetailA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_A PTR, BYVAL DriverInfoDetailData AS SP_DRVINFO_DETAIL_DATA_A PTR, BYVAL DriverInfoDetailDataSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDriverInfoDetailA LIB "setupapi.dll" ALIAS "SetupDiGetDriverInfoDetailA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DriverInfoData AS SP_DRVINFO_DATA_A , BYREF DriverInfoDetailData AS ANY , BYVAL DriverInfoDetailDataSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDriverInfoDetailW LIB "SetupApi.dll" ALIAS "SetupDiGetDriverInfoDetailW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_W PTR, BYVAL DriverInfoDetailData AS SP_DRVINFO_DETAIL_DATA_W PTR, BYVAL DriverInfoDetailDataSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDriverInfoDetailW LIB "setupapi.dll" ALIAS "SetupDiGetDriverInfoDetailW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DriverInfoData AS SP_DRVINFO_DATA_W , BYREF DriverInfoDetailData AS ANY , BYVAL DriverInfoDetailDataSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetDriverInfoDetail = SetupDiGetDriverInfoDetailW
#ELSE
 MACRO SetupDiGetDriverInfoDetail = SetupDiGetDriverInfoDetailA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiDestroyDriverInfoList LIB "SetupApi.dll" ALIAS "SetupDiDestroyDriverInfoList" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverType AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiDestroyDriverInfoList LIB "setupapi.dll" ALIAS "SetupDiDestroyDriverInfoList" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL DriverType AS QUAD ) AS LONG
#ENDIF
' //
' // Flags controlling what is included in the device information set built
' // by SetupDiGetClassDevs
' //
%EQUATE `DIGCF_DEFAULT = &H00000001 ' // only valid with DIGCF_DEVICEINTERFACE
%EQUATE `DIGCF_PRESENT = &H00000002
%EQUATE `DIGCF_ALLCLASSES = &H00000004
%EQUATE `DIGCF_PROFILE = &H00000008
%EQUATE `DIGCF_DEVICEINTERFACE = &H00000010
' //
' // Backward compatibility--do not use.
' //
%EQUATE `DIGCF_INTERFACEDEVICE = %DIGCF_DEVICEINTERFACE
DECLARE FUNCTION SetupDiGetClassDevsA LIB "setupapi.dll" ALIAS "SetupDiGetClassDevsA" ( BYREF ClassGuid AS GUID , BYREF Enumerator AS ASCIIZ , BYVAL hwndParent AS QUAD , BYVAL Flags AS QUAD ) AS QUAD ' HDEVINFO
DECLARE FUNCTION SetupDiGetClassDevsW LIB "setupapi.dll" ALIAS "SetupDiGetClassDevsW" ( BYREF ClassGuid AS GUID , BYREF Enumerator AS WSTRINGZ , BYVAL hwndParent AS QUAD , BYVAL Flags AS QUAD ) AS QUAD ' HDEVINFO
#IF %DEF(%UNICODE)
 MACRO SetupDiGetClassDevs = SetupDiGetClassDevsW
#ELSE
 MACRO SetupDiGetClassDevs = SetupDiGetClassDevsA
#ENDIF
DECLARE FUNCTION SetupDiGetClassDevsExA LIB "setupapi.dll" ALIAS "SetupDiGetClassDevsExA" ( BYREF ClassGuid AS GUID , BYREF Enumerator AS ASCIIZ , BYVAL hwndParent AS QUAD , BYVAL Flags AS QUAD , OPTIONAL BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS QUAD ' HDEVINFO
DECLARE FUNCTION SetupDiGetClassDevsExW LIB "setupapi.dll" ALIAS "SetupDiGetClassDevsExW" ( BYREF ClassGuid AS GUID , BYREF Enumerator AS WSTRINGZ , BYVAL hwndParent AS QUAD , BYVAL Flags AS QUAD , OPTIONAL BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF MachineName AS WSTRINGZ , OPTIONAL BYVAL Reserved AS QUAD ) AS QUAD ' HDEVINFO
#IF %DEF(%UNICODE)
 MACRO SetupDiGetClassDevsEx = SetupDiGetClassDevsExW
#ELSE
 MACRO SetupDiGetClassDevsEx = SetupDiGetClassDevsExA
#ENDIF
DECLARE FUNCTION SetupDiGetINFClassA LIB "setupapi.dll" ALIAS "SetupDiGetINFClassA" ( BYREF InfName AS ASCIIZ , BYREF ClassGuid AS GUID , BYREF ClassName AS ASCIIZ , BYVAL ClassNameSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiGetINFClassW LIB "setupapi.dll" ALIAS "SetupDiGetINFClassW" ( BYREF InfName AS WSTRINGZ
 , BYREF ClassGuid AS GUID
 , BYREF ClassName AS WSTRINGZ
 , BYVAL ClassNameSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiGetINFClass = SetupDiGetINFClassW
#ELSE
 MACRO SetupDiGetINFClass = SetupDiGetINFClassA
#ENDIF
' //
' // Flags controlling exclusion from the class information list built
' // by SetupDiBuildClassInfoList(Ex)
' //
%EQUATE `DIBCI_NOINSTALLCLASS = &H00000001
%EQUATE `DIBCI_NODISPLAYCLASS = &H00000002
DECLARE FUNCTION SetupDiBuildClassInfoList LIB "setupapi.dll" ALIAS "SetupDiBuildClassInfoList" ( BYVAL Flags AS QUAD , BYREF ClassGuidList AS GUID , BYVAL ClassGuidListSize AS QUAD , BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiBuildClassInfoListExA LIB "setupapi.dll" ALIAS "SetupDiBuildClassInfoListExA" ( BYVAL Flags AS QUAD
 , BYREF ClassGuidList AS GUID
 , BYVAL ClassGuidListSize AS DWORD
 , BYREF RequiredSize AS DWORD
 , OPTIONAL BYREF MachineName AS ASCIIZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
DECLARE FUNCTION SetupDiBuildClassInfoListExW LIB "setupapi.dll" ALIAS "SetupDiBuildClassInfoListExW" ( BYVAL Flags AS DWORD
 , BYREF ClassGuidList AS GUID
 , BYVAL ClassGuidListSize AS DWORD
 , BYREF RequiredSize AS DWORD
 , OPTIONAL BYREF MachineName AS WSTRINGZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiBuildClassInfoListEx = SetupDiBuildClassInfoListExW
#ELSE
 MACRO SetupDiBuildClassInfoListEx = SetupDiBuildClassInfoListExA
#ENDIF
DECLARE FUNCTION SetupDiGetClassDescriptionA LIB "setupapi.dll" ALIAS "SetupDiGetClassDescriptionA" ( BYREF ClassGuid AS GUID , BYREF ClassDescription AS ASCIIZ , BYVAL ClassDescriptionSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiGetClassDescriptionW LIB "setupapi.dll" ALIAS "SetupDiGetClassDescriptionW" ( BYREF ClassGuid AS GUID
 , BYREF ClassDescription AS WSTRINGZ
 , BYVAL ClassDescriptionSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiGetClassDescription = SetupDiGetClassDescriptionW
#ELSE
 MACRO SetupDiGetClassDescription = SetupDiGetClassDescriptionA
#ENDIF
DECLARE FUNCTION SetupDiGetClassDescriptionExA LIB "setupapi.dll" ALIAS "SetupDiGetClassDescriptionExA" ( BYREF ClassGuid AS GUID , BYREF ClassDescription AS ASCIIZ , BYVAL ClassDescriptionSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiGetClassDescriptionExW LIB "setupapi.dll" ALIAS "SetupDiGetClassDescriptionExW" ( BYREF ClassGuid AS GUID
 , BYREF ClassDescription AS WSTRINGZ
 , BYVAL ClassDescriptionSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 , OPTIONAL BYREF MachineName AS WSTRINGZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiGetClassDescriptionEx = SetupDiGetClassDescriptionExW
#ELSE
 MACRO SetupDiGetClassDescriptionEx = SetupDiGetClassDescriptionExA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCallClassInstaller LIB "SetupApi.dll" ALIAS "SetupDiCallClassInstaller" ( BYVAL InstallFunction AS QUAD, BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiCallClassInstaller LIB "setupapi.dll" ALIAS "SetupDiCallClassInstaller" ( BYVAL InstallFunction AS QUAD , BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Default install handler for DIF_SELECTDEVICE
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSelectDevice LIB "SetupApi.dll" ALIAS "SetupDiSelectDevice" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSelectDevice LIB "setupapi.dll" ALIAS "SetupDiSelectDevice" ( BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Default install handler for DIF_SELECTBESTCOMPATDRV
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSelectBestCompatDrv LIB "SetupApi.dll" ALIAS "SetupDiSelectBestCompatDrv" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSelectBestCompatDrv LIB "setupapi.dll" ALIAS "SetupDiSelectBestCompatDrv" ( BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Default install handler for DIF_INSTALLDEVICE
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiInstallDevice LIB "SetupApi.dll" ALIAS "SetupDiInstallDevice" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiInstallDevice LIB "setupapi.dll" ALIAS "SetupDiInstallDevice" ( BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Default install handler for DIF_INSTALLDEVICEFILES
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiInstallDriverFiles LIB "SetupApi.dll" ALIAS "SetupDiInstallDriverFiles" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiInstallDriverFiles LIB "setupapi.dll" ALIAS "SetupDiInstallDriverFiles" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Default install handler for DIF_REGISTER_COINSTALLERS
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiRegisterCoDeviceInstallers LIB "SetupApi.dll" ALIAS "SetupDiRegisterCoDeviceInstallers" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiRegisterCoDeviceInstallers LIB "setupapi.dll" ALIAS "SetupDiRegisterCoDeviceInstallers" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Default install handler for DIF_REMOVE
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiRemoveDevice LIB "SetupApi.dll" ALIAS "SetupDiRemoveDevice" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiRemoveDevice LIB "setupapi.dll" ALIAS "SetupDiRemoveDevice" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
' //
' // Default install handler for DIF_UNREMOVE
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiUnremoveDevice LIB "SetupApi.dll" ALIAS "SetupDiUnremoveDevice" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiUnremoveDevice LIB "setupapi.dll" ALIAS "SetupDiUnremoveDevice" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WS03
#IF %SETUPAPI_VER >= %WIN32_WINNT_WS03
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiRestartDevices LIB "SetupApi.dll" ALIAS "SetupDiRestartDevices" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiRestartDevices LIB "setupapi.dll" ALIAS "SetupDiRestartDevices" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WS03
' //
' // Default install handler for DIF_PROPERTYCHANGE
' //
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiChangeState LIB "SetupApi.dll" ALIAS "SetupDiChangeState" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiChangeState LIB "setupapi.dll" ALIAS "SetupDiChangeState" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
'//
'// Default install handler for DIF_FINISHINSTALL_ACTION
'//
#IF %DEF(%USEPBDECL)
' [does not appear to be exported]
'DECLARE FUNCTION SetupDiFinishInstallAction LIB "SetupApi.dll" ' ALIAS "SetupDiFinishInstallAction" ( ' BYVAL DeviceInfoSet AS DWORD, ' BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ' ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiFinishInstallAction LIB "setupapi.dll" ALIAS "SetupDiFinishInstallAction" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
DECLARE FUNCTION SetupDiInstallClassA LIB "setupapi.dll" ALIAS "SetupDiInstallClassA" ( BYVAL hwndParent AS QUAD , BYREF InfFileName AS ASCIIZ , BYVAL Flags AS QUAD , OPTIONAL BYVAL FileQueue AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiInstallClassW LIB "setupapi.dll" ALIAS "SetupDiInstallClassW" ( BYVAL hwndParent AS QUAD
 , BYREF InfFileName AS WSTRINGZ
 , BYVAL Flags AS DWORD
 , OPTIONAL BYVAL FileQueue AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiInstallClass = SetupDiInstallClassW
#ELSE
 MACRO SetupDiInstallClass = SetupDiInstallClassA
#ENDIF
DECLARE FUNCTION SetupDiInstallClassExA LIB "setupapi.dll" ALIAS "SetupDiInstallClassExA" ( BYVAL hwndParent AS QUAD , BYREF InfFileName AS ASCIIZ , BYVAL Flags AS QUAD , OPTIONAL BYVAL FileQueue AS QUAD , OPTIONAL BYREF InterfaceClassGuid AS GUID , OPTIONAL BYVAL Reserved1 AS QUAD , OPTIONAL BYVAL Reserved2 AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiInstallClassExW LIB "setupapi.dll" ALIAS "SetupDiInstallClassExW" ( BYVAL hwndParent AS QUAD
 , BYREF InfFileName AS WSTRINGZ
 , BYVAL Flags AS DWORD
 , OPTIONAL BYVAL FileQueue AS DWORD
 , OPTIONAL BYREF InterfaceClassGuid AS GUID
 , OPTIONAL BYVAL Reserved1 AS DWORD
 , OPTIONAL BYVAL Reserved2 AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiInstallClassEx = SetupDiInstallClassExW
#ELSE
 MACRO SetupDiInstallClassEx = SetupDiInstallClassExA
#ENDIF
DECLARE FUNCTION SetupDiOpenClassRegKey LIB "setupapi.dll" ALIAS "SetupDiOpenClassRegKey" ( BYREF ClassGuid AS GUID , BYVAL samDesired AS REGSAM ) AS QUAD ' HKEY
' //
' // Flags for SetupDiOpenClassRegKeyEx
' //
%EQUATE `DIOCR_INSTALLER = &H00000001 ' // class installer registry branch
%EQUATE `DIOCR_INTERFACE = &H00000002 ' // interface class registry branch
DECLARE FUNCTION SetupDiOpenClassRegKeyExA LIB "setupapi.dll" ALIAS "SetupDiOpenClassRegKeyExA" ( BYREF ClassGuid AS GUID , BYVAL samDesired AS REGSAM , BYVAL Flags AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS QUAD ' HKEY
DECLARE FUNCTION SetupDiOpenClassRegKeyExW LIB "setupapi.dll" ALIAS "SetupDiOpenClassRegKeyExW" ( BYREF ClassGuid AS GUID , BYVAL samDesired AS REGSAM , BYVAL Flags AS QUAD , OPTIONAL BYREF MachineName AS WSTRINGZ , OPTIONAL BYVAL Reserved AS QUAD ) AS QUAD ' HKEY
#IF %DEF(%UNICODE)
 MACRO SetupDiOpenClassRegKeyEx = SetupDiOpenClassRegKeyExW
#ELSE
 MACRO SetupDiOpenClassRegKeyEx = SetupDiOpenClassRegKeyExA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCreateDeviceInterfaceRegKeyA LIB "SetupApi.dll" ALIAS "SetupDiCreateDeviceInterfaceRegKeyA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL Reserved AS QUAD, BYVAL samDesired AS REGSAM, BYVAL InfHandle AS QUAD, InfSectionName AS ASCIIZ ) AS QUAD ' HKEY
#ELSE
DECLARE FUNCTION SetupDiCreateDeviceInterfaceRegKeyA LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInterfaceRegKeyA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYVAL Reserved AS QUAD , BYVAL samDesired AS REGSAM , OPTIONAL BYVAL InfHandle AS QUAD , OPTIONAL BYREF InfSectionName AS ASCIIZ ) AS QUAD ' HKEY
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCreateDeviceInterfaceRegKeyW LIB "SetupApi.dll" ALIAS "SetupDiCreateDeviceInterfaceRegKeyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL Reserved AS QUAD, BYVAL samDesired AS REGSAM, BYVAL InfHandle AS QUAD, InfSectionName AS WSTRINGZ ) AS QUAD ' HKEY
#ELSE
DECLARE FUNCTION SetupDiCreateDeviceInterfaceRegKeyW LIB "setupapi.dll" ALIAS "SetupDiCreateDeviceInterfaceRegKeyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYVAL Reserved AS QUAD , BYVAL samDesired AS REGSAM , OPTIONAL BYVAL InfHandle AS QUAD , OPTIONAL BYREF InfSectionName AS WSTRINGZ ) AS QUAD ' HKEY
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiCreateDeviceInterfaceRegKey = SetupDiCreateDeviceInterfaceRegKeyW
#ELSE
 MACRO SetupDiCreateDeviceInterfaceRegKey = SetupDiCreateDeviceInterfaceRegKeyA
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiCreateInterfaceDeviceRegKeyW SetupDiCreateDeviceInterfaceRegKeyW
'#define SetupDiCreateInterfaceDeviceRegKeyA SetupDiCreateDeviceInterfaceRegKeyA
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiOpenDeviceInterfaceRegKey LIB "SetupApi.dll" ALIAS "SetupDiOpenDeviceInterfaceRegKey" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL Reserved AS QUAD, BYVAL samDesired AS REGSAM ) AS QUAD ' HKEY
#ELSE
DECLARE FUNCTION SetupDiOpenDeviceInterfaceRegKey LIB "setupapi.dll" ALIAS "SetupDiOpenDeviceInterfaceRegKey" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYVAL Reserved AS QUAD , BYVAL samDesired AS REGSAM ) AS QUAD ' HKEY
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiOpenInterfaceDeviceRegKey SetupDiOpenDeviceInterfaceRegKey
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiDeleteDeviceInterfaceRegKey LIB "SetupApi.dll" ALIAS "SetupDiDeleteDeviceInterfaceRegKey" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL Reserved AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiDeleteDeviceInterfaceRegKey LIB "setupapi.dll" ALIAS "SetupDiDeleteDeviceInterfaceRegKey" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
' //
' // Backward compatibility--do not use.
' //
'#define SetupDiDeleteInterfaceDeviceRegKey SetupDiDeleteDeviceInterfaceRegKey
' //
' // KeyType values for SetupDiCreateDevRegKey, SetupDiOpenDevRegKey, and
' // SetupDiDeleteDevRegKey.
' //
%EQUATE `DIREG_DEV = &H00000001 ' // Open/Create/Delete device key
%EQUATE `DIREG_DRV = &H00000002 ' // Open/Create/Delete driver key
%EQUATE `DIREG_BOTH = &H00000004 ' // Delete both driver and Device key
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCreateDevRegKeyA LIB "SetupApi.dll" ALIAS "SetupDiCreateDevRegKeyA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL Scope AS QUAD, BYVAL HwProfile AS QUAD, BYVAL KeyType AS QUAD, BYVAL InfHandle AS QUAD, InfSectionName AS ASCIIZ ) AS QUAD ' HKEY
#ELSE
DECLARE FUNCTION SetupDiCreateDevRegKeyA LIB "setupapi.dll" ALIAS "SetupDiCreateDevRegKeyA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Scope AS QUAD , BYVAL HwProfile AS QUAD , BYVAL KeyType AS QUAD , OPTIONAL BYVAL InfHandle AS QUAD , OPTIONAL BYREF InfSectionName AS ASCIIZ ) AS QUAD ' HKEY
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiCreateDevRegKeyW LIB "SetupApi.dll" ALIAS "SetupDiCreateDevRegKeyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL Scope AS QUAD, BYVAL HwProfile AS QUAD, BYVAL KeyType AS QUAD, BYVAL InfHandle AS QUAD, InfSectionName AS WSTRINGZ ) AS QUAD ' HKEY
#ELSE
DECLARE FUNCTION SetupDiCreateDevRegKeyW LIB "setupapi.dll" ALIAS "SetupDiCreateDevRegKeyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Scope AS QUAD , BYVAL HwProfile AS QUAD , BYVAL KeyType AS QUAD , OPTIONAL BYVAL InfHandle AS QUAD , OPTIONAL BYREF InfSectionName AS WSTRINGZ ) AS QUAD ' HKEY
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiCreateDevRegKey = SetupDiCreateDevRegKeyW
#ELSE
 MACRO SetupDiCreateDevRegKey = SetupDiCreateDevRegKeyA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiOpenDevRegKey LIB "SetupApi.dll" ALIAS "SetupDiOpenDevRegKey" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL Scope AS QUAD, BYVAL HwProfile AS QUAD, BYVAL KeyType AS QUAD, BYVAL samDesired AS REGSAM ) AS QUAD ' HKEY
#ELSE
DECLARE FUNCTION SetupDiOpenDevRegKey LIB "setupapi.dll" ALIAS "SetupDiOpenDevRegKey" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Scope AS QUAD , BYVAL HwProfile AS QUAD , BYVAL KeyType AS QUAD , BYVAL samDesired AS REGSAM ) AS QUAD ' HKEY
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiDeleteDevRegKey LIB "SetupApi.dll" ALIAS "SetupDiDeleteDevRegKey" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL Scope AS QUAD, BYVAL HwProfile AS QUAD, BYVAL KeyType AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiDeleteDevRegKey LIB "setupapi.dll" ALIAS "SetupDiDeleteDevRegKey" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Scope AS QUAD , BYVAL HwProfile AS QUAD , BYVAL KeyType AS QUAD ) AS LONG
#ENDIF
DECLARE FUNCTION SetupDiGetHwProfileList LIB "setupapi.dll" ALIAS "SetupDiGetHwProfileList" ( BYREF HwProfileList AS QUAD , BYVAL HwProfile AS QUAD , BYREF RequiredSize AS QUAD , OPTIONAL BYREF CurrentlyActiveIndex AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiGetHwProfileListExA LIB "setupapi.dll" ALIAS "SetupDiGetHwProfileListExA" ( BYREF HwProfileList AS QUAD
 , BYVAL HwProfile AS DWORD
 , BYREF RequiredSize AS DWORD
 , OPTIONAL BYREF CurrentlyActiveIndex AS DWORD
 , OPTIONAL BYREF MachineName AS ASCIIZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
DECLARE FUNCTION SetupDiGetHwProfileListExW LIB "setupapi.dll" ALIAS "SetupDiGetHwProfileListExW" ( BYREF HwProfileList AS DWORD
 , BYVAL HwProfile AS DWORD
 , BYREF RequiredSize AS DWORD
 , OPTIONAL BYREF CurrentlyActiveIndex AS DWORD
 , OPTIONAL BYREF MachineName AS WSTRINGZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiGetHwProfileListEx = SetupDiGetHwProfileListExW
#ELSE
 MACRO SetupDiGetHwProfileListEx = SetupDiGetHwProfileListExA
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDevicePropertyKeys LIB "SetupApi.dll" ALIAS "SetupDiGetDevicePropertyKeys" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL PropertyKeyArray AS DEVPROPKEY PTR, BYVAL PropertyKeyCount AS QUAD, RequiredPropertyKeyCount AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDevicePropertyKeys LIB "setupapi.dll" ALIAS "SetupDiGetDevicePropertyKeys" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF PropertyKeyArray AS DEVPROPKEY , BYVAL PropertyKeyCount AS QUAD , BYREF RequiredPropertyKeyCount AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDevicePropertyW LIB "SetupApi.dll" ALIAS "SetupDiGetDevicePropertyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL PropertyKey AS DEVPROPKEY PTR, BYVAL PropertyType AS QUAD PTR, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDevicePropertyW LIB "setupapi.dll" ALIAS "SetupDiGetDevicePropertyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF PropertyKey AS DEVPROPKEY , BYREF PropertyType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , BYREF RequiredSize AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiGetDeviceProperty = SetupDiGetDevicePropertyW
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetDevicePropertyW LIB "SetupApi.dll" ALIAS "SetupDiSetDevicePropertyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL PropertyKey AS DEVPROPKEY PTR, BYVAL PropertyType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetDevicePropertyW LIB "setupapi.dll" ALIAS "SetupDiSetDevicePropertyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF PropertyKey AS DEVPROPKEY , BYVAL PropertyType AS QUAD , BYVAL PropertyBuffer AS BYTE PTR , BYVAL PropertyBufferSize AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiSetDeviceProperty = SetupDiSetDevicePropertyW
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInterfacePropertyKeys LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInterfacePropertyKeys" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL PropertyKeyArray AS DEVPROPKEY PTR, BYVAL PropertyKeyCount AS QUAD, RequiredPropertyKeyCount AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInterfacePropertyKeys LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInterfacePropertyKeys" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYREF PropertyKeyArray AS DEVPROPKEY , BYVAL PropertyKeyCount AS QUAD , BYREF RequiredPropertyKeyCount AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInterfacePropertyW LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInterfacePropertyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL PropertyKey AS DEVPROPKEY PTR, BYVAL PropertyType AS QUAD PTR, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInterfacePropertyW LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInterfacePropertyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYREF PropertyKey AS DEVPROPKEY , BYREF PropertyType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , BYREF RequiredSize AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiGetDeviceInterfaceProperty = SetupDiGetDeviceInterfacePropertyW
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetDeviceInterfacePropertyW LIB "SetupApi.dll" ALIAS "SetupDiSetDeviceInterfacePropertyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA PTR, BYVAL PropertyKey AS DEVPROPKEY PTR, BYVAL PropertyType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetDeviceInterfacePropertyW LIB "setupapi.dll" ALIAS "SetupDiSetDeviceInterfacePropertyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInterfaceData AS SP_DEVICE_INTERFACE_DATA , BYREF PropertyKey AS DEVPROPKEY , BYVAL PropertyType AS QUAD , BYVAL PropertyBuffer AS BYTE PTR , BYVAL PropertyBufferSize AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiSetDeviceInterfaceProperty = SetupDiSetDeviceInterfacePropertyW
'//
'// Flags for SetupDiGetClassPropertyKeys, SetupDiGetClassProperty, and
'// SetupDiSetClassProperty.
'//
%EQUATE `DICLASSPROP_INSTALLER = &H00000001 ' // device setup class property
%EQUATE `DICLASSPROP_INTERFACE = &H00000002 ' // device interface class property
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassPropertyKeys LIB "SetupApi.dll" ALIAS "SetupDiGetClassPropertyKeys" ( ClassGuid AS GUID, BYVAL PropertyKeyArray AS DEVPROPKEY PTR, BYVAL PropertyKeyCount AS QUAD, RequiredPropertyKeyCount AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassPropertyKeys LIB "setupapi.dll" ALIAS "SetupDiGetClassPropertyKeys" ( BYREF ClassGuid AS GUID , BYREF PropertyKeyArray AS DEVPROPKEY , BYVAL PropertyKeyCount AS QUAD , BYREF RequiredPropertyKeyCount AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassPropertyKeysExW LIB "SetupApi.dll" ALIAS "SetupDiGetClassPropertyKeysExW" ( ClassGuid AS GUID, BYVAL PropertyKeyArray AS DEVPROPKEY PTR, BYVAL PropertyKeyCount AS QUAD, RequiredPropertyKeyCount AS QUAD, BYVAL Flags AS QUAD, MachineName AS WSTRINGZ, BYVAL Reserved AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassPropertyKeysExW LIB "setupapi.dll" ALIAS "SetupDiGetClassPropertyKeysExW" ( BYREF ClassGuid AS GUID , BYREF PropertyKeyArray AS DEVPROPKEY , BYVAL PropertyKeyCount AS QUAD , BYREF RequiredPropertyKeyCount AS QUAD , BYVAL Flags AS QUAD , OPTIONAL BYREF MachineName AS WSTRINGZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiGetClassPropertyKeysEx = SetupDiGetClassPropertyKeysExW
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassPropertyW LIB "SetupApi.dll" ALIAS "SetupDiGetClassPropertyW" ( ClassGuid AS GUID, BYVAL PropertyKey AS DEVPROPKEY PTR, BYVAL PropertyType AS QUAD PTR, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassPropertyW LIB "setupapi.dll" ALIAS "SetupDiGetClassPropertyW" ( BYREF ClassGuid AS GUID , BYREF PropertyKey AS DEVPROPKEY , BYREF PropertyType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , BYREF RequiredSize AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiGetClassProperty = SetupDiGetClassPropertyW
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassPropertyExW LIB "SetupApi.dll" ALIAS "SetupDiGetClassPropertyExW" ( ClassGuid AS GUID, BYVAL PropertyKey AS DEVPROPKEY PTR, BYVAL PropertyType AS QUAD PTR, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD, BYVAL Flags AS QUAD, MachineName AS WSTRINGZ, BYVAL Reserved AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassPropertyExW LIB "setupapi.dll" ALIAS "SetupDiGetClassPropertyExW" ( BYREF ClassGuid AS GUID , BYREF PropertyKey AS DEVPROPKEY , BYREF PropertyType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , BYREF RequiredSize AS QUAD , BYVAL Flags AS QUAD , OPTIONAL BYREF MachineName AS WSTRINGZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiGetClassPropertyEx = SetupDiGetClassPropertyExW
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetClassPropertyW LIB "SetupApi.dll" ALIAS "SetupDiSetClassPropertyW" ( ClassGuid AS GUID, BYVAL PropertyKey AS DEVPROPKEY PTR, BYVAL PropertyType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, BYVAL Flags AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetClassPropertyW LIB "setupapi.dll" ALIAS "SetupDiSetClassPropertyW" ( BYREF ClassGuid AS GUID , BYREF PropertyKey AS DEVPROPKEY , BYREF PropertyType AS QUAD , BYVAL PropertyBuffer AS BYTE PTR , BYVAL PropertyBufferSize AS QUAD , BYVAL Flags AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiSetClassProperty = SetupDiSetClassPropertyW
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetClassPropertyExW LIB "SetupApi.dll" ALIAS "SetupDiSetClassPropertyExW" ( ClassGuid AS GUID, BYVAL PropertyKey AS DEVPROPKEY PTR, BYVAL PropertyType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, BYVAL Flags AS QUAD, MachineName AS WSTRINGZ, BYVAL Reserved AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetClassPropertyExW LIB "setupapi.dll" ALIAS "SetupDiSetClassPropertyExW" ( BYREF ClassGuid AS GUID , BYREF PropertyKey AS DEVPROPKEY , BYREF PropertyType AS QUAD , BYVAL PropertyBuffer AS BYTE PTR , BYVAL PropertyBufferSize AS QUAD , BYVAL Flags AS QUAD , OPTIONAL BYREF MachineName AS WSTRINGZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
MACRO SetupDiSetClassPropertyEx = SetupDiSetClassPropertyExW
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
' //
' // 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!
' //
%EQUATE `SPDRP_DEVICEDESC = &H00000000 ' // DeviceDesc R/W
%EQUATE `SPDRP_HARDWAREID = &H00000001 ' // HardwareID R/W
%EQUATE `SPDRP_COMPATIBLEIDS = &H00000002 ' // CompatibleIDs R/W
%EQUATE `SPDRP_UNUSED0 = &H00000003 ' // unused
%EQUATE `SPDRP_SERVICE = &H00000004 ' // Service R/W
%EQUATE `SPDRP_UNUSED1 = &H00000005 ' // unused
%EQUATE `SPDRP_UNUSED2 = &H00000006 ' // unused
%EQUATE `SPDRP_CLASS = &H00000007 ' // Class R--tied to ClassGUID???
%EQUATE `SPDRP_CLASSGUID = &H00000008 ' // ClassGUID R/W
%EQUATE `SPDRP_DRIVER = &H00000009 ' // Driver R/W
%EQUATE `SPDRP_CONFIGFLAGS = &H0000000A ' // ConfigFlags R/W
%EQUATE `SPDRP_MFG = &H0000000B ' // Mfg R/W
%EQUATE `SPDRP_FRIENDLYNAME = &H0000000C ' // FriendlyName R/W
%EQUATE `SPDRP_LOCATION_INFORMATION = &H0000000D ' // LocationInformation R/W
%EQUATE `SPDRP_PHYSICAL_DEVICE_OBJECT_NAME = &H0000000E ' // PhysicalDeviceObjectName R
%EQUATE `SPDRP_CAPABILITIES = &H0000000F ' // Capabilities R
%EQUATE `SPDRP_UI_NUMBER = &H00000010 ' // UiNumber R
%EQUATE `SPDRP_UPPERFILTERS = &H00000011 ' // UpperFilters R/W
%EQUATE `SPDRP_LOWERFILTERS = &H00000012 ' // LowerFilters R/W
%EQUATE `SPDRP_BUSTYPEGUID = &H00000013 ' // BusTypeGUID R
%EQUATE `SPDRP_LEGACYBUSTYPE = &H00000014 ' // LegacyBusType R
%EQUATE `SPDRP_BUSNUMBER = &H00000015 ' // BusNumber R
%EQUATE `SPDRP_ENUMERATOR_NAME = &H00000016 ' // Enumerator Name R
%EQUATE `SPDRP_SECURITY = &H00000017 ' // Security R/W, binary form???
%EQUATE `SPDRP_SECURITY_SDS = &H00000018 ' // Security W, SDS form???
%EQUATE `SPDRP_DEVTYPE = &H00000019 ' // Device Type R/W
%EQUATE `SPDRP_EXCLUSIVE = &H0000001A ' // Device is exclusive-access R/W
%EQUATE `SPDRP_CHARACTERISTICS = &H0000001B ' // Device Characteristics R/W
%EQUATE `SPDRP_ADDRESS = &H0000001C ' // Device Address R
%EQUATE `SPDRP_UI_NUMBER_DESC_FORMAT = &H0000001D ' // UiNumberDescFormat R/W
%EQUATE `SPDRP_DEVICE_POWER_DATA = &H0000001E ' // Device Power Data R
%EQUATE `SPDRP_REMOVAL_POLICY = &H0000001F ' // Removal Policy R
%EQUATE `SPDRP_REMOVAL_POLICY_HW_DEFAULT = &H00000020 ' // Hardware Removal Policy R
%EQUATE `SPDRP_REMOVAL_POLICY_OVERRIDE = &H00000021 ' // Removal Policy Override RW???
%EQUATE `SPDRP_INSTALL_STATE = &H00000022 ' // Device Install State R
%EQUATE `SPDRP_LOCATION_PATHS = &H00000023 ' // Device Location Paths R
%EQUATE `SPDRP_BASE_CONTAINERID = &H00000024 ' // Base ContainerID R
%EQUATE `SPDRP_MAXIMUM_PROPERTY = &H00000025 ' // 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
' //
%EQUATE `SPCRP_UPPERFILTERS = (&H00000011) ' // UpperFilters (R/W)
%EQUATE `SPCRP_LOWERFILTERS = (&H00000012) ' // LowerFilters (R/W)
%EQUATE `SPCRP_SECURITY = (&H00000017) ' // Security (R/W, binary form)
%EQUATE `SPCRP_SECURITY_SDS = (&H00000018) ' // Security (W, SDS form)
%EQUATE `SPCRP_DEVTYPE = (&H00000019) ' // Device Type (R/W)
%EQUATE `SPCRP_EXCLUSIVE = (&H0000001A) ' // Device is exclusive-access (R/W)
%EQUATE `SPCRP_CHARACTERISTICS = (&H0000001B) ' // Device Characteristics (R/W)
%EQUATE `SPCRP_MAXIMUM_PROPERTY = (&H0000001C) ' // Upper bound on ordinals
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceRegistryPropertyA LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceRegistryPropertyA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL PROPERTY AS QUAD, PropertyRegDataType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceRegistryPropertyA LIB "setupapi.dll" ALIAS "SetupDiGetDeviceRegistryPropertyA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Property AS QUAD , BYREF PropertyRegDataType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceRegistryPropertyW LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceRegistryPropertyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL PROPERTY AS QUAD, PropertyRegDataType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceRegistryPropertyW LIB "setupapi.dll" ALIAS "SetupDiGetDeviceRegistryPropertyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Property AS QUAD , BYREF PropertyRegDataType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetDeviceRegistryProperty = SetupDiGetDeviceRegistryPropertyW
#ELSE
 MACRO SetupDiGetDeviceRegistryProperty = SetupDiGetDeviceRegistryPropertyA
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassRegistryPropertyA LIB "SetupApi.dll" ALIAS "SetupDiGetClassRegistryPropertyA" ( ClassGuid AS GUID, BYVAL PROPERTY AS QUAD, PropertyRegDataType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD, MachineName AS ASCIIZ, BYVAL Reserved AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassRegistryPropertyA LIB "setupapi.dll" ALIAS "SetupDiGetClassRegistryPropertyA" ( BYREF ClassGuid AS GUID , BYVAL Property AS QUAD , BYREF PropertyRegDataType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassRegistryPropertyW LIB "SetupApi.dll" ALIAS "SetupDiGetClassRegistryPropertyW" ( ClassGuid AS GUID, BYVAL PROPERTY AS QUAD, PropertyRegDataType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD, MachineName AS WSTRINGZ, BYVAL Reserved AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassRegistryPropertyW LIB "setupapi.dll" ALIAS "SetupDiGetClassRegistryPropertyW" ( BYREF ClassGuid AS GUID , BYVAL Property AS QUAD , BYREF PropertyRegDataType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF MachineName AS WSTRINGZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetClassRegistryProperty = SetupDiGetClassRegistryPropertyW
#ELSE
 MACRO SetupDiGetClassRegistryProperty = SetupDiGetClassRegistryPropertyA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetDeviceRegistryPropertyA LIB "SetupApi.dll" ALIAS "SetupDiSetDeviceRegistryPropertyA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL PROPERTY AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetDeviceRegistryPropertyA LIB "setupapi.dll" ALIAS "SetupDiSetDeviceRegistryPropertyA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Property AS QUAD , BYVAL PropertyBuffer AS BYTE PTR , BYVAL PropertyBufferSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetDeviceRegistryPropertyW LIB "SetupApi.dll" ALIAS "SetupDiSetDeviceRegistryPropertyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL PROPERTY AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetDeviceRegistryPropertyW LIB "setupapi.dll" ALIAS "SetupDiSetDeviceRegistryPropertyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL Property AS QUAD , BYVAL PropertyBuffer AS BYTE PTR , BYVAL PropertyBufferSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiSetDeviceRegistryProperty = SetupDiSetDeviceRegistryPropertyW
#ELSE
 MACRO SetupDiSetDeviceRegistryProperty = SetupDiSetDeviceRegistryPropertyA
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
DECLARE FUNCTION SetupDiSetClassRegistryPropertyA LIB "setupapi.dll" ALIAS "SetupDiSetClassRegistryPropertyA" ( BYREF ClassGuid AS GUID , BYVAL Property AS QUAD , BYVAL PropertyBuffer AS BYTE PTR , BYVAL PropertyBufferSize AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiSetClassRegistryPropertyW LIB "setupapi.dll" ALIAS "SetupDiSetClassRegistryPropertyW" ( BYREF ClassGuid AS GUID
 , BYVAL Property AS DWORD
 , BYVAL PropertyBuffer AS BYTE PTR
 , BYVAL PropertyBufferSize AS DWORD
 , OPTIONAL BYREF MachineName AS WSTRINGZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiSetClassRegistryProperty = SetupDiSetClassRegistryPropertyW
#ELSE
 MACRO SetupDiSetClassRegistryProperty = SetupDiSetClassRegistryPropertyA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInstallParamsA LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DeviceInstallParams AS SP_DEVINSTALL_PARAMS_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInstallParamsA LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DeviceInstallParams AS SP_DEVINSTALL_PARAMS_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDeviceInstallParamsW LIB "SetupApi.dll" ALIAS "SetupDiGetDeviceInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DeviceInstallParams AS SP_DEVINSTALL_PARAMS_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDeviceInstallParamsW LIB "setupapi.dll" ALIAS "SetupDiGetDeviceInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DeviceInstallParams AS SP_DEVINSTALL_PARAMS_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetDeviceInstallParams = SetupDiGetDeviceInstallParamsW
#ELSE
 MACRO SetupDiGetDeviceInstallParams = SetupDiGetDeviceInstallParamsA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassInstallParamsA LIB "SetupApi.dll" ALIAS "SetupDiGetClassInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL ClassInstallParams AS SP_CLASSINSTALL_HEADER PTR, BYVAL ClassInstallParamsSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassInstallParamsA LIB "setupapi.dll" ALIAS "SetupDiGetClassInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF ClassInstallParams AS SP_CLASSINSTALL_HEADER , BYVAL ClassInstallParamsSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassInstallParamsW LIB "SetupApi.dll" ALIAS "SetupDiGetClassInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL ClassInstallParams AS SP_CLASSINSTALL_HEADER PTR, BYVAL ClassInstallParamsSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassInstallParamsW LIB "setupapi.dll" ALIAS "SetupDiGetClassInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF ClassInstallParams AS SP_CLASSINSTALL_HEADER , BYVAL ClassInstallParamsSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetClassInstallParams = SetupDiGetClassInstallParamsW
#ELSE
 MACRO SetupDiGetClassInstallParams = SetupDiGetClassInstallParamsA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetDeviceInstallParamsA LIB "SetupApi.dll" ALIAS "SetupDiSetDeviceInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DeviceInstallParams AS SP_DEVINSTALL_PARAMS_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetDeviceInstallParamsA LIB "setupapi.dll" ALIAS "SetupDiSetDeviceInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DeviceInstallParams AS SP_DEVINSTALL_PARAMS_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetDeviceInstallParamsW LIB "SetupApi.dll" ALIAS "SetupDiSetDeviceInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DeviceInstallParams AS SP_DEVINSTALL_PARAMS_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetDeviceInstallParamsW LIB "setupapi.dll" ALIAS "SetupDiSetDeviceInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DeviceInstallParams AS SP_DEVINSTALL_PARAMS_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiSetDeviceInstallParams = SetupDiSetDeviceInstallParamsW
#ELSE
 MACRO SetupDiSetDeviceInstallParams = SetupDiSetDeviceInstallParamsA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetClassInstallParamsA LIB "SetupApi.dll" ALIAS "SetupDiSetClassInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL ClassInstallParams AS SP_CLASSINSTALL_HEADER PTR, BYVAL ClassInstallParamsSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetClassInstallParamsA LIB "setupapi.dll" ALIAS "SetupDiSetClassInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF ClassInstallParams AS SP_CLASSINSTALL_HEADER , BYVAL ClassInstallParamsSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetClassInstallParamsW LIB "SetupApi.dll" ALIAS "SetupDiSetClassInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL ClassInstallParams AS SP_CLASSINSTALL_HEADER PTR, BYVAL ClassInstallParamsSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetClassInstallParamsW LIB "setupapi.dll" ALIAS "SetupDiSetClassInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF ClassInstallParams AS SP_CLASSINSTALL_HEADER , BYVAL ClassInstallParamsSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiSetClassInstallParams = SetupDiSetClassInstallParamsW
#ELSE
 MACRO SetupDiSetClassInstallParams = SetupDiSetClassInstallParamsA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDriverInstallParamsA LIB "SetupApi.dll" ALIAS "SetupDiGetDriverInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_A PTR, BYVAL DriverInstallParams AS SP_DRVINSTALL_PARAMS PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDriverInstallParamsA LIB "setupapi.dll" ALIAS "SetupDiGetDriverInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DriverInfoData AS SP_DRVINFO_DATA_A , BYREF DriverInstallParams AS SP_DRVINSTALL_PARAMS ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetDriverInstallParamsW LIB "SetupApi.dll" ALIAS "SetupDiGetDriverInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_W PTR, BYVAL DriverInstallParams AS SP_DRVINSTALL_PARAMS PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetDriverInstallParamsW LIB "setupapi.dll" ALIAS "SetupDiGetDriverInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DriverInfoData AS SP_DRVINFO_DATA_W , BYREF DriverInstallParams AS SP_DRVINSTALL_PARAMS ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetDriverInstallParams = SetupDiGetDriverInstallParamsW
#ELSE
 MACRO SetupDiGetDriverInstallParams = SetupDiGetDriverInstallParamsA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetDriverInstallParamsA LIB "SetupApi.dll" ALIAS "SetupDiSetDriverInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_A PTR, BYVAL DriverInstallParams AS SP_DRVINSTALL_PARAMS PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetDriverInstallParamsA LIB "setupapi.dll" ALIAS "SetupDiSetDriverInstallParamsA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DriverInfoData AS SP_DRVINFO_DATA_A , BYREF DriverInstallParams AS SP_DRVINSTALL_PARAMS ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetDriverInstallParamsW LIB "SetupApi.dll" ALIAS "SetupDiSetDriverInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL DriverInfoData AS SP_DRVINFO_DATA_W PTR, BYVAL DriverInstallParams AS SP_DRVINSTALL_PARAMS PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetDriverInstallParamsW LIB "setupapi.dll" ALIAS "SetupDiSetDriverInstallParamsW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF DriverInfoData AS SP_DRVINFO_DATA_W , BYREF DriverInstallParams AS SP_DRVINSTALL_PARAMS ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiSetDriverInstallParams = SetupDiSetDriverInstallParamsW
#ELSE
 MACRO SetupDiSetDriverInstallParams = SetupDiSetDriverInstallParamsA
#ENDIF
DECLARE FUNCTION SetupDiLoadClassIcon LIB "setupapi.dll" ALIAS "SetupDiLoadClassIcon" ( BYREF ClassGuid AS GUID , OPTIONAL BYREF LargeIcon AS QUAD , OPTIONAL BYREF MiniIconIndex AS LONG ) AS LONG
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
DECLARE FUNCTION SetupDiLoadDeviceIcon LIB "setupapi.dll" ALIAS "SetupDiLoadDeviceIcon" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYVAL cxIcon AS QUAD , BYVAL cyIcon AS QUAD , BYVAL Flags AS QUAD , BYREF hIcon AS QUAD ) AS LONG
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
' //
' // Flags controlling the drawing of mini-icons
' //
%EQUATE `DMI_MASK = &H00000001
%EQUATE `DMI_BKCOLOR = &H00000002
%EQUATE `DMI_USERECT = &H00000004
DECLARE FUNCTION SetupDiDrawMiniIcon LIB "setupapi.dll" ALIAS "SetupDiDrawMiniIcon" ( BYVAL hdc AS QUAD , BYVAL rc AS RECT , BYVAL MiniIconIndex AS LONG , BYVAL Flags AS QUAD ) AS LONG ' INT
DECLARE FUNCTION SetupDiGetClassBitmapIndex LIB "setupapi.dll" ALIAS "SetupDiGetClassBitmapIndex" ( BYREF ClassGuid AS GUID , BYREF MiniIconIndex AS LONG ) AS LONG
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassImageList LIB "SetupApi.dll" ALIAS "SetupDiGetClassImageList" ( BYVAL ClassImageListData AS SP_CLASSIMAGELIST_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassImageList LIB "setupapi.dll" ALIAS "SetupDiGetClassImageList" ( BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassImageListExA LIB "SetupApi.dll" ALIAS "SetupDiGetClassImageListExA" ( BYVAL ClassImageListData AS SP_CLASSIMAGELIST_DATA PTR, MachineName AS ASCIIZ, BYVAL Reserved AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassImageListExA LIB "setupapi.dll" ALIAS "SetupDiGetClassImageListExA" ( BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassImageListExW LIB "SetupApi.dll" ALIAS "SetupDiGetClassImageListExW" ( BYVAL ClassImageListData AS SP_CLASSIMAGELIST_DATA PTR, MachineName AS WSTRINGZ, BYVAL Reserved AS QUAD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassImageListExW LIB "setupapi.dll" ALIAS "SetupDiGetClassImageListExW" ( BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA , OPTIONAL BYREF MachineName AS WSTRINGZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetClassImageListEx = SetupDiGetClassImageListExW
#ELSE
 MACRO SetupDiGetClassImageListEx = SetupDiGetClassImageListExA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassImageIndex LIB "SetupApi.dll" ALIAS "SetupDiGetClassImageIndex" ( BYVAL ClassImageListData AS SP_CLASSIMAGELIST_DATA PTR, ClassGuid AS GUID, ImageIndex AS LONG ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassImageIndex LIB "setupapi.dll" ALIAS "SetupDiGetClassImageIndex" ( BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA , BYREF ClassGuid AS GUID , BYREF ImageIndex AS LONG ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiDestroyClassImageList LIB "SetupApi.dll" ALIAS "SetupDiDestroyClassImageList" ( BYVAL ClassImageListData AS SP_CLASSIMAGELIST_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiDestroyClassImageList LIB "setupapi.dll" ALIAS "SetupDiDestroyClassImageList" ( BYREF ClassImageListData AS SP_CLASSIMAGELIST_DATA ) AS LONG
#ENDIF
' //
' // PropertySheetType values for the SetupDiGetClassDevPropertySheets API
' //
%EQUATE `DIGCDP_FLAG_BASIC = &H00000001
%EQUATE `DIGCDP_FLAG_ADVANCED = &H00000002
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
%EQUATE `DIGCDP_FLAG_REMOTE_BASIC = &H00000003 ' // not presently implemented
%EQUATE `DIGCDP_FLAG_REMOTE_ADVANCED = &H00000004
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassDevPropertySheetsA LIB "SetupApi.dll" ALIAS "SetupDiGetClassDevPropertySheetsA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, PropertySheetHeader AS PROPSHEETHEADERA, BYVAL PropertySheetHeaderPageListSize AS QUAD, RequiredSize AS QUAD, BYVAL PropertySheetType AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassDevPropertySheetsA LIB "setupapi.dll" ALIAS "SetupDiGetClassDevPropertySheetsA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF PropertySheetHeader AS PROPSHEETHEADERA , BYVAL PropertySheetHeaderPageListSize AS QUAD , BYREF RequiredSize AS QUAD , BYVAL PropertySheetType AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetClassDevPropertySheetsW LIB "SetupApi.dll" ALIAS "SetupDiGetClassDevPropertySheetsW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, PropertySheetHeader AS PROPSHEETHEADERW, BYVAL PropertySheetHeaderPageListSize AS QUAD, RequiredSize AS QUAD, BYVAL PropertySheetType AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetClassDevPropertySheetsW LIB "setupapi.dll" ALIAS "SetupDiGetClassDevPropertySheetsW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF PropertySheetHeader AS PROPSHEETHEADERW , BYVAL PropertySheetHeaderPageListSize AS QUAD , BYREF RequiredSize AS QUAD , BYVAL PropertySheetType AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetClassDevPropertySheets = SetupDiGetClassDevPropertySheetsW
#ELSE
 MACRO SetupDiGetClassDevPropertySheets = SetupDiGetClassDevPropertySheetsA
#ENDIF
' //
' // Define ICON IDs publicly exposed from setupapi.
' //
%EQUATE `IDI_RESOURCEFIRST = 159
%EQUATE `IDI_RESOURCE = 159
%EQUATE `IDI_RESOURCELAST = 161
%EQUATE `IDI_RESOURCEOVERLAYFIRST = 161
%EQUATE `IDI_RESOURCEOVERLAYLAST = 161
%EQUATE `IDI_CONFLICT = 161
%EQUATE `IDI_CLASSICON_OVERLAYFIRST = 500
%EQUATE `IDI_CLASSICON_OVERLAYLAST = 502
%EQUATE `IDI_PROBLEM_OVL = 500
%EQUATE `IDI_DISABLED_OVL = 501
%EQUATE `IDI_FORCED_OVL = 502
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiAskForOEMDisk LIB "SetupApi.dll" ALIAS "SetupDiAskForOEMDisk" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiAskForOEMDisk LIB "setupapi.dll" ALIAS "SetupDiAskForOEMDisk" ( BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSelectOEMDrv LIB "SetupApi.dll" ALIAS "SetupDiSelectOEMDrv" ( BYVAL hwndParent AS QUAD,
 BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSelectOEMDrv LIB "setupapi.dll" ALIAS "SetupDiSelectOEMDrv" ( BYVAL hwndParent AS QUAD , BYVAL DeviceInfoSet AS QUAD , OPTIONAL BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
DECLARE FUNCTION SetupDiClassNameFromGuidA LIB "setupapi.dll" ALIAS "SetupDiClassNameFromGuidA" ( BYREF ClassGuid AS GUID , BYREF ClassName AS ASCIIZ , BYVAL ClassNameSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiClassNameFromGuidW LIB "setupapi.dll" ALIAS "SetupDiClassNameFromGuidW" ( BYREF ClassGuid AS GUID
 , BYREF ClassName AS WSTRINGZ
 , BYVAL ClassNameSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiClassNameFromGuid = SetupDiClassNameFromGuidW
#ELSE
 MACRO SetupDiClassNameFromGuid = SetupDiClassNameFromGuidA
#ENDIF
DECLARE FUNCTION SetupDiClassNameFromGuidExA LIB "setupapi.dll" ALIAS "SetupDiClassNameFromGuidExA" ( BYREF ClassGuid AS GUID , BYREF ClassName AS ASCIIZ , BYVAL ClassNameSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiClassNameFromGuidExW LIB "setupapi.dll" ALIAS "SetupDiClassNameFromGuidExW" ( BYREF ClassGuid AS GUID
 , BYREF ClassName AS WSTRINGZ
 , BYVAL ClassNameSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 , OPTIONAL BYREF MachineName AS WSTRINGZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiClassNameFromGuidEx = SetupDiClassNameFromGuidExW
#ELSE
 MACRO SetupDiClassNameFromGuidEx = SetupDiClassNameFromGuidExA
#ENDIF
DECLARE FUNCTION SetupDiClassGuidsFromNameA LIB "setupapi.dll" ALIAS "SetupDiClassGuidsFromNameA" ( BYREF ClassName AS ASCIIZ , BYREF ClassGuidList AS GUID , BYVAL ClassGuidListSize AS QUAD , BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiClassGuidsFromNameW LIB "setupapi.dll" ALIAS "SetupDiClassGuidsFromNameW" ( BYREF ClassName AS WSTRINGZ
 , BYREF ClassGuidList AS GUID
 , BYVAL ClassGuidListSize AS DWORD
 , BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiClassGuidsFromName = SetupDiClassGuidsFromNameW
#ELSE
 MACRO SetupDiClassGuidsFromName = SetupDiClassGuidsFromNameA
#ENDIF
DECLARE FUNCTION SetupDiClassGuidsFromNameExA LIB "setupapi.dll" ALIAS "SetupDiClassGuidsFromNameExA" ( BYREF ClassName AS ASCIIZ , BYREF ClassGuidList AS GUID , BYVAL ClassGuidListSize AS QUAD , BYREF RequiredSize AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiClassGuidsFromNameExW LIB "setupapi.dll" ALIAS "SetupDiClassGuidsFromNameExW" ( BYREF ClassName AS WSTRINGZ
 , BYREF ClassGuidList AS GUID
 , BYVAL ClassGuidListSize AS DWORD
 , BYREF RequiredSize AS DWORD
 , OPTIONAL BYREF MachineName AS WSTRINGZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiClassGuidsFromNameEx = SetupDiClassGuidsFromNameExW
#ELSE
 MACRO SetupDiClassGuidsFromNameEx = SetupDiClassGuidsFromNameExA
#ENDIF
DECLARE FUNCTION SetupDiGetHwProfileFriendlyNameA LIB "setupapi.dll" ALIAS "SetupDiGetHwProfileFriendlyNameA" ( BYVAL HwProfile AS QUAD , BYREF FriendlyName AS ASCIIZ , BYVAL FriendlyNameSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiGetHwProfileFriendlyNameW LIB "setupapi.dll" ALIAS "SetupDiGetHwProfileFriendlyNameW" ( BYVAL HwProfile AS QUAD
 , BYREF FriendlyName AS WSTRINGZ
 , BYVAL FriendlyNameSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiGetHwProfileFriendlyName = SetupDiGetHwProfileFriendlyNameW
#ELSE
 MACRO SetupDiGetHwProfileFriendlyName = SetupDiGetHwProfileFriendlyNameA
#ENDIF
DECLARE FUNCTION SetupDiGetHwProfileFriendlyNameExA LIB "setupapi.dll" ALIAS "SetupDiGetHwProfileFriendlyNameExA" ( BYVAL HwProfile AS QUAD , BYREF FriendlyName AS ASCIIZ , BYVAL FriendlyNameSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF MachineName AS ASCIIZ , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiGetHwProfileFriendlyNameExW LIB "setupapi.dll" ALIAS "SetupDiGetHwProfileFriendlyNameExW" ( BYVAL HwProfile AS QUAD
 , BYREF FriendlyName AS WSTRINGZ
 , BYVAL FriendlyNameSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 , OPTIONAL BYREF MachineName AS WSTRINGZ
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiGetHwProfileFriendlyNameEx = SetupDiGetHwProfileFriendlyNameExW
#ELSE
 MACRO SetupDiGetHwProfileFriendlyNameEx = SetupDiGetHwProfileFriendlyNameExA
#ENDIF
' //
' // PageType values for SetupDiGetWizardPage API
' //
%EQUATE `SPWPT_SELECTDEVICE = &H00000001
' //
' // Flags for SetupDiGetWizardPage API
' //
%EQUATE `SPWP_USE_DEVINFO_DATA = &H00000001
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetWizardPage LIB "SetupApi.dll" ALIAS "SetupDiGetWizardPage" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, BYVAL InstallWizardData AS SP_INSTALLWIZARD_DATA PTR, BYVAL PageType AS QUAD, BYVAL Flags AS QUAD ) AS QUAD ' HPROPSHEETPAGE
#ELSE
DECLARE FUNCTION SetupDiGetWizardPage LIB "setupapi.dll" ALIAS "SetupDiGetWizardPage" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF InstallWizardData AS SP_INSTALLWIZARD_DATA , BYVAL PageType AS QUAD , BYVAL Flags AS QUAD ) AS QUAD ' HPROPSHEETPAGE
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetSelectedDevice LIB "SetupApi.dll" ALIAS "SetupDiGetSelectedDevice" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetSelectedDevice LIB "setupapi.dll" ALIAS "SetupDiGetSelectedDevice" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiSetSelectedDevice LIB "SetupApi.dll" ALIAS "SetupDiSetSelectedDevice" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiSetSelectedDevice LIB "setupapi.dll" ALIAS "SetupDiSetSelectedDevice" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA ) AS LONG
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WS03
#IF %SETUPAPI_VER >= %WIN32_WINNT_WS03
DECLARE FUNCTION SetupDiGetActualModelsSectionA LIB "setupapi.dll" ALIAS "SetupDiGetActualModelsSectionA" ( BYREF Context AS INFCONTEXT , BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO , BYREF InfSectionWithExt AS ASCIIZ , BYVAL InfSectionWithExtSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
DECLARE FUNCTION SetupDiGetActualModelsSectionW LIB "setupapi.dll" ALIAS "SetupDiGetActualModelsSectionW" ( BYREF Context AS INFCONTEXT
 , BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO
 , BYREF InfSectionWithExt AS WSTRINGZ
 , BYVAL InfSectionWithExtSize AS DWORD
 , OPTIONAL BYREF RequiredSize AS DWORD
 , OPTIONAL BYVAL Reserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupDiGetActualModelsSection = SetupDiGetActualModelsSectionW
#ELSE
 MACRO SetupDiGetActualModelsSection = SetupDiGetActualModelsSectionA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WS03
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetActualSectionToInstallA LIB "SetupApi.dll" ALIAS "SetupDiGetActualSectionToInstallA" ( BYVAL InfHandle AS QUAD, InfSectionName AS ASCIIZ, InfSectionWithExt AS ASCIIZ, BYVAL InfSectionWithExtSize AS QUAD, RequiredSize AS QUAD, BYVAL Extension AS QUAD ) AS LONG ' PSTR *
#ELSE
DECLARE FUNCTION SetupDiGetActualSectionToInstallA LIB "setupapi.dll" ALIAS "SetupDiGetActualSectionToInstallA" ( BYVAL InfHandle AS QUAD , BYREF InfSectionName AS ASCIIZ , BYREF InfSectionWithExt AS ASCIIZ , BYVAL InfSectionWithExtSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF Extension AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetActualSectionToInstallW LIB "SetupApi.dll" ALIAS "SetupDiGetActualSectionToInstallW" ( BYVAL InfHandle AS QUAD, InfSectionName AS WSTRINGZ, InfSectionWithExt AS WSTRINGZ, BYVAL InfSectionWithExtSize AS QUAD, RequiredSize AS QUAD, BYVAL Extension AS QUAD ) AS LONG ' PWSTR *
#ELSE
DECLARE FUNCTION SetupDiGetActualSectionToInstallW LIB "setupapi.dll" ALIAS "SetupDiGetActualSectionToInstallW" ( BYVAL InfHandle AS QUAD , BYREF InfSectionName AS WSTRINGZ , BYREF InfSectionWithExt AS WSTRINGZ , BYVAL InfSectionWithExtSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF Extension AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetActualSectionToInstall = SetupDiGetActualSectionToInstallW
#ELSE
 MACRO SetupDiGetActualSectionToInstall = SetupDiGetActualSectionToInstallA
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetActualSectionToInstallExA LIB "SetupApi.dll" ALIAS "SetupDiGetActualSectionToInstallExA" ( BYVAL InfHandle AS QUAD, InfSectionName AS ASCIIZ, BYVAL AlternatePlatformInfo AS SP_ALTPLATFORM_INFO PTR, InfSectionWithExt AS ASCIIZ, BYVAL InfSectionWithExtSize AS QUAD, RequiredSize AS QUAD, BYVAL Extension AS QUAD, ' PSTR *
 BYVAL Reserved AS DWORD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetActualSectionToInstallExA LIB "setupapi.dll" ALIAS "SetupDiGetActualSectionToInstallExA" ( BYVAL InfHandle AS QUAD , BYREF InfSectionName AS ASCIIZ , BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO , BYREF InfSectionWithExt AS ASCIIZ , BYVAL InfSectionWithExtSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF Extension AS QUAD , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetActualSectionToInstallExW LIB "SetupApi.dll" ALIAS "SetupDiGetActualSectionToInstallExW" ( BYVAL InfHandle AS QUAD, InfSectionName AS WSTRINGZ, BYVAL AlternatePlatformInfo AS SP_ALTPLATFORM_INFO PTR, InfSectionWithExt AS WSTRINGZ, BYVAL InfSectionWithExtSize AS QUAD, RequiredSize AS QUAD, BYVAL Extension AS QUAD, ' PWSTR *
 BYVAL Reserved AS DWORD
 ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetActualSectionToInstallExW LIB "setupapi.dll" ALIAS "SetupDiGetActualSectionToInstallExW" ( BYVAL InfHandle AS QUAD , BYREF InfSectionName AS ASCIIZ , BYREF AlternatePlatformInfo AS SP_ALTPLATFORM_INFO , BYREF InfSectionWithExt AS WSTRINGZ , BYVAL InfSectionWithExtSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD , OPTIONAL BYREF Extension AS QUAD , OPTIONAL BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetActualSectionToInstallEx = SetupDiGetActualSectionToInstallExW
#ELSE
 MACRO SetupDiGetActualSectionToInstallEx = SetupDiGetActualSectionToInstallExA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // SetupEnumInfSections is for low-level parsing of an INF
' //
DECLARE FUNCTION SetupEnumInfSectionsA LIB "setupapi.dll" ALIAS "SetupEnumInfSectionsA" ( BYVAL InfHandle AS QUAD , BYVAL Index AS QUAD , BYREF Buffer AS ASCIIZ , BYVAL Size AS QUAD , OPTIONAL BYREF SizeNeeded AS QUAD ) AS LONG
DECLARE FUNCTION SetupEnumInfSectionsW LIB "setupapi.dll" ALIAS "SetupEnumInfSectionsW" ( BYVAL InfHandle AS QUAD
 , BYVAL Index AS DWORD
 , BYREF Buffer AS WSTRINGZ
 , BYVAL Size AS DWORD
 , OPTIONAL BYREF SizeNeeded AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupEnumInfSections = SetupEnumInfSectionsW
#ELSE
 MACRO SetupEnumInfSections = SetupEnumInfSectionsA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' // Size = 784 bytes
TYPE SP_INF_SIGNER_INFO_V1_A BYTE
 cbSize AS DWORD
 CatalogFile AS ASCIIZ * %MAX_PATH ' CHAR
 DigitalSigner AS ASCIIZ * %MAX_PATH ' CHAR
 DigitalSignerVersion AS ASCIIZ * %MAX_PATH ' CHAR
END TYPE
' // Size = 1564 bytes
TYPE SP_INF_SIGNER_INFO_V1_W BYTE
 cbSize AS DWORD
 CatalogFile AS WSTRINGZ * %MAX_PATH ' WCHAR
 DigitalSigner AS WSTRINGZ * %MAX_PATH ' WCHAR
 DigitalSignerVersion AS WSTRINGZ * %MAX_PATH ' WCHAR
END TYPE
#IF %DEF(%UNICODE)
 MACRO SP_INF_SIGNER_INFO_V1 = SP_INF_SIGNER_INFO_V1_W
#ELSE
 MACRO SP_INF_SIGNER_INFO_V1 = SP_INF_SIGNER_INFO_V1_A
#ENDIF
'#if _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
#IF %SETUPAPI_VER >= %WIN32_WINNT_LONGHORN
' // Size = 788 bytes
TYPE SP_INF_SIGNER_INFO_V2_A BYTE
 cbSize AS DWORD
 CatalogFile AS ASCIIZ * %MAX_PATH ' CHAR
 DigitalSigner AS ASCIIZ * %MAX_PATH ' CHAR
 DigitalSignerVersion AS ASCIIZ * %MAX_PATH ' CHAR
 SignerScore AS DWORD
END TYPE
' // Size = 1568 bytes
TYPE SP_INF_SIGNER_INFO_V2_W BYTE
 cbSize AS DWORD
 CatalogFile AS WSTRINGZ * %MAX_PATH ' WCHAR
 DigitalSigner AS WSTRINGZ * %MAX_PATH ' WCHAR
 DigitalSignerVersion AS WSTRINGZ * %MAX_PATH ' WCHAR
 SignerScore AS DWORD
END TYPE
#IF %DEF(%UNICODE)
 MACRO SP_INF_SIGNER_INFO_V2 = SP_INF_SIGNER_INFO_V2_W
#ELSE
 MACRO SP_INF_SIGNER_INFO_V2 = SP_INF_SIGNER_INFO_V2_A
#ENDIF
'//
'// Driver signer scores (high order bit of the signing byte means unsigned)
'//
%EQUATE `SIGNERSCORE_UNKNOWN = &HFF000000
%EQUATE `SIGNERSCORE_W9X_SUSPECT = &HC0000000
%EQUATE `SIGNERSCORE_UNSIGNED = &H80000000
%EQUATE `SIGNERSCORE_AUTHENTICODE = &H0F000000
%EQUATE `SIGNERSCORE_WHQL = &H0D000005 ' // base WHQL.
%EQUATE `SIGNERSCORE_UNCLASSIFIED = &H0D000004 ' // UNCLASSIFIED == INBOX == STANDARD == PREMIUM when the SIGNERSCORE_MASK
%EQUATE `SIGNERSCORE_INBOX = &H0D000003 ' // filter is applied.
%EQUATE `SIGNERSCORE_LOGO_STANDARD = &H0D000002
%EQUATE `SIGNERSCORE_LOGO_PREMIUM = &H0D000001
%EQUATE `SIGNERSCORE_MASK = &HFF000000 ' // Mask out all but the upper BYTE which contains the ranking signer information
%EQUATE `SIGNERSCORE_SIGNED_MASK = &HF0000000 ' // Mask out only the upper nibble, which tells us if the package is signed or not.
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_LONGHORN
'#if USE_SP_INF_SIGNER_INFO_V1 || (_SETUPAPI_VER < _WIN32_WINNT_LONGHORN) // use version 1 signer info structure
#IF %DEF(%USE_SP_INF_SIGNER_INFO_V1) OR (%SETUPAPI_VER < %WIN32_WINNT_LONGHORN) ' // use version 1 signer info structure
MACRO SP_INF_SIGNER_INFO_A = SP_INF_SIGNER_INFO_V1_A
MACRO SP_INF_SIGNER_INFO_W = SP_INF_SIGNER_INFO_V1_W
#IF %DEF(%UNICODE)
 MACRO SP_INF_SIGNER_INFO = SP_INF_SIGNER_INFO_V1_W
#ELSE
 MACRO SP_INF_SIGNER_INFO = SP_INF_SIGNER_INFO_V1_A
#ENDIF
#ELSE ' // use version 2 signer info structure
MACRO SP_INF_SIGNER_INFO_A = SP_INF_SIGNER_INFO_V2_A
MACRO SP_INF_SIGNER_INFO_W = SP_INF_SIGNER_INFO_V2_W
#IF %DEF(%UNICODE)
 MACRO SP_INF_SIGNER_INFO = SP_INF_SIGNER_INFO_V2_W
#ELSE
 MACRO SP_INF_SIGNER_INFO = SP_INF_SIGNER_INFO_V2_A
#ENDIF
#ENDIF ' // use current version of signer info structure
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupVerifyInfFileA LIB "SetupApi.dll" ALIAS "SetupVerifyInfFileA" ( InfName AS ASCIIZ, BYVAL AltPlatformInfo AS SP_ALTPLATFORM_INFO PTR, BYVAL InfSignerInfo AS SP_INF_SIGNER_INFO_A PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupVerifyInfFileA LIB "setupapi.dll" ALIAS "SetupVerifyInfFileA" ( BYREF InfName AS ASCIIZ , BYREF AltPlatformInfo AS SP_ALTPLATFORM_INFO , BYREF InfSignerInfo AS SP_INF_SIGNER_INFO_A ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupVerifyInfFileW LIB "SetupApi.dll" ALIAS "SetupVerifyInfFileW" ( InfName AS WSTRINGZ, BYVAL AltPlatformInfo AS SP_ALTPLATFORM_INFO PTR, BYVAL InfSignerInfo AS SP_INF_SIGNER_INFO_W PTR ) AS LONG
#ELSE
DECLARE FUNCTION SetupVerifyInfFileW LIB "setupapi.dll" ALIAS "SetupVerifyInfFileW" ( BYREF InfName AS WSTRINGZ , BYREF AltPlatformInfo AS SP_ALTPLATFORM_INFO , BYREF InfSignerInfo AS SP_INF_SIGNER_INFO_W ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupVerifyInfFile = SetupVerifyInfFileW
#ELSE
 MACRO SetupVerifyInfFile = SetupVerifyInfFileA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_WINXP
#IF %SETUPAPI_VER >= %WIN32_WINNT_WINXP
' //
' // Flags for use by SetupDiGetCustomDeviceProperty
' //
%EQUATE `DICUSTOMDEVPROP_MERGE_MULTISZ = &H00000001
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetCustomDevicePropertyA LIB "SetupApi.dll" ALIAS "SetupDiGetCustomDevicePropertyA" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, CustomPropertyName AS ASCIIZ, BYVAL Flags AS QUAD, PropertyRegDataType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetCustomDevicePropertyA LIB "setupapi.dll" ALIAS "SetupDiGetCustomDevicePropertyA" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF CustomPropertyName AS ASCIIZ , BYVAL Flags AS QUAD , BYREF PropertyRegDataType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION SetupDiGetCustomDevicePropertyW LIB "SetupApi.dll" ALIAS "SetupDiGetCustomDevicePropertyW" ( BYVAL DeviceInfoSet AS QUAD, BYVAL DeviceInfoData AS SP_DEVINFO_DATA PTR, CustomPropertyName AS WSTRINGZ, BYVAL Flags AS QUAD, PropertyRegDataType AS QUAD, BYVAL PropertyBuffer AS BYTE PTR, BYVAL PropertyBufferSize AS QUAD, RequiredSize AS QUAD ) AS LONG
#ELSE
DECLARE FUNCTION SetupDiGetCustomDevicePropertyW LIB "setupapi.dll" ALIAS "SetupDiGetCustomDevicePropertyW" ( BYVAL DeviceInfoSet AS QUAD , BYREF DeviceInfoData AS SP_DEVINFO_DATA , BYREF CustomPropertyName AS ASCIIZ , BYVAL Flags AS QUAD , BYREF PropertyRegDataType AS QUAD , BYREF PropertyBuffer AS ANY , BYVAL PropertyBufferSize AS QUAD , OPTIONAL BYREF RequiredSize AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO SetupDiGetCustomDeviceProperty = SetupDiGetCustomDevicePropertyW
#ELSE
 MACRO SetupDiGetCustomDeviceProperty = SetupDiGetCustomDevicePropertyA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WINXP
'#if _SETUPAPI_VER >= _WIN32_WINNT_WS03
#IF %SETUPAPI_VER >= %WIN32_WINNT_WS03
' //
' // 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
' //
%EQUATE `SCWMI_CLOBBER_SECURITY = &H00000001
DECLARE FUNCTION SetupConfigureWmiFromInfSectionA LIB "setupapi.dll" ALIAS "SetupConfigureWmiFromInfSectionA" ( BYVAL InfHandle AS QUAD , BYREF SectionName AS ASCIIZ , BYVAL Flags AS QUAD ) AS LONG
DECLARE FUNCTION SetupConfigureWmiFromInfSectionW LIB "setupapi.dll" ALIAS "SetupConfigureWmiFromInfSectionW" ( BYVAL InfHandle AS QUAD
 , BYREF SectionName AS WSTRINGZ
 , BYVAL Flags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetupConfigureWmiFromInfSection = SetupConfigureWmiFromInfSectionW
#ELSE
 MACRO SetupConfigureWmiFromInfSection = SetupConfigureWmiFromInfSectionA
#ENDIF
#ENDIF
'#endif // _SETUPAPI_VER >= _WIN32_WINNT_WS03
'#include <poppack.h>
#ENDIF
