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.

1452 lines
46 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: icm.h
  4. //
  5. // Module: CMDIAL32.DLL
  6. //
  7. // Synopsis: Main header file for cmdial32.dll
  8. //
  9. // Copyright (c) 1998-1999 Microsoft Corporation
  10. //
  11. // Author: nickball Created 02/10/98
  12. //
  13. //+----------------------------------------------------------------------------
  14. #ifndef _ICM_INC
  15. #define _ICM_INC
  16. #include <stddef.h>
  17. #include <stdlib.h>
  18. #include <limits.h>
  19. #include <windows.h>
  20. #include <windowsx.h>
  21. #include <shlobj.h>
  22. #include <stdio.h>
  23. #include <errno.h>
  24. #include <olectl.h>
  25. #include <ctype.h>
  26. #include <wininet.h>
  27. #include <wchar.h>
  28. // #undef WINVER
  29. // #define WINVER 0x0401
  30. #include <commctrl.h>
  31. #include <ras.h>
  32. #include <raserror.h>
  33. #include <tapi.h>
  34. #include <mbstring.h>
  35. #include <wininet.h>
  36. #include <rasdlg.h>
  37. #include <olectl.h>
  38. #include <ntsecapi.h> // for LSA stuff
  39. #include "cmglobal.h"
  40. #include "cm_def.h"
  41. #include "reg_str.h"
  42. #include "cmmgr32.h" // help IDs
  43. #include "cm_phbk.h"
  44. #include "cmdial.h"
  45. #include "cmutil.h"
  46. #include "cm_misc.h"
  47. #include "cmlog.h"
  48. #include "state.h"
  49. #include "cmsecure.h"
  50. #include "cmdebug.h"
  51. #include "contable.h"
  52. #include "ary.hxx"
  53. #include "ctr.h"
  54. #include "resource.h"
  55. #include "cmfmtstr.h"
  56. #include "base_str.h"
  57. #include "mgr_str.h"
  58. #include "ShellDll.h"
  59. #include "mutex.h"
  60. #include "cmras.h"
  61. #include "userinfo.h"
  62. #include "lanawait.h"
  63. #include "linkdll.h" // LinkToDll and BindLinkage
  64. #include "uapi.h"
  65. #include "bmpimage.h" // Common bitmap processing code
  66. #include "pwutil.h"
  67. #include "stp_str.h"
  68. #include "dial_str.h"
  69. #include "mon_str.h"
  70. #include "tooltip.h"
  71. #include "gppswithalloc.h"
  72. #include "hnetcfg.h"
  73. #include "netconp.h"
  74. #if DEBUG && defined(CMASSERTMSG)
  75. #define CELEMS(x) ( \
  76. CMASSERTMSG(sizeof(x) != sizeof(void*), TEXT("possible incorrect usage of CELEMS")), \
  77. (sizeof(x))/(sizeof(x[0])) \
  78. )
  79. #else
  80. #define CELEMS(x) ((sizeof(x))/(sizeof(x[0])))
  81. #endif // DEBUG
  82. // we haven't done the strsafe pass for the entire XPSP codebase - make sure we can still build
  83. #define STRSAFE_NO_DEPRECATE
  84. #include <strsafe.h>
  85. //************************************************************************
  86. // define's
  87. //************************************************************************
  88. #define TIMER_RATE 1000 // 1 second
  89. #define PAUSE_DELAY 3
  90. #define PWHANDLE_NONE 0
  91. #define PWHANDLE_LOWER 1
  92. #define PWHANDLE_UPPER 2
  93. #define CE_PASSWORD_NOT_PRESENT 1223
  94. #define CUSTOM_BUTTON_WIDTH 88
  95. //#define DEFAULT_MAX_DOMAIN_LENGTH 256
  96. //
  97. // User defined msg for telling CM itself to start loading startup info
  98. //
  99. #define WM_LOADSTARTUPINFO (WM_USER + 6)
  100. //
  101. // Delayed hangup of CM for W9x
  102. // wParam indicates if entry should be removed from table.
  103. // lParam is the RAS error code for hangup or ERROR_CANCELLED (currently unused)
  104. #define WM_HANGUP_CM (WM_USER + 7)
  105. //
  106. // Connected CM - CM is connected, do connect processing
  107. //
  108. #define WM_CONNECTED_CM (WM_USER + 8)
  109. //
  110. // Pause RasDial - Resume dialing after pause state.
  111. //
  112. #define WM_PAUSE_RASDIAL (WM_USER + 9)
  113. // Duration message flags
  114. #define DMF_NUL 0x0000
  115. #define DMF_H 0x0001 // Hours
  116. #define DMF_M 0x0002 // Minutes
  117. #define DMF_S 0x0004 // Seconds
  118. #define DMF_HM 0x0003 // Hours, Minutes
  119. #define DMF_HS 0x0005 // Hours, Seconds
  120. #define DMF_MS 0x0006 // Minutes, Seconds
  121. #define DMF_HMS 0x0007 // Hours, Minutes, Seconds
  122. // for NT RasSetEntryProperties()
  123. #define SCRIPT_PATCH_BUFFER_SIZE 2048
  124. #define SIZEOF_NULL 1
  125. #define MIN_TAPI_VERSION 0x10003
  126. #define MAX_TAPI_VERSION 0x10004
  127. #define NElems(a) (sizeof a / sizeof a[0])
  128. #define INETCFG_INSTALLMODEM 0x00000002
  129. #define INETCFG_INSTALLRNA 0x00000004
  130. #define INETCFG_INSTALLTCP 0x00000008
  131. #define INETCFG_SUPPRESSINSTALLUI 0x00000080
  132. //
  133. // Check to see if TCP is installed regardless of binding
  134. //
  135. #define INETCFG_INSTALLTCPONLY 0x00004000
  136. //
  137. // Components Checked flags
  138. //
  139. #define CC_RNA 0x00000001 // RNA installed
  140. #define CC_TCPIP 0x00000002 // TCPIP installed
  141. #define CC_MODEM 0x00000004 // Modem installed
  142. #define CC_PPTP 0x00000008 // PPTP installed
  143. #define CC_SCRIPTING 0x00000010 // Scripting installed
  144. #define CC_RASRUNNING 0X00000020 // RAS services is running
  145. // on NT
  146. #define CC_CHECK_BINDINGS 0x00000040 // Check if PPP is bound to TCP
  147. #define DT_CMMON 0x00000001
  148. #define DT_EXPLORER 0x00000002
  149. #define DT_CMMGR 0x00000004
  150. #define DT_CMSTP 0x00000008
  151. #define DT_RUNDLL32 0x00000010
  152. #define DT_RASAUTOU 0x00000020
  153. #define DT_USER (DT_CMMGR | DT_CMMON | DT_EXPLORER | DT_CMSTP | DT_RUNDLL32 | DT_RASAUTOU)
  154. #define MAX_PHONE_NUMBERS 2
  155. #define MAX_PHONE_LEN95 36 //Win 95 has 36 char phone limit
  156. #define MAX_PHONE_LENNT 80 //NT has 80 char phone limit
  157. //
  158. // Country list limits and defines
  159. //
  160. #define DEF_COUNTRY_INFO_SIZE 1024
  161. #define MAX_COUNTRY_NAME 36
  162. #define DEFAULT_COUNTRY_CODE 1
  163. #define DEFAULT_COUNTRY_ID 1 // US
  164. //
  165. // Default settings values
  166. //
  167. #define DEFAULT_IDLETIMEOUT 10 // # of minutes to wait before idle disconnect
  168. #define DEFAULT_DIALEXTRAPERCENT 80 // see ArgsStruct dwDialExtraPercent
  169. #define DEFAULT_DIALEXTRASAMPLESECONDS 30 // see ArgsStruct dwDialExtraSampleSeconds
  170. #define DEFAULT_HANGUPEXTRAPERCENT 40 // see ArgsStruct dwHangupExtraPercent
  171. #define DEFAULT_HANGUPEXTRASAMPLESECONDS 300 // see ArgsStruct dwHangupExtraSampleSeconds
  172. #define DEFAULT_REDIAL_DELAY 5
  173. #define DEFAULT_MAX_REDIALS 3
  174. #define NT4_BUILD_NUMBER 1381
  175. //
  176. // isdn dial mode
  177. //
  178. #define CM_ISDN_MODE_SINGLECHANNEL 0
  179. #define CM_ISDN_MODE_DUALCHANNEL_ONLY 1
  180. #define CM_ISDN_MODE_DUALCHANNEL_FALLBACK 2
  181. //
  182. // len for the var lasterror string
  183. //
  184. #define MAX_LASTERR_LEN 128
  185. //
  186. // Flags for manipulating dialog template mask
  187. //
  188. #define CMTM_UID 0x00000001 // Username to be displayed
  189. #define CMTM_PWD 0x00000002 // Password to be displayed
  190. #define CMTM_DMN 0x00000004 // Domain to be displayed
  191. #define CMTM_FAVS 0x00000008 // Favorite enbabled dialogs
  192. #define CMTM_GCOPT 0x00000010 // Global Credential Options
  193. #define CMTM_UID_AND_PWD CMTM_UID | CMTM_PWD // 0x00000003 // No domain displayed
  194. #define CMTM_UID_AND_DMN CMTM_UID | CMTM_DMN // 0x00000005 // No Password displayed
  195. #define CMTM_PWD_AND_DMN CMTM_PWD | CMTM_DMN // 0x00000006 // No Username displayed
  196. #define CMTM_U_P_D CMTM_UID | CMTM_PWD | CMTM_DMN // 0x00000007 // All userinfo displayed
  197. //
  198. // Access point names should be no longer than 32 chars (not counting the NULL terminator)
  199. //
  200. #define MAX_ACCESSPOINT_LENGTH 32
  201. #define ID_OK_RELAUNCH_MAIN_DLG 123174
  202. //
  203. // Balloon Tip Flags
  204. //
  205. #define BT_ACCESS_POINTS 0x00000001 // Access Point balloon tip has already been displayed
  206. //
  207. // Connection Types
  208. //
  209. #define DIAL_UP_CONNECTION 0
  210. #define DIRECT_CONNECTION 1
  211. #define DOUBLE_DIAL_CONNECTION 2
  212. class CConnStatistics;
  213. //
  214. // Special-case some smart-card PIN errors
  215. //
  216. #define BAD_SCARD_PIN(x) ((SCARD_W_WRONG_CHV == (x)) || (SCARD_E_INVALID_CHV == (x)))
  217. //************************************************************************
  218. // structures, typdef's
  219. //************************************************************************
  220. //
  221. // Function prototypes for entrypoints into RAS. We will link to RAS using LoadLibary()/GetProcAddress(),
  222. // so that we can be flexible concerning how we load (for example, if RAS is not installed on the machine,
  223. // we can print a polite message, instead of just having Windows put up an ugly dialog about RASAPI32.DLL
  224. // not being found.
  225. //
  226. #include "raslink.h"
  227. //
  228. // Function prototypes for entrypoints into TAPI. We will link to TAPI using LoadLibary()/GetProcAddress(),
  229. // so that we can be flexible concerning how we load (for example, if TAPI is not installed on the machine,
  230. // we can print a polite message, instead of just having Windows put up an ugly dialog about TAPI32.DLL
  231. // not being found.
  232. //
  233. typedef LONG (WINAPI *pfnTapilineInitialize)(LPHLINEAPP, HINSTANCE, LINECALLBACK, LPCTSTR, LPDWORD);
  234. typedef LONG (WINAPI *pfnTapilineNegotiateAPIVersion)(HLINEAPP, DWORD, DWORD, DWORD, LPDWORD, LPLINEEXTENSIONID);
  235. typedef LONG (WINAPI *pfnTapilineGetDevCaps)(HLINEAPP, DWORD, DWORD, DWORD, LPLINEDEVCAPS);
  236. typedef LONG (WINAPI *pfnTapilineShutdown)(HLINEAPP);
  237. typedef LONG (WINAPI *pfnTapilineTranslateAddress)(HLINEAPP, DWORD, DWORD, LPCTSTR, DWORD, DWORD, LPLINETRANSLATEOUTPUT);
  238. typedef LONG (WINAPI *pfnTapilineTranslateDialog)(HLINEAPP, DWORD, DWORD, HWND, LPCTSTR);
  239. typedef LONG (WINAPI *pfnTapilineGetDevConfig)(DWORD, LPVARSTRING, LPCSTR);
  240. //typedef LONG (WINAPI *pfnTapilineGetID)(HLINE, DWORD, HCALL, DWORD, LPVARSTRING, LPCTSTR);
  241. //typedef LONG (WINAPI *pfnTapitapiGetLocationInfo)(LPCTSTR, LPCTSTR);
  242. typedef LONG (WINAPI *pfnTapilineGetTranslateCaps)(HLINEAPP, DWORD, LPLINETRANSLATECAPS);
  243. typedef LONG (WINAPI *pfnTapilineSetCurrentLocation)(HLINEAPP, DWORD);
  244. //
  245. // function prototypes for LSA stuff.
  246. //
  247. typedef NTSTATUS (NTAPI *pfnLsaOpenPolicy)(PLSA_UNICODE_STRING, PLSA_OBJECT_ATTRIBUTES, ACCESS_MASK, PLSA_HANDLE);
  248. typedef NTSTATUS (NTAPI *pfnLsaRetrievePrivateData)(LSA_HANDLE, PLSA_UNICODE_STRING, PLSA_UNICODE_STRING *);
  249. typedef NTSTATUS (NTAPI *pfnLsaStorePrivateData)(LSA_HANDLE, PLSA_UNICODE_STRING, PLSA_UNICODE_STRING);
  250. typedef ULONG (NTAPI *pfnLsaNtStatusToWinError)(NTSTATUS);
  251. typedef NTSTATUS (NTAPI *pfnLsaClose)(LSA_HANDLE);
  252. typedef NTSTATUS (NTAPI *pfnLsaFreeMemory)(PVOID);
  253. //
  254. // Connect Action Function Prototype
  255. //
  256. typedef DWORD (WINAPI *pfnCmConnectActionFunc)(HWND, HINSTANCE, LPCSTR, int);
  257. //
  258. // Structure used to describe the linkage to TAPI. NOTE: Changes to this structure
  259. // will probably require changes to LinkToTapi() and UnlinkFromTapi().
  260. //
  261. typedef struct _TapiLinkageStruct {
  262. HINSTANCE hInstTapi;
  263. union {
  264. struct {
  265. pfnTapilineInitialize pfnlineInitialize;
  266. pfnTapilineNegotiateAPIVersion pfnlineNegotiateAPIVersion;
  267. pfnTapilineGetDevCaps pfnlineGetDevCaps;
  268. pfnTapilineGetDevConfig pfnlineGetDevConfig;
  269. pfnTapilineShutdown pfnlineShutdown;
  270. pfnTapilineTranslateAddress pfnlineTranslateAddress;
  271. // pfnTapitapiGetLocationInfo pfntapiGetLocationInfo;
  272. pfnTapilineTranslateDialog pfnlineTranslateDialog;
  273. // pfnTapilineGetID pfnlineGetID;
  274. pfnTapilineGetTranslateCaps pfnlineGetTranslateCaps;
  275. pfnTapilineSetCurrentLocation pfnlineSetCurrentLocation;
  276. };
  277. void *apvPfnTapi[10]; // see comment for RasLinkageStruct for 10.
  278. };
  279. HLINEAPP hlaLine;
  280. DWORD dwDevCnt;
  281. BOOL bOpen;
  282. BOOL bDevicePicked;
  283. TCHAR szDeviceName[RAS_MaxDeviceName + 1];
  284. DWORD dwDeviceId;
  285. DWORD dwApiVersion;
  286. BOOL bModemSpeakerOff;
  287. DWORD dwTapiLocationForAccessPoint; // Tapi location for current access point
  288. DWORD dwOldTapiLocation; // Tapi location when CM is started, restored when CM exits
  289. } TapiLinkageStruct;
  290. typedef struct _LsaLinkageStruct {
  291. HINSTANCE hInstLsa;
  292. union {
  293. struct {
  294. pfnLsaOpenPolicy pfnOpenPolicy;
  295. pfnLsaRetrievePrivateData pfnRetrievePrivateData;
  296. pfnLsaStorePrivateData pfnStorePrivateData;
  297. pfnLsaNtStatusToWinError pfnNtStatusToWinError;
  298. pfnLsaClose pfnClose;
  299. pfnLsaFreeMemory pfnFreeMemory;
  300. };
  301. void *apvPfnLsa[7];
  302. };
  303. } LsaLinkageStruct;
  304. #define PHONE_DESC_LEN 80
  305. #define PB_MAX_SERVICE 256
  306. #define PB_MAX_REGION 256
  307. //
  308. // Phone Info Flags
  309. //
  310. #define PIF_USE_DIALING_RULES 0x00000001
  311. typedef struct _PHONEINFO
  312. {
  313. DWORD dwCountryID;
  314. TCHAR szPhoneNumber[RAS_MaxPhoneNumber+1];
  315. TCHAR szCanonical[RAS_MaxPhoneNumber+1];
  316. TCHAR szDUN[MAX_PATH+1];
  317. TCHAR szPhoneBookFile[MAX_PATH+1]; // the service file associate with the phone #
  318. TCHAR szDialablePhoneNumber[RAS_MaxPhoneNumber+1];
  319. TCHAR szDisplayablePhoneNumber[RAS_MaxPhoneNumber+1];
  320. TCHAR szDesc[PHONE_DESC_LEN];
  321. DWORD dwPhoneInfoFlags;
  322. //
  323. // The following 2 vars are set by the phone book dlg(OnGeneralPhoneChange).
  324. // We need to save them and then write them out when the user clicks OK.
  325. //
  326. TCHAR szServiceType[PB_MAX_SERVICE];
  327. TCHAR szRegionName[PB_MAX_REGION];
  328. } PHONEINFO, *PPHONEINFO;
  329. //
  330. // Structure for all of the program's data. Basically, the program doesn't have any
  331. // global variables - everything is stored in this structure.
  332. //
  333. typedef struct _ArgsStruct
  334. {
  335. public:
  336. LPICMOCCtr pCtr; // OC ctr for FS OC
  337. UINT uMsgId; // message ID used for driving the dialing state machine
  338. DWORD dwFlags; // any flags from the command line -- see IniArgs
  339. RasLinkageStruct rlsRasLink; // linkade to RAS
  340. HRASCONN hrcRasConn; // the handle of the RAS connection
  341. TapiLinkageStruct tlsTapiLink; // linkage to TAPI
  342. LsaLinkageStruct llsLsaLink; // linkage to LSA
  343. BOOL fIgnoreChangeNotification; // TRUE if EN_CHANGE messages should be ignored
  344. TCHAR szLastErrorSrc[MAX_LASTERR_LEN]; // the source of last err(either RAS or a connect action name)
  345. TCHAR szDeviceName[RAS_MaxDeviceName+1]; // device being used
  346. TCHAR szDeviceType[RAS_MaxDeviceName+1]; // device type of the device being used
  347. TCHAR szUserName[UNLEN+1]; // username for corp account
  348. TCHAR szPassword[PWLEN+1]; // password for corp account
  349. TCHAR szDomain[DNLEN+1]; // domain for corp account
  350. TCHAR szConnectoid[RAS_MaxEntryName]; // connectoid name
  351. TCHAR szServiceName[RAS_MaxEntryName]; // top-level long service name
  352. // added for tunneling
  353. HRASCONN hrcTunnelConn; // the handle of the tunnel connection
  354. TCHAR szTunnelDeviceType[RAS_MaxDeviceType+1]; // device type
  355. TCHAR szTunnelDeviceName[RAS_MaxDeviceName+1]; // device being used for tunneling
  356. TCHAR szInetUserName[UNLEN+1]; // username for internet(isp)
  357. TCHAR szInetPassword[PWLEN+1]; // password for internet(isp)
  358. BOOL fUseSameUserName; // TRUE if will use the same password for dialup
  359. BOOL fHideDialAutomatically; // don't show 'dial automatically..." checkbox
  360. BOOL fHideRememberPassword; // don't show 'remember password" checkbox
  361. BOOL fHideRememberInetPassword; // don't show 'remember Internet password" checkbox
  362. BOOL fDialAutomatically; // dial automatically upon start?
  363. BOOL fRememberInetPassword; // remember the internet password
  364. BOOL fRememberMainPassword; // remember the password in the main dialog box
  365. BOOL fHideUserName; // Hide the username on the main logon tab
  366. BOOL fHidePassword; // Hide the password on the main logon tab
  367. BOOL fHideDomain; // Hide the domain on the main logon tab
  368. BOOL fHideInetUsername; // Hide the username on the Inet logon tab
  369. BOOL fHideInetPassword; // Hide the password on the Inet logon tab
  370. BOOL fTunnelPrimary; // if TRUE, we'll tunnel only if the user selects a phone #
  371. // from the pbk associated with the primary service profile
  372. BOOL fTunnelReferences; // if TRUE, we'll tunnel only if the user selects a phone #
  373. // from the pbk associated with the referenced service profile
  374. BOOL fUseTunneling; // TRUE if use tunneling for dial-up networking(it is NOT the same
  375. // as (fTunnel|fTunnelReferences)!!! It's determined by
  376. // looking at the above 3 flags plus more.
  377. BOOL bUseRasCredStore; // TRUE if this profile uses RasSetCredentials and RasGetCredentials
  378. // to store creds on win2k+. Will be FALSE on legacy platforms
  379. BOOL bShowHNetCfgAdvancedTab; // displays the ICF & ICS (Advanced) tab
  380. // Internet Connection Sharing & Internet Connection Firewall tab
  381. // TRUE by default
  382. DWORD dwSCardErr; // special case handling for SmartCard errors
  383. LPTSTR GetProperty(const TCHAR* pszName, BOOL *pbValidPropertyName); // get the cm property by name
  384. DWORD GetTypeOfConnection(); // is the connection dialup, direct, or double dial?
  385. protected:
  386. //
  387. // Encapsulate the tunnel address
  388. //
  389. // IP(or DNS name) in the profile for tunnel server
  390. TCHAR szPrimaryTunnelIP[RAS_MaxPhoneNumber+1];
  391. public:
  392. const TCHAR* GetTunnelAddress()
  393. {return szPrimaryTunnelIP;}
  394. void SetPrimaryTunnel(LPCTSTR pszTunnelIP)
  395. {lstrcpynU(szPrimaryTunnelIP, pszTunnelIP, sizeof(szPrimaryTunnelIP)/sizeof(TCHAR));}
  396. public:
  397. UINT_PTR nTimerId; // ID of the timer
  398. ProgState psState; // the program's state
  399. DWORD dwStateStartTime; // the time that the state started
  400. UINT nRedialDelay; // the number of seconds to wait between redial attempts
  401. UINT nMaxRedials; // the maximum number of times to redial
  402. UINT nRedialCnt; // number of re-dial attempts remaining
  403. UINT nLastSecondsDisplay; // the last seconds count which was displayed
  404. UINT nDialIdx; // zero-based index of current phone number
  405. PHONEINFO aDialInfo[MAX_PHONE_NUMBERS]; // actual phone number that's to be dialed
  406. CIni *piniProfile;
  407. CIni *piniService;
  408. CIni *piniBoth;
  409. CIni *piniBothNonFav;
  410. LPTSTR pszHelpFile; // file name of help file
  411. BMPDATA BmpData; // bitmap handles for main sign-in dialog
  412. HPALETTE hMasterPalette; // the current palette for the app
  413. HICON hBigIcon; // icon for Alt-Tab task bar
  414. HICON hSmallIcon; // icon for main title bar and task bar
  415. DWORD dwExitCode;
  416. DWORD dwIdleTimeout; // Idle time out in minutes, 0 means never time out
  417. HWND hwndResetPasswdButton;
  418. HWND hwndTT; // tooltip
  419. HANDLE *phWatchProcesses;
  420. LPTSTR pszResetPasswdExe;
  421. LPTSTR pszCurrentAccessPoint; // String to store the current access point
  422. BOOL fAccessPointsEnabled; // Are Access Points enabled?
  423. DWORD dwOldTapiLocation; // tapi location when CM is started
  424. BOOL fHideBalloonTips; // Are Balloon Tips enabled?
  425. CBalloonTip *pBalloonTip; // pointer to the Balloon tip class
  426. // for references
  427. BOOL fHasRefs;
  428. BOOL fHasValidTopLevelPBK;
  429. BOOL fHasValidReferencedPBKs;
  430. //
  431. // for IdleThreshold -- byao 5/30/97
  432. //
  433. CConnStatistics *pConnStatistics;
  434. CConnectionTable *pConnTable;
  435. // idle threshold value
  436. BOOL fCheckOSComponents; // should we check OS components?
  437. BOOL bDoNotCheckBindings; // Check if TCP is bound to PPP?
  438. Ole32LinkageStruct olsOle32Link; // links to Ole32 DLL for future splashing
  439. BOOL fFastEncryption; // Whether we want a faster encryption or a more secure one
  440. DWORD bDialInfoLoaded; // Whether the dial info is loaded
  441. BOOL fStartupInfoLoaded; // have we loaded Startup info? (OnMainLoadStartupInfo())
  442. BOOL fNeedConfigureTapi; // need to configure TAPI location info
  443. BOOL fIgnoreTimerRasMsg; // Whether to ignore WM_TIMER and RAS messages
  444. BOOL fInFastUserSwitch; // Are we in the process of doing a fast user switch (FUS)
  445. CShellDll m_ShellDll; // The link to Shell dll
  446. public:
  447. BOOL IsDirectConnect() const;
  448. void SetDirectConnect(BOOL fDirect) ; // set the connection type direct or dial-up
  449. BOOL IsBothConnTypeSupported() const;
  450. void SetBothConnTypeSupported(BOOL fBoth);
  451. protected:
  452. BOOL m_fBothConnTypeSupported; // Whether the profile support both direct connect an dial-up
  453. BOOL m_fDirectConnect; // Whether the current configuration is using direct connection
  454. public:
  455. LPTSTR pszRasPbk; // Ras phonebook path
  456. LPTSTR pszRasHiddenPbk; // Hidden Ras phonebook path for dial-up portion of wholesale dial
  457. LPTSTR pszVpnFile;
  458. //
  459. // ISDN dual channel support(dial all initially, dial on demand)
  460. //
  461. // Dial-on-demand:
  462. // CM dials an additional channel when the total bandwidth used exceeds
  463. // dwDialExtraPercent percent of the available bandwidth for at least
  464. // dwDialExtraSampleSeconds seconds.
  465. //
  466. BOOL dwIsdnDialMode; // see CM_ISDN_MODE*
  467. DWORD dwDialExtraPercent; // used when dialmode = dialasneeded
  468. DWORD dwDialExtraSampleSeconds; // used when dialmode = dialasneeded
  469. DWORD dwHangUpExtraPercent; // used when dialmode = dialasneeded
  470. DWORD dwHangUpExtraSampleSeconds; // used when dialmode = dialasneeded
  471. BOOL fInitSecureCalled; // whether InitSecure() is called for password Encryption
  472. //
  473. // pucDnsTunnelIpAddr_list:
  474. // the h_addr_list of a HOSTENT - a list of ip addrs obtained by resolving the
  475. // tunnel server DNS name.
  476. // uiCurrentTunnelAddr
  477. // the index for h_TunnelIpAddr_list. Points to the currently used ip addr address.
  478. // rgwRandomDnsIndex
  479. // an array of random index to index into the tunnel addr list
  480. //
  481. unsigned char *pucDnsTunnelIpAddr_list;
  482. UINT uiCurrentDnsTunnelAddr;
  483. DWORD dwDnsTunnelAddrCount;
  484. PWORD rgwRandomDnsIndex;
  485. BOOL fAllUser;
  486. UINT uLanaMsgId; // Window handle of Lana window if any
  487. LPRASDIALPARAMS pRasDialParams;
  488. LPRASDIALEXTENSIONS pRasDialExtensions;
  489. DWORD dwRasSubEntry;
  490. HWND hwndMainDlg;
  491. BOOL fNoDialingRules;
  492. LPRASNOUSER lpRasNoUser;
  493. PEAPLOGONINFO lpEapLogonInfo;
  494. //
  495. // Note: RAS will pass either a LPRASNOUSER or LPEAPLOGONINFO ptr through the
  496. // RasCustomDialDlg interface when calling CM from WinLogon. RAS will
  497. // differentiate them by the RCD_Eap flag, which will be set if the
  498. // LPEAPLOGONINFO is passed. When not running in WinLogon, neither
  499. // will be sent.
  500. //
  501. BOOL fChangedPassword; // User changed password during logon
  502. HWND hWndChangePassword; // Hwnd of change passwor dialog
  503. BOOL fWaitingForCallback; // We're waiting for RAS to call us back
  504. HWND hWndCallbackNumber; // Hwnd of callback number dialog
  505. HWND hWndRetryAuthentication; // Hwnd of Retry Authentication dialog
  506. //
  507. // Support for global credentials
  508. //
  509. BOOL fGlobalCredentialsSupported; // enables/disables support for global creds
  510. DWORD dwCurrentCredentialType; // Which credentials are currently selected
  511. DWORD dwExistingCredentials; // uses bit flags to mark if credentials exist
  512. DWORD dwDeleteCredentials; // uses bit flag to mark creds for deletion
  513. DWORD dwWinLogonType; // 0 - User logged on
  514. // 1 - Winlogon: dial-up
  515. // 2 - Winlogon: ICS (no one is logged on)
  516. DWORD dwGlobalUserInfo; // uses bit flags to load/save global user info
  517. LONG lInConnectOrCancel; // to protect against Cancel during Connect processing, and vice-versa
  518. CmLogFile Log;
  519. } ArgsStruct;
  520. //
  521. // Global Credential Support
  522. //
  523. // Used to identify the current RAS credential store being used.
  524. // Used with ArgsStruct.dwCurrentCredentialType
  525. #define CM_CREDS_USER 1
  526. #define CM_CREDS_GLOBAL 2
  527. // Identifies which type of credentials want to be use used
  528. #define CM_CREDS_TYPE_MAIN 0
  529. #define CM_CREDS_TYPE_INET 1
  530. #define CM_CREDS_TYPE_BOTH 2
  531. // Used to identify who is logged on.
  532. // Used with ArgsStruct.dwWinLogonType
  533. #define CM_LOGON_TYPE_USER 0 // User is logged on
  534. #define CM_LOGON_TYPE_WINLOGON 1 // Dial-up, winlogon, reconnect user initiated logon
  535. #define CM_LOGON_TYPE_ICS 2 // No user is logged on, but need to dial unattended (ICS)
  536. // Used with ArgsStruct.dwGlobalUserInfo
  537. #define CM_GLOBAL_USER_INFO_READ_ICS_DATA 0x0001 // used to load user settings for ICS
  538. #define CM_GLOBAL_USER_INFO_WRITE_ICS_DATA 0x0002 // used to save user settings for ICS
  539. // Used with ArgsStruct.dwExistingCredentials
  540. #define CM_EXIST_CREDS_MAIN_GLOBAL 0x0001 // set if RAS credential store has main global creds
  541. #define CM_EXIST_CREDS_MAIN_USER 0x0002 // set if RAS credential store has main user creds
  542. #define CM_EXIST_CREDS_INET_GLOBAL 0x0004 // set if RAS credential store has Internet global creds
  543. #define CM_EXIST_CREDS_INET_USER 0x0008 // set if RAS credential store has Internet user creds
  544. // Used with ArgsStruct.dwDeleteCredentials
  545. #define CM_DELETE_CREDS_MAIN_GLOBAL 0x0001 // set to delete main global creds
  546. #define CM_DELETE_CREDS_MAIN_USER 0x0002 // set to delete main user creds
  547. #define CM_DELETE_CREDS_INET_GLOBAL 0x0004 // set to delete Internet global creds
  548. #define CM_DELETE_CREDS_INET_USER 0x0008 // set to delete Internet user creds
  549. //
  550. // RasNumEntry - phone number subset of RASENTRY
  551. //
  552. typedef struct tagRasNumEntry
  553. {
  554. DWORD dwSize;
  555. DWORD dwfOptions;
  556. DWORD dwCountryID;
  557. DWORD dwCountryCode;
  558. TCHAR szAreaCode[ RAS_MaxAreaCode + 1 ];
  559. TCHAR szLocalPhoneNumber[ RAS_MaxPhoneNumber + 1 ];
  560. } RASNUMENTRY, *LPRASNUMENTRY;
  561. //
  562. // EditNumData struct used to pass data to/from EditNum dialog.
  563. //
  564. typedef struct tagEditNumData
  565. {
  566. ArgsStruct *pArgs;
  567. RASNUMENTRY RasNumEntry;
  568. } EDITNUMDATA, *LPEDITNUMDATA;
  569. //************************************************************************
  570. // string constants
  571. //************************************************************************
  572. //
  573. // CMMON exe name, expected to be local
  574. //
  575. const TCHAR* const c_pszCmMonExeName = TEXT("CMMON32.EXE");
  576. //************************************************************************
  577. // function prototypes
  578. //************************************************************************
  579. // init.cpp
  580. void InitProfileFromName(ArgsStruct *pArgs,
  581. LPCTSTR pszArg);
  582. HRESULT InitProfile(ArgsStruct *pArgs,
  583. LPCTSTR pszEntry);
  584. HRESULT InitArgsForDisconnect(ArgsStruct *pArgs, BOOL fAllUser);
  585. HRESULT InitArgsForConnect(ArgsStruct *pArgs,
  586. LPCTSTR pszRasPhoneBook,
  587. LPCMDIALINFO lpCmInfo,
  588. BOOL fAllUser);
  589. HRESULT InitCredentials(ArgsStruct *pArgs,
  590. LPCMDIALINFO lpCmInfo,
  591. DWORD dwFlags,
  592. PVOID pvLogonBlob);
  593. HRESULT InitLogging(ArgsStruct *pArgs,
  594. LPCTSTR pszEntry,
  595. BOOL fBanner);
  596. LRESULT CreateIniObjects(ArgsStruct *pArgs);
  597. void ReleaseIniObjects(ArgsStruct *pArgs);
  598. DWORD RegisterBitmapClass(HINSTANCE hInst);
  599. HRESULT WriteCmpInfoToReg(LPCTSTR pszSubKey,
  600. LPCTSTR pszEntryName,
  601. PVOID pEntryValue,
  602. DWORD dwType,
  603. DWORD dwSize);
  604. LPTSTR GetEntryFromCmp(const TCHAR *pszSectionName,
  605. LPTSTR pszEntryName,
  606. LPCTSTR pszCmpPath);
  607. void ReplaceCmpFile(LPCTSTR pszCmpPath);
  608. LPTSTR FormRegPathFromAccessPoint(ArgsStruct *pArgs);
  609. // disconn.cpp
  610. DWORD Disconnect(CConnectionTable *pConnTable,
  611. LPCM_CONNECTION pConnection,
  612. BOOL fIgnoreRefCount,
  613. BOOL fPersist);
  614. DWORD HangupNotifyCmMon(CConnectionTable *pConnTable,
  615. LPCTSTR pszEntry);
  616. // connect.cpp
  617. HRESULT Connect(HWND hwndParent,
  618. LPCTSTR lpszEntry,
  619. LPTSTR lpszPhonebook,
  620. LPRASDIALDLG lpRasDialDlg,
  621. LPRASENTRYDLG lpRasEntryDlg,
  622. LPCMDIALINFO lpCmInfo,
  623. DWORD dwFlags,
  624. LPVOID lpvLogonBlob);
  625. #define NOT_IN_CONNECT_OR_CANCEL 0
  626. #define IN_CONNECT_OR_CANCEL 1
  627. void GetConnectType(ArgsStruct *pArgs);
  628. void AddWatchProcessId(ArgsStruct *pArgs, DWORD dwProcessId);
  629. void AddWatchProcess(ArgsStruct *pArgs, HANDLE hProcess);
  630. DWORD DoRasHangup(RasLinkageStruct *prlsRasLink,
  631. HRASCONN hRasConnection,
  632. HWND hwndDlg = NULL,
  633. BOOL fWaitForComplete = FALSE,
  634. LPBOOL pfWaiting = NULL);
  635. DWORD MyRasHangup(ArgsStruct *pArgs,
  636. HRASCONN hRasConnection,
  637. HWND hwndDlg = NULL,
  638. BOOL fWaitForComplete = FALSE);
  639. DWORD HangupCM(
  640. ArgsStruct *pArgs,
  641. HWND hwndDlg,
  642. BOOL fWaitForComplete = FALSE,
  643. BOOL fUpdateTable = TRUE);
  644. BOOL UseTunneling(
  645. ArgsStruct *pArgs,
  646. DWORD dwEntry
  647. );
  648. void SetMainDlgUserInfo(
  649. ArgsStruct *pArgs,
  650. HWND hwndDlg
  651. );
  652. BOOL OnResetPassword(
  653. HWND hwndDlg,
  654. ArgsStruct *pArgs
  655. );
  656. void AppendStatusPane(HWND hwndDlg,
  657. DWORD dwMsgId);
  658. void AppendStatusPane(HWND hwndDlg,
  659. LPCTSTR pszMsg);
  660. LPTSTR GetPhoneByIdx(ArgsStruct *pArgs,
  661. UINT nIdx,
  662. LPTSTR *ppszDesc,
  663. LPTSTR *ppszDUN,
  664. LPDWORD pdwCountryID,
  665. LPTSTR *ppszRegionName,
  666. LPTSTR *ppszServiceType,
  667. LPTSTR *ppszPhoneBookFile,
  668. LPTSTR *ppszCanonical,
  669. DWORD *pdwPhoneInfoFlags);
  670. void PutPhoneByIdx(ArgsStruct *pArgs,
  671. UINT nIdx,
  672. LPCTSTR pszPhone,
  673. LPCTSTR pszDesc,
  674. LPCTSTR pszDUN,
  675. DWORD dwCountryID,
  676. LPCTSTR pszRegionName,
  677. LPCTSTR pszServiceType,
  678. LPCTSTR pszPhoneBookFile,
  679. LPCTSTR ppszCanonical,
  680. DWORD dwPhoneInfoFlags);
  681. DWORD LoadDialInfo(ArgsStruct *pArgs, HWND hwndDlg, BOOL fInstallModem = TRUE, BOOL fAlwaysMunge = FALSE);
  682. VOID MungeDialInfo(ArgsStruct *pArgs);
  683. void LoadHelpFileInfo(ArgsStruct *pArgs);
  684. void CopyPhone(ArgsStruct *pArgs,
  685. LPRASENTRY preEntry,
  686. DWORD dwEntry);
  687. VOID LoadLogoBitmap(ArgsStruct * pArgs,
  688. HWND hwndDlg);
  689. HRESULT LoadFutureSplash(ArgsStruct * pArgs,
  690. HWND hwndDlg);
  691. void LoadProperties(
  692. ArgsStruct *pArgs
  693. );
  694. void LoadIconsAndBitmaps(
  695. ArgsStruct *pArgs,
  696. HWND hwndDlg
  697. );
  698. DWORD DoRasDial(HWND hwndDlg,
  699. ArgsStruct *pArgs,
  700. DWORD dwEntry);
  701. DWORD DoTunnelDial(HWND hwndDlg,
  702. ArgsStruct *pArgs);
  703. BOOL CheckConnect(HWND hwndDlg,
  704. ArgsStruct *pArgs,
  705. UINT *pnCtrlFocus,
  706. BOOL fShowMsg = FALSE);
  707. void MainSetDefaultButton(HWND hwndDlg,
  708. UINT nCtrlId);
  709. VOID MapStateToFrame(ArgsStruct * pArgs);
  710. void SetInteractive(HWND hwndDlg,
  711. ArgsStruct *pArgs);
  712. void OnMainLoadStartupInfo(
  713. HWND hwndDlg,
  714. ArgsStruct *pArgs
  715. );
  716. BOOL SetupInternalInfo(
  717. ArgsStruct *pArgs,
  718. HWND hwndDlg
  719. );
  720. void OnMainInit(HWND hwndDlg,
  721. ArgsStruct *pArgs);
  722. void OnMainConnect(HWND hwndDlg,
  723. ArgsStruct *pArgs);
  724. int OnMainProperties(HWND hwndDlg,
  725. ArgsStruct *pArgs);
  726. void OnMainCancel(HWND hwndDlg,
  727. ArgsStruct *pArgs);
  728. void OnMainEnChange(HWND hwndDlg,
  729. ArgsStruct *pArgs);
  730. DWORD OnRasNotificationMessage(HWND hwndDlg,
  731. ArgsStruct *pArgs,
  732. WPARAM wParam,
  733. LPARAM lParam);
  734. void OnRasErrorMessage(HWND hwndDlg,
  735. ArgsStruct *pArgs,
  736. DWORD dwError);
  737. void OnMainTimer(HWND hwndDlg,
  738. ArgsStruct *pArgs);
  739. void OnConnectedCM(HWND hwndDlg,
  740. ArgsStruct *pArgs);
  741. INT_PTR CALLBACK MainDlgProc(HWND hwndDlg,
  742. UINT uMsg,
  743. WPARAM wParam,
  744. LPARAM lParam);
  745. BOOL ShowAccessPointInfoFromReg(ArgsStruct *pArgs,
  746. HWND hwndParent,
  747. UINT uiComboID);
  748. BOOL ChangedAccessPoint(ArgsStruct *pArgs,
  749. HWND hwndDlg,
  750. UINT uiComboID);
  751. // dialogs.cpp
  752. int DoPropertiesPropSheets(
  753. HWND hwndDlg,
  754. ArgsStruct *pArgs
  755. );
  756. void CheckConnectionAndInformUser(
  757. HWND hwndDlg,
  758. ArgsStruct *pArgs
  759. );
  760. BOOL HaveContextHelp(
  761. HWND hwndDlg,
  762. HWND hwndCtrl
  763. );
  764. // refs.cpp
  765. BOOL ValidTopLevelPBK(
  766. ArgsStruct *pArgs
  767. );
  768. BOOL ValidReferencedPBKs(
  769. ArgsStruct *pArgs
  770. );
  771. CIni* GetAppropriateIniService(
  772. ArgsStruct *pArgs,
  773. DWORD dwEntry
  774. );
  775. // ctr.cpp
  776. VOID CleanupCtr(LPICMOCCtr pCtr);
  777. BOOL LinkToOle32(
  778. Ole32LinkageStruct *polsOle32Link,
  779. LPCSTR pszOle32);
  780. void UnlinkFromOle32(
  781. Ole32LinkageStruct *polsOle32Link);
  782. // util.cpp
  783. BOOL InBetween(int iLowerBound, int iNumber, int iUpperBound);
  784. void GetPrefixSuffix
  785. (
  786. ArgsStruct *pArgs,
  787. CIni* piniService,
  788. LPTSTR *ppszUsernamePrefix,
  789. LPTSTR *ppszUsernameSuffix
  790. );
  791. LPTSTR ApplyPrefixSuffixToBufferAlloc
  792. (
  793. ArgsStruct *pArgs,
  794. CIni *piniService,
  795. LPTSTR pszBuffer
  796. );
  797. LPTSTR ApplyDomainPrependToBufferAlloc
  798. (
  799. ArgsStruct *pArgs,
  800. CIni *piniService,
  801. LPTSTR pszBuffer,
  802. LPCTSTR pszDunName
  803. );
  804. void ApplyPasswordHandlingToBuffer
  805. (
  806. ArgsStruct *pArgs,
  807. LPTSTR pszBuffer
  808. );
  809. BOOL IsActionEnabled(CONST WCHAR *pszProgram,
  810. CONST WCHAR *pszServiceName,
  811. CONST WCHAR *pszServiceFileName,
  812. LPDWORD lpdwLoadType);
  813. BOOL IsLogonAsSystem();
  814. BOOL UnRegisterWindowClass(HINSTANCE hInst);
  815. DWORD RegisterWindowClass(HINSTANCE hInst);
  816. LPCM_CONNECTION GetConnection(ArgsStruct *pArgs);
  817. void NotifyUserOfExistingConnection(
  818. HWND hwndParent,
  819. LPCM_CONNECTION pConnection,
  820. BOOL fStatus);
  821. BOOL FileExists(LPCTSTR pszFullNameAndPath);
  822. LPTSTR CmGetWindowTextAlloc(
  823. HWND hwndDlg,
  824. UINT nCtrl);
  825. LPTSTR GetServiceName(CIni *piniService);
  826. LPTSTR GetTunnelSuffix();
  827. LPTSTR GetDefaultDunSettingName(CIni* piniService, BOOL fTunnelEntry);
  828. LPTSTR GetDunSettingName(ArgsStruct * pArgs, DWORD dwEntry, BOOL fTunnelEntry);
  829. LPTSTR GetCMSforPhoneBook(ArgsStruct * pArgs, DWORD dwEntry);
  830. BOOL ReadMappingByRoot(
  831. HKEY hkRoot,
  832. LPCTSTR pszDUN,
  833. LPTSTR pszMapping,
  834. DWORD dwMapping,
  835. BOOL bExpandEnvStrings
  836. );
  837. BOOL ReadMapping(
  838. LPCTSTR pszDUN,
  839. LPTSTR pszMapping,
  840. DWORD dwMapping,
  841. BOOL fAllUser,
  842. BOOL bExpandEnvStrings
  843. );
  844. LPTSTR ReducePathToRelative(
  845. ArgsStruct *pArgs,
  846. LPCTSTR pszFullPath);
  847. BOOL IsBlankString(LPCTSTR pszString);
  848. BOOL IsValidPhoneNumChar(TCHAR tChar);
  849. LPTSTR StripPath(LPCTSTR pszFullNameAndPath);
  850. void SingleSpace(LPTSTR pszStr, UINT uNumCharsInStr);
  851. void Ip_GPPS(CIni *pIni,
  852. LPCTSTR pszSection,
  853. LPCTSTR pszEntry,
  854. RASIPADDR *pIP);
  855. void CopyGPPS(CIni *pIni,
  856. LPCTSTR pszSection,
  857. LPCTSTR pszEntry,
  858. LPTSTR pszBuffer,
  859. size_t nLen);
  860. BYTE HexValue(IN CHAR ch);
  861. CHAR HexChar(IN BYTE byte);
  862. void StripCanonical(LPTSTR pszSrc);
  863. void StripFirstElement(LPTSTR pszSrc);
  864. BOOL FrontExistingUI
  865. (
  866. CConnectionTable *pConnTable,
  867. LPCTSTR pszServiceName,
  868. BOOL fConnect
  869. );
  870. LPTSTR GetPropertiesDlgTitle(
  871. LPCTSTR pszServiceName
  872. );
  873. int GetPPTPMsgId(void);
  874. BOOL IsServicePackInstalled(void);
  875. // pb.cpp
  876. #define CPBMAP_ERROR -1
  877. class CPBMap {
  878. public:
  879. CPBMap();
  880. ~CPBMap();
  881. DWORD Open(LPCSTR pszISP, DWORD dwParam=0);
  882. DWORD ToCookie(DWORD_PTR dwPB, DWORD dwIdx, DWORD *pdwParam=NULL);
  883. DWORD_PTR PBFromCookie(DWORD dwCookie, DWORD *pdwParam=NULL);
  884. DWORD IdxFromCookie(DWORD dwCookie, DWORD *pdwParam=NULL);
  885. DWORD_PTR GetPBByIdx(DWORD_PTR dwIdx, DWORD *pdwParam=NULL);
  886. DWORD GetCnt();
  887. private:
  888. UINT m_nCnt;
  889. void *m_pvData;
  890. };
  891. #define PB_MAX_PHONE (RAS_MaxPhoneNumber+1)
  892. #define PB_MAX_DESC 256
  893. typedef struct tagPBArgs {
  894. LPCTSTR pszCMSFile;
  895. TCHAR szServiceType[PB_MAX_SERVICE];
  896. DWORD dwCountryId;
  897. TCHAR szRegionName[PB_MAX_REGION];
  898. TCHAR szNonCanonical[PB_MAX_PHONE];
  899. TCHAR szCanonical[PB_MAX_PHONE];
  900. TCHAR szDesc[PB_MAX_DESC];
  901. LPTSTR pszMessage;
  902. TCHAR szPhoneBookFile[MAX_PATH+1];
  903. LPTSTR pszBitmap;
  904. LPCTSTR pszHelpFile;
  905. TCHAR szDUNFile[MAX_PATH+1];
  906. HPALETTE *phMasterPalette;
  907. } PBArgs;
  908. BOOL DisplayPhoneBook(HWND hwndDlg, PBArgs *pArgs, BOOL fHasValidTopLevelPBK, BOOL fHasValidReferencedPBKs);
  909. // rnawnd.cpp
  910. HANDLE ZapRNAConnectedTo(LPCTSTR pszDUN, HANDLE hEvent);
  911. // userinfo.cpp
  912. BOOL GetUserInfo(
  913. ArgsStruct *pArgs,
  914. UINT uiEntry,
  915. PVOID *ppvData
  916. );
  917. BOOL SaveUserInfo(
  918. ArgsStruct *pArgs,
  919. UINT uiEntry,
  920. PVOID pvData
  921. );
  922. BOOL DeleteUserInfo(
  923. ArgsStruct *pArgs,
  924. UINT uiEntry
  925. );
  926. int NeedToUpgradeUserInfo(
  927. ArgsStruct *pArgs
  928. );
  929. BOOL UpgradeUserInfoFromCmp(
  930. ArgsStruct *pArgs
  931. );
  932. BOOL UpgradeUserInfoFromRegToRasAndReg(
  933. ArgsStruct *pArgs
  934. );
  935. BOOL ReadUserInfoFromReg(
  936. ArgsStruct *pArgs,
  937. UINT uiDataID,
  938. PVOID *ppvData);
  939. LPTSTR BuildUserInfoSubKey(
  940. LPCTSTR pszServiceKey,
  941. BOOL fAllUser);
  942. LPTSTR BuildICSDataInfoSubKey(
  943. LPCTSTR pszServiceKey);
  944. BOOL WriteUserInfoToReg(
  945. ArgsStruct *pArgs,
  946. UINT uiDataID,
  947. PVOID pvData);
  948. // ntlsa.cpp
  949. DWORD LSA_ReadString(
  950. ArgsStruct *pArgs,
  951. LPTSTR pszKey,
  952. LPTSTR pszStr,
  953. DWORD dwStrLen
  954. );
  955. DWORD LSA_WriteString(
  956. ArgsStruct *pArgs,
  957. LPTSTR pszKey,
  958. LPCTSTR pszStr
  959. );
  960. BOOL InitLsa(
  961. ArgsStruct *pArgs
  962. );
  963. BOOL DeInitLsa(
  964. ArgsStruct *pArgs
  965. );
  966. // ras.cpp
  967. BOOL IsRasLoaded(const RasLinkageStruct * const prlsRasLink);
  968. BOOL LinkToRas(RasLinkageStruct *prlsRasLink);
  969. void UnlinkFromRas(RasLinkageStruct *prlsRasLink);
  970. BOOL GetRasModems(const RasLinkageStruct *prlsRasLink,
  971. LPRASDEVINFO *pprdiRasDevInfo,
  972. LPDWORD pdwCnt);
  973. BOOL PickModem(IN const ArgsStruct *pArgs,
  974. OUT LPTSTR pszDeviceType,
  975. OUT LPTSTR pszDeviceName,
  976. OUT BOOL* pfSameModem = NULL);
  977. BOOL GetDeviceType(ArgsStruct *pArgs,
  978. LPTSTR pszDeviceType,
  979. UINT uNumCharsInDeviceType,
  980. LPTSTR pszDeviceName);
  981. BOOL PickTunnelDevice(LPTSTR pszDeviceType,
  982. LPTSTR pszDeviceName,
  983. LPRASDEVINFO prdiModems,
  984. DWORD dwCnt);
  985. BOOL PickTunnelDevice(ArgsStruct *pArgs,
  986. LPTSTR pszDeviceType,
  987. LPTSTR pszDeviceName);
  988. void CopyAutoDial(LPRASENTRY preEntry);
  989. LPRASENTRY MyRGEP(LPCTSTR pszRasPbk,
  990. LPCTSTR pszEntryName,
  991. RasLinkageStruct *prlsRasLink);
  992. BOOL CheckConnectionError(HWND hwndDlg,
  993. DWORD dwErr,
  994. ArgsStruct *pArgs,
  995. BOOL fTunneling,
  996. LPTSTR *ppszRasErrMsg = NULL);
  997. LPTSTR GetRasConnectoidName(
  998. ArgsStruct *pArgs,
  999. CIni* piniService,
  1000. BOOL fTunnelEntry
  1001. );
  1002. LPRASENTRY CreateRASEntryStruct(
  1003. ArgsStruct *pArgs,
  1004. LPCTSTR pszDUN,
  1005. CIni* piniService,
  1006. BOOL fTunnelEntry,
  1007. LPTSTR pszRasPbk,
  1008. LPBYTE *ppbEapData,
  1009. LPDWORD pdwEapSize
  1010. );
  1011. LRESULT ReadDUNSettings(
  1012. ArgsStruct *pArgs,
  1013. LPCTSTR pszFile,
  1014. LPCTSTR pszDunName,
  1015. LPVOID pvBuffer,
  1016. LPBYTE *ppbEapData,
  1017. LPDWORD pdwEapSiz,
  1018. BOOL fTunnel
  1019. );
  1020. BOOL ValidateDialupDunSettings(LPCTSTR pszCmsFile,
  1021. LPCTSTR pszDunName,
  1022. LPCTSTR pszTopLevelCms);
  1023. LPTSTR CreateRasPrivatePbk(
  1024. ArgsStruct *pArgs);
  1025. DWORD AllocateSecurityDescriptorAllowAccessToWorld(PSECURITY_DESCRIPTOR *ppSd);
  1026. LPTSTR GetPathToPbk(
  1027. LPCTSTR pszCmp, ArgsStruct *pArgs);
  1028. void DisableWin95RasWizard(
  1029. void
  1030. );
  1031. BOOL SetIsdnDualChannelEntries(
  1032. ArgsStruct *pArgs,
  1033. LPRASENTRY pre,
  1034. LPRASSUBENTRY *pprse,
  1035. PDWORD pdwSubEntryCount
  1036. );
  1037. BOOL SetNtIdleDisconnectInRasEntry(
  1038. ArgsStruct *pArgs,
  1039. LPRASENTRY pre
  1040. );
  1041. BOOL DisableSystemIdleDisconnect(LPRASENTRY pre);
  1042. DWORD WINAPI RasDialFunc2(
  1043. ULONG_PTR dwCallbackId, // user-defined value specified in RasDial
  1044. // call
  1045. DWORD dwSubEntry, // subentry index in multilink connection
  1046. HRASCONN hrasconn, // handle to RAS connection
  1047. UINT unMsg, // type of event that has occurred
  1048. RASCONNSTATE rascs, // connection state about to be entered
  1049. DWORD dwError, // error that may have occurred
  1050. DWORD dwExtendedError // extended error information for some
  1051. // errors
  1052. );
  1053. LPRASENTRY AllocateRasEntry();
  1054. LPRASDIALEXTENSIONS AllocateAndInitRasDialExtensions();
  1055. DWORD InitRasDialExtensions(LPRASDIALEXTENSIONS lpRasDialExtensions);
  1056. DWORD SetRasDialExtensions(ArgsStruct* pArgs, BOOL fEnablePausedStates, BOOL fEnableCustomScripting);
  1057. LPVOID GetRasCallBack(ArgsStruct* pArgs);
  1058. DWORD GetRasCallBackType();
  1059. #if 0
  1060. /*
  1061. void InitDefaultRasPhoneBook();
  1062. LPTSTR GetRasSystemPhoneBookPath();
  1063. */
  1064. #endif
  1065. LPRASDIALPARAMS AllocateAndInitRasDialParams();
  1066. DWORD InitRasDialParams(LPRASDIALPARAMS lpRasDialParams);
  1067. LPTSTR GetRasPbkFromNT5ProfilePath(LPCTSTR pszProfile);
  1068. DWORD OnPauseRasDial(HWND hwndDlg, ArgsStruct *pArgs, WPARAM wParam, LPARAM lParam);
  1069. // tapi.cpp
  1070. BOOL OpenTapi(HINSTANCE hInst, TapiLinkageStruct *ptlsTapiLink);
  1071. void CloseTapi(TapiLinkageStruct *ptlsTapiLink);
  1072. BOOL LinkToTapi(TapiLinkageStruct *ptlsTapiLink, LPCSTR pszTapi);
  1073. void UnlinkFromTapi(TapiLinkageStruct *ptlsTapiLink);
  1074. BOOL SetTapiDevice(HINSTANCE hInst,
  1075. TapiLinkageStruct *ptlsTapiLink,
  1076. LPCTSTR pszModem);
  1077. LRESULT MungePhone(LPCTSTR pszModem,
  1078. LPTSTR *ppszPhone,
  1079. TapiLinkageStruct *ptlsTapiLink,
  1080. HINSTANCE hInst,
  1081. BOOL fDialingRulesEnabled,
  1082. LPTSTR *ppszDial,
  1083. BOOL fAccessPointsEnabled);
  1084. DWORD GetCurrentTapiLocation(TapiLinkageStruct *ptlsTapiLink);
  1085. DWORD SetCurrentTapiLocation(TapiLinkageStruct *ptlsTapiLink, DWORD dwLocation);
  1086. void RestoreOldTapiLocation(TapiLinkageStruct *ptlsTapiLink);
  1087. HANDLE HookLights(ArgsStruct *pArgs);
  1088. inline BOOL IsTunnelEnabled(const ArgsStruct* pArgs)
  1089. {
  1090. return (pArgs->fTunnelPrimary || pArgs->fTunnelReferences);
  1091. }
  1092. inline BOOL IsDialingTunnel(const ArgsStruct* pArgs)
  1093. {
  1094. return pArgs->psState == PS_TunnelDialing
  1095. || pArgs->psState == PS_TunnelAuthenticating;
  1096. }
  1097. inline BOOL _ArgsStruct::IsDirectConnect() const
  1098. {
  1099. return m_fDirectConnect;
  1100. }
  1101. inline void _ArgsStruct::SetDirectConnect(BOOL fDirect)
  1102. {
  1103. m_fDirectConnect = fDirect;
  1104. }
  1105. inline BOOL _ArgsStruct::IsBothConnTypeSupported() const
  1106. {
  1107. return m_fBothConnTypeSupported;
  1108. }
  1109. inline void _ArgsStruct::SetBothConnTypeSupported(BOOL fBoth)
  1110. {
  1111. m_fBothConnTypeSupported = fBoth;
  1112. }
  1113. // wsock.cpp
  1114. BOOL TryAnotherTunnelDnsAddress(
  1115. ArgsStruct *pArgs
  1116. );
  1117. // main.cpp
  1118. BOOL WhoIsCaller(
  1119. DWORD dwCaller = DT_USER
  1120. );
  1121. // lanawait.cpp
  1122. BOOL LanaWait(
  1123. ArgsStruct *pArgs,
  1124. HWND hwndMainDlg
  1125. );
  1126. //
  1127. // Credential helper functions
  1128. //
  1129. #define CM_DELETE_SAVED_CREDS_KEEP_GLOBALS FALSE
  1130. #define CM_DELETE_SAVED_CREDS_DELETE_GLOBALS TRUE
  1131. #define CM_DELETE_SAVED_CREDS_KEEP_IDENTITY FALSE
  1132. #define CM_DELETE_SAVED_CREDS_DELETE_IDENTITY TRUE
  1133. BOOL InitializeCredentialSupport(ArgsStruct *pArgs);
  1134. BOOL RefreshCredentialTypes(ArgsStruct *pArgs, BOOL fSetCredsDefault);
  1135. VOID RefreshCredentialInfo(ArgsStruct *pArgs, DWORD dwCredsType);
  1136. DWORD FindEntryCredentialsForCM(ArgsStruct *pArgs, LPTSTR pszPhoneBook, BOOL *pfUser, BOOL *pfGlobal);
  1137. DWORD GetCurrentCredentialType(ArgsStruct *pArgs);
  1138. BOOL DeleteSavedCredentials(ArgsStruct *pArgs, DWORD dwCredsType, BOOL fDeleteGlobal, BOOL fDeleteIdentity);
  1139. VOID SetCredentialUIOptionBasedOnDefaultCreds(ArgsStruct *pArgs, HWND hwndDlg);
  1140. VOID GetAndStoreUserInfo(ArgsStruct *pArgs, HWND hwndDlg, BOOL fSaveUPD, BOOL fSaveOtherUserInfo);
  1141. VOID TryToDeleteAndSaveCredentials(ArgsStruct *pArgs, HWND hwndDlg);
  1142. VOID GetUserInfoFromDialog(ArgsStruct *pArgs, HWND hwndDlg, RASCREDENTIALS *prc);
  1143. VOID SwitchToLocalCreds(ArgsStruct *pArgs, HWND hwndDlg, BOOL fSwitchToLocal);
  1144. VOID SwitchToGlobalCreds(ArgsStruct *pArgs, HWND hwndDlg, BOOL fSwitchToGlobal);
  1145. VOID ReloadCredentials(ArgsStruct *pArgs, HWND hwndDlg, DWORD dwWhichCredType);
  1146. //
  1147. // Global User Info help functions
  1148. //
  1149. VOID SetIniObjectReadWriteFlags(ArgsStruct *pArgs);
  1150. VOID VerifyAdvancedTabSettings(ArgsStruct *pArgs);
  1151. HRESULT InternalGetSharingEnabled(IHNetConnection *pHNetConnection, BOOLEAN *pbEnabled, SHARINGCONNECTIONTYPE* pType);
  1152. HRESULT InternalGetFirewallEnabled(IHNetConnection *pHNetConnection, BOOLEAN *pbEnabled);
  1153. STDMETHODIMP DisableSharing(IHNetConnection *pHNetConn);
  1154. VOID EnableInternetFirewall(IHNetConnection *pHNetConn);
  1155. HRESULT FindINetConnectionByGuid(GUID *pGuid, INetConnection **ppNetCon);
  1156. VOID SetProxyBlanket(IUnknown *pUnk);
  1157. BOOL IsAdmin(VOID);
  1158. BOOL IsMemberOfGroup(DWORD dwGroupRID, BOOL bUseBuiltinDomainRid);
  1159. HRESULT APIENTRY HrCreateNetConnectionUtilities(INetConnectionUiUtilities ** ppncuu);
  1160. #endif // _ICM_INC