home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / advpub.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  31KB  |  616 lines

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