📄 jwamsiquery.pas
字号:
{******************************************************************************}
{ }
{ Windows Installer API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: msiquery.h, released June 2000. The original Pascal }
{ code is: MsiQuery.pas, released June 2001. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ 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 or my personal homepage located at }
{ http://members.chello.nl/m.vanbrakel2 }
{ }
{ 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/MPL/MPL-1.1.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. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
unit JwaMsiQuery;
{$WEAKPACKAGEUNIT}
{$HPPEMIT ''}
{$HPPEMIT '#include "msiquery.h"'}
{$HPPEMIT ''}
{$I WINDEFINES.INC}
interface
uses
JwaMsi, JwaWinBase, JwaWinType;
(*****************************************************************************\
* *
* MsiQuery.h - Interface to running installer for custom actions and tools *
* *
* Version 1.0 - 1.2 *
* *
* NOTES: All buffers sizes are TCHAR count, null included only on input *
* Return argument pointers may be null if not interested in value *
* Returned handles of all types must be closed: MsiCloseHandle(h) *
* Functions with UINT return type return a system error code *
* Designated functions will set or clear the last error record, *
* which is then accessible with MsiGetLastErrorRecord. However, *
* the following argument errors do not register an error record: *
* ERROR_INVALID_HANDLE, ERROR_INVALID_PARAMETER, ERROR_MORE_DATA. *
* *
* Copyright (c) 1999-2000, Microsoft Corp. All rights reserved. *
* *
\*****************************************************************************)
const
MSI_NULL_INTEGER = DWORD($80000000); // integer value reserved for null
{$EXTERNALSYM MSI_NULL_INTEGER}
// MsiOpenDatabase persist predefine values, otherwise output database path is used
MSIDBOPEN_READONLY = LPCTSTR(0); // database open read-only, no persistent changes
{$EXTERNALSYM MSIDBOPEN_READONLY}
MSIDBOPEN_TRANSACT = LPCTSTR(1); // database read/write in transaction mode
{$EXTERNALSYM MSIDBOPEN_TRANSACT}
MSIDBOPEN_DIRECT = LPCTSTR(2); // database direct read/write without transaction
{$EXTERNALSYM MSIDBOPEN_DIRECT}
MSIDBOPEN_CREATE = LPCTSTR(3); // create new database, transact mode read/write
{$EXTERNALSYM MSIDBOPEN_CREATE}
MSIDBOPEN_CREATEDIRECT = LPCTSTR(4); // create new database, direct mode read/write
{$EXTERNALSYM MSIDBOPEN_CREATEDIRECT}
{$IFDEF UNICODE}
MSIDBOPEN_PATCHFILE = 32 div SizeOf(WideChar); // add flag to indicate patch file
{$ELSE}
MSIDBOPEN_PATCHFILE = 32 div SizeOf(AnsiChar); // add flag to indicate patch file
{$ENDIF}
MSIDBSTATE_ERROR = DWORD(-1); // invalid database handle
{$EXTERNALSYM MSIDBSTATE_ERROR}
MSIDBSTATE_READ = 0; // database open read-only, no persistent changes
{$EXTERNALSYM MSIDBSTATE_READ}
MSIDBSTATE_WRITE = 1; // database readable and updatable
{$EXTERNALSYM MSIDBSTATE_WRITE}
type
MSIDBSTATE = DWORD;
{$EXTERNALSYM MSIDBSTATE}
TMsiDbState = MSIDBSTATE;
const
MSIMODIFY_SEEK = DWORD(-1); // reposition to current record primary key
{$EXTERNALSYM MSIMODIFY_SEEK}
MSIMODIFY_REFRESH = 0; // refetch current record data
{$EXTERNALSYM MSIMODIFY_REFRESH}
MSIMODIFY_INSERT = 1; // insert new record, fails if matching key exists
{$EXTERNALSYM MSIMODIFY_INSERT}
MSIMODIFY_UPDATE = 2; // update existing non-key data of fetched record
{$EXTERNALSYM MSIMODIFY_UPDATE}
MSIMODIFY_ASSIGN = 3; // insert record, replacing any existing record
{$EXTERNALSYM MSIMODIFY_ASSIGN}
MSIMODIFY_REPLACE = 4; // update record, delete old if primary key edit
{$EXTERNALSYM MSIMODIFY_REPLACE}
MSIMODIFY_MERGE = 5; // fails if record with duplicate key not identical
{$EXTERNALSYM MSIMODIFY_MERGE}
MSIMODIFY_DELETE = 6; // remove row referenced by this record from table
{$EXTERNALSYM MSIMODIFY_DELETE}
MSIMODIFY_INSERT_TEMPORARY = 7; // insert a temporary record
{$EXTERNALSYM MSIMODIFY_INSERT_TEMPORARY}
MSIMODIFY_VALIDATE = 8; // validate a fetched record
{$EXTERNALSYM MSIMODIFY_VALIDATE}
MSIMODIFY_VALIDATE_NEW = 9; // validate a new record
{$EXTERNALSYM MSIMODIFY_VALIDATE_NEW}
MSIMODIFY_VALIDATE_FIELD = 10; // validate field(s) of an incomplete record
{$EXTERNALSYM MSIMODIFY_VALIDATE_FIELD}
MSIMODIFY_VALIDATE_DELETE = 11; // validate before deleting record
{$EXTERNALSYM MSIMODIFY_VALIDATE_DELETE}
type
MSIMODIFY = DWORD;
{$EXTERNALSYM MSIMODIFY}
TMsiModify = MSIMODIFY;
const
MSICOLINFO_NAMES = 0; // return column names
{$EXTERNALSYM MSICOLINFO_NAMES}
MSICOLINFO_TYPES = 1; // return column definitions, datatype code followed by width
{$EXTERNALSYM MSICOLINFO_TYPES}
type
MSICOLINFO = DWORD;
{$EXTERNALSYM MSICOLINFO}
TMsiColInfo = MSICOLINFO;
const
MSICONDITION_FALSE = 0; // expression evaluates to False
{$EXTERNALSYM MSICONDITION_FALSE}
MSICONDITION_TRUE = 1; // expression evaluates to True
{$EXTERNALSYM MSICONDITION_TRUE}
MSICONDITION_NONE = 2; // no expression present
{$EXTERNALSYM MSICONDITION_NONE}
MSICONDITION_ERROR = 3; // syntax error in expression
{$EXTERNALSYM MSICONDITION_ERROR}
type
MSICONDITION = DWORD;
{$EXTERNALSYM MSICONDITION}
TMsiCondition = MSICONDITION;
const
MSICOSTTREE_SELFONLY = 0;
{$EXTERNALSYM MSICOSTTREE_SELFONLY}
MSICOSTTREE_CHILDREN = 1;
{$EXTERNALSYM MSICOSTTREE_CHILDREN}
MSICOSTTREE_PARENTS = 2;
{$EXTERNALSYM MSICOSTTREE_PARENTS}
MSICOSTTREE_RESERVED = 3; // Reserved for future use
{$EXTERNALSYM MSICOSTTREE_RESERVED}
type
MSICOSTTREE = DWORD;
{$EXTERNALSYM MSICOSTTREE}
TMsiCostTree = MSICOSTTREE;
const
MSIDBERROR_INVALIDARG = DWORD(-3); // invalid argument
{$EXTERNALSYM MSIDBERROR_INVALIDARG}
MSIDBERROR_MOREDATA = DWORD(-2); // buffer too small
{$EXTERNALSYM MSIDBERROR_MOREDATA}
MSIDBERROR_FUNCTIONERROR = DWORD(-1); // function error
{$EXTERNALSYM MSIDBERROR_FUNCTIONERROR}
MSIDBERROR_NOERROR = 0; // no error
{$EXTERNALSYM MSIDBERROR_NOERROR}
MSIDBERROR_DUPLICATEKEY = 1; // new record duplicates primary keys of existing record in table
{$EXTERNALSYM MSIDBERROR_DUPLICATEKEY}
MSIDBERROR_REQUIRED = 2; // non-nullable column, no null values allowed
{$EXTERNALSYM MSIDBERROR_REQUIRED}
MSIDBERROR_BADLINK = 3; // corresponding record in foreign table not found
{$EXTERNALSYM MSIDBERROR_BADLINK}
MSIDBERROR_OVERFLOW = 4; // data greater than maximum value allowed
{$EXTERNALSYM MSIDBERROR_OVERFLOW}
MSIDBERROR_UNDERFLOW = 5; // data less than minimum value allowed
{$EXTERNALSYM MSIDBERROR_UNDERFLOW}
MSIDBERROR_NOTINSET = 6; // data not a member of the values permitted in the set
{$EXTERNALSYM MSIDBERROR_NOTINSET}
MSIDBERROR_BADVERSION = 7; // invalid version string
{$EXTERNALSYM MSIDBERROR_BADVERSION}
MSIDBERROR_BADCASE = 8; // invalid case, must be all upper-case or all lower-case
{$EXTERNALSYM MSIDBERROR_BADCASE}
MSIDBERROR_BADGUID = 9; // invalid GUID
{$EXTERNALSYM MSIDBERROR_BADGUID}
MSIDBERROR_BADWILDCARD = 10; // invalid wildcardfilename or use of wildcards
{$EXTERNALSYM MSIDBERROR_BADWILDCARD}
MSIDBERROR_BADIDENTIFIER = 11; // bad identifier
{$EXTERNALSYM MSIDBERROR_BADIDENTIFIER}
MSIDBERROR_BADLANGUAGE = 12; // bad language Id(s)
{$EXTERNALSYM MSIDBERROR_BADLANGUAGE}
MSIDBERROR_BADFILENAME = 13; // bad filename
{$EXTERNALSYM MSIDBERROR_BADFILENAME}
MSIDBERROR_BADPATH = 14; // bad path
{$EXTERNALSYM MSIDBERROR_BADPATH}
MSIDBERROR_BADCONDITION = 15; // bad conditional statement
{$EXTERNALSYM MSIDBERROR_BADCONDITION}
MSIDBERROR_BADFORMATTED = 16; // bad format string
{$EXTERNALSYM MSIDBERROR_BADFORMATTED}
MSIDBERROR_BADTEMPLATE = 17; // bad template string
{$EXTERNALSYM MSIDBERROR_BADTEMPLATE}
MSIDBERROR_BADDEFAULTDIR = 18; // bad string in DefaultDir column of Directory table
{$EXTERNALSYM MSIDBERROR_BADDEFAULTDIR}
MSIDBERROR_BADREGPATH = 19; // bad registry path string
{$EXTERNALSYM MSIDBERROR_BADREGPATH}
MSIDBERROR_BADCUSTOMSOURCE = 20; // bad string in CustomSource column of CustomAction table
{$EXTERNALSYM MSIDBERROR_BADCUSTOMSOURCE}
MSIDBERROR_BADPROPERTY = 21; // bad property string
{$EXTERNALSYM MSIDBERROR_BADPROPERTY}
MSIDBERROR_MISSINGDATA = 22; // _Validation table missing reference to column
{$EXTERNALSYM MSIDBERROR_MISSINGDATA}
MSIDBERROR_BADCATEGORY = 23; // Category column of _Validation table for column is invalid
{$EXTERNALSYM MSIDBERROR_BADCATEGORY}
MSIDBERROR_BADKEYTABLE = 24; // table in KeyTable column of _Validation table could not be found/loaded
{$EXTERNALSYM MSIDBERROR_BADKEYTABLE}
MSIDBERROR_BADMAXMINVALUES = 25; // value in MaxValue column of _Validation table is less than value in MinValue column
{$EXTERNALSYM MSIDBERROR_BADMAXMINVALUES}
MSIDBERROR_BADCABINET = 26; // bad cabinet name
{$EXTERNALSYM MSIDBERROR_BADCABINET}
MSIDBERROR_BADSHORTCUT = 27; // bad shortcut target
{$EXTERNALSYM MSIDBERROR_BADSHORTCUT}
MSIDBERROR_STRINGOVERFLOW = 28; // string overflow (greater than length allowed in column def)
{$EXTERNALSYM MSIDBERROR_STRINGOVERFLOW}
MSIDBERROR_BADLOCALIZEATTRIB = 29; // invalid localization attribute (primary keys cannot be localized)
{$EXTERNALSYM MSIDBERROR_BADLOCALIZEATTRIB}
type
MSIDBERROR = DWORD;
{$EXTERNALSYM MSIDBERROR}
TMsiDbError = MSIDBERROR;
const
MSIRUNMODE_ADMIN = 0; // admin mode install, else product install
{$EXTERNALSYM MSIRUNMODE_ADMIN}
MSIRUNMODE_ADVERTISE = 1; // installing advertisements, else installing or updating product
{$EXTERNALSYM MSIRUNMODE_ADVERTISE}
MSIRUNMODE_MAINTENANCE = 2; // modifying an existing installation, else new installation
{$EXTERNALSYM MSIRUNMODE_MAINTENANCE}
MSIRUNMODE_ROLLBACKENABLED = 3; // rollback is enabled
{$EXTERNALSYM MSIRUNMODE_ROLLBACKENABLED}
MSIRUNMODE_LOGENABLED = 4; // log file active, enabled prior to install session
{$EXTERNALSYM MSIRUNMODE_LOGENABLED}
MSIRUNMODE_OPERATIONS = 5; // spooling execute operations, else in determination phase
{$EXTERNALSYM MSIRUNMODE_OPERATIONS}
MSIRUNMODE_REBOOTATEND = 6; // reboot needed after successful installation (settable)
{$EXTERNALSYM MSIRUNMODE_REBOOTATEND}
MSIRUNMODE_REBOOTNOW = 7; // reboot needed to continue installation (settable)
{$EXTERNALSYM MSIRUNMODE_REBOOTNOW}
MSIRUNMODE_CABINET = 8; // installing files from cabinets and files using Media table
{$EXTERNALSYM MSIRUNMODE_CABINET}
MSIRUNMODE_SOURCESHORTNAMES= 9; // source LongFileNames suppressed via PID_MSISOURCE summary property
{$EXTERNALSYM MSIRUNMODE_SOURCESHORTNAMES}
MSIRUNMODE_TARGETSHORTNAMES= 10; // target LongFileNames suppressed via SHORTFILENAMES property
{$EXTERNALSYM MSIRUNMODE_TARGETSHORTNAMES}
MSIRUNMODE_RESERVED11 = 11; // future use
{$EXTERNALSYM MSIRUNMODE_RESERVED11}
MSIRUNMODE_WINDOWS9X = 12; // operating systems is Windows9?, else Windows NT
{$EXTERNALSYM MSIRUNMODE_WINDOWS9X}
MSIRUNMODE_ZAWENABLED = 13; // operating system supports demand installation
{$EXTERNALSYM MSIRUNMODE_ZAWENABLED}
MSIRUNMODE_RESERVED14 = 14; // future use
{$EXTERNALSYM MSIRUNMODE_RESERVED14}
MSIRUNMODE_RESERVED15 = 15; // future use
{$EXTERNALSYM MSIRUNMODE_RESERVED15}
MSIRUNMODE_SCHEDULED = 16; // custom action call from install script execution
{$EXTERNALSYM MSIRUNMODE_SCHEDULED}
MSIRUNMODE_ROLLBACK = 17; // custom action call from rollback execution script
{$EXTERNALSYM MSIRUNMODE_ROLLBACK}
MSIRUNMODE_COMMIT = 18; // custom action call from commit execution script
{$EXTERNALSYM MSIRUNMODE_COMMIT}
type
MSIRUNMODE = DWORD;
{$EXTERNALSYM MSIRUNMODE}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -