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.

188 lines
5.9 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. #include <stdio.h>
  30. #include <io.h>
  31. #include "base_str.h"
  32. #include "dl_str.h"
  33. #include "mgr_str.h"
  34. #include "pbk_str.h"
  35. #include "log_str.h"
  36. #include "cm_def.h"
  37. #include "resource.h"
  38. #include "cm_phbk.h"
  39. #include "cmdebug.h"
  40. #include "cmutil.h"
  41. #include "cmlog.h"
  42. #include "mutex.h"
  43. #include "cmfdi.h"
  44. #include "util.h"
  45. #include "pnpuverp.h"
  46. #include "inetopt.h"
  47. #define BUFFER_LENGTH (8*1024) // buffer length for i/o
  48. #define DEFAULT_DELAY (2*60) // default delay before downloading, in seconds
  49. #define DEFAULT_HIDE (-1) // default number of milliseconds to keep window hidden
  50. const TCHAR* const c_pszPbdFile = TEXT("PBUPDATE.PBD"); // for detecting itPbdInCab
  51. #define IDX_INETTHREAD_HANDLE 0 // must be *first*
  52. #define IDX_EVENT_HANDLE 1
  53. #define HANDLE_COUNT 2
  54. extern "C" __declspec(dllimport) HRESULT WINAPI PhoneBookLoad(LPCSTR pszISP, DWORD_PTR *pdwPB);
  55. extern "C" __declspec(dllimport) HRESULT WINAPI PhoneBookUnload(DWORD_PTR dwPB);
  56. extern "C" __declspec(dllimport) HRESULT WINAPI PhoneBookMergeChanges(DWORD_PTR dwPB, LPCSTR pszChangeFile);
  57. typedef enum _EventType {
  58. etDataBegin,
  59. etDataReceived,
  60. etDataEnd,
  61. etInstall,
  62. etDone,
  63. etICMTerm
  64. } EventType;
  65. // Values for dwAppFlags
  66. #define AF_NO_DELETE 0x0001 // does not delete file(s) on exit
  67. #define AF_NO_INSTALL 0x0002 // downloads and verifies, but does not install
  68. #ifdef DEBUG
  69. #define AF_NO_VERIFY 0x0004 // bypasses WinVerifyTrust() - only available in DEBUG builds
  70. #endif
  71. #define AF_NO_PROFILE 0x0008 // no profile on command line (and hence must use AF_URL, and no phone book delta support)
  72. #define AF_URL 0x0010 // URL on command line (in next token) instead of in profile->service
  73. #define AF_NO_EXE 0x0020 // disable running of .EXEs
  74. #define AF_NO_EXEINCAB 0x0040 // disable running of PBUPDATE.EXE from .CAB
  75. #define AF_NO_INFINCAB 0x0080 // disable running of PBUPDATE.INF from .CAB
  76. #define AF_NO_PBDINCAB 0x0100 // disable running of PBUPDATE.PBD from .CAB
  77. #define AF_NO_SHLINCAB 0x0200 // disable running of first file in .CAB
  78. #define AF_NO_VER 0x0400 // disable updating of phone book version
  79. //#define AF_NO_UPDATE 0x0800 // don't do any work
  80. #define AF_LAN 0x1000 // update request is over a LAN, don't look for the RAS connection before download
  81. #define AF_VPN 0x2000 // this is a VPN file update request instead of a PBK update request
  82. typedef void (*EVENTFUNC)(DWORD,DWORD,LPVOID);
  83. // NOTE - the values in enum _InstallType are in sorted order! Higher values have
  84. // higher precendence.
  85. typedef enum _InstallType {
  86. itInvalid = 0, // Must be 0.
  87. itPbdInCab,
  88. itPbkInCab,
  89. itPbrInCab,
  90. } InstallType;
  91. // the info on how we process each file we find in the cab
  92. typedef struct _FILEPROCESSINFO {
  93. LPTSTR pszFile;
  94. InstallType itType;
  95. } FILEPROCESSINFO, *PFILEPROCESSINFO;
  96. // download args, one per URL(or .cms)
  97. typedef struct _DownloadArgs {
  98. LPTSTR pszCMSFile;
  99. LPTSTR pszPbkFile;
  100. LPTSTR pszPbrFile;
  101. LPTSTR pszUrl;
  102. LPTSTR pszVerCurr;
  103. LPTSTR pszVerNew;
  104. LPTSTR pszPhoneBookName;
  105. LPURL_COMPONENTS psUrl;
  106. HINTERNET hInet;
  107. HINTERNET hConn;
  108. HINTERNET hReq;
  109. TCHAR szFile[MAX_PATH+1];
  110. EVENTFUNC pfnEvent;
  111. LPVOID pvEventParam;
  112. DWORD dwTransferred;
  113. DWORD dwTotalSize;
  114. BOOL bTransferOk;
  115. BOOL * volatile pbAbort;
  116. TCHAR szCabDir[MAX_PATH+1];
  117. BOOL fContainsExeOrInf;
  118. TCHAR szHostName[MAX_PATH+1];
  119. DWORD dwBubbledUpError;
  120. DWORD dwNumFilesToProcess;
  121. PFILEPROCESSINFO rgfpiFileProcessInfo;
  122. } DownloadArgs;
  123. typedef struct _ArgsStruct {
  124. HINSTANCE hInst;
  125. DWORD dwDownloadDelay;
  126. LPTSTR pszProfile;
  127. DWORD dwAppFlags;
  128. UINT nMsgId;
  129. HWND hwndDlg;
  130. DWORD dwHandles;
  131. HANDLE ahHandles[HANDLE_COUNT];
  132. DWORD dwArgsCnt;
  133. DownloadArgs *pdaArgs;
  134. BOOL bAbort;
  135. DWORD dwDataCompleted;
  136. DWORD dwDataTotal;
  137. DWORD dwDataStepSize;
  138. LPTSTR pszServiceName;
  139. HICON hIcon;
  140. HICON hSmallIcon;
  141. BOOL bShow;
  142. DWORD dwFirstEventTime;
  143. DWORD dwHideDelay;
  144. DWORD dwComplete;
  145. CmLogFile Log;
  146. } ArgsStruct;
  147. typedef struct _NotifyArgs
  148. {
  149. DWORD dwAppFlags;
  150. DownloadArgs *pdaArgs;
  151. } NotifyArgs;
  152. //
  153. // Function Prototypes
  154. //
  155. BOOL UpdateVpnFileForProfile(LPCTSTR pszCmpPath, LPCTSTR pszCmsPath, CmLogFile * pLog, BOOL bCheckConnection);
  156. BOOL IsConnectionAlive(LPCSTR pszConnectionName);
  157. #endif // _CMDL_INC