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.

463 lines
16 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1994-1995 **
  4. //*********************************************************************
  5. //
  6. // INETCPL.H - central header file for Internet control panel
  7. //
  8. // HISTORY:
  9. //
  10. // 4/3/95 jeremys Created.
  11. // 6/25/96 t-ashlem condensed most header files into here
  12. // and other cleanup
  13. //
  14. #ifndef _INETCPL_H_
  15. #define _INETCPL_H_
  16. // Extra error checking (catches false errors, but useful to run every so often)
  17. #if 1
  18. #pragma warning(3:4701) // local may be used w/o init
  19. #pragma warning(3:4702) // Unreachable code
  20. #pragma warning(3:4705) // Statement has no effect
  21. #pragma warning(3:4709) // command operator w/o index expression
  22. #endif
  23. // IEUNIX - removing warning for redefinition of STRICT
  24. #ifdef STRICT
  25. #undef STRICT
  26. #endif
  27. #define STRICT // Use strict handle types
  28. #define _SHELL32_
  29. #define _CRYPT32_ // get DECLSPEC_IMPORT stuff right for Cert API
  30. #include <windows.h>
  31. #include <windowsx.h>
  32. #ifdef WINNT
  33. #include <shellapi.h>
  34. #endif // WINNT
  35. #include <shlobj.h>
  36. #include <commctrl.h>
  37. #include <comctrlp.h>
  38. #include <prsht.h>
  39. #include <cpl.h>
  40. #include <regstr.h>
  41. #include <ccstock.h>
  42. #include <validate.h>
  43. #include <debug.h>
  44. #include <mshtml.h>
  45. #include <wincrypt.h>
  46. #include <shfusion.h>
  47. //
  48. // All HKEYs are defined in this library: INETREG.LIB
  49. // please change/add any HKEYs to this library. Thanks!
  50. //
  51. #include <inetreg.h>
  52. //
  53. // Delay load DLLs' globals (see DLYLDDLL.C for details)
  54. //
  55. #include "dlylddll.h"
  56. #include <ratings.h>
  57. #include <commdlg.h>
  58. #include <olectl.h>
  59. #define _WINX32_ // get DECLSPEC_IMPORT stuff right for WININET API
  60. #include <urlmon.h>
  61. #include <wininet.h>
  62. #define _URLCACHEAPI_ // get DECLSPEC_IMPORT stuff right for wininet urlcache
  63. #ifdef WINNT
  64. #include <winineti.h>
  65. #endif // WINNT
  66. #define MAX_URL_STRING INTERNET_MAX_URL_LENGTH
  67. #include <shlwapi.h>
  68. #include "ieguidp.h"
  69. #include "oleacc.h"
  70. // Hack. winuserp.h and winable.h both define the flag WINEVENT_VALID. Since
  71. // no one in inetcpl uses this value we undef it to make the compile work.
  72. #undef WINEVENT_VALID
  73. #include "winable.h"
  74. #ifdef UNICODE
  75. #define POST_IE5_BETA
  76. #include <w95wraps.h>
  77. #endif
  78. #include <ras.h>
  79. #include <raserror.h>
  80. //
  81. // When a user clicks "reset web defaults" (on the programs tab), we may need
  82. // to update the url shown in the general tab. The general tab will check this
  83. // flag each time it's made active, and also when we hit ok or apply.
  84. //
  85. extern BOOL g_fReloadHomePage;
  86. ///////////////////////////////////////////////////////////////////////
  87. //
  88. // Structure Defintions and other typedefs
  89. //
  90. ///////////////////////////////////////////////////////////////////////
  91. typedef struct _RESTRICT_FLAGS
  92. {
  93. BOOL fGeneralTab; // Enable/disable "General" tab
  94. BOOL fSecurityTab; // Enable/disable "Security" tab
  95. BOOL fContentTab; // Enable/disable "Content" tab
  96. BOOL fConnectionsTab; // Enable/disable "Programs" tab
  97. BOOL fProgramsTab; // Enable/disable "Connections" tab
  98. BOOL fAdvancedTab; // Enable/disable "Advanced" tab
  99. BOOL fPrivacyTab; // Enable/disable "Privacy" tab
  100. BOOL fColors; // Colors section of Colors dialog
  101. BOOL fLinks; // Links section of Links dialog
  102. BOOL fFonts; // Fonts dialog
  103. BOOL fInternational; // Languages dialog
  104. BOOL fDialing; // Connection section of Connection tab (incl Settings subdialog)
  105. BOOL fProxy; // Proxy section of Connection tab (incl Advanced subdialog)
  106. BOOL fPlaces; // Home page section of General tab
  107. BOOL fHistory; // History section of General tab
  108. BOOL fMailNews; // Messaging section of the Programs tab
  109. BOOL fRatings; // Ratings buttons on Content tab
  110. BOOL fCertif; // Certificate section of Content tab
  111. BOOL fCertifPers; // Personal Cert button
  112. BOOL fCertifSite; // Site Cert button
  113. BOOL fCertifPub; // Publishers button
  114. BOOL fCache; // Temporary Internet Files section of General tab
  115. BOOL fAutoConfig; // Autoconig section of Connection tab
  116. BOOL fAccessibility; // Accessibility dialog
  117. BOOL fSecChangeSettings; // can't change level
  118. BOOL fSecAddSites; // can't add/remove sites
  119. BOOL fProfiles; // Profile Asst section of Content tab
  120. BOOL fFormSuggest; // AutoSuggest for forms on Content tab
  121. BOOL fFormPasswords; // AutoSuggest for form passwords on Content tab
  122. #ifdef WALLET
  123. BOOL fWallet; // MS Wallet section of Content tab
  124. #endif
  125. BOOL fConnectionWizard; // Connection Wizard section of Connection tab
  126. BOOL fCalContact; // Cal/Contact section of Programs tab
  127. BOOL fAdvanced; // Advanced page
  128. BOOL fCacheReadOnly; // Disables the delete and Settings buttons on the general panel
  129. BOOL fResetWebSettings; // Disables the "reset web settings" feature
  130. BOOL fDefault; // IE should check if it's the default browser
  131. BOOL fPrivacySettings; // Disables privacy settings
  132. #if 0
  133. BOOL fMultimedia; // OBSOLETE: do not use
  134. BOOL fToolbar; // OBSOLETE: do not use
  135. BOOL fFileTypes; // OBSOLETE: do not use
  136. BOOL fActiveX; // OBSOLETE: do not use
  137. BOOL fActiveDownload; // OBSOLETE: do not use
  138. BOOL fActiveControls; // OBSOLETE: do not use
  139. BOOL fActiveScript; // OBSOLETE: do not use
  140. BOOL fActiveJava; // OBSOLETE: do not use
  141. BOOL fActiveSafety; // OBSOLETE: do not use
  142. BOOL fWarnings; // OBSOLETE: do not use
  143. BOOL fOther; // OBSOLETE: do not use
  144. BOOL fCrypto; // OBSOLETE: do not use
  145. BOOL fPlacesDefault; // OBSOLETE: do not use
  146. #endif
  147. } RESTRICT_FLAGS, *LPRESTRICT_FLAGS;
  148. typedef struct tagPROXYINFO
  149. {
  150. BOOL fEnable;
  151. BOOL fEditCurrentProxy;
  152. BOOL fOverrideLocal;
  153. BOOL fCustomHandler;
  154. TCHAR szProxy[MAX_URL_STRING];
  155. TCHAR szOverride[MAX_URL_STRING];
  156. } PROXYINFO, *LPPROXYINFO;
  157. // function pointer typedefs
  158. typedef DWORD (WINAPI * RASENUMENTRIESA) (LPSTR, LPSTR, LPRASENTRYNAMEA, LPDWORD, LPDWORD);
  159. typedef DWORD (WINAPI * RASENUMENTRIESW) (LPSTR, LPSTR, LPRASENTRYNAMEW, LPDWORD, LPDWORD);
  160. typedef DWORD (WINAPI * RASCREATEPHONEBOOKENTRYA) (HWND,LPSTR);
  161. typedef DWORD (WINAPI * RASEDITPHONEBOOKENTRYA) (HWND,LPSTR,LPSTR);
  162. typedef DWORD (WINAPI * RASEDITPHONEBOOKENTRYW) (HWND,LPWSTR,LPWSTR);
  163. typedef DWORD (WINAPI * RASGETENTRYDIALPARAMSA) (LPSTR, LPRASDIALPARAMSA, LPBOOL);
  164. typedef DWORD (WINAPI * RASGETENTRYDIALPARAMSW) (LPWSTR, LPRASDIALPARAMSW, LPBOOL);
  165. typedef DWORD (WINAPI * RASSETENTRYDIALPARAMSA) (LPSTR, LPRASDIALPARAMSA, BOOL);
  166. typedef DWORD (WINAPI * RASSETENTRYDIALPARAMSW) (LPWSTR, LPRASDIALPARAMSW, BOOL);
  167. typedef DWORD (WINAPI * RASDELETEENTRYA) (LPSTR, LPSTR);
  168. typedef DWORD (WINAPI * RASDELETEENTRYW) (LPWSTR, LPWSTR);
  169. typedef DWORD (WINAPI * RASGETENTRYPROPERTIESW) (LPCWSTR, LPCWSTR, LPRASENTRYW, LPDWORD, LPBYTE, LPDWORD);
  170. typedef DWORD (WINAPI * RNAACTIVATEENGINE) (void);
  171. typedef DWORD (WINAPI * RNADEACTIVATEENGINE) (void);
  172. typedef DWORD (WINAPI * RNADELETEENTRY) (LPSTR);
  173. ///////////////////////////////////////////////////////////////////////
  174. //
  175. // #defines
  176. //
  177. ///////////////////////////////////////////////////////////////////////
  178. #define IDC_NOTUSED ((unsigned) IDC_UNUSED)
  179. #define INM_UPDATE (WM_USER + 100)
  180. #define MAX_RES_LEN 255
  181. #define SMALL_BUF_LEN 48
  182. #define MAX_PATH_URL INTERNET_MAX_URL_LENGTH
  183. // NOTE: If you change these max values to something other than two digits, then you'll need to change
  184. // the call in connectn.cpp:DialupDlgInit which sets the limittext to 2 chars.
  185. #define DEF_AUTODISCONNECT_TIME 20 // default disconnect timeout is 20 mins
  186. #define MIN_AUTODISCONNECT_TIME 3 // minimum disconnect timeout is 3 mins
  187. #define MAX_AUTODISCONNECT_TIME 59 // maximum disconnect timeout is 59 mins
  188. // NOTE: If you change these max values to something other than two digits, then you'll need to change
  189. // the call in connectn.cpp:DialupDlgInit which sets the limittext to 2 chars.
  190. #define DEF_REDIAL_TRIES 10
  191. #define MAX_REDIAL_TRIES 99
  192. #define MIN_REDIAL_TRIES 1
  193. #define CO_INTERNET 1
  194. #define CO_INTRANET 2
  195. // NOTE: If you change these max values to something other than two digits, then you'll need to change
  196. // the call in connectn.cpp:DialupDlgInit which sets the limittext to 2 chars.
  197. #define DEF_REDIAL_WAIT 5
  198. #define MAX_REDIAL_WAIT 99
  199. #define MIN_REDIAL_WAIT 5
  200. #define MESSAGE_SIZE 255
  201. #define BITMAP_WIDTH 16
  202. #define BITMAP_HEIGHT 16
  203. #define NUM_BITMAPS 5
  204. #define MAX_KEY_NAME 64
  205. #define COLOR_BG 0
  206. //
  207. #define IDCHECKED 0
  208. #define IDUNCHECKED 1
  209. #define IDRADIOON 2
  210. #define IDRADIOOFF 3
  211. #define IDUNKNOWN 4
  212. //
  213. #define SZDEFAULTBITMAP TEXT("DefaultBitmap")
  214. #define SZHT_RADIO TEXT("radio")
  215. #define SZHT_CHECKBOX TEXT("checkbox")
  216. //
  217. #define RET_CHECKBOX 0
  218. #define RET_RADIO 1
  219. //
  220. #define TREE_NEITHER 1
  221. #define TREE_CHECKBOX 2
  222. #define TREE_RADIO 4
  223. //
  224. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  225. //
  226. #define RCS_GETSTATE 1
  227. #define RCS_SETSTATE 2
  228. // Used with the various registry functions to detect when a value isn't
  229. // present
  230. #define VALUE_NOT_PRESENT -255
  231. #define DEFAULT_CPL_PAGE -1
  232. ///////////////////////////////////////////////////////////////////////
  233. //
  234. // Macros
  235. //
  236. ///////////////////////////////////////////////////////////////////////
  237. #define ENABLEAPPLY(hDlg) SendMessage( GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L )
  238. #define SetPropSheetResult( hwnd, result ) SetWindowLongPtr(hwnd, DWLP_MSGRESULT, result)
  239. #undef DATASEG_READONLY
  240. #define DATASEG_READONLY ".rdata"
  241. #include "resource.h"
  242. #include "clsutil.h"
  243. ///////////////////////////////////////////////////////////////////////
  244. //
  245. // Read-Only Global Variables
  246. //
  247. ///////////////////////////////////////////////////////////////////////
  248. extern HINSTANCE ghInstance; // global module instance handle
  249. extern const DWORD mapIDCsToIDHs[]; // Help IDC to IDH map
  250. extern RESTRICT_FLAGS g_restrict; // var to restrict access to pages
  251. // functions in UTIL.C
  252. int MsgBox(HWND hWnd,UINT nMsgID,UINT uIcon,UINT uButtons);
  253. int MsgBoxSz(HWND hWnd,LPTSTR szText,UINT uIcon,UINT uButtons);
  254. int _cdecl MsgBoxParam(HWND hWnd,UINT nMsgID,UINT uIcon,UINT uButtons,...);
  255. LPTSTR LoadSz(UINT idString,LPTSTR lpszBuf,UINT cbBuf);
  256. BOOL EnableDlgItem(HWND hDlg,UINT uID,BOOL fEnable);
  257. VOID _cdecl DisplayErrorMessage(HWND hWnd,UINT uStrID,UINT uError,
  258. UINT uErrorClass,UINT uIcon,...);
  259. BOOL WarnFieldIsEmpty(HWND hDlg,UINT uCtrlID,UINT uStrID);
  260. VOID DisplayFieldErrorMsg(HWND hDlg,UINT uCtrlID,UINT uStrID);
  261. VOID GetErrorDescription(CHAR * pszErrorDesc,UINT cbErrorDesc,
  262. UINT uError,UINT uErrorClass);
  263. BOOL IsNTSPx(BOOL fEqualOrGreater, UINT uMajorVer, UINT uSPVer);
  264. // functions in RNACALL.C
  265. BOOL InitRNA(HWND hWnd);
  266. VOID DeInitRNA();
  267. // structure for getting proc addresses of api functions
  268. typedef struct APIFCN {
  269. PVOID * ppFcnPtr;
  270. LPCSTR pszName;
  271. } APIFCN;
  272. #undef DATASEG_PERINSTANCE
  273. #define DATASEG_PERINSTANCE ".instance"
  274. #undef DATASEG_SHARED
  275. #define DATASEG_SHARED ".data"
  276. #define DATASEG_DEFAULT DATASEG_SHARED
  277. ///////////////////////////////////////////////////////////////////////
  278. //
  279. // Global Variables
  280. //
  281. ///////////////////////////////////////////////////////////////////////
  282. extern TCHAR g_szCurrentURL[INTERNET_MAX_URL_LENGTH];
  283. extern HWND g_hwndUpdate;
  284. extern HWND g_hwndPropSheet;
  285. extern BOOL g_fChangedMime;
  286. ///////////////////////////////////////////////////////////////////////
  287. //
  288. // Dialog Procs
  289. //
  290. ///////////////////////////////////////////////////////////////////////
  291. INT_PTR CALLBACK AdvancedDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  292. LPARAM lParam);
  293. INT_PTR CALLBACK TemporaryDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  294. LPARAM lParam);
  295. INT_PTR CALLBACK ConnectionDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  296. LPARAM lParam);
  297. INT_PTR CALLBACK General_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  298. LPARAM lParam);
  299. #ifdef UNIX
  300. BOOL CALLBACK AssocDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  301. LPARAM lParam);
  302. BOOL CALLBACK AliasDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  303. LPARAM lParam);
  304. #endif
  305. STDAPI_(INT_PTR) OpenFontsDialog(HWND hDlg, LPCSTR lpszKeyPath);
  306. STDAPI_(INT_PTR) OpenFontsDialogEx(HWND hDlg, LPCTSTR lpszKeyPath);
  307. INT_PTR CALLBACK FontsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  308. INT_PTR CALLBACK LanguageDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  309. INT_PTR CALLBACK PlacesDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  310. INT_PTR CALLBACK ProgramsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  311. LPARAM lParam);
  312. INT_PTR CALLBACK ProxyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  313. LPARAM lParam);
  314. INT_PTR CALLBACK SafetyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  315. INT_PTR CALLBACK SecurityDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  316. INT_PTR CALLBACK PrintDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  317. INT_PTR CALLBACK ContentDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  318. INT_PTR CALLBACK PrivacyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  319. extern "C" void CALLBACK OpenLanguageDialog(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);
  320. void KickLanguageDialog(HWND hDlg);
  321. ///////////////////////////////////////////////////////////////////////
  322. //
  323. // Dialog Proc Helpers
  324. //
  325. ///////////////////////////////////////////////////////////////////////
  326. // hunts down all windows and notifies them that they should update themselves
  327. void UpdateAllWindows();
  328. // Windows Help helper
  329. void ResWinHelp( HWND hwnd, int ids, int id2, DWORD_PTR dwp);
  330. #ifdef UNIX
  331. void FindEditClient(LPTSTR szProtocol, HWND hwndDlg, int nIDDlgItem, LPTSTR szPath);
  332. BOOL EditScript(HKEY hkeyProtocol);
  333. BOOL FindScript(HWND hwndLable, HKEY hkeyProtocol);
  334. #define DIR_SEPR FILENAME_SEPARATOR
  335. #include <tchar.h>
  336. #include <platform.h>
  337. #include "unixstuff.h"
  338. inline
  339. BOOL
  340. HAS_DRIVE_LETTER(LPCTSTR pszPath)
  341. {
  342. ASSERT(pszPath!=NULL);
  343. return (pszPath[0] == '/');
  344. }
  345. #else
  346. #define DIR_SEPR '\\'
  347. inline
  348. BOOL
  349. HAS_DRIVE_LETTER(LPCTSTR pszPath)
  350. {
  351. ASSERT(pszPath!=NULL);
  352. ASSERT(pszPath[0]!='\0');
  353. return (pszPath[1] == ':');
  354. }
  355. #endif
  356. //
  357. // We can be hung if we use sendMessage, and you can not use pointers with asynchronous
  358. // calls such as PostMessage or SendNotifyMessage. So we resort to using a timeout.
  359. // This function should be used to broadcast notification messages, such as WM_SETTINGCHANGE,
  360. // that pass pointers.
  361. //
  362. inline LRESULT SendBroadcastMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
  363. {
  364. return SHSendMessageBroadcastW(uMsg, wParam, lParam);
  365. }
  366. // struct used in security.cpp as tls in a hack to get around bad dialog creation situation
  367. struct SECURITYINITFLAGS
  368. {
  369. DWORD dwZone;
  370. BOOL fForceUI;
  371. BOOL fDisableAddSites;
  372. SECURITYINITFLAGS()
  373. {
  374. dwZone = 0;
  375. fForceUI = FALSE;
  376. fDisableAddSites = FALSE;
  377. }
  378. };
  379. LANGID INETCPL_GetUILanguage();
  380. #endif // _INETCPL_H_