diff --git a/stepmania/src/archutils/Win32/ddk/dbghelp.h b/stepmania/src/archutils/Win32/ddk/dbghelp.h new file mode 100644 index 0000000000..b85c5c6b6c --- /dev/null +++ b/stepmania/src/archutils/Win32/ddk/dbghelp.h @@ -0,0 +1,2670 @@ +/*++ BUILD Version: 0001 Increment this if a change has global effects + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + dbghelp.h + +Abstract: + + This module defines the prototypes and constants required for the image + help routines. + + Contains debugging support routines that are redistributable. + +Revision History: + +--*/ + +#ifndef _DBGHELP_ +#define _DBGHELP_ + +#if _MSC_VER > 1020 +#pragma once +#endif + + +// As a general principal always call the 64 bit version +// of every API, if a choice exists. The 64 bit version +// works great on 32 bit platforms, and is forward +// compatible to 64 bit platforms. + +#ifdef _WIN64 +#ifndef _IMAGEHLP64 +#define _IMAGEHLP64 +#endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _IMAGEHLP_SOURCE_ + #define IMAGEAPI __stdcall + #define DBHLP_DEPRECIATED +#else + #define IMAGEAPI DECLSPEC_IMPORT __stdcall + #if (_MSC_VER >= 1300) && !defined(MIDL_PASS) + #define DBHLP_DEPRECIATED __declspec(deprecated) + #else + #define DBHLP_DEPRECIATED + #endif +#endif + +#define DBHLPAPI IMAGEAPI + +#define IMAGE_SEPARATION (64*1024) + +typedef struct _LOADED_IMAGE { + PSTR ModuleName; + HANDLE hFile; + PUCHAR MappedAddress; +#ifdef _IMAGEHLP64 + PIMAGE_NT_HEADERS64 FileHeader; +#else + PIMAGE_NT_HEADERS32 FileHeader; +#endif + PIMAGE_SECTION_HEADER LastRvaSection; + ULONG NumberOfSections; + PIMAGE_SECTION_HEADER Sections; + ULONG Characteristics; + BOOLEAN fSystemImage; + BOOLEAN fDOSImage; + LIST_ENTRY Links; + ULONG SizeOfImage; +} LOADED_IMAGE, *PLOADED_IMAGE; + +#define MAX_SYM_NAME 2000 + + +HANDLE +IMAGEAPI +FindDebugInfoFile ( + PSTR FileName, + PSTR SymbolPath, + PSTR DebugFilePath + ); + +typedef BOOL +(CALLBACK *PFIND_DEBUG_FILE_CALLBACK)( + HANDLE FileHandle, + PSTR FileName, + PVOID CallerData + ); + +HANDLE +IMAGEAPI +FindDebugInfoFileEx ( + PSTR FileName, + PSTR SymbolPath, + PSTR DebugFilePath, + PFIND_DEBUG_FILE_CALLBACK Callback, + PVOID CallerData + ); + +typedef BOOL +(CALLBACK *PFINDFILEINPATHCALLBACK)( + PSTR filename, + PVOID context + ); + +BOOL +IMAGEAPI +SymFindFileInPath( + HANDLE hprocess, + LPSTR SearchPath, + LPSTR FileName, + PVOID id, + DWORD two, + DWORD three, + DWORD flags, + LPSTR FoundFile, + PFINDFILEINPATHCALLBACK callback, + PVOID context + ); + +HANDLE +IMAGEAPI +FindExecutableImage( + PSTR FileName, + PSTR SymbolPath, + PSTR ImageFilePath + ); + +typedef BOOL +(CALLBACK *PFIND_EXE_FILE_CALLBACK)( + HANDLE FileHandle, + PSTR FileName, + PVOID CallerData + ); + +HANDLE +IMAGEAPI +FindExecutableImageEx( + PSTR FileName, + PSTR SymbolPath, + PSTR ImageFilePath, + PFIND_EXE_FILE_CALLBACK Callback, + PVOID CallerData + ); + +PIMAGE_NT_HEADERS +IMAGEAPI +ImageNtHeader ( + IN PVOID Base + ); + +PVOID +IMAGEAPI +ImageDirectoryEntryToDataEx ( + IN PVOID Base, + IN BOOLEAN MappedAsImage, + IN USHORT DirectoryEntry, + OUT PULONG Size, + OUT PIMAGE_SECTION_HEADER *FoundHeader OPTIONAL + ); + +PVOID +IMAGEAPI +ImageDirectoryEntryToData ( + IN PVOID Base, + IN BOOLEAN MappedAsImage, + IN USHORT DirectoryEntry, + OUT PULONG Size + ); + +PIMAGE_SECTION_HEADER +IMAGEAPI +ImageRvaToSection( + IN PIMAGE_NT_HEADERS NtHeaders, + IN PVOID Base, + IN ULONG Rva + ); + +PVOID +IMAGEAPI +ImageRvaToVa( + IN PIMAGE_NT_HEADERS NtHeaders, + IN PVOID Base, + IN ULONG Rva, + IN OUT PIMAGE_SECTION_HEADER *LastRvaSection + ); + +// Symbol server exports + +typedef BOOL (WINAPI *PSYMBOLSERVERPROC)(LPCSTR, LPCSTR, PVOID, DWORD, DWORD, LPSTR); +typedef BOOL (WINAPI *PSYMBOLSERVEROPENPROC)(VOID); +typedef BOOL (WINAPI *PSYMBOLSERVERCLOSEPROC)(VOID); +typedef BOOL (WINAPI *PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR, ULONG64); +typedef BOOL (CALLBACK WINAPI *PSYMBOLSERVERCALLBACKPROC)(UINT_PTR action, ULONG64 data, ULONG64 context); +typedef UINT_PTR (WINAPI *PSYMBOLSERVERGETOPTIONSPROC)(); +typedef BOOL (WINAPI *PSYMBOLSERVERPINGPROC)(LPCSTR); + +#define SSRVOPT_CALLBACK 0x001 +#define SSRVOPT_DWORD 0x002 +#define SSRVOPT_DWORDPTR 0x004 +#define SSRVOPT_GUIDPTR 0x008 +#define SSRVOPT_OLDGUIDPTR 0x010 +#define SSRVOPT_UNATTENDED 0x020 +#define SSRVOPT_NOCOPY 0x040 +#define SSRVOPT_PARENTWIN 0x080 +#define SSRVOPT_PARAMTYPE 0x100 +#define SSRVOPT_SECURE 0x200 +#define SSRVOPT_TRACE 0x400 +#define SSRVOPT_RESET ((ULONG_PTR)-1) + +#define SSRVACTION_TRACE 1 + + +#ifndef _WIN64 +// This api won't be ported to Win64 - Fix your code. + +typedef struct _IMAGE_DEBUG_INFORMATION { + LIST_ENTRY List; + DWORD ReservedSize; + PVOID ReservedMappedBase; + USHORT ReservedMachine; + USHORT ReservedCharacteristics; + DWORD ReservedCheckSum; + DWORD ImageBase; + DWORD SizeOfImage; + + DWORD ReservedNumberOfSections; + PIMAGE_SECTION_HEADER ReservedSections; + + DWORD ReservedExportedNamesSize; + PSTR ReservedExportedNames; + + DWORD ReservedNumberOfFunctionTableEntries; + PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries; + DWORD ReservedLowestFunctionStartingAddress; + DWORD ReservedHighestFunctionEndingAddress; + + DWORD ReservedNumberOfFpoTableEntries; + PFPO_DATA ReservedFpoTableEntries; + + DWORD SizeOfCoffSymbols; + PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols; + + DWORD ReservedSizeOfCodeViewSymbols; + PVOID ReservedCodeViewSymbols; + + PSTR ImageFilePath; + PSTR ImageFileName; + PSTR ReservedDebugFilePath; + + DWORD ReservedTimeDateStamp; + + BOOL ReservedRomImage; + PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory; + DWORD ReservedNumberOfDebugDirectories; + + DWORD ReservedOriginalFunctionTableBaseAddress; + + DWORD Reserved[ 2 ]; + +} IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION; + + +PIMAGE_DEBUG_INFORMATION +IMAGEAPI +MapDebugInformation( + HANDLE FileHandle, + PSTR FileName, + PSTR SymbolPath, + DWORD ImageBase + ); + +BOOL +IMAGEAPI +UnmapDebugInformation( + PIMAGE_DEBUG_INFORMATION DebugInfo + ); + +#endif + +BOOL +IMAGEAPI +SearchTreeForFile( + PSTR RootPath, + PSTR InputPathName, + PSTR OutputPathBuffer + ); + +typedef BOOL +(CALLBACK *PENUMDIRTREE_CALLBACK)( + LPCSTR FilePath, + PVOID CallerData + ); + +BOOL +IMAGEAPI +EnumDirTree( + HANDLE hProcess, + PSTR RootPath, + PSTR InputPathName, + PSTR OutputPathBuffer, + PENUMDIRTREE_CALLBACK Callback, + PVOID CallbackData + ); + +BOOL +IMAGEAPI +MakeSureDirectoryPathExists( + PCSTR DirPath + ); + +// +// UnDecorateSymbolName Flags +// + +#define UNDNAME_COMPLETE (0x0000) // Enable full undecoration +#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) // Remove leading underscores from MS extended keywords +#define UNDNAME_NO_MS_KEYWORDS (0x0002) // Disable expansion of MS extended keywords +#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) // Disable expansion of return type for primary declaration +#define UNDNAME_NO_ALLOCATION_MODEL (0x0008) // Disable expansion of the declaration model +#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010) // Disable expansion of the declaration language specifier +#define UNDNAME_NO_MS_THISTYPE (0x0020) // NYI Disable expansion of MS keywords on the 'this' type for primary declaration +#define UNDNAME_NO_CV_THISTYPE (0x0040) // NYI Disable expansion of CV modifiers on the 'this' type for primary declaration +#define UNDNAME_NO_THISTYPE (0x0060) // Disable all modifiers on the 'this' type +#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) // Disable expansion of access specifiers for members +#define UNDNAME_NO_THROW_SIGNATURES (0x0100) // Disable expansion of 'throw-signatures' for functions and pointers to functions +#define UNDNAME_NO_MEMBER_TYPE (0x0200) // Disable expansion of 'static' or 'virtual'ness of members +#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400) // Disable expansion of MS model for UDT returns +#define UNDNAME_32_BIT_DECODE (0x0800) // Undecorate 32-bit decorated names +#define UNDNAME_NAME_ONLY (0x1000) // Crack only the name for primary declaration; + // return just [scope::]name. Does expand template params +#define UNDNAME_NO_ARGUMENTS (0x2000) // Don't undecorate arguments to function +#define UNDNAME_NO_SPECIAL_SYMS (0x4000) // Don't undecorate special names (v-table, vcall, vector xxx, metatype, etc) + +DWORD +IMAGEAPI +WINAPI +UnDecorateSymbolName( + PCSTR DecoratedName, // Name to undecorate + PSTR UnDecoratedName, // If NULL, it will be allocated + DWORD UndecoratedLength, // The maximym length + DWORD Flags // See above. + ); + + +// +// these values are used for synthesized file types +// that can be passed in as image headers instead of +// the standard ones from ntimage.h +// + +#define DBHHEADER_DEBUGDIRS 0x1 + +typedef struct _MODLOAD_DATA { + DWORD ssize; // size of this struct + DWORD ssig; // signature identifying the passed data + PVOID data; // pointer to passed data + DWORD size; // size of passed data + DWORD flags; // options +} MODLOAD_DATA, *PMODLOAD_DATA; + +// +// StackWalking API +// + +typedef enum { + AddrMode1616, + AddrMode1632, + AddrModeReal, + AddrModeFlat +} ADDRESS_MODE; + +typedef struct _tagADDRESS64 { + DWORD64 Offset; + WORD Segment; + ADDRESS_MODE Mode; +} ADDRESS64, *LPADDRESS64; + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define ADDRESS ADDRESS64 +#define LPADDRESS LPADDRESS64 +#else +typedef struct _tagADDRESS { + DWORD Offset; + WORD Segment; + ADDRESS_MODE Mode; +} ADDRESS, *LPADDRESS; + +__inline +void +Address32To64( + LPADDRESS a32, + LPADDRESS64 a64 + ) +{ + a64->Offset = (ULONG64)(LONG64)(LONG)a32->Offset; + a64->Segment = a32->Segment; + a64->Mode = a32->Mode; +} + +__inline +void +Address64To32( + LPADDRESS64 a64, + LPADDRESS a32 + ) +{ + a32->Offset = (ULONG)a64->Offset; + a32->Segment = a64->Segment; + a32->Mode = a64->Mode; +} +#endif + +// +// This structure is included in the STACKFRAME structure, +// and is used to trace through usermode callbacks in a thread's +// kernel stack. The values must be copied by the kernel debugger +// from the DBGKD_GET_VERSION and WAIT_STATE_CHANGE packets. +// + +// +// New KDHELP structure for 64 bit system support. +// This structure is preferred in new code. +// +typedef struct _KDHELP64 { + + // + // address of kernel thread object, as provided in the + // WAIT_STATE_CHANGE packet. + // + DWORD64 Thread; + + // + // offset in thread object to pointer to the current callback frame + // in kernel stack. + // + DWORD ThCallbackStack; + + // + // offset in thread object to pointer to the current callback backing + // store frame in kernel stack. + // + DWORD ThCallbackBStore; + + // + // offsets to values in frame: + // + // address of next callback frame + DWORD NextCallback; + + // address of saved frame pointer (if applicable) + DWORD FramePointer; + + + // + // Address of the kernel function that calls out to user mode + // + DWORD64 KiCallUserMode; + + // + // Address of the user mode dispatcher function + // + DWORD64 KeUserCallbackDispatcher; + + // + // Lowest kernel mode address + // + DWORD64 SystemRangeStart; + + DWORD64 Reserved[8]; + +} KDHELP64, *PKDHELP64; + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define KDHELP KDHELP64 +#define PKDHELP PKDHELP64 +#else +typedef struct _KDHELP { + + // + // address of kernel thread object, as provided in the + // WAIT_STATE_CHANGE packet. + // + DWORD Thread; + + // + // offset in thread object to pointer to the current callback frame + // in kernel stack. + // + DWORD ThCallbackStack; + + // + // offsets to values in frame: + // + // address of next callback frame + DWORD NextCallback; + + // address of saved frame pointer (if applicable) + DWORD FramePointer; + + // + // Address of the kernel function that calls out to user mode + // + DWORD KiCallUserMode; + + // + // Address of the user mode dispatcher function + // + DWORD KeUserCallbackDispatcher; + + // + // Lowest kernel mode address + // + DWORD SystemRangeStart; + + // + // offset in thread object to pointer to the current callback backing + // store frame in kernel stack. + // + DWORD ThCallbackBStore; + + DWORD Reserved[8]; + +} KDHELP, *PKDHELP; + +__inline +void +KdHelp32To64( + PKDHELP p32, + PKDHELP64 p64 + ) +{ + p64->Thread = p32->Thread; + p64->ThCallbackStack = p32->ThCallbackStack; + p64->NextCallback = p32->NextCallback; + p64->FramePointer = p32->FramePointer; + p64->KiCallUserMode = p32->KiCallUserMode; + p64->KeUserCallbackDispatcher = p32->KeUserCallbackDispatcher; + p64->SystemRangeStart = p32->SystemRangeStart; +} +#endif + +typedef struct _tagSTACKFRAME64 { + ADDRESS64 AddrPC; // program counter + ADDRESS64 AddrReturn; // return address + ADDRESS64 AddrFrame; // frame pointer + ADDRESS64 AddrStack; // stack pointer + ADDRESS64 AddrBStore; // backing store pointer + PVOID FuncTableEntry; // pointer to pdata/fpo or NULL + DWORD64 Params[4]; // possible arguments to the function + BOOL Far; // WOW far call + BOOL Virtual; // is this a virtual frame? + DWORD64 Reserved[3]; + KDHELP64 KdHelp; +} STACKFRAME64, *LPSTACKFRAME64; + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define STACKFRAME STACKFRAME64 +#define LPSTACKFRAME LPSTACKFRAME64 +#else +typedef struct _tagSTACKFRAME { + ADDRESS AddrPC; // program counter + ADDRESS AddrReturn; // return address + ADDRESS AddrFrame; // frame pointer + ADDRESS AddrStack; // stack pointer + PVOID FuncTableEntry; // pointer to pdata/fpo or NULL + DWORD Params[4]; // possible arguments to the function + BOOL Far; // WOW far call + BOOL Virtual; // is this a virtual frame? + DWORD Reserved[3]; + KDHELP KdHelp; + ADDRESS AddrBStore; // backing store pointer +} STACKFRAME, *LPSTACKFRAME; +#endif + + +typedef +BOOL +(__stdcall *PREAD_PROCESS_MEMORY_ROUTINE64)( + HANDLE hProcess, + DWORD64 qwBaseAddress, + PVOID lpBuffer, + DWORD nSize, + LPDWORD lpNumberOfBytesRead + ); + +typedef +PVOID +(__stdcall *PFUNCTION_TABLE_ACCESS_ROUTINE64)( + HANDLE hProcess, + DWORD64 AddrBase + ); + +typedef +DWORD64 +(__stdcall *PGET_MODULE_BASE_ROUTINE64)( + HANDLE hProcess, + DWORD64 Address + ); + +typedef +DWORD64 +(__stdcall *PTRANSLATE_ADDRESS_ROUTINE64)( + HANDLE hProcess, + HANDLE hThread, + LPADDRESS64 lpaddr + ); + +BOOL +IMAGEAPI +StackWalk64( + DWORD MachineType, + HANDLE hProcess, + HANDLE hThread, + LPSTACKFRAME64 StackFrame, + PVOID ContextRecord, + PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, + PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, + PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, + PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) + +#define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64 +#define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64 +#define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64 +#define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64 + +#define StackWalk StackWalk64 + +#else + +typedef +BOOL +(__stdcall *PREAD_PROCESS_MEMORY_ROUTINE)( + HANDLE hProcess, + DWORD lpBaseAddress, + PVOID lpBuffer, + DWORD nSize, + PDWORD lpNumberOfBytesRead + ); + +typedef +PVOID +(__stdcall *PFUNCTION_TABLE_ACCESS_ROUTINE)( + HANDLE hProcess, + DWORD AddrBase + ); + +typedef +DWORD +(__stdcall *PGET_MODULE_BASE_ROUTINE)( + HANDLE hProcess, + DWORD Address + ); + +typedef +DWORD +(__stdcall *PTRANSLATE_ADDRESS_ROUTINE)( + HANDLE hProcess, + HANDLE hThread, + LPADDRESS lpaddr + ); + +BOOL +IMAGEAPI +StackWalk( + DWORD MachineType, + HANDLE hProcess, + HANDLE hThread, + LPSTACKFRAME StackFrame, + PVOID ContextRecord, + PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine, + PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine, + PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine, + PTRANSLATE_ADDRESS_ROUTINE TranslateAddress + ); + +#endif + + +#define API_VERSION_NUMBER 9 + +typedef struct API_VERSION { + USHORT MajorVersion; + USHORT MinorVersion; + USHORT Revision; + USHORT Reserved; +} API_VERSION, *LPAPI_VERSION; + +LPAPI_VERSION +IMAGEAPI +ImagehlpApiVersion( + VOID + ); + +LPAPI_VERSION +IMAGEAPI +ImagehlpApiVersionEx( + LPAPI_VERSION AppVersion + ); + +DWORD +IMAGEAPI +GetTimestampForLoadedLibrary( + HMODULE Module + ); + +// +// typedefs for function pointers +// +typedef BOOL +(CALLBACK *PSYM_ENUMMODULES_CALLBACK64)( + PSTR ModuleName, + DWORD64 BaseOfDll, + PVOID UserContext + ); + +typedef BOOL +(CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)( + PSTR SymbolName, + DWORD64 SymbolAddress, + ULONG SymbolSize, + PVOID UserContext + ); + +typedef BOOL +(CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)( + PWSTR SymbolName, + DWORD64 SymbolAddress, + ULONG SymbolSize, + PVOID UserContext + ); + +typedef BOOL +(CALLBACK *PENUMLOADED_MODULES_CALLBACK64)( + PSTR ModuleName, + DWORD64 ModuleBase, + ULONG ModuleSize, + PVOID UserContext + ); + +typedef BOOL +(CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)( + HANDLE hProcess, + ULONG ActionCode, + ULONG64 CallbackData, + ULONG64 UserContext + ); + +typedef +PVOID +(CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)( + HANDLE hProcess, + DWORD AddrBase, + PVOID UserContext + ); + +typedef +PVOID +(CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)( + HANDLE hProcess, + ULONG64 AddrBase, + ULONG64 UserContext + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) + +#define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64 +#define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64 +#define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACK64W +#define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64 +#define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64 +#define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64 + +#else + +typedef BOOL +(CALLBACK *PSYM_ENUMMODULES_CALLBACK)( + PSTR ModuleName, + ULONG BaseOfDll, + PVOID UserContext + ); + +typedef BOOL +(CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)( + PSTR SymbolName, + ULONG SymbolAddress, + ULONG SymbolSize, + PVOID UserContext + ); + +typedef BOOL +(CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)( + PWSTR SymbolName, + ULONG SymbolAddress, + ULONG SymbolSize, + PVOID UserContext + ); + +typedef BOOL +(CALLBACK *PENUMLOADED_MODULES_CALLBACK)( + PSTR ModuleName, + ULONG ModuleBase, + ULONG ModuleSize, + PVOID UserContext + ); + +typedef BOOL +(CALLBACK *PSYMBOL_REGISTERED_CALLBACK)( + HANDLE hProcess, + ULONG ActionCode, + PVOID CallbackData, + PVOID UserContext + ); + +#endif + + +// +// flags found in SYMBOL_INFO.Flags +// + +#define SYMFLAG_VALUEPRESENT 0x00000001 +#define SYMFLAG_REGISTER 0x00000008 +#define SYMFLAG_REGREL 0x00000010 +#define SYMFLAG_FRAMEREL 0x00000020 +#define SYMFLAG_PARAMETER 0x00000040 +#define SYMFLAG_LOCAL 0x00000080 +#define SYMFLAG_CONSTANT 0x00000100 +#define SYMFLAG_EXPORT 0x00000200 +#define SYMFLAG_FORWARDER 0x00000400 +#define SYMFLAG_FUNCTION 0x00000800 +#define SYMFLAG_VIRTUAL 0x00001000 +#define SYMFLAG_THUNK 0x00002000 +#define SYMFLAG_TLSREL 0x00004000 + +// +// symbol type enumeration +// +typedef enum { + SymNone = 0, + SymCoff, + SymCv, + SymPdb, + SymExport, + SymDeferred, + SymSym, // .sym file + SymDia, + SymVirtual, + NumSymTypes +} SYM_TYPE; + +// +// symbol data structure +// + +typedef struct _IMAGEHLP_SYMBOL64 { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_SYMBOL64) + DWORD64 Address; // virtual address including dll base address + DWORD Size; // estimated size of symbol, can be zero + DWORD Flags; // info about the symbols, see the SYMF defines + DWORD MaxNameLength; // maximum size of symbol name in 'Name' + CHAR Name[1]; // symbol name (null terminated string) +} IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64; + +typedef struct _IMAGEHLP_SYMBOL64_PACKAGE { + IMAGEHLP_SYMBOL64 sym; + CHAR name[MAX_SYM_NAME + 1]; +} IMAGEHLP_SYMBOL64_PACKAGE, *PIMAGEHLP_SYMBOL64_PACKAGE; + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) + + #define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64 + #define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64 + #define IMAGEHLP_SYMBOL_PACKAGE IMAGEHLP_SYMBOL64_PACKAGE + #define PIMAGEHLP_SYMBOL_PACKAGE PIMAGEHLP_SYMBOL64_PACKAGE + +#else + + typedef struct _IMAGEHLP_SYMBOL { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_SYMBOL) + DWORD Address; // virtual address including dll base address + DWORD Size; // estimated size of symbol, can be zero + DWORD Flags; // info about the symbols, see the SYMF defines + DWORD MaxNameLength; // maximum size of symbol name in 'Name' + CHAR Name[1]; // symbol name (null terminated string) + } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL; + + typedef struct _IMAGEHLP_SYMBOL_PACKAGE { + IMAGEHLP_SYMBOL sym; + CHAR name[MAX_SYM_NAME + 1]; + } IMAGEHLP_SYMBOL_PACKAGE, *PIMAGEHLP_SYMBOL_PACKAGE; + +#endif + +// +// module data structure +// + +typedef struct _IMAGEHLP_MODULE64 { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_MODULE64) + DWORD64 BaseOfImage; // base load address of module + DWORD ImageSize; // virtual size of the loaded module + DWORD TimeDateStamp; // date/time stamp from pe header + DWORD CheckSum; // checksum from the pe header + DWORD NumSyms; // number of symbols in the symbol table + SYM_TYPE SymType; // type of symbols loaded + CHAR ModuleName[32]; // module name + CHAR ImageName[256]; // image name + CHAR LoadedImageName[256]; // symbol file name +} IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64; + +typedef struct _IMAGEHLP_MODULE64W { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_MODULE64) + DWORD64 BaseOfImage; // base load address of module + DWORD ImageSize; // virtual size of the loaded module + DWORD TimeDateStamp; // date/time stamp from pe header + DWORD CheckSum; // checksum from the pe header + DWORD NumSyms; // number of symbols in the symbol table + SYM_TYPE SymType; // type of symbols loaded + WCHAR ModuleName[32]; // module name + WCHAR ImageName[256]; // image name + WCHAR LoadedImageName[256]; // symbol file name +} IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64; + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define IMAGEHLP_MODULE IMAGEHLP_MODULE64 +#define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64 +#define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64 +#define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64 +#else +typedef struct _IMAGEHLP_MODULE { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_MODULE) + DWORD BaseOfImage; // base load address of module + DWORD ImageSize; // virtual size of the loaded module + DWORD TimeDateStamp; // date/time stamp from pe header + DWORD CheckSum; // checksum from the pe header + DWORD NumSyms; // number of symbols in the symbol table + SYM_TYPE SymType; // type of symbols loaded + CHAR ModuleName[32]; // module name + CHAR ImageName[256]; // image name + CHAR LoadedImageName[256]; // symbol file name +} IMAGEHLP_MODULE, *PIMAGEHLP_MODULE; + +typedef struct _IMAGEHLP_MODULEW { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_MODULE) + DWORD BaseOfImage; // base load address of module + DWORD ImageSize; // virtual size of the loaded module + DWORD TimeDateStamp; // date/time stamp from pe header + DWORD CheckSum; // checksum from the pe header + DWORD NumSyms; // number of symbols in the symbol table + SYM_TYPE SymType; // type of symbols loaded + WCHAR ModuleName[32]; // module name + WCHAR ImageName[256]; // image name + WCHAR LoadedImageName[256]; // symbol file name +} IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW; +#endif + +// +// source file line data structure +// + +typedef struct _IMAGEHLP_LINE64 { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_LINE64) + PVOID Key; // internal + DWORD LineNumber; // line number in file + PCHAR FileName; // full filename + DWORD64 Address; // first instruction of line +} IMAGEHLP_LINE64, *PIMAGEHLP_LINE64; + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define IMAGEHLP_LINE IMAGEHLP_LINE64 +#define PIMAGEHLP_LINE PIMAGEHLP_LINE64 +#else +typedef struct _IMAGEHLP_LINE { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_LINE) + PVOID Key; // internal + DWORD LineNumber; // line number in file + PCHAR FileName; // full filename + DWORD Address; // first instruction of line +} IMAGEHLP_LINE, *PIMAGEHLP_LINE; +#endif + +// +// source file structure +// + +typedef struct _SOURCEFILE { + DWORD64 ModBase; // base address of loaded module + PCHAR FileName; // full filename of source +} SOURCEFILE, *PSOURCEFILE; + +// +// data structures used for registered symbol callbacks +// + +#define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001 +#define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002 +#define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003 +#define CBA_SYMBOLS_UNLOADED 0x00000004 +#define CBA_DUPLICATE_SYMBOL 0x00000005 +#define CBA_READ_MEMORY 0x00000006 +#define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007 +#define CBA_SET_OPTIONS 0x00000008 +#define CBA_EVENT 0x00000010 +#define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020 +#define CBA_DEBUG_INFO 0x10000000 + +typedef struct _IMAGEHLP_CBA_READ_MEMORY { + DWORD64 addr; // address to read from + PVOID buf; // buffer to read to + DWORD bytes; // amount of bytes to read + DWORD *bytesread; // pointer to store amount of bytes read +} IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY; + +enum { + sevInfo = 0, + sevProblem, + sevAttn, + sevFatal, + sevMax // unused +}; + +typedef struct _IMAGEHLP_CBA_EVENT { + DWORD severity; // values from sevInfo to sevFatal + DWORD code; // numerical code IDs the error + PCHAR desc; // may contain a text description of the error + PVOID object; // value dependant upon the error code +} IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT; + +typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64 { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_DEFERRED_SYMBOL_LOAD64) + DWORD64 BaseOfImage; // base load address of module + DWORD CheckSum; // checksum from the pe header + DWORD TimeDateStamp; // date/time stamp from pe header + CHAR FileName[MAX_PATH]; // symbols file or image name + BOOLEAN Reparse; // load failure reparse + HANDLE hFile; // file handle, if passed + DWORD Flags; // +} IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64; + +#define DSLFLAG_MISMATCHED_PDB 0x1 +#define DSLFLAG_MISMATCHED_DBG 0x2 + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64 +#define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 +#else +typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_DEFERRED_SYMBOL_LOAD) + DWORD BaseOfImage; // base load address of module + DWORD CheckSum; // checksum from the pe header + DWORD TimeDateStamp; // date/time stamp from pe header + CHAR FileName[MAX_PATH]; // symbols file or image name + BOOLEAN Reparse; // load failure reparse + HANDLE hFile; // file handle, if passed +} IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD; +#endif + +typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64 { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_DUPLICATE_SYMBOL64) + DWORD NumberOfDups; // number of duplicates in the Symbol array + PIMAGEHLP_SYMBOL64 Symbol; // array of duplicate symbols + DWORD SelectedSymbol; // symbol selected (-1 to start) +} IMAGEHLP_DUPLICATE_SYMBOL64, *PIMAGEHLP_DUPLICATE_SYMBOL64; + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64 +#define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64 +#else +typedef struct _IMAGEHLP_DUPLICATE_SYMBOL { + DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_DUPLICATE_SYMBOL) + DWORD NumberOfDups; // number of duplicates in the Symbol array + PIMAGEHLP_SYMBOL Symbol; // array of duplicate symbols + DWORD SelectedSymbol; // symbol selected (-1 to start) +} IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL; +#endif + +// If dbghelp ever needs to display graphical UI, it will use this as the parent window. + +BOOL +SymSetParentWindow( + HWND hwnd + ); + +// +// options that are set/returned by SymSetOptions() & SymGetOptions() +// these are used as a mask +// +#define SYMOPT_CASE_INSENSITIVE 0x00000001 +#define SYMOPT_UNDNAME 0x00000002 +#define SYMOPT_DEFERRED_LOADS 0x00000004 +#define SYMOPT_NO_CPP 0x00000008 +#define SYMOPT_LOAD_LINES 0x00000010 +#define SYMOPT_OMAP_FIND_NEAREST 0x00000020 +#define SYMOPT_LOAD_ANYTHING 0x00000040 +#define SYMOPT_IGNORE_CVREC 0x00000080 +#define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100 +#define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200 +#define SYMOPT_EXACT_SYMBOLS 0x00000400 +#define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800 +#define SYMOPT_IGNORE_NT_SYMPATH 0x00001000 +#define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000 +#define SYMOPT_PUBLICS_ONLY 0x00004000 +#define SYMOPT_NO_PUBLICS 0x00008000 +#define SYMOPT_AUTO_PUBLICS 0x00010000 +#define SYMOPT_NO_IMAGE_SEARCH 0x00020000 +#define SYMOPT_SECURE 0x00040000 + +#define SYMOPT_DEBUG 0x80000000 + +DWORD +IMAGEAPI +SymSetOptions( + IN DWORD SymOptions + ); + +DWORD +IMAGEAPI +SymGetOptions( + VOID + ); + +BOOL +IMAGEAPI +SymCleanup( + IN HANDLE hProcess + ); + +BOOL +IMAGEAPI +SymMatchString( + IN LPSTR string, + IN LPSTR expression, + IN BOOL fCase + ); + +typedef BOOL +(CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)( + PSOURCEFILE pSourceFile, + PVOID UserContext + ); + +BOOL +IMAGEAPI +SymEnumSourceFiles( + IN HANDLE hProcess, + IN ULONG64 ModBase, + IN LPSTR Mask, + IN PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles, + IN PVOID UserContext + ); + +BOOL +IMAGEAPI +SymEnumerateModules64( + IN HANDLE hProcess, + IN PSYM_ENUMMODULES_CALLBACK64 EnumModulesCallback, + IN PVOID UserContext + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymEnumerateModules SymEnumerateModules64 +#else +BOOL +IMAGEAPI +SymEnumerateModules( + IN HANDLE hProcess, + IN PSYM_ENUMMODULES_CALLBACK EnumModulesCallback, + IN PVOID UserContext + ); +#endif + +BOOL +IMAGEAPI +SymEnumerateSymbols64( + IN HANDLE hProcess, + IN DWORD64 BaseOfDll, + IN PSYM_ENUMSYMBOLS_CALLBACK64 EnumSymbolsCallback, + IN PVOID UserContext + ); + +BOOL +IMAGEAPI +SymEnumerateSymbolsW64( + IN HANDLE hProcess, + IN DWORD64 BaseOfDll, + IN PSYM_ENUMSYMBOLS_CALLBACK64W EnumSymbolsCallback, + IN PVOID UserContext + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymEnumerateSymbols SymEnumerateSymbols64 +#define SymEnumerateSymbolsW SymEnumerateSymbolsW64 +#else +BOOL +IMAGEAPI +SymEnumerateSymbols( + IN HANDLE hProcess, + IN DWORD BaseOfDll, + IN PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback, + IN PVOID UserContext + ); + +BOOL +IMAGEAPI +SymEnumerateSymbolsW( + IN HANDLE hProcess, + IN DWORD BaseOfDll, + IN PSYM_ENUMSYMBOLS_CALLBACKW EnumSymbolsCallback, + IN PVOID UserContext + ); +#endif + +BOOL +IMAGEAPI +EnumerateLoadedModules64( + IN HANDLE hProcess, + IN PENUMLOADED_MODULES_CALLBACK64 EnumLoadedModulesCallback, + IN PVOID UserContext + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define EnumerateLoadedModules EnumerateLoadedModules64 +#else +BOOL +IMAGEAPI +EnumerateLoadedModules( + IN HANDLE hProcess, + IN PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback, + IN PVOID UserContext + ); +#endif + +PVOID +IMAGEAPI +SymFunctionTableAccess64( + HANDLE hProcess, + DWORD64 AddrBase + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymFunctionTableAccess SymFunctionTableAccess64 +#else +PVOID +IMAGEAPI +SymFunctionTableAccess( + HANDLE hProcess, + DWORD AddrBase + ); +#endif + +BOOL +IMAGEAPI +SymGetModuleInfo64( + IN HANDLE hProcess, + IN DWORD64 qwAddr, + OUT PIMAGEHLP_MODULE64 ModuleInfo + ); + +BOOL +IMAGEAPI +SymGetModuleInfoW64( + IN HANDLE hProcess, + IN DWORD64 qwAddr, + OUT PIMAGEHLP_MODULEW64 ModuleInfo + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetModuleInfo SymGetModuleInfo64 +#define SymGetModuleInfoW SymGetModuleInfoW64 +#else +BOOL +IMAGEAPI +SymGetModuleInfo( + IN HANDLE hProcess, + IN DWORD dwAddr, + OUT PIMAGEHLP_MODULE ModuleInfo + ); + +BOOL +IMAGEAPI +SymGetModuleInfoW( + IN HANDLE hProcess, + IN DWORD dwAddr, + OUT PIMAGEHLP_MODULEW ModuleInfo + ); +#endif + +DWORD64 +IMAGEAPI +SymGetModuleBase64( + IN HANDLE hProcess, + IN DWORD64 qwAddr + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetModuleBase SymGetModuleBase64 +#else +DWORD +IMAGEAPI +SymGetModuleBase( + IN HANDLE hProcess, + IN DWORD dwAddr + ); +#endif + +BOOL +IMAGEAPI +SymGetSymNext64( + IN HANDLE hProcess, + IN OUT PIMAGEHLP_SYMBOL64 Symbol + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetSymNext SymGetSymNext64 +#else +BOOL +IMAGEAPI +SymGetSymNext( + IN HANDLE hProcess, + IN OUT PIMAGEHLP_SYMBOL Symbol + ); +#endif + +BOOL +IMAGEAPI +SymGetSymPrev64( + IN HANDLE hProcess, + IN OUT PIMAGEHLP_SYMBOL64 Symbol + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetSymPrev SymGetSymPrev64 +#else +BOOL +IMAGEAPI +SymGetSymPrev( + IN HANDLE hProcess, + IN OUT PIMAGEHLP_SYMBOL Symbol + ); +#endif + +BOOL +IMAGEAPI +SymGetLineFromAddr64( + IN HANDLE hProcess, + IN DWORD64 qwAddr, + OUT PDWORD pdwDisplacement, + OUT PIMAGEHLP_LINE64 Line64 + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetLineFromAddr SymGetLineFromAddr64 +#else +BOOL +IMAGEAPI +SymGetLineFromAddr( + IN HANDLE hProcess, + IN DWORD dwAddr, + OUT PDWORD pdwDisplacement, + OUT PIMAGEHLP_LINE Line + ); +#endif + +BOOL +IMAGEAPI +SymGetLineFromName64( + IN HANDLE hProcess, + IN PSTR ModuleName, + IN PSTR FileName, + IN DWORD dwLineNumber, + OUT PLONG plDisplacement, + IN OUT PIMAGEHLP_LINE64 Line + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetLineFromName SymGetLineFromName64 +#else +BOOL +IMAGEAPI +SymGetLineFromName( + IN HANDLE hProcess, + IN PSTR ModuleName, + IN PSTR FileName, + IN DWORD dwLineNumber, + OUT PLONG plDisplacement, + IN OUT PIMAGEHLP_LINE Line + ); +#endif + +BOOL +IMAGEAPI +SymGetLineNext64( + IN HANDLE hProcess, + IN OUT PIMAGEHLP_LINE64 Line + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetLineNext SymGetLineNext64 +#else +BOOL +IMAGEAPI +SymGetLineNext( + IN HANDLE hProcess, + IN OUT PIMAGEHLP_LINE Line + ); +#endif + +BOOL +IMAGEAPI +SymGetLinePrev64( + IN HANDLE hProcess, + IN OUT PIMAGEHLP_LINE64 Line + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetLinePrev SymGetLinePrev64 +#else +BOOL +IMAGEAPI +SymGetLinePrev( + IN HANDLE hProcess, + IN OUT PIMAGEHLP_LINE Line + ); +#endif + +BOOL +IMAGEAPI +SymMatchFileName( + IN PSTR FileName, + IN PSTR Match, + OUT PSTR *FileNameStop, + OUT PSTR *MatchStop + ); + +BOOL +IMAGEAPI +SymInitialize( + IN HANDLE hProcess, + IN PSTR UserSearchPath, + IN BOOL fInvadeProcess + ); + +BOOL +IMAGEAPI +SymGetSearchPath( + IN HANDLE hProcess, + OUT PSTR SearchPath, + IN DWORD SearchPathLength + ); + +BOOL +IMAGEAPI +SymSetSearchPath( + IN HANDLE hProcess, + IN PSTR SearchPath + ); + +DWORD64 +IMAGEAPI +SymLoadModule64( + IN HANDLE hProcess, + IN HANDLE hFile, + IN PSTR ImageName, + IN PSTR ModuleName, + IN DWORD64 BaseOfDll, + IN DWORD SizeOfDll + ); + +#define SLMFLAG_VIRTUAL 0x1 + +DWORD64 +IMAGEAPI +SymLoadModuleEx( + IN HANDLE hProcess, + IN HANDLE hFile, + IN PSTR ImageName, + IN PSTR ModuleName, + IN DWORD64 BaseOfDll, + IN DWORD DllSize, + IN PMODLOAD_DATA Data, + IN DWORD Flags + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymLoadModule SymLoadModule64 +#else +DWORD +IMAGEAPI +SymLoadModule( + IN HANDLE hProcess, + IN HANDLE hFile, + IN PSTR ImageName, + IN PSTR ModuleName, + IN DWORD BaseOfDll, + IN DWORD SizeOfDll + ); +#endif + +BOOL +IMAGEAPI +SymUnloadModule64( + IN HANDLE hProcess, + IN DWORD64 BaseOfDll + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymUnloadModule SymUnloadModule64 +#else +BOOL +IMAGEAPI +SymUnloadModule( + IN HANDLE hProcess, + IN DWORD BaseOfDll + ); +#endif + +BOOL +IMAGEAPI +SymUnDName64( + IN PIMAGEHLP_SYMBOL64 sym, // Symbol to undecorate + OUT PSTR UnDecName, // Buffer to store undecorated name in + IN DWORD UnDecNameLength // Size of the buffer + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymUnDName SymUnDName64 +#else +BOOL +IMAGEAPI +SymUnDName( + IN PIMAGEHLP_SYMBOL sym, // Symbol to undecorate + OUT PSTR UnDecName, // Buffer to store undecorated name in + IN DWORD UnDecNameLength // Size of the buffer + ); +#endif + +BOOL +IMAGEAPI +SymRegisterCallback64( + IN HANDLE hProcess, + IN PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, + IN ULONG64 UserContext + ); + +BOOL +IMAGEAPI +SymRegisterFunctionEntryCallback64( + IN HANDLE hProcess, + IN PSYMBOL_FUNCENTRY_CALLBACK64 CallbackFunction, + IN ULONG64 UserContext + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymRegisterCallback SymRegisterCallback64 +#define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64 +#else +BOOL +IMAGEAPI +SymRegisterCallback( + IN HANDLE hProcess, + IN PSYMBOL_REGISTERED_CALLBACK CallbackFunction, + IN PVOID UserContext + ); + +BOOL +IMAGEAPI +SymRegisterFunctionEntryCallback( + IN HANDLE hProcess, + IN PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction, + IN PVOID UserContext + ); +#endif + + +typedef struct _IMAGEHLP_SYMBOL_SRC { + DWORD sizeofstruct; + DWORD type; + char file[MAX_PATH]; +} IMAGEHLP_SYMBOL_SRC, *PIMAGEHLP_SYMBOL_SRC; + +typedef struct _MODULE_TYPE_INFO { // AKA TYPTYP + USHORT dataLength; + USHORT leaf; + BYTE data[1]; +} MODULE_TYPE_INFO, *PMODULE_TYPE_INFO; + +typedef struct _SYMBOL_INFO { + ULONG SizeOfStruct; + ULONG TypeIndex; // Type Index of symbol + ULONG64 Reserved[2]; + ULONG info; + ULONG Size; + ULONG64 ModBase; // Base Address of module comtaining this symbol + ULONG Flags; + ULONG64 Value; // Value of symbol, ValuePresent should be 1 + ULONG64 Address; // Address of symbol including base address of module + ULONG Register; // register holding value or pointer to value + ULONG Scope; // scope of the symbol + ULONG Tag; // pdb classification + ULONG NameLen; // Actual length of name + ULONG MaxNameLen; + CHAR Name[1]; // Name of symbol +} SYMBOL_INFO, *PSYMBOL_INFO; + +typedef struct _SYMBOL_INFO_PACKAGE { + SYMBOL_INFO si; + CHAR name[MAX_SYM_NAME + 1]; +} SYMBOL_INFO_PACKAGE, *PSYMBOL_INFO_PACKAGE; + +typedef struct _IMAGEHLP_STACK_FRAME +{ + ULONG64 InstructionOffset; + ULONG64 ReturnOffset; + ULONG64 FrameOffset; + ULONG64 StackOffset; + ULONG64 BackingStoreOffset; + ULONG64 FuncTableEntry; + ULONG64 Params[4]; + ULONG64 Reserved[5]; + BOOL Virtual; + ULONG Reserved2; +} IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME; + +typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT; + + +BOOL +IMAGEAPI +SymSetContext( + HANDLE hProcess, + PIMAGEHLP_STACK_FRAME StackFrame, + PIMAGEHLP_CONTEXT Context + ); + +BOOL +IMAGEAPI +SymFromAddr( + IN HANDLE hProcess, + IN DWORD64 Address, + OUT PDWORD64 Displacement, + IN OUT PSYMBOL_INFO Symbol + ); + +// While SymFromName will provide a symbol from a name, +// SymEnumSymbols can provide the same matching information +// for ALL symbols with a matching name, even regular +// expressions. That way you can search across modules +// and differentiate between identically named symbols. + +BOOL +IMAGEAPI +SymFromName( + IN HANDLE hProcess, + IN LPSTR Name, + OUT PSYMBOL_INFO Symbol + ); + +typedef BOOL +(CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)( + PSYMBOL_INFO pSymInfo, + ULONG SymbolSize, + PVOID UserContext + ); + +BOOL +IMAGEAPI +SymEnumSymbols( + IN HANDLE hProcess, + IN ULONG64 BaseOfDll, + IN PCSTR Mask, + IN PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, + IN PVOID UserContext + ); + +BOOL +IMAGEAPI +SymEnumSymbolsForAddr( + IN HANDLE hProcess, + IN DWORD64 Address, + IN PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, + IN PVOID UserContext + ); + +typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO { + TI_GET_SYMTAG, + TI_GET_SYMNAME, + TI_GET_LENGTH, + TI_GET_TYPE, + TI_GET_TYPEID, + TI_GET_BASETYPE, + TI_GET_ARRAYINDEXTYPEID, + TI_FINDCHILDREN, + TI_GET_DATAKIND, + TI_GET_ADDRESSOFFSET, + TI_GET_OFFSET, + TI_GET_VALUE, + TI_GET_COUNT, + TI_GET_CHILDRENCOUNT, + TI_GET_BITPOSITION, + TI_GET_VIRTUALBASECLASS, + TI_GET_VIRTUALTABLESHAPEID, + TI_GET_VIRTUALBASEPOINTEROFFSET, + TI_GET_CLASSPARENTID, + TI_GET_NESTED, + TI_GET_SYMINDEX, + TI_GET_LEXICALPARENT, + TI_GET_ADDRESS, + TI_GET_THISADJUST, + TI_GET_UDTKIND, + TI_IS_EQUIV_TO, + TI_GET_CALLING_CONVENTION, +} IMAGEHLP_SYMBOL_TYPE_INFO; + +typedef struct _TI_FINDCHILDREN_PARAMS { + ULONG Count; + ULONG Start; + ULONG ChildId[1]; +} TI_FINDCHILDREN_PARAMS; + +BOOL +IMAGEAPI +SymGetTypeInfo( + IN HANDLE hProcess, + IN DWORD64 ModBase, + IN ULONG TypeId, + IN IMAGEHLP_SYMBOL_TYPE_INFO GetType, + OUT PVOID pInfo + ); + +BOOL +IMAGEAPI +SymEnumTypes( + IN HANDLE hProcess, + IN ULONG64 BaseOfDll, + IN PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, + IN PVOID UserContext + ); + +BOOL +IMAGEAPI +SymGetTypeFromName( + IN HANDLE hProcess, + IN ULONG64 BaseOfDll, + IN LPSTR Name, + OUT PSYMBOL_INFO Symbol + ); + +BOOL +IMAGEAPI +SymAddSymbol( + IN HANDLE hProcess, + IN ULONG64 BaseOfDll, + IN PCSTR Name, + IN DWORD64 Address, + IN DWORD Size, + IN DWORD Flags + ); + +BOOL +IMAGEAPI +SymDeleteSymbol( + IN HANDLE hProcess, + IN ULONG64 BaseOfDll, + IN PCSTR Name, + IN DWORD64 Address, + IN DWORD Flags + ); + +// +// Full user-mode dump creation. +// + +typedef BOOL (WINAPI *PDBGHELP_CREATE_USER_DUMP_CALLBACK)( + DWORD DataType, + PVOID* Data, + LPDWORD DataLength, + PVOID UserData + ); + +BOOL +WINAPI +DbgHelpCreateUserDump( + IN LPSTR FileName, + IN PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback, + IN PVOID UserData + ); + +BOOL +WINAPI +DbgHelpCreateUserDumpW( + IN LPWSTR FileName, + IN PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback, + IN PVOID UserData + ); + +// ----------------------------------------------------------------- +// The following 4 legacy APIs are fully supported, but newer +// ones are recommended. SymFromName and SymFromAddr provide +// much more detailed info on the returned symbol. + +BOOL +IMAGEAPI +SymGetSymFromAddr64( + IN HANDLE hProcess, + IN DWORD64 qwAddr, + OUT PDWORD64 pdwDisplacement, + OUT PIMAGEHLP_SYMBOL64 Symbol + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetSymFromAddr SymGetSymFromAddr64 +#else +BOOL +IMAGEAPI +SymGetSymFromAddr( + IN HANDLE hProcess, + IN DWORD dwAddr, + OUT PDWORD pdwDisplacement, + OUT PIMAGEHLP_SYMBOL Symbol + ); +#endif + +// While following two APIs will provide a symbol from a name, +// SymEnumSymbols can provide the same matching information +// for ALL symbols with a matching name, even regular +// expressions. That way you can search across modules +// and differentiate between identically named symbols. + +BOOL +IMAGEAPI +SymGetSymFromName64( + IN HANDLE hProcess, + IN PSTR Name, + OUT PIMAGEHLP_SYMBOL64 Symbol + ); + +#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) +#define SymGetSymFromName SymGetSymFromName64 +#else +BOOL +IMAGEAPI +SymGetSymFromName( + IN HANDLE hProcess, + IN PSTR Name, + OUT PIMAGEHLP_SYMBOL Symbol + ); +#endif + + +// ----------------------------------------------------------------- +// The following APIs exist only for backwards compatibility +// with a pre-release version documented in an MSDN release. + +// You should use SymFindFileInPath if you want to maintain +// future compatibility. + +DBHLP_DEPRECIATED +BOOL +IMAGEAPI +FindFileInPath( + HANDLE hprocess, + LPSTR SearchPath, + LPSTR FileName, + PVOID id, + DWORD two, + DWORD three, + DWORD flags, + LPSTR FilePath + ); + +// You should use SymFindFileInPath if you want to maintain +// future compatibility. + +DBHLP_DEPRECIATED +BOOL +IMAGEAPI +FindFileInSearchPath( + HANDLE hprocess, + LPSTR SearchPath, + LPSTR FileName, + DWORD one, + DWORD two, + DWORD three, + LPSTR FilePath + ); + +DBHLP_DEPRECIATED +BOOL +IMAGEAPI +SymEnumSym( + IN HANDLE hProcess, + IN ULONG64 BaseOfDll, + IN PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, + IN PVOID UserContext + ); + +// These values should not be used. +// They have been replaced by SYMFLAG_ values. + +#define SYMF_OMAP_GENERATED 0x00000001 +#define SYMF_OMAP_MODIFIED 0x00000002 +#define SYMF_REGISTER 0x00000008 +#define SYMF_REGREL 0x00000010 +#define SYMF_FRAMEREL 0x00000020 +#define SYMF_PARAMETER 0x00000040 +#define SYMF_LOCAL 0x00000080 +#define SYMF_CONSTANT 0x00000100 +#define SYMF_EXPORT 0x00000200 +#define SYMF_FORWARDER 0x00000400 +#define SYMF_FUNCTION 0x00000800 +#define SYMF_VIRTUAL 0x00001000 +#define SYMF_THUNK 0x00002000 +#define SYMF_TLSREL 0x00004000 + +// These values should also not be used. +// They have been replaced by SYMFLAG_ values. + +#define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1 +#define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER // 0x0008 +#define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL // 0x0010 +#define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL // 0x0020 +#define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER // 0x0040 +#define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL // 0x0080 +#define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT // 0x0100 +#define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION // 0x0800 +#define IMAGEHLP_SYMBOL_VIRTUAL SYMF_VIRTUAL // 0x1000 +#define IMAGEHLP_SYMBOL_THUNK SYMF_THUNK // 0x2000 +#define IMAGEHLP_SYMBOL_INFO_TLSRELATIVE SYMF_TLSREL // 0x4000 + + +#include + +#pragma warning(disable:4200) // Zero length array + + +#define MINIDUMP_SIGNATURE ('PMDM') +#define MINIDUMP_VERSION (42899) +typedef DWORD RVA; +typedef ULONG64 RVA64; + +typedef struct _MINIDUMP_LOCATION_DESCRIPTOR { + ULONG32 DataSize; + RVA Rva; +} MINIDUMP_LOCATION_DESCRIPTOR; + +typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 { + ULONG64 DataSize; + RVA64 Rva; +} MINIDUMP_LOCATION_DESCRIPTOR64; + + +typedef struct _MINIDUMP_MEMORY_DESCRIPTOR { + ULONG64 StartOfMemoryRange; + MINIDUMP_LOCATION_DESCRIPTOR Memory; +} MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR; + +// DESCRIPTOR64 is used for full-memory minidumps where +// all of the raw memory is laid out sequentially at the +// end of the dump. There is no need for individual RVAs +// as the RVA is the base RVA plus the sum of the preceeding +// data blocks. +typedef struct _MINIDUMP_MEMORY_DESCRIPTOR64 { + ULONG64 StartOfMemoryRange; + ULONG64 DataSize; +} MINIDUMP_MEMORY_DESCRIPTOR64, *PMINIDUMP_MEMORY_DESCRIPTOR64; + + +typedef struct _MINIDUMP_HEADER { + ULONG32 Signature; + ULONG32 Version; + ULONG32 NumberOfStreams; + RVA StreamDirectoryRva; + ULONG32 CheckSum; + union { + ULONG32 Reserved; + ULONG32 TimeDateStamp; + }; + ULONG64 Flags; +} MINIDUMP_HEADER, *PMINIDUMP_HEADER; + +// +// The MINIDUMP_HEADER field StreamDirectoryRva points to +// an array of MINIDUMP_DIRECTORY structures. +// + +typedef struct _MINIDUMP_DIRECTORY { + ULONG32 StreamType; + MINIDUMP_LOCATION_DESCRIPTOR Location; +} MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY; + + +typedef struct _MINIDUMP_STRING { + ULONG32 Length; // Length in bytes of the string + WCHAR Buffer [0]; // Variable size buffer +} MINIDUMP_STRING, *PMINIDUMP_STRING; + + + +// +// The MINIDUMP_DIRECTORY field StreamType may be one of the following types. +// Types will be added in the future, so if a program reading the minidump +// header encounters a stream type it does not understand it should ignore +// the data altogether. Any tag above LastReservedStream will not be used by +// the system and is reserved for program-specific information. +// + +typedef enum _MINIDUMP_STREAM_TYPE { + + UnusedStream = 0, + ReservedStream0 = 1, + ReservedStream1 = 2, + ThreadListStream = 3, + ModuleListStream = 4, + MemoryListStream = 5, + ExceptionStream = 6, + SystemInfoStream = 7, + ThreadExListStream = 8, + Memory64ListStream = 9, + CommentStreamA = 10, + CommentStreamW = 11, + HandleDataStream = 12, + FunctionTableStream = 13, + UnloadedModuleListStream = 14, + MiscInfoStream = 15, + + LastReservedStream = 0xffff + +} MINIDUMP_STREAM_TYPE; + + +// +// The minidump system information contains processor and +// Operating System specific information. +// + +#if defined(_MSC_VER) +#if _MSC_VER >= 800 +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) /* Nameless struct/union */ +#endif +#endif + +typedef struct _MINIDUMP_SYSTEM_INFO { + + // + // ProcessorArchitecture, ProcessorLevel and ProcessorRevision are all + // taken from the SYSTEM_INFO structure obtained by GetSystemInfo( ). + // + + USHORT ProcessorArchitecture; + USHORT ProcessorLevel; + USHORT ProcessorRevision; + + union { + USHORT Reserved0; + struct { + UCHAR NumberOfProcessors; + UCHAR ProductType; + }; + }; + + // + // MajorVersion, MinorVersion, BuildNumber, PlatformId and + // CSDVersion are all taken from the OSVERSIONINFO structure + // returned by GetVersionEx( ). + // + + ULONG32 MajorVersion; + ULONG32 MinorVersion; + ULONG32 BuildNumber; + ULONG32 PlatformId; + + // + // RVA to a CSDVersion string in the string table. + // + + RVA CSDVersionRva; + + union { + ULONG32 Reserved1; + struct { + USHORT SuiteMask; + USHORT Reserved2; + }; + }; + + // + // CPU information is obtained from one of two places. + // + // 1) On x86 computers, CPU_INFORMATION is obtained from the CPUID + // instruction. You must use the X86 portion of the union for X86 + // computers. + // + // 2) On non-x86 architectures, CPU_INFORMATION is obtained by calling + // IsProcessorFeatureSupported(). + // + + union _CPU_INFORMATION { + + // + // X86 platforms use CPUID function to obtain processor information. + // + + struct { + + // + // CPUID Subfunction 0, register EAX (VendorId [0]), + // EBX (VendorId [1]) and ECX (VendorId [2]). + // + + ULONG32 VendorId [ 3 ]; + + // + // CPUID Subfunction 1, register EAX + // + + ULONG32 VersionInformation; + + // + // CPUID Subfunction 1, register EDX + // + + ULONG32 FeatureInformation; + + + // + // CPUID, Subfunction 80000001, register EBX. This will only + // be obtained if the vendor id is "AuthenticAMD". + // + + ULONG32 AMDExtendedCpuFeatures; + + } X86CpuInfo; + + // + // Non-x86 platforms use processor feature flags. + // + + struct { + + ULONG64 ProcessorFeatures [ 2 ]; + + } OtherCpuInfo; + + } Cpu; + +} MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO; + +typedef union _CPU_INFORMATION CPU_INFORMATION, *PCPU_INFORMATION; + +#if defined(_MSC_VER) +#if _MSC_VER >= 800 +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(disable:4201) /* Nameless struct/union */ +#endif +#endif +#endif + +// +// The minidump thread contains standard thread +// information plus an RVA to the memory for this +// thread and an RVA to the CONTEXT structure for +// this thread. +// + + +// +// ThreadId must be 4 bytes on all architectures. +// + +C_ASSERT (sizeof ( ((PPROCESS_INFORMATION)0)->dwThreadId ) == 4); + +typedef struct _MINIDUMP_THREAD { + ULONG32 ThreadId; + ULONG32 SuspendCount; + ULONG32 PriorityClass; + ULONG32 Priority; + ULONG64 Teb; + MINIDUMP_MEMORY_DESCRIPTOR Stack; + MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; +} MINIDUMP_THREAD, *PMINIDUMP_THREAD; + +// +// The thread list is a container of threads. +// + +typedef struct _MINIDUMP_THREAD_LIST { + ULONG32 NumberOfThreads; + MINIDUMP_THREAD Threads [0]; +} MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST; + + +typedef struct _MINIDUMP_THREAD_EX { + ULONG32 ThreadId; + ULONG32 SuspendCount; + ULONG32 PriorityClass; + ULONG32 Priority; + ULONG64 Teb; + MINIDUMP_MEMORY_DESCRIPTOR Stack; + MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; + MINIDUMP_MEMORY_DESCRIPTOR BackingStore; +} MINIDUMP_THREAD_EX, *PMINIDUMP_THREAD_EX; + +// +// The thread list is a container of threads. +// + +typedef struct _MINIDUMP_THREAD_EX_LIST { + ULONG32 NumberOfThreads; + MINIDUMP_THREAD_EX Threads [0]; +} MINIDUMP_THREAD_EX_LIST, *PMINIDUMP_THREAD_EX_LIST; + + +// +// The MINIDUMP_EXCEPTION is the same as EXCEPTION on Win64. +// + +typedef struct _MINIDUMP_EXCEPTION { + ULONG32 ExceptionCode; + ULONG32 ExceptionFlags; + ULONG64 ExceptionRecord; + ULONG64 ExceptionAddress; + ULONG32 NumberParameters; + ULONG32 __unusedAlignment; + ULONG64 ExceptionInformation [ EXCEPTION_MAXIMUM_PARAMETERS ]; +} MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION; + + +// +// The exception information stream contains the id of the thread that caused +// the exception (ThreadId), the exception record for the exception +// (ExceptionRecord) and an RVA to the thread context where the exception +// occured. +// + +typedef struct MINIDUMP_EXCEPTION_STREAM { + ULONG32 ThreadId; + ULONG32 __alignment; + MINIDUMP_EXCEPTION ExceptionRecord; + MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; +} MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM; + + +// +// The MINIDUMP_MODULE contains information about a +// a specific module. It includes the CheckSum and +// the TimeDateStamp for the module so the module +// can be reloaded during the analysis phase. +// + +typedef struct _MINIDUMP_MODULE { + ULONG64 BaseOfImage; + ULONG32 SizeOfImage; + ULONG32 CheckSum; + ULONG32 TimeDateStamp; + RVA ModuleNameRva; + VS_FIXEDFILEINFO VersionInfo; + MINIDUMP_LOCATION_DESCRIPTOR CvRecord; + MINIDUMP_LOCATION_DESCRIPTOR MiscRecord; + ULONG64 Reserved0; // Reserved for future use. + ULONG64 Reserved1; // Reserved for future use. +} MINIDUMP_MODULE, *PMINIDUMP_MODULE; + + +// +// The minidump module list is a container for modules. +// + +typedef struct _MINIDUMP_MODULE_LIST { + ULONG32 NumberOfModules; + MINIDUMP_MODULE Modules [ 0 ]; +} MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST; + + +// +// Memory Ranges +// + +typedef struct _MINIDUMP_MEMORY_LIST { + ULONG32 NumberOfMemoryRanges; + MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges [0]; +} MINIDUMP_MEMORY_LIST, *PMINIDUMP_MEMORY_LIST; + +typedef struct _MINIDUMP_MEMORY64_LIST { + ULONG64 NumberOfMemoryRanges; + RVA64 BaseRva; + MINIDUMP_MEMORY_DESCRIPTOR64 MemoryRanges [0]; +} MINIDUMP_MEMORY64_LIST, *PMINIDUMP_MEMORY64_LIST; + + +// +// Support for user supplied exception information. +// + +typedef struct _MINIDUMP_EXCEPTION_INFORMATION { + DWORD ThreadId; + PEXCEPTION_POINTERS ExceptionPointers; + BOOL ClientPointers; +} MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION; + + +// +// Support for capturing system handle state at the time of the dump. +// + +typedef struct _MINIDUMP_HANDLE_DESCRIPTOR { + ULONG64 Handle; + RVA TypeNameRva; + RVA ObjectNameRva; + ULONG32 Attributes; + ULONG32 GrantedAccess; + ULONG32 HandleCount; + ULONG32 PointerCount; +} MINIDUMP_HANDLE_DESCRIPTOR, *PMINIDUMP_HANDLE_DESCRIPTOR; + +typedef struct _MINIDUMP_HANDLE_DATA_STREAM { + ULONG32 SizeOfHeader; + ULONG32 SizeOfDescriptor; + ULONG32 NumberOfDescriptors; + ULONG32 Reserved; +} MINIDUMP_HANDLE_DATA_STREAM, *PMINIDUMP_HANDLE_DATA_STREAM; + + +// +// Support for capturing dynamic function table state at the time of the dump. +// + +typedef struct _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR { + ULONG64 MinimumAddress; + ULONG64 MaximumAddress; + ULONG64 BaseAddress; + ULONG32 EntryCount; + ULONG32 SizeOfAlignPad; +} MINIDUMP_FUNCTION_TABLE_DESCRIPTOR, *PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR; + +typedef struct _MINIDUMP_FUNCTION_TABLE_STREAM { + ULONG32 SizeOfHeader; + ULONG32 SizeOfDescriptor; + ULONG32 SizeOfNativeDescriptor; + ULONG32 SizeOfFunctionEntry; + ULONG32 NumberOfDescriptors; + ULONG32 SizeOfAlignPad; +} MINIDUMP_FUNCTION_TABLE_STREAM, *PMINIDUMP_FUNCTION_TABLE_STREAM; + + +// +// The MINIDUMP_UNLOADED_MODULE contains information about a +// a specific module that was previously loaded but no +// longer is. This can help with diagnosing problems where +// callers attempt to call code that is no longer loaded. +// + +typedef struct _MINIDUMP_UNLOADED_MODULE { + ULONG64 BaseOfImage; + ULONG32 SizeOfImage; + ULONG32 CheckSum; + ULONG32 TimeDateStamp; + RVA ModuleNameRva; +} MINIDUMP_UNLOADED_MODULE, *PMINIDUMP_UNLOADED_MODULE; + + +// +// The minidump unloaded module list is a container for unloaded modules. +// + +typedef struct _MINIDUMP_UNLOADED_MODULE_LIST { + ULONG32 SizeOfHeader; + ULONG32 SizeOfEntry; + ULONG32 NumberOfEntries; +} MINIDUMP_UNLOADED_MODULE_LIST, *PMINIDUMP_UNLOADED_MODULE_LIST; + + +// +// The miscellaneous information stream contains a variety +// of small pieces of information. A member is valid if +// it's within the available size and its corresponding +// bit is set. +// + +#define MINIDUMP_MISC1_PROCESS_ID 0x00000001 +#define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002 + +typedef struct _MINIDUMP_MISC_INFO { + ULONG32 SizeOfInfo; + ULONG32 Flags1; + ULONG32 ProcessId; + ULONG32 ProcessCreateTime; + ULONG32 ProcessUserTime; + ULONG32 ProcessKernelTime; +} MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO; + + +// +// Support for arbitrary user-defined information. +// + +typedef struct _MINIDUMP_USER_RECORD { + ULONG32 Type; + MINIDUMP_LOCATION_DESCRIPTOR Memory; +} MINIDUMP_USER_RECORD, *PMINIDUMP_USER_RECORD; + + +typedef struct _MINIDUMP_USER_STREAM { + ULONG32 Type; + ULONG BufferSize; + PVOID Buffer; + +} MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM; + + +typedef struct _MINIDUMP_USER_STREAM_INFORMATION { + ULONG UserStreamCount; + PMINIDUMP_USER_STREAM UserStreamArray; +} MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION; + +// +// Callback support. +// + +typedef enum _MINIDUMP_CALLBACK_TYPE { + ModuleCallback, + ThreadCallback, + ThreadExCallback, + IncludeThreadCallback, + IncludeModuleCallback, +} MINIDUMP_CALLBACK_TYPE; + + +typedef struct _MINIDUMP_THREAD_CALLBACK { + ULONG ThreadId; + HANDLE ThreadHandle; + CONTEXT Context; + ULONG SizeOfContext; + ULONG64 StackBase; + ULONG64 StackEnd; +} MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK; + + +typedef struct _MINIDUMP_THREAD_EX_CALLBACK { + ULONG ThreadId; + HANDLE ThreadHandle; + CONTEXT Context; + ULONG SizeOfContext; + ULONG64 StackBase; + ULONG64 StackEnd; + ULONG64 BackingStoreBase; + ULONG64 BackingStoreEnd; +} MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK; + + +typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK { + ULONG ThreadId; +} MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK; + + +typedef enum _THREAD_WRITE_FLAGS { + ThreadWriteThread = 0x0001, + ThreadWriteStack = 0x0002, + ThreadWriteContext = 0x0004, + ThreadWriteBackingStore = 0x0008, + ThreadWriteInstructionWindow = 0x0010, + ThreadWriteThreadData = 0x0020, +} THREAD_WRITE_FLAGS; + +typedef struct _MINIDUMP_MODULE_CALLBACK { + PWCHAR FullPath; + ULONG64 BaseOfImage; + ULONG SizeOfImage; + ULONG CheckSum; + ULONG TimeDateStamp; + VS_FIXEDFILEINFO VersionInfo; + PVOID CvRecord; + ULONG SizeOfCvRecord; + PVOID MiscRecord; + ULONG SizeOfMiscRecord; +} MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK; + + +typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK { + ULONG64 BaseOfImage; +} MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK; + + +typedef enum _MODULE_WRITE_FLAGS { + ModuleWriteModule = 0x0001, + ModuleWriteDataSeg = 0x0002, + ModuleWriteMiscRecord = 0x0004, + ModuleWriteCvRecord = 0x0008, + ModuleReferencedByMemory = 0x0010 +} MODULE_WRITE_FLAGS; + + +typedef struct _MINIDUMP_CALLBACK_INPUT { + ULONG ProcessId; + HANDLE ProcessHandle; + ULONG CallbackType; + union { + MINIDUMP_THREAD_CALLBACK Thread; + MINIDUMP_THREAD_EX_CALLBACK ThreadEx; + MINIDUMP_MODULE_CALLBACK Module; + MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread; + MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule; + }; +} MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT; + +typedef struct _MINIDUMP_CALLBACK_OUTPUT { + union { + ULONG ModuleWriteFlags; + ULONG ThreadWriteFlags; + }; +} MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT; + + +// +// A normal minidump contains just the information +// necessary to capture stack traces for all of the +// existing threads in a process. +// +// A minidump with data segments includes all of the data +// sections from loaded modules in order to capture +// global variable contents. This can make the dump much +// larger if many modules have global data. +// +// A minidump with full memory includes all of the accessible +// memory in the process and can be very large. A minidump +// with full memory always has the raw memory data at the end +// of the dump so that the initial structures in the dump can +// be mapped directly without having to include the raw +// memory information. +// +// Stack and backing store memory can be filtered to remove +// data unnecessary for stack walking. This can improve +// compression of stacks and also deletes data that may +// be private and should not be stored in a dump. +// Memory can also be scanned to see what modules are +// referenced by stack and backing store memory to allow +// omission of other modules to reduce dump size. +// In either of these modes the ModuleReferencedByMemory flag +// is set for all modules referenced before the base +// module callbacks occur. +// +// On some operating systems a list of modules that were +// recently unloaded is kept in addition to the currently +// loaded module list. This information can be saved in +// the dump if desired. +// +// Stack and backing store memory can be scanned for referenced +// pages in order to pick up data referenced by locals or other +// stack memory. This can increase the size of a dump significantly. +// +// Module paths may contain undesired information such as user names +// or other important directory names so they can be stripped. This +// option reduces the ability to locate the proper image later +// and should only be used in certain situations. +// +// Complete operating system per-process and per-thread information can +// be gathered and stored in the dump. +// +// The virtual address space can be scanned for various types +// of memory to be included in the dump. +// + +typedef enum _MINIDUMP_TYPE { + MiniDumpNormal = 0x0000, + MiniDumpWithDataSegs = 0x0001, + MiniDumpWithFullMemory = 0x0002, + MiniDumpWithHandleData = 0x0004, + MiniDumpFilterMemory = 0x0008, + MiniDumpScanMemory = 0x0010, + MiniDumpWithUnloadedModules = 0x0020, + MiniDumpWithIndirectlyReferencedMemory = 0x0040, + MiniDumpFilterModulePaths = 0x0080, + MiniDumpWithProcessThreadData = 0x0100, + MiniDumpWithPrivateReadWriteMemory = 0x0200, +} MINIDUMP_TYPE; + + +// +// The minidump callback should modify the FieldsToWrite parameter to reflect +// what portions of the specified thread or module should be written to the +// file. +// + +typedef +BOOL +(WINAPI * MINIDUMP_CALLBACK_ROUTINE) ( + IN PVOID CallbackParam, + IN CONST PMINIDUMP_CALLBACK_INPUT CallbackInput, + IN OUT PMINIDUMP_CALLBACK_OUTPUT CallbackOutput + ); + +typedef struct _MINIDUMP_CALLBACK_INFORMATION { + MINIDUMP_CALLBACK_ROUTINE CallbackRoutine; + PVOID CallbackParam; +} MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION; + + + +//++ +// +// PVOID +// RVA_TO_ADDR( +// PVOID Mapping, +// ULONG Rva +// ) +// +// Routine Description: +// +// Map an RVA that is contained within a mapped file to it's associated +// flat address. +// +// Arguments: +// +// Mapping - Base address of mapped file containing the RVA. +// +// Rva - An Rva to fixup. +// +// Return Values: +// +// A pointer to the desired data. +// +//-- + +#define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva))) + +BOOL +WINAPI +MiniDumpWriteDump( + IN HANDLE hProcess, + IN DWORD ProcessId, + IN HANDLE hFile, + IN MINIDUMP_TYPE DumpType, + IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL + IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL + IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL + ); + +BOOL +WINAPI +MiniDumpReadDumpStream( + IN PVOID BaseOfDump, + IN ULONG StreamNumber, + OUT PMINIDUMP_DIRECTORY * Dir, OPTIONAL + OUT PVOID * StreamPointer, OPTIONAL + OUT ULONG * StreamSize OPTIONAL + ); + +#include + +#ifdef __cplusplus +} +#endif + + +#endif // _DBGHELP_ diff --git a/stepmania/src/archutils/Win32/ddk/dbghelp.lib b/stepmania/src/archutils/Win32/ddk/dbghelp.lib new file mode 100644 index 0000000000..f5d71d423a Binary files /dev/null and b/stepmania/src/archutils/Win32/ddk/dbghelp.lib differ diff --git a/stepmania/src/archutils/Win32/ddk/hid.lib b/stepmania/src/archutils/Win32/ddk/hid.lib new file mode 100644 index 0000000000..0b59a66efd Binary files /dev/null and b/stepmania/src/archutils/Win32/ddk/hid.lib differ diff --git a/stepmania/src/archutils/Win32/ddk/hidpi.h b/stepmania/src/archutils/Win32/ddk/hidpi.h new file mode 100644 index 0000000000..4a361227d5 --- /dev/null +++ b/stepmania/src/archutils/Win32/ddk/hidpi.h @@ -0,0 +1,1788 @@ + /*++ + +Copyright (c) 1996-1998 Microsoft Corporation + +Module Name: + + HIDPI.H + +Abstract: + + Public Interface to the HID parsing library. + +Environment: + + Kernel & user mode + +--*/ + +#ifndef __HIDPI_H__ +#define __HIDPI_H__ + +#include + +// Please include "hidsdi.h" to use the user space (dll / parser) +// Please include "hidpddi.h" to use the kernel space parser + +// +// Special Link collection values for using the query functions +// +// Root collection references the collection at the base of the link +// collection tree. +// Unspecifies, references all collections in the link collection tree. +// +#define HIDP_LINK_COLLECTION_ROOT ((USHORT) -1) +#define HIDP_LINK_COLLECTION_UNSPECIFIED ((USHORT) 0) + + +typedef enum _HIDP_REPORT_TYPE +{ + HidP_Input, + HidP_Output, + HidP_Feature +} HIDP_REPORT_TYPE; + +typedef struct _USAGE_AND_PAGE +{ + USAGE Usage; + USAGE UsagePage; +} USAGE_AND_PAGE, *PUSAGE_AND_PAGE; + +#define HidP_IsSameUsageAndPage(u1, u2) ((* (PULONG) &u1) == (* (PULONG) &u2)) + +typedef struct _HIDP_BUTTON_CAPS +{ + USAGE UsagePage; + UCHAR ReportID; + BOOLEAN IsAlias; + + USHORT BitField; + USHORT LinkCollection; // A unique internal index pointer + + USAGE LinkUsage; + USAGE LinkUsagePage; + + BOOLEAN IsRange; + BOOLEAN IsStringRange; + BOOLEAN IsDesignatorRange; + BOOLEAN IsAbsolute; + + ULONG Reserved[10]; + union { + struct { + USAGE UsageMin, UsageMax; + USHORT StringMin, StringMax; + USHORT DesignatorMin, DesignatorMax; + USHORT DataIndexMin, DataIndexMax; + } Range; + struct { + USAGE Usage, Reserved1; + USHORT StringIndex, Reserved2; + USHORT DesignatorIndex, Reserved3; + USHORT DataIndex, Reserved4; + } NotRange; + }; + +} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS; + + +typedef struct _HIDP_VALUE_CAPS +{ + USAGE UsagePage; + UCHAR ReportID; + BOOLEAN IsAlias; + + USHORT BitField; + USHORT LinkCollection; // A unique internal index pointer + + USAGE LinkUsage; + USAGE LinkUsagePage; + + BOOLEAN IsRange; + BOOLEAN IsStringRange; + BOOLEAN IsDesignatorRange; + BOOLEAN IsAbsolute; + + BOOLEAN HasNull; // Does this channel have a null report union + UCHAR Reserved; + USHORT BitSize; // How many bits are devoted to this value? + + USHORT ReportCount; // See Note below. Usually set to 1. + USHORT Reserved2[5]; + + ULONG UnitsExp; + ULONG Units; + + LONG LogicalMin, LogicalMax; + LONG PhysicalMin, PhysicalMax; + + union { + struct { + USAGE UsageMin, UsageMax; + USHORT StringMin, StringMax; + USHORT DesignatorMin, DesignatorMax; + USHORT DataIndexMin, DataIndexMax; + } Range; + + struct { + USAGE Usage, Reserved1; + USHORT StringIndex, Reserved2; + USHORT DesignatorIndex, Reserved3; + USHORT DataIndex, Reserved4; + } NotRange; + }; +} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS; + +// +// Notes: +// +// ReportCount: When a report descriptor declares an Input, Output, or +// Feature main item with fewer usage declarations than the report count, then +// the last usage applies to all remaining unspecified count in that main item. +// (As an example you might have data that required many fields to describe, +// possibly buffered bytes.) In this case, only one value cap structure is +// allocated for these associtated fields, all with the same usage, and Report +// Count reflects the number of fields involved. Normally ReportCount is 1. +// To access all of the fields in such a value structure would require using +// HidP_GetUsageValueArray and HidP_SetUsageValueArray. HidP_GetUsageValue/ +// HidP_SetScaledUsageValue will also work, however, these functions will only +// work with the first field of the structure. +// + +// +// The link collection tree consists of an array of LINK_COLLECTION_NODES +// where the index into this array is the same as the collection number. +// +// Given a collection A which contains a subcollection B, A is defined to be +// the parent B, and B is defined to be the child. +// +// Given collections A, B, and C where B and C are children of A, and B was +// encountered before C in the report descriptor, B is defined as a sibling of +// C. (This implies, of course, that if B is a sibling of C, then C is NOT a +// sibling of B). +// +// B is defined as the NextSibling of C if and only if there exists NO +// child collection of A, call it D, such that B is a sibling of D and D +// is a sibling of C. +// +// E is defined to be the FirstChild of A if and only if for all children of A, +// F, that are not equivalent to E, F is a sibling of E. +// (This implies, of course, that the does not exist a child of A, call it G, +// where E is a sibling of G). In other words the first sibling is the last +// link collection found in the list. +// +// In other words, if a collection B is defined within the definition of another +// collection A, B becomes a child of A. All collections with the same parent +// are considered siblings. The FirstChild of the parent collection, A, will be +// last collection defined that has A as a parent. The order of sibling pointers +// is similarly determined. When a collection B is defined, it becomes the +// FirstChild of it's parent collection. The previously defined FirstChild of the +// parent collection becomes the NextSibling of the new collection. As new +// collections with the same parent are discovered, the chain of sibling is built. +// +// With that in mind, the following describes conclusively a data structure +// that provides direct traversal up, down, and accross the link collection +// tree. +// +// +typedef struct _HIDP_LINK_COLLECTION_NODE +{ + USAGE LinkUsage; + USAGE LinkUsagePage; + USHORT Parent; + USHORT NumberOfChildren; + USHORT NextSibling; + USHORT FirstChild; + ULONG CollectionType: 8; // As defined in 6.2.2.6 of HID spec + ULONG IsAlias : 1; // This link node is an allias of the next link node. + ULONG Reserved: 23; + PVOID UserContext; // The user can hang his coat here. +} HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE; + +// +// When a link collection is described by a delimiter, alias link collection +// nodes are created. (One for each usage within the delimiter). +// The parser assigns each capability description listed above only one +// link collection. +// +// If a control is defined within a collection defined by +// delimited usages, then that control is said to be within multiple link +// collections, one for each usage within the open and close delimiter tokens. +// Such multiple link collecions are said to be aliases. The first N-1 such +// collections, listed in the link collection node array, have their IsAlias +// bit set. The last such link collection is the link collection index used +// in the capabilities described above. +// Clients wishing to set a control in an aliased collection, should walk the +// collection array once for each time they see the IsAlias flag set, and use +// the last link collection as the index for the below accessor functions. +// +// NB: if IsAlias is set, then NextSibling should be one more than the current +// link collection node index. +// + +typedef PUCHAR PHIDP_REPORT_DESCRIPTOR; +typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA; + +typedef struct _HIDP_CAPS +{ + USAGE Usage; + USAGE UsagePage; + USHORT InputReportByteLength; + USHORT OutputReportByteLength; + USHORT FeatureReportByteLength; + USHORT Reserved[17]; + + USHORT NumberLinkCollectionNodes; + + USHORT NumberInputButtonCaps; + USHORT NumberInputValueCaps; + USHORT NumberInputDataIndices; + + USHORT NumberOutputButtonCaps; + USHORT NumberOutputValueCaps; + USHORT NumberOutputDataIndices; + + USHORT NumberFeatureButtonCaps; + USHORT NumberFeatureValueCaps; + USHORT NumberFeatureDataIndices; +} HIDP_CAPS, *PHIDP_CAPS; + +typedef struct _HIDP_DATA +{ + USHORT DataIndex; + USHORT Reserved; + union { + ULONG RawValue; // for values + BOOLEAN On; // for buttons MUST BE TRUE for buttons. + }; +} HIDP_DATA, *PHIDP_DATA; +// +// The HIDP_DATA structure is used with HidP_GetData and HidP_SetData +// functions. +// +// The parser contiguously assigns every control (button or value) in a hid +// device a unique data index from zero to NumberXXXDataIndices -1 , inclusive. +// This value is found in the HIDP_BUTTON_CAPS and HIDP_VALUE_CAPS structures. +// +// Most clients will find the Get/Set Buttons / Value accessor functions +// sufficient to their needs, as they will allow the clients to access the +// data known to them while ignoring the other controls. +// +// More complex clients, which actually read the Button / Value Caps, and which +// do a value add service to these routines (EG Direct Input), will need to +// access all the data in the device without interest in the individual usage +// or link collection location. These are the clients that will find +// HidP_Data useful. +// + +typedef struct _HIDP_UNKNOWN_TOKEN +{ + UCHAR Token; + UCHAR Reserved[3]; + ULONG BitField; +} HIDP_UNKNOWN_TOKEN, *PHIDP_UNKNOWN_TOKEN; + +typedef struct _HIDP_EXTENDED_ATTRIBUTES +{ + UCHAR NumGlobalUnknowns; + UCHAR Reserved [3]; + PHIDP_UNKNOWN_TOKEN GlobalUnknowns; + // ... Additional attributes + ULONG Data [1]; // variableLength DO NOT ACCESS THIS FIELD +} HIDP_EXTENDED_ATTRIBUTES, *PHIDP_EXTENDED_ATTRIBUTES; + +NTSTATUS __stdcall +HidP_GetCaps ( + IN PHIDP_PREPARSED_DATA PreparsedData, + OUT PHIDP_CAPS Capabilities + ); +/*++ +Routine Description: + Returns a list of capabilities of a given hid device as described by its + preparsed data. + +Arguments: + PreparsedData The preparsed data returned from HIDCLASS. + Capabilities a HIDP_CAPS structure + +Return Value: +· HIDP_STATUS_SUCCESS +· HIDP_STATUS_INVALID_PREPARSED_DATA +--*/ + +NTSTATUS __stdcall +HidP_GetLinkCollectionNodes ( + OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes, + IN OUT PULONG LinkCollectionNodesLength, + IN PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Routine Description: + Return a list of PHIDP_LINK_COLLECTION_NODEs used to describe the link + collection tree of this hid device. See the above description of + struct _HIDP_LINK_COLLECTION_NODE. + +Arguments: + LinkCollectionNodes - a caller allocated array into which + HidP_GetLinkCollectionNodes will store the information + + LinKCollectionNodesLength - the caller sets this value to the length of the + the array in terms of number of elements. + HidP_GetLinkCollectionNodes sets this value to the actual + number of elements set. The total number of nodes required to + describe this HID device can be found in the + NumberLinkCollectionNodes field in the HIDP_CAPS structure. + +--*/ + +NTSTATUS __stdcall +HidP_GetButtonCaps ( + IN HIDP_REPORT_TYPE ReportType, + OUT PHIDP_BUTTON_CAPS ButtonCaps, + IN OUT PUSHORT ButtonCapsLength, + IN PHIDP_PREPARSED_DATA PreparsedData +); +#define HidP_GetButtonCaps(_Type_, _Caps_, _Len_, _Data_) \ + HidP_GetSpecificButtonCaps (_Type_, 0, 0, 0, _Caps_, _Len_, _Data_) +NTSTATUS __stdcall +HidP_GetSpecificButtonCaps ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, // Optional (0 => ignore) + IN USHORT LinkCollection, // Optional (0 => ignore) + IN USAGE Usage, // Optional (0 => ignore) + OUT PHIDP_BUTTON_CAPS ButtonCaps, + IN OUT PUSHORT ButtonCapsLength, + IN PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Description: + HidP_GetButtonCaps returns all the buttons (binary values) that are a part + of the given report type for the Hid device represented by the given + preparsed data. + +Parameters: + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + UsagePage A usage page value used to limit the button caps returned to + those on a given usage page. If set to 0, this parameter is + ignored. Can be used with LinkCollection and Usage parameters + to further limit the number of button caps structures returned. + + LinkCollection HIDP_LINK_COLLECTION node array index used to limit the + button caps returned to those buttons in a given link + collection. If set to 0, this parameter is + ignored. Can be used with UsagePage and Usage parameters + to further limit the number of button caps structures + returned. + + Usage A usage value used to limit the button caps returned to those + with the specified usage value. If set to 0, this parameter + is ignored. Can be used with LinkCollection and UsagePage + parameters to further limit the number of button caps + structures returned. + + ButtonCaps A _HIDP_BUTTON_CAPS array containing information about all the + binary values in the given report. This buffer is provided by + the caller. + + ButtonLength As input, this parameter specifies the length of the + ButtonCaps parameter (array) in number of array elements. + As output, this value is set to indicate how many of those + array elements were filled in by the function. The maximum number of + button caps that can be returned is found in the HIDP_CAPS + structure. If HIDP_STATUS_BUFFER_TOO_SMALL is returned, + this value contains the number of array elements needed to + successfully complete the request. + + PreparsedData The preparsed data returned from HIDCLASS. + + +Return Value +HidP_GetSpecificButtonCaps returns the following error codes: +· HIDP_STATUS_SUCCESS. +· HIDP_STATUS_INVALID_REPORT_TYPE +· HIDP_STATUS_INVALID_PREPARSED_DATA +· HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in) +· HIDP_STATUS_USAGE_NOT_FOUND +--*/ + +NTSTATUS __stdcall +HidP_GetValueCaps ( + IN HIDP_REPORT_TYPE ReportType, + OUT PHIDP_VALUE_CAPS ValueCaps, + IN OUT PUSHORT ValueCapsLength, + IN PHIDP_PREPARSED_DATA PreparsedData +); +#define HidP_GetValueCaps(_Type_, _Caps_, _Len_, _Data_) \ + HidP_GetSpecificValueCaps (_Type_, 0, 0, 0, _Caps_, _Len_, _Data_) +NTSTATUS __stdcall +HidP_GetSpecificValueCaps ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, // Optional (0 => ignore) + IN USHORT LinkCollection, // Optional (0 => ignore) + IN USAGE Usage, // Optional (0 => ignore) + OUT PHIDP_VALUE_CAPS ValueCaps, + IN OUT PUSHORT ValueCapsLength, + IN PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Description: + HidP_GetValueCaps returns all the values (non-binary) that are a part + of the given report type for the Hid device represented by the given + preparsed data. + +Parameters: + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + UsagePage A usage page value used to limit the value caps returned to + those on a given usage page. If set to 0, this parameter is + ignored. Can be used with LinkCollection and Usage parameters + to further limit the number of value caps structures returned. + + LinkCollection HIDP_LINK_COLLECTION node array index used to limit the + value caps returned to those buttons in a given link + collection. If set to 0, this parameter is + ignored. Can be used with UsagePage and Usage parameters + to further limit the number of value caps structures + returned. + + Usage A usage value used to limit the value caps returned to those + with the specified usage value. If set to 0, this parameter + is ignored. Can be used with LinkCollection and UsagePage + parameters to further limit the number of value caps + structures returned. + + ValueCaps A _HIDP_VALUE_CAPS array containing information about all the + non-binary values in the given report. This buffer is provided + by the caller. + + ValueLength As input, this parameter specifies the length of the ValueCaps + parameter (array) in number of array elements. As output, + this value is set to indicate how many of those array elements + were filled in by the function. The maximum number of + value caps that can be returned is found in the HIDP_CAPS + structure. If HIDP_STATUS_BUFFER_TOO_SMALL is returned, + this value contains the number of array elements needed to + successfully complete the request. + + PreparsedData The preparsed data returned from HIDCLASS. + + +Return Value +HidP_GetValueCaps returns the following error codes: +· HIDP_STATUS_SUCCESS. +· HIDP_STATUS_INVALID_REPORT_TYPE +· HIDP_STATUS_INVALID_PREPARSED_DATA +· HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in) +· HIDP_STATUS_USAGE_NOT_FOUND + +--*/ + +NTSTATUS __stdcall +HidP_GetExtendedAttributes ( + IN HIDP_REPORT_TYPE ReportType, + IN USHORT DataIndex, + IN PHIDP_PREPARSED_DATA PreparsedData, + OUT PHIDP_EXTENDED_ATTRIBUTES Attributes, + IN OUT PULONG LengthAttributes + ); +/*++ +Description: + Given a data index from the value or button capabilities of a given control + return any extended attributes for the control if any exist. + +Parameters: + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + DataIndex The data index for the given control, found in the capabilities + structure for that control + + PreparsedData The preparsed data returned from HIDCLASS. + + Attributes Pointer to a buffer into which the extended attribute data will + be copied. + + LengthAttributes Length of the given buffer in bytes. + +Return Value + HIDP_STATUS_SUCCESS + HIDP_STATUS_DATA_INDEX_NOT_FOUND +--*/ + +NTSTATUS __stdcall +HidP_InitializeReportForID ( + IN HIDP_REPORT_TYPE ReportType, + IN UCHAR ReportID, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN OUT PCHAR Report, + IN ULONG ReportLength + ); +/*++ + +Routine Description: + + Initialize a report based on the given report ID. + +Parameters: + + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + PreparasedData Preparsed data structure returned by HIDCLASS + + Report Buffer which to set the data into. + + ReportLength Length of Report...Report should be at least as long as the + value indicated in the HIDP_CAPS structure for the device and + the corresponding ReportType + +Return Value + +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal + to the length specified in HIDP_CAPS + structure for the given ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + +--*/ + +NTSTATUS __stdcall +HidP_SetData ( + IN HIDP_REPORT_TYPE ReportType, + IN PHIDP_DATA DataList, + IN OUT PULONG DataLength, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN OUT PCHAR Report, + IN ULONG ReportLength + ); +/*++ + +Routine Description: + + Please Note: Since usage value arrays deal with multiple fields for + for one usage value, they cannot be used with HidP_SetData + and HidP_GetData. In this case, + HIDP_STATUS_IS_USAGE_VALUE_ARRAY will be returned. + +Parameters: + + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + DataList Array of HIDP_DATA structures that contains the data values + that are to be set into the given report + + DataLength As input, length in array elements of DataList. As output, + contains the number of data elements set on successful + completion or an index into the DataList array to identify + the faulting HIDP_DATA value if an error code is returned. + + PreparasedData Preparsed data structure returned by HIDCLASS + + Report Buffer which to set the data into. + + ReportLength Length of Report...Report should be at least as long as the + value indicated in the HIDP_CAPS structure for the device and + the corresponding ReportType + +Return Value + HidP_SetData returns the following error codes. The report packet will + have all the data set up until the HIDP_DATA structure that caused the + error. DataLength, in the error case, will return this problem index. + +· HIDP_STATUS_SUCCESS -- upon successful insertion of all data + into the report packet. +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_DATA_INDEX_NOT_FOUND -- if a HIDP_DATA structure referenced a + data index that does not exist for this + device's ReportType +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal + to the length specified in HIDP_CAPS + structure for the given ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_IS_USAGE_VALUE_ARRAY -- if one of the HIDP_DATA structures + references a usage value array. + DataLength will contain the index into + the array that was invalid +· HIDP_STATUS_BUTTON_NOT_PRESSED -- if a HIDP_DATA structure attempted + to unset a button that was not already + set in the Report +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- a HIDP_DATA structure was found with + a valid index value but is contained + in a different report than the one + currently being processed +· HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in + a given Main Array Item to report all + buttons that have been requested to be + set +--*/ + +NTSTATUS __stdcall +HidP_GetData ( + IN HIDP_REPORT_TYPE ReportType, + OUT PHIDP_DATA DataList, + IN OUT PULONG DataLength, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN PCHAR Report, + IN ULONG ReportLength + ); +/*++ + +Routine Description: + + Please Note: For obvious reasons HidP_SetData and HidP_GetData will not + access UsageValueArrays. + +Parameters: + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + DataList Array of HIDP_DATA structures that will receive the data + values that are set in the given report + + DataLength As input, length in array elements of DataList. As output, + contains the number of data elements that were successfully + set by HidP_GetData. The maximum size necessary for DataList + can be determined by calling HidP_MaxDataListLength + + PreparasedData Preparsed data structure returned by HIDCLASS + + Report Buffer which to set the data into. + + ReportLength Length of Report...Report should be at least as long as the + value indicated in the HIDP_CAPS structure for the device and + the corresponding ReportType + +Return Value + HidP_GetData returns the following error codes. + +· HIDP_STATUS_SUCCESS -- upon successful retrieval of all data + from the report packet. +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal + to the length specified in HIDP_CAPS + structure for the given ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough array entries in + DataList to store all the indice values + in the given report. DataLength will + contain the number of array entries + required to hold all data +--*/ + +ULONG __stdcall +HidP_MaxDataListLength ( + IN HIDP_REPORT_TYPE ReportType, + IN PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Routine Description: + + This function returns the maximum length of HIDP_DATA elements that + HidP_GetData could return for the given report type. + +Parameters: + + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + PreparsedData Preparsed data structure returned by HIDCLASS + +Return Value: + + The length of the data list array required for the HidP_GetData function + call. If an error occurs (either HIDP_STATUS_INVALID_REPORT_TYPE or + HIDP_STATUS_INVALID_PREPARSED_DATA), this function returns 0. + +--*/ + +#define HidP_SetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \ + HidP_SetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) + +NTSTATUS __stdcall +HidP_SetUsages ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + IN PUSAGE UsageList, + IN OUT PULONG UsageLength, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN OUT PCHAR Report, + IN ULONG ReportLength + ); +/*++ + +Routine Description: + This function sets binary values (buttons) in a report. Given an + initialized packet of correct length, it modifies the report packet so that + each element in the given list of usages has been set in the report packet. + For example, in an output report with 5 LED’s, each with a given usage, + an application could turn on any subset of these lights by placing their + usages in any order into the usage array (UsageList). HidP_SetUsages would, + in turn, set the appropriate bit or add the corresponding byte into the + HID Main Array Item. + + A properly initialized Report packet is one of the correct byte length, + and all zeros. + + NOTE: A packet that has already been set with a call to a HidP_Set routine + can also be passed in. This routine then sets processes the UsageList + in the same fashion but verifies that the ReportID already set in + Report matches the report ID for the given usages. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage All of the usages in the usage array, which HidP_SetUsages will + set in the report, refer to this same usage page. + If a client wishes to set usages in a report for multiple + usage pages then that client needs to make multiple calls to + HidP_SetUsages for each of the usage pages. + + UsageList A usage array containing the usages that HidP_SetUsages will set in + the report packet. + + UsageLength The length of the given usage array in array elements. + The parser will set this value to the position in the usage + array where it stopped processing. If successful, UsageLength + will be unchanged. In any error condition, this parameter + reflects how many of the usages in the usage list have + actually been set by the parser. This is useful for finding + the usage in the list which caused the error. + + PreparsedData The preparsed data recevied from HIDCLASS + + Report The report packet. + + ReportLength Length of the given report packet...Must be equal to the + value reported in the HIDP_CAPS structure for the device + and corresponding report type. + +Return Value + HidP_SetUsages returns the following error codes. On error, the report packet + will be correct up until the usage element that caused the error. + +· HIDP_STATUS_SUCCESS -- upon successful insertion of all usages + into the report packet. +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a + different report. If the report is + zero-initialized on entry the first + usage in the list will determine which + report ID is used. Otherwise, the + parser will verify that usage matches + the passed in report's ID +· HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any + report (no matter what the report ID) + for the given report type. +· HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in a + given Main Array Item to list all of + the given usages. The caller needs + to split his request into more than + one call +--*/ + +#define HidP_UnsetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \ + HidP_UnsetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) + +NTSTATUS __stdcall +HidP_UnsetUsages ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + IN PUSAGE UsageList, + IN OUT PULONG UsageLength, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN OUT PCHAR Report, + IN ULONG ReportLength + ); +/*++ + +Routine Description: + This function unsets (turns off) binary values (buttons) in the report. Given + an initialized packet of correct length, it modifies the report packet so + that each element in the given list of usages has been unset in the + report packet. + + This function is the "undo" operation for SetUsages. If the given usage + is not already set in the Report, it will return an error code of + HIDP_STATUS_BUTTON_NOT_PRESSED. If the button is pressed, HidP_UnsetUsages + will unset the appropriate bit or remove the corresponding index value from + the HID Main Array Item. + + A properly initialized Report packet is one of the correct byte length, + and all zeros.. + + NOTE: A packet that has already been set with a call to a HidP_Set routine + can also be passed in. This routine then processes the UsageList + in the same fashion but verifies that the ReportID already set in + Report matches the report ID for the given usages. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage All of the usages in the usage array, which HidP_UnsetUsages will + unset in the report, refer to this same usage page. + If a client wishes to unset usages in a report for multiple + usage pages then that client needs to make multiple calls to + HidP_UnsetUsages for each of the usage pages. + + UsageList A usage array containing the usages that HidP_UnsetUsages will + unset in the report packet. + + UsageLength The length of the given usage array in array elements. + The parser will set this value to the position in the usage + array where it stopped processing. If successful, UsageLength + will be unchanged. In any error condition, this parameter + reflects how many of the usages in the usage list have + actually been unset by the parser. This is useful for finding + the usage in the list which caused the error. + + PreparsedData The preparsed data recevied from HIDCLASS + + Report The report packet. + + ReportLength Length of the given report packet...Must be equal to the + value reported in the HIDP_CAPS structure for the device + and corresponding report type. + +Return Value + HidP_UnsetUsages returns the following error codes. On error, the report + packet will be correct up until the usage element that caused the error. + +· HIDP_STATUS_SUCCESS -- upon successful "unsetting" of all usages + in the report packet. +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a + different report. If the report is + zero-initialized on entry the first + usage in the list will determine which + report ID is used. Otherwise, the + parser will verify that usage matches + the passed in report's ID +· HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any + report (no matter what the report ID) + for the given report type. +· HIDP_STATUS_BUTTON_NOT_PRESSED -- if a usage corresponds to a button that + is not already set in the given report +--*/ + +#define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \ + HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) + +NTSTATUS __stdcall +HidP_GetUsages ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + OUT USAGE * UsageList, + IN OUT ULONG * UsageLength, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN PCHAR Report, + IN ULONG ReportLength + ); +/*++ + +Routine Description: + This function returns the binary values (buttons) that are set in a HID + report. Given a report packet of correct length, it searches the report + packet for each usage for the given usage page and returns them in the + usage list. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage All of the usages in the usage list, which HidP_GetUsages will + retrieve in the report, refer to this same usage page. + If the client wishes to get usages in a packet for multiple + usage pages then that client needs to make multiple calls + to HidP_GetUsages. + + LinkCollection An optional value which can limit which usages are returned + in the UsageList to those usages that exist in a specific + LinkCollection. A non-zero value indicates the index into + the HIDP_LINK_COLLECITON_NODE list returned by + HidP_GetLinkCollectionNodes of the link collection the + usage should belong to. A value of 0 indicates this + should value be ignored. + + UsageList The usage array that will contain all the usages found in + the report packet. + + UsageLength The length of the given usage array in array elements. + On input, this value describes the length of the usage list. + On output, HidP_GetUsages sets this value to the number of + usages that was found. Use HidP_MaxUsageListLength to + determine the maximum length needed to return all the usages + that a given report packet may contain. + + PreparsedData Preparsed data structure returned by HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet + + +Return Value + HidP_GetUsages returns the following error codes: + +· HIDP_STATUS_SUCCESS -- upon successfully retrieving all the + usages from the report packet +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_BUFFER_TOO_SMALL -- if the UsageList is not big enough to + hold all the usages found in the report + packet. If this is returned, the buffer + will contain UsageLength number of + usages. Use HidP_MaxUsageListLength to + find the maximum length needed +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages + that match the UsagePage and + LinkCollection specified could be found + in a report with a different report ID +· HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in a reports for + the device and ReportType that match the + UsagePage and LinkCollection that were + specified +--*/ + +#define HidP_GetButtonsEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe) \ + HidP_GetUsagesEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe) + +NTSTATUS __stdcall +HidP_GetUsagesEx ( + IN HIDP_REPORT_TYPE ReportType, + IN USHORT LinkCollection, // Optional + OUT PUSAGE_AND_PAGE ButtonList, + IN OUT ULONG * UsageLength, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN PCHAR Report, + IN ULONG ReportLength + ); + +/*++ + +Routine Description: + This function returns the binary values (buttons) in a HID report. + Given a report packet of correct length, it searches the report packet + for all buttons and returns the UsagePage and Usage for each of the buttons + it finds. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + LinkCollection An optional value which can limit which usages are returned + in the ButtonList to those usages that exist in a specific + LinkCollection. A non-zero value indicates the index into + the HIDP_LINK_COLLECITON_NODE list returned by + HidP_GetLinkCollectionNodes of the link collection the + usage should belong to. A value of 0 indicates this + should value be ignored. + + ButtonList An array of USAGE_AND_PAGE structures describing all the + buttons currently ``down'' in the device. + + UsageLength The length of the given array in terms of elements. + On input, this value describes the length of the list. On + output, HidP_GetUsagesEx sets this value to the number of + usages that were found. Use HidP_MaxUsageListLength to + determine the maximum length needed to return all the usages + that a given report packet may contain. + + PreparsedData Preparsed data returned by HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value + HidP_GetUsagesEx returns the following error codes: + +· HIDP_STATUS_SUCCESS -- upon successfully retrieving all the + usages from the report packet +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_BUFFER_TOO_SMALL -- if ButtonList is not big enough to + hold all the usages found in the report + packet. If this is returned, the buffer + will contain UsageLength number of + usages. Use HidP_MaxUsageListLength to + find the maximum length needed +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages + that match the specified LinkCollection + exist in report with a different report + ID. +· HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in any reports that + match the LinkCollection parameter +--*/ + +#define HidP_GetButtonListLength(RTy, UPa, Ppd) \ + HidP_GetUsageListLength(Rty, UPa, Ppd) + +ULONG __stdcall +HidP_MaxUsageListLength ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, // Optional + IN PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Routine Description: + This function returns the maximum number of usages that a call to + HidP_GetUsages or HidP_GetUsagesEx could return for a given HID report. + If calling for number of usages returned by HidP_GetUsagesEx, use 0 as + the UsagePage value. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage Specifies the optional UsagePage to query for. If 0, will + return all the maximum number of usage values that could be + returned for a given ReportType. If non-zero, will return + the maximum number of usages that would be returned for the + ReportType with the given UsagePage. + + PreparsedData Preparsed data returned from HIDCLASS + +Return Value: + The length of the usage list array required for the HidP_GetUsages or + HidP_GetUsagesEx function call. If an error occurs (such as + HIDP_STATUS_INVALID_REPORT_TYPE or HIDP_INVALID_PREPARSED_DATA, this + returns 0. +--*/ + +NTSTATUS __stdcall +HidP_SetUsageValue ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + IN USAGE Usage, + IN ULONG UsageValue, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN OUT PCHAR Report, + IN ULONG ReportLength + ); +/*++ +Description: + HidP_SetUsageValue inserts a value into the HID Report Packet in the field + corresponding to the given usage page and usage. HidP_SetUsageValue + casts this value to the appropriate bit length. If a report packet + contains two different fields with the same Usage and UsagePage, + they can be distinguished with the optional LinkCollection field value. + Using this function sets the raw value into the report packet with + no checking done as to whether it actually falls within the logical + minimum/logical maximum range. Use HidP_SetScaledUsageValue for this... + + NOTE: Although the UsageValue parameter is a ULONG, any casting that is + done will preserve or sign-extend the value. The value being set + should be considered a LONG value and will be treated as such by + this function. + +Parameters: + + ReportType One of HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value HidP_SetUsageValue will set. + + UsageValue The raw value to set in the report buffer. This value must be within + the logical range or if a NULL value this value should be the + most negative value that can be represented by the number of bits + for this field. + + PreparsedData The preparsed data returned for HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HidP_SetUsageValue returns the following error codes: + +· HIDP_STATUS_SUCCESS -- upon successfully setting the value + in the report packet +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call HidP_SetUsageValue + again with a zero-initizialed report + packet +· HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + +NTSTATUS __stdcall +HidP_SetScaledUsageValue ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + IN USAGE Usage, + IN LONG UsageValue, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN OUT PCHAR Report, + IN ULONG ReportLength + ); + +/*++ +Description: + HidP_SetScaledUsageValue inserts the UsageValue into the HID report packet + in the field corresponding to the given usage page and usage. If a report + packet contains two different fields with the same Usage and UsagePage, + they can be distinguished with the optional LinkCollection field value. + + If the specified field has a defined physical range, this function converts + the physical value specified to the corresponding logical value for the + report. If a physical value does not exist, the function will verify that + the value specified falls within the logical range and set according. + + If the range checking fails but the field has NULL values, the function will + set the field to the defined NULL value (most negative number possible) and + return HIDP_STATUS_NULL. In other words, use this function to set NULL + values for a given field by passing in a value that falls outside the + physical range if it is defined or the logical range otherwise. + + If the field does not support NULL values, an out of range error will be + returned instead. + +Parameters: + + ReportType One of HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value HidP_SetScaledUsageValue will set. + + UsageValue The value to set in the report buffer. See the routine + description above for the different interpretations of this + value + + PreparsedData The preparsed data returned from HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HidP_SetScaledUsageValue returns the following error codes: + +· HIDP_STATUS_SUCCESS -- upon successfully setting the value + in the report packet +· HIDP_STATUS_NULL -- upon successfully setting the value + in the report packet as a NULL value +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_VALUE_OUT_OF_RANGE -- if the value specified failed to fall + within the physical range if it exists + or within the logical range otherwise + and the field specified by the usage + does not allow NULL values +· HIDP_STATUS_BAD_LOG_PHY_VALUES -- if the field has a physical range but + either the logical range is invalid + (max <= min) or the physical range is + invalid +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call + HidP_SetScaledUsageValue again with + a zero-initialized report packet +· HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + +NTSTATUS __stdcall +HidP_SetUsageValueArray ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + IN USAGE Usage, + IN PCHAR UsageValue, + IN USHORT UsageValueByteLength, + IN PHIDP_PREPARSED_DATA PreparsedData, + OUT PCHAR Report, + IN ULONG ReportLength + ); + +/*++ +Routine Descripton: + A usage value array occurs when the last usage in the list of usages + describing a main item must be repeated because there are less usages defined + than there are report counts declared for the given main item. In this case + a single value cap is allocated for that usage and the report count of that + value cap is set to reflect the number of fields to which that usage refers. + + HidP_SetUsageValueArray sets the raw bits for that usage which spans + more than one field in a report. + + NOTE: This function currently does not support value arrays where the + ReportSize for each of the fields in the array is not a multiple + of 8 bits. + + The UsageValue buffer should have the values set as they would appear + in the report buffer. If this function supported non 8-bit multiples + for the ReportSize then caller should format the input buffer so that + each new value begins at the bit immediately following the last bit + of the previous value + +Parameters: + + ReportType One of HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value array HidP_SetUsageValueArray will set. + + UsageValue The buffer with the values to set into the value array. + The number of BITS required is found by multiplying the + BitSize and ReportCount fields of the Value Cap for this + control. The least significant bit of this control found in the + given report will be placed in the least significan bit location + of the array given (little-endian format), regardless of whether + or not the field is byte alligned or if the BitSize is a multiple + of sizeof (CHAR). + + See the above note for current implementation limitations. + + UsageValueByteLength Length of the UsageValue buffer (in bytes) + + PreparsedData The preparsed data returned from HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: +· HIDP_STATUS_SUCCESS -- upon successfully setting the value + array in the report packet +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_NOT_VALUE_ARRAY -- if the control specified is not a + value array -- a value array will have + a ReportCount field in the + HIDP_VALUE_CAPS structure that is > 1 + Use HidP_SetUsageValue instead +· HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer with + the values to set is too small (ie. has + fewer values than the number of fields in + the array +· HIDP_STATUS_NOT_IMPLEMENTED -- if the usage value array has field sizes + that are not multiples of 8 bits, this + error code is returned since the function + currently does not handle setting into + such arrays. +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call + HidP_SetUsageValueArray again with + a zero-initialized report packet +· HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + + +NTSTATUS __stdcall +HidP_GetUsageValue ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + IN USAGE Usage, + OUT PULONG UsageValue, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN PCHAR Report, + IN ULONG ReportLength + ); + +/* +Description + HidP_GetUsageValue retrieves the value from the HID Report for the usage + specified by the combination of usage page, usage and link collection. + If a report packet contains two different fields with the same + Usage and UsagePage, they can be distinguished with the optional + LinkCollection field value. + +Parameters: + + ReportType One of HidP_Input or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value HidP_GetUsageValue will retrieve + + UsageValue The raw value that is set for the specified field in the report + buffer. This value will either fall within the logical range + or if NULL values are allowed, a number outside the range to + indicate a NULL + + PreparsedData The preparsed data returned for HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HidP_GetUsageValue returns the following error codes: + +· HIDP_STATUS_SUCCESS -- upon successfully retrieving the value + from the report packet +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call HidP_GetUsageValue + again with a different report packet +· HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + + +NTSTATUS __stdcall +HidP_GetScaledUsageValue ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + IN USAGE Usage, + OUT PLONG UsageValue, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN PCHAR Report, + IN ULONG ReportLength + ); + +/*++ +Description + HidP_GetScaledUsageValue retrieves a UsageValue from the HID report packet + in the field corresponding to the given usage page and usage. If a report + packet contains two different fields with the same Usage and UsagePage, + they can be distinguished with the optional LinkCollection field value. + + If the specified field has a defined physical range, this function converts + the logical value that exists in the report packet to the corresponding + physical value. If a physical range does not exist, the function will + return the logical value. This function will check to verify that the + logical value in the report falls within the declared logical range. + + When doing the conversion between logical and physical values, this + function assumes a linear extrapolation between the physical max/min and + the logical max/min. (Where logical is the values reported by the device + and physical is the value returned by this function). If the data field + size is less than 32 bits, then HidP_GetScaledUsageValue will sign extend + the value to 32 bits. + + If the range checking fails but the field has NULL values, the function + will set UsageValue to 0 and return HIDP_STATUS_NULL. Otherwise, it + returns a HIDP_STATUS_OUT_OF_RANGE error. + +Parameters: + + ReportType One of HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will retrieve the first + field it finds that matches the usage page + and usage. + + Usage The usage whose value HidP_GetScaledUsageValue will retrieve + + UsageValue The value retrieved from the report buffer. See the routine + description above for the different interpretations of this + value + + PreparsedData The preparsed data returned from HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HidP_GetScaledUsageValue returns the following error codes: + +· HIDP_STATUS_SUCCESS -- upon successfully retrieving the value + from the report packet +· HIDP_STATUS_NULL -- if the report packet had a NULL value + set +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_VALUE_OUT_OF_RANGE -- if the value retrieved from the packet + falls outside the logical range and + the field does not support NULL values +· HIDP_STATUS_BAD_LOG_PHY_VALUES -- if the field has a physical range but + either the logical range is invalid + (max <= min) or the physical range is + invalid +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call + HidP_GetScaledUsageValue with a + different report packet +· HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + +NTSTATUS __stdcall +HidP_GetUsageValueArray ( + IN HIDP_REPORT_TYPE ReportType, + IN USAGE UsagePage, + IN USHORT LinkCollection, // Optional + IN USAGE Usage, + OUT PCHAR UsageValue, + IN USHORT UsageValueByteLength, + IN PHIDP_PREPARSED_DATA PreparsedData, + IN PCHAR Report, + IN ULONG ReportLength + ); + +/*++ +Routine Descripton: + A usage value array occurs when the last usage in the list of usages + describing a main item must be repeated because there are less usages defined + than there are report counts declared for the given main item. In this case + a single value cap is allocated for that usage and the report count of that + value cap is set to reflect the number of fields to which that usage refers. + + HidP_GetUsageValueArray returns the raw bits for that usage which spans + more than one field in a report. + + NOTE: This function currently does not support value arrays where the + ReportSize for each of the fields in the array is not a multiple + of 8 bits. + + The UsageValue buffer will have the raw values as they are set + in the report packet. + +Parameters: + + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value HidP_GetUsageValueArray will retreive. + + UsageValue A pointer to an array of characters where the value will be + placed. The number of BITS required is found by multiplying the + BitSize and ReportCount fields of the Value Cap for this + control. The least significant bit of this control found in the + given report will be placed in the least significant bit location + of the buffer (little-endian format), regardless of whether + or not the field is byte aligned or if the BitSize is a multiple + of sizeof (CHAR). + + See note above about current implementation limitations + + UsageValueByteLength + the length of the given UsageValue buffer. + + PreparsedData The preparsed data returned by the HIDCLASS + + Report The report packet. + + ReportLength Length of the given report packet. + +Return Value: + +· HIDP_STATUS_SUCCESS -- upon successfully retrieving the value + from the report packet +· HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. +· HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid +· HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType +· HIDP_STATUS_NOT_VALUE_ARRAY -- if the control specified is not a + value array -- a value array will have + a ReportCount field in the + HIDP_VALUE_CAPS structure that is > 1 + Use HidP_GetUsageValue instead +· HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer in + which to return the array is too small + (ie. has fewer values than the number of + fields in the array +· HIDP_STATUS_NOT_IMPLEMENTED -- if the usage value array has field sizes + that are not multiples of 8 bits, this + error code is returned since the function + currently does not handle getting values + from such arrays. +· HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call + HidP_GetUsageValueArray with a + different report packet +· HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + +NTSTATUS __stdcall +HidP_UsageListDifference ( + IN PUSAGE PreviousUsageList, + IN PUSAGE CurrentUsageList, + OUT PUSAGE BreakUsageList, + OUT PUSAGE MakeUsageList, + IN ULONG UsageListLength + ); +/*++ +Routine Description: + This function will return the difference between a two lists of usages + (as might be returned from HidP_GetUsages), In other words, it will return + return a list of usages that are in the current list but not the previous + list as well as a list of usages that are in the previous list but not + the current list. + +Parameters: + + PreviousUsageList The list of usages before. + CurrentUsageList The list of usages now. + BreakUsageList Previous - Current. + MakeUsageList Current - Previous. + UsageListLength Represents the length of the usage lists in array + elements. If comparing two lists with a differing + number of array elements, this value should be + the size of the larger of the two lists. Any + zero found with a list indicates an early termination + of the list and any usages found after the first zero + will be ignored. +--*/ + +NTSTATUS __stdcall +HidP_UsageAndPageListDifference ( + IN PUSAGE_AND_PAGE PreviousUsageList, + IN PUSAGE_AND_PAGE CurrentUsageList, + OUT PUSAGE_AND_PAGE BreakUsageList, + OUT PUSAGE_AND_PAGE MakeUsageList, + IN ULONG UsageListLength + ); + +// +// Produce Make or Break Codes +// +typedef enum _HIDP_KEYBOARD_DIRECTION { + HidP_Keyboard_Break, + HidP_Keyboard_Make +} HIDP_KEYBOARD_DIRECTION; + +// +// A bitmap of the current shift state of the keyboard when using the +// below keyboard usages to i8042 translation function. +// +typedef struct _HIDP_KEYBOARD_MODIFIER_STATE { + union { + struct { + ULONG LeftControl: 1; + ULONG LeftShift: 1; + ULONG LeftAlt: 1; + ULONG LeftGUI: 1; + ULONG RightControl: 1; + ULONG RightShift: 1; + ULONG RightAlt: 1; + ULONG RigthGUI: 1; + ULONG CapsLock: 1; + ULONG ScollLock: 1; + ULONG NumLock: 1; + ULONG Reserved: 21; + }; + ULONG ul; + }; + +} HIDP_KEYBOARD_MODIFIER_STATE, * PHIDP_KEYBOARD_MODIFIER_STATE; + +// +// A call back function to give the i8042 scan codes to the caller of +// the below translation function. +// +typedef BOOLEAN (* PHIDP_INSERT_SCANCODES) ( + IN PVOID Context, // Some caller supplied context. + IN PCHAR NewScanCodes, // A list of i8042 scan codes. + IN ULONG Length // the length of the scan codes. + ); + +NTSTATUS __stdcall +HidP_TranslateUsageAndPagesToI8042ScanCodes ( + IN PUSAGE_AND_PAGE ChangedUsageList, + IN ULONG UsageListLength, + IN HIDP_KEYBOARD_DIRECTION KeyAction, + IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, + IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, + IN PVOID InsertCodesContext + ); +/*++ +Routine Description: +Parameters: +--*/ + +NTSTATUS __stdcall +HidP_TranslateUsagesToI8042ScanCodes ( + IN PUSAGE ChangedUsageList, + IN ULONG UsageListLength, + IN HIDP_KEYBOARD_DIRECTION KeyAction, + IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, + IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, + IN PVOID InsertCodesContext + ); +/*++ +Routine Description: +Parameters: +--*/ + + + +// +// Define NT Status codes with Facility Code of FACILITY_HID_ERROR_CODE +// + +// FACILITY_HID_ERROR_CODE defined in ntstatus.h +#ifndef FACILITY_HID_ERROR_CODE +#define FACILITY_HID_ERROR_CODE 0x11 +#endif + +#define HIDP_ERROR_CODES(SEV, CODE) \ + ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE))) + +#define HIDP_STATUS_SUCCESS (HIDP_ERROR_CODES(0x0,0)) +#define HIDP_STATUS_NULL (HIDP_ERROR_CODES(0x8,1)) +#define HIDP_STATUS_INVALID_PREPARSED_DATA (HIDP_ERROR_CODES(0xC,1)) +#define HIDP_STATUS_INVALID_REPORT_TYPE (HIDP_ERROR_CODES(0xC,2)) +#define HIDP_STATUS_INVALID_REPORT_LENGTH (HIDP_ERROR_CODES(0xC,3)) +#define HIDP_STATUS_USAGE_NOT_FOUND (HIDP_ERROR_CODES(0xC,4)) +#define HIDP_STATUS_VALUE_OUT_OF_RANGE (HIDP_ERROR_CODES(0xC,5)) +#define HIDP_STATUS_BAD_LOG_PHY_VALUES (HIDP_ERROR_CODES(0xC,6)) +#define HIDP_STATUS_BUFFER_TOO_SMALL (HIDP_ERROR_CODES(0xC,7)) +#define HIDP_STATUS_INTERNAL_ERROR (HIDP_ERROR_CODES(0xC,8)) +#define HIDP_STATUS_I8042_TRANS_UNKNOWN (HIDP_ERROR_CODES(0xC,9)) +#define HIDP_STATUS_INCOMPATIBLE_REPORT_ID (HIDP_ERROR_CODES(0xC,0xA)) +#define HIDP_STATUS_NOT_VALUE_ARRAY (HIDP_ERROR_CODES(0xC,0xB)) +#define HIDP_STATUS_IS_VALUE_ARRAY (HIDP_ERROR_CODES(0xC,0xC)) +#define HIDP_STATUS_DATA_INDEX_NOT_FOUND (HIDP_ERROR_CODES(0xC,0xD)) +#define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE (HIDP_ERROR_CODES(0xC,0xE)) +#define HIDP_STATUS_BUTTON_NOT_PRESSED (HIDP_ERROR_CODES(0xC,0xF)) +#define HIDP_STATUS_REPORT_DOES_NOT_EXIST (HIDP_ERROR_CODES(0xC,0x10)) +#define HIDP_STATUS_NOT_IMPLEMENTED (HIDP_ERROR_CODES(0xC,0x20)) + +// +// We blundered this status code. +// +#define HIDP_STATUS_I8242_TRANS_UNKNOWN HIDP_STATUS_I8042_TRANS_UNKNOWN + +#include + +#endif + diff --git a/stepmania/src/archutils/Win32/ddk/hidsdi.h b/stepmania/src/archutils/Win32/ddk/hidsdi.h new file mode 100644 index 0000000000..ae0ef12932 --- /dev/null +++ b/stepmania/src/archutils/Win32/ddk/hidsdi.h @@ -0,0 +1,413 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + HIDSDI.H + +Abstract: + + This module contains the PUBLIC definitions for the + code that implements the HID dll. + +Environment: + + Kernel & user mode + +--*/ + + +#ifndef _HIDSDI_H +#define _HIDSDI_H + +#include + +//#include "wtypes.h" + +//#include +//#include +//#include + +typedef LONG NTSTATUS; +#include "hidusage.h" +#include "hidpi.h" + +typedef struct _HIDD_CONFIGURATION { + PVOID cookie; + ULONG size; + ULONG RingBufferSize; +} HIDD_CONFIGURATION, *PHIDD_CONFIGURATION; + +typedef struct _HIDD_ATTRIBUTES { + ULONG Size; // = sizeof (struct _HIDD_ATTRIBUTES) + + // + // Vendor ids of this hid device + // + USHORT VendorID; + USHORT ProductID; + USHORT VersionNumber; + + // + // Additional fields will be added to the end of this structure. + // +} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES; + + +BOOLEAN __stdcall +HidD_GetAttributes ( + IN HANDLE HidDeviceObject, + OUT PHIDD_ATTRIBUTES Attributes + ); +/*++ +Routine Description: + Fill in the given HIDD_ATTRIBUTES structure with the attributes of the + given hid device. + +--*/ + + +void __stdcall +HidD_GetHidGuid ( + OUT LPGUID HidGuid + ); + +BOOLEAN __stdcall +HidD_GetPreparsedData ( + IN HANDLE HidDeviceObject, + OUT PHIDP_PREPARSED_DATA * PreparsedData + ); +/*++ +Routine Description: + Given a handle to a valid Hid Class Device Object, retrieve the preparsed + data for the device. This routine will allocate the appropriately + sized buffer to hold this preparsed data. It is up to client to call + HidP_FreePreparsedData to free the memory allocated to this structure when + it is no longer needed. + +Arguments: + HidDeviceObject A handle to a Hid Device that the client obtains using + a call to CreateFile on a valid Hid device string name. + The string name can be obtained using standard PnP calls. + + PreparsedData An opaque data structure used by other functions in this + library to retrieve information about a given device. + +Return Value: + TRUE if successful. + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_FreePreparsedData ( + IN PHIDP_PREPARSED_DATA PreparsedData + ); + +BOOLEAN __stdcall +HidD_FlushQueue ( + IN HANDLE HidDeviceObject + ); +/*++ +Routine Description: + Flush the input queue for the given HID device. + +Arguments: + HidDeviceObject A handle to a Hid Device that the client obtains using + a call to CreateFile on a valid Hid device string name. + The string name can be obtained using standard PnP calls. + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetConfiguration ( + IN HANDLE HidDeviceObject, + OUT PHIDD_CONFIGURATION Configuration, + IN ULONG ConfigurationLength + ); +/*++ +Routine Description: + Get the configuration information for this Hid device + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Configuration A configuration structure. HidD_GetConfiguration MUST + be called before the configuration can be modified and + set using HidD_SetConfiguration + + ConfigurationLength That is ``sizeof (HIDD_CONFIGURATION)''. Using this + parameter, we can later increase the length of the + configuration array and not break older apps. + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_SetConfiguration ( + IN HANDLE HidDeviceObject, + IN PHIDD_CONFIGURATION Configuration, + IN ULONG ConfigurationLength + ); +/*++ +Routine Description: + Set the configuration information for this Hid device... + + NOTE: HidD_GetConfiguration must be called to retrieve the current + configuration information before this information can be modified + and set. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Configuration A configuration structure. HidD_GetConfiguration MUST + be called before the configuration can be modified and + set using HidD_SetConfiguration + + ConfigurationLength That is ``sizeof (HIDD_CONFIGURATION)''. Using this + parameter, we can later increase the length of the + configuration array and not break older apps. + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetFeature ( + IN HANDLE HidDeviceObject, + OUT PVOID ReportBuffer, + IN ULONG ReportBufferLength + ); +/*++ +Routine Description: + Retrieve a feature report from a HID device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + ReportBuffer The buffer that the feature report should be placed + into. The first byte of the buffer should be set to + the report ID of the desired report + + ReportBufferLength The size (in bytes) of ReportBuffer. This value + should be greater than or equal to the + FeatureReportByteLength field as specified in the + HIDP_CAPS structure for the device +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_SetFeature ( + IN HANDLE HidDeviceObject, + IN PVOID ReportBuffer, + IN ULONG ReportBufferLength + ); +/*++ +Routine Description: + Send a feature report to a HID device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + ReportBuffer The buffer of the feature report to send to the device + + ReportBufferLength The size (in bytes) of ReportBuffer. This value + should be greater than or equal to the + FeatureReportByteLength field as specified in the + HIDP_CAPS structure for the device +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetNumInputBuffers ( + IN HANDLE HidDeviceObject, + OUT PULONG NumberBuffers + ); +/*++ +Routine Description: + This function returns the number of input buffers used by the specified + file handle to the Hid device. Each file object has a number of buffers + associated with it to queue reports read from the device but which have + not yet been read by the user-mode app with a handle to that device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + NumberBuffers Number of buffers currently being used for this file + handle to the Hid device + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_SetNumInputBuffers ( + IN HANDLE HidDeviceObject, + OUT ULONG NumberBuffers + ); +/*++ + +Routine Description: + This function sets the number of input buffers used by the specified + file handle to the Hid device. Each file object has a number of buffers + associated with it to queue reports read from the device but which have + not yet been read by the user-mode app with a handle to that device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + NumberBuffers New number of buffers to use for this file handle to + the Hid device + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetPhysicalDescriptor ( + IN HANDLE HidDeviceObject, + OUT PVOID Buffer, + IN ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves the raw physical descriptor for the specified + Hid device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Buffer Buffer which on return will contain the physical + descriptor if one exists for the specified device + handle + + BufferLength Length of buffer (in bytes) + + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetManufacturerString ( + IN HANDLE HidDeviceObject, + OUT PVOID Buffer, + IN ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves the manufacturer string from the specified + Hid device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Buffer Buffer which on return will contain the manufacturer + string returned from the device. This string is a + wide-character string + + BufferLength Length of Buffer (in bytes) + + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetProductString ( + IN HANDLE HidDeviceObject, + OUT PVOID Buffer, + IN ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves the product string from the specified + Hid device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Buffer Buffer which on return will contain the product + string returned from the device. This string is a + wide-character string + + BufferLength Length of Buffer (in bytes) + + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetIndexedString ( + IN HANDLE HidDeviceObject, + IN ULONG StringIndex, + OUT PVOID Buffer, + IN ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves a string from the specified Hid device that is + specified with a certain string index. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + StringIndex Index of the string to retrieve + + Buffer Buffer which on return will contain the product + string returned from the device. This string is a + wide-character string + + BufferLength Length of Buffer (in bytes) + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetSerialNumberString ( + IN HANDLE HidDeviceObject, + OUT PVOID Buffer, + IN ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves the serial number string from the specified + Hid device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Buffer Buffer which on return will contain the serial number + string returned from the device. This string is a + wide-character string + + BufferLength Length of Buffer (in bytes) + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + + +#include + +#endif + diff --git a/stepmania/src/archutils/Win32/ddk/hidusage.h b/stepmania/src/archutils/Win32/ddk/hidusage.h new file mode 100644 index 0000000000..6ee6890f93 --- /dev/null +++ b/stepmania/src/archutils/Win32/ddk/hidusage.h @@ -0,0 +1,265 @@ +/*++ + +Copyright (c) 1996, 1997 Microsoft Corporation + +Module Name: + + HIDUSAGE.H + +Abstract: + + Public Definitions of HID USAGES. + +Environment: + + Kernel & user mode + +--*/ + +#ifndef __HIDUSAGE_H__ +#define __HIDUSAGE_H__ + +// +// Usage Pages +// + +typedef USHORT USAGE, *PUSAGE; + +#define HID_USAGE_PAGE_GENERIC ((USAGE) 0x01) +#define HID_USAGE_PAGE_SIMULATION ((USAGE) 0x02) +#define HID_USAGE_PAGE_VR ((USAGE) 0x03) +#define HID_USAGE_PAGE_SPORT ((USAGE) 0x04) +#define HID_USAGE_PAGE_GAME ((USAGE) 0x05) +#define HID_USAGE_PAGE_KEYBOARD ((USAGE) 0x07) +#define HID_USAGE_PAGE_LED ((USAGE) 0x08) +#define HID_USAGE_PAGE_BUTTON ((USAGE) 0x09) +#define HID_USAGE_PAGE_ORDINAL ((USAGE) 0x0A) +#define HID_USAGE_PAGE_TELEPHONY ((USAGE) 0x0B) +#define HID_USAGE_PAGE_CONSUMER ((USAGE) 0x0C) +#define HID_USAGE_PAGE_DIGITIZER ((USAGE) 0x0D) +#define HID_USAGE_PAGE_UNICODE ((USAGE) 0x10) +#define HID_USAGE_PAGE_ALPHANUMERIC ((USAGE) 0x14) + + +// +// Usages from Generic Desktop Page (0x01) +// + +#define HID_USAGE_GENERIC_POINTER ((USAGE) 0x01) +#define HID_USAGE_GENERIC_MOUSE ((USAGE) 0x02) +#define HID_USAGE_GENERIC_JOYSTICK ((USAGE) 0x04) +#define HID_USAGE_GENERIC_GAMEPAD ((USAGE) 0x05) +#define HID_USAGE_GENERIC_KEYBOARD ((USAGE) 0x06) +#define HID_USAGE_GENERIC_KEYPAD ((USAGE) 0x07) +#define HID_USAGE_GENERIC_SYSTEM_CTL ((USAGE) 0x80) + +#define HID_USAGE_GENERIC_X ((USAGE) 0x30) +#define HID_USAGE_GENERIC_Y ((USAGE) 0x31) +#define HID_USAGE_GENERIC_Z ((USAGE) 0x32) +#define HID_USAGE_GENERIC_RX ((USAGE) 0x33) +#define HID_USAGE_GENERIC_RY ((USAGE) 0x34) +#define HID_USAGE_GENERIC_RZ ((USAGE) 0x35) +#define HID_USAGE_GENERIC_SLIDER ((USAGE) 0x36) +#define HID_USAGE_GENERIC_DIAL ((USAGE) 0x37) +#define HID_USAGE_GENERIC_WHEEL ((USAGE) 0x38) +#define HID_USAGE_GENERIC_HATSWITCH ((USAGE) 0x39) +#define HID_USAGE_GENERIC_COUNTED_BUFFER ((USAGE) 0x3A) +#define HID_USAGE_GENERIC_BYTE_COUNT ((USAGE) 0x3B) +#define HID_USAGE_GENERIC_MOTION_WAKEUP ((USAGE) 0x3C) +#define HID_USAGE_GENERIC_VX ((USAGE) 0x40) +#define HID_USAGE_GENERIC_VY ((USAGE) 0x41) +#define HID_USAGE_GENERIC_VZ ((USAGE) 0x42) +#define HID_USAGE_GENERIC_VBRX ((USAGE) 0x43) +#define HID_USAGE_GENERIC_VBRY ((USAGE) 0x44) +#define HID_USAGE_GENERIC_VBRZ ((USAGE) 0x45) +#define HID_USAGE_GENERIC_VNO ((USAGE) 0x46) +#define HID_USAGE_GENERIC_SYSCTL_POWER ((USAGE) 0x81) +#define HID_USAGE_GENERIC_SYSCTL_SLEEP ((USAGE) 0x82) +#define HID_USAGE_GENERIC_SYSCTL_WAKE ((USAGE) 0x83) +#define HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU ((USAGE) 0x84) +#define HID_USAGE_GENERIC_SYSCTL_MAIN_MENU ((USAGE) 0x85) +#define HID_USAGE_GENERIC_SYSCTL_APP_MENU ((USAGE) 0x86) +#define HID_USAGE_GENERIC_SYSCTL_HELP_MENU ((USAGE) 0x87) +#define HID_USAGE_GENERIC_SYSCTL_MENU_EXIT ((USAGE) 0x88) +#define HID_USAGE_GENERIC_SYSCTL_MENU_SELECT ((USAGE) 0x89) +#define HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT ((USAGE) 0x8A) +#define HID_USAGE_GENERIC_SYSCTL_MENU_LEFT ((USAGE) 0x8B) +#define HID_USAGE_GENERIC_SYSCTL_MENU_UP ((USAGE) 0x8C) +#define HID_USAGE_GENERIC_SYSCTL_MENU_DOWN ((USAGE) 0x8D) + +// +// Usages from Simulation Controls Page (0x02) +// + +#define HID_USAGE_SIMULATION_RUDDER ((USAGE) 0xBA) +#define HID_USAGE_SIMULATION_THROTTLE ((USAGE) 0xBB) + +// +// Virtual Reality Controls Page (0x03) +// + + +// +// Sport Controls Page (0x04) +// + + +// +// Game Controls Page (0x05) +// + + +// +// Keyboard/Keypad Page (0x07) +// + + // Error "keys" +#define HID_USAGE_KEYBOARD_NOEVENT ((USAGE) 0x00) +#define HID_USAGE_KEYBOARD_ROLLOVER ((USAGE) 0x01) +#define HID_USAGE_KEYBOARD_POSTFAIL ((USAGE) 0x02) +#define HID_USAGE_KEYBOARD_UNDEFINED ((USAGE) 0x03) + + // Letters +#define HID_USAGE_KEYBOARD_aA ((USAGE) 0x04) +#define HID_USAGE_KEYBOARD_zZ ((USAGE) 0x1D) + // Numbers +#define HID_USAGE_KEYBOARD_ONE ((USAGE) 0x1E) +#define HID_USAGE_KEYBOARD_ZERO ((USAGE) 0x27) + // Modifier Keys +#define HID_USAGE_KEYBOARD_LCTRL ((USAGE) 0xE0) +#define HID_USAGE_KEYBOARD_LSHFT ((USAGE) 0xE1) +#define HID_USAGE_KEYBOARD_LALT ((USAGE) 0xE2) +#define HID_USAGE_KEYBOARD_LGUI ((USAGE) 0xE3) +#define HID_USAGE_KEYBOARD_RCTRL ((USAGE) 0xE4) +#define HID_USAGE_KEYBOARD_RSHFT ((USAGE) 0xE5) +#define HID_USAGE_KEYBOARD_RALT ((USAGE) 0xE6) +#define HID_USAGE_KEYBOARD_RGUI ((USAGE) 0xE7) +#define HID_USAGE_KEYBOARD_SCROLL_LOCK ((USAGE) 0x47) +#define HID_USAGE_KEYBOARD_NUM_LOCK ((USAGE) 0x53) +#define HID_USAGE_KEYBOARD_CAPS_LOCK ((USAGE) 0x39) + // Funtion keys +#define HID_USAGE_KEYBOARD_F1 ((USAGE) 0x3A) +#define HID_USAGE_KEYBOARD_F12 ((USAGE) 0x45) + +#define HID_USAGE_KEYBOARD_RETURN ((USAGE) 0x28) +#define HID_USAGE_KEYBOARD_ESCAPE ((USAGE) 0x29) +#define HID_USAGE_KEYBOARD_DELETE ((USAGE) 0x2A) + +#define HID_USAGE_KEYBOARD_PRINT_SCREEN ((USAGE) 0x46) + +// and hundreds more... + +// +// LED Page (0x08) +// + +#define HID_USAGE_LED_NUM_LOCK ((USAGE) 0x01) +#define HID_USAGE_LED_CAPS_LOCK ((USAGE) 0x02) +#define HID_USAGE_LED_SCROLL_LOCK ((USAGE) 0x03) +#define HID_USAGE_LED_COMPOSE ((USAGE) 0x04) +#define HID_USAGE_LED_KANA ((USAGE) 0x05) +#define HID_USAGE_LED_POWER ((USAGE) 0x06) +#define HID_USAGE_LED_SHIFT ((USAGE) 0x07) +#define HID_USAGE_LED_DO_NOT_DISTURB ((USAGE) 0x08) +#define HID_USAGE_LED_MUTE ((USAGE) 0x09) +#define HID_USAGE_LED_TONE_ENABLE ((USAGE) 0x0A) +#define HID_USAGE_LED_HIGH_CUT_FILTER ((USAGE) 0x0B) +#define HID_USAGE_LED_LOW_CUT_FILTER ((USAGE) 0x0C) +#define HID_USAGE_LED_EQUALIZER_ENABLE ((USAGE) 0x0D) +#define HID_USAGE_LED_SOUND_FIELD_ON ((USAGE) 0x0E) +#define HID_USAGE_LED_SURROUND_FIELD_ON ((USAGE) 0x0F) +#define HID_USAGE_LED_REPEAT ((USAGE) 0x10) +#define HID_USAGE_LED_STEREO ((USAGE) 0x11) +#define HID_USAGE_LED_SAMPLING_RATE_DETECT ((USAGE) 0x12) +#define HID_USAGE_LED_SPINNING ((USAGE) 0x13) +#define HID_USAGE_LED_CAV ((USAGE) 0x14) +#define HID_USAGE_LED_CLV ((USAGE) 0x15) +#define HID_USAGE_LED_RECORDING_FORMAT_DET ((USAGE) 0x16) +#define HID_USAGE_LED_OFF_HOOK ((USAGE) 0x17) +#define HID_USAGE_LED_RING ((USAGE) 0x18) +#define HID_USAGE_LED_MESSAGE_WAITING ((USAGE) 0x19) +#define HID_USAGE_LED_DATA_MODE ((USAGE) 0x1A) +#define HID_USAGE_LED_BATTERY_OPERATION ((USAGE) 0x1B) +#define HID_USAGE_LED_BATTERY_OK ((USAGE) 0x1C) +#define HID_USAGE_LED_BATTERY_LOW ((USAGE) 0x1D) +#define HID_USAGE_LED_SPEAKER ((USAGE) 0x1E) +#define HID_USAGE_LED_HEAD_SET ((USAGE) 0x1F) +#define HID_USAGE_LED_HOLD ((USAGE) 0x20) +#define HID_USAGE_LED_MICROPHONE ((USAGE) 0x21) +#define HID_USAGE_LED_COVERAGE ((USAGE) 0x22) +#define HID_USAGE_LED_NIGHT_MODE ((USAGE) 0x23) +#define HID_USAGE_LED_SEND_CALLS ((USAGE) 0x24) +#define HID_USAGE_LED_CALL_PICKUP ((USAGE) 0x25) +#define HID_USAGE_LED_CONFERENCE ((USAGE) 0x26) +#define HID_USAGE_LED_STAND_BY ((USAGE) 0x27) +#define HID_USAGE_LED_CAMERA_ON ((USAGE) 0x28) +#define HID_USAGE_LED_CAMERA_OFF ((USAGE) 0x29) +#define HID_USAGE_LED_ON_LINE ((USAGE) 0x2A) +#define HID_USAGE_LED_OFF_LINE ((USAGE) 0x2B) +#define HID_USAGE_LED_BUSY ((USAGE) 0x2C) +#define HID_USAGE_LED_READY ((USAGE) 0x2D) +#define HID_USAGE_LED_PAPER_OUT ((USAGE) 0x2E) +#define HID_USAGE_LED_PAPER_JAM ((USAGE) 0x2F) +#define HID_USAGE_LED_REMOTE ((USAGE) 0x30) +#define HID_USAGE_LED_FORWARD ((USAGE) 0x31) +#define HID_USAGE_LED_REVERSE ((USAGE) 0x32) +#define HID_USAGE_LED_STOP ((USAGE) 0x33) +#define HID_USAGE_LED_REWIND ((USAGE) 0x34) +#define HID_USAGE_LED_FAST_FORWARD ((USAGE) 0x35) +#define HID_USAGE_LED_PLAY ((USAGE) 0x36) +#define HID_USAGE_LED_PAUSE ((USAGE) 0x37) +#define HID_USAGE_LED_RECORD ((USAGE) 0x38) +#define HID_USAGE_LED_ERROR ((USAGE) 0x39) +#define HID_USAGE_LED_SELECTED_INDICATOR ((USAGE) 0x3A) +#define HID_USAGE_LED_IN_USE_INDICATOR ((USAGE) 0x3B) +#define HID_USAGE_LED_MULTI_MODE_INDICATOR ((USAGE) 0x3C) +#define HID_USAGE_LED_INDICATOR_ON ((USAGE) 0x3D) +#define HID_USAGE_LED_INDICATOR_FLASH ((USAGE) 0x3E) +#define HID_USAGE_LED_INDICATOR_SLOW_BLINK ((USAGE) 0x3F) +#define HID_USAGE_LED_INDICATOR_FAST_BLINK ((USAGE) 0x40) +#define HID_USAGE_LED_INDICATOR_OFF ((USAGE) 0x41) +#define HID_USAGE_LED_FLASH_ON_TIME ((USAGE) 0x42) +#define HID_USAGE_LED_SLOW_BLINK_ON_TIME ((USAGE) 0x43) +#define HID_USAGE_LED_SLOW_BLINK_OFF_TIME ((USAGE) 0x44) +#define HID_USAGE_LED_FAST_BLINK_ON_TIME ((USAGE) 0x45) +#define HID_USAGE_LED_FAST_BLINK_OFF_TIME ((USAGE) 0x46) +#define HID_USAGE_LED_INDICATOR_COLOR ((USAGE) 0x47) +#define HID_USAGE_LED_RED ((USAGE) 0x48) +#define HID_USAGE_LED_GREEN ((USAGE) 0x49) +#define HID_USAGE_LED_AMBER ((USAGE) 0x4A) +#define HID_USAGE_LED_GENERIC_INDICATOR ((USAGE) 0x3B) + +// +// Button Page (0x09) +// +// There is no need to label these usages. +// + + +// +// Ordinal Page (0x0A) +// +// There is no need to label these usages. +// + + +// +// Telephony Device Page (0x0B) +// + +#define HID_USAGE_TELEPHONY_PHONE ((USAGE) 0x01) +#define HID_USAGE_TELEPHONY_ANSWERING_MACHINE ((USAGE) 0x02) +#define HID_USAGE_TELEPHONY_MESSAGE_CONTROLS ((USAGE) 0x03) +#define HID_USAGE_TELEPHONY_HANDSET ((USAGE) 0x04) +#define HID_USAGE_TELEPHONY_HEADSET ((USAGE) 0x05) +#define HID_USAGE_TELEPHONY_KEYPAD ((USAGE) 0x06) +#define HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON ((USAGE) 0x07) + +// +// and others... +// + + +#endif + + diff --git a/stepmania/src/archutils/Win32/ddk/setupapi.h b/stepmania/src/archutils/Win32/ddk/setupapi.h new file mode 100644 index 0000000000..d832be9568 --- /dev/null +++ b/stepmania/src/archutils/Win32/ddk/setupapi.h @@ -0,0 +1,5929 @@ +/*++ + +Copyright (c) 1995-1999 Microsoft Corporation + +Module Name: + + setupapi.h + +Abstract: + + Public header file for Windows NT Setup and Device Installer services Dll. + +--*/ + +#ifndef _INC_SETUPAPI +#define _INC_SETUPAPI + +#if _MSC_VER > 1000 +#pragma once +#endif + +// +// Define API decoration for direct importing of DLL references. +// +#if !defined(_SETUPAPI_) +#define WINSETUPAPI DECLSPEC_IMPORT +#else +#define WINSETUPAPI +#endif + +#ifndef __LPGUID_DEFINED__ +#define __LPGUID_DEFINED__ +typedef GUID *LPGUID; +#endif + +// +// Include commctrl.h for our use of HIMAGELIST and wizard support. +// +#include + + +#include // Assume byte packing throughout + +#ifdef __cplusplus +extern "C" { +#endif + +// +// Define maximum string length constants as specified by +// Windows 95. +// +#define LINE_LEN 256 // Win95-compatible maximum for displayable + // strings coming from a device INF. +#define MAX_INF_STRING_LENGTH 4096 // Actual maximum size of an INF string + // (including string substitutions). +#define MAX_TITLE_LEN 60 +#define MAX_INSTRUCTION_LEN 256 +#define MAX_LABEL_LEN 30 +#define MAX_SERVICE_NAME_LEN 256 +#define MAX_SUBTITLE_LEN 256 + +// +// Define maximum length of a machine name in the format expected by ConfigMgr32 +// CM_Connect_Machine (i.e., "\\\\MachineName\0"). +// +#define SP_MAX_MACHINENAME_LENGTH (MAX_PATH + 3) + +// +// Define type for reference to loaded inf file +// +typedef PVOID HINF; + +// +// Inf context structure. Applications must not interpret or +// overwrite values in these structures. +// +typedef struct _INFCONTEXT { + PVOID Inf; + PVOID CurrentInf; + UINT Section; + UINT Line; +} INFCONTEXT, *PINFCONTEXT; + +// +// Inf file information structure. +// +typedef struct _SP_INF_INFORMATION { + DWORD InfStyle; + DWORD InfCount; + BYTE VersionData[ANYSIZE_ARRAY]; +} SP_INF_INFORMATION, *PSP_INF_INFORMATION; + +// +// Define structure for passing alternate platform info into +// SetupSetFileQueueAlternatePlatform and SetupQueryInfOriginalFileInformation. +// +typedef struct _SP_ALTPLATFORM_INFO { + DWORD cbSize; + // + // platform to use (VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT) + // + DWORD Platform; + // + // major and minor version numbers to use + // + DWORD MajorVersion; + DWORD MinorVersion; + // + // processor architecture to use (PROCESSOR_ARCHITECTURE_INTEL, + // PROCESSOR_ARCHITECTURE_ALPHA, PROCESSOR_ARCHITECTURE_IA64, or + // PROCESSOR_ARCHITECTURE_ALPHA64) + // + WORD ProcessorArchitecture; + + WORD Reserved; // must be zero. +} SP_ALTPLATFORM_INFO, *PSP_ALTPLATFORM_INFO; + +// +// Define structure that is filled in by SetupQueryInfOriginalFileInformation +// to indicate the INF's original name and the original name of the (potentially +// platform-specific) catalog file specified by that INF. +// +typedef struct _SP_ORIGINAL_FILE_INFO_A { + DWORD cbSize; + CHAR OriginalInfName[MAX_PATH]; + CHAR OriginalCatalogName[MAX_PATH]; +} SP_ORIGINAL_FILE_INFO_A, *PSP_ORIGINAL_FILE_INFO_A; + +typedef struct _SP_ORIGINAL_FILE_INFO_W { + DWORD cbSize; + WCHAR OriginalInfName[MAX_PATH]; + WCHAR OriginalCatalogName[MAX_PATH]; +} SP_ORIGINAL_FILE_INFO_W, *PSP_ORIGINAL_FILE_INFO_W; + +#ifdef UNICODE +typedef SP_ORIGINAL_FILE_INFO_W SP_ORIGINAL_FILE_INFO; +typedef PSP_ORIGINAL_FILE_INFO_W PSP_ORIGINAL_FILE_INFO; +#else +typedef SP_ORIGINAL_FILE_INFO_A SP_ORIGINAL_FILE_INFO; +typedef PSP_ORIGINAL_FILE_INFO_A PSP_ORIGINAL_FILE_INFO; +#endif + +// +// SP_INF_INFORMATION.InfStyle values +// +#define INF_STYLE_NONE 0x00000000 // unrecognized or non-existent +#define INF_STYLE_OLDNT 0x00000001 // winnt 3.x +#define INF_STYLE_WIN4 0x00000002 // Win95 + +// +// Additional InfStyle flags that may be specified when calling SetupOpenInfFile. +// +// +#define INF_STYLE_CACHE_ENABLE 0x00000010 // always cache INF, even outside of %windir%\Inf +#define INF_STYLE_CACHE_DISABLE 0x00000020 // delete cached INF information + + +// +// Target directory specs. +// +#define DIRID_ABSOLUTE -1 // real 32-bit -1 +#define DIRID_ABSOLUTE_16BIT 0xffff // 16-bit -1 for compat w/setupx +#define DIRID_NULL 0 +#define DIRID_SRCPATH 1 +#define DIRID_WINDOWS 10 +#define DIRID_SYSTEM 11 // system32 +#define DIRID_DRIVERS 12 +#define DIRID_IOSUBSYS DIRID_DRIVERS +#define DIRID_INF 17 +#define DIRID_HELP 18 +#define DIRID_FONTS 20 +#define DIRID_VIEWERS 21 +#define DIRID_COLOR 23 +#define DIRID_APPS 24 +#define DIRID_SHARED 25 +#define DIRID_BOOT 30 + +#define DIRID_SYSTEM16 50 +#define DIRID_SPOOL 51 +#define DIRID_SPOOLDRIVERS 52 +#define DIRID_USERPROFILE 53 +#define DIRID_LOADER 54 +#define DIRID_PRINTPROCESSOR 55 + +#define DIRID_DEFAULT DIRID_SYSTEM + +// +// The following DIRIDs are for commonly-used shell "special folders". The +// complete list of such folders is contained in shlobj.h. In that headerfile, +// each folder is assigned a CSIDL_* value. The DIRID values below are created +// by taking the CSIDL value in shlobj.h and OR'ing it with 0x4000. Thus, if +// an INF needs to reference other special folders not defined below, it may +// generate one using the above mechanism, and setupapi will automatically deal +// with it and use the corresponding shell's path where appropriate. (Remember +// that DIRIDs must be specified in decimal, not hex, in an INF when used for +// string substitution.) +// +#define DIRID_COMMON_STARTMENU 16406 // All Users\Start Menu +#define DIRID_COMMON_PROGRAMS 16407 // All Users\Start Menu\Programs +#define DIRID_COMMON_STARTUP 16408 // All Users\Start Menu\Programs\Startup +#define DIRID_COMMON_DESKTOPDIRECTORY 16409 // All Users\Desktop +#define DIRID_COMMON_FAVORITES 16415 // All Users\Favorites +#define DIRID_COMMON_APPDATA 16419 // All Users\Application Data + +#define DIRID_PROGRAM_FILES 16422 // Program Files +#define DIRID_SYSTEM_X86 16425 // system32 on RISC +#define DIRID_PROGRAM_FILES_X86 16426 // Program Files on RISC +#define DIRID_PROGRAM_FILES_COMMON 16427 // Program Files\Common +#define DIRID_PROGRAM_FILES_COMMONX86 16428 // x86 Program Files\Common on RISC + +#define DIRID_COMMON_TEMPLATES 16429 // All Users\Templates +#define DIRID_COMMON_DOCUMENTS 16430 // All Users\Documents + + +// +// First user-definable dirid. See SetupSetDirectoryId(). +// +#define DIRID_USER 0x8000 + + +// +// Setup callback notification routine type +// +typedef UINT (CALLBACK* PSP_FILE_CALLBACK_A)( + IN PVOID Context, + IN UINT Notification, + IN UINT_PTR Param1, + IN UINT_PTR Param2 + ); + +typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)( + IN PVOID Context, + IN UINT Notification, + IN UINT_PTR Param1, + IN UINT_PTR Param2 + ); + +#ifdef UNICODE +#define PSP_FILE_CALLBACK PSP_FILE_CALLBACK_W +#else +#define PSP_FILE_CALLBACK PSP_FILE_CALLBACK_A +#endif + + +// +// Operation/queue start/end notification. These are ordinal values. +// +#define SPFILENOTIFY_STARTQUEUE 0x00000001 +#define SPFILENOTIFY_ENDQUEUE 0x00000002 +#define SPFILENOTIFY_STARTSUBQUEUE 0x00000003 +#define SPFILENOTIFY_ENDSUBQUEUE 0x00000004 +#define SPFILENOTIFY_STARTDELETE 0x00000005 +#define SPFILENOTIFY_ENDDELETE 0x00000006 +#define SPFILENOTIFY_DELETEERROR 0x00000007 +#define SPFILENOTIFY_STARTRENAME 0x00000008 +#define SPFILENOTIFY_ENDRENAME 0x00000009 +#define SPFILENOTIFY_RENAMEERROR 0x0000000a +#define SPFILENOTIFY_STARTCOPY 0x0000000b +#define SPFILENOTIFY_ENDCOPY 0x0000000c +#define SPFILENOTIFY_COPYERROR 0x0000000d +#define SPFILENOTIFY_NEEDMEDIA 0x0000000e +#define SPFILENOTIFY_QUEUESCAN 0x0000000f +// +// These are used with SetupIterateCabinet(). +// +#define SPFILENOTIFY_CABINETINFO 0x00000010 +#define SPFILENOTIFY_FILEINCABINET 0x00000011 +#define SPFILENOTIFY_NEEDNEWCABINET 0x00000012 +#define SPFILENOTIFY_FILEEXTRACTED 0x00000013 +#define SPFILENOTIFY_FILEOPDELAYED 0x00000014 +// +// These are used for backup operations +// +#define SPFILENOTIFY_STARTBACKUP 0x00000015 +#define SPFILENOTIFY_BACKUPERROR 0x00000016 +#define SPFILENOTIFY_ENDBACKUP 0x00000017 +// +// Extended notification for SetupScanFileQueue(Flags=SPQ_SCAN_USE_CALLBACKEX) +// +#define SPFILENOTIFY_QUEUESCAN_EX 0x00000018 +// +// Copy notification. These are bit flags that may be combined. +// +#define SPFILENOTIFY_LANGMISMATCH 0x00010000 +#define SPFILENOTIFY_TARGETEXISTS 0x00020000 +#define SPFILENOTIFY_TARGETNEWER 0x00040000 + +// +// File operation codes and callback outcomes. +// +#define FILEOP_COPY 0 +#define FILEOP_RENAME 1 +#define FILEOP_DELETE 2 +#define FILEOP_BACKUP 3 + +#define FILEOP_ABORT 0 +#define FILEOP_DOIT 1 +#define FILEOP_SKIP 2 +#define FILEOP_RETRY FILEOP_DOIT +#define FILEOP_NEWPATH 4 + +// +// Flags in inf copy sections +// +#define COPYFLG_WARN_IF_SKIP 0x00000001 // warn if user tries to skip file +#define COPYFLG_NOSKIP 0x00000002 // disallow skipping this file +#define COPYFLG_NOVERSIONCHECK 0x00000004 // ignore versions and overwrite target +#define COPYFLG_FORCE_FILE_IN_USE 0x00000008 // force file-in-use behavior +#define COPYFLG_NO_OVERWRITE 0x00000010 // do not copy if file exists on target +#define COPYFLG_NO_VERSION_DIALOG 0x00000020 // do not copy if target is newer +#define COPYFLG_OVERWRITE_OLDER_ONLY 0x00000040 // leave target alone if version same as source +#define COPYFLG_REPLACEONLY 0x00000400 // copy only if file exists on target +#define COPYFLG_NODECOMP 0x00000800 // don't attempt to decompress file; copy as-is +#define COPYFLG_REPLACE_BOOT_FILE 0x00001000 // file must be present upon reboot (i.e., it's + // needed by the loader); this flag implies a reboot +#define COPYFLG_NOPRUNE 0x00002000 // never prune this file + +// +// Flags in inf delete sections +// New flags go in high word +// +#define DELFLG_IN_USE 0x00000001 // queue in-use file for delete +#define DELFLG_IN_USE1 0x00010000 // high-word version of DELFLG_IN_USE + +// +// Source and file paths. Used when notifying queue callback +// of SPFILENOTIFY_STARTxxx, SPFILENOTIFY_ENDxxx, and SPFILENOTIFY_xxxERROR. +// +typedef struct _FILEPATHS_A { + PCSTR Target; + PCSTR Source; // not used for delete operations + UINT Win32Error; + DWORD Flags; // such as SP_COPY_NOSKIP for copy errors +} FILEPATHS_A, *PFILEPATHS_A; + +typedef struct _FILEPATHS_W { + PCWSTR Target; + PCWSTR Source; // not used for delete operations + UINT Win32Error; + DWORD Flags; // such as SP_COPY_NOSKIP for copy errors +} FILEPATHS_W, *PFILEPATHS_W; + +#ifdef UNICODE +typedef FILEPATHS_W FILEPATHS; +typedef PFILEPATHS_W PFILEPATHS; +#else +typedef FILEPATHS_A FILEPATHS; +typedef PFILEPATHS_A PFILEPATHS; +#endif + + +// +// Structure used with SPFILENOTIFY_NEEDMEDIA +// +typedef struct _SOURCE_MEDIA_A { + PCSTR Reserved; + PCSTR Tagfile; // may be NULL + PCSTR Description; + // + // Pathname part and filename part of source file + // that caused us to need the media. + // + PCSTR SourcePath; + PCSTR SourceFile; + DWORD Flags; // subset of SP_COPY_xxx +} SOURCE_MEDIA_A, *PSOURCE_MEDIA_A; + +typedef struct _SOURCE_MEDIA_W { + PCWSTR Reserved; + PCWSTR Tagfile; // may be NULL + PCWSTR Description; + // + // Pathname part and filename part of source file + // that caused us to need the media. + // + PCWSTR SourcePath; + PCWSTR SourceFile; + DWORD Flags; // subset of SP_COPY_xxx +} SOURCE_MEDIA_W, *PSOURCE_MEDIA_W; + +#ifdef UNICODE +typedef SOURCE_MEDIA_W SOURCE_MEDIA; +typedef PSOURCE_MEDIA_W PSOURCE_MEDIA; +#else +typedef SOURCE_MEDIA_A SOURCE_MEDIA; +typedef PSOURCE_MEDIA_A PSOURCE_MEDIA; +#endif + +// +// Structure used with SPFILENOTIFY_CABINETINFO and +// SPFILENOTIFY_NEEDNEWCABINET +// +typedef struct _CABINET_INFO_A { + PCSTR CabinetPath; + PCSTR CabinetFile; + PCSTR DiskName; + USHORT SetId; + USHORT CabinetNumber; +} CABINET_INFO_A, *PCABINET_INFO_A; + +typedef struct _CABINET_INFO_W { + PCWSTR CabinetPath; + PCWSTR CabinetFile; + PCWSTR DiskName; + USHORT SetId; + USHORT CabinetNumber; +} CABINET_INFO_W, *PCABINET_INFO_W; + +#ifdef UNICODE +typedef CABINET_INFO_W CABINET_INFO; +typedef PCABINET_INFO_W PCABINET_INFO; +#else +typedef CABINET_INFO_A CABINET_INFO; +typedef PCABINET_INFO_A PCABINET_INFO; +#endif + +// +// Structure used with SPFILENOTIFY_FILEINCABINET +// +typedef struct _FILE_IN_CABINET_INFO_A { + PCSTR NameInCabinet; + DWORD FileSize; + DWORD Win32Error; + WORD DosDate; + WORD DosTime; + WORD DosAttribs; + CHAR FullTargetName[MAX_PATH]; +} FILE_IN_CABINET_INFO_A, *PFILE_IN_CABINET_INFO_A; + +typedef struct _FILE_IN_CABINET_INFO_W { + PCWSTR NameInCabinet; + DWORD FileSize; + DWORD Win32Error; + WORD DosDate; + WORD DosTime; + WORD DosAttribs; + WCHAR FullTargetName[MAX_PATH]; +} FILE_IN_CABINET_INFO_W, *PFILE_IN_CABINET_INFO_W; + +#ifdef UNICODE +typedef FILE_IN_CABINET_INFO_W FILE_IN_CABINET_INFO; +typedef PFILE_IN_CABINET_INFO_W PFILE_IN_CABINET_INFO; +#else +typedef FILE_IN_CABINET_INFO_A FILE_IN_CABINET_INFO; +typedef PFILE_IN_CABINET_INFO_A PFILE_IN_CABINET_INFO; +#endif + + +// +// Define type for setup file queue +// +typedef PVOID HSPFILEQ; + +// +// Structure used with SetupQueueCopyIndirect +// +typedef struct _SP_FILE_COPY_PARAMS_A { + DWORD cbSize; + HSPFILEQ QueueHandle; + PCSTR SourceRootPath; OPTIONAL + PCSTR SourcePath; OPTIONAL + PCSTR SourceFilename; + PCSTR SourceDescription; OPTIONAL + PCSTR SourceTagfile; OPTIONAL + PCSTR TargetDirectory; + PCSTR TargetFilename; OPTIONAL + DWORD CopyStyle; + HINF LayoutInf; OPTIONAL + PCSTR SecurityDescriptor; OPTIONAL +} SP_FILE_COPY_PARAMS_A, *PSP_FILE_COPY_PARAMS_A; + +typedef struct _SP_FILE_COPY_PARAMS_W { + DWORD cbSize; + HSPFILEQ QueueHandle; + PCWSTR SourceRootPath; OPTIONAL + PCWSTR SourcePath; OPTIONAL + PCWSTR SourceFilename; + PCWSTR SourceDescription; OPTIONAL + PCWSTR SourceTagfile; OPTIONAL + PCWSTR TargetDirectory; + PCWSTR TargetFilename; OPTIONAL + DWORD CopyStyle; + HINF LayoutInf; OPTIONAL + PCWSTR SecurityDescriptor; OPTIONAL +} SP_FILE_COPY_PARAMS_W, *PSP_FILE_COPY_PARAMS_W; + +#ifdef UNICODE +typedef SP_FILE_COPY_PARAMS_W SP_FILE_COPY_PARAMS; +typedef PSP_FILE_COPY_PARAMS_W PSP_FILE_COPY_PARAMS; +#else +typedef SP_FILE_COPY_PARAMS_A SP_FILE_COPY_PARAMS; +typedef PSP_FILE_COPY_PARAMS_A PSP_FILE_COPY_PARAMS; +#endif + + +// +// Define type for setup disk space list +// +typedef PVOID HDSKSPC; + +// +// Define type for reference to device information set +// +typedef PVOID HDEVINFO; + +// +// Device information structure (references a device instance +// that is a member of a device information set) +// +typedef struct _SP_DEVINFO_DATA { + DWORD cbSize; + GUID ClassGuid; + DWORD DevInst; // DEVINST handle + ULONG_PTR Reserved; +} SP_DEVINFO_DATA, *PSP_DEVINFO_DATA; + +// +// Device interface information structure (references a device +// interface that is associated with the device information +// element that owns it). +// +typedef struct _SP_DEVICE_INTERFACE_DATA { + DWORD cbSize; + GUID InterfaceClassGuid; + DWORD Flags; + ULONG_PTR Reserved; +} SP_DEVICE_INTERFACE_DATA, *PSP_DEVICE_INTERFACE_DATA; + +// +// Flags for SP_DEVICE_INTERFACE_DATA.Flags field. +// +#define SPINT_ACTIVE 0x00000001 +#define SPINT_DEFAULT 0x00000002 +#define SPINT_REMOVED 0x00000004 + +// +// Backward compatibility--do not use. +// +typedef SP_DEVICE_INTERFACE_DATA SP_INTERFACE_DEVICE_DATA; +typedef PSP_DEVICE_INTERFACE_DATA PSP_INTERFACE_DEVICE_DATA; +#define SPID_ACTIVE SPINT_ACTIVE +#define SPID_DEFAULT SPINT_DEFAULT +#define SPID_REMOVED SPINT_REMOVED + + +typedef struct _SP_DEVICE_INTERFACE_DETAIL_DATA_A { + DWORD cbSize; + CHAR DevicePath[ANYSIZE_ARRAY]; +} SP_DEVICE_INTERFACE_DETAIL_DATA_A, *PSP_DEVICE_INTERFACE_DETAIL_DATA_A; + +typedef struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W { + DWORD cbSize; + WCHAR DevicePath[ANYSIZE_ARRAY]; +} SP_DEVICE_INTERFACE_DETAIL_DATA_W, *PSP_DEVICE_INTERFACE_DETAIL_DATA_W; + +#ifdef UNICODE +typedef SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA; +typedef PSP_DEVICE_INTERFACE_DETAIL_DATA_W PSP_DEVICE_INTERFACE_DETAIL_DATA; +#else +typedef SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_DEVICE_INTERFACE_DETAIL_DATA; +typedef PSP_DEVICE_INTERFACE_DETAIL_DATA_A PSP_DEVICE_INTERFACE_DETAIL_DATA; +#endif + +// +// Backward compatibility--do not use. +// +typedef SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DATA_W; +typedef PSP_DEVICE_INTERFACE_DETAIL_DATA_W PSP_INTERFACE_DEVICE_DETAIL_DATA_W; +typedef SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_INTERFACE_DEVICE_DETAIL_DATA_A; +typedef PSP_DEVICE_INTERFACE_DETAIL_DATA_A PSP_INTERFACE_DEVICE_DETAIL_DATA_A; +#ifdef UNICODE +typedef SP_INTERFACE_DEVICE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DATA; +typedef PSP_INTERFACE_DEVICE_DETAIL_DATA_W PSP_INTERFACE_DEVICE_DETAIL_DATA; +#else +typedef SP_INTERFACE_DEVICE_DETAIL_DATA_A SP_INTERFACE_DEVICE_DETAIL_DATA; +typedef PSP_INTERFACE_DEVICE_DETAIL_DATA_A PSP_INTERFACE_DEVICE_DETAIL_DATA; +#endif + + +// +// Structure for detailed information on a device information set (used for +// SetupDiGetDeviceInfoListDetail which supercedes the functionality of +// SetupDiGetDeviceInfoListClass). +// +typedef struct _SP_DEVINFO_LIST_DETAIL_DATA_A { + DWORD cbSize; + GUID ClassGuid; + HANDLE RemoteMachineHandle; + CHAR RemoteMachineName[SP_MAX_MACHINENAME_LENGTH]; +} SP_DEVINFO_LIST_DETAIL_DATA_A, *PSP_DEVINFO_LIST_DETAIL_DATA_A; + +typedef struct _SP_DEVINFO_LIST_DETAIL_DATA_W { + DWORD cbSize; + GUID ClassGuid; + HANDLE RemoteMachineHandle; + WCHAR RemoteMachineName[SP_MAX_MACHINENAME_LENGTH]; +} SP_DEVINFO_LIST_DETAIL_DATA_W, *PSP_DEVINFO_LIST_DETAIL_DATA_W; + +#ifdef UNICODE +typedef SP_DEVINFO_LIST_DETAIL_DATA_W SP_DEVINFO_LIST_DETAIL_DATA; +typedef PSP_DEVINFO_LIST_DETAIL_DATA_W PSP_DEVINFO_LIST_DETAIL_DATA; +#else +typedef SP_DEVINFO_LIST_DETAIL_DATA_A SP_DEVINFO_LIST_DETAIL_DATA; +typedef PSP_DEVINFO_LIST_DETAIL_DATA_A PSP_DEVINFO_LIST_DETAIL_DATA; +#endif + + +// +// Class installer function codes +// +#define DIF_SELECTDEVICE 0x00000001 +#define DIF_INSTALLDEVICE 0x00000002 +#define DIF_ASSIGNRESOURCES 0x00000003 +#define DIF_PROPERTIES 0x00000004 +#define DIF_REMOVE 0x00000005 +#define DIF_FIRSTTIMESETUP 0x00000006 +#define DIF_FOUNDDEVICE 0x00000007 +#define DIF_SELECTCLASSDRIVERS 0x00000008 +#define DIF_VALIDATECLASSDRIVERS 0x00000009 +#define DIF_INSTALLCLASSDRIVERS 0x0000000A +#define DIF_CALCDISKSPACE 0x0000000B +#define DIF_DESTROYPRIVATEDATA 0x0000000C +#define DIF_VALIDATEDRIVER 0x0000000D +#define DIF_MOVEDEVICE 0x0000000E +#define DIF_DETECT 0x0000000F +#define DIF_INSTALLWIZARD 0x00000010 +#define DIF_DESTROYWIZARDDATA 0x00000011 +#define DIF_PROPERTYCHANGE 0x00000012 +#define DIF_ENABLECLASS 0x00000013 +#define DIF_DETECTVERIFY 0x00000014 +#define DIF_INSTALLDEVICEFILES 0x00000015 +#define DIF_UNREMOVE 0x00000016 +#define DIF_SELECTBESTCOMPATDRV 0x00000017 +#define DIF_ALLOW_INSTALL 0x00000018 +#define DIF_REGISTERDEVICE 0x00000019 +#define DIF_NEWDEVICEWIZARD_PRESELECT 0x0000001A +#define DIF_NEWDEVICEWIZARD_SELECT 0x0000001B +#define DIF_NEWDEVICEWIZARD_PREANALYZE 0x0000001C +#define DIF_NEWDEVICEWIZARD_POSTANALYZE 0x0000001D +#define DIF_NEWDEVICEWIZARD_FINISHINSTALL 0x0000001E +#define DIF_UNUSED1 0x0000001F +#define DIF_INSTALLINTERFACES 0x00000020 +#define DIF_DETECTCANCEL 0x00000021 +#define DIF_REGISTER_COINSTALLERS 0x00000022 +#define DIF_ADDPROPERTYPAGE_ADVANCED 0x00000023 +#define DIF_ADDPROPERTYPAGE_BASIC 0x00000024 +#define DIF_RESERVED1 0x00000025 +#define DIF_TROUBLESHOOTER 0x00000026 +#define DIF_POWERMESSAGEWAKE 0x00000027 + +typedef UINT DI_FUNCTION; // Function type for device installer + + +// +// Device installation parameters structure (associated with a +// particular device information element, or globally with a device +// information set) +// +typedef struct _SP_DEVINSTALL_PARAMS_A { + DWORD cbSize; + DWORD Flags; + DWORD FlagsEx; + HWND hwndParent; + PSP_FILE_CALLBACK InstallMsgHandler; + PVOID InstallMsgHandlerContext; + HSPFILEQ FileQueue; + ULONG_PTR ClassInstallReserved; + DWORD Reserved; + CHAR DriverPath[MAX_PATH]; +} SP_DEVINSTALL_PARAMS_A, *PSP_DEVINSTALL_PARAMS_A; + +typedef struct _SP_DEVINSTALL_PARAMS_W { + DWORD cbSize; + DWORD Flags; + DWORD FlagsEx; + HWND hwndParent; + PSP_FILE_CALLBACK InstallMsgHandler; + PVOID InstallMsgHandlerContext; + HSPFILEQ FileQueue; + ULONG_PTR ClassInstallReserved; + DWORD Reserved; + WCHAR DriverPath[MAX_PATH]; +} SP_DEVINSTALL_PARAMS_W, *PSP_DEVINSTALL_PARAMS_W; + +#ifdef UNICODE +typedef SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS; +typedef PSP_DEVINSTALL_PARAMS_W PSP_DEVINSTALL_PARAMS; +#else +typedef SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS; +typedef PSP_DEVINSTALL_PARAMS_A PSP_DEVINSTALL_PARAMS; +#endif + + +// +// SP_DEVINSTALL_PARAMS.Flags values +// +// Flags for choosing a device +// +#define DI_SHOWOEM 0x00000001L // support Other... button +#define DI_SHOWCOMPAT 0x00000002L // show compatibility list +#define DI_SHOWCLASS 0x00000004L // show class list +#define DI_SHOWALL 0x00000007L // both class & compat list shown +#define DI_NOVCP 0x00000008L // don't create a new copy queue--use + // caller-supplied FileQueue +#define DI_DIDCOMPAT 0x00000010L // Searched for compatible devices +#define DI_DIDCLASS 0x00000020L // Searched for class devices +#define DI_AUTOASSIGNRES 0x00000040L // No UI for resources if possible + +// flags returned by DiInstallDevice to indicate need to reboot/restart +#define DI_NEEDRESTART 0x00000080L // Reboot required to take effect +#define DI_NEEDREBOOT 0x00000100L // "" + +// flags for device installation +#define DI_NOBROWSE 0x00000200L // no Browse... in InsertDisk + +// Flags set by DiBuildDriverInfoList +#define DI_MULTMFGS 0x00000400L // Set if multiple manufacturers in + // class driver list + +// Flag indicates that device is disabled +#define DI_DISABLED 0x00000800L // Set if device disabled + +// Flags for Device/Class Properties +#define DI_GENERALPAGE_ADDED 0x00001000L +#define DI_RESOURCEPAGE_ADDED 0x00002000L + +// Flag to indicate the setting properties for this Device (or class) caused a change +// so the Dev Mgr UI probably needs to be updatd. +#define DI_PROPERTIES_CHANGE 0x00004000L + +// Flag to indicate that the sorting from the INF file should be used. +#define DI_INF_IS_SORTED 0x00008000L + +// Flag to indicate that only the the INF specified by SP_DEVINSTALL_PARAMS.DriverPath +// should be searched. +#define DI_ENUMSINGLEINF 0x00010000L + +// Flag that prevents ConfigMgr from removing/re-enumerating devices during device +// registration, installation, and deletion. +#define DI_DONOTCALLCONFIGMG 0x00020000L + +// The following flag can be used to install a device disabled +#define DI_INSTALLDISABLED 0x00040000L + +// Flag that causes SetupDiBuildDriverInfoList to build a device's compatible driver +// list from its existing class driver list, instead of the normal INF search. +#define DI_COMPAT_FROM_CLASS 0x00080000L + +// This flag is set if the Class Install params should be used. +#define DI_CLASSINSTALLPARAMS 0x00100000L + +// This flag is set if the caller of DiCallClassInstaller does NOT +// want the internal default action performed if the Class installer +// returns ERROR_DI_DO_DEFAULT. +#define DI_NODI_DEFAULTACTION 0x00200000L + +// The setupx flag, DI_NOSYNCPROCESSING (0x00400000L) is not support in the Setup APIs. + +// flags for device installation +#define DI_QUIETINSTALL 0x00800000L // don't confuse the user with + // questions or excess info +#define DI_NOFILECOPY 0x01000000L // No file Copy necessary +#define DI_FORCECOPY 0x02000000L // Force files to be copied from install path +#define DI_DRIVERPAGE_ADDED 0x04000000L // Prop provider added Driver page. +#define DI_USECI_SELECTSTRINGS 0x08000000L // Use Class Installer Provided strings in the Select Device Dlg +#define DI_OVERRIDE_INFFLAGS 0x10000000L // Override INF flags +#define DI_PROPS_NOCHANGEUSAGE 0x20000000L // No Enable/Disable in General Props + +#define DI_NOSELECTICONS 0x40000000L // No small icons in select device dialogs + +#define DI_NOWRITE_IDS 0x80000000L // Don't write HW & Compat IDs on install + + +// +// SP_DEVINSTALL_PARAMS.FlagsEx values +// +#define DI_FLAGSEX_USEOLDINFSEARCH 0x00000001L // Inf Search functions should not use Index Search +#define DI_FLAGSEX_AUTOSELECTRANK0 0x00000002L // SetupDiSelectDevice doesn't prompt user if rank 0 match +#define DI_FLAGSEX_CI_FAILED 0x00000004L // Failed to Load/Call class installer + +#define DI_FLAGSEX_DIDINFOLIST 0x00000010L // Did the Class Info List +#define DI_FLAGSEX_DIDCOMPATINFO 0x00000020L // Did the Compat Info List + +#define DI_FLAGSEX_FILTERCLASSES 0x00000040L +#define DI_FLAGSEX_SETFAILEDINSTALL 0x00000080L +#define DI_FLAGSEX_DEVICECHANGE 0x00000100L +#define DI_FLAGSEX_ALWAYSWRITEIDS 0x00000200L +#define DI_FLAGSEX_PROPCHANGE_PENDING 0x00000400L // One or more device property sheets have had changes made + // to them, and need to have a DIF_PROPERTYCHANGE occur. +#define DI_FLAGSEX_ALLOWEXCLUDEDDRVS 0x00000800L +#define DI_FLAGSEX_NOUIONQUERYREMOVE 0x00001000L +#define DI_FLAGSEX_USECLASSFORCOMPAT 0x00002000L // Use the device's class when building compat drv list. + // (Ignored if DI_COMPAT_FROM_CLASS flag is specified.) +#define DI_FLAGSEX_OLDINF_IN_CLASSLIST 0x00004000L // Search legacy INFs when building class driver list. +#define DI_FLAGSEX_NO_DRVREG_MODIFY 0x00008000L // Don't run AddReg and DelReg for device's software (driver) key. +#define DI_FLAGSEX_IN_SYSTEM_SETUP 0x00010000L // Installation is occurring during initial system setup. +#define DI_FLAGSEX_INET_DRIVER 0x00020000L // Driver came from Windows Update +#define DI_FLAGSEX_APPENDDRIVERLIST 0x00040000L // Cause SetupDiBuildDriverInfoList to append + // a new driver list to an existing list. +#define DI_FLAGSEX_PREINSTALLBACKUP 0x00080000L // backup all files required by old inf before install +#define DI_FLAGSEX_BACKUPONREPLACE 0x00100000L // backup files required by old inf as they are replaced +#define DI_FLAGSEX_DRIVERLIST_FROM_URL 0x00200000L // build driver list from INF(s) retrieved from URL specified + // in SP_DEVINSTALL_PARAMS.DriverPath (empty string means + // Windows Update website) +#define DI_FLAGSEX_RESERVED1 0x00400000L +#define DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS 0x00800000L // Don't include old Internet drivers when building + // a driver list. +#define DI_FLAGSEX_POWERPAGE_ADDED 0x01000000L // class installer added their own power page + +// +// Class installation parameters header. This must be the first field of any +// class install parameter structure. The InstallFunction field must be set to +// the function code corresponding to the structure, and the cbSize field must +// be set to the size of the header structure. E.g., +// +// SP_ENABLECLASS_PARAMS EnableClassParams; +// +// EnableClassParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); +// EnableClassParams.ClassInstallHeader.InstallFunction = DIF_ENABLECLASS; +// +typedef struct _SP_CLASSINSTALL_HEADER { + DWORD cbSize; + DI_FUNCTION InstallFunction; +} SP_CLASSINSTALL_HEADER, *PSP_CLASSINSTALL_HEADER; + + +// +// Structure corresponding to a DIF_ENABLECLASS install function. +// +typedef struct _SP_ENABLECLASS_PARAMS { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + GUID ClassGuid; + DWORD EnableMessage; +} SP_ENABLECLASS_PARAMS, *PSP_ENABLECLASS_PARAMS; + +#define ENABLECLASS_QUERY 0 +#define ENABLECLASS_SUCCESS 1 +#define ENABLECLASS_FAILURE 2 + + +// +// Structure corresponding to a DIF_MOVEDEVICE install function. +// +typedef struct _SP_MOVEDEV_PARAMS { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + SP_DEVINFO_DATA SourceDeviceInfoData; +} SP_MOVEDEV_PARAMS, *PSP_MOVEDEV_PARAMS; + + +// +// Values indicating a change in a device's state +// +#define DICS_ENABLE 0x00000001 +#define DICS_DISABLE 0x00000002 +#define DICS_PROPCHANGE 0x00000003 +#define DICS_START 0x00000004 +#define DICS_STOP 0x00000005 +// +// Values specifying the scope of a device property change +// +#define DICS_FLAG_GLOBAL 0x00000001 // make change in all hardware profiles +#define DICS_FLAG_CONFIGSPECIFIC 0x00000002 // make change in specified profile only +#define DICS_FLAG_CONFIGGENERAL 0x00000004 // 1 or more hardware profile-specific + // changes to follow. +// +// Structure corresponding to a DIF_PROPERTYCHANGE install function. +// +typedef struct _SP_PROPCHANGE_PARAMS { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + DWORD StateChange; + DWORD Scope; + DWORD HwProfile; +} SP_PROPCHANGE_PARAMS, *PSP_PROPCHANGE_PARAMS; + + +// +// Structure corresponding to a DIF_REMOVE install function. +// +typedef struct _SP_REMOVEDEVICE_PARAMS { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + DWORD Scope; + DWORD HwProfile; +} SP_REMOVEDEVICE_PARAMS, *PSP_REMOVEDEVICE_PARAMS; + +#define DI_REMOVEDEVICE_GLOBAL 0x00000001 +#define DI_REMOVEDEVICE_CONFIGSPECIFIC 0x00000002 + + +// +// Structure corresponding to a DIF_UNREMOVE install function. +// +typedef struct _SP_UNREMOVEDEVICE_PARAMS { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + DWORD Scope; + DWORD HwProfile; +} SP_UNREMOVEDEVICE_PARAMS, *PSP_UNREMOVEDEVICE_PARAMS; + +#define DI_UNREMOVEDEVICE_CONFIGSPECIFIC 0x00000002 + + +// +// Structure corresponding to a DIF_SELECTDEVICE install function. +// +typedef struct _SP_SELECTDEVICE_PARAMS_A { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + CHAR Title[MAX_TITLE_LEN]; + CHAR Instructions[MAX_INSTRUCTION_LEN]; + CHAR ListLabel[MAX_LABEL_LEN]; + CHAR SubTitle[MAX_SUBTITLE_LEN]; + BYTE Reserved[2]; // DWORD size alignment +} SP_SELECTDEVICE_PARAMS_A, *PSP_SELECTDEVICE_PARAMS_A; + +typedef struct _SP_SELECTDEVICE_PARAMS_W { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + WCHAR Title[MAX_TITLE_LEN]; + WCHAR Instructions[MAX_INSTRUCTION_LEN]; + WCHAR ListLabel[MAX_LABEL_LEN]; + WCHAR SubTitle[MAX_SUBTITLE_LEN]; +} SP_SELECTDEVICE_PARAMS_W, *PSP_SELECTDEVICE_PARAMS_W; + +#ifdef UNICODE +typedef SP_SELECTDEVICE_PARAMS_W SP_SELECTDEVICE_PARAMS; +typedef PSP_SELECTDEVICE_PARAMS_W PSP_SELECTDEVICE_PARAMS; +#else +typedef SP_SELECTDEVICE_PARAMS_A SP_SELECTDEVICE_PARAMS; +typedef PSP_SELECTDEVICE_PARAMS_A PSP_SELECTDEVICE_PARAMS; +#endif + + +// +// Callback routine for giving progress notification during detection +// +typedef BOOL (CALLBACK* PDETECT_PROGRESS_NOTIFY)( + IN PVOID ProgressNotifyParam, + IN DWORD DetectComplete + ); + +// where: +// ProgressNotifyParam - value supplied by caller requesting detection. +// DetectComplete - Percent completion, to be incremented by class +// installer, as it steps thru its detection. +// +// Return Value - If TRUE, then detection is cancelled. Allows caller +// requesting detection to stop detection asap. +// + +// +// Structure corresponding to a DIF_DETECT install function. +// +typedef struct _SP_DETECTDEVICE_PARAMS { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + PDETECT_PROGRESS_NOTIFY DetectProgressNotify; + PVOID ProgressNotifyParam; +} SP_DETECTDEVICE_PARAMS, *PSP_DETECTDEVICE_PARAMS; + + +// +// 'Add New Device' installation wizard structure (backward-compatibility +// only--respond to DIF_NEWDEVICEWIZARD_* requests instead). +// +// Structure corresponding to a DIF_INSTALLWIZARD install function. +// (NOTE: This structure is also applicable for DIF_DESTROYWIZARDDATA, +// but DIF_INSTALLWIZARD is the associated function code in the class +// installation parameter structure in both cases.) +// +// Define maximum number of dynamic wizard pages that can be added to +// hardware install wizard. +// +#define MAX_INSTALLWIZARD_DYNAPAGES 20 + +typedef struct _SP_INSTALLWIZARD_DATA { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + DWORD Flags; + HPROPSHEETPAGE DynamicPages[MAX_INSTALLWIZARD_DYNAPAGES]; + DWORD NumDynamicPages; + DWORD DynamicPageFlags; + DWORD PrivateFlags; + LPARAM PrivateData; + HWND hwndWizardDlg; +} SP_INSTALLWIZARD_DATA, *PSP_INSTALLWIZARD_DATA; + +// +// SP_INSTALLWIZARD_DATA.Flags values +// +#define NDW_INSTALLFLAG_DIDFACTDEFS 0x00000001 +#define NDW_INSTALLFLAG_HARDWAREALLREADYIN 0x00000002 +#define NDW_INSTALLFLAG_NEEDRESTART DI_NEEDRESTART +#define NDW_INSTALLFLAG_NEEDREBOOT DI_NEEDREBOOT +#define NDW_INSTALLFLAG_NEEDSHUTDOWN 0x00000200 +#define NDW_INSTALLFLAG_EXPRESSINTRO 0x00000400 +#define NDW_INSTALLFLAG_SKIPISDEVINSTALLED 0x00000800 +#define NDW_INSTALLFLAG_NODETECTEDDEVS 0x00001000 +#define NDW_INSTALLFLAG_INSTALLSPECIFIC 0x00002000 +#define NDW_INSTALLFLAG_SKIPCLASSLIST 0x00004000 +#define NDW_INSTALLFLAG_CI_PICKED_OEM 0x00008000 +#define NDW_INSTALLFLAG_PCMCIAMODE 0x00010000 +#define NDW_INSTALLFLAG_PCMCIADEVICE 0x00020000 +#define NDW_INSTALLFLAG_USERCANCEL 0x00040000 +#define NDW_INSTALLFLAG_KNOWNCLASS 0x00080000 + + +// +// SP_INSTALLWIZARD_DATA.DynamicPageFlags values +// +// This flag is set if a Class installer has added pages to the install wizard. +// +#define DYNAWIZ_FLAG_PAGESADDED 0x00000001 + +// +// Set this flag if you jump to the analyze page, and want it to +// handle conflicts for you. NOTE. You will not get control back +// in the event of a conflict if you set this flag. +// +#define DYNAWIZ_FLAG_ANALYZE_HANDLECONFLICT 0x00000008 + +// +// The following flags are not used by the Windows NT hardware wizard. +// +#define DYNAWIZ_FLAG_INSTALLDET_NEXT 0x00000002 +#define DYNAWIZ_FLAG_INSTALLDET_PREV 0x00000004 + + +// +// Reserve a range of wizard page resource IDs for internal use. Some of +// these IDs are for use by class installers that respond to the obsolete +// DIF_INSTALLWIZARD/DIF_DESTROYWIZARDDATA messages. These IDs are listed +// below. +// +#define MIN_IDD_DYNAWIZ_RESOURCE_ID 10000 +#define MAX_IDD_DYNAWIZ_RESOURCE_ID 11000 + +// +// Define wizard page resource IDs to be used when adding custom pages to the +// hardware install wizard via DIF_INSTALLWIZARD. Pages marked with +// (CLASS INSTALLER PROVIDED) _must_ be supplied by the class installer if it +// responds to the DIF_INSTALLWIZARD request. +// + +// +// Resource ID for the first page that the install wizard will go to after +// adding the class installer pages. (CLASS INSTALLER PROVIDED) +// +#define IDD_DYNAWIZ_FIRSTPAGE 10000 + +// +// Resource ID for the page that the Select Device page will go back to. +// (CLASS INSTALLER PROVIDED) +// +#define IDD_DYNAWIZ_SELECT_PREVPAGE 10001 + +// +// Resource ID for the page that the Select Device page will go forward to. +// (CLASS INSTALLER PROVIDED) +// +#define IDD_DYNAWIZ_SELECT_NEXTPAGE 10002 + +// +// Resource ID for the page that the Analyze dialog should go back to +// This will only be used in the event that there is a problem, and the user +// selects Back from the analyze proc. (CLASS INSTALLER PROVIDED) +// +#define IDD_DYNAWIZ_ANALYZE_PREVPAGE 10003 + +// +// Resource ID for the page that the Analyze dialog should go to if it +// continues from the analyze proc. (CLASS INSTALLER PROVIDED) +// +#define IDD_DYNAWIZ_ANALYZE_NEXTPAGE 10004 + +// +// Resource ID of the hardware install wizard's select device page. +// This ID can be used to go directly to the hardware install wizard's select +// device page. (This is the resource ID of the Select Device wizard page +// retrieved via SetupDiGetWizardPage when SPWPT_SELECTDEVICE is the requested +// PageType.) +// +#define IDD_DYNAWIZ_SELECTDEV_PAGE 10009 + +// +// Resource ID of the hardware install wizard's device analysis page. +// This ID can be use to go directly to the hardware install wizard's analysis +// page. +// +#define IDD_DYNAWIZ_ANALYZEDEV_PAGE 10010 + +// +// Resource ID of the hardware install wizard's install detected devices page. +// This ID can be use to go directly to the hardware install wizard's install +// detected devices page. +// +#define IDD_DYNAWIZ_INSTALLDETECTEDDEVS_PAGE 10011 + +// +// Resource ID of the hardware install wizard's select class page. +// This ID can be use to go directly to the hardware install wizard's select +// class page. +// +#define IDD_DYNAWIZ_SELECTCLASS_PAGE 10012 + +// +// The following class installer-provided wizard page resource IDs are not used +// by the Windows NT hardware wizard. +// +#define IDD_DYNAWIZ_INSTALLDETECTED_PREVPAGE 10006 +#define IDD_DYNAWIZ_INSTALLDETECTED_NEXTPAGE 10007 +#define IDD_DYNAWIZ_INSTALLDETECTED_NODEVS 10008 + + +// +// Structure corresponding to the following DIF_NEWDEVICEWIZARD_* install +// functions: +// +// DIF_NEWDEVICEWIZARD_PRESELECT +// DIF_NEWDEVICEWIZARD_SELECT +// DIF_NEWDEVICEWIZARD_PREANALYZE +// DIF_NEWDEVICEWIZARD_POSTANALYZE +// DIF_NEWDEVICEWIZARD_FINISHINSTALL +// +typedef struct _SP_NEWDEVICEWIZARD_DATA { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + DWORD Flags; // presently unused--must be zero. + HPROPSHEETPAGE DynamicPages[MAX_INSTALLWIZARD_DYNAPAGES]; + DWORD NumDynamicPages; + HWND hwndWizardDlg; +} SP_NEWDEVICEWIZARD_DATA, *PSP_NEWDEVICEWIZARD_DATA; + + +typedef SP_NEWDEVICEWIZARD_DATA SP_ADDPROPERTYPAGE_DATA; +typedef PSP_NEWDEVICEWIZARD_DATA PSP_ADDPROPERTYPAGE_DATA; + + +// +// Structure corresponding to the DIF_TROUBLESHOOTER install function +// +typedef struct _SP_TROUBLESHOOTER_PARAMS_A { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + CHAR ChmFile[MAX_PATH]; + CHAR HtmlTroubleShooter[MAX_PATH]; +} SP_TROUBLESHOOTER_PARAMS_A, *PSP_TROUBLESHOOTER_PARAMS_A; + +typedef struct _SP_TROUBLESHOOTER_PARAMS_W { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + WCHAR ChmFile[MAX_PATH]; + WCHAR HtmlTroubleShooter[MAX_PATH]; +} SP_TROUBLESHOOTER_PARAMS_W, *PSP_TROUBLESHOOTER_PARAMS_W; + +#ifdef UNICODE +typedef SP_TROUBLESHOOTER_PARAMS_W SP_TROUBLESHOOTER_PARAMS; +typedef PSP_TROUBLESHOOTER_PARAMS_W PSP_TROUBLESHOOTER_PARAMS; +#else +typedef SP_TROUBLESHOOTER_PARAMS_A SP_TROUBLESHOOTER_PARAMS; +typedef PSP_TROUBLESHOOTER_PARAMS_A PSP_TROUBLESHOOTER_PARAMS; +#endif + + +// +// Structure corresponding to the DIF_POWERMESSAGEWAKE install function +// +typedef struct _SP_POWERMESSAGEWAKE_PARAMS_A { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + CHAR PowerMessageWake[LINE_LEN*2]; +} SP_POWERMESSAGEWAKE_PARAMS_A, *PSP_POWERMESSAGEWAKE_PARAMS_A; + +typedef struct _SP_POWERMESSAGEWAKE_PARAMS_W { + SP_CLASSINSTALL_HEADER ClassInstallHeader; + WCHAR PowerMessageWake[LINE_LEN*2]; +} SP_POWERMESSAGEWAKE_PARAMS_W, *PSP_POWERMESSAGEWAKE_PARAMS_W; + +#ifdef UNICODE +typedef SP_POWERMESSAGEWAKE_PARAMS_W SP_POWERMESSAGEWAKE_PARAMS; +typedef PSP_POWERMESSAGEWAKE_PARAMS_W PSP_POWERMESSAGEWAKE_PARAMS; +#else +typedef SP_POWERMESSAGEWAKE_PARAMS_A SP_POWERMESSAGEWAKE_PARAMS; +typedef PSP_POWERMESSAGEWAKE_PARAMS_A PSP_POWERMESSAGEWAKE_PARAMS; +#endif + + +// +// Driver information structure (member of a driver info list that may be associated +// with a particular device instance, or (globally) with a device information set) +// +typedef struct _SP_DRVINFO_DATA_V2_A { + DWORD cbSize; + DWORD DriverType; + ULONG_PTR Reserved; + CHAR Description[LINE_LEN]; + CHAR MfgName[LINE_LEN]; + CHAR ProviderName[LINE_LEN]; + FILETIME DriverDate; + DWORDLONG DriverVersion; +} SP_DRVINFO_DATA_V2_A, *PSP_DRVINFO_DATA_V2_A; + +typedef struct _SP_DRVINFO_DATA_V2_W { + DWORD cbSize; + DWORD DriverType; + ULONG_PTR Reserved; + WCHAR Description[LINE_LEN]; + WCHAR MfgName[LINE_LEN]; + WCHAR ProviderName[LINE_LEN]; + FILETIME DriverDate; + DWORDLONG DriverVersion; +} SP_DRVINFO_DATA_V2_W, *PSP_DRVINFO_DATA_V2_W; + +// +// Version 1 of the SP_DRVINFO_DATA structures, used only for compatibility +// with Windows NT 4.0/Windows 95/98 SETUPAPI.DLL +// +typedef struct _SP_DRVINFO_DATA_V1_A { + DWORD cbSize; + DWORD DriverType; + ULONG_PTR Reserved; + CHAR Description[LINE_LEN]; + CHAR MfgName[LINE_LEN]; + CHAR ProviderName[LINE_LEN]; +} SP_DRVINFO_DATA_V1_A, *PSP_DRVINFO_DATA_V1_A; + +typedef struct _SP_DRVINFO_DATA_V1_W { + DWORD cbSize; + DWORD DriverType; + ULONG_PTR Reserved; + WCHAR Description[LINE_LEN]; + WCHAR MfgName[LINE_LEN]; + WCHAR ProviderName[LINE_LEN]; +} SP_DRVINFO_DATA_V1_W, *PSP_DRVINFO_DATA_V1_W; + +#ifdef UNICODE +typedef SP_DRVINFO_DATA_V1_W SP_DRVINFO_DATA_V1; +typedef PSP_DRVINFO_DATA_V1_W PSP_DRVINFO_DATA_V1; +typedef SP_DRVINFO_DATA_V2_W SP_DRVINFO_DATA_V2; +typedef PSP_DRVINFO_DATA_V2_W PSP_DRVINFO_DATA_V2; +#else +typedef SP_DRVINFO_DATA_V1_A SP_DRVINFO_DATA_V1; +typedef PSP_DRVINFO_DATA_V1_A PSP_DRVINFO_DATA_V1; +typedef SP_DRVINFO_DATA_V2_A SP_DRVINFO_DATA_V2; +typedef PSP_DRVINFO_DATA_V2_A PSP_DRVINFO_DATA_V2; +#endif + +#if USE_SP_DRVINFO_DATA_V1 // use version 1 driver info data structure + +typedef SP_DRVINFO_DATA_V1_A SP_DRVINFO_DATA_A; +typedef PSP_DRVINFO_DATA_V1_A PSP_DRVINFO_DATA_A; +typedef SP_DRVINFO_DATA_V1_W SP_DRVINFO_DATA_W; +typedef PSP_DRVINFO_DATA_V1_W PSP_DRVINFO_DATA_W; +typedef SP_DRVINFO_DATA_V1 SP_DRVINFO_DATA; +typedef PSP_DRVINFO_DATA_V1 PSP_DRVINFO_DATA; + +#else // use version 2 driver info data structure + +typedef SP_DRVINFO_DATA_V2_A SP_DRVINFO_DATA_A; +typedef PSP_DRVINFO_DATA_V2_A PSP_DRVINFO_DATA_A; +typedef SP_DRVINFO_DATA_V2_W SP_DRVINFO_DATA_W; +typedef PSP_DRVINFO_DATA_V2_W PSP_DRVINFO_DATA_W; +typedef SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA; +typedef PSP_DRVINFO_DATA_V2 PSP_DRVINFO_DATA; + +#endif // use current version of driver info data structure + +// +// Driver information details structure (provides detailed information about a +// particular driver information structure) +// +typedef struct _SP_DRVINFO_DETAIL_DATA_A { + DWORD cbSize; + FILETIME InfDate; + DWORD CompatIDsOffset; + DWORD CompatIDsLength; + ULONG_PTR Reserved; + CHAR SectionName[LINE_LEN]; + CHAR InfFileName[MAX_PATH]; + CHAR DrvDescription[LINE_LEN]; + CHAR HardwareID[ANYSIZE_ARRAY]; +} SP_DRVINFO_DETAIL_DATA_A, *PSP_DRVINFO_DETAIL_DATA_A; + +typedef struct _SP_DRVINFO_DETAIL_DATA_W { + DWORD cbSize; + FILETIME InfDate; + DWORD CompatIDsOffset; + DWORD CompatIDsLength; + ULONG_PTR Reserved; + WCHAR SectionName[LINE_LEN]; + WCHAR InfFileName[MAX_PATH]; + WCHAR DrvDescription[LINE_LEN]; + WCHAR HardwareID[ANYSIZE_ARRAY]; +} SP_DRVINFO_DETAIL_DATA_W, *PSP_DRVINFO_DETAIL_DATA_W; + +#ifdef UNICODE +typedef SP_DRVINFO_DETAIL_DATA_W SP_DRVINFO_DETAIL_DATA; +typedef PSP_DRVINFO_DETAIL_DATA_W PSP_DRVINFO_DETAIL_DATA; +#else +typedef SP_DRVINFO_DETAIL_DATA_A SP_DRVINFO_DETAIL_DATA; +typedef PSP_DRVINFO_DETAIL_DATA_A PSP_DRVINFO_DETAIL_DATA; +#endif + + +// +// Driver installation parameters (associated with a particular driver +// information element) +// +typedef struct _SP_DRVINSTALL_PARAMS { + DWORD cbSize; + DWORD Rank; + DWORD Flags; + DWORD_PTR PrivateData; + DWORD Reserved; +} SP_DRVINSTALL_PARAMS, *PSP_DRVINSTALL_PARAMS; + +// +// SP_DRVINSTALL_PARAMS.Flags values +// +#define DNF_DUPDESC 0x00000001 // Multiple providers have same desc +#define DNF_OLDDRIVER 0x00000002 // Driver node specifies old/current driver +#define DNF_EXCLUDEFROMLIST 0x00000004 // If set, this driver node will not be + // displayed in any driver select dialogs. +#define DNF_NODRIVER 0x00000008 // if we want to install no driver + // (e.g no mouse drv) +#define DNF_LEGACYINF 0x00000010 // this driver node comes from an old-style INF +#define DNF_CLASS_DRIVER 0x00000020 // Driver node represents a class driver +#define DNF_COMPATIBLE_DRIVER 0x00000040 // Driver node represents a compatible driver +#define DNF_INET_DRIVER 0x00000080 // Driver comes from an internet source +#define DNF_UNUSED1 0x00000100 +#define DNF_INDEXED_DRIVER 0x00000200 // Driver is contained in the Windows Driver Index +#define DNF_OLD_INET_DRIVER 0x00000400 // Driver came from the Internet, but we don't currently + // have access to it's source files. Never attempt to + // install a driver with this flag! +#define DNF_BAD_DRIVER 0x00000800 // Driver node should not be used at all +#define DNF_DUPPROVIDER 0x00001000 // Multiple drivers have the same provider and desc + +// +//Rank values (the lower the Rank number, the better the Rank) +// +#define DRIVER_HARDWAREID_RANK 0x00000FFF // Any rank less than or equal to + // this value is a HardwareID match + +// +// Setup callback routine for comparing detection signatures +// +typedef DWORD (CALLBACK* PSP_DETSIG_CMPPROC)( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA NewDeviceData, + IN PSP_DEVINFO_DATA ExistingDeviceData, + IN PVOID CompareContext OPTIONAL + ); + + +// +// Define context structure handed to co-installers +// +typedef struct _COINSTALLER_CONTEXT_DATA { + BOOL PostProcessing; + DWORD InstallResult; + PVOID PrivateData; +} COINSTALLER_CONTEXT_DATA, *PCOINSTALLER_CONTEXT_DATA; + + +// +// Structure containing class image list information. +// +typedef struct _SP_CLASSIMAGELIST_DATA { + DWORD cbSize; + HIMAGELIST ImageList; + ULONG_PTR Reserved; +} SP_CLASSIMAGELIST_DATA, *PSP_CLASSIMAGELIST_DATA; + + +// +// Structure to be passed as first parameter (LPVOID lpv) to ExtensionPropSheetPageProc +// entry point in setupapi.dll or to "EnumPropPages32" or "BasicProperties32" entry +// points provided by class/device property page providers. Used to retrieve a handle +// (or, potentially, multiple handles) to property pages for a specified property page type. +// +typedef struct _SP_PROPSHEETPAGE_REQUEST { + DWORD cbSize; + DWORD PageRequested; + HDEVINFO DeviceInfoSet; + PSP_DEVINFO_DATA DeviceInfoData; +} SP_PROPSHEETPAGE_REQUEST, *PSP_PROPSHEETPAGE_REQUEST; + +// +// Property sheet codes used in SP_PROPSHEETPAGE_REQUEST.PageRequested +// +#define SPPSR_SELECT_DEVICE_RESOURCES 1 // supplied by setupapi.dll +#define SPPSR_ENUM_BASIC_DEVICE_PROPERTIES 2 // supplied by device's BasicProperties32 provider +#define SPPSR_ENUM_ADV_DEVICE_PROPERTIES 3 // supplied by class and/or device's EnumPropPages32 provider + + +// +// Structure used with SetupGetBackupQueue +// +typedef struct _SP_BACKUP_QUEUE_PARAMS_A { + DWORD cbSize; + CHAR FullInfPath[MAX_PATH]; // buffer to hold ANSI pathname of INF file + INT FilenameOffset; // offset in CHAR's of filename part (after '\') +} SP_BACKUP_QUEUE_PARAMS_A, *PSP_BACKUP_QUEUE_PARAMS_A; + +typedef struct _SP_BACKUP_QUEUE_PARAMS_W { + DWORD cbSize; + WCHAR FullInfPath[MAX_PATH]; // buffer to hold UNICODE pathname of INF file + INT FilenameOffset; // offset in WCHAR's of filename part (after '\') +} SP_BACKUP_QUEUE_PARAMS_W, *PSP_BACKUP_QUEUE_PARAMS_W; + +#ifdef UNICODE +typedef SP_BACKUP_QUEUE_PARAMS_W SP_BACKUP_QUEUE_PARAMS; +typedef PSP_BACKUP_QUEUE_PARAMS_W PSP_BACKUP_QUEUE_PARAMS; +#else +typedef SP_BACKUP_QUEUE_PARAMS_A SP_BACKUP_QUEUE_PARAMS; +typedef PSP_BACKUP_QUEUE_PARAMS_A PSP_BACKUP_QUEUE_PARAMS; +#endif + +// +// Setupapi-specific error codes +// +// Inf parse outcomes +// +#define ERROR_EXPECTED_SECTION_NAME (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0) +#define ERROR_BAD_SECTION_NAME_LINE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|1) +#define ERROR_SECTION_NAME_TOO_LONG (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|2) +#define ERROR_GENERAL_SYNTAX (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|3) +// +// Inf runtime errors +// +#define ERROR_WRONG_INF_STYLE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x100) +#define ERROR_SECTION_NOT_FOUND (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x101) +#define ERROR_LINE_NOT_FOUND (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x102) +#define ERROR_NO_BACKUP (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x103) +// +// Device Installer/other errors +// +#define ERROR_NO_ASSOCIATED_CLASS (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x200) +#define ERROR_CLASS_MISMATCH (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x201) +#define ERROR_DUPLICATE_FOUND (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x202) +#define ERROR_NO_DRIVER_SELECTED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x203) +#define ERROR_KEY_DOES_NOT_EXIST (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x204) +#define ERROR_INVALID_DEVINST_NAME (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x205) +#define ERROR_INVALID_CLASS (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x206) +#define ERROR_DEVINST_ALREADY_EXISTS (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x207) +#define ERROR_DEVINFO_NOT_REGISTERED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x208) +#define ERROR_INVALID_REG_PROPERTY (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x209) +#define ERROR_NO_INF (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x20A) +#define ERROR_NO_SUCH_DEVINST (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x20B) +#define ERROR_CANT_LOAD_CLASS_ICON (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x20C) +#define ERROR_INVALID_CLASS_INSTALLER (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x20D) +#define ERROR_DI_DO_DEFAULT (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x20E) +#define ERROR_DI_NOFILECOPY (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x20F) +#define ERROR_INVALID_HWPROFILE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x210) +#define ERROR_NO_DEVICE_SELECTED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x211) +#define ERROR_DEVINFO_LIST_LOCKED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x212) +#define ERROR_DEVINFO_DATA_LOCKED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x213) +#define ERROR_DI_BAD_PATH (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x214) +#define ERROR_NO_CLASSINSTALL_PARAMS (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x215) +#define ERROR_FILEQUEUE_LOCKED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x216) +#define ERROR_BAD_SERVICE_INSTALLSECT (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x217) +#define ERROR_NO_CLASS_DRIVER_LIST (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x218) +#define ERROR_NO_ASSOCIATED_SERVICE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x219) +#define ERROR_NO_DEFAULT_DEVICE_INTERFACE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x21A) +#define ERROR_DEVICE_INTERFACE_ACTIVE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x21B) +#define ERROR_DEVICE_INTERFACE_REMOVED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x21C) +#define ERROR_BAD_INTERFACE_INSTALLSECT (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x21D) +#define ERROR_NO_SUCH_INTERFACE_CLASS (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x21E) +#define ERROR_INVALID_REFERENCE_STRING (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x21F) +#define ERROR_INVALID_MACHINENAME (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x220) +#define ERROR_REMOTE_COMM_FAILURE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x221) +#define ERROR_MACHINE_UNAVAILABLE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x222) +#define ERROR_NO_CONFIGMGR_SERVICES (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x223) +#define ERROR_INVALID_PROPPAGE_PROVIDER (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x224) +#define ERROR_NO_SUCH_DEVICE_INTERFACE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x225) +#define ERROR_DI_POSTPROCESSING_REQUIRED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x226) +#define ERROR_INVALID_COINSTALLER (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x227) +#define ERROR_NO_COMPAT_DRIVERS (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x228) +#define ERROR_NO_DEVICE_ICON (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x229) +#define ERROR_INVALID_INF_LOGCONFIG (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x22A) +#define ERROR_DI_DONT_INSTALL (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x22B) +#define ERROR_INVALID_FILTER_DRIVER (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x22C) +#define ERROR_NON_WINDOWS_NT_DRIVER (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x22D) +#define ERROR_NON_WINDOWS_DRIVER (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x22E) +#define ERROR_NO_CATALOG_FOR_OEM_INF (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x22F) +#define ERROR_DEVINSTALL_QUEUE_NONNATIVE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x230) +#define ERROR_NOT_DISABLEABLE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x231) +#define ERROR_CANT_REMOVE_DEVINST (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x232) + +// +// Backward compatibility--do not use. +// +#define ERROR_NO_DEFAULT_INTERFACE_DEVICE ERROR_NO_DEFAULT_DEVICE_INTERFACE +#define ERROR_INTERFACE_DEVICE_ACTIVE ERROR_DEVICE_INTERFACE_ACTIVE +#define ERROR_INTERFACE_DEVICE_REMOVED ERROR_DEVICE_INTERFACE_REMOVED +#define ERROR_NO_SUCH_INTERFACE_DEVICE ERROR_NO_SUCH_DEVICE_INTERFACE + + +// +// Win9x migration DLL error code +// +#define ERROR_NOT_INSTALLED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x1000) + + +WINSETUPAPI +BOOL +WINAPI +SetupGetInfInformationA( + IN LPCVOID InfSpec, + IN DWORD SearchControl, + OUT PSP_INF_INFORMATION ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetInfInformationW( + IN LPCVOID InfSpec, + IN DWORD SearchControl, + OUT PSP_INF_INFORMATION ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +// +// SearchControl flags for SetupGetInfInformation +// +#define INFINFO_INF_SPEC_IS_HINF 1 +#define INFINFO_INF_NAME_IS_ABSOLUTE 2 +#define INFINFO_DEFAULT_SEARCH 3 +#define INFINFO_REVERSE_DEFAULT_SEARCH 4 +#define INFINFO_INF_PATH_LIST_SEARCH 5 + +#ifdef UNICODE +#define SetupGetInfInformation SetupGetInfInformationW +#else +#define SetupGetInfInformation SetupGetInfInformationA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueryInfFileInformationA( + IN PSP_INF_INFORMATION InfInformation, + IN UINT InfIndex, + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueryInfFileInformationW( + IN PSP_INF_INFORMATION InfInformation, + IN UINT InfIndex, + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupQueryInfFileInformation SetupQueryInfFileInformationW +#else +#define SetupQueryInfFileInformation SetupQueryInfFileInformationA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueryInfOriginalFileInformationA( + IN PSP_INF_INFORMATION InfInformation, + IN UINT InfIndex, + IN PSP_ALTPLATFORM_INFO AlternatePlatformInfo, OPTIONAL + OUT PSP_ORIGINAL_FILE_INFO_A OriginalFileInfo + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueryInfOriginalFileInformationW( + IN PSP_INF_INFORMATION InfInformation, + IN UINT InfIndex, + IN PSP_ALTPLATFORM_INFO AlternatePlatformInfo, OPTIONAL + OUT PSP_ORIGINAL_FILE_INFO_W OriginalFileInfo + ); + +#ifdef UNICODE +#define SetupQueryInfOriginalFileInformation SetupQueryInfOriginalFileInformationW +#else +#define SetupQueryInfOriginalFileInformation SetupQueryInfOriginalFileInformationA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueryInfVersionInformationA( + IN PSP_INF_INFORMATION InfInformation, + IN UINT InfIndex, + IN PCSTR Key, OPTIONAL + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueryInfVersionInformationW( + IN PSP_INF_INFORMATION InfInformation, + IN UINT InfIndex, + IN PCWSTR Key, OPTIONAL + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupQueryInfVersionInformation SetupQueryInfVersionInformationW +#else +#define SetupQueryInfVersionInformation SetupQueryInfVersionInformationA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupGetInfFileListA( + IN PCSTR DirectoryPath, OPTIONAL + IN DWORD InfStyle, + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetInfFileListW( + IN PCWSTR DirectoryPath, OPTIONAL + IN DWORD InfStyle, + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupGetInfFileList SetupGetInfFileListW +#else +#define SetupGetInfFileList SetupGetInfFileListA +#endif + + +WINSETUPAPI +HINF +WINAPI +SetupOpenInfFileW( + IN PCWSTR FileName, + IN PCWSTR InfClass, OPTIONAL + IN DWORD InfStyle, + OUT PUINT ErrorLine OPTIONAL + ); + +WINSETUPAPI +HINF +WINAPI +SetupOpenInfFileA( + IN PCSTR FileName, + IN PCSTR InfClass, OPTIONAL + IN DWORD InfStyle, + OUT PUINT ErrorLine OPTIONAL + ); + +#ifdef UNICODE +#define SetupOpenInfFile SetupOpenInfFileW +#else +#define SetupOpenInfFile SetupOpenInfFileA +#endif + + +WINSETUPAPI +HINF +WINAPI +SetupOpenMasterInf( + VOID + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupOpenAppendInfFileW( + IN PCWSTR FileName, OPTIONAL + IN HINF InfHandle, + OUT PUINT ErrorLine OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupOpenAppendInfFileA( + IN PCSTR FileName, OPTIONAL + IN HINF InfHandle, + OUT PUINT ErrorLine OPTIONAL + ); + +#ifdef UNICODE +#define SetupOpenAppendInfFile SetupOpenAppendInfFileW +#else +#define SetupOpenAppendInfFile SetupOpenAppendInfFileA +#endif + + +WINSETUPAPI +VOID +WINAPI +SetupCloseInfFile( + IN HINF InfHandle + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupFindFirstLineA( + IN HINF InfHandle, + IN PCSTR Section, + IN PCSTR Key, OPTIONAL + OUT PINFCONTEXT Context + ); + +WINSETUPAPI +BOOL +WINAPI +SetupFindFirstLineW( + IN HINF InfHandle, + IN PCWSTR Section, + IN PCWSTR Key, OPTIONAL + OUT PINFCONTEXT Context + ); + +#ifdef UNICODE +#define SetupFindFirstLine SetupFindFirstLineW +#else +#define SetupFindFirstLine SetupFindFirstLineA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupFindNextLine( + IN PINFCONTEXT ContextIn, + OUT PINFCONTEXT ContextOut + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupFindNextMatchLineA( + IN PINFCONTEXT ContextIn, + IN PCSTR Key, OPTIONAL + OUT PINFCONTEXT ContextOut + ); + +WINSETUPAPI +BOOL +WINAPI +SetupFindNextMatchLineW( + IN PINFCONTEXT ContextIn, + IN PCWSTR Key, OPTIONAL + OUT PINFCONTEXT ContextOut + ); + +#ifdef UNICODE +#define SetupFindNextMatchLine SetupFindNextMatchLineW +#else +#define SetupFindNextMatchLine SetupFindNextMatchLineA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupGetLineByIndexA( + IN HINF InfHandle, + IN PCSTR Section, + IN DWORD Index, + OUT PINFCONTEXT Context + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetLineByIndexW( + IN HINF InfHandle, + IN PCWSTR Section, + IN DWORD Index, + OUT PINFCONTEXT Context + ); + +#ifdef UNICODE +#define SetupGetLineByIndex SetupGetLineByIndexW +#else +#define SetupGetLineByIndex SetupGetLineByIndexA +#endif + + +WINSETUPAPI +LONG +WINAPI +SetupGetLineCountA( + IN HINF InfHandle, + IN PCSTR Section + ); + +WINSETUPAPI +LONG +WINAPI +SetupGetLineCountW( + IN HINF InfHandle, + IN PCWSTR Section + ); + +#ifdef UNICODE +#define SetupGetLineCount SetupGetLineCountW +#else +#define SetupGetLineCount SetupGetLineCountA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupGetLineTextA( + IN PINFCONTEXT Context, OPTIONAL + IN HINF InfHandle, OPTIONAL + IN PCSTR Section, OPTIONAL + IN PCSTR Key, OPTIONAL + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetLineTextW( + IN PINFCONTEXT Context, OPTIONAL + IN HINF InfHandle, OPTIONAL + IN PCWSTR Section, OPTIONAL + IN PCWSTR Key, OPTIONAL + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupGetLineText SetupGetLineTextW +#else +#define SetupGetLineText SetupGetLineTextA +#endif + + +WINSETUPAPI +DWORD +WINAPI +SetupGetFieldCount( + IN PINFCONTEXT Context + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupGetStringFieldA( + IN PINFCONTEXT Context, + IN DWORD FieldIndex, + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetStringFieldW( + IN PINFCONTEXT Context, + IN DWORD FieldIndex, + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupGetStringField SetupGetStringFieldW +#else +#define SetupGetStringField SetupGetStringFieldA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupGetIntField( + IN PINFCONTEXT Context, + IN DWORD FieldIndex, + OUT PINT IntegerValue + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupGetMultiSzFieldA( + IN PINFCONTEXT Context, + IN DWORD FieldIndex, + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT LPDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetMultiSzFieldW( + IN PINFCONTEXT Context, + IN DWORD FieldIndex, + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT LPDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupGetMultiSzField SetupGetMultiSzFieldW +#else +#define SetupGetMultiSzField SetupGetMultiSzFieldA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupGetBinaryField( + IN PINFCONTEXT Context, + IN DWORD FieldIndex, + OUT PBYTE ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT LPDWORD RequiredSize OPTIONAL + ); + + +WINSETUPAPI +DWORD +WINAPI +SetupGetFileCompressionInfoA( + IN PCSTR SourceFileName, + OUT PSTR *ActualSourceFileName, + OUT PDWORD SourceFileSize, + OUT PDWORD TargetFileSize, + OUT PUINT CompressionType + ); + +WINSETUPAPI +DWORD +WINAPI +SetupGetFileCompressionInfoW( + IN PCWSTR SourceFileName, + OUT PWSTR *ActualSourceFileName, + OUT PDWORD SourceFileSize, + OUT PDWORD TargetFileSize, + OUT PUINT CompressionType + ); + +#ifdef UNICODE +#define SetupGetFileCompressionInfo SetupGetFileCompressionInfoW +#else +#define SetupGetFileCompressionInfo SetupGetFileCompressionInfoA +#endif + + +// +// Compression types +// +#define FILE_COMPRESSION_NONE 0 +#define FILE_COMPRESSION_WINLZA 1 +#define FILE_COMPRESSION_MSZIP 2 +#define FILE_COMPRESSION_NTCAB 3 + + +WINSETUPAPI +DWORD +WINAPI +SetupDecompressOrCopyFileA( + IN PCSTR SourceFileName, + IN PCSTR TargetFileName, + IN PUINT CompressionType OPTIONAL + ); + +WINSETUPAPI +DWORD +WINAPI +SetupDecompressOrCopyFileW( + IN PCWSTR SourceFileName, + IN PCWSTR TargetFileName, + IN PUINT CompressionType OPTIONAL + ); + +#ifdef UNICODE +#define SetupDecompressOrCopyFile SetupDecompressOrCopyFileW +#else +#define SetupDecompressOrCopyFile SetupDecompressOrCopyFileA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupGetSourceFileLocationA( + IN HINF InfHandle, + IN PINFCONTEXT InfContext, OPTIONAL + IN PCSTR FileName, OPTIONAL + OUT PUINT SourceId, + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetSourceFileLocationW( + IN HINF InfHandle, + IN PINFCONTEXT InfContext, OPTIONAL + IN PCWSTR FileName, OPTIONAL + OUT PUINT SourceId, + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupGetSourceFileLocation SetupGetSourceFileLocationW +#else +#define SetupGetSourceFileLocation SetupGetSourceFileLocationA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupGetSourceFileSizeA( + IN HINF InfHandle, + IN PINFCONTEXT InfContext, OPTIONAL + IN PCSTR FileName, OPTIONAL + IN PCSTR Section, OPTIONAL + OUT PDWORD FileSize, + IN UINT RoundingFactor OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetSourceFileSizeW( + IN HINF InfHandle, + IN PINFCONTEXT InfContext, OPTIONAL + IN PCWSTR FileName, OPTIONAL + IN PCWSTR Section, OPTIONAL + OUT PDWORD FileSize, + IN UINT RoundingFactor OPTIONAL + ); + +#ifdef UNICODE +#define SetupGetSourceFileSize SetupGetSourceFileSizeW +#else +#define SetupGetSourceFileSize SetupGetSourceFileSizeA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupGetTargetPathA( + IN HINF InfHandle, + IN PINFCONTEXT InfContext, OPTIONAL + IN PCSTR Section, OPTIONAL + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetTargetPathW( + IN HINF InfHandle, + IN PINFCONTEXT InfContext, OPTIONAL + IN PCWSTR Section, OPTIONAL + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupGetTargetPath SetupGetTargetPathW +#else +#define SetupGetTargetPath SetupGetTargetPathA +#endif + + +// +// Define flags for SourceList APIs. +// +#define SRCLIST_TEMPORARY 0x00000001 +#define SRCLIST_NOBROWSE 0x00000002 +#define SRCLIST_SYSTEM 0x00000010 +#define SRCLIST_USER 0x00000020 +#define SRCLIST_SYSIFADMIN 0x00000040 +#define SRCLIST_SUBDIRS 0x00000100 +#define SRCLIST_APPEND 0x00000200 +#define SRCLIST_NOSTRIPPLATFORM 0x00000400 + + +WINSETUPAPI +BOOL +WINAPI +SetupSetSourceListA( + IN DWORD Flags, + IN PCSTR *SourceList, + IN UINT SourceCount + ); + +WINSETUPAPI +BOOL +WINAPI +SetupSetSourceListW( + IN DWORD Flags, + IN PCWSTR *SourceList, + IN UINT SourceCount + ); + +#ifdef UNICODE +#define SetupSetSourceList SetupSetSourceListW +#else +#define SetupSetSourceList SetupSetSourceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupCancelTemporarySourceList( + VOID + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupAddToSourceListA( + IN DWORD Flags, + IN PCSTR Source + ); + +WINSETUPAPI +BOOL +WINAPI +SetupAddToSourceListW( + IN DWORD Flags, + IN PCWSTR Source + ); + +#ifdef UNICODE +#define SetupAddToSourceList SetupAddToSourceListW +#else +#define SetupAddToSourceList SetupAddToSourceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveFromSourceListA( + IN DWORD Flags, + IN PCSTR Source + ); + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveFromSourceListW( + IN DWORD Flags, + IN PCWSTR Source + ); + +#ifdef UNICODE +#define SetupRemoveFromSourceList SetupRemoveFromSourceListW +#else +#define SetupRemoveFromSourceList SetupRemoveFromSourceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQuerySourceListA( + IN DWORD Flags, + OUT PCSTR **List, + OUT PUINT Count + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQuerySourceListW( + IN DWORD Flags, + OUT PCWSTR **List, + OUT PUINT Count + ); + +#ifdef UNICODE +#define SetupQuerySourceList SetupQuerySourceListW +#else +#define SetupQuerySourceList SetupQuerySourceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupFreeSourceListA( + IN OUT PCSTR **List, + IN UINT Count + ); + +WINSETUPAPI +BOOL +WINAPI +SetupFreeSourceListW( + IN OUT PCWSTR **List, + IN UINT Count + ); + +#ifdef UNICODE +#define SetupFreeSourceList SetupFreeSourceListW +#else +#define SetupFreeSourceList SetupFreeSourceListA +#endif + + +WINSETUPAPI +UINT +WINAPI +SetupPromptForDiskA( + IN HWND hwndParent, + IN PCSTR DialogTitle, OPTIONAL + IN PCSTR DiskName, OPTIONAL + IN PCSTR PathToSource, OPTIONAL + IN PCSTR FileSought, + IN PCSTR TagFile, OPTIONAL + IN DWORD DiskPromptStyle, + OUT PSTR PathBuffer, + IN DWORD PathBufferSize, + OUT PDWORD PathRequiredSize + ); + +WINSETUPAPI +UINT +WINAPI +SetupPromptForDiskW( + IN HWND hwndParent, + IN PCWSTR DialogTitle, OPTIONAL + IN PCWSTR DiskName, OPTIONAL + IN PCWSTR PathToSource, OPTIONAL + IN PCWSTR FileSought, + IN PCWSTR TagFile, OPTIONAL + IN DWORD DiskPromptStyle, + OUT PWSTR PathBuffer, + IN DWORD PathBufferSize, + OUT PDWORD PathRequiredSize + ); + +#ifdef UNICODE +#define SetupPromptForDisk SetupPromptForDiskW +#else +#define SetupPromptForDisk SetupPromptForDiskA +#endif + + +WINSETUPAPI +UINT +WINAPI +SetupCopyErrorA( + IN HWND hwndParent, + IN PCSTR DialogTitle, OPTIONAL + IN PCSTR DiskName, OPTIONAL + IN PCSTR PathToSource, + IN PCSTR SourceFile, + IN PCSTR TargetPathFile, OPTIONAL + IN UINT Win32ErrorCode, + IN DWORD Style, + OUT PSTR PathBuffer, OPTIONAL + IN DWORD PathBufferSize, + OUT PDWORD PathRequiredSize OPTIONAL + ); + +WINSETUPAPI +UINT +WINAPI +SetupCopyErrorW( + IN HWND hwndParent, + IN PCWSTR DialogTitle, OPTIONAL + IN PCWSTR DiskName, OPTIONAL + IN PCWSTR PathToSource, + IN PCWSTR SourceFile, + IN PCWSTR TargetPathFile, OPTIONAL + IN UINT Win32ErrorCode, + IN DWORD Style, + OUT PWSTR PathBuffer, OPTIONAL + IN DWORD PathBufferSize, + OUT PDWORD PathRequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupCopyError SetupCopyErrorW +#else +#define SetupCopyError SetupCopyErrorA +#endif + + +WINSETUPAPI +UINT +WINAPI +SetupRenameErrorA( + IN HWND hwndParent, + IN PCSTR DialogTitle, OPTIONAL + IN PCSTR SourceFile, + IN PCSTR TargetFile, + IN UINT Win32ErrorCode, + IN DWORD Style + ); + +WINSETUPAPI +UINT +WINAPI +SetupRenameErrorW( + IN HWND hwndParent, + IN PCWSTR DialogTitle, OPTIONAL + IN PCWSTR SourceFile, + IN PCWSTR TargetFile, + IN UINT Win32ErrorCode, + IN DWORD Style + ); + +#ifdef UNICODE +#define SetupRenameError SetupRenameErrorW +#else +#define SetupRenameError SetupRenameErrorA +#endif + + +WINSETUPAPI +UINT +WINAPI +SetupDeleteErrorA( + IN HWND hwndParent, + IN PCSTR DialogTitle, OPTIONAL + IN PCSTR File, + IN UINT Win32ErrorCode, + IN DWORD Style + ); + +WINSETUPAPI +UINT +WINAPI +SetupDeleteErrorW( + IN HWND hwndParent, + IN PCWSTR DialogTitle, OPTIONAL + IN PCWSTR File, + IN UINT Win32ErrorCode, + IN DWORD Style + ); + +#ifdef UNICODE +#define SetupDeleteError SetupDeleteErrorW +#else +#define SetupDeleteError SetupDeleteErrorA +#endif + +WINSETUPAPI +UINT +WINAPI +SetupBackupErrorA( + IN HWND hwndParent, + IN PCSTR DialogTitle, OPTIONAL + IN PCSTR BackupFile, + IN PCSTR TargetFile, + IN UINT Win32ErrorCode, + IN DWORD Style + ); + +WINSETUPAPI +UINT +WINAPI +SetupBackupErrorW( + IN HWND hwndParent, + IN PCWSTR DialogTitle, OPTIONAL + IN PCWSTR BackupFile, + IN PCWSTR TargetFile, + IN UINT Win32ErrorCode, + IN DWORD Style + ); + +#ifdef UNICODE +#define SetupBackupError SetupBackupErrorW +#else +#define SetupBackupError SetupBackupErrorA +#endif + + +// +// Styles for SetupPromptForDisk, SetupCopyError, +// SetupRenameError, SetupDeleteError +// +#define IDF_NOBROWSE 0x00000001 +#define IDF_NOSKIP 0x00000002 +#define IDF_NODETAILS 0x00000004 +#define IDF_NOCOMPRESSED 0x00000008 +#define IDF_CHECKFIRST 0x00000100 +#define IDF_NOBEEP 0x00000200 +#define IDF_NOFOREGROUND 0x00000400 +#define IDF_WARNIFSKIP 0x00000800 +#define IDF_OEMDISK 0x80000000 + +// +// Return values for SetupPromptForDisk, SetupCopyError, +// SetupRenameError, SetupDeleteError, SetupBackupError +// +#define DPROMPT_SUCCESS 0 +#define DPROMPT_CANCEL 1 +#define DPROMPT_SKIPFILE 2 +#define DPROMPT_BUFFERTOOSMALL 3 +#define DPROMPT_OUTOFMEMORY 4 + + +WINSETUPAPI +BOOL +WINAPI +SetupSetDirectoryIdA( + IN HINF InfHandle, + IN DWORD Id, OPTIONAL + IN PCSTR Directory OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupSetDirectoryIdW( + IN HINF InfHandle, + IN DWORD Id, OPTIONAL + IN PCWSTR Directory OPTIONAL + ); + +#ifdef UNICODE +#define SetupSetDirectoryId SetupSetDirectoryIdW +#else +#define SetupSetDirectoryId SetupSetDirectoryIdA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupSetDirectoryIdExA( + IN HINF InfHandle, + IN DWORD Id, OPTIONAL + IN PCSTR Directory, OPTIONAL + IN DWORD Flags, + IN DWORD Reserved1, + IN PVOID Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupSetDirectoryIdExW( + IN HINF InfHandle, + IN DWORD Id, OPTIONAL + IN PCWSTR Directory, OPTIONAL + IN DWORD Flags, + IN DWORD Reserved1, + IN PVOID Reserved2 + ); + +#ifdef UNICODE +#define SetupSetDirectoryIdEx SetupSetDirectoryIdExW +#else +#define SetupSetDirectoryIdEx SetupSetDirectoryIdExA +#endif + +// +// Flags for SetupSetDirectoryIdEx +// +#define SETDIRID_NOT_FULL_PATH 0x00000001 + + +WINSETUPAPI +BOOL +WINAPI +SetupGetSourceInfoA( + IN HINF InfHandle, + IN UINT SourceId, + IN UINT InfoDesired, + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetSourceInfoW( + IN HINF InfHandle, + IN UINT SourceId, + IN UINT InfoDesired, + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupGetSourceInfo SetupGetSourceInfoW +#else +#define SetupGetSourceInfo SetupGetSourceInfoA +#endif + +// +// InfoDesired values for SetupGetSourceInfo +// + +#define SRCINFO_PATH 1 +#define SRCINFO_TAGFILE 2 +#define SRCINFO_DESCRIPTION 3 +#define SRCINFO_FLAGS 4 + + +WINSETUPAPI +BOOL +WINAPI +SetupInstallFileA( + IN HINF InfHandle, OPTIONAL + IN PINFCONTEXT InfContext, OPTIONAL + IN PCSTR SourceFile, OPTIONAL + IN PCSTR SourcePathRoot, OPTIONAL + IN PCSTR DestinationName, OPTIONAL + IN DWORD CopyStyle, + IN PSP_FILE_CALLBACK_A CopyMsgHandler, OPTIONAL + IN PVOID Context OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupInstallFileW( + IN HINF InfHandle, OPTIONAL + IN PINFCONTEXT InfContext, OPTIONAL + IN PCWSTR SourceFile, OPTIONAL + IN PCWSTR SourcePathRoot, OPTIONAL + IN PCWSTR DestinationName, OPTIONAL + IN DWORD CopyStyle, + IN PSP_FILE_CALLBACK_W CopyMsgHandler, OPTIONAL + IN PVOID Context OPTIONAL + ); + +#ifdef UNICODE +#define SetupInstallFile SetupInstallFileW +#else +#define SetupInstallFile SetupInstallFileA +#endif + +WINSETUPAPI +BOOL +WINAPI +SetupInstallFileExA( + IN HINF InfHandle, OPTIONAL + IN PINFCONTEXT InfContext, OPTIONAL + IN PCSTR SourceFile, OPTIONAL + IN PCSTR SourcePathRoot, OPTIONAL + IN PCSTR DestinationName, OPTIONAL + IN DWORD CopyStyle, + IN PSP_FILE_CALLBACK_A CopyMsgHandler, OPTIONAL + IN PVOID Context, OPTIONAL + OUT PBOOL FileWasInUse + ); + +WINSETUPAPI +BOOL +WINAPI +SetupInstallFileExW( + IN HINF InfHandle, OPTIONAL + IN PINFCONTEXT InfContext, OPTIONAL + IN PCWSTR SourceFile, OPTIONAL + IN PCWSTR SourcePathRoot, OPTIONAL + IN PCWSTR DestinationName, OPTIONAL + IN DWORD CopyStyle, + IN PSP_FILE_CALLBACK_W CopyMsgHandler, OPTIONAL + IN PVOID Context, OPTIONAL + OUT PBOOL FileWasInUse + ); + +#ifdef UNICODE +#define SetupInstallFileEx SetupInstallFileExW +#else +#define SetupInstallFileEx SetupInstallFileExA +#endif + +// +// CopyStyle values for copy and queue-related APIs +// +#define SP_COPY_DELETESOURCE 0x0000001 // delete source file on successful copy +#define SP_COPY_REPLACEONLY 0x0000002 // copy only if target file already present +#define SP_COPY_NEWER 0x0000004 // copy only if source newer than or same as target +#define SP_COPY_NEWER_OR_SAME SP_COPY_NEWER +#define SP_COPY_NOOVERWRITE 0x0000008 // copy only if target doesn't exist +#define SP_COPY_NODECOMP 0x0000010 // don't decompress source file while copying +#define SP_COPY_LANGUAGEAWARE 0x0000020 // don't overwrite file of different language +#define SP_COPY_SOURCE_ABSOLUTE 0x0000040 // SourceFile is a full source path +#define SP_COPY_SOURCEPATH_ABSOLUTE 0x0000080 // SourcePathRoot is the full path +#define SP_COPY_IN_USE_NEEDS_REBOOT 0x0000100 // System needs reboot if file in use +#define SP_COPY_FORCE_IN_USE 0x0000200 // Force target-in-use behavior +#define SP_COPY_NOSKIP 0x0000400 // Skip is disallowed for this file or section +#define SP_FLAG_CABINETCONTINUATION 0x0000800 // Used with need media notification +#define SP_COPY_FORCE_NOOVERWRITE 0x0001000 // like NOOVERWRITE but no callback nofitication +#define SP_COPY_FORCE_NEWER 0x0002000 // like NEWER but no callback nofitication +#define SP_COPY_WARNIFSKIP 0x0004000 // system critical file: warn if user tries to skip +#define SP_COPY_NOBROWSE 0x0008000 // Browsing is disallowed for this file or section +#define SP_COPY_NEWER_ONLY 0x0010000 // copy only if source file newer than target +#define SP_COPY_SOURCE_SIS_MASTER 0x0020000 // source is single-instance store master +#define SP_COPY_OEMINF_CATALOG_ONLY 0x0040000 // (SetupCopyOEMInf only) don't copy INF--just catalog +#define SP_COPY_REPLACE_BOOT_FILE 0x0080000 // file must be present upon reboot (i.e., it's + // needed by the loader); this flag implies a reboot +#define SP_COPY_NOPRUNE 0x0100000 // never prune this file + + +WINSETUPAPI +HSPFILEQ +WINAPI +SetupOpenFileQueue( + VOID + ); + +WINSETUPAPI +BOOL +WINAPI +SetupCloseFileQueue( + IN HSPFILEQ QueueHandle + ); + +WINSETUPAPI +BOOL +WINAPI +SetupSetFileQueueAlternatePlatformA( + IN HSPFILEQ QueueHandle, + IN PSP_ALTPLATFORM_INFO AlternatePlatformInfo, OPTIONAL + IN PCSTR AlternateDefaultCatalogFile OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupSetFileQueueAlternatePlatformW( + IN HSPFILEQ QueueHandle, + IN PSP_ALTPLATFORM_INFO AlternatePlatformInfo, OPTIONAL + IN PCWSTR AlternateDefaultCatalogFile OPTIONAL + ); + +#ifdef UNICODE +#define SetupSetFileQueueAlternatePlatform SetupSetFileQueueAlternatePlatformW +#else +#define SetupSetFileQueueAlternatePlatform SetupSetFileQueueAlternatePlatformA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupSetPlatformPathOverrideA( + IN PCSTR Override OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupSetPlatformPathOverrideW( + IN PCWSTR Override OPTIONAL + ); + +#ifdef UNICODE +#define SetupSetPlatformPathOverride SetupSetPlatformPathOverrideW +#else +#define SetupSetPlatformPathOverride SetupSetPlatformPathOverrideA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueueCopyA( + IN HSPFILEQ QueueHandle, + IN PCSTR SourceRootPath, OPTIONAL + IN PCSTR SourcePath, OPTIONAL + IN PCSTR SourceFilename, + IN PCSTR SourceDescription, OPTIONAL + IN PCSTR SourceTagfile, OPTIONAL + IN PCSTR TargetDirectory, + IN PCSTR TargetFilename, OPTIONAL + IN DWORD CopyStyle + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueueCopyW( + IN HSPFILEQ QueueHandle, + IN PCWSTR SourceRootPath, OPTIONAL + IN PCWSTR SourcePath, OPTIONAL + IN PCWSTR SourceFilename, + IN PCWSTR SourceDescription, OPTIONAL + IN PCWSTR SourceTagfile, OPTIONAL + IN PCWSTR TargetDirectory, + IN PCWSTR TargetFilename, OPTIONAL + IN DWORD CopyStyle + ); + +#ifdef UNICODE +#define SetupQueueCopy SetupQueueCopyW +#else +#define SetupQueueCopy SetupQueueCopyA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueueCopyIndirectA( + IN PSP_FILE_COPY_PARAMS_A CopyParams + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueueCopyIndirectW( + IN PSP_FILE_COPY_PARAMS_W CopyParams + ); + +#ifdef UNICODE +#define SetupQueueCopyIndirect SetupQueueCopyIndirectW +#else +#define SetupQueueCopyIndirect SetupQueueCopyIndirectA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueueDefaultCopyA( + IN HSPFILEQ QueueHandle, + IN HINF InfHandle, + IN PCSTR SourceRootPath, + IN PCSTR SourceFilename, + IN PCSTR TargetFilename, + IN DWORD CopyStyle + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueueDefaultCopyW( + IN HSPFILEQ QueueHandle, + IN HINF InfHandle, + IN PCWSTR SourceRootPath, + IN PCWSTR SourceFilename, + IN PCWSTR TargetFilename, + IN DWORD CopyStyle + ); + +#ifdef UNICODE +#define SetupQueueDefaultCopy SetupQueueDefaultCopyW +#else +#define SetupQueueDefaultCopy SetupQueueDefaultCopyA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueueCopySectionA( + IN HSPFILEQ QueueHandle, + IN PCSTR SourceRootPath, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCSTR Section, + IN DWORD CopyStyle + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueueCopySectionW( + IN HSPFILEQ QueueHandle, + IN PCWSTR SourceRootPath, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCWSTR Section, + IN DWORD CopyStyle + ); + +#ifdef UNICODE +#define SetupQueueCopySection SetupQueueCopySectionW +#else +#define SetupQueueCopySection SetupQueueCopySectionA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueueDeleteA( + IN HSPFILEQ QueueHandle, + IN PCSTR PathPart1, + IN PCSTR PathPart2 OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueueDeleteW( + IN HSPFILEQ QueueHandle, + IN PCWSTR PathPart1, + IN PCWSTR PathPart2 OPTIONAL + ); + +#ifdef UNICODE +#define SetupQueueDelete SetupQueueDeleteW +#else +#define SetupQueueDelete SetupQueueDeleteA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueueDeleteSectionA( + IN HSPFILEQ QueueHandle, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCSTR Section + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueueDeleteSectionW( + IN HSPFILEQ QueueHandle, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCWSTR Section + ); + +#ifdef UNICODE +#define SetupQueueDeleteSection SetupQueueDeleteSectionW +#else +#define SetupQueueDeleteSection SetupQueueDeleteSectionA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueueRenameA( + IN HSPFILEQ QueueHandle, + IN PCSTR SourcePath, + IN PCSTR SourceFilename, OPTIONAL + IN PCSTR TargetPath, OPTIONAL + IN PCSTR TargetFilename + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueueRenameW( + IN HSPFILEQ QueueHandle, + IN PCWSTR SourcePath, + IN PCWSTR SourceFilename, OPTIONAL + IN PCWSTR TargetPath, OPTIONAL + IN PCWSTR TargetFilename + ); + +#ifdef UNICODE +#define SetupQueueRename SetupQueueRenameW +#else +#define SetupQueueRename SetupQueueRenameA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQueueRenameSectionA( + IN HSPFILEQ QueueHandle, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCSTR Section + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueueRenameSectionW( + IN HSPFILEQ QueueHandle, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCWSTR Section + ); + +#ifdef UNICODE +#define SetupQueueRenameSection SetupQueueRenameSectionW +#else +#define SetupQueueRenameSection SetupQueueRenameSectionA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupCommitFileQueueA( + IN HWND Owner, OPTIONAL + IN HSPFILEQ QueueHandle, + IN PSP_FILE_CALLBACK_A MsgHandler, + IN PVOID Context + ); + +WINSETUPAPI +BOOL +WINAPI +SetupCommitFileQueueW( + IN HWND Owner, OPTIONAL + IN HSPFILEQ QueueHandle, + IN PSP_FILE_CALLBACK_W MsgHandler, + IN PVOID Context + ); + +#ifdef UNICODE +#define SetupCommitFileQueue SetupCommitFileQueueW +#else +#define SetupCommitFileQueue SetupCommitFileQueueA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupScanFileQueueA( + IN HSPFILEQ FileQueue, + IN DWORD Flags, + IN HWND Window, OPTIONAL + IN PSP_FILE_CALLBACK_A CallbackRoutine, OPTIONAL + IN PVOID CallbackContext, OPTIONAL + OUT PDWORD Result + ); + +WINSETUPAPI +BOOL +WINAPI +SetupScanFileQueueW( + IN HSPFILEQ FileQueue, + IN DWORD Flags, + IN HWND Window, OPTIONAL + IN PSP_FILE_CALLBACK_W CallbackRoutine, OPTIONAL + IN PVOID CallbackContext, OPTIONAL + OUT PDWORD Result + ); + +#ifdef UNICODE +#define SetupScanFileQueue SetupScanFileQueueW +#else +#define SetupScanFileQueue SetupScanFileQueueA +#endif + +// +// Define flags for SetupScanFileQueue. +// +#define SPQ_SCAN_FILE_PRESENCE 0x00000001 +#define SPQ_SCAN_FILE_VALIDITY 0x00000002 +#define SPQ_SCAN_USE_CALLBACK 0x00000004 +#define SPQ_SCAN_USE_CALLBACKEX 0x00000008 +#define SPQ_SCAN_INFORM_USER 0x00000010 +#define SPQ_SCAN_PRUNE_COPY_QUEUE 0x00000020 + +// +// Define flags used with Param2 for SPFILENOTIFY_QUEUESCAN +// +#define SPQ_DELAYED_COPY 0x00000001 // file was in use; registered for delayed copy + + +// +// Define OEM Source Type values for use in SetupCopyOEMInf. +// +#define SPOST_NONE 0 +#define SPOST_PATH 1 +#define SPOST_URL 2 +#define SPOST_MAX 3 + +WINSETUPAPI +BOOL +WINAPI +SetupCopyOEMInfA( + IN PCSTR SourceInfFileName, + IN PCSTR OEMSourceMediaLocation, OPTIONAL + IN DWORD OEMSourceMediaType, + IN DWORD CopyStyle, + OUT PSTR DestinationInfFileName, OPTIONAL + IN DWORD DestinationInfFileNameSize, + OUT PDWORD RequiredSize, OPTIONAL + OUT PSTR *DestinationInfFileNameComponent OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupCopyOEMInfW( + IN PCWSTR SourceInfFileName, + IN PCWSTR OEMSourceMediaLocation, OPTIONAL + IN DWORD OEMSourceMediaType, + IN DWORD CopyStyle, + OUT PWSTR DestinationInfFileName, OPTIONAL + IN DWORD DestinationInfFileNameSize, + OUT PDWORD RequiredSize, OPTIONAL + OUT PWSTR *DestinationInfFileNameComponent OPTIONAL + ); + +#ifdef UNICODE +#define SetupCopyOEMInf SetupCopyOEMInfW +#else +#define SetupCopyOEMInf SetupCopyOEMInfA +#endif + + +// +// Disk space list APIs +// +WINSETUPAPI +HDSKSPC +WINAPI +SetupCreateDiskSpaceListA( + IN PVOID Reserved1, + IN DWORD Reserved2, + IN UINT Flags + ); + +WINSETUPAPI +HDSKSPC +WINAPI +SetupCreateDiskSpaceListW( + IN PVOID Reserved1, + IN DWORD Reserved2, + IN UINT Flags + ); + +#ifdef UNICODE +#define SetupCreateDiskSpaceList SetupCreateDiskSpaceListW +#else +#define SetupCreateDiskSpaceList SetupCreateDiskSpaceListA +#endif + +// +// Flags for SetupCreateDiskSpaceList +// +#define SPDSL_IGNORE_DISK 0x00000001 // ignore deletes and on-disk files in copies +#define SPDSL_DISALLOW_NEGATIVE_ADJUST 0x00000002 + + +WINSETUPAPI +HDSKSPC +WINAPI +SetupDuplicateDiskSpaceListA( + IN HDSKSPC DiskSpace, + IN PVOID Reserved1, + IN DWORD Reserved2, + IN UINT Flags + ); + +WINSETUPAPI +HDSKSPC +WINAPI +SetupDuplicateDiskSpaceListW( + IN HDSKSPC DiskSpace, + IN PVOID Reserved1, + IN DWORD Reserved2, + IN UINT Flags + ); + +#ifdef UNICODE +#define SetupDuplicateDiskSpaceList SetupDuplicateDiskSpaceListW +#else +#define SetupDuplicateDiskSpaceList SetupDuplicateDiskSpaceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDestroyDiskSpaceList( + IN OUT HDSKSPC DiskSpace + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupQueryDrivesInDiskSpaceListA( + IN HDSKSPC DiskSpace, + OUT PSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueryDrivesInDiskSpaceListW( + IN HDSKSPC DiskSpace, + OUT PWSTR ReturnBuffer, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupQueryDrivesInDiskSpaceList SetupQueryDrivesInDiskSpaceListW +#else +#define SetupQueryDrivesInDiskSpaceList SetupQueryDrivesInDiskSpaceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupQuerySpaceRequiredOnDriveA( + IN HDSKSPC DiskSpace, + IN PCSTR DriveSpec, + OUT LONGLONG *SpaceRequired, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQuerySpaceRequiredOnDriveW( + IN HDSKSPC DiskSpace, + IN PCWSTR DriveSpec, + OUT LONGLONG *SpaceRequired, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +#ifdef UNICODE +#define SetupQuerySpaceRequiredOnDrive SetupQuerySpaceRequiredOnDriveW +#else +#define SetupQuerySpaceRequiredOnDrive SetupQuerySpaceRequiredOnDriveA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupAdjustDiskSpaceListA( + IN HDSKSPC DiskSpace, + IN LPCSTR DriveRoot, + IN LONGLONG Amount, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupAdjustDiskSpaceListW( + IN HDSKSPC DiskSpace, + IN LPCWSTR DriveRoot, + IN LONGLONG Amount, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +#ifdef UNICODE +#define SetupAdjustDiskSpaceList SetupAdjustDiskSpaceListW +#else +#define SetupAdjustDiskSpaceList SetupAdjustDiskSpaceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupAddToDiskSpaceListA( + IN HDSKSPC DiskSpace, + IN PCSTR TargetFilespec, + IN LONGLONG FileSize, + IN UINT Operation, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupAddToDiskSpaceListW( + IN HDSKSPC DiskSpace, + IN PCWSTR TargetFilespec, + IN LONGLONG FileSize, + IN UINT Operation, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +#ifdef UNICODE +#define SetupAddToDiskSpaceList SetupAddToDiskSpaceListW +#else +#define SetupAddToDiskSpaceList SetupAddToDiskSpaceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupAddSectionToDiskSpaceListA( + IN HDSKSPC DiskSpace, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCSTR SectionName, + IN UINT Operation, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupAddSectionToDiskSpaceListW( + IN HDSKSPC DiskSpace, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCWSTR SectionName, + IN UINT Operation, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +#ifdef UNICODE +#define SetupAddSectionToDiskSpaceList SetupAddSectionToDiskSpaceListW +#else +#define SetupAddSectionToDiskSpaceList SetupAddSectionToDiskSpaceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupAddInstallSectionToDiskSpaceListA( + IN HDSKSPC DiskSpace, + IN HINF InfHandle, + IN HINF LayoutInfHandle, OPTIONAL + IN PCSTR SectionName, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupAddInstallSectionToDiskSpaceListW( + IN HDSKSPC DiskSpace, + IN HINF InfHandle, + IN HINF LayoutInfHandle, OPTIONAL + IN PCWSTR SectionName, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +#ifdef UNICODE +#define SetupAddInstallSectionToDiskSpaceList SetupAddInstallSectionToDiskSpaceListW +#else +#define SetupAddInstallSectionToDiskSpaceList SetupAddInstallSectionToDiskSpaceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveFromDiskSpaceListA( + IN HDSKSPC DiskSpace, + IN PCSTR TargetFilespec, + IN UINT Operation, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveFromDiskSpaceListW( + IN HDSKSPC DiskSpace, + IN PCWSTR TargetFilespec, + IN UINT Operation, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +#ifdef UNICODE +#define SetupRemoveFromDiskSpaceList SetupRemoveFromDiskSpaceListW +#else +#define SetupRemoveFromDiskSpaceList SetupRemoveFromDiskSpaceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveSectionFromDiskSpaceListA( + IN HDSKSPC DiskSpace, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCSTR SectionName, + IN UINT Operation, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveSectionFromDiskSpaceListW( + IN HDSKSPC DiskSpace, + IN HINF InfHandle, + IN HINF ListInfHandle, OPTIONAL + IN PCWSTR SectionName, + IN UINT Operation, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +#ifdef UNICODE +#define SetupRemoveSectionFromDiskSpaceList SetupRemoveSectionFromDiskSpaceListW +#else +#define SetupRemoveSectionFromDiskSpaceList SetupRemoveSectionFromDiskSpaceListA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveInstallSectionFromDiskSpaceListA( + IN HDSKSPC DiskSpace, + IN HINF InfHandle, + IN HINF LayoutInfHandle, OPTIONAL + IN PCSTR SectionName, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveInstallSectionFromDiskSpaceListW( + IN HDSKSPC DiskSpace, + IN HINF InfHandle, + IN HINF LayoutInfHandle, OPTIONAL + IN PCWSTR SectionName, + IN PVOID Reserved1, + IN UINT Reserved2 + ); + +#ifdef UNICODE +#define SetupRemoveInstallSectionFromDiskSpaceList SetupRemoveInstallSectionFromDiskSpaceListW +#else +#define SetupRemoveInstallSectionFromDiskSpaceList SetupRemoveInstallSectionFromDiskSpaceListA +#endif + + +// +// Cabinet APIs +// + +WINSETUPAPI +BOOL +WINAPI +SetupIterateCabinetA( + IN PCSTR CabinetFile, + IN DWORD Reserved, + IN PSP_FILE_CALLBACK_A MsgHandler, + IN PVOID Context + ); + +WINSETUPAPI +BOOL +WINAPI +SetupIterateCabinetW( + IN PCWSTR CabinetFile, + IN DWORD Reserved, + IN PSP_FILE_CALLBACK_W MsgHandler, + IN PVOID Context + ); + +#ifdef UNICODE +#define SetupIterateCabinet SetupIterateCabinetW +#else +#define SetupIterateCabinet SetupIterateCabinetA +#endif + + +WINSETUPAPI +INT +WINAPI +SetupPromptReboot( + IN HSPFILEQ FileQueue, OPTIONAL + IN HWND Owner, + IN BOOL ScanOnly + ); + +// +// Define flags that are returned by SetupPromptReboot +// +#define SPFILEQ_FILE_IN_USE 0x00000001 +#define SPFILEQ_REBOOT_RECOMMENDED 0x00000002 +#define SPFILEQ_REBOOT_IN_PROGRESS 0x00000004 + + +WINSETUPAPI +PVOID +WINAPI +SetupInitDefaultQueueCallback( + IN HWND OwnerWindow + ); + +WINSETUPAPI +PVOID +WINAPI +SetupInitDefaultQueueCallbackEx( + IN HWND OwnerWindow, + IN HWND AlternateProgressWindow, OPTIONAL + IN UINT ProgressMessage, + IN DWORD Reserved1, + IN PVOID Reserved2 + ); + +WINSETUPAPI +VOID +WINAPI +SetupTermDefaultQueueCallback( + IN PVOID Context + ); + +WINSETUPAPI +UINT +WINAPI +SetupDefaultQueueCallbackA( + IN PVOID Context, + IN UINT Notification, + IN UINT_PTR Param1, + IN UINT_PTR Param2 + ); + +WINSETUPAPI +UINT +WINAPI +SetupDefaultQueueCallbackW( + IN PVOID Context, + IN UINT Notification, + IN UINT_PTR Param1, + IN UINT_PTR Param2 + ); + +#ifdef UNICODE +#define SetupDefaultQueueCallback SetupDefaultQueueCallbackW +#else +#define SetupDefaultQueueCallback SetupDefaultQueueCallbackA +#endif + + +// +// Flags for AddReg section lines in INF. The corresponding value +// is in the AddReg line format given below: +// +// ,,,,... +// +// The low word contains basic flags concerning the general data type +// and AddReg action. The high word contains values that more specifically +// identify the data type of the registry value. The high word is ignored +// by the 16-bit Windows 95 SETUPX APIs. +// +#define FLG_ADDREG_BINVALUETYPE ( 0x00000001 ) +#define FLG_ADDREG_NOCLOBBER ( 0x00000002 ) +#define FLG_ADDREG_DELVAL ( 0x00000004 ) +#define FLG_ADDREG_APPEND ( 0x00000008 ) // Currently supported only + // for REG_MULTI_SZ values. +#define FLG_ADDREG_KEYONLY ( 0x00000010 ) // Just create the key, ignore value +#define FLG_ADDREG_OVERWRITEONLY ( 0x00000020 ) // Set only if value already exists + +#define FLG_ADDREG_TYPE_MASK ( 0xFFFF0000 | FLG_ADDREG_BINVALUETYPE ) +#define FLG_ADDREG_TYPE_SZ ( 0x00000000 ) +#define FLG_ADDREG_TYPE_MULTI_SZ ( 0x00010000 ) +#define FLG_ADDREG_TYPE_EXPAND_SZ ( 0x00020000 ) +#define FLG_ADDREG_TYPE_BINARY ( 0x00000000 | FLG_ADDREG_BINVALUETYPE ) +#define FLG_ADDREG_TYPE_DWORD ( 0x00010000 | FLG_ADDREG_BINVALUETYPE ) +#define FLG_ADDREG_TYPE_NONE ( 0x00020000 | FLG_ADDREG_BINVALUETYPE ) + +// +// Flags for BitReg section lines in INF. +// +#define FLG_BITREG_CLEARBITS ( 0x00000000 ) +#define FLG_BITREG_SETBITS ( 0x00000001 ) + +// +// Flags for RegSvr section lines in INF +// +#define FLG_REGSVR_DLLREGISTER ( 0x00000001 ) +#define FLG_REGSVR_DLLINSTALL ( 0x00000002 ) + +// Flags for RegSvr section lines in INF +// + +#define FLG_PROFITEM_CURRENTUSER ( 0x00000001 ) +#define FLG_PROFITEM_DELETE ( 0x00000002 ) +#define FLG_PROFITEM_GROUP ( 0x00000004 ) +#define FLG_PROFITEM_CSIDL ( 0x00000008 ) + + + +// +// The INF may supply any arbitrary data type ordinal in the highword except +// for the following: REG_NONE, REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ. If this +// technique is used, then the data is given in binary format, one byte per +// field. +// + + +WINSETUPAPI +BOOL +WINAPI +SetupInstallFromInfSectionA( + IN HWND Owner, + IN HINF InfHandle, + IN PCSTR SectionName, + IN UINT Flags, + IN HKEY RelativeKeyRoot, OPTIONAL + IN PCSTR SourceRootPath, OPTIONAL + IN UINT CopyFlags, OPTIONAL + IN PSP_FILE_CALLBACK_A MsgHandler, OPTIONAL + IN PVOID Context, OPTIONAL + IN HDEVINFO DeviceInfoSet, OPTIONAL + IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupInstallFromInfSectionW( + IN HWND Owner, + IN HINF InfHandle, + IN PCWSTR SectionName, + IN UINT Flags, + IN HKEY RelativeKeyRoot, OPTIONAL + IN PCWSTR SourceRootPath, OPTIONAL + IN UINT CopyFlags, OPTIONAL + IN PSP_FILE_CALLBACK_W MsgHandler, OPTIONAL + IN PVOID Context, OPTIONAL + IN HDEVINFO DeviceInfoSet, OPTIONAL + IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + +#ifdef UNICODE +#define SetupInstallFromInfSection SetupInstallFromInfSectionW +#else +#define SetupInstallFromInfSection SetupInstallFromInfSectionA +#endif + +// +// Flags for SetupInstallFromInfSection +// +#define SPINST_LOGCONFIG 0x00000001 +#define SPINST_INIFILES 0x00000002 +#define SPINST_REGISTRY 0x00000004 +#define SPINST_INI2REG 0x00000008 +#define SPINST_FILES 0x00000010 +#define SPINST_BITREG 0x00000020 +#define SPINST_REGSVR 0x00000040 +#define SPINST_UNREGSVR 0x00000080 +#define SPINST_PROFILEITEMS 0x00000100 +#define SPINST_ALL 0x000001ff +#define SPINST_SINGLESECTION 0x00010000 +#define SPINST_LOGCONFIG_IS_FORCED 0x00020000 +#define SPINST_LOGCONFIGS_ARE_OVERRIDES 0x00040000 + + +WINSETUPAPI +BOOL +WINAPI +SetupInstallFilesFromInfSectionA( + IN HINF InfHandle, + IN HINF LayoutInfHandle, OPTIONAL + IN HSPFILEQ FileQueue, + IN PCSTR SectionName, + IN PCSTR SourceRootPath, OPTIONAL + IN UINT CopyFlags + ); + +WINSETUPAPI +BOOL +WINAPI +SetupInstallFilesFromInfSectionW( + IN HINF InfHandle, + IN HINF LayoutInfHandle, OPTIONAL + IN HSPFILEQ FileQueue, + IN PCWSTR SectionName, + IN PCWSTR SourceRootPath, OPTIONAL + IN UINT CopyFlags + ); + +#ifdef UNICODE +#define SetupInstallFilesFromInfSection SetupInstallFilesFromInfSectionW +#else +#define SetupInstallFilesFromInfSection SetupInstallFilesFromInfSectionA +#endif + + +// +// Flags for SetupInstallServicesFromInfSection(Ex). These flags are also used +// in the flags field of AddService or DelService lines in a device INF. Some +// of these flags are not permitted in the non-Ex API. These flags are marked +// as such below. +// + +// +// (AddService) move service's tag to front of its group order list +// +#define SPSVCINST_TAGTOFRONT (0x00000001) + +// +// (AddService) **Ex API only** mark this service as the function driver for the +// device being installed +// +#define SPSVCINST_ASSOCSERVICE (0x00000002) + +// +// (DelService) delete the associated event log entry for a service specified in +// a DelService entry +// +#define SPSVCINST_DELETEEVENTLOGENTRY (0x00000004) + +// +// (AddService) don't overwrite display name if it already exists +// +#define SPSVCINST_NOCLOBBER_DISPLAYNAME (0x00000008) + +// +// (AddService) don't overwrite start type value if service already exists +// +#define SPSVCINST_NOCLOBBER_STARTTYPE (0x00000010) + +// +// (AddService) don't overwrite error control value if service already exists +// +#define SPSVCINST_NOCLOBBER_ERRORCONTROL (0x00000020) + +// +// (AddService) don't overwrite load order group if it already exists +// +#define SPSVCINST_NOCLOBBER_LOADORDERGROUP (0x00000040) + +// +// (AddService) don't overwrite dependencies list if it already exists +// +#define SPSVCINST_NOCLOBBER_DEPENDENCIES (0x00000080) + +// +// (AddService) don't overwrite description if it already exists +// +#define SPSVCINST_NOCLOBBER_DESCRIPTION (0x00000100) +// +// (DelService) stop the associated service specified in +// a DelService entry before deleting the service +// +#define SPSVCINST_STOPSERVICE (0x00000200) + + + + +WINSETUPAPI +BOOL +WINAPI +SetupInstallServicesFromInfSectionA( + IN HINF InfHandle, + IN PCSTR SectionName, + IN DWORD Flags + ); + +WINSETUPAPI +BOOL +WINAPI +SetupInstallServicesFromInfSectionW( + IN HINF InfHandle, + IN PCWSTR SectionName, + IN DWORD Flags + ); + +#ifdef UNICODE +#define SetupInstallServicesFromInfSection SetupInstallServicesFromInfSectionW +#else +#define SetupInstallServicesFromInfSection SetupInstallServicesFromInfSectionA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupInstallServicesFromInfSectionExA( + IN HINF InfHandle, + IN PCSTR SectionName, + IN DWORD Flags, + IN HDEVINFO DeviceInfoSet, OPTIONAL + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PVOID Reserved1, + IN PVOID Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupInstallServicesFromInfSectionExW( + IN HINF InfHandle, + IN PCWSTR SectionName, + IN DWORD Flags, + IN HDEVINFO DeviceInfoSet, OPTIONAL + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PVOID Reserved1, + IN PVOID Reserved2 + ); + +#ifdef UNICODE +#define SetupInstallServicesFromInfSectionEx SetupInstallServicesFromInfSectionExW +#else +#define SetupInstallServicesFromInfSectionEx SetupInstallServicesFromInfSectionExA +#endif + + +// +// Define handle type for Setup file log. +// +typedef PVOID HSPFILELOG; + +WINSETUPAPI +HSPFILELOG +WINAPI +SetupInitializeFileLogA( + IN PCSTR LogFileName, OPTIONAL + IN DWORD Flags + ); + +WINSETUPAPI +HSPFILELOG +WINAPI +SetupInitializeFileLogW( + IN PCWSTR LogFileName, OPTIONAL + IN DWORD Flags + ); + +#ifdef UNICODE +#define SetupInitializeFileLog SetupInitializeFileLogW +#else +#define SetupInitializeFileLog SetupInitializeFileLogA +#endif + +// +// Flags for SetupInitializeFileLog +// +#define SPFILELOG_SYSTEMLOG 0x00000001 // use system log -- must be Administrator +#define SPFILELOG_FORCENEW 0x00000002 // not valid with SPFILELOG_SYSTEMLOG +#define SPFILELOG_QUERYONLY 0x00000004 // allows non-administrators to read system log + + +WINSETUPAPI +BOOL +WINAPI +SetupTerminateFileLog( + IN HSPFILELOG FileLogHandle + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupLogFileA( + IN HSPFILELOG FileLogHandle, + IN PCSTR LogSectionName, OPTIONAL + IN PCSTR SourceFilename, + IN PCSTR TargetFilename, + IN DWORD Checksum, OPTIONAL + IN PCSTR DiskTagfile, OPTIONAL + IN PCSTR DiskDescription, OPTIONAL + IN PCSTR OtherInfo, OPTIONAL + IN DWORD Flags + ); + +WINSETUPAPI +BOOL +WINAPI +SetupLogFileW( + IN HSPFILELOG FileLogHandle, + IN PCWSTR LogSectionName, OPTIONAL + IN PCWSTR SourceFilename, + IN PCWSTR TargetFilename, + IN DWORD Checksum, OPTIONAL + IN PCWSTR DiskTagfile, OPTIONAL + IN PCWSTR DiskDescription, OPTIONAL + IN PCWSTR OtherInfo, OPTIONAL + IN DWORD Flags + ); + +#ifdef UNICODE +#define SetupLogFile SetupLogFileW +#else +#define SetupLogFile SetupLogFileA +#endif + +// +// Flags for SetupLogFile +// +#define SPFILELOG_OEMFILE 0x00000001 + + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveFileLogEntryA( + IN HSPFILELOG FileLogHandle, + IN PCSTR LogSectionName, OPTIONAL + IN PCSTR TargetFilename OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupRemoveFileLogEntryW( + IN HSPFILELOG FileLogHandle, + IN PCWSTR LogSectionName, OPTIONAL + IN PCWSTR TargetFilename OPTIONAL + ); + +#ifdef UNICODE +#define SetupRemoveFileLogEntry SetupRemoveFileLogEntryW +#else +#define SetupRemoveFileLogEntry SetupRemoveFileLogEntryA +#endif + + +// +// Items retrievable from SetupQueryFileLog() +// +typedef enum { + SetupFileLogSourceFilename, + SetupFileLogChecksum, + SetupFileLogDiskTagfile, + SetupFileLogDiskDescription, + SetupFileLogOtherInfo, + SetupFileLogMax +} SetupFileLogInfo; + +WINSETUPAPI +BOOL +WINAPI +SetupQueryFileLogA( + IN HSPFILELOG FileLogHandle, + IN PCSTR LogSectionName, OPTIONAL + IN PCSTR TargetFilename, + IN SetupFileLogInfo DesiredInfo, + OUT PSTR DataOut, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupQueryFileLogW( + IN HSPFILELOG FileLogHandle, + IN PCWSTR LogSectionName, OPTIONAL + IN PCWSTR TargetFilename, + IN SetupFileLogInfo DesiredInfo, + OUT PWSTR DataOut, OPTIONAL + IN DWORD ReturnBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupQueryFileLog SetupQueryFileLogW +#else +#define SetupQueryFileLog SetupQueryFileLogA +#endif + +// +// Text logging APIs +// +#define LogSeverity DWORD +#define LogSevInformation 0x00000000 +#define LogSevWarning 0x00000001 +#define LogSevError 0x00000002 +#define LogSevFatalError 0x00000003 +#define LogSevMaximum 0x00000004 + +WINSETUPAPI +BOOL +WINAPI +SetupOpenLog ( + BOOL Erase + ); + +WINSETUPAPI +BOOL +WINAPI +SetupLogErrorA ( + IN LPCSTR MessageString, + IN LogSeverity Severity + ); + +WINSETUPAPI +BOOL +WINAPI +SetupLogErrorW ( + IN LPCWSTR MessageString, + IN LogSeverity Severity + ); + +#ifdef UNICODE +#define SetupLogError SetupLogErrorW +#else +#define SetupLogError SetupLogErrorA +#endif + +WINSETUPAPI +VOID +WINAPI +SetupCloseLog ( + VOID + ); + + +// +// Backup Information API +// + +WINSETUPAPI +BOOL +WINAPI +SetupGetBackupInformationA( + IN HSPFILEQ QueueHandle, + OUT PSP_BACKUP_QUEUE_PARAMS_A BackupParams + ); + +WINSETUPAPI +BOOL +WINAPI +SetupGetBackupInformationW( + IN HSPFILEQ QueueHandle, + OUT PSP_BACKUP_QUEUE_PARAMS_W BackupParams + ); + +#ifdef UNICODE +#define SetupGetBackupInformation SetupGetBackupInformationW +#else +#define SetupGetBackupInformation SetupGetBackupInformationA +#endif + + +// +// Device Installer APIs +// + +WINSETUPAPI +HDEVINFO +WINAPI +SetupDiCreateDeviceInfoList( + IN CONST GUID *ClassGuid, OPTIONAL + IN HWND hwndParent OPTIONAL + ); + + +WINSETUPAPI +HDEVINFO +WINAPI +SetupDiCreateDeviceInfoListExA( + IN CONST GUID *ClassGuid, OPTIONAL + IN HWND hwndParent, OPTIONAL + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +HDEVINFO +WINAPI +SetupDiCreateDeviceInfoListExW( + IN CONST GUID *ClassGuid, OPTIONAL + IN HWND hwndParent, OPTIONAL + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiCreateDeviceInfoListEx SetupDiCreateDeviceInfoListExW +#else +#define SetupDiCreateDeviceInfoListEx SetupDiCreateDeviceInfoListExA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInfoListClass( + IN HDEVINFO DeviceInfoSet, + OUT LPGUID ClassGuid + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInfoListDetailA( + IN HDEVINFO DeviceInfoSet, + OUT PSP_DEVINFO_LIST_DETAIL_DATA_A DeviceInfoSetDetailData + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInfoListDetailW( + IN HDEVINFO DeviceInfoSet, + OUT PSP_DEVINFO_LIST_DETAIL_DATA_W DeviceInfoSetDetailData + ); + +#ifdef UNICODE +#define SetupDiGetDeviceInfoListDetail SetupDiGetDeviceInfoListDetailW +#else +#define SetupDiGetDeviceInfoListDetail SetupDiGetDeviceInfoListDetailA +#endif + + +// +// Flags for SetupDiCreateDeviceInfo +// +#define DICD_GENERATE_ID 0x00000001 +#define DICD_INHERIT_CLASSDRVS 0x00000002 + +WINSETUPAPI +BOOL +WINAPI +SetupDiCreateDeviceInfoA( + IN HDEVINFO DeviceInfoSet, + IN PCSTR DeviceName, + IN CONST GUID *ClassGuid, + IN PCSTR DeviceDescription, OPTIONAL + IN HWND hwndParent, OPTIONAL + IN DWORD CreationFlags, + OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiCreateDeviceInfoW( + IN HDEVINFO DeviceInfoSet, + IN PCWSTR DeviceName, + IN CONST GUID *ClassGuid, + IN PCWSTR DeviceDescription, OPTIONAL + IN HWND hwndParent, OPTIONAL + IN DWORD CreationFlags, + OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiCreateDeviceInfo SetupDiCreateDeviceInfoW +#else +#define SetupDiCreateDeviceInfo SetupDiCreateDeviceInfoA +#endif + + +// +// Flags for SetupDiOpenDeviceInfo +// +#define DIOD_INHERIT_CLASSDRVS 0x00000002 +#define DIOD_CANCEL_REMOVE 0x00000004 + +WINSETUPAPI +BOOL +WINAPI +SetupDiOpenDeviceInfoA( + IN HDEVINFO DeviceInfoSet, + IN PCSTR DeviceInstanceId, + IN HWND hwndParent, OPTIONAL + IN DWORD OpenFlags, + OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiOpenDeviceInfoW( + IN HDEVINFO DeviceInfoSet, + IN PCWSTR DeviceInstanceId, + IN HWND hwndParent, OPTIONAL + IN DWORD OpenFlags, + OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiOpenDeviceInfo SetupDiOpenDeviceInfoW +#else +#define SetupDiOpenDeviceInfo SetupDiOpenDeviceInfoA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInstanceIdA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + OUT PSTR DeviceInstanceId, + IN DWORD DeviceInstanceIdSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInstanceIdW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + OUT PWSTR DeviceInstanceId, + IN DWORD DeviceInstanceIdSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetDeviceInstanceId SetupDiGetDeviceInstanceIdW +#else +#define SetupDiGetDeviceInstanceId SetupDiGetDeviceInstanceIdA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiDeleteDeviceInfo( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiEnumDeviceInfo( + IN HDEVINFO DeviceInfoSet, + IN DWORD MemberIndex, + OUT PSP_DEVINFO_DATA DeviceInfoData + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiDestroyDeviceInfoList( + IN HDEVINFO DeviceInfoSet + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiEnumDeviceInterfaces( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN CONST GUID *InterfaceClassGuid, + IN DWORD MemberIndex, + OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData + ); + +// +// Backward compatibility--do not use +// +#define SetupDiEnumInterfaceDevice SetupDiEnumDeviceInterfaces + + +WINSETUPAPI +BOOL +WINAPI +SetupDiCreateDeviceInterfaceA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + IN CONST GUID *InterfaceClassGuid, + IN PCSTR ReferenceString, OPTIONAL + IN DWORD CreationFlags, + OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiCreateDeviceInterfaceW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + IN CONST GUID *InterfaceClassGuid, + IN PCWSTR ReferenceString, OPTIONAL + IN DWORD CreationFlags, + OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiCreateDeviceInterface SetupDiCreateDeviceInterfaceW +#else +#define SetupDiCreateDeviceInterface SetupDiCreateDeviceInterfaceA +#endif + +// +// Backward compatibility--do not use. +// +#define SetupDiCreateInterfaceDeviceW SetupDiCreateDeviceInterfaceW +#define SetupDiCreateInterfaceDeviceA SetupDiCreateDeviceInterfaceA +#ifdef UNICODE +#define SetupDiCreateInterfaceDevice SetupDiCreateDeviceInterfaceW +#else +#define SetupDiCreateInterfaceDevice SetupDiCreateDeviceInterfaceA +#endif + + +// +// Flags for SetupDiOpenDeviceInterface +// +#define DIODI_NO_ADD 0x00000001 + +WINSETUPAPI +BOOL +WINAPI +SetupDiOpenDeviceInterfaceA( + IN HDEVINFO DeviceInfoSet, + IN PCSTR DevicePath, + IN DWORD OpenFlags, + OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiOpenDeviceInterfaceW( + IN HDEVINFO DeviceInfoSet, + IN PCWSTR DevicePath, + IN DWORD OpenFlags, + OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiOpenDeviceInterface SetupDiOpenDeviceInterfaceW +#else +#define SetupDiOpenDeviceInterface SetupDiOpenDeviceInterfaceA +#endif + +// +// Backward compatibility--do not use +// +#define SetupDiOpenInterfaceDeviceW SetupDiOpenDeviceInterfaceW +#define SetupDiOpenInterfaceDeviceA SetupDiOpenDeviceInterfaceA +#ifdef UNICODE +#define SetupDiOpenInterfaceDevice SetupDiOpenDeviceInterfaceW +#else +#define SetupDiOpenInterfaceDevice SetupDiOpenDeviceInterfaceA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInterfaceAlias( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, + IN CONST GUID *AliasInterfaceClassGuid, + OUT PSP_DEVICE_INTERFACE_DATA AliasDeviceInterfaceData + ); + +// +// Backward compatibility--do not use. +// +#define SetupDiGetInterfaceDeviceAlias SetupDiGetDeviceInterfaceAlias + + +WINSETUPAPI +BOOL +WINAPI +SetupDiDeleteDeviceInterfaceData( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData + ); + +// +// Backward compatibility--do not use. +// +#define SetupDiDeleteInterfaceDeviceData SetupDiDeleteDeviceInterfaceData + + +WINSETUPAPI +BOOL +WINAPI +SetupDiRemoveDeviceInterface( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData + ); + +// +// Backward compatibility--do not use. +// +#define SetupDiRemoveInterfaceDevice SetupDiRemoveDeviceInterface + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInterfaceDetailA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, + OUT PSP_DEVICE_INTERFACE_DETAIL_DATA_A DeviceInterfaceDetailData, OPTIONAL + IN DWORD DeviceInterfaceDetailDataSize, + OUT PDWORD RequiredSize, OPTIONAL + OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInterfaceDetailW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, + OUT PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, OPTIONAL + IN DWORD DeviceInterfaceDetailDataSize, + OUT PDWORD RequiredSize, OPTIONAL + OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetDeviceInterfaceDetail SetupDiGetDeviceInterfaceDetailW +#else +#define SetupDiGetDeviceInterfaceDetail SetupDiGetDeviceInterfaceDetailA +#endif + +// +// Backward compatibility--do not use. +// +#define SetupDiGetInterfaceDeviceDetailW SetupDiGetDeviceInterfaceDetailW +#define SetupDiGetInterfaceDeviceDetailA SetupDiGetDeviceInterfaceDetailA +#ifdef UNICODE +#define SetupDiGetInterfaceDeviceDetail SetupDiGetDeviceInterfaceDetailW +#else +#define SetupDiGetInterfaceDeviceDetail SetupDiGetDeviceInterfaceDetailA +#endif + + +// +// Default install handler for DIF_INSTALLINTERFACES. +// +WINSETUPAPI +BOOL +WINAPI +SetupDiInstallDeviceInterfaces( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData + ); + +// +// Backward compatibility--do not use. +// +#define SetupDiInstallInterfaceDevices SetupDiInstallDeviceInterfaces + + +// +// Default install handler for DIF_REGISTERDEVICE +// + +// +// Flags for SetupDiRegisterDeviceInfo +// +#define SPRDI_FIND_DUPS 0x00000001 + +WINSETUPAPI +BOOL +WINAPI +SetupDiRegisterDeviceInfo( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Flags, + IN PSP_DETSIG_CMPPROC CompareProc, OPTIONAL + IN PVOID CompareContext, OPTIONAL + OUT PSP_DEVINFO_DATA DupDeviceInfoData OPTIONAL + ); + + +// +// Ordinal values distinguishing between class drivers and +// device drivers. +// (Passed in 'DriverType' parameter of driver information list APIs) +// +#define SPDIT_NODRIVER 0x00000000 +#define SPDIT_CLASSDRIVER 0x00000001 +#define SPDIT_COMPATDRIVER 0x00000002 + +WINSETUPAPI +BOOL +WINAPI +SetupDiBuildDriverInfoList( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN DWORD DriverType + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiCancelDriverInfoSearch( + IN HDEVINFO DeviceInfoSet + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiEnumDriverInfoA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN DWORD DriverType, + IN DWORD MemberIndex, + OUT PSP_DRVINFO_DATA_A DriverInfoData + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiEnumDriverInfoW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN DWORD DriverType, + IN DWORD MemberIndex, + OUT PSP_DRVINFO_DATA_W DriverInfoData + ); + +#ifdef UNICODE +#define SetupDiEnumDriverInfo SetupDiEnumDriverInfoW +#else +#define SetupDiEnumDriverInfo SetupDiEnumDriverInfoA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetSelectedDriverA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + OUT PSP_DRVINFO_DATA_A DriverInfoData + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetSelectedDriverW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + OUT PSP_DRVINFO_DATA_W DriverInfoData + ); + +#ifdef UNICODE +#define SetupDiGetSelectedDriver SetupDiGetSelectedDriverW +#else +#define SetupDiGetSelectedDriver SetupDiGetSelectedDriverA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetSelectedDriverA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN OUT PSP_DRVINFO_DATA_A DriverInfoData OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetSelectedDriverW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN OUT PSP_DRVINFO_DATA_W DriverInfoData OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiSetSelectedDriver SetupDiSetSelectedDriverW +#else +#define SetupDiSetSelectedDriver SetupDiSetSelectedDriverA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDriverInfoDetailA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_DRVINFO_DATA_A DriverInfoData, + OUT PSP_DRVINFO_DETAIL_DATA_A DriverInfoDetailData, OPTIONAL + IN DWORD DriverInfoDetailDataSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDriverInfoDetailW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_DRVINFO_DATA_W DriverInfoData, + OUT PSP_DRVINFO_DETAIL_DATA_W DriverInfoDetailData, OPTIONAL + IN DWORD DriverInfoDetailDataSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetDriverInfoDetail SetupDiGetDriverInfoDetailW +#else +#define SetupDiGetDriverInfoDetail SetupDiGetDriverInfoDetailA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiDestroyDriverInfoList( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN DWORD DriverType + ); + + +// +// Flags controlling what is included in the device information set built +// by SetupDiGetClassDevs +// +#define DIGCF_DEFAULT 0x00000001 // only valid with DIGCF_DEVICEINTERFACE +#define DIGCF_PRESENT 0x00000002 +#define DIGCF_ALLCLASSES 0x00000004 +#define DIGCF_PROFILE 0x00000008 +#define DIGCF_DEVICEINTERFACE 0x00000010 + +// +// Backward compatibility--do not use. +// +#define DIGCF_INTERFACEDEVICE DIGCF_DEVICEINTERFACE + + +WINSETUPAPI +HDEVINFO +WINAPI +SetupDiGetClassDevsA( + IN CONST GUID *ClassGuid, OPTIONAL + IN PCSTR Enumerator, OPTIONAL + IN HWND hwndParent, OPTIONAL + IN DWORD Flags + ); + +WINSETUPAPI +HDEVINFO +WINAPI +SetupDiGetClassDevsW( + IN CONST GUID *ClassGuid, OPTIONAL + IN PCWSTR Enumerator, OPTIONAL + IN HWND hwndParent, OPTIONAL + IN DWORD Flags + ); + +#ifdef UNICODE +#define SetupDiGetClassDevs SetupDiGetClassDevsW +#else +#define SetupDiGetClassDevs SetupDiGetClassDevsA +#endif + + +WINSETUPAPI +HDEVINFO +WINAPI +SetupDiGetClassDevsExA( + IN CONST GUID *ClassGuid, OPTIONAL + IN PCSTR Enumerator, OPTIONAL + IN HWND hwndParent, OPTIONAL + IN DWORD Flags, + IN HDEVINFO DeviceInfoSet, OPTIONAL + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +HDEVINFO +WINAPI +SetupDiGetClassDevsExW( + IN CONST GUID *ClassGuid, OPTIONAL + IN PCWSTR Enumerator, OPTIONAL + IN HWND hwndParent, OPTIONAL + IN DWORD Flags, + IN HDEVINFO DeviceInfoSet, OPTIONAL + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiGetClassDevsEx SetupDiGetClassDevsExW +#else +#define SetupDiGetClassDevsEx SetupDiGetClassDevsExA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetINFClassA( + IN PCSTR InfName, + OUT LPGUID ClassGuid, + OUT PSTR ClassName, + IN DWORD ClassNameSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetINFClassW( + IN PCWSTR InfName, + OUT LPGUID ClassGuid, + OUT PWSTR ClassName, + IN DWORD ClassNameSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetINFClass SetupDiGetINFClassW +#else +#define SetupDiGetINFClass SetupDiGetINFClassA +#endif + + +// +// Flags controlling exclusion from the class information list built +// by SetupDiBuildClassInfoList(Ex) +// +#define DIBCI_NOINSTALLCLASS 0x00000001 +#define DIBCI_NODISPLAYCLASS 0x00000002 + +WINSETUPAPI +BOOL +WINAPI +SetupDiBuildClassInfoList( + IN DWORD Flags, + OUT LPGUID ClassGuidList, + IN DWORD ClassGuidListSize, + OUT PDWORD RequiredSize + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiBuildClassInfoListExA( + IN DWORD Flags, + OUT LPGUID ClassGuidList, + IN DWORD ClassGuidListSize, + OUT PDWORD RequiredSize, + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiBuildClassInfoListExW( + IN DWORD Flags, + OUT LPGUID ClassGuidList, + IN DWORD ClassGuidListSize, + OUT PDWORD RequiredSize, + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiBuildClassInfoListEx SetupDiBuildClassInfoListExW +#else +#define SetupDiBuildClassInfoListEx SetupDiBuildClassInfoListExA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassDescriptionA( + IN CONST GUID *ClassGuid, + OUT PSTR ClassDescription, + IN DWORD ClassDescriptionSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassDescriptionW( + IN CONST GUID *ClassGuid, + OUT PWSTR ClassDescription, + IN DWORD ClassDescriptionSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetClassDescription SetupDiGetClassDescriptionW +#else +#define SetupDiGetClassDescription SetupDiGetClassDescriptionA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassDescriptionExA( + IN CONST GUID *ClassGuid, + OUT PSTR ClassDescription, + IN DWORD ClassDescriptionSize, + OUT PDWORD RequiredSize, OPTIONAL + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassDescriptionExW( + IN CONST GUID *ClassGuid, + OUT PWSTR ClassDescription, + IN DWORD ClassDescriptionSize, + OUT PDWORD RequiredSize, OPTIONAL + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiGetClassDescriptionEx SetupDiGetClassDescriptionExW +#else +#define SetupDiGetClassDescriptionEx SetupDiGetClassDescriptionExA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiCallClassInstaller( + IN DI_FUNCTION InstallFunction, + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + + +// +// Default install handler for DIF_SELECTDEVICE +// +WINSETUPAPI +BOOL +WINAPI +SetupDiSelectDevice( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + + +// +// Default install handler for DIF_SELECTBESTCOMPATDRV +// +WINSETUPAPI +BOOL +WINAPI +SetupDiSelectBestCompatDrv( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + + +// +// Default install handler for DIF_INSTALLDEVICE +// +WINSETUPAPI +BOOL +WINAPI +SetupDiInstallDevice( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData + ); + + +// +// Default install handler for DIF_INSTALLDEVICEFILES +// +WINSETUPAPI +BOOL +WINAPI +SetupDiInstallDriverFiles( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData + ); + + +// +// Default install handler for DIF_REGISTER_COINSTALLERS +// +WINSETUPAPI +BOOL +WINAPI +SetupDiRegisterCoDeviceInstallers( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData + ); + + +// +// Default install handler for DIF_REMOVE +// +WINSETUPAPI +BOOL +WINAPI +SetupDiRemoveDevice( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData + ); + + +// +// Default install handler for DIF_UNREMOVE +// +WINSETUPAPI +BOOL +WINAPI +SetupDiUnremoveDevice( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData + ); + + +// +// Default install handler for DIF_MOVEDEVICE +// +WINSETUPAPI +BOOL +WINAPI +SetupDiMoveDuplicateDevice( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DestinationDeviceInfoData + ); + + +// +// Default install handler for DIF_PROPERTYCHANGE +// +WINSETUPAPI +BOOL +WINAPI +SetupDiChangeState( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiInstallClassA( + IN HWND hwndParent, OPTIONAL + IN PCSTR InfFileName, + IN DWORD Flags, + IN HSPFILEQ FileQueue OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiInstallClassW( + IN HWND hwndParent, OPTIONAL + IN PCWSTR InfFileName, + IN DWORD Flags, + IN HSPFILEQ FileQueue OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiInstallClass SetupDiInstallClassW +#else +#define SetupDiInstallClass SetupDiInstallClassA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiInstallClassExA( + IN HWND hwndParent, OPTIONAL + IN PCSTR InfFileName, OPTIONAL + IN DWORD Flags, + IN HSPFILEQ FileQueue, OPTIONAL + IN CONST GUID *InterfaceClassGuid, OPTIONAL + IN PVOID Reserved1, + IN PVOID Reserved2 + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiInstallClassExW( + IN HWND hwndParent, OPTIONAL + IN PCWSTR InfFileName, OPTIONAL + IN DWORD Flags, + IN HSPFILEQ FileQueue, OPTIONAL + IN CONST GUID *InterfaceClassGuid, OPTIONAL + IN PVOID Reserved1, + IN PVOID Reserved2 + ); + +#ifdef UNICODE +#define SetupDiInstallClassEx SetupDiInstallClassExW +#else +#define SetupDiInstallClassEx SetupDiInstallClassExA +#endif + + +WINSETUPAPI +HKEY +WINAPI +SetupDiOpenClassRegKey( + IN CONST GUID *ClassGuid, OPTIONAL + IN REGSAM samDesired + ); + + +// +// Flags for SetupDiOpenClassRegKeyEx +// +#define DIOCR_INSTALLER 0x00000001 // class installer registry branch +#define DIOCR_INTERFACE 0x00000002 // interface class registry branch + +WINSETUPAPI +HKEY +WINAPI +SetupDiOpenClassRegKeyExA( + IN CONST GUID *ClassGuid, OPTIONAL + IN REGSAM samDesired, + IN DWORD Flags, + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +HKEY +WINAPI +SetupDiOpenClassRegKeyExW( + IN CONST GUID *ClassGuid, OPTIONAL + IN REGSAM samDesired, + IN DWORD Flags, + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiOpenClassRegKeyEx SetupDiOpenClassRegKeyExW +#else +#define SetupDiOpenClassRegKeyEx SetupDiOpenClassRegKeyExA +#endif + + +WINSETUPAPI +HKEY +WINAPI +SetupDiCreateDeviceInterfaceRegKeyA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, + IN DWORD Reserved, + IN REGSAM samDesired, + IN HINF InfHandle, OPTIONAL + IN PCSTR InfSectionName OPTIONAL + ); + +WINSETUPAPI +HKEY +WINAPI +SetupDiCreateDeviceInterfaceRegKeyW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, + IN DWORD Reserved, + IN REGSAM samDesired, + IN HINF InfHandle, OPTIONAL + IN PCWSTR InfSectionName OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiCreateDeviceInterfaceRegKey SetupDiCreateDeviceInterfaceRegKeyW +#else +#define SetupDiCreateDeviceInterfaceRegKey SetupDiCreateDeviceInterfaceRegKeyA +#endif + +// +// Backward compatibility--do not use. +// +#define SetupDiCreateInterfaceDeviceRegKeyW SetupDiCreateDeviceInterfaceRegKeyW +#define SetupDiCreateInterfaceDeviceRegKeyA SetupDiCreateDeviceInterfaceRegKeyA +#ifdef UNICODE +#define SetupDiCreateInterfaceDeviceRegKey SetupDiCreateDeviceInterfaceRegKeyW +#else +#define SetupDiCreateInterfaceDeviceRegKey SetupDiCreateDeviceInterfaceRegKeyA +#endif + + +WINSETUPAPI +HKEY +WINAPI +SetupDiOpenDeviceInterfaceRegKey( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, + IN DWORD Reserved, + IN REGSAM samDesired + ); + +// +// Backward compatibility--do not use. +// +#define SetupDiOpenInterfaceDeviceRegKey SetupDiOpenDeviceInterfaceRegKey + + +WINSETUPAPI +BOOL +WINAPI +SetupDiDeleteDeviceInterfaceRegKey( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, + IN DWORD Reserved + ); + +// +// Backward compatibility--do not use. +// +#define SetupDiDeleteInterfaceDeviceRegKey SetupDiDeleteDeviceInterfaceRegKey + + +// +// KeyType values for SetupDiCreateDevRegKey, SetupDiOpenDevRegKey, and +// SetupDiDeleteDevRegKey. +// +#define DIREG_DEV 0x00000001 // Open/Create/Delete device key +#define DIREG_DRV 0x00000002 // Open/Create/Delete driver key +#define DIREG_BOTH 0x00000004 // Delete both driver and Device key + +WINSETUPAPI +HKEY +WINAPI +SetupDiCreateDevRegKeyA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Scope, + IN DWORD HwProfile, + IN DWORD KeyType, + IN HINF InfHandle, OPTIONAL + IN PCSTR InfSectionName OPTIONAL + ); + +WINSETUPAPI +HKEY +WINAPI +SetupDiCreateDevRegKeyW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Scope, + IN DWORD HwProfile, + IN DWORD KeyType, + IN HINF InfHandle, OPTIONAL + IN PCWSTR InfSectionName OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiCreateDevRegKey SetupDiCreateDevRegKeyW +#else +#define SetupDiCreateDevRegKey SetupDiCreateDevRegKeyA +#endif + + +WINSETUPAPI +HKEY +WINAPI +SetupDiOpenDevRegKey( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Scope, + IN DWORD HwProfile, + IN DWORD KeyType, + IN REGSAM samDesired + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiDeleteDevRegKey( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Scope, + IN DWORD HwProfile, + IN DWORD KeyType + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetHwProfileList( + OUT PDWORD HwProfileList, + IN DWORD HwProfileListSize, + OUT PDWORD RequiredSize, + OUT PDWORD CurrentlyActiveIndex OPTIONAL + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetHwProfileListExA( + OUT PDWORD HwProfileList, + IN DWORD HwProfileListSize, + OUT PDWORD RequiredSize, + OUT PDWORD CurrentlyActiveIndex, OPTIONAL + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetHwProfileListExW( + OUT PDWORD HwProfileList, + IN DWORD HwProfileListSize, + OUT PDWORD RequiredSize, + OUT PDWORD CurrentlyActiveIndex, OPTIONAL + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiGetHwProfileListEx SetupDiGetHwProfileListExW +#else +#define SetupDiGetHwProfileListEx SetupDiGetHwProfileListExA +#endif + + +// +// Device registry property codes +// (Codes marked as read-only (R) may only be used for +// SetupDiGetDeviceRegistryProperty) +// +// These values should cover the same set of registry properties +// as defined by the CM_DRP codes in cfgmgr32.h. +// +#define SPDRP_DEVICEDESC (0x00000000) // DeviceDesc (R/W) +#define SPDRP_HARDWAREID (0x00000001) // HardwareID (R/W) +#define SPDRP_COMPATIBLEIDS (0x00000002) // CompatibleIDs (R/W) +#define SPDRP_UNUSED0 (0x00000003) // unused +#define SPDRP_SERVICE (0x00000004) // Service (R/W) +#define SPDRP_UNUSED1 (0x00000005) // unused +#define SPDRP_UNUSED2 (0x00000006) // unused +#define SPDRP_CLASS (0x00000007) // Class (R--tied to ClassGUID) +#define SPDRP_CLASSGUID (0x00000008) // ClassGUID (R/W) +#define SPDRP_DRIVER (0x00000009) // Driver (R/W) +#define SPDRP_CONFIGFLAGS (0x0000000A) // ConfigFlags (R/W) +#define SPDRP_MFG (0x0000000B) // Mfg (R/W) +#define SPDRP_FRIENDLYNAME (0x0000000C) // FriendlyName (R/W) +#define SPDRP_LOCATION_INFORMATION (0x0000000D) // LocationInformation (R/W) +#define SPDRP_PHYSICAL_DEVICE_OBJECT_NAME (0x0000000E) // PhysicalDeviceObjectName (R) +#define SPDRP_CAPABILITIES (0x0000000F) // Capabilities (R) +#define SPDRP_UI_NUMBER (0x00000010) // UiNumber (R) +#define SPDRP_UPPERFILTERS (0x00000011) // UpperFilters (R/W) +#define SPDRP_LOWERFILTERS (0x00000012) // LowerFilters (R/W) +#define SPDRP_BUSTYPEGUID (0x00000013) // BusTypeGUID (R) +#define SPDRP_LEGACYBUSTYPE (0x00000014) // LegacyBusType (R) +#define SPDRP_BUSNUMBER (0x00000015) // BusNumber (R) +#define SPDRP_ENUMERATOR_NAME (0x00000016) // Enumerator Name (R) +#define SPDRP_SECURITY (0x00000017) // Security (R/W, binary form) +#define SPDRP_SECURITY_SDS (0x00000018) // Security (W, SDS form) +#define SPDRP_DEVTYPE (0x00000019) // Device Type (R/W) +#define SPDRP_EXCLUSIVE (0x0000001A) // Device is exclusive-access (R/W) +#define SPDRP_CHARACTERISTICS (0x0000001B) // Device Characteristics (R/W) +#define SPDRP_ADDRESS (0x0000001C) // Device Address (R) +#define SPDRP_UI_NUMBER_DESC_FORMAT (0X0000001E) // UiNumberDescFormat (R/W) +#define SPDRP_MAXIMUM_PROPERTY (0x0000001F) // Upper bound on ordinals +// +// Class registry property codes +// (Codes marked as read-only (R) may only be used for +// SetupDiGetClassRegistryProperty) +// +// These values should cover the same set of registry properties +// as defined by the CM_CRP codes in cfgmgr32.h. +// they should also have a 1:1 correspondence with Device registers, where applicable +// but no overlap otherwise +// +#define SPCRP_SECURITY (0x00000017) // Security (R/W, binary form) +#define SPCRP_SECURITY_SDS (0x00000018) // Security (W, SDS form) +#define SPCRP_DEVTYPE (0x00000019) // Device Type (R/W) +#define SPCRP_EXCLUSIVE (0x0000001A) // Device is exclusive-access (R/W) +#define SPCRP_CHARACTERISTICS (0x0000001B) // Device Characteristics (R/W) +#define SPCRP_MAXIMUM_PROPERTY (0x0000001C) // Upper bound on ordinals + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceRegistryPropertyA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Property, + OUT PDWORD PropertyRegDataType, OPTIONAL + OUT PBYTE PropertyBuffer, + IN DWORD PropertyBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceRegistryPropertyW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Property, + OUT PDWORD PropertyRegDataType, OPTIONAL + OUT PBYTE PropertyBuffer, + IN DWORD PropertyBufferSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetDeviceRegistryProperty SetupDiGetDeviceRegistryPropertyW +#else +#define SetupDiGetDeviceRegistryProperty SetupDiGetDeviceRegistryPropertyA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassRegistryPropertyA( + IN LPGUID ClassGuid, + IN DWORD Property, + OUT PDWORD PropertyRegDataType, OPTIONAL + OUT PBYTE PropertyBuffer, + IN DWORD PropertyBufferSize, + OUT PDWORD RequiredSize, OPTIONAL + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassRegistryPropertyW( + IN LPGUID ClassGuid, + IN DWORD Property, + OUT PDWORD PropertyRegDataType, OPTIONAL + OUT PBYTE PropertyBuffer, + IN DWORD PropertyBufferSize, + OUT PDWORD RequiredSize, OPTIONAL + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiGetClassRegistryProperty SetupDiGetClassRegistryPropertyW +#else +#define SetupDiGetClassRegistryProperty SetupDiGetClassRegistryPropertyA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetDeviceRegistryPropertyA( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Property, + IN CONST BYTE* PropertyBuffer, OPTIONAL + IN DWORD PropertyBufferSize + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetDeviceRegistryPropertyW( + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData, + IN DWORD Property, + IN CONST BYTE* PropertyBuffer, OPTIONAL + IN DWORD PropertyBufferSize + ); + +#ifdef UNICODE +#define SetupDiSetDeviceRegistryProperty SetupDiSetDeviceRegistryPropertyW +#else +#define SetupDiSetDeviceRegistryProperty SetupDiSetDeviceRegistryPropertyA +#endif + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetClassRegistryPropertyA( + IN LPGUID ClassGuid, + IN DWORD Property, + IN CONST BYTE* PropertyBuffer, OPTIONAL + IN DWORD PropertyBufferSize, + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetClassRegistryPropertyW( + IN LPGUID ClassGuid, + IN DWORD Property, + IN CONST BYTE* PropertyBuffer, OPTIONAL + IN DWORD PropertyBufferSize, + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiSetClassRegistryProperty SetupDiSetClassRegistryPropertyW +#else +#define SetupDiSetClassRegistryProperty SetupDiSetClassRegistryPropertyA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInstallParamsA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + OUT PSP_DEVINSTALL_PARAMS_A DeviceInstallParams + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDeviceInstallParamsW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams + ); + +#ifdef UNICODE +#define SetupDiGetDeviceInstallParams SetupDiGetDeviceInstallParamsW +#else +#define SetupDiGetDeviceInstallParams SetupDiGetDeviceInstallParamsA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassInstallParamsA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + OUT PSP_CLASSINSTALL_HEADER ClassInstallParams, OPTIONAL + IN DWORD ClassInstallParamsSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassInstallParamsW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + OUT PSP_CLASSINSTALL_HEADER ClassInstallParams, OPTIONAL + IN DWORD ClassInstallParamsSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetClassInstallParams SetupDiGetClassInstallParamsW +#else +#define SetupDiGetClassInstallParams SetupDiGetClassInstallParamsA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetDeviceInstallParamsA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_DEVINSTALL_PARAMS_A DeviceInstallParams + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetDeviceInstallParamsW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams + ); + +#ifdef UNICODE +#define SetupDiSetDeviceInstallParams SetupDiSetDeviceInstallParamsW +#else +#define SetupDiSetDeviceInstallParams SetupDiSetDeviceInstallParamsA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetClassInstallParamsA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_CLASSINSTALL_HEADER ClassInstallParams, OPTIONAL + IN DWORD ClassInstallParamsSize + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetClassInstallParamsW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_CLASSINSTALL_HEADER ClassInstallParams, OPTIONAL + IN DWORD ClassInstallParamsSize + ); + +#ifdef UNICODE +#define SetupDiSetClassInstallParams SetupDiSetClassInstallParamsW +#else +#define SetupDiSetClassInstallParams SetupDiSetClassInstallParamsA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDriverInstallParamsA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_DRVINFO_DATA_A DriverInfoData, + OUT PSP_DRVINSTALL_PARAMS DriverInstallParams + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetDriverInstallParamsW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_DRVINFO_DATA_W DriverInfoData, + OUT PSP_DRVINSTALL_PARAMS DriverInstallParams + ); + +#ifdef UNICODE +#define SetupDiGetDriverInstallParams SetupDiGetDriverInstallParamsW +#else +#define SetupDiGetDriverInstallParams SetupDiGetDriverInstallParamsA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetDriverInstallParamsA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_DRVINFO_DATA_A DriverInfoData, + IN PSP_DRVINSTALL_PARAMS DriverInstallParams + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetDriverInstallParamsW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_DRVINFO_DATA_W DriverInfoData, + IN PSP_DRVINSTALL_PARAMS DriverInstallParams + ); + +#ifdef UNICODE +#define SetupDiSetDriverInstallParams SetupDiSetDriverInstallParamsW +#else +#define SetupDiSetDriverInstallParams SetupDiSetDriverInstallParamsA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiLoadClassIcon( + IN CONST GUID *ClassGuid, + OUT HICON *LargeIcon, OPTIONAL + OUT PINT MiniIconIndex OPTIONAL + ); + + +// +// Flags controlling the drawing of mini-icons +// +#define DMI_MASK 0x00000001 +#define DMI_BKCOLOR 0x00000002 +#define DMI_USERECT 0x00000004 + +WINSETUPAPI +INT +WINAPI +SetupDiDrawMiniIcon( + IN HDC hdc, + IN RECT rc, + IN INT MiniIconIndex, + IN DWORD Flags + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassBitmapIndex( + IN CONST GUID *ClassGuid, OPTIONAL + OUT PINT MiniIconIndex + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassImageList( + OUT PSP_CLASSIMAGELIST_DATA ClassImageListData + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassImageListExA( + OUT PSP_CLASSIMAGELIST_DATA ClassImageListData, + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassImageListExW( + OUT PSP_CLASSIMAGELIST_DATA ClassImageListData, + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiGetClassImageListEx SetupDiGetClassImageListExW +#else +#define SetupDiGetClassImageListEx SetupDiGetClassImageListExA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassImageIndex( + IN PSP_CLASSIMAGELIST_DATA ClassImageListData, + IN CONST GUID *ClassGuid, + OUT PINT ImageIndex + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiDestroyClassImageList( + IN PSP_CLASSIMAGELIST_DATA ClassImageListData + ); + + +// +// PropertySheetType values for the SetupDiGetClassDevPropertySheets API +// +#define DIGCDP_FLAG_BASIC 0x00000001 +#define DIGCDP_FLAG_ADVANCED 0x00000002 + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassDevPropertySheetsA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN LPPROPSHEETHEADERA PropertySheetHeader, + IN DWORD PropertySheetHeaderPageListSize, + OUT PDWORD RequiredSize, OPTIONAL + IN DWORD PropertySheetType + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetClassDevPropertySheetsW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN LPPROPSHEETHEADERW PropertySheetHeader, + IN DWORD PropertySheetHeaderPageListSize, + OUT PDWORD RequiredSize, OPTIONAL + IN DWORD PropertySheetType + ); + +#ifdef UNICODE +#define SetupDiGetClassDevPropertySheets SetupDiGetClassDevPropertySheetsW +#else +#define SetupDiGetClassDevPropertySheets SetupDiGetClassDevPropertySheetsA +#endif + + +// +// Define ICON IDs publicly exposed from setupapi. +// +#define IDI_RESOURCEFIRST 159 +#define IDI_RESOURCE 159 +#define IDI_RESOURCELAST 161 +#define IDI_RESOURCEOVERLAYFIRST 161 +#define IDI_RESOURCEOVERLAYLAST 161 +#define IDI_CONFLICT 161 + +#define IDI_CLASSICON_OVERLAYFIRST 500 +#define IDI_CLASSICON_OVERLAYLAST 502 +#define IDI_PROBLEM_OVL 500 +#define IDI_DISABLED_OVL 501 +#define IDI_FORCED_OVL 502 + + +WINSETUPAPI +BOOL +WINAPI +SetupDiAskForOEMDisk( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiSelectOEMDrv( + IN HWND hwndParent, OPTIONAL + IN HDEVINFO DeviceInfoSet, + IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiClassNameFromGuidA( + IN CONST GUID *ClassGuid, + OUT PSTR ClassName, + IN DWORD ClassNameSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiClassNameFromGuidW( + IN CONST GUID *ClassGuid, + OUT PWSTR ClassName, + IN DWORD ClassNameSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiClassNameFromGuid SetupDiClassNameFromGuidW +#else +#define SetupDiClassNameFromGuid SetupDiClassNameFromGuidA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiClassNameFromGuidExA( + IN CONST GUID *ClassGuid, + OUT PSTR ClassName, + IN DWORD ClassNameSize, + OUT PDWORD RequiredSize, OPTIONAL + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiClassNameFromGuidExW( + IN CONST GUID *ClassGuid, + OUT PWSTR ClassName, + IN DWORD ClassNameSize, + OUT PDWORD RequiredSize, OPTIONAL + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiClassNameFromGuidEx SetupDiClassNameFromGuidExW +#else +#define SetupDiClassNameFromGuidEx SetupDiClassNameFromGuidExA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiClassGuidsFromNameA( + IN PCSTR ClassName, + OUT LPGUID ClassGuidList, + IN DWORD ClassGuidListSize, + OUT PDWORD RequiredSize + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiClassGuidsFromNameW( + IN PCWSTR ClassName, + OUT LPGUID ClassGuidList, + IN DWORD ClassGuidListSize, + OUT PDWORD RequiredSize + ); + +#ifdef UNICODE +#define SetupDiClassGuidsFromName SetupDiClassGuidsFromNameW +#else +#define SetupDiClassGuidsFromName SetupDiClassGuidsFromNameA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiClassGuidsFromNameExA( + IN PCSTR ClassName, + OUT LPGUID ClassGuidList, + IN DWORD ClassGuidListSize, + OUT PDWORD RequiredSize, + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiClassGuidsFromNameExW( + IN PCWSTR ClassName, + OUT LPGUID ClassGuidList, + IN DWORD ClassGuidListSize, + OUT PDWORD RequiredSize, + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiClassGuidsFromNameEx SetupDiClassGuidsFromNameExW +#else +#define SetupDiClassGuidsFromNameEx SetupDiClassGuidsFromNameExA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetHwProfileFriendlyNameA( + IN DWORD HwProfile, + OUT PSTR FriendlyName, + IN DWORD FriendlyNameSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetHwProfileFriendlyNameW( + IN DWORD HwProfile, + OUT PWSTR FriendlyName, + IN DWORD FriendlyNameSize, + OUT PDWORD RequiredSize OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetHwProfileFriendlyName SetupDiGetHwProfileFriendlyNameW +#else +#define SetupDiGetHwProfileFriendlyName SetupDiGetHwProfileFriendlyNameA +#endif + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetHwProfileFriendlyNameExA( + IN DWORD HwProfile, + OUT PSTR FriendlyName, + IN DWORD FriendlyNameSize, + OUT PDWORD RequiredSize, OPTIONAL + IN PCSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetHwProfileFriendlyNameExW( + IN DWORD HwProfile, + OUT PWSTR FriendlyName, + IN DWORD FriendlyNameSize, + OUT PDWORD RequiredSize, OPTIONAL + IN PCWSTR MachineName, OPTIONAL + IN PVOID Reserved + ); + +#ifdef UNICODE +#define SetupDiGetHwProfileFriendlyNameEx SetupDiGetHwProfileFriendlyNameExW +#else +#define SetupDiGetHwProfileFriendlyNameEx SetupDiGetHwProfileFriendlyNameExA +#endif + + +// +// PageType values for SetupDiGetWizardPage API +// +#define SPWPT_SELECTDEVICE 0x00000001 + +// +// Flags for SetupDiGetWizardPage API +// +#define SPWP_USE_DEVINFO_DATA 0x00000001 + +WINSETUPAPI +HPROPSHEETPAGE +WINAPI +SetupDiGetWizardPage( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL + IN PSP_INSTALLWIZARD_DATA InstallWizardData, + IN DWORD PageType, + IN DWORD Flags + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetSelectedDevice( + IN HDEVINFO DeviceInfoSet, + OUT PSP_DEVINFO_DATA DeviceInfoData + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiSetSelectedDevice( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData + ); + + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetActualSectionToInstallA( + IN HINF InfHandle, + IN PCSTR InfSectionName, + OUT PSTR InfSectionWithExt, OPTIONAL + IN DWORD InfSectionWithExtSize, + OUT PDWORD RequiredSize, OPTIONAL + OUT PSTR *Extension OPTIONAL + ); + +WINSETUPAPI +BOOL +WINAPI +SetupDiGetActualSectionToInstallW( + IN HINF InfHandle, + IN PCWSTR InfSectionName, + OUT PWSTR InfSectionWithExt, OPTIONAL + IN DWORD InfSectionWithExtSize, + OUT PDWORD RequiredSize, OPTIONAL + OUT PWSTR *Extension OPTIONAL + ); + +#ifdef UNICODE +#define SetupDiGetActualSectionToInstall SetupDiGetActualSectionToInstallW +#else +#define SetupDiGetActualSectionToInstall SetupDiGetActualSectionToInstallA +#endif + + +#ifdef __cplusplus +} +#endif + +#include + +#endif // _INC_SETUPAPI + + diff --git a/stepmania/src/archutils/Win32/ddk/setupapi.lib b/stepmania/src/archutils/Win32/ddk/setupapi.lib new file mode 100644 index 0000000000..a0be46975d Binary files /dev/null and b/stepmania/src/archutils/Win32/ddk/setupapi.lib differ