' ########################################################################################
' Microsoft Windows
' File: cfgmgr32.inc
' Contents: User APIs for the Configuration Manager
' 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_cfgmgr32_PBI)
#DEFINE PBX_cfgmgr32_PBI
%EQUATE `CFGMGR32_INC = 1
#INCLUDE ONCE "Legacy/System/cfg.inc"
#IF NOT %DEF(%GUID_DEFINED)
#include ONCE "Legacy/UI/Guiddef.inc"
#ENDIF
'typedef CONST VOID *PCVOID;
'//--------------------------------------------------------------
'// General size definitions
'//--------------------------------------------------------------
%EQUATE `MAX_DEVICE_ID_LEN = 200
%EQUATE `MAX_DEVNODE_ID_LEN = %MAX_DEVICE_ID_LEN
%EQUATE `MAX_GUID_STRING_LEN = 39 ' // 38 chars + terminator null
%EQUATE `MAX_CLASS_NAME_LEN = 32
%EQUATE `MAX_PROFILE_LEN = 80
%EQUATE `MAX_CONFIG_VALUE = 9999
%EQUATE `MAX_INSTANCE_VALUE = 9999
%EQUATE `MAX_MEM_REGISTERS = 9 ' // Win95 compatibility--not applicable to 32-bit ConfigMgr
%EQUATE `MAX_IO_PORTS = 20 ' // Win95 compatibility--not applicable to 32-bit ConfigMgr
%EQUATE `MAX_IRQS = 7 ' // Win95 compatibility--not applicable to 32-bit ConfigMgr
%EQUATE `MAX_DMA_CHANNELS = 7 ' // Win95 compatibility--not applicable to 32-bit ConfigMgr
'DWORD_MAX 0xffffffffUL
'DWORDLONG_MAX 0xffffffffffffffffui64
%EQUATE `CONFIGMG_VERSION = &H0400
'//--------------------------------------------------------------
'// Data types
'//--------------------------------------------------------------
'#ifdef NT_INCLUDED
'typedef unsigned __int64 DWORDLONG;
'typedef DWORDLONG *PDWORDLONG;
'#endif /* NT_INCLUDED */
'//
'// Standardized Return Value data type
'//
'typedef DWORD RETURN_TYPE;
'typedef RETURN_TYPE CONFIGRET;
'//
'// Device Instance Handle data type
'//
'typedef DWORD DEVNODE, DEVINST;
'typedef DEVNODE *PDEVNODE, *PDEVINST;
'//
'// Device Instance Identifier data type
'// The device instance ID specifies the registry path, relative to the
'// Enum key , for a device instance. For example: \Root\*PNP0500\0000.
'//
'typedef __nullterminated CHAR *DEVNODEID_A, *DEVINSTID_A; // Device ID ANSI name.
'typedef __nullterminated WCHAR *DEVNODEID_W, *DEVINSTID_W; // Device ID Unicode name.
'#ifdef UNICODE
'typedef DEVNODEID_W DEVNODEID;
'typedef DEVINSTID_W DEVINSTID;
'#else
'typedef DEVNODEID_A DEVNODEID;
'typedef DEVINSTID_A DEVINSTID;
'#endif
'//
'// Logical Configuration Handle data type
'//
'typedef DWORD_PTR LOG_CONF;
'typedef LOG_CONF *PLOG_CONF;
'//
'// Resource Descriptor Handle data type
'//
'typedef DWORD_PTR RES_DES;
'typedef RES_DES *PRES_DES;
'//
'// Resource ID data type (may take any of the ResType_* values)
'//
'typedef ULONG RESOURCEID;
'typedef RESOURCEID *PRESOURCEID;
'//
'// Priority data type (may take any of the LCPRI_* values)
'//
'typedef ULONG PRIORITY;
'typedef PRIORITY *PPRIORITY;
'//
'// Range List Handle data type
'//
'typedef DWORD_PTR RANGE_LIST;
'typedef RANGE_LIST *PRANGE_LIST;
'//
'// Range Element Handle data type
'//
'typedef DWORD_PTR RANGE_ELEMENT;
'typedef RANGE_ELEMENT *PRANGE_ELEMENT;
'//
'// Machine Handle data type
'//
'typedef HANDLE HMACHINE;
'typedef HMACHINE *PHMACHINE;
'//
'// Conflict List data types
'//
'typedef ULONG_PTR CONFLICT_LIST;
'typedef CONFLICT_LIST *PCONFLICT_LIST;
' // Size = 280 bytes
TYPE CONFLICT_DETAILS_A DWORD
 CD_ulSize AS DWORD ' ULONG // size of structure, ie: sizeof(CONFLICT_DETAILS)
 CD_ulMask AS DWORD ' ULONG // indicates what information is required/valid
 CD_dnDevInst AS DWORD ' DEVINST // filled with DevInst of conflicting device if CM_CDMASK_DEVINST set
 CD_rdResDes AS DWORD ' RES_DES // filled with a ResDes of conflict if CM_CDMASK_RESDES set
 CD_ulFlags AS DWORD ' ULONG // various flags regarding conflict
 CD_szDescription AS ASCIIZ * %MAX_PATH ' CHAR // description of conflicting device
END TYPE
' // Size = 540 bytes
TYPE CONFLICT_DETAILS_W DWORD
 CD_ulSize AS DWORD ' ULONG // size of structure, ie: sizeof(CONFLICT_DETAILS)
 CD_ulMask AS DWORD ' ULONG // indicates what information is required/valid
 CD_dnDevInst AS DWORD ' DEVINST // filled with DevInst of conflicting device if CM_CDMASK_DEVINST set
 CD_rdResDes AS DWORD ' RES_DES // filled with a ResDes of conflict if CM_CDMASK_RESDES set
 CD_ulFlags AS DWORD ' ULONG // various flags regarding conflict
 CD_szDescription AS WSTRINGZ * %MAX_PATH ' WCHAR // description of conflicting device
END TYPE
#IF %DEF(%UNICODE)
MACRO CONFLICT_DETAILS = CONFLICT_DETAILS_W
#ELSE
MACRO CONFLICT_DETAILS = CONFLICT_DETAILS_A
#ENDIF
%EQUATE `CM_CDMASK_DEVINST = &H00000001 ' // mask to retrieve CD_dnDevInst attribute for conflict
%EQUATE `CM_CDMASK_RESDES = &H00000002 ' // mask to retrieve CD_rdResDes attribute for conflict
%EQUATE `CM_CDMASK_FLAGS = &H00000004 ' // mask to retrieve CD_ulFlags attribute for conflict
%EQUATE `CM_CDMASK_DESCRIPTION = &H00000008 ' // mask to retrieve CD_szDescription attribute for conflict
%EQUATE `CM_CDMASK_VALID = &H0000000F ' // valid bits
%EQUATE `CM_CDFLAGS_DRIVER = &H00000001 ' // CD_ulFlags: CD_szDescription reports back legacy driver name
%EQUATE `CM_CDFLAGS_ROOT_OWNED = &H00000002 ' // CD_ulFlags: Root owned device
%EQUATE `CM_CDFLAGS_RESERVED = &H00000004 ' // CD_ulFlags: Specified range is not available for use
'typedef ULONG REGDISPOSITION;
'//
'// use 1 byte packing for the data structures
'//
'#include "pshpack1.h"
'//--------------------------------------------------------------
'// Memory resource
'//--------------------------------------------------------------
'//
'// Define the attribute flags for memory ranges. Each bit flag is
'// identified by a constant bitmask. Following the bitmask definition,
'// are the two possible values.
'//
%EQUATE `mMD_MemoryType = &H1 ' // Bitmask, whether memory is writable
%EQUATE `fMD_MemoryType = %mMD_MemoryType ' // compatibility
%EQUATE `fMD_ROM = &H0 ' // Memory range is read-only
%EQUATE `fMD_RAM = &H1 ' // Memory range may be written to
%EQUATE `mMD_32_24 = &H2 ' // Bitmask, memory is 24 or 32-bit
%EQUATE `fMD_32_24 = %mMD_32_24 ' // compatibility
%EQUATE `fMD_24 = &H0 ' // Memory range is 24-bit
%EQUATE `fMD_32 = &H2 ' // Memory range is 32-bit
%EQUATE `mMD_Prefetchable = &H4 ' // Bitmask,whether memory prefetchable
%EQUATE `fMD_Prefetchable = %mMD_Prefetchable ' // compatibility
%EQUATE `fMD_Pref = %mMD_Prefetchable ' // compatibility
%EQUATE `fMD_PrefetchDisallowed = &H0 ' // Memory range is not prefetchable
%EQUATE `fMD_PrefetchAllowed = &H4 ' // Memory range is prefetchable
%EQUATE `mMD_Readable = &H8 ' // Bitmask,whether memory is readable
%EQUATE `fMD_Readable = %mMD_Readable ' // compatibility
%EQUATE `fMD_ReadAllowed = &H0 ' // Memory range is readable
%EQUATE `fMD_ReadDisallowed = &H8 ' // Memory range is write-only
%EQUATE `mMD_CombinedWrite = &H10 ' // Bitmask,supports write-behind
%EQUATE `fMD_CombinedWrite = %mMD_CombinedWrite ' // compatibility
%EQUATE `fMD_CombinedWriteDisallowed = &H0 ' // no combined-write caching
%EQUATE `fMD_CombinedWriteAllowed = &H10 ' // supports combined-write caching
%EQUATE `mMD_Cacheable = &H20 ' // Bitmask,whether memory is cacheable
%EQUATE `fMD_NonCacheable = &H0 ' // Memory range is non-cacheable
%EQUATE `fMD_Cacheable = &H20 ' // Memory range is cacheable
%EQUATE `fMD_WINDOW_DECODE = &H40 ' // Memory range is bridge window decode.
%EQUATE `fMD_MEMORY_BAR = &H80 ' // Memory BAR resource.
'//
'// MEM_RANGE Structure
'//
' // Size = 36 bytes
TYPE MEM_RANGE DWORD
 MR_Align AS QUAD ' DWORDLONG // specifies mask for base alignment
 MR_nBytes AS DWORD ' ULONG // specifies number of bytes required
 MR_Min AS QUAD ' DWORDLONG // specifies minimum address of the range
 MR_Max AS QUAD ' DWORDLONG // specifies maximum address of the range
 MR_Flags AS DWORD ' DWORD // specifies flags describing range (fMD flags)
 MR_Reserved AS DWORD
END TYPE
'//
'// MEM_DES structure
'//
' // Size = 32 bytes
TYPE MEM_DES DWORD
 MD_Count AS DWORD ' DWORD // number of MEM_RANGE structs in MEM_RESOURCE
 MD_Type AS DWORD ' DWORD // size (in bytes) of MEM_RANGE (MType_Range)
 MD_Alloc_Base AS QUAD ' DWORDLONG // base memory address of range allocated
 MD_Alloc_End AS QUAD ' DWORDLONG // end of allocated range
 MD_Flags AS DWORD ' DWORD // flags describing allocated range (fMD flags)
 MD_Reserved AS DWORD
END TYPE
'//
'// MEM_RESOURCE structure
'//
' // Size = 68 bytes
TYPE MEM_RESOURCE DWORD
 MEM_Header AS MEM_DES ' MEM_DES // info about memory range list
 MEM_Data(0) AS MEM_RANGE ' MEM_RANGE - variable-length array // list of memory ranges
END TYPE
'//
'// Define the size of each range structure
'//
'#define MType_Range sizeof(struct Mem_Range_s)
'//--------------------------------------------------------------
'// Large Memory Resource
'//--------------------------------------------------------------
'//
'// Note that large memory ranges use the same attribute flags as memory ranges.
'//
'//
'// MEM_LARGE_RANGE Structure
'//
' // Size = 40 bytes
TYPE MEM_LARGE_RANGE DWORD
 MLR_Align AS QUAD ' DWORDLONG ' // specifies mask for base alignment
 MLR_nBytes AS QUAD ' ULONGLONG // specifies number of bytes required
 MLR_Min AS QUAD ' DWORDLONG // specifies minimum address of the range
 MLR_Max AS QUAD ' DWORDLONG // specifies maximum address of the range
 MLR_Flags AS DWORD ' DWORD // specifies flags describing range (fMD flags)
 MLR_Reserved AS DWORD
END TYPE
'//
'// MEM_LARGE_DES structure
'//
' // Size = 32 bytes
TYPE MEM_LARGE_DES DWORD
 MLD_Count AS DWORD ' DWORD // number of LARGE_MEM_RANGE structs in LARGE_MEM_RESOURCE
 MLD_Type AS DWORD ' DWORD // size (in bytes) of MEM_RANGE (MType_Range)
 MLD_Alloc_Base AS QUAD ' DWORDLONG // base memory address of range allocated
 MLD_Alloc_End AS QUAD ' DWORDLONG // end of allocated range
 MLD_Flags AS DWORD ' DWORD // flags describing allocated range (fMD flags)
 MLD_Reserved AS DWORD
END TYPE
'//
'// MEM_LARGE_RESOURCE structure
'//
' // Size = 72 bytes
TYPE MEM_LARGE_RESOURCE DWORD
 MEM_LARGE_Header AS MEM_LARGE_DES ' // info about memory range list
 MEM_LARGE_Data(0) AS MEM_LARGE_RANGE ' // list of memory ranges
END TYPE
'//
'// Define the size of each range structure
'//
'#define MLType_Range sizeof(struct Mem_Large_Range_s)
'//--------------------------------------------------------------
'// I/O Port Resource
'//--------------------------------------------------------------
'//
'// Define the attribute flags for port resources. Each bit flag is
'// identified by a constant bitmask. Following the bitmask definition,
'// are the two possible values.
'//
%EQUATE `fIOD_PortType = &H1 ' // Bitmask,whether port is IO or memory
%EQUATE `fIOD_Memory = &H0 ' // Port resource really uses memory
%EQUATE `fIOD_IO = &H1 ' // Port resource uses IO ports
%EQUATE `fIOD_DECODE = &H00fc ' // decode flags
%EQUATE `fIOD_10_BIT_DECODE = &H0004
%EQUATE `fIOD_12_BIT_DECODE = &H0008
%EQUATE `fIOD_16_BIT_DECODE = &H0010
%EQUATE `fIOD_POSITIVE_DECODE = &H0020
%EQUATE `fIOD_PASSIVE_DECODE = &H0040
%EQUATE `fIOD_WINDOW_DECODE = &H0080
%EQUATE `fIOD_PORT_BAR = &H0100
'//
'// these are for compatiblity
'//
%EQUATE `IO_ALIAS_10_BIT_DECODE = &H00000004
%EQUATE `IO_ALIAS_12_BIT_DECODE = &H00000010
%EQUATE `IO_ALIAS_16_BIT_DECODE = &H00000000
%EQUATE `IO_ALIAS_POSITIVE_DECODE = &H000000FF
'//
'// IO_RANGE structure
'//
' // Size = 40 bytes
TYPE IO_RANGE DWORD
 IOR_Align AS QUAD ' DWORDLONG // mask for base alignment
 IOR_nPorts AS DWORD ' DWORD // number of ports
 IOR_Min AS QUAD ' DWORDLONG // minimum port address
 IOR_Max AS QUAD ' DWORDLONG // maximum port address
 IOR_RangeFlags AS DWORD ' DWORD // flags for this port range
 IOR_Alias AS QUAD ' DWORDLONG // multiplier that generates aliases for port(s)
END TYPE
'//
'// IO_DES structure
'//
' // Size = 28 bytes
TYPE IO_DES DWORD
 IOD_Count AS DWORD ' DWORD // number of IO_RANGE structs in IO_RESOURCE
 IOD_Type AS DWORD ' DWORD // size (in bytes) of IO_RANGE (IOType_Range)
 IOD_Alloc_Base AS QUAD ' DWORDLONG // base of allocated port range
 IOD_Alloc_End AS QUAD ' DWORDLONG // end of allocated port range
 IOD_DesFlags AS DWORD ' DWORD // flags relating to allocated port range
END TYPE
'//
'// IO_RESOURCE
'//
' // Size = 68 bytes
TYPE IO_RESOURCE DWORD
 IO_Header AS IO_DES ' IO_DES // info about I/O port range list
 IO_Data(0) AS IO_RANGE ' IO_RANGE - variable-length array // list of I/O port ranges
END TYPE
%EQUATE `IOA_Local = &Hff
'//
'// Define the size of each range structure
'//
'#define IOType_Range sizeof(struct IO_Range_s)
'//--------------------------------------------------------------
'// DMA Resource
'//--------------------------------------------------------------
'//
'// Define the attribute flags for a DMA resource range. Each bit flag is
'// identified with a constant bitmask. Following the bitmask definition
'// are the possible values.
'//
%EQUATE `mDD_Width = &H3 ' // Bitmask, width of the DMA channel:
%EQUATE `fDD_BYTE = &H0 ' // 8-bit DMA channel
%EQUATE `fDD_WORD = &H1 ' // 16-bit DMA channel
%EQUATE `fDD_DWORD = &H2 ' // 32-bit DMA channel
%EQUATE `fDD_BYTE_AND_WORD = &H3 ' // 8-bit and 16-bit DMA channel
%EQUATE `mDD_BusMaster = &H4 ' // Bitmask, whether bus mastering is supported
%EQUATE `fDD_NoBusMaster = &H0 ' // no bus mastering
%EQUATE `fDD_BusMaster = &H4 ' // bus mastering
%EQUATE `mDD_Type = &H18 ' // Bitmask, specifies type of DMA
%EQUATE `fDD_TypeStandard = &H00 ' // standard DMA
%EQUATE `fDD_TypeA = &H08 ' // Type-A DMA
%EQUATE `fDD_TypeB = &H10 ' // Type-B DMA
%EQUATE `fDD_TypeF = &H18 ' // Type-F DMA
'//
'// DMA_RANGE structure
'//
' // Size = 12 bytes
TYPE DMA_RANGE DWORD
 DR_Min AS DWORD ' ULONG // minimum DMA port in the range
 DR_Max AS DWORD ' ULONG // maximum DMA port in the range
 DR_Flags AS DWORD ' ULONG // flags describing the range (fDD flags)
END TYPE
'//
'// DMA_DES structure
'//
' // Size = 16 bytes
TYPE DMA_DES DWORD
 DD_Count AS DWORD ' DWORD // number of DMA_RANGE structs in DMA_RESOURCE
 DD_Type AS DWORD ' DWORD // size (in bytes) of DMA_RANGE struct (DType_Range)
 DD_Flags AS DWORD ' DWORD // Flags describing DMA channel (fDD flags)
 DD_Alloc_Chan AS DWORD ' ULONG // Specifies the DMA channel that was allocated
END TYPE
'//
'// DMA_RESOURCE
'//
' // Size = 28 bytes
TYPE DMA_RESOURCE DWORD
 DMA_Header AS DMA_DES ' DMA_DES // info about DMA channel range list
 DMA_Data(0) AS DMA_RANGE ' DMA_RANGE variable-length array// list of DMA ranges
END TYPE
'//
'// Define the size of each range structure
'//
'#define DType_Range sizeof(struct DMA_Range_s)
'//--------------------------------------------------------------
'// Interrupt Resource
'//--------------------------------------------------------------
'//
'// Define the attribute flags for an interrupt resource range. Each bit flag
'// is identified with a constant bitmask. Following the bitmask definition
'// are the possible values.
'//
%EQUATE `mIRQD_Share = &H1 ' // Bitmask,whether the IRQ may be shared:
%EQUATE `fIRQD_Exclusive = &H0 ' // The IRQ may not be shared
%EQUATE `fIRQD_Share = &H1 ' // The IRQ may be shared
%EQUATE `fIRQD_Share_Bit = 0 ' // compatibility
%EQUATE `fIRQD_Level_Bit = 1 ' // compatibility
' ' //
' ' // ** NOTE: 16-bit ConfigMgr uses fIRQD_Level_Bit being set to indicate that the
' ' // ** interrupt is _level-sensitive_. For 32-bit ConfigMgr, if this bit is set,
' ' // ** then the interrupt is _edge-sensitive_.
' ' //
%EQUATE `mIRQD_Edge_Level = &H2 ' // Bitmask,whether edge or level triggered:
%EQUATE `fIRQD_Level = &H0 ' // The IRQ is level-sensitive
%EQUATE `fIRQD_Edge = &H2 ' // The IRQ is edge-sensitive
'//
'// IRQ_RANGE
'//
' // Size = 12 bytes
TYPE IRQ_RANGE DWORD FILL
 IRQR_Min AS DWORD ' ULONG // minimum IRQ in the range
 IRQR_Max AS DWORD ' ULONG // maximum IRQ in the range
#IF %DEF(%NT_PROCESSOR_GROUPS)
 IRQR_Flags AS WORD ' USHORT // flags describing the range (fIRQD flags)
 IRQR_Rsvdz AS WORD ' USHORT // Reserved, must be zero.
#ELSE
 IRQR_Flags AS DWORD ' ULONG // flags describing the range (fIRQD flags)
#ENDIF
END TYPE
'//
'// IRQ_DES structure
'//
' // Size = 20 bytes
TYPE IRQ_DES_32 DWORD FILL
 IRQD_Count AS DWORD ' DWORD // number of IRQ_RANGE structs in IRQ_RESOURCE
 IRQD_Type AS DWORD ' DWORD // size (in bytes) of IRQ_RANGE (IRQType_Range)
#IF %DEF(%NT_PROCESSOR_GROUPS)
 IRQD_Flags AS WORD ' USHORT // flags describing the range (fIRQD flags)
 IRQD_Group AS WORD ' USHORT // Reserved, must be zero.
#ELSE
 IRQD_Flags AS DWORD ' DWORD // flags describing the IRQ (fIRQD flags)
#ENDIF
 IRQD_Alloc_Num AS DWORD ' ULONG // specifies the IRQ that was allocated
 IRQD_Affinity AS DWORD ' ULONG32
END TYPE
' // Size = 24 bytes
TYPE IRQ_DES_64 DWORD FILL
 IRQD_Count AS DWORD ' DWORD // number of IRQ_RANGE structs in IRQ_RESOURCE
 IRQD_Type AS DWORD ' DWORD // size (in bytes) of IRQ_RANGE (IRQType_Range)
#IF %DEF(%NT_PROCESSOR_GROUPS)
 IRQD_Flags AS WORD ' USHORT // flags describing the range (fIRQD flags)
 IRQD_Group AS WORD ' USHORT // Reserved, must be zero.
#ELSE
 IRQD_Flags AS DWORD ' DWORD // flags describing the IRQ (fIRQD flags)
#ENDIF
 IRQD_Alloc_Num AS DWORD ' ULONG // specifies the IRQ that was allocated
 IRQD_Affinity AS QUAD ' ULONG64
END TYPE
'#ifdef _WIN64
'typedef IRQ_DES_64 IRQ_DES;
'typedef PIRQ_DES_64 PIRQ_DES;
'#else
'typedef IRQ_DES_32 IRQ_DES;
'typedef PIRQ_DES_32 PIRQ_DES;
'#endif
MACRO IRQ_DES = IRQ_DES_32
'//
'// IRQ_RESOURCE structure
'//
' // Size = 32 bytes
TYPE IRQ_RESOURCE_32 DWORD FILL
 IRQ_Header AS IRQ_DES_32 ' IRQ_DES_32 // info about IRQ range list
 IRQ_Data(0) AS IRQ_RANGE ' IRQ_RANGE variable-length array // list of IRQ ranges
END TYPE
' // Size = 36 bytes
TYPE IRQ_RESOURCE_64 DWORD FILL
 IRQ_Header AS IRQ_DES_64 ' IRQ_DES_64 // info about IRQ range list
 IRQ_Data(0) AS IRQ_RANGE ' IRQ_RANGE variable-length array // list of IRQ ranges
END TYPE
'#ifdef _WIN64
'typedef IRQ_RESOURCE_64 IRQ_RESOURCE;
'typedef PIRQ_RESOURCE_64 PIRQ_RESOURCE;
'#else
'typedef IRQ_RESOURCE_32 IRQ_RESOURCE;
'typedef PIRQ_RESOURCE_32 PIRQ_RESOURCE;
'#endif
MACRO IRQ_RESOURCE = IRQ_RESOURCE_32
'//
'// Define the size of each range structure
'//
'#define IRQType_Range sizeof(struct IRQ_Range_s)
'#if (WINVER >= _WIN32_WINNT_WINXP)
'//
'// Flags for resource descriptor APIs indicating the width of certain
'// variable-size resource descriptor structure fields, where applicable.
'//
%EQUATE `CM_RESDES_WIDTH_DEFAULT = &H00000000 ' // 32 or 64-bit IRQ_RESOURCE / IRQ_DES, based on client
%EQUATE `CM_RESDES_WIDTH_32 = &H00000001 ' // 32-bit IRQ_RESOURCE / IRQ_DES
%EQUATE `CM_RESDES_WIDTH_64 = &H00000002 ' // 64-bit IRQ_RESOURCE / IRQ_DES
%EQUATE `CM_RESDES_WIDTH_BITS = &H00000003
'#endif // (WINVER >= _WIN32_WINNT_WINXP)
'//--------------------------------------------------------------
'// Device Private Resource
'//--------------------------------------------------------------
'//
'// DEVICEPRIVATE_RANGE structure
'//
' // Size = 12 bytes
TYPE DEVPRIVATE_RANGE DWORD
 PR_Data1 AS DWORD ' DWORD // mask for base alignment
 PR_Data2 AS DWORD ' DWORD // number of bytes
 PR_Data3 AS DWORD ' DWORD // minimum address
END TYPE
'//
'// DEVPRIVATE_DES structure
'//
' // Size = 24 bytes
TYPE DEVPRIVATE_DES DWORD
 PD_Count AS DWORD
 PD_Type AS DWORD
 PD_Data1 AS DWORD
 PD_Data2 AS DWORD
 PD_Data3 AS DWORD
 PD_Flags AS DWORD
END TYPE
'//
'// DEVPRIVATE_RESOURCE
'//
' // Size = 36 bytes
TYPE DEVPRIVATE_RESOURCE DWORD
 PRV_Header AS DEVPRIVATE_DES
 PRV_Data(0) AS DEVPRIVATE_RANGE
END TYPE
'//
'// Define the size of each range structure
'//
'#define PType_Range sizeof(struct DevPrivate_Range_s)
'//--------------------------------------------------------------
'// Class-Specific Resource
'//--------------------------------------------------------------
' // Size = 33 bytes
TYPE CS_DES BYTE
 CSD_SignatureLength AS DWORD
 CSD_LegacyDataOffset AS DWORD
 CSD_LegacyDataSize AS DWORD
 CSD_Flags AS DWORD
 CSD_ClassGuid AS GUID
 CSD_Signature(0) AS BYTE ' BYTE - variable-length array
END TYPE
' // Size = 33 bytes
TYPE CS_RESOURCE BYTE
 CS_Header AS CS_DES
END TYPE
'//--------------------------------------------------------------
'// PC Card Configuration Resource
'//--------------------------------------------------------------
'//
'// Define the attribute flags for a PC Card configuration resource descriptor.
'// Each bit flag is identified with a constant bitmask. Following the bitmask
'// definition are the possible values.
'//
%EQUATE `mPCD_IO_8_16 = &H1 ' // Bitmask, whether I/O is 8 or 16 bits
%EQUATE `fPCD_IO_8 = &H0 ' // I/O is 8-bit
%EQUATE `fPCD_IO_16 = &H1 ' // I/O is 16-bit
%EQUATE `mPCD_MEM_8_16 = &H2 ' // Bitmask, whether MEM is 8 or 16 bits
%EQUATE `fPCD_MEM_8 = &H0 ' // MEM is 8-bit
%EQUATE `fPCD_MEM_16 = &H2 ' // MEM is 16-bit
%EQUATE `mPCD_MEM_A_C = &HC ' // Bitmask, whether MEMx is Attribute or Common
%EQUATE `fPCD_MEM1_A = &H4 ' // MEM1 is Attribute
%EQUATE `fPCD_MEM2_A = &H8 ' // MEM2 is Attribute
%EQUATE `fPCD_IO_ZW_8 = &H10 ' // zero wait on 8 bit I/O
%EQUATE `fPCD_IO_SRC_16 = &H20 ' // iosrc 16
%EQUATE `fPCD_IO_WS_16 = &H40 ' // wait states on 16 bit io
%EQUATE `mPCD_MEM_WS = &H300 ' // Bitmask, for additional wait states on memory windows
%EQUATE `fPCD_MEM_WS_ONE = &H100 ' // 1 wait state
%EQUATE `fPCD_MEM_WS_TWO = &H200 ' // 2 wait states
%EQUATE `fPCD_MEM_WS_THREE = &H300 ' // 3 wait states
'#if (WINVER >= _WIN32_WINNT_WINXP)
%EQUATE `fPCD_MEM_A = &H4 ' // MEM is Attribute
%EQUATE `fPCD_ATTRIBUTES_PER_WINDOW = &H8000
%EQUATE `fPCD_IO1_16 = &H00010000 ' // I/O window 1 is 16-bit
%EQUATE `fPCD_IO1_ZW_8 = &H00020000 ' // I/O window 1 zero wait on 8 bit I/O
%EQUATE `fPCD_IO1_SRC_16 = &H00040000 ' // I/O window 1 iosrc 16
%EQUATE `fPCD_IO1_WS_16 = &H00080000 ' // I/O window 1 wait states on 16 bit io
%EQUATE `fPCD_IO2_16 = &H00100000 ' // I/O window 2 is 16-bit
%EQUATE `fPCD_IO2_ZW_8 = &H00200000 ' // I/O window 2 zero wait on 8 bit I/O
%EQUATE `fPCD_IO2_SRC_16 = &H00400000 ' // I/O window 2 iosrc 16
%EQUATE `fPCD_IO2_WS_16 = &H00800000 ' // I/O window 2 wait states on 16 bit io
%EQUATE `mPCD_MEM1_WS = &H03000000 ' // MEM window 1 Bitmask, for additional wait states on memory windows
%EQUATE `fPCD_MEM1_WS_ONE = &H01000000 ' // MEM window 1, 1 wait state
%EQUATE `fPCD_MEM1_WS_TWO = &H02000000 ' // MEM window 1, 2 wait states
%EQUATE `fPCD_MEM1_WS_THREE = &H03000000 ' // MEM window 1, 3 wait states
%EQUATE `fPCD_MEM1_16 = &H04000000 ' // MEM window 1 is 16-bit
%EQUATE `mPCD_MEM2_WS = &H30000000 ' // MEM window 2 Bitmask, for additional wait states on memory windows
%EQUATE `fPCD_MEM2_WS_ONE = &H10000000 ' // MEM window 2, 1 wait state
%EQUATE `fPCD_MEM2_WS_TWO = &H20000000 ' // MEM window 2, 2 wait states
%EQUATE `fPCD_MEM2_WS_THREE = &H30000000 ' // MEM window 2, 3 wait states
%EQUATE `fPCD_MEM2_16 = &H40000000 ' // MEM window 2 is 16-bit
%EQUATE `PCD_MAX_MEMORY = 2
%EQUATE `PCD_MAX_IO = 2
'#endif // (WINVER >= _WIN32_WINNT_WINXP)
' // Size = 38 bytes
TYPE PCCARD_DES BYTE
 PCD_Count AS DWORD
 PCD_Type AS DWORD
 PCD_Flags AS DWORD
 PCD_ConfigIndex AS BYTE ' BYTE
 PCD_Reserved(2) AS BYTE ' BYTE[3]
 PCD_MemoryCardBase1 AS DWORD
 PCD_MemoryCardBase2 AS DWORD
'#if (WINVER >= _WIN32_WINNT_WINXP)
 PCD_MemoryCardBase(%PCD_MAX_MEMORY - 1) AS DWORD ' DWORD ' // will soon be removed
 PCD_MemoryFlags(%PCD_MAX_MEMORY - 1) AS WORD ' WORD ' // will soon be removed
 PCD_IoFlags(%PCD_MAX_IO - 1) AS BYTE ' BYTE ' // will soon be removed
'#endif // (WINVER >= _WIN32_WINNT_WINXP)
END TYPE
' // Size = 38 bytes
TYPE PCCARD_RESOURCE BYTE
 PcCard_Header AS PCCARD_DES
END TYPE
'//--------------------------------------------------------------
'// MF (multifunction) PCCard Configuration Resource
'//--------------------------------------------------------------
%EQUATE `mPMF_AUDIO_ENABLE = &H8 ' // Bitmask, whether audio is enabled or not
%EQUATE `fPMF_AUDIO_ENABLE = &H8 ' // Audio is enabled
' // Size = 20 bytes
TYPE MFCARD_DES BYTE
 PMF_Count AS DWORD
 PMF_Type AS DWORD
 PMF_Flags AS DWORD
 PMF_ConfigOptions AS BYTE ' BYTE
 PMF_IoResourceIndex AS BYTE ' BYTE
 PMF_Reserved(1) AS BYTE ' BYTE[2]
 PMF_ConfigRegisterBase AS DWORD
END TYPE
' // Size = 20 bytes
TYPE MFCARD_RESOURCE BYTE
 MfCard_Header AS MFCARD_DES
END TYPE
'//--------------------------------------------------------------
'// Bus Number Resource
'//--------------------------------------------------------------
'//
'// Define the attribute flags for a Bus Number resource descriptor.
'// Each bit flag is identified with a constant bitmask. Following the bitmask
'// definition are the possible values.
'//
'// Currently unused.
'//
'//
'// BUSNUMBER_RANGE
'//
' // Size = 16 bytes
TYPE BUSNUMBER_RANGE DWORD
 BUSR_Min AS DWORD ' ULONG // minimum Bus Number in the range
 BUSR_Max AS DWORD ' ULONG // maximum Bus Number in the range
 BUSR_nBusNumbers AS DWORD ' ULONG // specifies number of buses required
 BUSR_Flags AS DWORD ' ULONG // flags describing the range (currently unused)
END TYPE
'//
'// BUSNUMBER_DES structure
'//
' // Size = 20 bytes
TYPE BUSNUMBER_DES DWORD
 BUSD_Count AS DWORD ' DWORD // number of BUSNUMBER_RANGE structs in BUSNUMBER_RESOURCE
 BUSD_Type AS DWORD ' DWORD // size (in bytes) of BUSNUMBER_RANGE (BusNumberType_Range)
 BUSD_Flags AS DWORD ' DWORD // flags describing the range (currently unused)
 BUSD_Alloc_Base AS DWORD ' ULONG // specifies the first Bus that was allocated
 BUSD_Alloc_End AS DWORD ' ULONG // specifies the last Bus number that was allocated
END TYPE
'//
'// BUSNUMBER_RESOURCE structure
'//
' // Size = 36 bytes
TYPE BUSNUMBER_RESOURCE DWORD
 BusNumber_Header AS BUSNUMBER_DES ' BUSNUMBER_DES // info about Bus Number range list
 BusNumber_Data(0) AS BUSNUMBER_RANGE ' BUSNUMBER_RANGE - variable-length array // list of Bus Number ranges
END TYPE
'//
'// Define the size of each range structure
'//
'#define BusNumberType_Range sizeof(struct BusNumber_Range_s)
'//--------------------------------------------------------------
'// Hardware Profile Information
'//--------------------------------------------------------------
'//
'// Define flags relating to hardware profiles
'//
%EQUATE `CM_HWPI_NOT_DOCKABLE = &H00000000 ' // machine is not dockable
%EQUATE `CM_HWPI_UNDOCKED = &H00000001 ' // hw profile for docked config
%EQUATE `CM_HWPI_DOCKED = &H00000002 ' // hw profile for undocked config
'//
'// HWPROFILEINFO structure
'//
' // Size = 88 bytes
TYPE HWPROFILEINFO_A DWORD
 HWPI_ulHWProfile AS DWORD ' ULONG // handle of hw profile
 HWPI_szFriendlyName AS ASCIIZ * %MAX_PROFILE_LEN ' CHAR // friendly name of hw profile
 HWPI_dwFlags AS DWORD ' DWORD // profile flags (CM_HWPI_*)
END TYPE
' // Size = 88 bytes
TYPE HWPROFILEINFO_W DWORD
 HWPI_ulHWProfile AS DWORD ' ULONG // handle of hw profile
 HWPI_szFriendlyName AS WSTRINGZ * %MAX_PROFILE_LEN ' WCHAR // friendly name of hw profile
 HWPI_dwFlags AS DWORD ' DWORD // profile flags (CM_HWPI_*)
END TYPE
#IF %DEF(%UNICODE)
MACRO HWPROFILEINFO = HWPROFILEINFO_W
#ELSE
MACRO HWPROFILEINFO = HWPROFILEINFO_A
#ENDIF
'//
'// revert back to normal default packing
'//
'#include "poppack.h"
'//--------------------------------------------------------------
'// Miscellaneous
'//--------------------------------------------------------------
'//
'// Resource types
'//
%EQUATE `ResType_All = &H00000000 ' // Return all resource types
%EQUATE `ResType_None = &H00000000 ' // Arbitration always succeeded
%EQUATE `ResType_Mem = &H00000001 ' // Physical address resource
%EQUATE `ResType_IO = &H00000002 ' // Physical I/O address resource
%EQUATE `ResType_DMA = &H00000003 ' // DMA channels resource
%EQUATE `ResType_IRQ = &H00000004 ' // IRQ resource
%EQUATE `ResType_DoNotUse = &H00000005 ' // Used as spacer to sync subsequent ResTypes w/NT
%EQUATE `ResType_BusNumber = &H00000006 ' // bus number resource
%EQUATE `ResType_MemLarge = &H00000007 ' // Memory resources >= 4GB
%EQUATE `ResType_MAX = &H00000007 ' // Maximum known (arbitrated??? ResType
%EQUATE `ResType_Ignored_Bit = &H00008000 ' // Ignore this resource
%EQUATE `ResType_ClassSpecific = &H0000FFFF ' // class-specific resource
%EQUATE `ResType_Reserved = &H00008000 ' // reserved for internal use
%EQUATE `ResType_DevicePrivate = &H00008001 ' // device private data
%EQUATE `ResType_PcCardConfig = &H00008002 ' // PC Card configuration data
%EQUATE `ResType_MfCardConfig = &H00008003 ' // MF Card configuration data
'//
'// Flags specifying options for ranges that conflict with ranges already in
'// the range list (CM_Add_Range???
'//
%EQUATE `CM_ADD_RANGE_ADDIFCONFLICT = &H00000000 ' // merg with conflicting range
%EQUATE `CM_ADD_RANGE_DONOTADDIFCONFLICT = &H00000001 ' // error if range conflicts
%EQUATE `CM_ADD_RANGE_BITS = &H00000001
'//
'// Logical Config Flags (specified in call to CM_Get_First_Log_Conf
'//
%EQUATE `BASIC_LOG_CONF = &H00000000 ' // Specifies the req list.
%EQUATE `FILTERED_LOG_CONF = &H00000001 ' // Specifies the filtered req list.
%EQUATE `ALLOC_LOG_CONF = &H00000002 ' // Specifies the Alloc Element.
%EQUATE `BOOT_LOG_CONF = &H00000003 ' // Specifies the RM Alloc Element.
%EQUATE `FORCED_LOG_CONF = &H00000004 ' // Specifies the Forced Log Conf
%EQUATE `OVERRIDE_LOG_CONF = &H00000005 ' // Specifies the Override req list.
%EQUATE `NUM_LOG_CONF = &H00000006 ' // Number of Log Conf type
%EQUATE `LOG_CONF_BITS = &H00000007 ' // The bits of the log conf type.
%EQUATE `PRIORITY_EQUAL_FIRST = &H00000008 ' // Same priority, new one first
%EQUATE `PRIORITY_EQUAL_LAST = &H00000000 ' // Same priority, new one last
%EQUATE `PRIORITY_BIT = &H00000008
'//
'// Registry disposition values
'// (specified in call to CM_Open_DevNode_Key and CM_Open_Class_Key???
'//
%EQUATE `RegDisposition_OpenAlways = &H00000000 ' // open if exists else create
%EQUATE `RegDisposition_OpenExisting = &H00000001 ' // open key only if exists
%EQUATE `RegDisposition_Bits = &H00000001
'//
'// ulFlags values for CM API routines
'//
'//
'// Flags for CM_Add_ID
'//
%EQUATE `CM_ADD_ID_HARDWARE = &H00000000
%EQUATE `CM_ADD_ID_COMPATIBLE = &H00000001
%EQUATE `CM_ADD_ID_BITS = &H00000001
'//
'// Device Node creation flags
'//
%EQUATE `CM_CREATE_DEVNODE_NORMAL = &H00000000 ' // install later
%EQUATE `CM_CREATE_DEVNODE_NO_WAIT_INSTALL = &H00000001 ' // NOT SUPPORTED ON NT
%EQUATE `CM_CREATE_DEVNODE_PHANTOM = &H00000002
%EQUATE `CM_CREATE_DEVNODE_GENERATE_ID = &H00000004
%EQUATE `CM_CREATE_DEVNODE_DO_NOT_INSTALL = &H00000008
%EQUATE `CM_CREATE_DEVNODE_BITS = &H0000000F
%EQUATE `CM_CREATE_DEVINST_NORMAL = %CM_CREATE_DEVNODE_NORMAL
%EQUATE `CM_CREATE_DEVINST_NO_WAIT_INSTALL = %CM_CREATE_DEVNODE_NO_WAIT_INSTALL
%EQUATE `CM_CREATE_DEVINST_PHANTOM = %CM_CREATE_DEVNODE_PHANTOM
%EQUATE `CM_CREATE_DEVINST_GENERATE_ID = %CM_CREATE_DEVNODE_GENERATE_ID
%EQUATE `CM_CREATE_DEVINST_DO_NOT_INSTALL = %CM_CREATE_DEVNODE_DO_NOT_INSTALL
%EQUATE `CM_CREATE_DEVINST_BITS = %CM_CREATE_DEVNODE_BITS
'//
'// Flags for CM_Delete_Class_Key
'//
%EQUATE `CM_DELETE_CLASS_ONLY = &H00000000
%EQUATE `CM_DELETE_CLASS_SUBKEYS = &H00000001
'#if (WINVER >= _WIN32_WINNT_LONGHORN)
%EQUATE `CM_DELETE_CLASS_INTERFACE = &H00000002
'#endif ' // (WINVER >= _WIN32_WINNT_LONGHORN)
%EQUATE `CM_DELETE_CLASS_BITS = &H00000003
'//
'// Detection reason flags (specified in call to CM_Run_Detection???
'//
%EQUATE `CM_DETECT_NEW_PROFILE = &H00000001 ' // detection for new hw profile
%EQUATE `CM_DETECT_CRASHED = &H00000002 ' // Previous detection crashed
%EQUATE `CM_DETECT_HWPROF_FIRST_BOOT = &H00000004
%EQUATE `CM_DETECT_RUN = &H80000000
%EQUATE `CM_DETECT_BITS = &H80000007
%EQUATE `CM_DISABLE_POLITE = &H00000000 ' // Ask the driver
%EQUATE `CM_DISABLE_ABSOLUTE = &H00000001 ' // Don't ask the driver
%EQUATE `CM_DISABLE_HARDWARE = &H00000002 ' // Don't ask the driver, and won't be restarteable
%EQUATE `CM_DISABLE_UI_NOT_OK = &H00000004 ' // Don't popup any veto API
%EQUATE `CM_DISABLE_BITS = &H00000007 ' // The bits for the disable function
'//
'// Flags for CM_Get_Device_ID_List, CM_Get_Device_ID_List_Size
'//
%EQUATE `CM_GETIDLIST_FILTER_NONE = &H00000000
%EQUATE `CM_GETIDLIST_FILTER_ENUMERATOR = &H00000001
%EQUATE `CM_GETIDLIST_FILTER_SERVICE = &H00000002
%EQUATE `CM_GETIDLIST_FILTER_EJECTRELATIONS = &H00000004
%EQUATE `CM_GETIDLIST_FILTER_REMOVALRELATIONS = &H00000008
%EQUATE `CM_GETIDLIST_FILTER_POWERRELATIONS = &H00000010
%EQUATE `CM_GETIDLIST_FILTER_BUSRELATIONS = &H00000020
%EQUATE `CM_GETIDLIST_DONOTGENERATE = &H10000040
'#if (WINVER <= _WIN32_WINNT_LONGHORN)
#IF %WINVER <= &H0600
%EQUATE `CM_GETIDLIST_FILTER_BITS = &H1000007F
#ENDIF
'#endif // (WINVER <= _WIN32_WINNT_LONGHORN)
'#if (WINVER >= _WIN32_WINNT_WIN7)
#IF %WINVER >= &H0600
%EQUATE `CM_GETIDLIST_FILTER_TRANSPORTRELATIONS = &H00000080
%EQUATE `CM_GETIDLIST_FILTER_PRESENT = &H00000100
%EQUATE `CM_GETIDLIST_FILTER_CLASS = &H00000200
%EQUATE `CM_GETIDLIST_FILTER_BITS = &H100003FF
#ENDIF ' // (WINVER >= _WIN32_WINNT_WIN7)
'//
'// Flags for CM_Get_Device_Interface_List, CM_Get_Device_Interface_List_Size
'//
%EQUATE `CM_GET_DEVICE_INTERFACE_LIST_PRESENT = &H00000000 ' // only currently 'live' device interfaces
%EQUATE `CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES = &H00000001 ' // all registered device interfaces, live or not
%EQUATE `CM_GET_DEVICE_INTERFACE_LIST_BITS = &H00000001
'//
'// Registry properties (specified in call to CM_Get_DevInst_Registry_Property or CM_Get_Class_Registry_Property,
'// some are allowed in calls to CM_Set_DevInst_Registry_Property and CM_Set_Class_Registry_Property???
'// CM_DRP_xxxx values should be used for CM_Get_DevInst_Registry_Property / CM_Set_DevInst_Registry_Property
'// CM_CRP_xxxx values should be used for CM_Get_Class_Registry_Property / CM_Set_Class_Registry_Property
'// DRP/CRP values that overlap must have a 1:1 correspondence with each other
'//
%EQUATE `CM_DRP_DEVICEDESC = &H00000001 ' // DeviceDesc REG_SZ property (RW???
%EQUATE `CM_DRP_HARDWAREID = &H00000002 ' // HardwareID REG_MULTI_SZ property (RW???
%EQUATE `CM_DRP_COMPATIBLEIDS = &H00000003 ' // CompatibleIDs REG_MULTI_SZ property (RW???
%EQUATE `CM_DRP_UNUSED0 = &H00000004 ' // unused
%EQUATE `CM_DRP_SERVICE = &H00000005 ' // Service REG_SZ property (RW???
%EQUATE `CM_DRP_UNUSED1 = &H00000006 ' // unused
%EQUATE `CM_DRP_UNUSED2 = &H00000007 ' // unused
%EQUATE `CM_DRP_CLASS = &H00000008 ' // Class REG_SZ property (RW???
%EQUATE `CM_DRP_CLASSGUID = &H00000009 ' // ClassGUID REG_SZ property (RW???
%EQUATE `CM_DRP_DRIVER = &H0000000A ' // Driver REG_SZ property (RW???
%EQUATE `CM_DRP_CONFIGFLAGS = &H0000000B ' // ConfigFlags REG_DWORD property (RW???
%EQUATE `CM_DRP_MFG = &H0000000C ' // Mfg REG_SZ property (RW???
%EQUATE `CM_DRP_FRIENDLYNAME = &H0000000D ' // FriendlyName REG_SZ property (RW???
%EQUATE `CM_DRP_LOCATION_INFORMATION = &H0000000E ' // LocationInformation REG_SZ property (RW???
%EQUATE `CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME = &H0000000F ' // PhysicalDeviceObjectName REG_SZ property (R???
%EQUATE `CM_DRP_CAPABILITIES = &H00000010 ' // Capabilities REG_DWORD property (R???
%EQUATE `CM_DRP_UI_NUMBER = &H00000011 ' // UiNumber REG_DWORD property (R???
%EQUATE `CM_DRP_UPPERFILTERS = &H00000012 ' // UpperFilters REG_MULTI_SZ property (RW???
'#if (WINVER >= _WIN32_WINNT_LONGHORN)
'%CM_CRP_UPPERFILTERS CM_DRP_UPPERFILTERS ' // UpperFilters REG_MULTI_SZ property (RW???
'#endif ' // (WINVER >= _WIN32_WINNT_LONGHORN)
%EQUATE `CM_DRP_LOWERFILTERS = &H00000013 ' // LowerFilters REG_MULTI_SZ property (RW???
'#if (WINVER >= _WIN32_WINNT_LONGHORN)
%EQUATE `CM_CRP_LOWERFILTERS = %CM_DRP_LOWERFILTERS ' // LowerFilters REG_MULTI_SZ property (RW???
'#endif ' // (WINVER >= _WIN32_WINNT_LONGHORN)
%EQUATE `CM_DRP_BUSTYPEGUID = &H00000014 ' // Bus Type Guid, GUID, (R???
%EQUATE `CM_DRP_LEGACYBUSTYPE = &H00000015 ' // Legacy bus type, INTERFACE_TYPE, (R???
%EQUATE `CM_DRP_BUSNUMBER = &H00000016 ' // Bus Number, DWORD, (R???
%EQUATE `CM_DRP_ENUMERATOR_NAME = &H00000017 ' // Enumerator Name REG_SZ property (R???
%EQUATE `CM_DRP_SECURITY = &H00000018 ' // Security - Device override (RW???
%EQUATE `CM_CRP_SECURITY = %CM_DRP_SECURITY ' // Class default security (RW???
%EQUATE `CM_DRP_SECURITY_SDS = &H00000019 ' // Security - Device override (RW???
%EQUATE `CM_CRP_SECURITY_SDS = %CM_DRP_SECURITY_SDS ' // Class default security (RW???
%EQUATE `CM_DRP_DEVTYPE = &H0000001A ' // Device Type - Device override (RW???
%EQUATE `CM_CRP_DEVTYPE = %CM_DRP_DEVTYPE ' // Class default Device-type (RW???
%EQUATE `CM_DRP_EXCLUSIVE = &H0000001B ' // Exclusivity - Device override (RW???
%EQUATE `CM_CRP_EXCLUSIVE = %CM_DRP_EXCLUSIVE ' // Class default (RW???
%EQUATE `CM_DRP_CHARACTERISTICS = &H0000001C ' // Characteristics - Device Override (RW???
%EQUATE `CM_CRP_CHARACTERISTICS = %CM_DRP_CHARACTERISTICS ' // Class default (RW???
%EQUATE `CM_DRP_ADDRESS = &H0000001D ' // Device Address (R???
%EQUATE `CM_DRP_UI_NUMBER_DESC_FORMAT = &H0000001E ' // UINumberDescFormat REG_SZ property (RW???
'#if (WINVER >= _WIN32_WINNT_WINXP)
%EQUATE `CM_DRP_DEVICE_POWER_DATA = &H0000001F ' // CM_POWER_DATA REG_BINARY property (R???
%EQUATE `CM_DRP_REMOVAL_POLICY = &H00000020 ' // CM_DEVICE_REMOVAL_POLICY REG_DWORD (R???
%EQUATE `CM_DRP_REMOVAL_POLICY_HW_DEFAULT = &H00000021 ' // CM_DRP_REMOVAL_POLICY_HW_DEFAULT REG_DWORD (R???
%EQUATE `CM_DRP_REMOVAL_POLICY_OVERRIDE = &H00000022 ' // CM_DRP_REMOVAL_POLICY_OVERRIDE REG_DWORD (RW???
%EQUATE `CM_DRP_INSTALL_STATE = &H00000023 ' // CM_DRP_INSTALL_STATE REG_DWORD (R???
'#endif ' // (WINVER >= _WIN32_WINNT_WINXP)
'#if (WINVER >= _WIN32_WINNT_WS03)
%EQUATE `CM_DRP_LOCATION_PATHS = &H00000024 ' // CM_DRP_LOCATION_PATHS REG_MULTI_SZ (R???
'#endif ' // (WINVER >= _WIN32_WINNT_WS03)
'#if (WINVER >= _WIN32_WINNT_WIN7)
%EQUATE `CM_DRP_BASE_CONTAINERID = &H00000025 ' // Base ContainerID REG_SZ property (R)
'#endif // (WINVER >= _WIN32_WINNT_WIN7)
%EQUATE `CM_DRP_MIN = &H00000001 ' // First device register
%EQUATE `CM_CRP_MIN = %CM_DRP_MIN ' // First class register
%EQUATE `CM_DRP_MAX = &H00000025 ' // Last device register
%EQUATE `CM_CRP_MAX = %CM_DRP_MAX ' // Last class register
'//
'// Capabilities bits (the capability value is returned from calling
'// CM_Get_DevInst_Registry_Property with CM_DRP_CAPABILITIES property???
'//
%EQUATE `CM_DEVCAP_LOCKSUPPORTED = &H00000001
%EQUATE `CM_DEVCAP_EJECTSUPPORTED = &H00000002
%EQUATE `CM_DEVCAP_REMOVABLE = &H00000004
%EQUATE `CM_DEVCAP_DOCKDEVICE = &H00000008
%EQUATE `CM_DEVCAP_UNIQUEID = &H00000010
%EQUATE `CM_DEVCAP_SILENTINSTALL = &H00000020
%EQUATE `CM_DEVCAP_RAWDEVICEOK = &H00000040
%EQUATE `CM_DEVCAP_SURPRISEREMOVALOK = &H00000080
%EQUATE `CM_DEVCAP_HARDWAREDISABLED = &H00000100
%EQUATE `CM_DEVCAP_NONDYNAMIC = &H00000200
'#if (WINVER >= _WIN32_WINNT_WINXP)
'//
'// Removal policies (retrievable via CM_Get_DevInst_Registry_Property with
'// the CM_DRP_REMOVAL_POLICY, CM_DRP_REMOVAL_POLICY_OVERRIDE, or
'// CM_DRP_REMOVAL_POLICY_HW_DEFAULT properties???
'//
%EQUATE `CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL = 1
%EQUATE `CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL = 2
%EQUATE `CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL = 3
'//
'// Device install states (retrievable via CM_Get_DevInst_Registry_Property with
'// the CM_DRP_INSTALL_STATE properties???
'//
%EQUATE `CM_INSTALL_STATE_INSTALLED = 0
%EQUATE `CM_INSTALL_STATE_NEEDS_REINSTALL = 1
%EQUATE `CM_INSTALL_STATE_FAILED_INSTALL = 2
%EQUATE `CM_INSTALL_STATE_FINISH_INSTALL = 3
'#endif ' // (WINVER >= _WIN32_WINNT_WINXP)
'//
'// Flags for CM_Locate_DevNode
'//
%EQUATE `CM_LOCATE_DEVNODE_NORMAL = &H00000000
%EQUATE `CM_LOCATE_DEVNODE_PHANTOM = &H00000001
%EQUATE `CM_LOCATE_DEVNODE_CANCELREMOVE = &H00000002
%EQUATE `CM_LOCATE_DEVNODE_NOVALIDATION = &H00000004
%EQUATE `CM_LOCATE_DEVNODE_BITS = &H00000007
%EQUATE `CM_LOCATE_DEVINST_NORMAL = %CM_LOCATE_DEVNODE_NORMAL
%EQUATE `CM_LOCATE_DEVINST_PHANTOM = %CM_LOCATE_DEVNODE_PHANTOM
%EQUATE `CM_LOCATE_DEVINST_CANCELREMOVE = %CM_LOCATE_DEVNODE_CANCELREMOVE
%EQUATE `CM_LOCATE_DEVINST_NOVALIDATION = %CM_LOCATE_DEVNODE_NOVALIDATION
%EQUATE `CM_LOCATE_DEVINST_BITS = %CM_LOCATE_DEVNODE_BITS
'//
'// Flags for CM_Open_Class_Key
'//
%EQUATE `CM_OPEN_CLASS_KEY_INSTALLER = &H00000000
%EQUATE `CM_OPEN_CLASS_KEY_INTERFACE = &H00000001
%EQUATE `CM_OPEN_CLASS_KEY_BITS = &H00000001
'//
'// Flags for CM_Query_And_Remove_SubTree
'//
%EQUATE `CM_REMOVE_UI_OK = &H00000000
%EQUATE `CM_REMOVE_UI_NOT_OK = &H00000001
%EQUATE `CM_REMOVE_NO_RESTART = &H00000002
%EQUATE `CM_REMOVE_BITS = &H00000003
'//
'// Backward compatibility--do not use
'// (use above CM_REMOVE_* flags instead)
'//
%EQUATE `CM_QUERY_REMOVE_UI_OK = %CM_REMOVE_UI_OK
%EQUATE `CM_QUERY_REMOVE_UI_NOT_OK = %CM_REMOVE_UI_NOT_OK
%EQUATE `CM_QUERY_REMOVE_BITS = %CM_QUERY_REMOVE_UI_OK OR %CM_QUERY_REMOVE_UI_NOT_OK
'//
'// Flags for CM_Reenumerate_DevNode
'//
%EQUATE `CM_REENUMERATE_NORMAL = &H00000000
%EQUATE `CM_REENUMERATE_SYNCHRONOUS = &H00000001
'#if (WINVER >= _WIN32_WINNT_WINXP)
%EQUATE `CM_REENUMERATE_RETRY_INSTALLATION = &H00000002
%EQUATE `CM_REENUMERATE_ASYNCHRONOUS = &H00000004
'#endif ' // (WINVER >= _WIN32_WINNT_WINXP)
%EQUATE `CM_REENUMERATE_BITS = &H00000007
'//
'// Flags for CM_Register_Device_Driver
'//
%EQUATE `CM_REGISTER_DEVICE_DRIVER_STATIC = &H00000000
%EQUATE `CM_REGISTER_DEVICE_DRIVER_DISABLEABLE = &H00000001
%EQUATE `CM_REGISTER_DEVICE_DRIVER_REMOVABLE = &H00000002
%EQUATE `CM_REGISTER_DEVICE_DRIVER_BITS = &H00000003
'//
'// Registry Branch Locations (for CM_Open_DevNode_Key???
'//
%EQUATE `CM_REGISTRY_HARDWARE = &H00000000
%EQUATE `CM_REGISTRY_SOFTWARE = &H00000001
%EQUATE `CM_REGISTRY_USER = &H00000100
%EQUATE `CM_REGISTRY_CONFIG = &H00000200
%EQUATE `CM_REGISTRY_BITS = &H00000301
'//
'// Flags for CM_Set_DevNode_Problem
'//
%EQUATE `CM_SET_DEVNODE_PROBLEM_NORMAL = &H00000000 ' // only set problem if currently no problem
%EQUATE `CM_SET_DEVNODE_PROBLEM_OVERRIDE = &H00000001 ' // override current problem with new problem
%EQUATE `CM_SET_DEVNODE_PROBLEM_BITS = &H00000001
%EQUATE `CM_SET_DEVINST_PROBLEM_NORMAL = %CM_SET_DEVNODE_PROBLEM_NORMAL
%EQUATE `CM_SET_DEVINST_PROBLEM_OVERRIDE = %CM_SET_DEVNODE_PROBLEM_OVERRIDE
%EQUATE `CM_SET_DEVINST_PROBLEM_BITS = %CM_SET_DEVNODE_PROBLEM_BITS
'//
'// Flags for CM_Set_HW_Prof_Flags
'//
%EQUATE `CM_SET_HW_PROF_FLAGS_UI_NOT_OK = &H00000001 ' // Don't popup any veto UI
%EQUATE `CM_SET_HW_PROF_FLAGS_BITS = &H00000001
'//
'// Re-enable and configuration actions (specified in call to CM_Setup_DevInst???
'//
%EQUATE `CM_SETUP_DEVNODE_READY = &H00000000 ' // Reenable problem devinst
%EQUATE `CM_SETUP_DEVINST_READY = %CM_SETUP_DEVNODE_READY
%EQUATE `CM_SETUP_DOWNLOAD = &H00000001 ' // Get info about devinst
%EQUATE `CM_SETUP_WRITE_LOG_CONFS = &H00000002
%EQUATE `CM_SETUP_PROP_CHANGE = &H00000003
'#if (WINVER >= _WIN32_WINNT_WINXP)
%EQUATE `CM_SETUP_DEVNODE_RESET = &H00000004 ' // Reset problem devinst without starting
%EQUATE `CM_SETUP_DEVINST_RESET = %CM_SETUP_DEVNODE_RESET
'#endif ' // (WINVER >= _WIN32_WINNT_WINXP)
%EQUATE `CM_SETUP_BITS = &H00000007
'//
'// Flags for CM_Query_Arbitrator_Free_Data and
'// CM_Query_Arbitrator_Free_Data_Size.
'//
%EQUATE `CM_QUERY_ARBITRATOR_RAW = &H00000000
%EQUATE `CM_QUERY_ARBITRATOR_TRANSLATED = &H00000001
%EQUATE `CM_QUERY_ARBITRATOR_BITS = &H00000001
'#if (WINVER >= _WIN32_WINNT_WINXP)
'//
'// Flags for CM_Get_DevNode_Custom_Property
'//
%EQUATE `CM_CUSTOMDEVPROP_MERGE_MULTISZ = &H00000001
%EQUATE `CM_CUSTOMDEVPROP_BITS = &H00000001
'#endif ' // (WINVER >= _WIN32_WINNT_WINXP)
'//
'// Name attribute bitmasks
'//
%EQUATE `CM_NAME_ATTRIBUTE_NAME_RETRIEVED_FROM_DEVICE = &H1
%EQUATE `CM_NAME_ATTRIBUTE_USER_ASSIGNED_NAME = &H2
'//--------------------------------------------------------------
'// Function prototypes
'//--------------------------------------------------------------
DECLARE FUNCTION CM_Add_Empty_Log_Conf LIB "setupapi.dll" ALIAS "CM_Add_Empty_Log_Conf" ( BYREF plcLogConf AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL Priority AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Add_Empty_Log_Conf_Ex LIB "setupapi.dll" ALIAS "CM_Add_Empty_Log_Conf_Ex" ( BYREF plcLogConf AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL Priority AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Add_IDA LIB "setupapi.dll" ALIAS "CM_Add_IDA" ( BYVAL dnDevInst AS QUAD , BYREF pszID AS ASCIIZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Add_IDW LIB "setupapi.dll" ALIAS "CM_Add_IDW" ( BYVAL dnDevInst AS QUAD , BYREF pszID AS WSTRINGZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Add_ID = CM_Add_IDW
#ELSE
MACRO CM_Add_ID = CM_Add_IDA
#ENDIF
DECLARE FUNCTION CM_Add_ID_ExA LIB "setupapi.dll" ALIAS "CM_Add_ID_ExA" ( BYVAL dnDevInst AS QUAD , BYREF pszID AS ASCIIZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Add_ID_ExW LIB "setupapi.dll" ALIAS "CM_Add_ID_ExW" ( BYVAL dnDevInst AS QUAD , BYREF pszID AS WSTRINGZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Add_ID_Ex = CM_Add_ID_ExW
#ELSE
MACRO CM_Add_ID_Ex = CM_Add_ID_ExA
#ENDIF
DECLARE FUNCTION CM_Add_Range LIB "setupapi.dll" ALIAS "CM_Add_Range" ( BYVAL ullStartValue AS QUAD , BYVAL ullEndValue AS QUAD , BYVAL rlh AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Add_Res_Des LIB "setupapi.dll" ALIAS "CM_Add_Res_Des" ( BYREF prdResDes AS QUAD , BYVAL lcLogConf AS QUAD , BYVAL ResourceID AS QUAD , BYREF ResourceData AS ANY , BYVAL ResourceLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Add_Res_Des_Ex LIB "setupapi.dll" ALIAS "CM_Add_Res_Des_Ex" ( BYREF prdResDes AS QUAD , BYVAL lcLogConf AS QUAD , BYVAL ResourceID AS QUAD , BYREF ResourceData AS ANY , BYVAL ResourceLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Connect_MachineA LIB "setupapi.dll" ALIAS "CM_Connect_MachineA" ( BYREF UNCServerName AS ASCIIZ , BYREF hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Connect_MachineW LIB "setupapi.dll" ALIAS "CM_Connect_MachineW" ( BYREF UNCServerName AS WSTRINGZ , BYREF hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Connect_Machine = CM_Connect_MachineW
#ELSE
MACRO CM_Connect_Machine = CM_Connect_MachineA
#ENDIF
DECLARE FUNCTION CM_Create_DevNodeA LIB "setupapi.dll" ALIAS "CM_Create_DevNodeA" ( BYREF pdnDevInst AS QUAD , BYREF pDeviceID AS ASCIIZ , BYVAL dnParent AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Create_DevNodeW LIB "setupapi.dll" ALIAS "CM_Create_DevNodeW" ( BYREF pdnDevInst AS QUAD , BYVAL pDeviceID AS QUAD , BYVAL dnParent AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Create_DevNode = CM_Create_DevNodeW
#ELSE
MACRO CM_Create_DevNode = CM_Create_DevNodeA
#ENDIF
DECLARE FUNCTION CM_Create_DevNode_ExA LIB "setupapi.dll" ALIAS "CM_Create_DevNode_ExA" ( BYREF pdnDevInst AS QUAD , BYREF pDeviceID AS ASCIIZ , BYVAL dnParent AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Create_DevNode_ExW LIB "setupapi.dll" ALIAS "CM_Create_DevNode_ExW" ( BYREF pdnDevInst AS QUAD , BYVAL pDeviceID AS QUAD , BYVAL dnParent AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Create_DevNode_Ex = CM_Create_DevNode_ExW
#ELSE
MACRO CM_Create_DevNode_Ex = CM_Create_DevNode_ExA
#ENDIF
DECLARE FUNCTION CM_Create_Range_List LIB "setupapi.dll" ALIAS "CM_Create_Range_List" ( BYREF prlh AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Delete_Class_Key LIB "setupapi.dll" ALIAS "CM_Delete_Class_Key" ( BYREF ClassGuid AS GUID , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Delete_Class_Key_Ex LIB "setupapi.dll" ALIAS "CM_Delete_Class_Key_Ex" ( BYREF ClassGuid AS GUID , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Delete_DevNode_Key LIB "setupapi.dll" ALIAS "CM_Delete_DevNode_Key" ( BYVAL dnDevNode AS QUAD , BYVAL ulHardwareProfile AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Delete_DevNode_Key_Ex LIB "setupapi.dll" ALIAS "CM_Delete_DevNode_Key_Ex" ( BYVAL dnDevNode AS QUAD , BYVAL ulHardwareProfile AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Delete_Range LIB "setupapi.dll" ALIAS "CM_Delete_Range" ( BYVAL ullStartValue AS QUAD , BYVAL ullEndValue AS QUAD , BYVAL rlh AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Detect_Resource_Conflict LIB "setupapi.dll" ALIAS "CM_Detect_Resource_Conflict" ( BYVAL dnDevInst AS QUAD , BYVAL ResourceID AS QUAD , BYREF ResourceData AS ANY , BYVAL ResourceLen AS QUAD , BYREF pbConflictDetected AS LONG , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Detect_Resource_Conflict_Ex LIB "setupapi.dll" ALIAS "CM_Detect_Resource_Conflict_Ex" ( BYVAL dnDevInst AS QUAD , BYVAL ResourceID AS QUAD , BYREF ResourceData AS ANY , BYVAL ResourceLen AS QUAD , BYREF pbConflictDetected AS LONG , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Disable_DevNode LIB "setupapi.dll" ALIAS "CM_Disable_DevNode" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Disable_DevNode_Ex LIB "setupapi.dll" ALIAS "CM_Disable_DevNode_Ex" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Disconnect_Machine LIB "setupapi.dll" ALIAS "CM_Disconnect_Machine" ( OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Dup_Range_List LIB "setupapi.dll" ALIAS "CM_Dup_Range_List" ( BYVAL rlhOld AS QUAD , BYVAL rlhNew AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Enable_DevNode LIB "setupapi.dll" ALIAS "CM_Enable_DevNode" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Enable_DevNode_Ex LIB "setupapi.dll" ALIAS "CM_Enable_DevNode_Ex" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Enumerate_Classes LIB "setupapi.dll" ALIAS "CM_Enumerate_Classes" ( BYVAL ulClassIndex AS QUAD , BYREF ClassGuid AS GUID , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Enumerate_Classes_Ex LIB "setupapi.dll" ALIAS "CM_Enumerate_Classes_Ex" ( BYVAL ulClassIndex AS QUAD , BYREF ClassGuid AS GUID , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Enumerate_EnumeratorsA LIB "setupapi.dll" ALIAS "CM_Enumerate_EnumeratorsA" ( BYVAL ulEnumIndex AS QUAD , BYREF Buffer AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Enumerate_EnumeratorsW LIB "setupapi.dll" ALIAS "CM_Enumerate_EnumeratorsW" ( BYVAL ulEnumIndex AS QUAD , BYREF Buffer AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Enumerate_Enumerators = CM_Enumerate_EnumeratorsW
#ELSE
MACRO CM_Enumerate_Enumerators = CM_Enumerate_EnumeratorsA
#ENDIF
DECLARE FUNCTION CM_Enumerate_Enumerators_ExA LIB "setupapi.dll" ALIAS "CM_Enumerate_Enumerators_ExA" ( BYVAL ulEnumIndex AS QUAD , BYREF Buffer AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Enumerate_Enumerators_ExW LIB "setupapi.dll" ALIAS "CM_Enumerate_Enumerators_ExW" ( BYVAL ulEnumIndex AS QUAD , BYREF Buffer AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Enumerate_Enumerators_Ex = CM_Enumerate_Enumerators_ExW
#ELSE
MACRO CM_Enumerate_Enumerators_Ex = CM_Enumerate_Enumerators_ExA
#ENDIF
DECLARE FUNCTION CM_Find_Range LIB "setupapi.dll" ALIAS "CM_Find_Range" ( BYREF pullStart AS QUAD , BYVAL ullStart AS QUAD , BYVAL ulLength AS QUAD , BYVAL ullAlignment AS QUAD , BYVAL ullEnd AS QUAD , BYVAL rlh AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_First_Range LIB "setupapi.dll" ALIAS "CM_First_Range" ( BYVAL rlh AS QUAD , BYREF pullStart AS QUAD , BYREF pullEnd AS QUAD , BYREF preElement AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Free_Log_Conf LIB "setupapi.dll" ALIAS "CM_Free_Log_Conf" ( BYVAL lcLogConfToBeFreed AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Free_Log_Conf_Ex LIB "setupapi.dll" ALIAS "CM_Free_Log_Conf_Ex" ( BYVAL lcLogConfToBeFreed AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Free_Log_Conf_Handle LIB "setupapi.dll" ALIAS "CM_Free_Log_Conf_Handle" ( BYVAL lcLogConf AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Free_Range_List LIB "setupapi.dll" ALIAS "CM_Free_Range_List" ( BYVAL rlh AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Free_Res_Des LIB "setupapi.dll" ALIAS "CM_Free_Res_Des" ( BYREF prdResDes AS QUAD , BYVAL rdResDes AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Free_Res_Des_Ex LIB "setupapi.dll" ALIAS "CM_Free_Res_Des_Ex" ( BYREF prdResDes AS QUAD , BYVAL rdResDes AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Free_Res_Des_Handle LIB "setupapi.dll" ALIAS "CM_Free_Res_Des_Handle" ( BYVAL rdResDes AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Child LIB "setupapi.dll" ALIAS "CM_Get_Child" ( BYREF pdnDevInst AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Child_Ex LIB "setupapi.dll" ALIAS "CM_Get_Child_Ex" ( BYREF pdnDevInst AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Class_NameA LIB "setupapi.dll" ALIAS "CM_Get_Class_NameA" ( BYREF ClassGuid AS GUID , BYREF Buffer AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Class_NameW LIB "setupapi.dll" ALIAS "CM_Get_Class_NameW" ( BYREF ClassGuid AS GUID , BYREF Buffer AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Class_Name = CM_Get_Class_NameW
#ELSE
MACRO CM_Get_Class_Name = CM_Get_Class_NameA
#ENDIF
DECLARE FUNCTION CM_Get_Class_Name_ExA LIB "setupapi.dll" ALIAS "CM_Get_Class_Name_ExA" ( BYREF ClassGuid AS GUID , BYREF Buffer AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Class_Name_ExW LIB "setupapi.dll" ALIAS "CM_Get_Class_Name_ExW" ( BYREF ClassGuid AS GUID , BYREF Buffer AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Class_Name_Ex = CM_Get_Class_Name_ExW
#ELSE
MACRO CM_Get_Class_Name_Ex = CM_Get_Class_Name_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Class_Key_NameA LIB "setupapi.dll" ALIAS "CM_Get_Class_Key_NameA" ( BYREF ClassGuid AS GUID , BYREF pszKeyName AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Class_Key_NameW LIB "setupapi.dll" ALIAS "CM_Get_Class_Key_NameW" ( BYREF ClassGuid AS GUID , BYREF pszKeyName AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Class_Key_Name = CM_Get_Class_Key_NameW
#ELSE
MACRO CM_Get_Class_Key_Name = CM_Get_Class_Key_NameA
#ENDIF
DECLARE FUNCTION CM_Get_Class_Key_Name_ExA LIB "setupapi.dll" ALIAS "CM_Get_Class_Key_Name_ExA" ( BYREF ClassGuid AS GUID , BYREF pszKeyName AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Class_Key_Name_ExW LIB "setupapi.dll" ALIAS "CM_Get_Class_Key_Name_ExW" ( BYREF ClassGuid AS GUID , BYREF pszKeyName AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Class_Key_Name_Ex = CM_Get_Class_Key_Name_ExW
#ELSE
MACRO CM_Get_Class_Key_Name_Ex = CM_Get_Class_Key_Name_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Depth LIB "setupapi.dll" ALIAS "CM_Get_Depth" ( BYREF pulDepth AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Depth_Ex LIB "setupapi.dll" ALIAS "CM_Get_Depth_Ex" ( BYREF pulDepth AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_IDA LIB "setupapi.dll" ALIAS "CM_Get_Device_IDA" ( BYVAL dnDevInst AS QUAD , BYREF Buffer AS ASCIIZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_IDW LIB "setupapi.dll" ALIAS "CM_Get_Device_IDW" ( BYVAL dnDevInst AS QUAD , BYREF Buffer AS WSTRINGZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_ID = CM_Get_Device_IDW
#ELSE
MACRO CM_Get_Device_ID = CM_Get_Device_IDA
#ENDIF
DECLARE FUNCTION CM_Get_Device_ID_ExA LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_ExA" ( BYVAL dnDevInst AS QUAD , BYREF Buffer AS ASCIIZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_ID_ExW LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_ExW" ( BYVAL dnDevInst AS QUAD , BYREF Buffer AS WSTRINGZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_ID_Ex = CM_Get_Device_ID_ExW
#ELSE
MACRO CM_Get_Device_ID_Ex = CM_Get_Device_ID_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Device_ID_ListA LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_ListA" ( BYREF pszFilter AS ASCIIZ , BYREF Buffer AS ASCIIZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_ID_ListW LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_ListW" ( BYREF pszFilter AS WSTRINGZ , BYREF Buffer AS WSTRINGZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_ID_List = CM_Get_Device_ID_ListW
#ELSE
MACRO CM_Get_Device_ID_List = CM_Get_Device_ID_ListA
#ENDIF
DECLARE FUNCTION CM_Get_Device_ID_List_ExA LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_List_ExA" ( BYREF pszFilter AS ASCIIZ , BYREF Buffer AS ASCIIZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_ID_List_ExW LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_List_ExW" ( BYREF pszFilter AS WSTRINGZ , BYREF Buffer AS WSTRINGZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_ID_List_Ex = CM_Get_Device_ID_List_ExW
#ELSE
MACRO CM_Get_Device_ID_List_Ex = CM_Get_Device_ID_List_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Device_ID_List_SizeA LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_List_SizeA" ( BYREF pulLen AS QUAD , BYREF pszFilter AS ASCIIZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_ID_List_SizeW LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_List_SizeW" ( BYREF pulLen AS QUAD , BYREF pszFilter AS WSTRINGZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_ID_List_Size = CM_Get_Device_ID_List_SizeW
#ELSE
MACRO CM_Get_Device_ID_List_Size = CM_Get_Device_ID_List_SizeA
#ENDIF
DECLARE FUNCTION CM_Get_Device_ID_List_Size_ExA LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_List_Size_ExA" ( BYREF pulLen AS QUAD , BYREF pszFilter AS ASCIIZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_ID_List_Size_ExW LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_List_Size_ExW" ( BYREF pulLen AS QUAD , BYREF pszFilter AS WSTRINGZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_ID_List_Size_Ex = CM_Get_Device_ID_List_Size_ExW
#ELSE
MACRO CM_Get_Device_ID_List_Size_Ex = CM_Get_Device_ID_List_Size_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Device_ID_Size LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_Size" ( BYREF pulLen AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_ID_Size_Ex LIB "setupapi.dll" ALIAS "CM_Get_Device_ID_Size_Ex" ( BYREF pulLen AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_DevNode_Registry_PropertyA LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Registry_PropertyA" ( BYVAL dnDevInst AS QUAD , BYVAL ulProperty AS QUAD , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_DevNode_Registry_PropertyW LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Registry_PropertyW" ( BYVAL dnDevInst AS QUAD , BYVAL ulProperty AS QUAD , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_DevNode_Registry_Property = CM_Get_DevNode_Registry_PropertyW
#ELSE
MACRO CM_Get_DevNode_Registry_Property = CM_Get_DevNode_Registry_PropertyA
#ENDIF
DECLARE FUNCTION CM_Get_DevNode_Registry_Property_ExA LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Registry_Property_ExA" ( BYVAL dnDevInst AS QUAD , BYVAL ulProperty AS QUAD , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_DevNode_Registry_Property_ExW LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Registry_Property_ExW" ( BYVAL dnDevInst AS QUAD , BYVAL ulProperty AS QUAD , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_DevNode_Registry_Property_Ex = CM_Get_DevNode_Registry_Property_ExW
#ELSE
MACRO CM_Get_DevNode_Registry_Property_Ex = CM_Get_DevNode_Registry_Property_ExA
#ENDIF
'#if (WINVER >= _WIN32_WINNT_WINXP)
DECLARE FUNCTION CM_Get_DevNode_Custom_PropertyA LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Custom_PropertyA" ( BYVAL dnDevInst AS QUAD , BYREF pszCustomPropertyName AS ASCIIZ , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_DevNode_Custom_PropertyW LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Custom_PropertyW" ( BYVAL dnDevInst AS QUAD , BYREF pszCustomPropertyName AS WSTRINGZ , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_DevNode_Custom_Property = CM_Get_DevNode_Custom_PropertyW
#ELSE
MACRO CM_Get_DevNode_Custom_Property = CM_Get_DevNode_Custom_PropertyA
#ENDIF
DECLARE FUNCTION CM_Get_DevNode_Custom_Property_ExA LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Custom_Property_ExA" ( BYVAL dnDevInst AS QUAD , BYREF pszCustomPropertyName AS ASCIIZ , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_DevNode_Custom_Property_ExW LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Custom_Property_ExW" ( BYVAL dnDevInst AS QUAD , BYREF pszCustomPropertyName AS WSTRINGZ , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_DevNode_Custom_Property_Ex = CM_Get_DevNode_Custom_Property_ExW
#ELSE
MACRO CM_Get_DevNode_Custom_Property_Ex = CM_Get_DevNode_Custom_Property_ExA
#ENDIF
'#endif // (WINVER >= _WIN32_WINNT_WINXP)
DECLARE FUNCTION CM_Get_DevNode_Status LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Status" ( BYREF pulStatus AS QUAD , BYREF pulProblemNumber AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_DevNode_Status_Ex LIB "setupapi.dll" ALIAS "CM_Get_DevNode_Status_Ex" ( BYREF pulStatus AS QUAD , BYREF pulProblemNumber AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_First_Log_Conf LIB "setupapi.dll" ALIAS "CM_Get_First_Log_Conf" ( BYREF plcLogConf AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_First_Log_Conf_Ex LIB "setupapi.dll" ALIAS "CM_Get_First_Log_Conf_Ex" ( BYREF plcLogConf AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Global_State LIB "setupapi.dll" ALIAS "CM_Get_Global_State" ( BYREF pulState AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Global_State_Ex LIB "setupapi.dll" ALIAS "CM_Get_Global_State_Ex" ( BYREF pulState AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
%EQUATE `CM_GLOBAL_STATE_CAN_DO_UI = &H00000001 ' // Can do UI
%EQUATE `CM_GLOBAL_STATE_ON_BIG_STACK = &H00000002 ' // Not used (reserved)
%EQUATE `CM_GLOBAL_STATE_SERVICES_AVAILABLE = &H00000004 ' // CM APIs available?
%EQUATE `CM_GLOBAL_STATE_SHUTTING_DOWN = &H00000008 ' // CM shutting down
%EQUATE `CM_GLOBAL_STATE_DETECTION_PENDING = &H00000010 ' // Not used (reserved)
'#if (WINVER >= _WIN32_WINNT_WIN7)
%EQUATE `CM_GLOBAL_STATE_REBOOT_REQUIRED = &H00000020 ' // system reboot is required
'#endif // (WINVER >= _WIN32_WINNT_WIN7)
DECLARE FUNCTION CM_Get_Hardware_Profile_InfoA LIB "setupapi.dll" ALIAS "CM_Get_Hardware_Profile_InfoA" ( BYVAL ulIndex AS QUAD , BYREF pHWProfileInfo AS HWPROFILEINFO_A , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Hardware_Profile_InfoW LIB "setupapi.dll" ALIAS "CM_Get_Hardware_Profile_InfoW" ( BYVAL ulIndex AS QUAD , BYREF pHWProfileInfo AS HWPROFILEINFO_W , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Hardware_Profile_Info = CM_Get_Hardware_Profile_InfoW
#ELSE
MACRO CM_Get_Hardware_Profile_Info = CM_Get_Hardware_Profile_InfoA
#ENDIF
DECLARE FUNCTION CM_Get_Hardware_Profile_Info_ExA LIB "setupapi.dll" ALIAS "CM_Get_Hardware_Profile_Info_ExA" ( BYVAL ulIndex AS QUAD , BYREF pHWProfileInfo AS HWPROFILEINFO_A , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Hardware_Profile_Info_ExW LIB "setupapi.dll" ALIAS "CM_Get_Hardware_Profile_Info_ExW" ( BYVAL ulIndex AS QUAD , BYREF pHWProfileInfo AS HWPROFILEINFO_W , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Hardware_Profile_Info_Ex = CM_Get_Hardware_Profile_Info_ExW
#ELSE
MACRO CM_Get_Hardware_Profile_Info_Ex = CM_Get_Hardware_Profile_Info_ExA
#ENDIF
DECLARE FUNCTION CM_Get_HW_Prof_FlagsA LIB "setupapi.dll" ALIAS "CM_Get_HW_Prof_FlagsA" ( BYREF pDeviceID AS ASCIIZ , BYVAL ulHardwareProfile AS QUAD , BYREF pulValue AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_HW_Prof_FlagsW LIB "setupapi.dll" ALIAS "CM_Get_HW_Prof_FlagsW" ( BYVAL pDeviceID AS QUAD , BYVAL ulHardwareProfile AS QUAD , BYREF pulValue AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_HW_Prof_Flags = CM_Get_HW_Prof_FlagsW
#ELSE
MACRO CM_Get_HW_Prof_Flags = CM_Get_HW_Prof_FlagsA
#ENDIF
DECLARE FUNCTION CM_Get_HW_Prof_Flags_ExA LIB "setupapi.dll" ALIAS "CM_Get_HW_Prof_Flags_ExA" ( BYREF pDeviceID AS ASCIIZ , BYVAL ulHardwareProfile AS QUAD , BYREF pulValue AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_HW_Prof_Flags_ExW LIB "setupapi.dll" ALIAS "CM_Get_HW_Prof_Flags_ExW" ( BYVAL pDeviceID AS QUAD , BYVAL ulHardwareProfile AS QUAD , BYREF pulValue AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_HW_Prof_Flags_Ex = CM_Get_HW_Prof_Flags_ExW
#ELSE
MACRO CM_Get_HW_Prof_Flags_Ex = CM_Get_HW_Prof_Flags_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Device_Interface_AliasA LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_AliasA" ( BYREF pszDeviceInterface AS ASCIIZ , BYREF AliasInterfaceGuid AS GUID , BYREF pszAliasDeviceInterface AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_Interface_AliasW LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_AliasW" ( BYREF pszDeviceInterface AS WSTRINGZ , BYREF AliasInterfaceGuid AS GUID , BYREF pszAliasDeviceInterface AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_Interface_Alias = CM_Get_Device_Interface_AliasW
#ELSE
MACRO CM_Get_Device_Interface_Alias = CM_Get_Device_Interface_AliasA
#ENDIF
DECLARE FUNCTION CM_Get_Device_Interface_Alias_ExA LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_Alias_ExA" ( BYREF pszDeviceInterface AS ASCIIZ , BYREF AliasInterfaceGuid AS GUID , BYREF pszAliasDeviceInterface AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_Interface_Alias_ExW LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_Alias_ExW" ( BYREF pszDeviceInterface AS WSTRINGZ , BYREF AliasInterfaceGuid AS GUID , BYREF pszAliasDeviceInterface AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_Interface_Alias_Ex = CM_Get_Device_Interface_Alias_ExW
#ELSE
MACRO CM_Get_Device_Interface_Alias_Ex = CM_Get_Device_Interface_Alias_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Device_Interface_ListA LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_ListA" ( BYREF InterfaceClassGuid AS GUID , BYREF pDeviceID AS ASCIIZ , BYREF Buffer AS ASCIIZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_Interface_ListW LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_ListW" ( BYREF InterfaceClassGuid AS GUID , BYVAL pDeviceID AS QUAD , BYREF Buffer AS WSTRINGZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_Interface_List = CM_Get_Device_Interface_ListW
#ELSE
MACRO CM_Get_Device_Interface_List = CM_Get_Device_Interface_ListA
#ENDIF
DECLARE FUNCTION CM_Get_Device_Interface_List_ExA LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_List_ExA" ( BYREF InterfaceClassGuid AS GUID , BYREF pDeviceID AS ASCIIZ , BYREF Buffer AS ASCIIZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_Interface_List_ExW LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_List_ExW" ( BYREF InterfaceClassGuid AS GUID , BYVAL pDeviceID AS QUAD , BYREF Buffer AS WSTRINGZ , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_Interface_List_Ex = CM_Get_Device_Interface_List_ExW
#ELSE
MACRO CM_Get_Device_Interface_List_Ex = CM_Get_Device_Interface_List_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Device_Interface_List_SizeA LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_List_SizeA" ( BYREF pulLen AS QUAD , BYREF InterfaceClassGuid AS GUID , BYREF pDeviceID AS ASCIIZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_Interface_List_SizeW LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_List_SizeW" ( BYREF pulLen AS QUAD , BYREF InterfaceClassGuid AS GUID , BYVAL pDeviceID AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_Interface_List_Size = CM_Get_Device_Interface_List_SizeW
#ELSE
MACRO CM_Get_Device_Interface_List_Size = CM_Get_Device_Interface_List_SizeA
#ENDIF
DECLARE FUNCTION CM_Get_Device_Interface_List_Size_ExA LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_List_Size_ExA" ( BYREF pulLen AS QUAD , BYREF InterfaceClassGuid AS GUID , BYREF pDeviceID AS ASCIIZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Device_Interface_List_Size_ExW LIB "setupapi.dll" ALIAS "CM_Get_Device_Interface_List_Size_ExW" ( BYREF pulLen AS QUAD , BYREF InterfaceClassGuid AS GUID , BYVAL pDeviceID AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Device_Interface_List_Size_Ex = CM_Get_Device_Interface_List_Size_ExW
#ELSE
MACRO CM_Get_Device_Interface_List_Size_Ex = CM_Get_Device_Interface_List_Size_ExA
#ENDIF
DECLARE FUNCTION CM_Get_Log_Conf_Priority LIB "setupapi.dll" ALIAS "CM_Get_Log_Conf_Priority" ( BYVAL lcLogConf AS QUAD , BYREF pPriority AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Log_Conf_Priority_Ex LIB "setupapi.dll" ALIAS "CM_Get_Log_Conf_Priority_Ex" ( BYVAL lcLogConf AS QUAD , BYREF pPriority AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Next_Log_Conf LIB "setupapi.dll" ALIAS "CM_Get_Next_Log_Conf" ( BYREF plcLogConf AS QUAD , BYVAL lcLogConf AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Next_Log_Conf_Ex LIB "setupapi.dll" ALIAS "CM_Get_Next_Log_Conf_Ex" ( BYREF plcLogConf AS QUAD , BYVAL lcLogConf AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Parent LIB "setupapi.dll" ALIAS "CM_Get_Parent" ( BYREF pdnDevInst AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Parent_Ex LIB "setupapi.dll" ALIAS "CM_Get_Parent_Ex" ( BYREF pdnDevInst AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Res_Des_Data LIB "setupapi.dll" ALIAS "CM_Get_Res_Des_Data" ( BYREF rdResDes AS QUAD , BYREF Buffer AS ANY , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Res_Des_Data_Ex LIB "setupapi.dll" ALIAS "CM_Get_Res_Des_Data_Ex" ( BYREF rdResDes AS QUAD , BYREF Buffer AS ANY , BYVAL BufferLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Res_Des_Data_Size LIB "setupapi.dll" ALIAS "CM_Get_Res_Des_Data_Size" ( BYREF pulSize AS QUAD , BYVAL rdResDes AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Res_Des_Data_Size_Ex LIB "setupapi.dll" ALIAS "CM_Get_Res_Des_Data_Size_Ex" ( BYREF pulSize AS QUAD , BYVAL rdResDes AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Sibling LIB "setupapi.dll" ALIAS "CM_Get_Sibling" ( BYREF pdnDevInst AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Sibling_Ex LIB "setupapi.dll" ALIAS "CM_Get_Sibling_Ex" ( BYREF pdnDevInst AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Version LIB "setupapi.dll" ALIAS "CM_Get_Version" ( ) AS WORD ' WORD
DECLARE FUNCTION CM_Get_Version_Ex LIB "setupapi.dll" ALIAS "CM_Get_Version_Ex" ( OPTIONAL BYVAL hMachine AS QUAD ) AS WORD ' WORD
'#if (WINVER >= _WIN32_WINNT_WINXP)
DECLARE FUNCTION CM_Is_Version_Available LIB "setupapi.dll" ALIAS "CM_Is_Version_Available" ( BYVAL wVersion AS WORD ) AS LONG
DECLARE FUNCTION CM_Is_Version_Available_Ex LIB "setupapi.dll" ALIAS "CM_Is_Version_Available_Ex" ( BYVAL wVersion AS WORD
 , OPTIONAL BYVAL hMachine AS DWORD
 ) AS LONG
'#endif // (WINVER >= _WIN32_WINNT_WINXP)
DECLARE FUNCTION CM_Intersect_Range_List LIB "setupapi.dll" ALIAS "CM_Intersect_Range_List" ( BYVAL rlhOld1 AS QUAD , BYVAL rlhOld2 AS QUAD , BYVAL rlhNew AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Invert_Range_List LIB "setupapi.dll" ALIAS "CM_Invert_Range_List" ( BYVAL rlhOld AS QUAD , BYVAL rlhNew AS QUAD , BYVAL ullMaxValue AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Locate_DevNodeA LIB "setupapi.dll" ALIAS "CM_Locate_DevNodeA" ( BYVAL pdnDevInst AS QUAD , BYREF pDeviceID AS ASCIIZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Locate_DevNodeW LIB "setupapi.dll" ALIAS "CM_Locate_DevNodeW" ( BYVAL pdnDevInst AS QUAD , BYVAL pDeviceID AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Locate_DevNode = CM_Locate_DevNodeW
#ELSE
MACRO CM_Locate_DevNode = CM_Locate_DevNodeA
#ENDIF
DECLARE FUNCTION CM_Locate_DevNode_ExA LIB "setupapi.dll" ALIAS "CM_Locate_DevNode_ExA" ( BYVAL pdnDevInst AS QUAD , BYREF pDeviceID AS ASCIIZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Locate_DevNode_ExW LIB "setupapi.dll" ALIAS "CM_Locate_DevNode_ExW" ( BYVAL pdnDevInst AS QUAD , BYVAL pDeviceID AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Locate_DevNode_Ex = CM_Locate_DevNode_ExW
#ELSE
MACRO CM_Locate_DevNode_Ex = CM_Locate_DevNode_ExA
#ENDIF
DECLARE FUNCTION CM_Merge_Range_List LIB "setupapi.dll" ALIAS "CM_Merge_Range_List" ( BYVAL rlhOld1 AS QUAD , BYVAL rlhOld2 AS QUAD , BYVAL rlhNew AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Modify_Res_Des LIB "setupapi.dll" ALIAS "CM_Modify_Res_Des" ( BYREF prdResDes AS QUAD , BYVAL rdResDes AS QUAD , BYVAL ResourceID AS QUAD , BYREF ResourceData AS ANY , BYVAL ResourceLen AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Modify_Res_Des_Ex LIB "setupapi.dll" ALIAS "CM_Modify_Res_Des_Ex" ( BYREF prdResDes AS QUAD , BYVAL rdResDes AS QUAD , BYVAL ResourceID AS QUAD , BYREF ResourceData AS ANY , BYVAL ResourceLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Move_DevNode LIB "setupapi.dll" ALIAS "CM_Move_DevNode" ( BYVAL dnFromDevInst AS QUAD , BYVAL dnToDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Move_DevNode_Ex LIB "setupapi.dll" ALIAS "CM_Move_DevNode_Ex" ( BYVAL dnFromDevInst AS QUAD , BYVAL dnToDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Next_Range LIB "setupapi.dll" ALIAS "CM_Next_Range" ( BYREF preElement AS QUAD , BYREF pullStart AS QUAD , BYREF pullEnd AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Next_Res_Des LIB "setupapi.dll" ALIAS "CM_Get_Next_Res_Des" ( BYREF prdResDes AS QUAD , BYVAL rdResDes AS QUAD , BYVAL ForResource AS QUAD , BYREF pResourceID AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Next_Res_Des_Ex LIB "setupapi.dll" ALIAS "CM_Get_Next_Res_Des_Ex" ( BYREF prdResDes AS QUAD , BYVAL rdResDes AS QUAD , BYVAL ForResource AS QUAD , BYREF pResourceID AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Open_Class_KeyA LIB "setupapi.dll" ALIAS "CM_Open_Class_KeyA" ( BYREF ClassGuid AS GUID , BYREF pszClassName AS ASCIIZ , BYVAL samDesired AS REGSAM , BYVAL Disposition AS QUAD , BYREF phkClass AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Open_Class_KeyW LIB "setupapi.dll" ALIAS "CM_Open_Class_KeyW" ( BYREF ClassGuid AS GUID , BYREF pszClassName AS WSTRINGZ , BYVAL samDesired AS REGSAM , BYVAL Disposition AS QUAD , BYREF phkClass AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Open_Class_Key = CM_Open_Class_KeyW
#ELSE
MACRO CM_Open_Class_Key = CM_Open_Class_KeyA
#ENDIF
DECLARE FUNCTION CM_Open_Class_Key_ExA LIB "setupapi.dll" ALIAS "CM_Open_Class_Key_ExA" ( BYREF ClassGuid AS GUID , BYREF pszClassName AS ASCIIZ , BYVAL samDesired AS REGSAM , BYVAL Disposition AS QUAD , BYREF phkClass AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Open_Class_Key_ExW LIB "setupapi.dll" ALIAS "CM_Open_Class_Key_ExW" ( BYREF ClassGuid AS GUID , BYREF pszClassName AS WSTRINGZ , BYVAL samDesired AS REGSAM , BYVAL Disposition AS QUAD , BYREF phkClass AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Open_Class_Key_Ex = CM_Open_Class_Key_ExW
#ELSE
MACRO CM_Open_Class_Key_Ex = CM_Open_Class_Key_ExA
#ENDIF
DECLARE FUNCTION CM_Open_DevNode_Key LIB "setupapi.dll" ALIAS "CM_Open_DevNode_Key" ( BYVAL dnDevNode AS QUAD , BYVAL samDesired AS REGSAM , BYVAL ulHardwareProfile AS QUAD , BYVAL Disposition AS QUAD , BYREF phkDevice AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Open_DevNode_Key_Ex LIB "setupapi.dll" ALIAS "CM_Open_DevNode_Key_Ex" ( BYVAL dnDevNode AS QUAD , BYVAL samDesired AS REGSAM , BYVAL ulHardwareProfile AS QUAD , BYVAL Disposition AS QUAD , BYREF phkDevice AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
'#if (WINVER >= _WIN32_WINNT_LONGHORN)
DECLARE FUNCTION CM_Open_Device_Interface_KeyA LIB "setupapi.dll" ALIAS "CM_Open_Device_Interface_KeyA" ( BYREF pszDeviceInterface AS ASCIIZ , BYVAL samDesired AS REGSAM , BYVAL Disposition AS QUAD , BYREF phkDeviceInterface AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Open_Device_Interface_KeyW LIB "setupapi.dll" ALIAS "CM_Open_Device_Interface_KeyW" ( BYREF pszDeviceInterface AS WSTRINGZ , BYVAL samDesired AS REGSAM , BYVAL Disposition AS QUAD , BYREF phkDeviceInterface AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Open_Device_Interface_Key = CM_Open_Device_Interface_KeyW
#ELSE
MACRO CM_Open_Device_Interface_Key = CM_Open_Device_Interface_KeyA
#ENDIF
DECLARE FUNCTION CM_Open_Device_Interface_Key_ExA LIB "setupapi.dll" ALIAS "CM_Open_Device_Interface_Key_ExA" ( BYREF pszDeviceInterface AS ASCIIZ , BYVAL samDesired AS REGSAM , BYVAL Disposition AS QUAD , BYREF phkDeviceInterface AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Open_Device_Interface_Key_ExW LIB "setupapi.dll" ALIAS "CM_Open_Device_Interface_Key_ExW" ( BYREF pszDeviceInterface AS WSTRINGZ , BYVAL samDesired AS REGSAM , BYVAL Disposition AS QUAD , BYREF phkDeviceInterface AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Open_Device_Interface_Key_Ex = CM_Open_Device_Interface_Key_ExW
#ELSE
MACRO CM_Open_Device_Interface_Key_Ex = CM_Open_Device_Interface_Key_ExA
#ENDIF
DECLARE FUNCTION CM_Delete_Device_Interface_KeyA LIB "setupapi.dll" ALIAS "CM_Delete_Device_Interface_KeyA" ( BYREF pszDeviceInterface AS ASCIIZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Delete_Device_Interface_KeyW LIB "setupapi.dll" ALIAS "CM_Delete_Device_Interface_KeyW" ( BYREF pszDeviceInterface AS WSTRINGZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Delete_Device_Interface_Key = CM_Delete_Device_Interface_KeyW
#ELSE
MACRO CM_Delete_Device_Interface_Key = CM_Delete_Device_Interface_KeyA
#ENDIF
DECLARE FUNCTION CM_Delete_Device_Interface_Key_ExA LIB "setupapi.dll" ALIAS "CM_Delete_Device_Interface_Key_ExA" ( BYREF pszDeviceInterface AS ASCIIZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Delete_Device_Interface_Key_ExW LIB "setupapi.dll" ALIAS "CM_Delete_Device_Interface_Key_ExW" ( BYREF pszDeviceInterface AS WSTRINGZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Delete_Device_Interface_Key_Ex = CM_Delete_Device_Interface_Key_ExW
#ELSE
MACRO CM_Delete_Device_Interface_Key_Ex = CM_Delete_Device_Interface_Key_ExA
#ENDIF
'#endif // (WINVER >= _WIN32_WINNT_LONGHORN)
DECLARE FUNCTION CM_Query_Arbitrator_Free_Data LIB "setupapi.dll" ALIAS "CM_Query_Arbitrator_Free_Data" ( BYREF pData AS ANY , BYVAL DataLen AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ResourceID AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_Arbitrator_Free_Data_Ex LIB "setupapi.dll" ALIAS "CM_Query_Arbitrator_Free_Data_Ex" ( BYREF pData AS ANY , BYVAL DataLen AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ResourceID AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_Arbitrator_Free_Size LIB "setupapi.dll" ALIAS "CM_Query_Arbitrator_Free_Size" ( BYREF pulSize AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ResourceID AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_Arbitrator_Free_Size_Ex LIB "setupapi.dll" ALIAS "CM_Query_Arbitrator_Free_Size_Ex" ( BYREF pulSize AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ResourceID AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_Remove_SubTree LIB "setupapi.dll" ALIAS "CM_Query_Remove_SubTree" ( BYVAL dnAncestor AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_Remove_SubTree_Ex LIB "setupapi.dll" ALIAS "CM_Query_Remove_SubTree_Ex" ( BYVAL dnAncestor AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_And_Remove_SubTree LIB "setupapi.dll" ALIAS "CM_Query_And_Remove_SubTreeA" ( BYVAL dnAncestor AS QUAD , BYREF pVetoType AS LONG , BYREF pszVetoName AS ASCIIZ , BYVAL ulNameLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_And_Remove_SubTree_ExA LIB "setupapi.dll" ALIAS "CM_Query_And_Remove_SubTree_ExA" ( BYVAL dnAncestor AS QUAD , BYREF pVetoType AS LONG , BYREF pszVetoName AS ASCIIZ , BYVAL ulNameLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_And_Remove_SubTreeW LIB "setupapi.dll" ALIAS "CM_Query_And_Remove_SubTreeW" ( BYVAL dnAncestor AS QUAD , BYREF pVetoType AS LONG , BYREF pszVetoName AS WSTRINGZ , BYVAL ulNameLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_And_Remove_SubTree_ExW LIB "setupapi.dll" ALIAS "CM_Query_And_Remove_SubTree_ExW" ( BYVAL dnAncestor AS QUAD , BYREF pVetoType AS LONG , BYREF pszVetoName AS WSTRINGZ , BYVAL ulNameLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Query_And_Remove_SubTree_Ex = CM_Query_And_Remove_SubTree_ExW
#ELSE
MACRO CM_Query_And_Remove_SubTree_Ex = CM_Query_And_Remove_SubTree_ExA
#ENDIF
DECLARE FUNCTION CM_Request_Device_EjectA LIB "setupapi.dll" ALIAS "CM_Request_Device_EjectA" ( BYVAL dnDevInst AS QUAD , BYREF pVetoType AS LONG , BYREF pszVetoName AS ASCIIZ , BYVAL ulNameLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Request_Device_EjectW LIB "setupapi.dll" ALIAS "CM_Request_Device_EjectW" ( BYVAL dnDevInst AS QUAD , BYREF pVetoType AS LONG , BYREF pszVetoName AS WSTRINGZ , BYVAL ulNameLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Request_Device_Eject = CM_Request_Device_EjectW
#ELSE
MACRO CM_Request_Device_Eject = CM_Request_Device_EjectA
#ENDIF
DECLARE FUNCTION CM_Request_Device_Eject_ExA LIB "setupapi.dll" ALIAS "CM_Request_Device_Eject_ExA" ( BYVAL dnDevInst AS QUAD , BYREF pVetoType AS LONG , BYREF pszVetoName AS ASCIIZ , BYVAL ulNameLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Request_Device_Eject_ExW LIB "setupapi.dll" ALIAS "CM_Request_Device_Eject_ExW" ( BYVAL dnDevInst AS QUAD , BYREF pVetoType AS LONG , BYREF pszVetoName AS WSTRINGZ , BYVAL ulNameLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Request_Device_Eject_Ex = CM_Request_Device_Eject_ExW
#ELSE
MACRO CM_Request_Device_Eject_Ex = CM_Request_Device_Eject_ExA
#ENDIF
DECLARE FUNCTION CM_Reenumerate_DevNode LIB "setupapi.dll" ALIAS "CM_Reenumerate_DevNode" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Reenumerate_DevNode_Ex LIB "setupapi.dll" ALIAS "CM_Reenumerate_DevNode_Ex" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Register_Device_InterfaceA LIB "setupapi.dll" ALIAS "CM_Register_Device_InterfaceA" ( BYVAL dnDevInst AS QUAD , BYREF InterfaceClassGuid AS GUID , BYREF pszReference AS ASCIIZ , BYREF pszDeviceInterface AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Register_Device_InterfaceW LIB "setupapi.dll" ALIAS "CM_Register_Device_InterfaceW" ( BYVAL dnDevInst AS QUAD , BYREF InterfaceClassGuid AS GUID , BYREF pszReference AS WSTRINGZ , BYVAL pszDeviceInterface AS QUAD , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Register_Device_Interface = CM_Register_Device_InterfaceW
#ELSE
MACRO CM_Register_Device_Interface = CM_Register_Device_InterfaceA
#ENDIF
DECLARE FUNCTION CM_Register_Device_Interface_ExA LIB "setupapi.dll" ALIAS "CM_Register_Device_Interface_ExA" ( BYVAL dnDevInst AS QUAD , BYREF InterfaceClassGuid AS GUID , BYREF pszReference AS ASCIIZ , BYREF pszDeviceInterface AS ASCIIZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Register_Device_Interface_ExW LIB "setupapi.dll" ALIAS "CM_Register_Device_Interface_ExW" ( BYVAL dnDevInst AS QUAD , BYREF InterfaceClassGuid AS GUID , BYREF pszReference AS WSTRINGZ , BYREF pszDeviceInterface AS WSTRINGZ , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Register_Device_Interface_Ex = CM_Register_Device_Interface_ExW
#ELSE
MACRO CM_Register_Device_Interface_Ex = CM_Register_Device_Interface_ExA
#ENDIF
DECLARE FUNCTION CM_Set_DevNode_Problem_Ex LIB "setupapi.dll" ALIAS "CM_Set_DevNode_Problem_Ex" ( BYVAL dnDevInst AS QUAD , BYVAL ulProblem AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_DevNode_Problem LIB "setupapi.dll" ALIAS "CM_Set_DevNode_Problem" ( BYVAL dnDevInst AS QUAD , BYVAL ulProblem AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Unregister_Device_InterfaceA LIB "setupapi.dll" ALIAS "CM_Unregister_Device_InterfaceA" ( BYREF pszDeviceInterface AS ASCIIZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Unregister_Device_InterfaceW LIB "setupapi.dll" ALIAS "CM_Unregister_Device_InterfaceW" ( BYREF pszDeviceInterface AS WSTRINGZ , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Unregister_Device_Interface = CM_Unregister_Device_InterfaceW
#ELSE
MACRO CM_Unregister_Device_Interface = CM_Unregister_Device_InterfaceA
#ENDIF
DECLARE FUNCTION CM_Unregister_Device_Interface_ExA LIB "setupapi.dll" ALIAS "CM_Unregister_Device_Interface_ExA" ( BYREF pszDeviceInterface AS ASCIIZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Unregister_Device_Interface_ExW LIB "setupapi.dll" ALIAS "CM_Unregister_Device_Interface_ExW" ( BYREF pszDeviceInterface AS WSTRINGZ , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Unregister_Device_Interface_Ex = CM_Unregister_Device_Interface_ExW
#ELSE
MACRO CM_Unregister_Device_Interface_Ex = CM_Unregister_Device_Interface_ExA
#ENDIF
DECLARE FUNCTION CM_Register_Device_Driver LIB "setupapi.dll" ALIAS "CM_Register_Device_Driver" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Register_Device_Driver_Ex LIB "setupapi.dll" ALIAS "CM_Register_Device_Driver_Ex" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Remove_SubTree LIB "setupapi.dll" ALIAS "CM_Remove_SubTree" ( BYVAL dnAncestor AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Remove_SubTree_Ex LIB "setupapi.dll" ALIAS "CM_Remove_SubTree_Ex" ( BYVAL dnAncestor AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_DevNode_Registry_PropertyA LIB "setupapi.dll" ALIAS "CM_Set_DevNode_Registry_PropertyA" ( BYVAL dnDevInst AS QUAD , BYVAL ulProperty AS QUAD , BYREF Buffer AS ANY , BYVAL ulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_DevNode_Registry_PropertyW LIB "setupapi.dll" ALIAS "CM_Set_DevNode_Registry_PropertyW" ( BYVAL dnDevInst AS QUAD , BYVAL ulProperty AS QUAD , BYREF Buffer AS ANY , BYVAL ulLength AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Set_DevNode_Registry_Property = CM_Set_DevNode_Registry_PropertyW
#ELSE
MACRO CM_Set_DevNode_Registry_Property = CM_Set_DevNode_Registry_PropertyA
#ENDIF
DECLARE FUNCTION CM_Set_DevNode_Registry_Property_ExA LIB "setupapi.dll" ALIAS "CM_Set_DevNode_Registry_Property_ExA" ( BYVAL dnDevInst AS QUAD , BYVAL ulProperty AS QUAD , BYREF Buffer AS ANY , BYVAL ulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_DevNode_Registry_Property_ExW LIB "setupapi.dll" ALIAS "CM_Set_DevNode_Registry_Property_ExW" ( BYVAL dnDevInst AS QUAD , BYVAL ulProperty AS QUAD , BYREF Buffer AS ANY , BYVAL ulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Set_DevNode_Registry_Property_Ex = CM_Set_DevNode_Registry_Property_ExW
#ELSE
MACRO CM_Set_DevNode_Registry_Property_Ex = CM_Set_DevNode_Registry_Property_ExA
#ENDIF
DECLARE FUNCTION CM_Is_Dock_Station_Present LIB "setupapi.dll" ALIAS "CM_Is_Dock_Station_Present" ( BYREF pbPresent AS LONG ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Is_Dock_Station_Present_Ex LIB "setupapi.dll" ALIAS "CM_Is_Dock_Station_Present_Ex" ( BYREF pbPresent AS LONG , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Request_Eject_PC LIB "setupapi.dll" ALIAS "CM_Request_Eject_PC" ( ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Request_Eject_PC_Ex LIB "setupapi.dll" ALIAS "CM_Request_Eject_PC_Ex" ( OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_HW_Prof_FlagsA LIB "setupapi.dll" ALIAS "CM_Set_HW_Prof_FlagsA" ( BYREF pDeviceID AS ASCIIZ , BYVAL ulConfig AS QUAD , BYVAL ulValue AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_HW_Prof_FlagsW LIB "setupapi.dll" ALIAS "CM_Set_HW_Prof_FlagsW" ( BYVAL pDeviceID AS QUAD , BYVAL ulConfig AS QUAD , BYVAL ulValue AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Set_HW_Prof_Flags = CM_Set_HW_Prof_FlagsW
#ELSE
MACRO CM_Set_HW_Prof_Flags = CM_Set_HW_Prof_FlagsA
#ENDIF
DECLARE FUNCTION CM_Set_HW_Prof_Flags_ExA LIB "setupapi.dll" ALIAS "CM_Set_HW_Prof_Flags_ExA" ( BYREF pDeviceID AS ASCIIZ , BYVAL ulConfig AS QUAD , BYVAL ulValue AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_HW_Prof_Flags_ExW LIB "setupapi.dll" ALIAS "CM_Set_HW_Prof_Flags_ExW" ( BYVAL pDeviceID AS QUAD , BYVAL ulConfig AS QUAD , BYVAL ulValue AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Set_HW_Prof_Flags_Ex = CM_Set_HW_Prof_Flags_ExW
#ELSE
MACRO CM_Set_HW_Prof_Flags_Ex = CM_Set_HW_Prof_Flags_ExA
#ENDIF
DECLARE FUNCTION CM_Setup_DevNode LIB "setupapi.dll" ALIAS "CM_Setup_DevNode" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Setup_DevNode_Ex LIB "setupapi.dll" ALIAS "CM_Setup_DevNode_Ex" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Test_Range_Available LIB "setupapi.dll" ALIAS "CM_Test_Range_Available" ( BYVAL ullStartValue AS QUAD , BYVAL ullEndValue AS QUAD , BYVAL rlh AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Uninstall_DevNode LIB "setupapi.dll" ALIAS "CM_Uninstall_DevNode" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Uninstall_DevNode_Ex LIB "setupapi.dll" ALIAS "CM_Uninstall_DevNode_Ex" ( BYVAL dnDevInst AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Run_Detection LIB "setupapi.dll" ALIAS "CM_Run_Detection" ( BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Run_Detection_Ex LIB "setupapi.dll" ALIAS "CM_Run_Detection_Ex" ( BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
'#if (WINVER >= _WIN32_WINNT_LONGHORN)
DECLARE FUNCTION CM_Apply_PowerScheme LIB "setupapi.dll" ALIAS "CM_Apply_PowerScheme" ( ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Write_UserPowerKey LIB "setupapi.dll" ALIAS "CM_Write_UserPowerKey" ( BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL AccessFlags AS QUAD , BYVAL Type AS QUAD , BYVAL Buffer AS QUAD , BYVAL BufferSize AS QUAD , BYREF Error AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_ActiveScheme LIB "setupapi.dll" ALIAS "CM_Set_ActiveScheme" ( BYREF SchemeGuid AS GUID , BYREF Error AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Restore_DefaultPowerScheme LIB "setupapi.dll" ALIAS "CM_Restore_DefaultPowerScheme" ( BYREF SchemeGuid AS GUID , BYREF Error AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_RestoreAll_DefaultPowerSchemes LIB "setupapi.dll" ALIAS "CM_RestoreAll_DefaultPowerSchemes" ( BYREF Error AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Duplicate_PowerScheme LIB "setupapi.dll" ALIAS "CM_Duplicate_PowerScheme" ( BYREF SourceSchemeGuid AS GUID , BYREF DestinationSchemeGuid AS GUID , BYREF Error AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Delete_PowerScheme LIB "setupapi.dll" ALIAS "CM_Delete_PowerScheme" ( BYREF SchemeGuid AS GUID , BYREF Error AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Import_PowerScheme LIB "setupapi.dll" ALIAS "CM_Import_PowerScheme" ( BYREF ImportFileNamePath AS WSTRINGZ , BYREF DestinationSchemeGuid AS GUID , BYREF Error AS QUAD ) AS QUAD ' CONFIGRET
'#endif // (WINVER >= _WIN32_WINNT_LONGHORN)
DECLARE FUNCTION CM_Set_HW_Prof LIB "setupapi.dll" ALIAS "CM_Set_HW_Prof" ( BYVAL ulHardwareProfile AS QUAD , BYVAL ulFlags AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_HW_Prof_Ex LIB "setupapi.dll" ALIAS "CM_Set_HW_Prof_Ex" ( BYVAL ulHardwareProfile AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Query_Resource_Conflict_List LIB "setupapi.dll" ALIAS "CM_Query_Resource_Conflict_List" ( BYREF pclConflictList AS QUAD , BYVAL dnDevInst AS QUAD , BYVAL ResourceID AS QUAD , BYREF ResourceData AS ANY , BYVAL ResourceLen AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Free_Resource_Conflict_Handle LIB "setupapi.dll" ALIAS "CM_Free_Resource_Conflict_Handle" ( BYVAL clConflictList AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Resource_Conflict_Count LIB "setupapi.dll" ALIAS "CM_Get_Resource_Conflict_Count" ( BYVAL clConflictList AS QUAD , BYREF pulCount AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Resource_Conflict_DetailsA LIB "setupapi.dll" ALIAS "CM_Get_Resource_Conflict_DetailsA" ( BYVAL clConflictList AS QUAD , BYVAL ulIndex AS QUAD , BYREF pConflictDetails AS CONFLICT_DETAILS_A ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Resource_Conflict_DetailsW LIB "setupapi.dll" ALIAS "CM_Get_Resource_Conflict_DetailsW" ( BYVAL clConflictList AS QUAD , BYVAL ulIndex AS QUAD , BYREF pConflictDetails AS CONFLICT_DETAILS_W ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Resource_Conflict_Details = CM_Get_Resource_Conflict_DetailsW
#ELSE
MACRO CM_Get_Resource_Conflict_Details = CM_Get_Resource_Conflict_DetailsA
#ENDIF
DECLARE FUNCTION CM_Get_Class_Registry_PropertyA LIB "setupapi.dll" ALIAS "CM_Get_Class_Registry_PropertyA" ( BYREF ClassGuid AS GUID , BYVAL ulProperty AS QUAD , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Get_Class_Registry_PropertyW LIB "setupapi.dll" ALIAS "CM_Get_Class_Registry_PropertyW" ( BYREF ClassGuid AS GUID , BYVAL ulProperty AS QUAD , BYREF pulRegDataType AS QUAD , BYREF Buffer AS ANY , BYREF pulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Get_Class_Registry_Property = CM_Get_Class_Registry_PropertyW
#ELSE
MACRO CM_Get_Class_Registry_Property = CM_Get_Class_Registry_PropertyA
#ENDIF
DECLARE FUNCTION CM_Set_Class_Registry_PropertyA LIB "setupapi.dll" ALIAS "CM_Set_Class_Registry_PropertyA" ( BYREF ClassGuid AS GUID , BYVAL ulProperty AS QUAD , BYVAL Buffer AS QUAD , BYVAL ulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
DECLARE FUNCTION CM_Set_Class_Registry_PropertyW LIB "setupapi.dll" ALIAS "CM_Set_Class_Registry_PropertyW" ( BYREF ClassGuid AS GUID , BYVAL ulProperty AS QUAD , BYVAL Buffer AS QUAD , BYVAL ulLength AS QUAD , BYVAL ulFlags AS QUAD , OPTIONAL BYVAL hMachine AS QUAD ) AS QUAD ' CONFIGRET
#IF %DEF(%UNICODE)
MACRO CM_Set_Class_Registry_Property = CM_Set_Class_Registry_PropertyW
#ELSE
MACRO CM_Set_Class_Registry_Property = CM_Set_Class_Registry_PropertyA
#ENDIF
'#if (WINVER >= _WIN32_WINNT_WIN2K)
DECLARE FUNCTION CM_WaitNoPendingInstallEvents LIB "setupapi.dll" ALIAS "CM_WaitNoPendingInstallEvents" ( BYVAL dwTimeout AS QUAD ) AS QUAD
'#endif // (WINVER >= _WIN32_WINNT_WIN2K)
'//--------------------------------------------------------------
'// Configuration Manager return status codes
'//--------------------------------------------------------------
%EQUATE `CR_SUCCESS = &H00000000
%EQUATE `CR_DEFAULT = &H00000001
%EQUATE `CR_OUT_OF_MEMORY = &H00000002
%EQUATE `CR_INVALID_POINTER = &H00000003
%EQUATE `CR_INVALID_FLAG = &H00000004
%EQUATE `CR_INVALID_DEVNODE = &H00000005
%EQUATE `CR_INVALID_DEVINST = %CR_INVALID_DEVNODE
%EQUATE `CR_INVALID_RES_DES = &H00000006
%EQUATE `CR_INVALID_LOG_CONF = &H00000007
%EQUATE `CR_INVALID_ARBITRATOR = &H00000008
%EQUATE `CR_INVALID_NODELIST = &H00000009
%EQUATE `CR_DEVNODE_HAS_REQS = &H0000000A
%EQUATE `CR_DEVINST_HAS_REQS = %CR_DEVNODE_HAS_REQS
%EQUATE `CR_INVALID_RESOURCEID = &H0000000B
%EQUATE `CR_DLVXD_NOT_FOUND = &H0000000C ' // WIN 95 ONLY
%EQUATE `CR_NO_SUCH_DEVNODE = &H0000000D
%EQUATE `CR_NO_SUCH_DEVINST = %CR_NO_SUCH_DEVNODE
%EQUATE `CR_NO_MORE_LOG_CONF = &H0000000E
%EQUATE `CR_NO_MORE_RES_DES = &H0000000F
%EQUATE `CR_ALREADY_SUCH_DEVNODE = &H00000010
%EQUATE `CR_ALREADY_SUCH_DEVINST = %CR_ALREADY_SUCH_DEVNODE
%EQUATE `CR_INVALID_RANGE_LIST = &H00000011
%EQUATE `CR_INVALID_RANGE = &H00000012
%EQUATE `CR_FAILURE = &H00000013
%EQUATE `CR_NO_SUCH_LOGICAL_DEV = &H00000014
%EQUATE `CR_CREATE_BLOCKED = &H00000015
%EQUATE `CR_NOT_SYSTEM_VM = &H00000016 ' // WIN 95 ONLY
%EQUATE `CR_REMOVE_VETOED = &H00000017
%EQUATE `CR_APM_VETOED = &H00000018
%EQUATE `CR_INVALID_LOAD_TYPE = &H00000019
%EQUATE `CR_BUFFER_SMALL = &H0000001A
%EQUATE `CR_NO_ARBITRATOR = &H0000001B
%EQUATE `CR_NO_REGISTRY_HANDLE = &H0000001C
%EQUATE `CR_REGISTRY_ERROR = &H0000001D
%EQUATE `CR_INVALID_DEVICE_ID = &H0000001E
%EQUATE `CR_INVALID_DATA = &H0000001F
%EQUATE `CR_INVALID_API = &H00000020
%EQUATE `CR_DEVLOADER_NOT_READY = &H00000021
%EQUATE `CR_NEED_RESTART = &H00000022
%EQUATE `CR_NO_MORE_HW_PROFILES = &H00000023
%EQUATE `CR_DEVICE_NOT_THERE = &H00000024
%EQUATE `CR_NO_SUCH_VALUE = &H00000025
%EQUATE `CR_WRONG_TYPE = &H00000026
%EQUATE `CR_INVALID_PRIORITY = &H00000027
%EQUATE `CR_NOT_DISABLEABLE = &H00000028
%EQUATE `CR_FREE_RESOURCES = &H00000029
%EQUATE `CR_QUERY_VETOED = &H0000002A
%EQUATE `CR_CANT_SHARE_IRQ = &H0000002B
%EQUATE `CR_NO_DEPENDENT = &H0000002C
%EQUATE `CR_SAME_RESOURCES = &H0000002D
%EQUATE `CR_NO_SUCH_REGISTRY_KEY = &H0000002E
%EQUATE `CR_INVALID_MACHINENAME = &H0000002F ' // NT ONLY
%EQUATE `CR_REMOTE_COMM_FAILURE = &H00000030 ' // NT ONLY
%EQUATE `CR_MACHINE_UNAVAILABLE = &H00000031 ' // NT ONLY
%EQUATE `CR_NO_CM_SERVICES = &H00000032 ' // NT ONLY
%EQUATE `CR_ACCESS_DENIED = &H00000033 ' // NT ONLY
%EQUATE `CR_CALL_NOT_IMPLEMENTED = &H00000034
%EQUATE `CR_INVALID_PROPERTY = &H00000035
%EQUATE `CR_DEVICE_INTERFACE_ACTIVE = &H00000036
%EQUATE `CR_NO_SUCH_DEVICE_INTERFACE = &H00000037
%EQUATE `CR_INVALID_REFERENCE_STRING = &H00000038
%EQUATE `CR_INVALID_CONFLICT_LIST = &H00000039
%EQUATE `CR_INVALID_INDEX = &H0000003A
%EQUATE `CR_INVALID_STRUCTURE_SIZE = &H0000003B
%EQUATE `NUM_CR_RESULTS = &H0000003C
#ENDIF
