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.

469 lines
17 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 INETERNET_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. #define REGSTR_PATH_SECURITY_LOCKOUT TEXT("Software\\Policies\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")
  233. #define REGSTR_VAL_OPTIONS_EDIT TEXT("Security_options_edit")
  234. #define REGSTR_VAL_ZONES_MAP_EDIT TEXT("Security_zones_map_edit")
  235. #define REGSTR_VAL_HKLM_ONLY TEXT("Security_HKLM_only")
  236. ///////////////////////////////////////////////////////////////////////
  237. //
  238. // Macros
  239. //
  240. ///////////////////////////////////////////////////////////////////////
  241. #define ENABLEAPPLY(hDlg) SendMessage( GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L )
  242. #define SetPropSheetResult( hwnd, result ) SetWindowLongPtr(hwnd, DWLP_MSGRESULT, result)
  243. #undef DATASEG_READONLY
  244. #define DATASEG_READONLY ".rdata"
  245. #include "resource.h"
  246. #include "clsutil.h"
  247. ///////////////////////////////////////////////////////////////////////
  248. //
  249. // Read-Only Global Variables
  250. //
  251. ///////////////////////////////////////////////////////////////////////
  252. extern HINSTANCE ghInstance; // global module instance handle
  253. extern const DWORD mapIDCsToIDHs[]; // Help IDC to IDH map
  254. extern RESTRICT_FLAGS g_restrict; // var to restrict access to pages
  255. // functions in UTIL.C
  256. int MsgBox(HWND hWnd,UINT nMsgID,UINT uIcon,UINT uButtons);
  257. int MsgBoxSz(HWND hWnd,LPTSTR szText,UINT uIcon,UINT uButtons);
  258. int _cdecl MsgBoxParam(HWND hWnd,UINT nMsgID,UINT uIcon,UINT uButtons,...);
  259. LPTSTR LoadSz(UINT idString,LPTSTR lpszBuf,UINT cbBuf);
  260. BOOL EnableDlgItem(HWND hDlg,UINT uID,BOOL fEnable);
  261. VOID _cdecl DisplayErrorMessage(HWND hWnd,UINT uStrID,UINT uError,
  262. UINT uErrorClass,UINT uIcon,...);
  263. BOOL WarnFieldIsEmpty(HWND hDlg,UINT uCtrlID,UINT uStrID);
  264. VOID DisplayFieldErrorMsg(HWND hDlg,UINT uCtrlID,UINT uStrID);
  265. VOID GetErrorDescription(CHAR * pszErrorDesc,UINT cbErrorDesc,
  266. UINT uError,UINT uErrorClass);
  267. BOOL IsNTSPx(BOOL fEqualOrGreater, UINT uMajorVer, UINT uSPVer);
  268. // functions in RNACALL.C
  269. BOOL InitRNA(HWND hWnd);
  270. VOID DeInitRNA();
  271. // structure for getting proc addresses of api functions
  272. typedef struct APIFCN {
  273. PVOID * ppFcnPtr;
  274. LPCSTR pszName;
  275. } APIFCN;
  276. #undef DATASEG_PERINSTANCE
  277. #define DATASEG_PERINSTANCE ".instance"
  278. #undef DATASEG_SHARED
  279. #define DATASEG_SHARED ".data"
  280. #define DATASEG_DEFAULT DATASEG_SHARED
  281. ///////////////////////////////////////////////////////////////////////
  282. //
  283. // Global Variables
  284. //
  285. ///////////////////////////////////////////////////////////////////////
  286. extern TCHAR g_szCurrentURL[INTERNET_MAX_URL_LENGTH];
  287. extern HWND g_hwndUpdate;
  288. extern HWND g_hwndPropSheet;
  289. extern BOOL g_fChangedMime;
  290. ///////////////////////////////////////////////////////////////////////
  291. //
  292. // Dialog Procs
  293. //
  294. ///////////////////////////////////////////////////////////////////////
  295. INT_PTR CALLBACK AdvancedDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  296. LPARAM lParam);
  297. INT_PTR CALLBACK TemporaryDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  298. LPARAM lParam);
  299. INT_PTR CALLBACK ConnectionDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  300. LPARAM lParam);
  301. INT_PTR CALLBACK General_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  302. LPARAM lParam);
  303. #ifdef UNIX
  304. BOOL CALLBACK AssocDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  305. LPARAM lParam);
  306. BOOL CALLBACK AliasDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  307. LPARAM lParam);
  308. #endif
  309. STDAPI_(INT_PTR) OpenFontsDialog(HWND hDlg, LPCSTR lpszKeyPath);
  310. STDAPI_(INT_PTR) OpenFontsDialogEx(HWND hDlg, LPCTSTR lpszKeyPath);
  311. INT_PTR CALLBACK FontsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  312. INT_PTR CALLBACK LanguageDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  313. INT_PTR CALLBACK PlacesDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  314. INT_PTR CALLBACK ProgramsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  315. LPARAM lParam);
  316. INT_PTR CALLBACK ProxyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
  317. LPARAM lParam);
  318. INT_PTR CALLBACK SafetyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  319. INT_PTR CALLBACK SecurityDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  320. INT_PTR CALLBACK PrintDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  321. INT_PTR CALLBACK ContentDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  322. INT_PTR CALLBACK PrivacyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  323. extern "C" void CALLBACK OpenLanguageDialog(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);
  324. void KickLanguageDialog(HWND hDlg);
  325. ///////////////////////////////////////////////////////////////////////
  326. //
  327. // Dialog Proc Helpers
  328. //
  329. ///////////////////////////////////////////////////////////////////////
  330. // hunts down all windows and notifies them that they should update themselves
  331. void UpdateAllWindows();
  332. // Windows Help helper
  333. void ResWinHelp( HWND hwnd, int ids, int id2, DWORD_PTR dwp);
  334. #ifdef UNIX
  335. void FindEditClient(LPTSTR szProtocol, HWND hwndDlg, int nIDDlgItem, LPTSTR szPath);
  336. BOOL EditScript(HKEY hkeyProtocol);
  337. BOOL FindScript(HWND hwndLable, HKEY hkeyProtocol);
  338. #define DIR_SEPR FILENAME_SEPARATOR
  339. #include <tchar.h>
  340. #include <platform.h>
  341. #include "unixstuff.h"
  342. inline
  343. BOOL
  344. HAS_DRIVE_LETTER(LPCTSTR pszPath)
  345. {
  346. ASSERT(pszPath!=NULL);
  347. return (pszPath[0] == '/');
  348. }
  349. #else
  350. #define DIR_SEPR '\\'
  351. inline
  352. BOOL
  353. HAS_DRIVE_LETTER(LPCTSTR pszPath)
  354. {
  355. ASSERT(pszPath!=NULL);
  356. ASSERT(pszPath[0]!='\0');
  357. return (pszPath[1] == ':');
  358. }
  359. #endif
  360. //
  361. // We can be hung if we use sendMessage, and you can not use pointers with asynchronous
  362. // calls such as PostMessage or SendNotifyMessage. So we resort to using a timeout.
  363. // This function should be used to broadcast notification messages, such as WM_SETTINGCHANGE,
  364. // that pass pointers.
  365. //
  366. inline LRESULT SendBroadcastMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
  367. {
  368. return SHSendMessageBroadcastW(uMsg, wParam, lParam);
  369. }
  370. // struct used in security.cpp as tls in a hack to get around bad dialog creation situation
  371. struct SECURITYINITFLAGS
  372. {
  373. DWORD dwZone;
  374. BOOL fForceUI;
  375. BOOL fDisableAddSites;
  376. SECURITYINITFLAGS()
  377. {
  378. dwZone = 0;
  379. fForceUI = FALSE;
  380. fDisableAddSites = FALSE;
  381. }
  382. };
  383. LANGID INETCPL_GetUILanguage();
  384. #endif // _INETCPL_H_