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.

644 lines
25 KiB

  1. //--------------------------------------------------------------------------------
  2. // icwglob.h
  3. // The information contained in this file is the sole property of Microsoft Corporation.
  4. // Copywrite Microsoft 1998
  5. //
  6. // Created 1/7/98, DONALDM
  7. //--------------------------------------------------------------------------------
  8. //-----------------------------------------------------------------------------
  9. // INCLUDES
  10. #include <wininet.h>
  11. #include "enumodem.h"
  12. #include "..\inc\debug.h"
  13. #include "..\inc\inetcfg.h"
  14. #include "..\inc\ras2.h"
  15. #include "..\icwphbk\phbk.h"
  16. // #include "..\icwdl\mydefs.h"
  17. #include <rnaapi.h>
  18. //-----------------------------------------------------------------------------
  19. // DEFINES
  20. #define ERROR_USERCANCEL 32767 // quit message value
  21. #define ERROR_USERBACK 32766 // back message value
  22. #define ERROR_USERNEXT 32765 // back message value
  23. #define ERROR_DOWNLOADIDNT 32764 // Download failure
  24. #define ERROR_READING_DUN 32768
  25. #define ERROR_READING_ISP 32769
  26. #define ERROR_PHBK_NOT_FOUND 32770
  27. #define ERROR_DOWNLOAD_NOT_FOUND 32771
  28. #define cMarvelBpsMin 2400 // minimum modem speed
  29. #define INVALID_PORTID UINT_MAX
  30. #define pcszDataModem TEXT("comm/datamodem")
  31. //#define MsgBox(m,s) MessageBox(g_hwndBack,GetSz(m),GetSz(IDS_TITLE),s)
  32. #if defined(WIN16)
  33. #define MsgBox(m,s) MessageBox(g_hwndMessage,GetSz(m),GetSz(IDS_TITLE),s)
  34. #endif
  35. #define szLoginKey TEXT("Software\\Microsoft\\MOS\\Connection")
  36. #define szCurrentComDev TEXT("CurrentCommDev")
  37. #define szTollFree TEXT("OlRegPhone")
  38. #define CCD_BUFFER_SIZE 255
  39. #define szSignupConnectoidName TEXT("MSN Signup Connection")
  40. #define szSignupDeviceKey TEXT("SignupCommDevice")
  41. #define KEYVALUE_SIGNUPID TEXT("iSignUp")
  42. #define RASENTRYVALUENAME TEXT("RasEntryName")
  43. #define GATHERINFOVALUENAME TEXT("UserInfo")
  44. #define INFFILE_USER_SECTION TEXT("User")
  45. #define INFFILE_PASSWORD TEXT("Password")
  46. #define NULLSZ TEXT("")
  47. #define cchMoreSpace 22000 // bytes needed to hold results of lineGetCountry(0,...).
  48. // Currently this function returns about 16K, docs say 20K,
  49. // this should be enough.
  50. #define DwFromSz(sz) Sz2Dw(sz) //make it inline, so this is faster.
  51. #define DwFromSzFast(sz) Sz2DwFast(sz)
  52. #define CONNECT_SIGNUPFIRST 1 // phonenumber constant for determining the firstcall phonenumber TO DO
  53. #define CONNECTFLAGS_MASK_TOLLFREE 0x01
  54. #define CONNECTFLAGS_MASK_TCP 0x02
  55. #define CONNECTFLAGS_MASK_ISDN 0x04
  56. #define CONNECTFLAGS_MASK_DIRECT 0x08
  57. #define CONNECTFLAGS_MASK_OTHERDIALUP 0x10
  58. #define CONNECTFLAGS_MASK_PROXY 0x20
  59. #define CONNECTFLAGS_MASK_FIRST CONNECTFLAGS_MASK_TCP
  60. #define CONNECTFLAGS_MASK_LAST CONNECTFLAGS_MASK_ISDN
  61. #define CONNECTMSNDIALUP(dw) ((dw & (CONNECTFLAGS_MASK_TOLLFREE|CONNECTFLAGS_M
  62. #define LANORSHUTTLE(dw) ((dw)==10 || (dw)==34)
  63. #define IS_SHUTTLE(dw) ((dw)==34)
  64. #define IS_ISP(dw) ((dw)==18)
  65. #define CONNECTPROTOCOL_MSNDIALUPX25 0
  66. #define CONNECTPROTOCOL_MSNDIALUPTCP 2
  67. #define CONNECTPROTOCOL_MSNDIALUPTCPISDN 6
  68. #define CONNECTPROTOCOL_LANDIRECT 10
  69. #define CONNECTPROTOCOL_ISPDIALUPTCP 18
  70. #define CONNECTPROTOCOL_LANSHUTTLE 34
  71. #define clineMaxATT 16 //for 950 MNEMONIC
  72. #define NXXMin 200
  73. #define NXXMax 999
  74. #define cbgrbitNXX ((NXXMax + 1 - NXXMin) / 8)
  75. #define crgnpab (NPAMax + 1 - NPAMin)
  76. #define MAX_PROMO 64
  77. #define MAX_OEMNAME 64
  78. #define MAX_AREACODE RAS_MaxAreaCode
  79. #define MAX_RELPROD 8
  80. #define MAX_RELVER 30
  81. #define MAX_STRING 256 //used by ErrorMsg1 in mt.cpp
  82. #define PHONEBOOK_LIBRARY TEXT("icwphbk.DLL")
  83. #ifdef WIN16
  84. #define PHBK_LOADAPI "PhoneBookLoad"
  85. #define PHBK_SUGGESTAPI "PhoneBookSuggestNumbers"
  86. #define PHBK_DISPLAYAPI "PhoneBookDisplaySignUpNumbers"
  87. #define PHBK_UNLOADAPI "PhoneBookUnload"
  88. #define PHBK_GETCANONICAL "PhoneBookGetCanonical"
  89. #else
  90. #define PHBK_LOADAPI "PhoneBookLoad"
  91. #define PHBK_SUGGESTAPI "PhoneBookSuggestNumbers"
  92. #define PHBK_DISPLAYAPI "PhoneBookDisplaySignUpNumbers"
  93. #define PHBK_UNLOADAPI "PhoneBookUnload"
  94. #define PHBK_GETCANONICAL "PhoneBookGetCanonical"
  95. #endif
  96. #define NUM_PHBK_SUGGESTIONS 50
  97. #define TYPE_SIGNUP_ANY 0x82
  98. #define MASK_SIGNUP_ANY 0xB2
  99. #define DOWNLOAD_LIBRARY TEXT("icwdl.dll")
  100. #if defined(WIN16)
  101. #define DOWNLOADINIT "DownLoadInit"
  102. #define DOWNLOADEXECUTE "DownLoadExecute"
  103. #define DOWNLOADCLOSE "DownLoadClose"
  104. #define DOWNLOADSETSTATUS "DownLoadSetStatusCallback"
  105. #define DOWNLOADPROCESS "DownLoadProcess"
  106. #define DOWNLOADCANCEL "DownLoadCancel"
  107. #else
  108. #define DOWNLOADINIT "DownLoadInit"
  109. #define DOWNLOADEXECUTE "DownLoadExecute"
  110. #define DOWNLOADCLOSE "DownLoadClose"
  111. #define DOWNLOADSETSTATUS "DownLoadSetStatusCallback"
  112. #define DOWNLOADPROCESS "DownLoadProcess"
  113. #define DOWNLOADCANCEL "DownLoadCancel"
  114. #endif
  115. #if defined(WIN16)
  116. extern "C" void CALLBACK __export DialCallback(UINT uiMsg,
  117. RASCONNSTATE rasState,
  118. DWORD dwErr);
  119. #endif
  120. //#define RASENUMAPI "RasEnumConnectionsA"
  121. //#define RASHANGUP "RasHangUpA"
  122. #define INF_SUFFIX TEXT(".ISP")
  123. #define INF_PHONE_BOOK TEXT("PhoneBookFile")
  124. #define INF_DUN_FILE TEXT("DUNFile")
  125. #define INF_REFERAL_URL TEXT("URLReferral")
  126. #define INF_SIGNUPEXE TEXT("Sign_Up_EXE")
  127. #define INF_SIGNUPPARAMS TEXT("Sign_Up_Params")
  128. #define INF_WELCOME_LABEL TEXT("Welcome_Label")
  129. #define INF_ISP_MSNSU TEXT("MSICW")
  130. #define INF_SIGNUP_URL TEXT("Signup")
  131. #define INF_AUTOCONFIG_URL TEXT("AutoConfig")
  132. #define INF_ISDN_URL TEXT("ISDNSignup")
  133. #define INF_ISDN_AUTOCONFIG_URL TEXT("ISDNAutoConfig")
  134. #define INF_SECTION_URL TEXT("URL")
  135. #define INF_SECTION_ISPINFO TEXT("ISP INFO")
  136. #define DUN_NOPHONENUMBER TEXT("000000000000")
  137. #define DUN_NOPHONENUMBER_A "000000000000"
  138. #define MAX_VERSION_LEN 40
  139. #define MB_MYERROR (MB_APPLMODAL | MB_ICONERROR | MB_SETFOREGROUND)
  140. // 8/9/96 jmazner
  141. // Added new macro to fix MOS Normandy Bug #4170
  142. #define MB_MYINFORMATION (MB_APPLMODAL | MB_ICONINFORMATION | MB_SETFOREGROUND)
  143. // 8/27/96 jmazner
  144. #define MB_MYEXCLAMATION (MB_APPLMODAL | MB_ICONEXCLAMATION | MB_SETFOREGROUND)
  145. #define WM_STATECHANGE WM_USER
  146. #define WM_DIENOW WM_USER + 1
  147. #define WM_DUMMY WM_USER + 2
  148. #define WM_DOWNLOAD_DONE WM_USER + 3
  149. #define WM_DOWNLOAD_PROGRESS WM_USER + 4
  150. #define WM_MYINITDIALOG (WM_USER + 4)
  151. #define MAX_REDIALS 2
  152. #define REG_USER_INFO TEXT("Software\\Microsoft\\User information")
  153. #define REG_USER_NAME1 TEXT("Default First Name")
  154. #define REG_USER_NAME2 TEXT("Default Last Name")
  155. #define REG_USER_COMPANY TEXT("Default Company")
  156. #define REG_USER_ADDRESS1 TEXT("Mailing Address")
  157. #define REG_USER_ADDRESS2 TEXT("Additional Address")
  158. #define REG_USER_CITY TEXT("City")
  159. #define REG_USER_STATE TEXT("State")
  160. #define REG_USER_ZIP TEXT("ZIP Code")
  161. #define REG_USER_PHONE TEXT("Daytime Phone")
  162. #define REG_USER_COUNTRY TEXT("Country")
  163. #define SIGNUPKEY TEXT("SOFTWARE\\MICROSOFT\\GETCONN")
  164. #define DEVICENAMEKEY TEXT("DeviceName") // used to store user's choice among multiple modems
  165. #define DEVICETYPEKEY TEXT("DeviceType")
  166. #define ICWSETTINGSPATH TEXT("Software\\Microsoft\\Internet Connection Wizard")
  167. #define ICWBUSYMESSAGES TEXT("Software\\Microsoft\\Internet Connection Wizard\\Busy Messages")
  168. #define RELEASEPRODUCTKEY TEXT("Release Product")
  169. #define RELEASEVERSIONKEY TEXT("Release Product Version")
  170. #define SETUPPATH_NONE TEXT("current")
  171. #define SETUPPATH_MANUAL TEXT("manual")
  172. #define SETUPPATH_AUTO TEXT("automatic")
  173. #define MAX_SETUPPATH_TOKEN 200
  174. // 12/3/96 jmazner superceded by definitions in ..\common\inc\semaphor.h
  175. //#define SEMAPHORE_NAME "Internet Connection Wizard ICWCONN1.EXE"
  176. //
  177. // 5/24/97 ChrisK Olympus 4650
  178. //
  179. #define RASDEVICETYPE_VPN TEXT("VPN")
  180. #define RASDEVICETYPE_MODEM TEXT("MODEM")
  181. #define RASDEVICETYPE_ISDN TEXT("ISDN")
  182. //--------------------------------------------------------------------------------
  183. // Type declarations
  184. // NOTE: due to code in connmain, the order of these IS IMPORTANT. They should be
  185. // in the same order that they appear.
  186. enum CState
  187. {
  188. STATE_WELCOME = 0,
  189. STATE_INITIAL,
  190. STATE_BEGINAUTO,
  191. STATE_CONTEXT1,
  192. STATE_NETWORK,
  193. STATE_AUTORUNSIGNUPWIZARD,
  194. STATE_GATHERINFO,
  195. STATE_DOWNLOADISPLIST,
  196. STATE_SHELLPARTTWO,
  197. STATE_MAX
  198. };
  199. typedef HINTERNET (WINAPI* PFNINTERNETOPEN) (LPCTSTR lpszCallerName, DWORD dwAccessType, LPCTSTR lpszProxyName, INTERNET_PORT nProxyPort, DWORD dwFlags);
  200. typedef HINTERNET (CALLBACK* PFNINTERNETOPENURL) (HINSTANCE hInternetSession,
  201. LPCTSTR lpszUrl, LPCTSTR lpszHeaders,
  202. DWORD dwHeadersLength, DWORD dwFlags,
  203. DWORD dwContext);
  204. typedef INTERNET_STATUS_CALLBACK (CALLBACK *PFNINTERNETSETSTATUSCALLBACK)(HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnInternetCallback);
  205. typedef BOOL (CALLBACK *PFNINTERNETCLOSEHANDLE)(HINTERNET hInet);
  206. typedef HRESULT (CALLBACK* PFNPHONEBOOKLOAD)(LPCTSTR pszISPCode, DWORD_PTR *pdwPhoneID);
  207. typedef HRESULT (CALLBACK* PFPHONEBOOKSUGGEST)(DWORD_PTR dwPhoneID, PSUGGESTINFO pSuggestInfo);
  208. typedef HRESULT (CALLBACK* PFNPHONEDISPLAY)(DWORD_PTR dwPhoneID, LPTSTR *ppszPhoneNumbers,
  209. LPTSTR *ppszDunFiles, WORD *pwPhoneNumbers,
  210. DWORD *pdwCountry,WORD *pwRegion,BYTE fType,
  211. BYTE bMask,HWND hwndParent,DWORD dwFlags);
  212. typedef HRESULT (CALLBACK *PFNPHONEBOOKUNLOAD) (DWORD_PTR dwPhoneID);
  213. typedef HRESULT (CALLBACK *PFNPHONEBOOKGETCANONICAL)(DWORD_PTR dwPhoneID, PACCESSENTRY pAE, TCHAR *psOut);
  214. typedef HRESULT (CALLBACK *PFNCONFIGAPI)(HWND hwndParent,DWORD dwfOptions,LPBOOL lpfNeedsRestart);
  215. typedef HRESULT (WINAPI *PFNINETCONFIGSYSTEM)(HWND,LPCTSTR,LPCTSTR,LPRASENTRY,LPCTSTR,LPCTSTR,LPCTSTR,LPVOID,DWORD,LPBOOL);
  216. typedef HRESULT (WINAPI *PFINETSTARTSERVICES)(void);
  217. typedef DWORD (WINAPI *PFNLAUNCHSIGNUPWIZARDEX)(LPTSTR,int, PBOOL);
  218. typedef VOID (WINAPI *PFNFREESIGNUPWIZARD) (VOID);
  219. typedef DWORD (WINAPI *PFNISSMARTSTART)(VOID);
  220. typedef DWORD (WINAPI *PFNINETCONFIGCLIENT)(HWND hwndParent, LPCTSTR lpszPhoneBook,LPCTSTR lpszEntryName, LPRASENTRY lpRasEntry,LPCTSTR lpszUserName, LPCTSTR lpszPassword,LPCTSTR lpszProfile, LPINETCLIENTINFO lpClientInfo,DWORD dwfOptions, LPBOOL lpfNeedsRestart);
  221. typedef DWORD (WINAPI *PFNINETGETAUTODIAL)(LPBOOL lpfEnable, LPCTSTR lpszEntryName, DWORD cbEntryNameSize);
  222. typedef DWORD (WINAPI *PFNINETSETAUTODIAL)(BOOL fEnable, LPCTSTR lpszEntryName);
  223. typedef DWORD (WINAPI *PFNINETGETCLIENTINFO)(LPCTSTR lpszProfile, LPINETCLIENTINFO lpClientInfo);
  224. typedef DWORD (WINAPI *PFNINETSETCLIENTINFO)(LPCTSTR lpszProfile, LPINETCLIENTINFO lpClientInfo);
  225. typedef DWORD (WINAPI *PFNINETGETPROXY)(LPBOOL lpfEnable, LPCTSTR lpszServer, DWORD cbServer,LPCTSTR lpszOverride, DWORD cbOverride);
  226. typedef DWORD (WINAPI *PFNINETSETPROXY)(BOOL fEnable, LPCTSTR lpszServer, LPCTSTR lpszOverride);
  227. typedef BOOL (WINAPI *PFNBRANDICW)(LPCSTR pszIns, LPCSTR pszPath, DWORD dwFlags, LPCSTR pszConnectoid);
  228. typedef DWORD (WINAPI *PFNRASSETAUTODIALADDRESS)(LPTSTR lpszAddress,DWORD dwReserved,LPRASAUTODIALENTRY lpAutoDialEntries,DWORD dwcbAutoDialEntries,DWORD dwcAutoDialEntries);
  229. typedef DWORD (WINAPI *PFNRASSETAUTODIALENABLE)(DWORD dwDialingLocation, BOOL fEnabled);
  230. typedef HRESULT (CALLBACK *PFNDOWNLOADINIT)(LPTSTR pszURL, DWORD_PTR FAR *pdwCDialDlg, DWORD_PTR FAR *pdwDownLoad, HWND g_hWndMain);
  231. typedef HRESULT (CALLBACK *PFNDOWNLOADGETSESSION)(DWORD_PTR dwDownLoad, HINTERNET *phInternet);
  232. typedef HRESULT (CALLBACK *PFNDOWNLOADCANCEL)(DWORD_PTR dwDownLoad);
  233. typedef HRESULT (CALLBACK *PFNDOWNLOADEXECUTE)(DWORD_PTR dwDownLoad);
  234. typedef HRESULT (CALLBACK *PFNDOWNLOADCLOSE)(DWORD_PTR dwDownLoad);
  235. typedef HRESULT (CALLBACK *PFNDOWNLOADSETSTATUS)(DWORD_PTR dwDownLoad, INTERNET_STATUS_CALLBACK lpfn);
  236. typedef HRESULT (CALLBACK *PFNDOWNLOADPROCESS)(DWORD_PTR dwDownLoad);
  237. typedef HRESULT (CALLBACK *PFNAUTODIALINIT)(LPTSTR lpszISPFile, BYTE fFlags, BYTE bMask, DWORD dwCountry, WORD wState);
  238. typedef struct tagGatherInfo
  239. {
  240. LCID m_lcidUser;
  241. LCID m_lcidSys;
  242. LCID m_lcidApps;
  243. DWORD m_dwOS;
  244. DWORD m_dwMajorVersion;
  245. DWORD m_dwMinorVersion;
  246. WORD m_wArchitecture;
  247. TCHAR m_szPromo[MAX_PROMO];
  248. DWORD m_dwCountry;
  249. TCHAR m_szAreaCode[MAX_AREACODE+1];
  250. HWND m_hwnd;
  251. LPLINECOUNTRYLIST m_pLineCountryList;
  252. LPCNTRYNAMELOOKUPELEMENT m_rgNameLookUp;
  253. TCHAR m_szSUVersion[MAX_VERSION_LEN];
  254. WORD m_wState;
  255. BYTE m_fType;
  256. BYTE m_bMask;
  257. TCHAR m_szISPFile[MAX_PATH+1];
  258. TCHAR m_szAppDir[MAX_PATH+1];
  259. TCHAR m_szRelProd[MAX_RELPROD + 1];
  260. TCHAR m_szRelVer[MAX_RELVER + 1];
  261. DWORD m_dwFlag;
  262. } GATHERINFO, *LPGATHERINFO;
  263. typedef struct tagRASDEVICE
  264. {
  265. LPRASDEVINFO lpRasDevInfo;
  266. DWORD dwTapiDev;
  267. } RASDEVICE, *PRASDEVICE;
  268. //--------------------------------------------------------------------------------
  269. // Prototypes
  270. DWORD ConfigRasEntryDevice( LPRASENTRY lpRasEntry );
  271. BOOL FInsureTCPIP();
  272. LPTSTR GetSz(WORD wszID);
  273. #ifdef UNICODE
  274. LPSTR GetSzA(WORD wszID);
  275. #endif
  276. void SetStatusArrow(CState wState);
  277. BOOL FInsureModemTAPI(HWND hwnd);
  278. BOOL FGetModemSpeed(PDWORD pdwSpeed);
  279. BOOL FGetDeviceID(HLINEAPP *phLineApp, PDWORD pdwAPI, PDWORD pdwDevice);
  280. BOOL FDoModemWizard(HWND hWnd);
  281. void CALLBACK LineCallback(DWORD hDevice, DWORD dwMessage, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3);
  282. BOOL FInsureNetwork(PBOOL pfNeedReboot);
  283. BOOL TestInternetConnection();
  284. inline DWORD Sz2Dw(LPCTSTR pSz);
  285. inline DWORD Sz2DwFast(LPCTSTR pSz);
  286. inline BOOL FSz2Dw(LPCTSTR pSz,LPDWORD dw);
  287. int __cdecl CompareCountryNames(const void *pv1, const void *pv2);
  288. DWORD GetCurrentTapiCountryID(void);
  289. int __cdecl CompareNPAEntry(const void *pv1, const void *pv2);
  290. //HRESULT GatherInformation(LPGATHERINFO pGatheredInfo, HWND hwndParent);
  291. HRESULT DownLoadISPInfo(GATHERINFO *pGI);
  292. HRESULT GetDataFromISPFile(LPTSTR pszISPCode, LPTSTR pszSection, LPTSTR pszDataName, LPTSTR pszOutput,
  293. DWORD dwOutputLength);
  294. HRESULT GetINTFromISPFile
  295. (
  296. LPTSTR pszISPCode,
  297. LPTSTR pszSection,
  298. LPTSTR pszDataName,
  299. int far *lpData,
  300. int iDefaultValue
  301. );
  302. HRESULT StoreInSignUpReg(LPBYTE lpbData, DWORD dwSize, DWORD dwType, LPCTSTR pszKey);
  303. HRESULT ReadSignUpReg(LPBYTE lpbData, DWORD *pdwSize, DWORD dwType, LPCTSTR pszKey);
  304. void CALLBACK LineCallback(DWORD hDevice,
  305. DWORD dwMessage,
  306. DWORD dwInstance,
  307. DWORD dwParam1,
  308. DWORD dwParam2,
  309. DWORD dwParam3);
  310. VOID WINAPI MyProgressCallBack(
  311. HINTERNET hInternet,
  312. DWORD dwContext,
  313. DWORD dwInternetStatus,
  314. LPVOID lpvStatusInformation,
  315. DWORD dwStatusInformationLength
  316. );
  317. HRESULT ReleaseBold(HWND hwnd);
  318. HRESULT MakeBold (HWND hwnd, BOOL fSize, LONG lfWeight);
  319. HRESULT ShowPickANumberDlg(PSUGGESTINFO pSuggestInfo);
  320. //HRESULT ShowDialingDialog(LPTSTR, LPGATHERINFO, LPTSTR);
  321. DWORD RasErrorToIDS(DWORD dwErr);
  322. HRESULT CreateEntryFromDUNFile(LPTSTR pszDunFile);
  323. //HRESULT RestoreHappyWelcomeScreen();
  324. HRESULT KillHappyWelcomeScreen();
  325. HRESULT GetCurrentWebSettings();
  326. LPTSTR LoadInfoFromWindowUser();
  327. HRESULT GetTapiCountryID2(LPDWORD pdwCountryID);
  328. HRESULT RestoreAutodialer();
  329. //HRESULT FilterStringDigits(LPTSTR);
  330. BOOL IsDigitString(LPTSTR szBuff);
  331. BOOL WaitForAppExit(HINSTANCE hInstance);
  332. VOID PrepareForRunOnceApp(VOID);
  333. void MinimizeRNAWindow(LPTSTR pszConnectoidName, HINSTANCE hInst);
  334. // 3/18/97 ChrisK Olympus 304
  335. DWORD MyGetTempPath(UINT uiLength, LPTSTR szPath);
  336. // 3/28/97 ChrisK Olympus 296
  337. void StopRNAReestablishZapper(HANDLE hthread);
  338. HANDLE LaunchRNAReestablishZapper(HINSTANCE hInst);
  339. BOOL FGetSystemShutdownPrivledge();
  340. BOOL LclSetEntryScriptPatch(LPTSTR lpszScript,LPTSTR lpszEntry);
  341. BOOL IsScriptingInstalled();
  342. void InstallScripter(void);
  343. void DeleteStartUpCommand ();
  344. extern BOOL IsNT (VOID);
  345. extern BOOL IsNT4SP3Lower (VOID);
  346. //
  347. // ChrisK Olympus 6368 6/24/97
  348. //
  349. VOID Win95JMoveDlgItem( HWND hwndParent, HWND hwndItem, int iUp );
  350. #if defined(DEBUG)
  351. void LoadTestingLocaleOverride(LPDWORD lpdwCountryID, LCID FAR *lplcid);
  352. BOOL FCampusNetOverride();
  353. BOOL FRefURLOverride();
  354. void TweakRefURL( TCHAR* szUrl,
  355. LCID* lcid,
  356. DWORD* dwOS,
  357. DWORD* dwMajorVersion,
  358. DWORD* dwMinorVersion,
  359. WORD* wArchitecture,
  360. TCHAR* szPromo,
  361. TCHAR* szOEM,
  362. TCHAR* szArea,
  363. DWORD* dwCountry,
  364. TCHAR* szSUVersion,//&m_lpGatherInfo->m_szSUVersion[0],
  365. TCHAR* szProd,
  366. DWORD* dwBuildNumber, //For this we really want to LOWORD
  367. TCHAR* szRelProd,
  368. TCHAR* szRelProdVer,
  369. DWORD* dwCONNWIZVersion,
  370. TCHAR* szPID,
  371. long* lAllOffers);
  372. #endif //DEBUG
  373. //#ifdef __cplusplus
  374. //extern "C" {
  375. //#endif // __cplusplus
  376. LPTSTR FileToPath(LPTSTR pszFile);
  377. HRESULT ANSI2URLValue(TCHAR *s, TCHAR *buf, UINT uiLen);
  378. BOOL BreakUpPhoneNumber(LPRASENTRY prasentry, LPTSTR pszPhone);
  379. extern "C" int _cdecl _purecall(void);
  380. // //10/24/96 jmazner Normandy 6968
  381. // //No longer neccessary thanks to Valdon's hooks for invoking ICW.
  382. // 11/21/96 jmazner Normandy 11812
  383. // oops, it _is_ neccessary, since if user downgrades from IE 4 to IE 3,
  384. // ICW 1.1 needs to morph the IE 3 icon.
  385. HRESULT GetDeskTopInternetCommand();
  386. HRESULT RestoreDeskTopInternetCommand();
  387. //
  388. // 7/24/97 ChrisK Olympus 1923
  389. //
  390. BOOL WaitForConnectionTermination(HRASCONN);
  391. // 11/21/96 jmazner Normandy #11812
  392. BOOL GetIEVersion(PDWORD pdwVerNumMS, PDWORD pdwVerNumLS);
  393. // Note that bryanst and marcl have confirmed that this key will be supported in IE 4
  394. #define IE_PATHKEY TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE")
  395. // IE 4 has major.minor version 4.71
  396. // IE 3 golden has major.minor.release.build version # > 4.70.0.1155
  397. // IE 2 has major.minor of 4.40
  398. #define IE4_MAJOR_VERSION (UINT) 4
  399. #define IE4_MINOR_VERSION (UINT) 71
  400. #define IE4_VERSIONMS (DWORD) ((IE4_MAJOR_VERSION << 16) | IE4_MINOR_VERSION)
  401. HRESULT ClearProxySettings();
  402. HRESULT RestoreProxySettings();
  403. BOOL FShouldRetry2(HRESULT hrErr);
  404. extern void ErrorMsg1(HWND hwnd, UINT uId, LPCTSTR lpszArg);
  405. extern void InfoMsg1(HWND hwnd, UINT uId, LPCTSTR lpszArg);
  406. VOID CALLBACK BusyMessagesTimerProc(HWND hwnd,
  407. UINT uMsg,
  408. UINT idEvent,
  409. DWORD dwTime);
  410. // 4-30-97 ChrisK Olympus 2934
  411. // While the ICW is trying to connect to the referral server, indicate something is
  412. // working
  413. #define MAX_BUSY_MESSAGE 255
  414. #define MAX_VALUE_NAME 10
  415. #define DEFAULT_IDEVENT 31
  416. #define DEFAULT_UELAPSE 3000
  417. class CBusyMessages
  418. {
  419. friend VOID CALLBACK BusyMessagesTimerProc(HWND hwnd,
  420. UINT uMsg,
  421. UINT idEvent,
  422. DWORD dwTime);
  423. public:
  424. CBusyMessages();
  425. ~CBusyMessages();
  426. DWORD Start(HWND hwnd, INT iID, HRASCONN hrasconn);
  427. DWORD Stop();
  428. private:
  429. // Private data members
  430. HWND m_hwnd;
  431. INT m_iStatusLabel;
  432. CHAR m_szMessage[MAX_BUSY_MESSAGE];
  433. DWORD m_dwCurIdx;
  434. UINT m_uIDTimer;
  435. HINSTANCE m_hInstance;
  436. HRASCONN m_hrasconn;
  437. RNAAPI* m_prna;
  438. };
  439. //
  440. // defined in connmain.cpp
  441. //
  442. class RegEntry
  443. {
  444. public:
  445. RegEntry(const TCHAR *pszSubKey, HKEY hkey = HKEY_CURRENT_USER);
  446. ~RegEntry();
  447. long GetError() { return _error; }
  448. long SetValue(const TCHAR *pszValue, const TCHAR *string);
  449. // long SetValue(const TCHAR *pszValue, unsigned long dwNumber);
  450. TCHAR * GetString(const TCHAR *pszValue, TCHAR *string, unsigned long length);
  451. //long GetNumber(const TCHAR *pszValue, long dwDefault = 0);
  452. long DeleteValue(const TCHAR *pszValue);
  453. /**long FlushKey();
  454. long MoveToSubKey(const TCHAR *pszSubKeyName);
  455. HKEY GetKey() { return _hkey; } **/
  456. private:
  457. HKEY _hkey;
  458. long _error;
  459. BOOL bhkeyValid;
  460. };
  461. // Trace flags
  462. #define TF_RNAAPI 0x00000010 // RNA Api stuff
  463. #define TF_SMARTSTART 0x00000020 // Smart Start code
  464. #define TF_SYSTEMCONFIG 0x00000040 // System Config
  465. #define TF_TAPIINFO 0x00000080 // TAPI stuff
  466. #define TF_INSHANDLER 0x00000100 // INS processing stuff
  467. // Prototypes for stuff in MISC.CPP
  468. int Sz2W (LPCTSTR szBuf);
  469. int FIsDigit( int c );
  470. LPBYTE MyMemSet(LPBYTE dest,int c, size_t count);
  471. LPBYTE MyMemCpy(LPBYTE dest,const LPBYTE src, size_t count);
  472. BOOL ShowControl(HWND hDlg,int idControl,BOOL fShow);
  473. BOOL ConvertToLongFilename(LPTSTR szOut, LPTSTR szIn, DWORD dwSize);
  474. //=--------------------------------------------------------------------------=
  475. // allocates a temporary buffer that will disappear when it goes out of scope
  476. // NOTE: be careful of that -- make sure you use the string in the same or
  477. // nested scope in which you created this buffer. people should not use this
  478. // class directly. use the macro(s) below.
  479. //
  480. class TempBuffer {
  481. public:
  482. TempBuffer(ULONG cBytes) {
  483. m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : malloc(cBytes);
  484. m_fHeapAlloc = (cBytes > 120);
  485. }
  486. ~TempBuffer() {
  487. if (m_pBuf && m_fHeapAlloc) free(m_pBuf);
  488. }
  489. void *GetBuffer() {
  490. return m_pBuf;
  491. }
  492. private:
  493. void *m_pBuf;
  494. // we'll use this temp buffer for small cases.
  495. //
  496. TCHAR m_szTmpBuf[120];
  497. unsigned m_fHeapAlloc:1;
  498. };
  499. //=--------------------------------------------------------------------------=
  500. // string helpers.
  501. //
  502. // given and ANSI String, copy it into a wide buffer.
  503. // be careful about scoping when using this macro!
  504. //
  505. // how to use the below two macros:
  506. //
  507. // ...
  508. // LPTSTR pszA;
  509. // pszA = MyGetAnsiStringRoutine();
  510. // MAKE_WIDEPTR_FROMANSI(pwsz, pszA);
  511. // MyUseWideStringRoutine(pwsz);
  512. // ...
  513. //
  514. // similarily for MAKE_ANSIPTR_FROMWIDE. note that the first param does not
  515. // have to be declared, and no clean up must be done.
  516. //
  517. #define MAKE_WIDEPTR_FROMANSI(ptrname, ansistr) \
  518. long __l##ptrname = (lstrlen(ansistr) + 1) * sizeof(WCHAR); \
  519. TempBuffer __TempBuffer##ptrname(__l##ptrname); \
  520. MultiByteToWideChar(CP_ACP, 0, ansistr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname); \
  521. LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()
  522. //
  523. // Note: allocate lstrlenW(widestr) * 2 because its possible for a UNICODE
  524. // character to map to 2 ansi characters this is a quick guarantee that enough
  525. // space will be allocated.
  526. //
  527. #define MAKE_ANSIPTR_FROMWIDE(ptrname, widestr) \
  528. long __l##ptrname = (lstrlenW(widestr) + 1) * 2 * sizeof(char); \
  529. TempBuffer __TempBuffer##ptrname(__l##ptrname); \
  530. WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
  531. LPSTR ptrname = (LPSTR)__TempBuffer##ptrname.GetBuffer()
  532. #define STR_BSTR 0
  533. #define STR_OLESTR 1
  534. #define BSTRFROMANSI(x) (BSTR)MakeWideStrFromAnsi((LPSTR)(x), STR_BSTR)
  535. #define OLESTRFROMANSI(x) (LPOLESTR)MakeWideStrFromAnsi((LPSTR)(x), STR_OLESTR)
  536. #define BSTRFROMRESID(x) (BSTR)MakeWideStrFromResourceId(x, STR_BSTR)
  537. #define OLESTRFROMRESID(x) (LPOLESTR)MakeWideStrFromResourceId(x, STR_OLESTR)
  538. #define COPYOLESTR(x) (LPOLESTR)MakeWideStrFromWide(x, STR_OLESTR)
  539. #define COPYBSTR(x) (BSTR)MakeWideStrFromWide(x, STR_BSTR)
  540. LPWSTR MakeWideStrFromAnsi(LPSTR, BYTE bType);
  541. LPWSTR MakeWideStrFromResourceId(WORD, BYTE bType);
  542. LPWSTR MakeWideStrFromWide(LPWSTR, BYTE bType);
  543. typedef struct SERVER_TYPES_tag
  544. {
  545. TCHAR szType[6];
  546. DWORD dwType;
  547. DWORD dwfOptions;
  548. } SERVER_TYPES;
  549. #define NUM_SERVER_TYPES 4
  550. // Default branding flags the we will support
  551. #define BRAND_FAVORITES 1
  552. #define BRAND_STARTSEARCH 2
  553. #define BRAND_TITLE 4
  554. #define BRAND_BITMAPS 8
  555. #define BRAND_MAIL 16
  556. #define BRAND_NEWS 32
  557. #define BRAND_DEFAULT (BRAND_FAVORITES | BRAND_STARTSEARCH)