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.

234 lines
10 KiB

  1. /*-----------------------------------------------------------------------------
  2. globals.h
  3. General declarations for ICWCONN2
  4. Copyright (C) 1996 Microsoft Corporation
  5. All rights reserved
  6. Authors:
  7. ChrisK Chris Kauffman
  8. Histroy:
  9. 7/22/96 ChrisK Cleaned and formatted
  10. 9/11/98 a-jaswed really Cleaned and formatted
  11. -----------------------------------------------------------------------------*/
  12. #include "debug.h"
  13. #include "resource.h"
  14. #include "helpids.h"
  15. #include "..\inc\icwdial.h"
  16. #include "..\inc\icwerr.h"
  17. #include "..\icwphbk\phbk.h" // need this to get the LPCNTRYNAMELOOKUPELEMENT struct definition
  18. #include "ras2.h"
  19. BOOL LclSetEntryScriptPatch(LPTSTR lpszScript,LPTSTR lpszEntry);
  20. #include "rnaapi.h"
  21. #define DOWNLOAD_LIBRARY TEXT("icwdl.dll")
  22. #define DOWNLOADINIT "DownLoadInit"
  23. #define DOWNLOADEXECUTE "DownLoadExecute"
  24. #define DOWNLOADCLOSE "DownLoadClose"
  25. #define DOWNLOADSETSTATUS "DownLoadSetStatusCallback"
  26. #define DOWNLOADPROCESS "DownLoadProcess"
  27. #define DOWNLOADCANCEL "DownLoadCancel"
  28. #define SIGNUPKEY TEXT("SOFTWARE\\MICROSOFT\\ISIGNUP")
  29. #define GATHERINFOVALUENAME TEXT("UserInfo")
  30. #define RASENTRYVALUENAME TEXT("RasEntryName")
  31. #define IEAPPPATHKEY TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE")
  32. #define MAX_RASENTRYNAME 126
  33. #define AUTODIAL_LIBRARY TEXT("icwdial.dll")
  34. #define AUTODIAL_INIT "AutoDialInit"
  35. #define RASAPI_LIBRARY TEXT("RASAPI32.DLL")
  36. #define RASDELETEAPI "RasDeleteEntryA"
  37. #define RASAPI_RASGETENTRY "RasGetEntryPropertiesA"
  38. #define RASAPI_RASSETENTRY "RasSetEntryPropertiesA"
  39. #define ERROR_USERCANCEL 32767 // quit message value
  40. #define ERROR_USERBACK 32766 // back message value
  41. #define ERROR_USERNEXT 32765 // back message value
  42. #define ERROR_DOWNLOADDIDNT 32764 // download failed
  43. #define MAX_PROMO 64
  44. #define MAX_OEMNAME 64
  45. #define MAX_AREACODE RAS_MaxAreaCode
  46. #define MAX_EXCHANGE 8
  47. #define MAX_VERSION_LEN 40
  48. #define CMD_CONNECTOID TEXT("/CONNECTOID:")
  49. #define CMD_INS TEXT("/INS:")
  50. #define CMD_REBOOT TEXT("/REBOOT")
  51. #define LEN_CONNECTOID sizeof(CMD_CONNECTOID)
  52. #define LEN_INS sizeof(CMD_INS)
  53. #define INSFILE_APPNAME TEXT("ClientSetup")
  54. #define INFFILE_SETUP_CLIENT_URL TEXT("Client_Setup_Url")
  55. #define INFFILE_SETUP_NEW_CALL TEXT("Client_Setup_New_Call")
  56. #define INFFILE_DONE_MESSAGE TEXT("Done_Message")
  57. #define INFFILE_EXPLORE_CMD TEXT("Explore_Command")
  58. #define INFFILE_ENTRYSECTION TEXT("Entry")
  59. #define INFFILE_ENTRY_NAME TEXT("Entry_Name")
  60. #define INFFILE_USER_SECTION TEXT("User")
  61. #define INFFILE_PASSWORD TEXT("Password")
  62. #define INFFILE_ISPSUPP TEXT("ISP_Support_Message")
  63. #define NULLSZ TEXT("")
  64. #define TIMEOUT 15000 // 15 seconds
  65. #define WM_DIENOW WM_USER+1
  66. #define WM_DUMMY WM_USER+2
  67. #define WM_DOWNLOAD_DONE WM_USER+2
  68. #define irgMaxSzs 5
  69. #define MB_MYERROR (MB_APPLMODAL | MB_ICONERROR | MB_SETFOREGROUND)
  70. #define MAX_RETIES 3
  71. #define CALLHOME_SIZE 500
  72. typedef DWORD (WINAPI* PFNRASDELETEENTRY) (LPTSTR lpszPhonebook, LPTSTR lpszEntry);
  73. typedef DWORD (WINAPI* PFNRASGETENTRYPROPERTIES) (LPTSTR lpszPhonebook, LPTSTR lpszEntry, LPBYTE lpbEntryInfo, LPDWORD lpdwEntryInfoSize, LPBYTE lpbDeviceInfo, LPDWORD lpdwDeviceInfoSize);
  74. typedef DWORD (WINAPI* PFNRASSETENTRYPROPERTIES) (LPTSTR lpszPhonebook, LPTSTR lpszEntry, LPBYTE lpbEntryInfo, DWORD dwEntryInfoSize, LPBYTE lpbDeviceInfo, DWORD dwDeviceInfoSize);
  75. typedef DWORD (CALLBACK* PFNRASENUMDEVICES) (LPRASDEVINFO lpRasDevInfo, LPDWORD lpcb, LPDWORD lpcDevices);
  76. typedef HRESULT (CALLBACK* PFNAUTODIALINIT) (LPTSTR lpszISPFile, BYTE fFlags, BYTE bMask, DWORD dwCountry, WORD wState);
  77. typedef HRESULT (CALLBACK* PFNDOWNLOADINIT) (LPTSTR pszURL, DWORD_PTR FAR *pdwDownLoad, HWND hWndMain);
  78. typedef HRESULT (CALLBACK* PFNDOWNLOADEXECUTE) (DWORD_PTR dwDownLoad);
  79. typedef HRESULT (CALLBACK* PFNDOWNLOADCLOSE) (DWORD_PTR dwDownLoad);
  80. typedef HRESULT (CALLBACK* PFNDOWNLOADSETSTATUS) (DWORD_PTR dwDownLoad, INTERNET_STATUS_CALLBACK lpfn);
  81. typedef HRESULT (CALLBACK* PFNDOWNLOADPROCESS) (DWORD_PTR dwDownLoad);
  82. typedef HRESULT (CALLBACK* PFNDOWNLOADCANCEL) (DWORD_PTR dwDownLoad);
  83. typedef HRESULT (WINAPI* PFNINETGETAUTODIAL) (LPBOOL, LPTSTR, DWORD);
  84. typedef BOOL (WINAPI* LCLSETENTRYSCRIPTPATCH) (LPTSTR, LPTSTR);
  85. typedef struct tagGATHEREDINFO
  86. {
  87. LCID m_lcid;
  88. HWND m_hwnd;
  89. DWORD m_dwOS;
  90. DWORD m_dwMajorVersion;
  91. DWORD m_dwMinorVersion;
  92. DWORD m_dwCountry;
  93. WORD m_wState;
  94. WORD m_wArchitecture;
  95. TCHAR m_szAreaCode [MAX_AREACODE+1];
  96. TCHAR m_szExchange [MAX_EXCHANGE+1];
  97. TCHAR m_szPromo [MAX_PROMO];
  98. TCHAR m_szSUVersion [MAX_VERSION_LEN];
  99. TCHAR m_szISPFile [MAX_PATH+1];
  100. TCHAR m_szAppDir [MAX_PATH+1];
  101. BYTE m_fType;
  102. BYTE m_bMask;
  103. LPLINECOUNTRYLIST m_pLineCountryList;
  104. LPCNTRYNAMELOOKUPELEMENT m_rgNameLookUp;
  105. } GATHEREDINFO, *PGATHEREDINFO;
  106. typedef struct _ShowProgressParams
  107. {
  108. HANDLE hProgressReadyEvent;
  109. HWND hwnd;
  110. HWND hwndParent;
  111. HINSTANCE hinst;
  112. DWORD dwThreadID;
  113. } ShowProgressParams, *PShowProgressParams;
  114. typedef struct tagDialDlg
  115. {
  116. HRASCONN m_hrasconn;
  117. LPTSTR m_pszConnectoid;
  118. HANDLE m_hThread;
  119. DWORD m_dwThreadID;
  120. DWORD_PTR m_dwDownLoad;
  121. DWORD m_dwAPIVersion;
  122. HWND m_hwnd;
  123. PGATHEREDINFO m_pGI;
  124. LPTSTR m_pszDisplayable;
  125. LPTSTR m_szUrl;
  126. HLINEAPP m_hLineApp;
  127. HINSTANCE g_hInst;
  128. TCHAR m_szPhoneNumber[256];
  129. BOOL m_bDialAsIs;
  130. UINT m_uiRetry;
  131. } DIALDLG, *PDIALDLG;
  132. typedef struct tagDialErr
  133. {
  134. LPTSTR m_pszConnectoid;
  135. HRESULT m_hrError;
  136. PGATHEREDINFO m_pGI;
  137. HWND m_hwnd;
  138. HLINEAPP m_hLineApp;
  139. DWORD m_dwAPIVersion;
  140. TCHAR m_szPhoneNumber[256];
  141. LPTSTR m_pszDisplayable;
  142. HINSTANCE m_hInst;
  143. LPRASDEVINFO m_lprasdevinfo;
  144. } DIALERR, *PDIALERR;
  145. typedef struct tagDEVICE
  146. {
  147. DWORD dwTapiDev;
  148. RASDEVINFO RasDevInfo;
  149. } MYDEVICE, *PMYDEVICE;
  150. extern "C" INT_PTR CALLBACK FAR PASCAL DialDlgProc (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam);
  151. extern "C" INT_PTR CALLBACK FAR PASCAL DialErrDlgProc (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam);
  152. extern "C" INT_PTR CALLBACK FAR PASCAL DialReallyCancelDlgProc (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam);
  153. extern HRESULT MyRasGetEntryProperties(LPTSTR lpszPhonebookFile,
  154. LPTSTR lpszPhonebookEntry,
  155. LPRASENTRY *lplpRasEntryBuff,
  156. LPDWORD lpdwRasEntryBuffSize,
  157. LPRASDEVINFO *lplpRasDevInfoBuff,
  158. LPDWORD lpdwRasDevInfoBuffSize);
  159. extern PMYDEVICE g_pdevice;
  160. extern TCHAR pszINSFileName[MAX_PATH+2];
  161. extern TCHAR pszFinalConnectoid[MAX_PATH+1];
  162. extern HRASCONN hrasconn;
  163. extern TCHAR pszSetupClientURL[1024];
  164. extern UINT uiSetupClientNewPhoneCall;
  165. extern ShowProgressParams SPParams;
  166. extern RECT rect;
  167. extern HBRUSH hbBackBrush;
  168. extern BOOL fUserCanceled;
  169. extern TCHAR szBuff256[256];
  170. extern HANDLE hThread;
  171. extern DWORD dwThreadID;
  172. extern DWORD_PTR dwDownLoad;
  173. extern DWORD g_fNeedReboot;
  174. extern BOOL g_bProgressBarVisible;
  175. HRESULT ReleaseBold (HWND hwnd);
  176. HRESULT WINAPI StatusMessageCallback (DWORD dwStatus, LPTSTR pszBuffer, DWORD dwBufferSize);
  177. HRESULT DeleteFileKindaLikeThisOne (LPTSTR lpszFileName);
  178. HRESULT DialDlg ();
  179. HRESULT MakeBold (HWND hwnd, BOOL fSize, LONG lfWeight);
  180. HRESULT ShowDialReallyCancelDialog (HINSTANCE hInst, HWND hwnd, LPTSTR pszHomePhone);
  181. HRESULT FillModems ();
  182. HRESULT DialErrGetDisplayableNumber ();
  183. HRESULT GetDisplayableNumberDialDlg ();
  184. HRESULT ShowDialErrDialog (PGATHEREDINFO pGI, HRESULT hrErr, LPTSTR pszConnectoid, HINSTANCE hInst, HWND hwnd);
  185. HRESULT ShowDialingDialog (LPTSTR pszConnectoid, PGATHEREDINFO pGI, LPTSTR szUrl, HINSTANCE hInst, HWND hwnd, LPTSTR szINSFile);
  186. LPTSTR StrDup (LPTSTR *ppszDest,LPCTSTR pszSource);
  187. LPTSTR GetSz (WORD wszID);
  188. WORD RasErrorToIDS (DWORD dwErr);
  189. BOOL FShouldRetry (HRESULT hrErr);
  190. BOOL WaitForConnectionTermination (HRASCONN hConn);
  191. BOOL FileExists (TCHAR *pszINSFileName);
  192. void MinimizeRNAWindow (LPTSTR pszConnectoidName, HINSTANCE hInst);
  193. void CALLBACK LineCallback (DWORD hDevice,
  194. DWORD dwMessage,
  195. DWORD dwInstance,
  196. DWORD dwParam1,
  197. DWORD dwParam2,
  198. DWORD dwParam3);
  199. DWORD WINAPI ThreadInit();
  200. inline BOOL IsNT(void)
  201. {
  202. OSVERSIONINFO OsVersionInfo;
  203. ZeroMemory(&OsVersionInfo, sizeof(OSVERSIONINFO));
  204. OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  205. GetVersionEx(&OsVersionInfo);
  206. return (VER_PLATFORM_WIN32_NT == OsVersionInfo.dwPlatformId);
  207. }
  208. #define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))