📄 advpub.h
字号:
//***************************************************************************
//* Copyright (c) Microsoft Corporation 1995-1998. All rights reserved. *
//***************************************************************************
//* *
//* ADVPUB.H - Specify the Interface for ADVPACK.DLL *
//* *
//***************************************************************************
#ifndef _ADVPUB_H_
#define _ADVPUB_H_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: RunSetupCommand
//
// SYNOPSIS: Execute an install section in an INF file, or execute a
// program. Advanced INF files are supported.
//
// RETURN CODES:
//
// S_OK Everything OK, no reboot needed.
// No EXE to wait for.
// S_ASYNCHRONOUS Please wait on phEXE.
// ERROR_SUCCESS_REBOOT_REQUIRED Reboot required.
// E_INVALIDARG NULL specified in szCmdName or szDir
// HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION) INF's not supported on this OS version
// E_UNEXPECTED Catastrophic failure(should never happen).
// HRESULT_FROM_WIN32(GetLastError()) Anything else
/////////////////////////////////////////////////////////////////////////////
#ifndef S_ASYNCHRONOUS
#define S_ASYNCHRONOUS _HRESULT_TYPEDEF_(0x401e8L)
#endif
#define achRUNSETUPCOMMANDFUNCTION "RunSetupCommand"
HRESULT WINAPI RunSetupCommand( HWND hWnd, LPCSTR szCmdName,
LPCSTR szInfSection, LPCSTR szDir,
LPCSTR lpszTitle, HANDLE *phEXE,
DWORD dwFlags, LPVOID pvReserved );
typedef HRESULT (WINAPI *RUNSETUPCOMMAND)(
HWND hWnd, // Handle to parent window NULL=Quiet mode
LPCSTR szCmdName, // Inf or EXE filename to "run"
LPCSTR szInfSection, // Inf section to install. NULL="DefaultInstall"
LPCSTR szDir, // Path to extracted files
LPCSTR szTitle, // Title for all dialogs
HANDLE *phEXE, // Handle to EXE to wait for
DWORD dwFlags, // Flags to specify functionality (see above)
LPVOID pvReserved // Reserved for future use
);
// FLAGS:
#define RSC_FLAG_INF 1 // exxcute INF install
#define RSC_FLAG_SKIPDISKSPACECHECK 2 // Currently does nothing
#define RSC_FLAG_QUIET 4 // quiet mode, no UI
#define RSC_FLAG_NGCONV 8 // don't run groupConv
#define RSC_FLAG_UPDHLPDLLS 16 // force to self-updating on user's system
#define RSC_FLAG_DELAYREGISTEROCX 512 // force delay of ocx registration
#define RSC_FLAG_SETUPAPI 1024 // use setupapi.dll
// please not adding flag after this. See LaunchINFSectionEx() flags.
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: NeedRebootInit
//
// SYNOPSIS: Initializes state for reboot checking. Call this function
// before calling RunSetupCommand.
// RETURNS: value required to be passed to NeedReboot()
/////////////////////////////////////////////////////////////////////////////
#define achNEEDREBOOTINITFUNCTION "NeedRebootInit"
DWORD WINAPI NeedRebootInit( VOID );
typedef DWORD (WINAPI *NEEDREBOOTINIT)(VOID);
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: NeedReboot
//
// SYNOPSIS: Compares stored state with current state to determine if a
// reboot is required.
// dwRebootCheck the return value from NeedRebootInit
//
// RETURNS:
// TRUE if a reboot is required;
// FALSE otherwise.
/////////////////////////////////////////////////////////////////////////////
#define achNEEDREBOOTFUNCTION "NeedReboot"
BOOL WINAPI NeedReboot( DWORD dwRebootCheck );
typedef BOOL (WINAPI *NEEDREBOOT)(
DWORD dwRebootCheck // Value returned from NeedRebootInit
);
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: DoReboot
//
// SYNOPSIS: Ask advpack to do reboot.
// hwnd if it is INVALID_HANDLE_VALUE, no user prompt. Otherwise promp.
// pszTitle User prompt UI title string.
// dwReserved Not used.
// RETURNS:
// FALSE User choose NO to reboot prompt.
/////////////////////////////////////////////////////////////////////////////
// #define achDOREBOOT "DoReboot"
// BOOL WINAPI DoReboot( HWND hwnd, BOOL bDoUI );
// typedef BOOL (WINAPI* DOREBOOT)( HWND hwnd, BOOL bDoUI );
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: RebootCheckOnInstall
//
// SYNOPSIS: Check reboot condition if the given INF section is installed.
// hwnd windows handle
// pszINF INF filename with fully qualified path
// pszSec INF section. NULL is translated as DefaultInstall or DefaultInstall.NT.
// dwReserved Not used.
// RETURN:
// S_OK Reboot needed if INF section is installed.
// S_FALSE Reboot is not needed if INF section is installed.
// HRESULT of Win 32 errors
//
/////////////////////////////////////////////////////////////////////////////
#define achPRECHECKREBOOT "RebootCheckOnInstall"
HRESULT WINAPI RebootCheckOnInstall( HWND hwnd, PCSTR pszINF, PCSTR pszSec, DWORD dwReserved );
typedef HRESULT (WINAPI *REBOOTCHECKONINSTALL)( HWND, PCSTR, PCSTR, DWORD );
//////////////////////////////////////////////////////////////////////////
// ENTRY POINT: TranslateInfString
//
// SYNOPSIS: Translates a key value in an INF file, using advanced INF
// syntax.
// RETURN CODES:
// S_OK Everything OK.
// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
// The buffer size is too small to hold the
// translated string. Required size is in *pdwRequiredSize.
// E_INVALIDARG NULL specified in pszInfFilename, pszTranslateSection,
// pszTranslateKey, pdwRequiredSize.
// HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION)
// OS not supported.
// E_UNEXPECTED Catastrophic failure -- should never happen.
// HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)
// The section or key specified does not exist.
// HRESULT_FROM_WIN32(GetLastError()) Anything else
//
/////////////////////////////////////////////////////////////////////////////
#define c_szTRANSLATEINFSTRING "TranslateInfString"
HRESULT WINAPI TranslateInfString( PCSTR pszInfFilename, PCSTR pszInstallSection,
PCSTR pszTranslateSection, PCSTR pszTranslateKey,
PSTR pszBuffer, DWORD dwBufferSize,
PDWORD pdwRequiredSize, PVOID pvReserved );
typedef HRESULT (WINAPI *TRANSLATEINFSTRING)(
PCSTR pszInfFilename, // Name of INF file to process
PCSTR pszInstallSection, // Install section name (NULL=DefaultInstall)
PCSTR pszTranslateSection, // Section that contains key to translate
PCSTR pszTranslateKey, // Key to translate
PSTR pszBuffer, // Buffer to store translated key. (NULL=return required size only)
DWORD dwBufferSize, // Size of this buffer. If pszBuffer==NULL, this is ignored.
PDWORD pdwRequiredSize, // Required size of buffer
PVOID pvReserved // Reserved for future use
);
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: RegInstall
//
// SYNOPSIS: Loads an INF from a string resource, adds some entries to the
// INF string substitution table, and executes the INF.
// RETURNS:
// S_OK success.
// E_FAIL failure,
/////////////////////////////////////////////////////////////////////////////
#define achREGINSTALL "RegInstall"
typedef struct _StrEntry {
LPSTR pszName; // String to substitute
LPSTR pszValue; // Replacement string or string resource
} STRENTRY, *LPSTRENTRY;
typedef const STRENTRY CSTRENTRY;
typedef CSTRENTRY *LPCSTRENTRY;
typedef struct _StrTable {
DWORD cEntries; // Number of entries in the table
LPSTRENTRY pse; // Array of entries
} STRTABLE, *LPSTRTABLE;
typedef const STRTABLE CSTRTABLE;
typedef CSTRTABLE *LPCSTRTABLE;
HRESULT WINAPI RegInstall( HMODULE hm, LPCSTR pszSection, LPCSTRTABLE pstTable );
typedef HRESULT (WINAPI *REGINSTALL)(
HMODULE hm, // Module that contains REGINST resource
LPCSTR pszSection, // Section of INF to execute
LPCSTRTABLE pstTable // Additional string substitutions
);
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: LaunchINFSectionEx
//
// SYNOPSIS: Install INF section with BACKUP/ROLLBACK capabilities.
//
// RETURNS: E_FAIL on failure, S_OK on success.
/////////////////////////////////////////////////////////////////////////////
#define achLAUNCHINFSECTIONEX "LaunchINFSectionEx"
HRESULT WINAPI LaunchINFSectionEx( HWND hwnd, HINSTANCE hInstance, PSTR pszParms, INT nShow );
typedef HRESULT (WINAPI *LAUNCHINFSECTIONEX)(
HWND hwnd, // pass in window handle
HINSTANCE hInst, // instance handle
PSTR pszParams, // String contains params: INF,section,CAB,flags
INT nShow
);
// FLAGS:
// FLAGS value this way is for compatibility. Don't change them.
//
#define ALINF_QUIET 4 // quiet mode, no UI
#define ALINF_NGCONV 8 // don't run groupConv
#define ALINF_UPDHLPDLLS 16 // force to self-updating on user's system
#define ALINF_BKINSTALL 32 // backup data before install
#define ALINF_ROLLBACK 64 // rollback to previous state
#define ALINF_CHECKBKDATA 128 // validate the backup data
#define ALINF_ROLLBKDOALL 256 // bypass building file list
#define ALINF_DELAYREGISTEROCX 512 // force delay of ocx registration
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: ExecuteCab
//
// SYNOPSIS: Extract the an INF from the CAB file, and do INF install on it.
/////////////////////////////////////////////////////////////////////////////
// RETURNS: E_FAIL on failure, S_OK on success.
#define achEXECUTECAB "ExecuteCab"
typedef struct _CabInfo {
PSTR pszCab;
PSTR pszInf;
PSTR pszSection;
char szSrcPath[MAX_PATH];
DWORD dwFlags;
} CABINFO, *PCABINFO;
HRESULT WINAPI ExecuteCab( HWND hwnd, PCABINFO pCab, LPVOID pReserved );
typedef HRESULT (WINAPI *EXECUTECAB)(
HWND hwnd,
PCABINFO pCab,
LPVOID pReserved
);
// flag as LaunchINFSectionEx's flag defines
/////////////////////////////////////////////////////////////////////////////
// ENTRY POINT: AdvInstallFile
//
// SYNOPSIS: To copy a file from the source to a destination
// Basicly a wrapper around the setupapi file copy engine
/////////////////////////////////////////////////////////////////////////////
// Flags which can be passed to AdvInstallFile
// Here is a copy of the flags defined in setupapi.h for reference below.
//#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_REPLACEONLY 0x00000400 // copy only if file exists on target
#define AIF_WARNIFSKIP 0x00000001 // system critical file: warn if user tries to skip
#define AIF_NOSKIP 0x00000002 // Skip is disallowed for this file
#define AIF_NOVERSIONCHECK 0x00000004 // don't check the version number of the file overwrite
#define AIF_FORCE_FILE_IN_USE 0x00000008 // force file-in-use behavior
#define AIF_NOOVERWRITE 0x00000010 // copy only if target doesn't exist
// if AIF_QUIET, the file is not copied and
// the user is not notified
#define AIF_NO_VERSION_DIALOG 0x00000020 // do not copy if target is newer
#define AIF_REPLACEONLY 0x00000400 // copy only if target file already present
// Flags only known to AdvInstallFile
#define AIF_NOLANGUAGECHECK 0x10000000 // don't check the language of the file
// if the flags is NOT specified and AIF_QUIET
// the file is not copied and the user is not notified
#define AIF_QUIET 0x20000000 // No UI to the user
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -