?? setupapi.pas
字號:
{******************************************************************}
{ }
{ Borland Delphi Runtime Library }
{ Setup and Device Installer API interface unit }
{ }
{ Portions created by Microsoft are }
{ Copyright (C) 1995-1999 Microsoft Corporation. }
{ All Rights Reserved. }
{ }
{ The original file is: setupapi.h, released March 1999. }
{ The original Pascal code is: SetupApi.pas, released 29 Jan 2000. }
{ The initial developer of the Pascal code is Robert Marquardt }
{ (robert_marquardt@gmx.de) }
{ }
{ Portions created by Robert Marquardt are }
{ Copyright (C) 1999 Robert Marquardt. }
{ }
{ Contributor(s): Marcel van Brakel (brakelm@bart.nl) }
{ }
{ Obtained through: }
{ Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project }
{ JEDI home page, located at http://delphi-jedi.org }
{ }
{ The contents of this file are used with permission, subject to }
{ the Mozilla Public License Version 1.1 (the "License"); you may }
{ not use this file except in compliance with the License. You may }
{ obtain a copy of the License at }
{ http://www.mozilla.org/NPL/NPL-1_1Final.html }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }
{ implied. See the License for the specific language governing }
{ rights and limitations under the License. }
{ }
{******************************************************************}
unit SetupApi;
{$WEAKPACKAGEUNIT}
interface
(*$HPPEMIT ''*)
(*$HPPEMIT '#include "setupapi.h"'*)
(*$HPPEMIT ''*)
uses
Windows, Commctrl;
type
PPWSTR = ^PWideChar;
PPASTR = ^PAnsiChar;
PPSTR = ^PChar;
PHICON = ^HICON;
ULONG_PTR = DWORD;
DWORD_PTR = DWORD;
UINT_PTR = DWORD;
const
ANYSIZE_ARRAY = 1;
//
// Define maximum string length constants as specified by
// Windows 95.
//
const
LINE_LEN = 256; // Win95-compatible maximum for displayable
{$EXTERNALSYM LINE_LEN}
// strings coming from a device INF.
MAX_INF_STRING_LENGTH = 4096; // Actual maximum size of an INF string
{$EXTERNALSYM MAX_INF_STRING_LENGTH}
// (including string substitutions).
MAX_TITLE_LEN = 60;
{$EXTERNALSYM MAX_TITLE_LEN}
MAX_INSTRUCTION_LEN = 256;
{$EXTERNALSYM MAX_INSTRUCTION_LEN}
MAX_LABEL_LEN = 30;
{$EXTERNALSYM MAX_LABEL_LEN}
MAX_SERVICE_NAME_LEN = 256;
{$EXTERNALSYM MAX_SERVICE_NAME_LEN}
MAX_SUBTITLE_LEN = 256;
{$EXTERNALSYM MAX_SUBTITLE_LEN}
//
// Define maximum length of a machine name in the format expected by ConfigMgr32
// CM_Connect_Machine (i.e., "\\\\MachineName\0").
//
SP_MAX_MACHINENAME_LENGTH = (MAX_PATH + 3);
{$EXTERNALSYM SP_MAX_MACHINENAME_LENGTH}
//
// Define type for reference to loaded inf file
//
type
HINF = Pointer;
{$EXTERNALSYM HINF}
//
// Inf context structure. Applications must not interpret or
// overwrite values in these structures.
//
PInfContext = ^TInfContext;
_INFCONTEXT = packed record
Inf: Pointer;
CurrentInf: Pointer;
Section: UINT;
Line: UINT;
end;
{$EXTERNALSYM _INFCONTEXT}
TInfContext = _INFCONTEXT;
//
// Inf file information structure.
//
PSPInfInformation = ^TSPInfInformation;
_SP_INF_INFORMATION = packed record
InfStyle: DWORD;
InfCount: DWORD;
VersionData: array [0..ANYSIZE_ARRAY - 1] of Byte;
end;
{$EXTERNALSYM _SP_INF_INFORMATION}
TSPInfInformation = _SP_INF_INFORMATION;
//
// Define structure for passing alternate platform info into
// SetupSetFileQueueAlternatePlatform and SetupQueryInfOriginalFileInformation.
//
PSPAltPlatformInfo = ^TSPAltPlatformInfo;
_SP_ALTPLATFORM_INFO = packed record
cbSize: DWORD;
//
// platform to use (VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT)
//
Platform: DWORD;
//
// major and minor version numbers to use
//
MajorVersion: DWORD;
MinorVersion: DWORD;
//
// processor architecture to use (PROCESSOR_ARCHITECTURE_INTEL,
// PROCESSOR_ARCHITECTURE_ALPHA, PROCESSOR_ARCHITECTURE_IA64, or
// PROCESSOR_ARCHITECTURE_ALPHA64)
//
ProcessorArchitecture: Word;
Reserved: Word; // must be zero.
end;
{$EXTERNALSYM _SP_ALTPLATFORM_INFO}
TSPAltPlatformInfo = _SP_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.
//
PSPOriginalFileInfoA = ^TSPOriginalFileInfoA;
PSPOriginalFileInfoW = ^TSPOriginalFileInfoW;
PSPOriginalFileInfo = PSPOriginalFileInfoA;
_SP_ORIGINAL_FILE_INFO_A = packed record
cbSize: DWORD;
OriginalInfName: array [0..MAX_PATH - 1] of AnsiChar;
OriginalCatalogName: array [0..MAX_PATH - 1] of AnsiChar;
end;
{$EXTERNALSYM _SP_ORIGINAL_FILE_INFO_A}
_SP_ORIGINAL_FILE_INFO_W = packed record
cbSize: DWORD;
OriginalInfName: array [0..MAX_PATH - 1] of WideChar;
OriginalCatalogName: array [0..MAX_PATH - 1] of WideChar;
end;
{$EXTERNALSYM _SP_ORIGINAL_FILE_INFO_W}
_SP_ORIGINAL_FILE_INFO_ = _SP_ORIGINAL_FILE_INFO_A;
TSPOriginalFileInfoA = _SP_ORIGINAL_FILE_INFO_A;
TSPOriginalFileInfoW = _SP_ORIGINAL_FILE_INFO_W;
TSPOriginalFileInfo = TSPOriginalFileInfoA;
//
// SP_INF_INFORMATION.InfStyle values
//
const
INF_STYLE_NONE = $00000000; // unrecognized or non-existent
{$EXTERNALSYM INF_STYLE_NONE}
INF_STYLE_OLDNT = $00000001; // winnt 3.x
{$EXTERNALSYM INF_STYLE_OLDNT}
INF_STYLE_WIN4 = $00000002; // Win95
{$EXTERNALSYM INF_STYLE_WIN4}
//
// Additional InfStyle flags that may be specified when calling SetupOpenInfFile.
//
//
INF_STYLE_CACHE_ENABLE = $00000010; // always cache INF, even outside of %windir%\Inf
{$EXTERNALSYM INF_STYLE_CACHE_ENABLE}
INF_STYLE_CACHE_DISABLE = $00000020; // delete cached INF information
{$EXTERNALSYM INF_STYLE_CACHE_DISABLE}
//
// Target directory specs.
//
DIRID_ABSOLUTE = DWORD(-1); // real 32-bit -1
{$EXTERNALSYM DIRID_ABSOLUTE}
DIRID_ABSOLUTE_16BIT = $FFFF; // 16-bit -1 for compat w/setupx
{$EXTERNALSYM DIRID_ABSOLUTE_16BIT}
DIRID_NULL = 0;
{$EXTERNALSYM DIRID_NULL}
DIRID_SRCPATH = 1;
{$EXTERNALSYM DIRID_SRCPATH}
DIRID_WINDOWS = 10;
{$EXTERNALSYM DIRID_WINDOWS}
DIRID_SYSTEM = 11; // system32
{$EXTERNALSYM DIRID_SYSTEM}
DIRID_DRIVERS = 12;
{$EXTERNALSYM DIRID_DRIVERS}
DIRID_IOSUBSYS = DIRID_DRIVERS;
{$EXTERNALSYM DIRID_IOSUBSYS}
DIRID_INF = 17;
{$EXTERNALSYM DIRID_INF}
DIRID_HELP = 18;
{$EXTERNALSYM DIRID_HELP}
DIRID_FONTS = 20;
{$EXTERNALSYM DIRID_FONTS}
DIRID_VIEWERS = 21;
{$EXTERNALSYM DIRID_VIEWERS}
DIRID_COLOR = 23;
{$EXTERNALSYM DIRID_COLOR}
DIRID_APPS = 24;
{$EXTERNALSYM DIRID_APPS}
DIRID_SHARED = 25;
{$EXTERNALSYM DIRID_SHARED}
DIRID_BOOT = 30;
{$EXTERNALSYM DIRID_BOOT}
DIRID_SYSTEM16 = 50;
{$EXTERNALSYM DIRID_SYSTEM16}
DIRID_SPOOL = 51;
{$EXTERNALSYM DIRID_SPOOL}
DIRID_SPOOLDRIVERS = 52;
{$EXTERNALSYM DIRID_SPOOLDRIVERS}
DIRID_USERPROFILE = 53;
{$EXTERNALSYM DIRID_USERPROFILE}
DIRID_LOADER = 54;
{$EXTERNALSYM DIRID_LOADER}
DIRID_PRINTPROCESSOR = 55;
{$EXTERNALSYM DIRID_PRINTPROCESSOR}
DIRID_DEFAULT = DIRID_SYSTEM;
{$EXTERNALSYM DIRID_DEFAULT}
//
// 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.)
//
DIRID_COMMON_STARTMENU = 16406; // All Users\Start Menu
{$EXTERNALSYM DIRID_COMMON_STARTMENU}
DIRID_COMMON_PROGRAMS = 16407; // All Users\Start Menu\Programs
{$EXTERNALSYM DIRID_COMMON_PROGRAMS}
DIRID_COMMON_STARTUP = 16408; // All Users\Start Menu\Programs\Startup
{$EXTERNALSYM DIRID_COMMON_STARTUP}
DIRID_COMMON_DESKTOPDIRECTORY = 16409; // All Users\Desktop
{$EXTERNALSYM DIRID_COMMON_DESKTOPDIRECTORY}
DIRID_COMMON_FAVORITES = 16415; // All Users\Favorites
{$EXTERNALSYM DIRID_COMMON_FAVORITES}
DIRID_COMMON_APPDATA = 16419; // All Users\Application Data
{$EXTERNALSYM DIRID_COMMON_APPDATA}
DIRID_PROGRAM_FILES = 16422; // Program Files
{$EXTERNALSYM DIRID_PROGRAM_FILES}
DIRID_SYSTEM_X86 = 16425; // system32 on RISC
{$EXTERNALSYM DIRID_SYSTEM_X86}
DIRID_PROGRAM_FILES_X86 = 16426; // Program Files on RISC
{$EXTERNALSYM DIRID_PROGRAM_FILES_X86}
DIRID_PROGRAM_FILES_COMMON = 16427; // Program Files\Common
{$EXTERNALSYM DIRID_PROGRAM_FILES_COMMON}
DIRID_PROGRAM_FILES_COMMONX86 = 16428; // x86 Program Files\Common on RISC
{$EXTERNALSYM DIRID_PROGRAM_FILES_COMMONX86}
DIRID_COMMON_TEMPLATES = 16429; // All Users\Templates
{$EXTERNALSYM DIRID_COMMON_TEMPLATES}
DIRID_COMMON_DOCUMENTS = 16430; // All Users\Documents
{$EXTERNALSYM DIRID_COMMON_DOCUMENTS}
//
// First user-definable dirid. See SetupSetDirectoryId().
//
DIRID_USER = $8000;
{$EXTERNALSYM DIRID_USER}
//
// Setup callback notification routine type
//
type
TSPFileCallbackA = function (Context: Pointer; Notification: UINT;
Param1, Param2: UINT_PTR): UINT; stdcall;
TSPFileCallbackW = function (Context: Pointer; Notification: UINT;
Param1, Param2: UINT_PTR): UINT; stdcall;
TSPFileCallback = TSPFileCallbackA;
//
// Operation/queue start/end notification. These are ordinal values.
//
const
SPFILENOTIFY_STARTQUEUE = $00000001;
{$EXTERNALSYM SPFILENOTIFY_STARTQUEUE}
SPFILENOTIFY_ENDQUEUE = $00000002;
{$EXTERNALSYM SPFILENOTIFY_ENDQUEUE}
SPFILENOTIFY_STARTSUBQUEUE = $00000003;
{$EXTERNALSYM SPFILENOTIFY_STARTSUBQUEUE}
SPFILENOTIFY_ENDSUBQUEUE = $00000004;
{$EXTERNALSYM SPFILENOTIFY_ENDSUBQUEUE}
SPFILENOTIFY_STARTDELETE = $00000005;
{$EXTERNALSYM SPFILENOTIFY_STARTDELETE}
SPFILENOTIFY_ENDDELETE = $00000006;
{$EXTERNALSYM SPFILENOTIFY_ENDDELETE}
SPFILENOTIFY_DELETEERROR = $00000007;
{$EXTERNALSYM SPFILENOTIFY_DELETEERROR}
SPFILENOTIFY_STARTRENAME = $00000008;
{$EXTERNALSYM SPFILENOTIFY_STARTRENAME}
SPFILENOTIFY_ENDRENAME = $00000009;
{$EXTERNALSYM SPFILENOTIFY_ENDRENAME}
SPFILENOTIFY_RENAMEERROR = $0000000a;
{$EXTERNALSYM SPFILENOTIFY_RENAMEERROR}
SPFILENOTIFY_STARTCOPY = $0000000b;
{$EXTERNALSYM SPFILENOTIFY_STARTCOPY}
SPFILENOTIFY_ENDCOPY = $0000000c;
{$EXTERNALSYM SPFILENOTIFY_ENDCOPY}
SPFILENOTIFY_COPYERROR = $0000000d;
{$EXTERNALSYM SPFILENOTIFY_COPYERROR}
SPFILENOTIFY_NEEDMEDIA = $0000000e;
{$EXTERNALSYM SPFILENOTIFY_NEEDMEDIA}
SPFILENOTIFY_QUEUESCAN = $0000000f;
{$EXTERNALSYM SPFILENOTIFY_QUEUESCAN}
//
// These are used with SetupIterateCabinet().
//
SPFILENOTIFY_CABINETINFO = $00000010;
{$EXTERNALSYM SPFILENOTIFY_CABINETINFO}
SPFILENOTIFY_FILEINCABINET = $00000011;
{$EXTERNALSYM SPFILENOTIFY_FILEINCABINET}
SPFILENOTIFY_NEEDNEWCABINET = $00000012;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -