Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

698 lines
34 KiB

  1. //* Copyright (c) Microsoft Corporation 1995-1998. All rights reserved. *
  2. //***************************************************************************
  3. //* *
  4. //* ADVPUB.H - Specify the Interface for ADVPACK.DLL *
  5. //* *
  6. //***************************************************************************
  7. #ifndef _ADVPUB_H_
  8. #define _ADVPUB_H_
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif /* __cplusplus */
  12. /////////////////////////////////////////////////////////////////////////////
  13. // ENTRY POINT: RunSetupCommand
  14. //
  15. // SYNOPSIS: Execute an install section in an INF file, or execute a
  16. // program. Advanced INF files are supported.
  17. //
  18. // RETURN CODES:
  19. //
  20. // S_OK Everything OK, no reboot needed.
  21. // No EXE to wait for.
  22. // S_ASYNCHRONOUS Please wait on phEXE.
  23. // ERROR_SUCCESS_REBOOT_REQUIRED Reboot required.
  24. // E_INVALIDARG NULL specified in szCmdName or szDir
  25. // HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION) INF's not supported on this OS version
  26. // E_UNEXPECTED Catastrophic failure(should never happen).
  27. // HRESULT_FROM_WIN32(GetLastError()) Anything else
  28. /////////////////////////////////////////////////////////////////////////////
  29. #ifndef S_ASYNCHRONOUS
  30. #define S_ASYNCHRONOUS _HRESULT_TYPEDEF_(0x401e8L)
  31. #endif
  32. #define achRUNSETUPCOMMANDFUNCTION "RunSetupCommand"
  33. HRESULT WINAPI RunSetupCommand( HWND hWnd, LPCSTR szCmdName,
  34. LPCSTR szInfSection, LPCSTR szDir,
  35. LPCSTR lpszTitle, HANDLE *phEXE,
  36. DWORD dwFlags, LPVOID pvReserved );
  37. typedef HRESULT (WINAPI *RUNSETUPCOMMAND)(
  38. HWND hWnd, // Handle to parent window NULL=Quiet mode
  39. LPCSTR szCmdName, // Inf or EXE filename to "run"
  40. LPCSTR szInfSection, // Inf section to install. NULL="DefaultInstall"
  41. LPCSTR szDir, // Path to extracted files
  42. LPCSTR szTitle, // Title for all dialogs
  43. HANDLE *phEXE, // Handle to EXE to wait for
  44. DWORD dwFlags, // Flags to specify functionality (see above)
  45. LPVOID pvReserved // Reserved for future use
  46. );
  47. // FLAGS:
  48. #define RSC_FLAG_INF 1 // exxcute INF install
  49. #define RSC_FLAG_SKIPDISKSPACECHECK 2 // Currently does nothing
  50. #define RSC_FLAG_QUIET 4 // quiet mode, no UI
  51. #define RSC_FLAG_NGCONV 8 // don't run groupConv
  52. #define RSC_FLAG_UPDHLPDLLS 16 // force to self-updating on user's system
  53. #define RSC_FLAG_DELAYREGISTEROCX 512 // force delay of ocx registration
  54. #define RSC_FLAG_SETUPAPI 1024 // use setupapi.dll
  55. // please not adding flag after this. See LaunchINFSectionEx() flags.
  56. /////////////////////////////////////////////////////////////////////////////
  57. // ENTRY POINT: NeedRebootInit
  58. //
  59. // SYNOPSIS: Initializes state for reboot checking. Call this function
  60. // before calling RunSetupCommand.
  61. // RETURNS: value required to be passed to NeedReboot()
  62. /////////////////////////////////////////////////////////////////////////////
  63. #define achNEEDREBOOTINITFUNCTION "NeedRebootInit"
  64. DWORD WINAPI NeedRebootInit( VOID );
  65. typedef DWORD (WINAPI *NEEDREBOOTINIT)(VOID);
  66. /////////////////////////////////////////////////////////////////////////////
  67. // ENTRY POINT: NeedReboot
  68. //
  69. // SYNOPSIS: Compares stored state with current state to determine if a
  70. // reboot is required.
  71. // dwRebootCheck the return value from NeedRebootInit
  72. //
  73. // RETURNS:
  74. // TRUE if a reboot is required;
  75. // FALSE otherwise.
  76. /////////////////////////////////////////////////////////////////////////////
  77. #define achNEEDREBOOTFUNCTION "NeedReboot"
  78. BOOL WINAPI NeedReboot( DWORD dwRebootCheck );
  79. typedef BOOL (WINAPI *NEEDREBOOT)(
  80. DWORD dwRebootCheck // Value returned from NeedRebootInit
  81. );
  82. /////////////////////////////////////////////////////////////////////////////
  83. // ENTRY POINT: DoReboot
  84. //
  85. // SYNOPSIS: Ask advpack to do reboot.
  86. // hwnd if it is INVALID_HANDLE_VALUE, no user prompt. Otherwise promp.
  87. // pszTitle User prompt UI title string.
  88. // dwReserved Not used.
  89. // RETURNS:
  90. // FALSE User choose NO to reboot prompt.
  91. /////////////////////////////////////////////////////////////////////////////
  92. // #define achDOREBOOT "DoReboot"
  93. // BOOL WINAPI DoReboot( HWND hwnd, BOOL bDoUI );
  94. // typedef BOOL (WINAPI* DOREBOOT)( HWND hwnd, BOOL bDoUI );
  95. /////////////////////////////////////////////////////////////////////////////
  96. // ENTRY POINT: RebootCheckOnInstall
  97. //
  98. // SYNOPSIS: Check reboot condition if the given INF section is installed.
  99. // hwnd windows handle
  100. // pszINF INF filename with fully qualified path
  101. // pszSec INF section. NULL is translated as DefaultInstall or DefaultInstall.NT.
  102. // dwReserved Not used.
  103. // RETURN:
  104. // S_OK Reboot needed if INF section is installed.
  105. // S_FALSE Reboot is not needed if INF section is installed.
  106. // HRESULT of Win 32 errors
  107. //
  108. /////////////////////////////////////////////////////////////////////////////
  109. #define achPRECHECKREBOOT "RebootCheckOnInstall"
  110. HRESULT WINAPI RebootCheckOnInstall( HWND hwnd, PCSTR pszINF, PCSTR pszSec, DWORD dwReserved );
  111. typedef HRESULT (WINAPI *REBOOTCHECKONINSTALL)( HWND, PCSTR, PCSTR, DWORD );
  112. //////////////////////////////////////////////////////////////////////////
  113. // ENTRY POINT: TranslateInfString
  114. //
  115. // SYNOPSIS: Translates a key value in an INF file, using advanced INF
  116. // syntax.
  117. // RETURN CODES:
  118. // S_OK Everything OK.
  119. // HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
  120. // The buffer size is too small to hold the
  121. // translated string. Required size is in *pdwRequiredSize.
  122. // E_INVALIDARG NULL specified in pszInfFilename, pszTranslateSection,
  123. // pszTranslateKey, pdwRequiredSize.
  124. // HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION)
  125. // OS not supported.
  126. // E_UNEXPECTED Catastrophic failure -- should never happen.
  127. // HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)
  128. // The section or key specified does not exist.
  129. // HRESULT_FROM_WIN32(GetLastError()) Anything else
  130. //
  131. /////////////////////////////////////////////////////////////////////////////
  132. #define c_szTRANSLATEINFSTRING "TranslateInfString"
  133. HRESULT WINAPI TranslateInfString( PCSTR pszInfFilename, PCSTR pszInstallSection,
  134. PCSTR pszTranslateSection, PCSTR pszTranslateKey,
  135. PSTR pszBuffer, DWORD dwBufferSize,
  136. PDWORD pdwRequiredSize, PVOID pvReserved );
  137. typedef HRESULT (WINAPI *TRANSLATEINFSTRING)(
  138. PCSTR pszInfFilename, // Name of INF file to process
  139. PCSTR pszInstallSection, // Install section name (NULL=DefaultInstall)
  140. PCSTR pszTranslateSection, // Section that contains key to translate
  141. PCSTR pszTranslateKey, // Key to translate
  142. PSTR pszBuffer, // Buffer to store translated key. (NULL=return required size only)
  143. DWORD dwBufferSize, // Size of this buffer. If pszBuffer==NULL, this is ignored.
  144. PDWORD pdwRequiredSize, // Required size of buffer
  145. PVOID pvReserved // Reserved for future use
  146. );
  147. /////////////////////////////////////////////////////////////////////////////
  148. // ENTRY POINT: RegInstall
  149. //
  150. // SYNOPSIS: Loads an INF from a string resource, adds some entries to the
  151. // INF string substitution table, and executes the INF.
  152. // RETURNS:
  153. // S_OK success.
  154. // E_FAIL failure,
  155. /////////////////////////////////////////////////////////////////////////////
  156. #define achREGINSTALL "RegInstall"
  157. typedef struct _StrEntry {
  158. LPSTR pszName; // String to substitute
  159. LPSTR pszValue; // Replacement string or string resource
  160. } STRENTRY, *LPSTRENTRY;
  161. typedef const STRENTRY CSTRENTRY;
  162. typedef CSTRENTRY *LPCSTRENTRY;
  163. typedef struct _StrTable {
  164. DWORD cEntries; // Number of entries in the table
  165. LPSTRENTRY pse; // Array of entries
  166. } STRTABLE, *LPSTRTABLE;
  167. typedef const STRTABLE CSTRTABLE;
  168. typedef CSTRTABLE *LPCSTRTABLE;
  169. HRESULT WINAPI RegInstall( HMODULE hm, LPCSTR pszSection, LPCSTRTABLE pstTable );
  170. typedef HRESULT (WINAPI *REGINSTALL)(
  171. HMODULE hm, // Module that contains REGINST resource
  172. LPCSTR pszSection, // Section of INF to execute
  173. LPCSTRTABLE pstTable // Additional string substitutions
  174. );
  175. /////////////////////////////////////////////////////////////////////////////
  176. // ENTRY POINT: LaunchINFSectionEx
  177. //
  178. // SYNOPSIS: Install INF section with BACKUP/ROLLBACK capabilities.
  179. //
  180. // RETURNS: E_FAIL on failure, S_OK on success.
  181. /////////////////////////////////////////////////////////////////////////////
  182. #define achLAUNCHINFSECTIONEX "LaunchINFSectionEx"
  183. HRESULT WINAPI LaunchINFSectionEx( HWND hwnd, HINSTANCE hInstance, PSTR pszParms, INT nShow );
  184. typedef HRESULT (WINAPI *LAUNCHINFSECTIONEX)(
  185. HWND hwnd, // pass in window handle
  186. HINSTANCE hInst, // instance handle
  187. PSTR pszParams, // String contains params: INF,section,CAB,flags
  188. INT nShow
  189. );
  190. // FLAGS:
  191. // FLAGS value this way is for compatibility. Don't change them.
  192. //
  193. #define ALINF_QUIET 4 // quiet mode, no UI
  194. #define ALINF_NGCONV 8 // don't run groupConv
  195. #define ALINF_UPDHLPDLLS 16 // force to self-updating on user's system
  196. #define ALINF_BKINSTALL 32 // backup data before install
  197. #define ALINF_ROLLBACK 64 // rollback to previous state
  198. #define ALINF_CHECKBKDATA 128 // validate the backup data
  199. #define ALINF_ROLLBKDOALL 256 // bypass building file list
  200. #define ALINF_DELAYREGISTEROCX 512 // force delay of ocx registration
  201. /////////////////////////////////////////////////////////////////////////////
  202. // ENTRY POINT: ExecuteCab
  203. //
  204. // SYNOPSIS: Extract the an INF from the CAB file, and do INF install on it.
  205. /////////////////////////////////////////////////////////////////////////////
  206. // RETURNS: E_FAIL on failure, S_OK on success.
  207. #define achEXECUTECAB "ExecuteCab"
  208. typedef struct _CabInfo {
  209. PSTR pszCab;
  210. PSTR pszInf;
  211. PSTR pszSection;
  212. char szSrcPath[MAX_PATH];
  213. DWORD dwFlags;
  214. } CABINFO, *PCABINFO;
  215. HRESULT WINAPI ExecuteCab( HWND hwnd, PCABINFO pCab, LPVOID pReserved );
  216. typedef HRESULT (WINAPI *EXECUTECAB)(
  217. HWND hwnd,
  218. PCABINFO pCab,
  219. LPVOID pReserved
  220. );
  221. // flag as LaunchINFSectionEx's flag defines
  222. /////////////////////////////////////////////////////////////////////////////
  223. // ENTRY POINT: AdvInstallFile
  224. //
  225. // SYNOPSIS: To copy a file from the source to a destination
  226. // Basicly a wrapper around the setupapi file copy engine
  227. /////////////////////////////////////////////////////////////////////////////
  228. // Flags which can be passed to AdvInstallFile
  229. // Here is a copy of the flags defined in setupapi.h for reference below.
  230. //#define COPYFLG_WARN_IF_SKIP 0x00000001 // warn if user tries to skip file
  231. //#define COPYFLG_NOSKIP 0x00000002 // disallow skipping this file
  232. //#define COPYFLG_NOVERSIONCHECK 0x00000004 // ignore versions and overwrite target
  233. //#define COPYFLG_FORCE_FILE_IN_USE 0x00000008 // force file-in-use behavior
  234. //#define COPYFLG_NO_OVERWRITE 0x00000010 // do not copy if file exists on target
  235. //#define COPYFLG_NO_VERSION_DIALOG 0x00000020 // do not copy if target is newer
  236. //#define COPYFLG_REPLACEONLY 0x00000400 // copy only if file exists on target
  237. #define AIF_WARNIFSKIP 0x00000001 // system critical file: warn if user tries to skip
  238. #define AIF_NOSKIP 0x00000002 // Skip is disallowed for this file
  239. #define AIF_NOVERSIONCHECK 0x00000004 // don't check the version number of the file overwrite
  240. #define AIF_FORCE_FILE_IN_USE 0x00000008 // force file-in-use behavior
  241. #define AIF_NOOVERWRITE 0x00000010 // copy only if target doesn't exist
  242. // if AIF_QUIET, the file is not copied and
  243. // the user is not notified
  244. #define AIF_NO_VERSION_DIALOG 0x00000020 // do not copy if target is newer
  245. #define AIF_REPLACEONLY 0x00000400 // copy only if target file already present
  246. // Flags only known to AdvInstallFile
  247. #define AIF_NOLANGUAGECHECK 0x10000000 // don't check the language of the file
  248. // if the flags is NOT specified and AIF_QUIET
  249. // the file is not copied and the user is not notified
  250. #define AIF_QUIET 0x20000000 // No UI to the user
  251. #define achADVINSTALLFILE "AdvInstallFile"
  252. HRESULT WINAPI AdvInstallFile(HWND hwnd, LPCSTR lpszSourceDir, LPCSTR lpszSourceFile,
  253. LPCSTR lpszDestDir, LPCSTR lpszDestFile, DWORD dwFlags, DWORD dwReserved);
  254. typedef HRESULT (WINAPI *ADVINSTALLFILE)(
  255. HWND hwnd, // Parent Window for messages
  256. LPCSTR lpszSourceDir, // Source directory (does not contain filename)
  257. LPCSTR lpszSourceFile, // Filename only
  258. LPCSTR lpszDestDir, // Destination directory (does not contain filename)
  259. LPCSTR lpszDestFile, // optional filename. if NULL lpszSourceFile is used
  260. DWORD dwFlags, // AIF_* FLAGS
  261. DWORD dwReserved);
  262. //////////////////////////////////////////////////////////////////
  263. //
  264. //////////////////////////////////////////////////////////////////
  265. // the following flags are for backwards compatiable. No API user
  266. // should reference them directly now.
  267. //
  268. #define IE4_RESTORE 0x00000001 // if this bit is off, save the registries.
  269. #define IE4_BACKNEW 0x00000002 // backup all files which are not backed up before
  270. #define IE4_NODELETENEW 0x00000004 // don't delete files we don't backed up before
  271. #define IE4_NOMESSAGES 0x00000008 // No message display in any events.
  272. #define IE4_NOPROGRESS 0x00000010 // this bit on: No file backup progressbar
  273. #define IE4_NOENUMKEY 0x00000020 // this bit on: Don't Enum sub key even there is no given valuename
  274. #define IE4_NO_CRC_MAPPING 0x00000040 // Normally you should not turn on this bit, advpack creates
  275. // internal mapping for all the entries backed up.
  276. #define IE4_REGSECTION 0x00000080 // INF AddReg/DelReg section
  277. #define IE4_FRDOALL 0x00000100 // FileRestore DoAll
  278. #define IE4_UPDREFCNT 0x00000200 // Update the ref count in .ini backup file list
  279. #define IE4_USEREFCNT 0x00000400 // use ref count to determin if the backup file should be put back
  280. #define IE4_EXTRAINCREFCNT 0x00000800 // if increase the ref cnt if it has been updated before
  281. #define IE4_REMOVREGBKDATA 0x00001000 // This bit should be used with restore bit
  282. /////////////////////////////////////////////////////////////////////////////
  283. // ENTRY POINT: RegSaveRestore
  284. //
  285. // SYNOPSIS: Save or Restore the given register value or given INF reg section.
  286. //
  287. // RETURNS: E_FAIL on failure, S_OK on success.
  288. /////////////////////////////////////////////////////////////////////////////
  289. // Save or Restore the given register value
  290. HRESULT WINAPI RegSaveRestore(HWND hWnd, PCSTR pszTitleString, HKEY hkBckupKey, PCSTR pcszRootKey, PCSTR pcszSubKey, PCSTR pcszValueName, DWORD dwFlags);
  291. typedef HRESULT (WINAPI *REGSAVERESTORE)( HWND hWnd,
  292. PCSTR pszTitleString, // user specified UI title
  293. HKEY hkBckupKey, // opened Key handle to store the backup data
  294. PCSTR pcszRootKey, // RootKey string
  295. PCSTR pcszSubKey, // SubKey string
  296. PCSTR pcszValueName, // Value name string
  297. DWORD dwFlags); // Flags
  298. // Save or Restore the given INF Reg Section. At restore, if INF and Section pointers are NULL,
  299. // Restore all from the given backup key handle.
  300. HRESULT WINAPI RegSaveRestoreOnINF( HWND hWnd, PCSTR pszTitle, PCSTR pszINF,
  301. PCSTR pszSection, HKEY hHKLMBackKey, HKEY hHKCUBackKey, DWORD dwFlags );
  302. typedef HRESULT (WINAPI *REGSAVERESTOREONINF)( HWND hWnd,
  303. PCSTR pszTitle, // user specified UI title
  304. PCSTR pszINF, // INF filename with fully qualified path
  305. PCSTR pszSection, // INF section name. NULL == default
  306. HKEY hHKLMBackKey, // openned key handle to store the data
  307. HKEY hHKCUBackKey, // openned key handle to store the data
  308. DWORD dwFlags ); // Flags
  309. // FLAG:
  310. #define ARSR_RESTORE IE4_RESTORE // if this bit is off, means Save. Otherwise, restore.
  311. #define ARSR_NOMESSAGES IE4_NOMESSAGES // Quiet no messages in any event.
  312. #define ARSR_REGSECTION IE4_REGSECTION // if this bit is off, the given section is GenInstall Section
  313. #define ARSR_REMOVREGBKDATA IE4_REMOVREGBKDATA // if both this bit and restore bit on, remove the backup reg data without restore it
  314. // Turn on the logging by add these RegVale in HKLM\software\microsoft\IE4
  315. #define REG_SAVE_LOG_KEY "RegSaveLogFile"
  316. #define REG_RESTORE_LOG_KEY "RegRestoreLogFile"
  317. // for backwards compatible add this one back
  318. HRESULT WINAPI RegRestoreAll(HWND hWnd, PSTR pszTitleString, HKEY hkBckupKey);
  319. typedef HRESULT (WINAPI *REGRESTOREALL)(HWND hWnd, PSTR pszTitleString, HKEY hkBckupKey);
  320. /////////////////////////////////////////////////////////////////////////////
  321. // ENTRY POINT: FileSaveRestore
  322. //
  323. // SYNOPSIS: Save or Restore the files on the list lpFileList.
  324. // If lpFileList is NULL at restore time, the function will restore
  325. // all based on INI index file.
  326. //
  327. // RETURNS: E_FAIL on failure, S_OK on success.
  328. /////////////////////////////////////////////////////////////////////////////
  329. HRESULT WINAPI FileSaveRestore( HWND hDlg, LPSTR lpFileList, LPSTR lpDir, LPSTR lpBaseName, DWORD dwFlags);
  330. typedef HRESULT (WINAPI *FILESAVERESTORE)( HWND hDlg,
  331. LPSTR lpFileList, // File list file1\0file2\0filen\0\0
  332. LPSTR lpDir, // pathname of the backup directory
  333. LPSTR lpBaseName, // backup file basename
  334. DWORD dwFlags); // Flags
  335. HRESULT WINAPI FileSaveRestoreOnINF( HWND hWnd, PCSTR pszTitle, PCSTR pszINF,
  336. PCSTR pszSection, PCSTR pszBackupDir, PCSTR pszBaseBackupFile,
  337. DWORD dwFlags );
  338. typedef HRESULT (WINAPI *FILESAVERESTOREONINF)( HWND hDlg,
  339. PCSTR pszTitle, // user specified UI title
  340. PCSTR pszINF, // INF filename with fully qualified path
  341. PCSTR pszSection, // GenInstall INF section name. NULL == default
  342. PCSTR pszBackupDir, // directory to store the backup file
  343. PCSTR pszBaseBackFile, // Basename of the backup data files
  344. DWORD dwFlags ); // Flags
  345. // FLAGS:
  346. #define AFSR_RESTORE IE4_RESTORE // if this bit is off, save the file.
  347. #define AFSR_BACKNEW IE4_BACKNEW // backup all files which are not backed up before
  348. #define AFSR_NODELETENEW IE4_NODELETENEW // don't delete files we don't backed up before
  349. #define AFSR_NOMESSAGES IE4_NOMESSAGES // No message display in any events.
  350. #define AFSR_NOPROGRESS IE4_NOPROGRESS // this bit on: No file backup progressbar
  351. #define AFSR_UPDREFCNT IE4_UPDREFCNT // update the reference count for the files
  352. #define AFSR_USEREFCNT IE4_USEREFCNT // use the ref count to guide the restore file
  353. #define AFSR_EXTRAINCREFCNT IE4_EXTRAINCREFCNT
  354. /////////////////////////////////////////////////////////////////////////////
  355. // ENTRY POINT: AddDelBackupEntry
  356. //
  357. // SYNOPSIS: If AADBE_ADD_ENTRY is specified, mark the file in the File list as not existing
  358. // during file save in the INI file. This can be used to mark additional files that
  359. // they did not exist during backup to avoid having them backup the next time the
  360. // FileSaveRestore is called to save files.
  361. // If AADBE_DEL_ENTRY is specified, delete the entry from the INI. This mechanism can
  362. // be used to leave files permanently on the system.
  363. //
  364. // RETURNS:
  365. // S_OK success
  366. // E_FAIL failure
  367. /////////////////////////////////////////////////////////////////////////////
  368. HRESULT WINAPI AddDelBackupEntry(LPCSTR lpcszFileList, LPCSTR lpcszBackupDir, LPCSTR lpcszBaseName, DWORD dwFlags);
  369. typedef HRESULT (WINAPI *ADDDELBACKUPENTRY)(LPCSTR lpcszFileList, // File list file1\0file2\0filen\0\0
  370. LPCSTR lpcszBackupDir, // pathname of the backup directory
  371. LPCSTR lpcszBaseName, // backup file basename
  372. DWORD dwFlags);
  373. #define AADBE_ADD_ENTRY 0x01 // add entries to the INI file
  374. #define AADBE_DEL_ENTRY 0x02 // delete entries from the INI file
  375. /////////////////////////////////////////////////////////////////////////////
  376. // ENTRY POINT: FileSaveMarkNotExist
  377. //
  378. // SYNOPSIS: Mark the file in the File list as not existing during file save in the INI file
  379. // This can be used to mark additional files that they did not exist during backup
  380. // to avoid having them backup the next time the FileSaveRestore is called to save
  381. // files
  382. //
  383. // RETURNS:
  384. // S_OK success
  385. // E_FAIL failure
  386. /////////////////////////////////////////////////////////////////////////////
  387. HRESULT WINAPI FileSaveMarkNotExist( LPSTR lpFileList, LPSTR lpDir, LPSTR lpBaseName);
  388. typedef HRESULT (WINAPI *FILESAVEMARKNOTEXIST)( LPSTR lpFileList, // File list file1\0file2\0filen\0\0
  389. LPSTR lpDir, // pathname of the backup directory
  390. LPSTR lpBaseName); // backup file basename
  391. /////////////////////////////////////////////////////////////////////////////
  392. // ENTRY POINT: GetVersionFromFile
  393. //
  394. // SYNOPSIS: Get the given file's version and lang information.
  395. //
  396. // RETURNS: E_FAIL on failure, S_OK on success.
  397. /////////////////////////////////////////////////////////////////////////////
  398. HRESULT WINAPI GetVersionFromFile(LPSTR lpszFilename, LPDWORD pdwMSVer, LPDWORD pdwLSVer, BOOL bVersion);
  399. typedef HRESULT (WINAPI *GETVERSIONFROMFILE)(
  400. LPSTR lpszFilename, // filename to get info from
  401. LPDWORD pdwMSVer, // Receive Major version
  402. LPDWORD pdwLSVer, // Receive Minor version
  403. BOOL bVersion); // if FALSE, pdwMSVer receive lang ID
  404. // pdwLSVer receive Codepage ID
  405. /////////////////////////////////////////////////////////////////////////////
  406. // ENTRY POINT: GetVersionFromFileEx
  407. //
  408. // SYNOPSIS: Get the given disk file's version and lang information.
  409. //
  410. // RETURNS: E_FAIL on failure, S_OK on success.
  411. /////////////////////////////////////////////////////////////////////////////
  412. HRESULT WINAPI GetVersionFromFileEx(LPSTR lpszFilename, LPDWORD pdwMSVer, LPDWORD pdwLSVer, BOOL bVersion);
  413. typedef HRESULT (WINAPI *GETVERSIONFROMFILE)(
  414. LPSTR lpszFilename, // filename to get info from
  415. LPDWORD pdwMSVer, // Receive Major version
  416. LPDWORD pdwLSVer, // Receive Minor version
  417. BOOL bVersion); // if FALSE, pdwMSVer receive lang ID
  418. // pdwLSVer receive Codepage ID
  419. /////////////////////////////////////////////////////////////////////////////
  420. // ENTRY POINT: IsNTAdmin
  421. //
  422. // SYNOPSIS: On NT, check if user has admin right.
  423. //
  424. // RETURNS: TURE has admin right; FLSE no admin right.
  425. /////////////////////////////////////////////////////////////////////////////
  426. #define achISNTADMIN "IsNTAdmin"
  427. BOOL WINAPI IsNTAdmin( DWORD dwReserved, DWORD *lpdwReserved );
  428. typedef BOOL (WINAPI *ISNTADMIN)( DWORD, // not used
  429. DWORD * ); // not used
  430. /////////////////////////////////////////////////////////////////////////////
  431. // ENTRY POINT: DelNode
  432. //
  433. // SYNOPSIS: Deletes a file or directory
  434. //
  435. // RETURNS:
  436. // S_OK success
  437. // E_FAIL failure
  438. /////////////////////////////////////////////////////////////////////////////
  439. // FLAGS:
  440. #define ADN_DEL_IF_EMPTY 0x00000001 // delete the directory only if it's empty
  441. #define ADN_DONT_DEL_SUBDIRS 0x00000002 // don't delete any sub-dirs; delete only the files
  442. #define ADN_DONT_DEL_DIR 0x00000004 // don't delete the dir itself
  443. #define ADN_DEL_UNC_PATHS 0x00000008 // delete UNC paths
  444. #define achDELNODE "DelNode"
  445. HRESULT WINAPI DelNode(LPCSTR pszFileOrDirName, DWORD dwFlags);
  446. typedef HRESULT (WINAPI *DELNODE)(
  447. LPCSTR pszFileOrDirName, // Name of file or directory to delete
  448. DWORD dwFlags // 0, ADN_DEL_IF_EMPTY, etc. can be specified
  449. );
  450. /////////////////////////////////////////////////////////////////////////////
  451. // ENTRY POINT: DelNodeRunDLL32
  452. //
  453. // SYNOPSIS: Deletes a file or directory; the parameters to this API are of
  454. // WinMain type
  455. //
  456. // RETURNS:
  457. // S_OK success
  458. // E_FAIL failure
  459. /////////////////////////////////////////////////////////////////////////////
  460. #define achDELNODERUNDLL32 "DelNodeRunDLL32"
  461. HRESULT WINAPI DelNodeRunDLL32(HWND hwnd, HINSTANCE hInstance, PSTR pszParms, INT nShow);
  462. typedef HRESULT (WINAPI *DELNODERUNDLL32)(
  463. HWND hwnd, // pass in window handle
  464. HINSTANCE hInst, // instance handle
  465. PSTR pszParams, // String contains params: FileOrDirName,Flags
  466. INT nShow
  467. );
  468. /////////////////////////////////////////////////////////////////////////////
  469. // ENTRY POINT: OpenINFEngine, TranslateINFStringEx, CloseINFEngine
  470. //
  471. // SYNOPSIS: Three APIs give the caller the option to be more efficient when need
  472. // Advpack to translate INF file in a continue fashion.
  473. //
  474. // RETURNS:
  475. // S_OK success
  476. // E_FAIL failure
  477. /////////////////////////////////////////////////////////////////////////////
  478. #if !defined(UNIX) || !defined(_INC_SETUPAPI) // IEUNIX: Prevent re-def.
  479. //
  480. // Define type for reference to loaded inf file
  481. // (from setupapi.h)
  482. //
  483. typedef PVOID HINF;
  484. #endif
  485. HRESULT WINAPI OpenINFEngine( PCSTR pszInfFilename, PCSTR pszInstallSection,
  486. DWORD dwFlags, HINF *phInf, PVOID pvReserved );
  487. HRESULT WINAPI TranslateInfStringEx( HINF hInf, PCSTR pszInfFilename,
  488. PCSTR pszTranslateSection, PCSTR pszTranslateKey,
  489. PSTR pszBuffer, DWORD dwBufferSize,
  490. PDWORD pdwRequiredSize, PVOID pvReserved );
  491. HRESULT WINAPI CloseINFEngine( HINF hInf );
  492. HRESULT WINAPI ExtractFiles( LPCSTR pszCabName, LPCSTR pszExpandDir, DWORD dwFlags,
  493. LPCSTR pszFileList, LPVOID lpReserved, DWORD dwReserved);
  494. /////////////////////////////////////////////////////////////////////////////
  495. // ENTRY POINT: LaunchINFSection
  496. //
  497. // SYNOPSIS: Install INF section WITHOUT BACKUP/ROLLBACK capabilities.
  498. //
  499. // RETURNS: E_FAIL on failure, S_OK on success.
  500. /////////////////////////////////////////////////////////////////////////////
  501. INT WINAPI LaunchINFSection( HWND, HINSTANCE, PSTR, INT );
  502. // LaunchINFSection flags
  503. #define LIS_QUIET 0x0001 // Bit 0
  504. #define LIS_NOGRPCONV 0x0002 // Bit 1
  505. // Flags in Advanced INF RunPreSetupCommands and RunPostSetupCommands of the Install section
  506. // Those flags can tell advpack how to run those commands, quiet or not quiet, wait or not wait.
  507. // The Default for runing those commands are: Not Quiet and Wait for finish before return the caller.
  508. // I.E> RunPostSetupCommands = MyCmdsSecA:1, MyCmdsSecB:2, MyCmdsSecC
  509. //
  510. #define RUNCMDS_QUIET 0x00000001
  511. #define RUNCMDS_NOWAIT 0x00000002
  512. #define RUNCMDS_DELAYPOSTCMD 0x00000004
  513. // Active Setup Installed Components GUID for IE4
  514. #define awchMSIE4GUID L"{89820200-ECBD-11cf-8B85-00AA005B4383}"
  515. /////////////////////////////////////////////////////////////////////////////
  516. // ENTRY POINT: UserStubWrapper
  517. //
  518. // SYNOPSIS: The function wrapper around the real per-user restore stub to
  519. // do some generic/intelligent function on behalf of every component.
  520. //
  521. // RETURNS: E_FAIL on failure, S_OK on success.
  522. /////////////////////////////////////////////////////////////////////////////
  523. HRESULT WINAPI UserInstStubWrapper( HWND hwnd, HINSTANCE hInstance, PSTR pszParms, INT nShow );
  524. #define achUserInstStubWrapper "UserInstStubWrapper"
  525. typedef HRESULT (WINAPI *USERINSTSTUBWRAPPER)(
  526. HWND hwnd, // pass in window handle
  527. HINSTANCE hInst, // instance handle
  528. PSTR pszParams, // String contains params: {GUID}
  529. INT nShow
  530. );
  531. HRESULT WINAPI UserUnInstStubWrapper( HWND hwnd, HINSTANCE hInstance, PSTR pszParms, INT nShow );
  532. #define achUserUnInstStubWrapper "UserUnInstStubWrapper"
  533. typedef HRESULT (WINAPI *USERUNINSTSTUBWRAPPER)(
  534. HWND hwnd, // pass in window handle
  535. HINSTANCE hInst, // instance handle
  536. PSTR pszParams, // String contains params: {GUID}
  537. INT nShow
  538. );
  539. /////////////////////////////////////////////////////////////////////////////
  540. // ENTRY POINT: SetPerUserInstValues
  541. //
  542. // SYNOPSIS: The function set the per-user stub reg values under IsInstalled\{GUID}
  543. // related key to ensure the later per-user process correctly.
  544. //
  545. // RETURNS: E_FAIL on failure, S_OK on success.
  546. /////////////////////////////////////////////////////////////////////////////
  547. // Args passed to the following API
  548. // MAX_GUID_STRING_LEN is 39 defined in cfgmgr32.h, here we just use it.
  549. //
  550. typedef struct _PERUSERSECTION { char szGUID[39+20];
  551. char szDispName[128];
  552. char szLocale[10];
  553. char szStub[MAX_PATH*4];
  554. char szVersion[32];
  555. char szCompID[128];
  556. DWORD dwIsInstalled;
  557. BOOL bRollback;
  558. } PERUSERSECTION, *PPERUSERSECTION;
  559. HRESULT WINAPI SetPerUserSecValues( PPERUSERSECTION pPerUser );
  560. #define achSetPerUserSecValues "SetPerUserSecValues"
  561. typedef HRESULT (WINAPI *SETPERUSERSECVALUES)( PPERUSERSECTION pPerUser );
  562. /////////////////////////////////////////////////////////////////////////////
  563. //
  564. /////////////////////////////////////////////////////////////////////////////
  565. #ifdef __cplusplus
  566. }
  567. #endif /* __cplusplus */
  568. #endif // _ADVPUB_H_