Source code of Windows XP (NT5)
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.

217 lines
6.4 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: cmdl.h
  4. //
  5. // Module: CMDL32.EXE
  6. //
  7. // Synopsis: Header file for common definitions
  8. //
  9. // Copyright (c) 1996-1999 Microsoft Corporation
  10. //
  11. // Author: nickball Created 04/08/98
  12. //
  13. //+----------------------------------------------------------------------------
  14. #ifndef _CMDL_INC
  15. #define _CMDL_INC
  16. #include <windows.h>
  17. #include <ras.h>
  18. #include <raserror.h>
  19. #include <windowsx.h>
  20. #ifdef WIN32_LEAN_AND_MEAN
  21. #include <shellapi.h>
  22. #endif
  23. #include <stdlib.h>
  24. #include <ctype.h>
  25. #include <tchar.h>
  26. //#define ISBU_VERSION "6.0.1313.0\0" /* VERSIONINFO string */
  27. #include <commctrl.h>
  28. #include <wininet.h>
  29. // Define EXTENDED_CAB_CONTENTS only if we support download of other items
  30. // besides PBKs, PBDs, PBRs, and VERs inside or in lieu of CAB files. You
  31. // will need to link statically to wintrust.lib to compile.
  32. #ifdef EXTENDED_CAB_CONTENTS
  33. #include <wintrust.h>
  34. #endif
  35. #include <stdio.h>
  36. #include <io.h>
  37. #include "base_str.h"
  38. #include "dl_str.h"
  39. #include "mgr_str.h"
  40. #include "pbk_str.h"
  41. #include "log_str.h"
  42. #include "cm_def.h"
  43. #include "resource.h"
  44. #include "cm_phbk.h"
  45. #include "cmdebug.h"
  46. #include "cmutil.h"
  47. #include "cmlog.h"
  48. #include "mutex.h"
  49. #include "cmfdi.h"
  50. #include "util.h"
  51. #include "pnpuverp.h"
  52. #define BUFFER_LENGTH (8*1024) // buffer length for i/o
  53. #define DEFAULT_DELAY (2*60) // default delay before downloading, in seconds
  54. #define DEFAULT_HIDE (-1) // default number of milliseconds to keep window hidden
  55. const TCHAR* const c_pszPbdFile = TEXT("PBUPDATE.PBD"); // for detecting itPbdInCab
  56. #define IDX_INETTHREAD_HANDLE 0 // must be *first*
  57. #define IDX_EVENT_HANDLE 1
  58. #define HANDLE_COUNT 2
  59. extern "C" __declspec(dllimport) HRESULT WINAPI PhoneBookLoad(LPCSTR pszISP, DWORD_PTR *pdwPB);
  60. extern "C" __declspec(dllimport) HRESULT WINAPI PhoneBookUnload(DWORD_PTR dwPB);
  61. extern "C" __declspec(dllimport) HRESULT WINAPI PhoneBookMergeChanges(DWORD_PTR dwPB, LPCSTR pszChangeFile);
  62. typedef enum _EventType {
  63. etDataBegin,
  64. etDataReceived,
  65. etDataEnd,
  66. #ifdef EXTENDED_CAB_CONTENTS
  67. etVerifyTrust,
  68. #endif
  69. etInstall,
  70. etDone,
  71. etICMTerm
  72. } EventType;
  73. // Values for dwAppFlags
  74. #define AF_NO_DELETE 0x0001 // does not delete file(s) on exit
  75. #define AF_NO_INSTALL 0x0002 // downloads and verifies, but does not install
  76. #ifdef DEBUG
  77. #define AF_NO_VERIFY 0x0004 // bypasses WinVerifyTrust() - only available in DEBUG builds
  78. #endif
  79. #define AF_NO_PROFILE 0x0008 // no profile on command line (and hence must use AF_URL, and no phone book delta support)
  80. #define AF_URL 0x0010 // URL on command line (in next token) instead of in profile->service
  81. #define AF_NO_EXE 0x0020 // disable running of .EXEs
  82. #define AF_NO_EXEINCAB 0x0040 // disable running of PBUPDATE.EXE from .CAB
  83. #define AF_NO_INFINCAB 0x0080 // disable running of PBUPDATE.INF from .CAB
  84. #define AF_NO_PBDINCAB 0x0100 // disable running of PBUPDATE.PBD from .CAB
  85. #define AF_NO_SHLINCAB 0x0200 // disable running of first file in .CAB
  86. #define AF_NO_VER 0x0400 // disable updating of phone book version
  87. //#define AF_NO_UPDATE 0x0800 // don't do any work
  88. #define AF_LAN 0x1000 // update request is over a LAN, don't look for the RAS connection before download
  89. #define AF_VPN 0x2000 // this is a VPN file update request instead of a PBK update request
  90. typedef void (*EVENTFUNC)(DWORD,DWORD,LPVOID);
  91. // NOTE - the values in enum _InstallType are in sorted order! Higher values have
  92. // higher precendence.
  93. typedef enum _InstallType {
  94. #ifdef EXTENDED_CAB_CONTENTS
  95. itInvalid = 0, // Must be 0.
  96. itShlInCab,
  97. itPbdInCab,
  98. itPbkInCab,
  99. itPbrInCab,
  100. itInfInCab,
  101. itExeInCab,
  102. itExe
  103. #else
  104. itInvalid = 0, // Must be 0.
  105. itPbdInCab,
  106. itPbkInCab,
  107. itPbrInCab,
  108. #endif
  109. } InstallType;
  110. // the info on how we process each file we find in the cab
  111. typedef struct _FILEPROCESSINFO {
  112. LPTSTR pszFile;
  113. InstallType itType;
  114. } FILEPROCESSINFO, *PFILEPROCESSINFO;
  115. // download args, one per URL(or .cms)
  116. typedef struct _DownloadArgs {
  117. LPTSTR pszCMSFile;
  118. LPTSTR pszPbkFile;
  119. LPTSTR pszPbrFile;
  120. LPTSTR pszUrl;
  121. LPTSTR pszVerCurr;
  122. LPTSTR pszVerNew;
  123. LPTSTR pszPhoneBookName;
  124. LPURL_COMPONENTS psUrl;
  125. HINTERNET hInet;
  126. HINTERNET hConn;
  127. HINTERNET hReq;
  128. TCHAR szFile[MAX_PATH+1];
  129. EVENTFUNC pfnEvent;
  130. LPVOID pvEventParam;
  131. DWORD dwTransferred;
  132. DWORD dwTotalSize;
  133. BOOL bTransferOk;
  134. BOOL * volatile pbAbort;
  135. TCHAR szCabDir[MAX_PATH+1];
  136. BOOL fContainsExeOrInf;
  137. TCHAR szHostName[MAX_PATH+1];
  138. DWORD dwBubbledUpError;
  139. #ifdef EXTENDED_CAB_CONTENTS
  140. BOOL fContainsShl;
  141. #endif // EXTENDED_CAB_CONTENTS
  142. DWORD dwNumFilesToProcess;
  143. PFILEPROCESSINFO rgfpiFileProcessInfo;
  144. } DownloadArgs;
  145. typedef struct _ArgsStruct {
  146. HINSTANCE hInst;
  147. DWORD dwDownloadDelay;
  148. LPTSTR pszProfile;
  149. DWORD dwAppFlags;
  150. UINT nMsgId;
  151. HWND hwndDlg;
  152. DWORD dwHandles;
  153. HANDLE ahHandles[HANDLE_COUNT];
  154. DWORD dwArgsCnt;
  155. DownloadArgs *pdaArgs;
  156. BOOL bAbort;
  157. DWORD dwDataCompleted;
  158. DWORD dwDataTotal;
  159. DWORD dwDataStepSize;
  160. LPTSTR pszServiceName;
  161. HICON hIcon;
  162. HICON hSmallIcon;
  163. BOOL bShow;
  164. DWORD dwFirstEventTime;
  165. DWORD dwHideDelay;
  166. DWORD dwComplete;
  167. CmLogFile Log;
  168. #ifdef EXTENDED_CAB_CONTENTS
  169. TCHAR szInstallTitle[MAX_PATH+1];
  170. DWORD dwRebootCookie;
  171. HINSTANCE hAdvPack;
  172. BOOL bVerified;
  173. #endif // EXTENDED_CAB_CONTENTS
  174. } ArgsStruct;
  175. typedef struct _NotifyArgs
  176. {
  177. DWORD dwAppFlags;
  178. DownloadArgs *pdaArgs;
  179. } NotifyArgs;
  180. //
  181. // Function Prototypes
  182. //
  183. BOOL UpdateVpnFileForProfile(LPCTSTR pszCmpPath);
  184. #endif // _CMDL_INC