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.

834 lines
25 KiB

  1. // Copyright (c) 1995, Microsoft Corporation, all rights reserved
  2. //
  3. // penettab.c
  4. // Remote Access Common Dialog APIs
  5. // Phonebook Entry property sheet (Networking tab)
  6. //
  7. // 12/10/97 Shaun Cox
  8. //
  9. #include "rasdlgp.h"
  10. #include "entryps.h"
  11. #include "inetcfgp.h"
  12. #include "initguid.h"
  13. #include "netcfgp.h"
  14. #include "netconp.h"
  15. #include "devguid.h"
  16. #include "uiinfo.h"
  17. typedef struct
  18. _MAP_SZ_DWORD
  19. {
  20. LPCTSTR pszValue;
  21. DWORD dwValue;
  22. }
  23. MAP_SZ_DWORD;
  24. //For whistler bug#194394
  25. //For 64bit, IPX wont show up
  26. //For 32/64 bit, NETBEUI wont show up
  27. //
  28. #ifdef _WIN64
  29. static const MAP_SZ_DWORD c_mapProtocols [] =
  30. {
  31. { NETCFG_TRANS_CID_MS_TCPIP, NP_Ip },
  32. { NETCFG_TRANS_CID_MS_NETMON, NP_Netmon },
  33. };
  34. #else
  35. static const MAP_SZ_DWORD c_mapProtocols [] =
  36. {
  37. { NETCFG_TRANS_CID_MS_TCPIP, NP_Ip },
  38. { NETCFG_TRANS_CID_MS_NWIPX, NP_Ipx },
  39. { NETCFG_TRANS_CID_MS_NETMON, NP_Netmon },
  40. };
  41. #endif
  42. //+---------------------------------------------------------------------------
  43. //
  44. // Function: DwProtocolFromComponentId
  45. //
  46. // Purpose: Return the DWORD value of the protocol corresponding to
  47. // the string value in c_mapProtocols.
  48. //
  49. // Arguments:
  50. // pszComponentId [in] Component id to find.
  51. //
  52. // Returns: NP_xxx value
  53. //
  54. // Author: shaunco 13 Dec 1997
  55. //
  56. // Notes: The input argument must exist in c_mapProtocols.
  57. //
  58. DWORD
  59. DwProtocolFromComponentId (
  60. LPCTSTR pszComponentId)
  61. {
  62. int i;
  63. for (i = 0; i < sizeof(c_mapProtocols) / sizeof(c_mapProtocols[0]); i++)
  64. {
  65. if (0 == lstrcmpi (pszComponentId, c_mapProtocols[i].pszValue))
  66. {
  67. return c_mapProtocols[i].dwValue;
  68. }
  69. }
  70. // Should never get here as we should never pass a protocol that is not
  71. // in c_mapProtocols.
  72. //
  73. ASSERT (FALSE);
  74. return 0;
  75. }
  76. //+---------------------------------------------------------------------------
  77. //
  78. // Function: GetComponentImageIndex
  79. //
  80. // Purpose: Returns the index into pcild corresponding to the class of
  81. // pComponent.
  82. //
  83. // Arguments:
  84. // pComponent [in] Component who's class should be used.
  85. // pcild [in] Returned from SetupDiGetClassImageList
  86. //
  87. // Returns: A valid index or zero (which may also be valid).
  88. //
  89. // Author: shaunco 12 Dec 1997
  90. //
  91. // Notes:
  92. //
  93. int
  94. GetComponentImageIndex (
  95. INetCfgComponent* pComponent,
  96. SP_CLASSIMAGELIST_DATA* pcild)
  97. {
  98. int iImage = 0;
  99. GUID guidClass;
  100. HRESULT hr = INetCfgComponent_GetClassGuid (pComponent, &guidClass);
  101. if (SUCCEEDED(hr))
  102. {
  103. SetupDiGetClassImageIndex (pcild, &guidClass, &iImage);
  104. }
  105. return iImage;
  106. }
  107. //+---------------------------------------------------------------------------
  108. //
  109. // Function: HrEnumComponentsForListView
  110. //
  111. // Purpose: Return an array of INetCfgComponents that are candidates
  112. // for adding to our list view. This is composed of all
  113. // clients and servcies, and a few select protocols. (No
  114. // net adapters.) Hidden components could be returned and
  115. // should be checked before adding to the list view.
  116. //
  117. // Arguments:
  118. // pNetCfg [in]
  119. // celt [in]
  120. // rgelt [out]
  121. // pceltFetched [out]
  122. //
  123. // Returns: S_OK or an error.
  124. //
  125. // Author: shaunco 12 Dec 1997
  126. //
  127. // Notes:
  128. //
  129. HRESULT
  130. HrEnumComponentsForListView (
  131. INetCfg* pNetCfg,
  132. ULONG celt,
  133. INetCfgComponent** rgelt,
  134. ULONG* pceltFetched)
  135. {
  136. static const GUID* c_apguidClasses [] =
  137. {
  138. &GUID_DEVCLASS_NETCLIENT,
  139. &GUID_DEVCLASS_NETSERVICE,
  140. };
  141. HRESULT hr;
  142. int i;
  143. ULONG celtFetched = 0;
  144. // Initialize the output parameters.
  145. //
  146. ZeroMemory (rgelt, celt * sizeof (*rgelt));
  147. *pceltFetched = 0;
  148. // Enumerate the clients and services.
  149. //
  150. hr = HrEnumComponentsInClasses (pNetCfg,
  151. sizeof(c_apguidClasses) / sizeof(c_apguidClasses[0]),
  152. (GUID**)c_apguidClasses,
  153. celt, rgelt, &celtFetched);
  154. // Find the protocols if they are installed.
  155. //
  156. for (i = 0; i < sizeof(c_mapProtocols) / sizeof(c_mapProtocols[0]); i++)
  157. {
  158. INetCfgComponent* pComponent;
  159. hr = INetCfg_FindComponent (pNetCfg, c_mapProtocols[i].pszValue,
  160. &pComponent);
  161. if (S_OK == hr)
  162. {
  163. rgelt [celtFetched++] = pComponent;
  164. }
  165. }
  166. *pceltFetched = celtFetched;
  167. return S_OK;
  168. }
  169. //+---------------------------------------------------------------------------
  170. //
  171. // Function: HrNeRefreshListView
  172. //
  173. // Purpose: Clear and re-add all of the items that belong in the list
  174. // view.
  175. //
  176. // Arguments:
  177. // pInfo [in]
  178. //
  179. // Returns: S_OK or an error code.
  180. //
  181. // Author: shaunco 12 Dec 1997
  182. //
  183. // Notes:
  184. //
  185. HRESULT
  186. HrNeRefreshListView (
  187. PEINFO* pInfo)
  188. {
  189. HRESULT hr = S_OK;
  190. INetCfgComponent* aComponents [256];
  191. ULONG cComponents;
  192. HIMAGELIST himlSmall;
  193. PBENTRY* pEntry = pInfo->pArgs->pEntry;
  194. PBFILE* pFile = pInfo->pArgs->pFile;
  195. // Delete all existing items. The LVN_DELETEITEM handler is expected to
  196. // release the objects we have attached prior.
  197. //
  198. ListView_DeleteAllItems (pInfo->hwndLvComponents);
  199. hr = HrEnumComponentsForListView (pInfo->pNetCfg,
  200. sizeof(aComponents)/sizeof(aComponents[0]),
  201. aComponents, &cComponents);
  202. if (SUCCEEDED(hr))
  203. {
  204. BOOL fHasPermission = TRUE;
  205. ULONG i;
  206. // check if user has any permission to change the bindings
  207. INetConnectionUiUtilities * pncuu = NULL;
  208. hr = HrCreateNetConnectionUtilities(&pncuu);
  209. if (SUCCEEDED(hr))
  210. {
  211. fHasPermission =
  212. INetConnectionUiUtilities_UserHasPermission(
  213. pncuu, NCPERM_ChangeBindState);
  214. INetConnectionUiUtilities_Release(pncuu);
  215. }
  216. for (i = 0; i < cComponents; i++)
  217. {
  218. INetCfgComponent* pComponent = aComponents [i];
  219. DWORD dwCharacter;
  220. LPWSTR pszwName = NULL;
  221. LPWSTR pszwId = NULL;
  222. int iItem;
  223. LV_ITEM item = {0};
  224. BOOL fCheck, fForceCheck = FALSE;
  225. GUID guid;
  226. BOOL fDisableCheckbox = FALSE;
  227. // We'll release it if inserting it failed or we decided to
  228. // skip it. By not releasing it, we pass ownership to the
  229. // list view.
  230. //
  231. BOOL fReleaseComponent = TRUE;
  232. // Don't add hidden components. Silently skip components
  233. // that we fail to get the class GUID or display name for.
  234. // (After all, what could we have the user do to fix the error?
  235. // Might as well show them what we can.)
  236. //
  237. if ( FAILED(INetCfgComponent_GetCharacteristics (pComponent, &dwCharacter))
  238. || (dwCharacter & NCF_HIDDEN)
  239. || FAILED(INetCfgComponent_GetDisplayName (pComponent, &pszwName)))
  240. {
  241. goto skip_component;
  242. }
  243. //for whistler bug 29356 filter out Network Load Balancing
  244. //
  245. if (SUCCEEDED(INetCfgComponent_GetId(pComponent, &pszwId)))
  246. {
  247. WCHAR * pszwTmpId = NULL;
  248. pszwTmpId = StrDupWFromT(NETCFG_SERVICE_CID_MS_WLBS);
  249. if(pszwTmpId)
  250. {
  251. if ( 0 == lstrcmpW(pszwId, pszwTmpId))
  252. {
  253. Free0(pszwTmpId);
  254. CoTaskMemFree (pszwId);
  255. goto skip_component;
  256. }
  257. Free0(pszwTmpId);
  258. }
  259. CoTaskMemFree (pszwId);
  260. }
  261. // Disable the checkbox on components whose bindings are not user adjustable
  262. // or user has no permission to adjust binding
  263. if (NCF_FIXED_BINDING & dwCharacter)
  264. {
  265. fDisableCheckbox = TRUE;
  266. }
  267. // Bug #157213: Don't add any protocols other than IP if SLIP
  268. // is enabled
  269. //
  270. // Bug #294401: Also filter out CSNW when server type is SLIP
  271. if (pInfo->pArgs->pEntry->dwBaseProtocol == BP_Slip)
  272. {
  273. if (SUCCEEDED(INetCfgComponent_GetClassGuid(pComponent, &guid)))
  274. {
  275. BOOL fSkip = FALSE;
  276. if (IsEqualGUID(&guid, &GUID_DEVCLASS_NETTRANS))
  277. {
  278. if (SUCCEEDED(INetCfgComponent_GetId(pComponent, &pszwId)))
  279. {
  280. if (DwProtocolFromComponentId(pszwId) == NP_Ip)
  281. {
  282. // This item is IP. We should disable the check
  283. // box so the user can't disable TCP/IP in SLIP
  284. // mode. This is done after the item is inserted.
  285. //
  286. fDisableCheckbox = TRUE;
  287. // 122024
  288. //
  289. // We should also force the ui to show ip as enabled
  290. // since IP is always used with SLIP.
  291. //
  292. fForceCheck = TRUE;
  293. }
  294. else
  295. {
  296. fSkip = TRUE;
  297. }
  298. CoTaskMemFree (pszwId);
  299. }
  300. }
  301. else if (IsEqualGUID(&guid, &GUID_DEVCLASS_NETCLIENT))
  302. {
  303. if (SUCCEEDED(INetCfgComponent_GetId(pComponent, &pszwId)))
  304. {
  305. if (0 == lstrcmpi (pszwId, TEXT("MS_NWCLIENT")))
  306. {
  307. fSkip = TRUE;
  308. }
  309. CoTaskMemFree (pszwId);
  310. }
  311. }
  312. if (fSkip)
  313. {
  314. goto skip_component;
  315. }
  316. }
  317. }
  318. // pmay: 348623
  319. //
  320. // If we are remote admining a router, only allow tcpip and
  321. // ipx to be displayed.
  322. //
  323. if (pInfo->pArgs->fRouter && pInfo->pArgs->fRemote)
  324. {
  325. if (SUCCEEDED(INetCfgComponent_GetClassGuid(pComponent, &guid)))
  326. {
  327. BOOL fSkip = TRUE;
  328. DWORD dwId;
  329. if (IsEqualGUID(&guid, &GUID_DEVCLASS_NETTRANS))
  330. {
  331. if (SUCCEEDED(INetCfgComponent_GetId(pComponent, &pszwId)))
  332. {
  333. dwId = DwProtocolFromComponentId(pszwId);
  334. if ((dwId == NP_Ip) || (dwId == NP_Ipx))
  335. {
  336. fSkip = FALSE;
  337. }
  338. CoTaskMemFree (pszwId);
  339. }
  340. }
  341. if (fSkip)
  342. {
  343. goto skip_component;
  344. }
  345. }
  346. }
  347. item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
  348. item.pszText = pszwName;
  349. item.iImage = GetComponentImageIndex (pComponent, &pInfo->cild);
  350. item.lParam = (LPARAM)pComponent;
  351. // Add the item.
  352. //
  353. iItem = ListView_InsertItem (pInfo->hwndLvComponents, &item);
  354. if (-1 != iItem)
  355. {
  356. // List view now has it. We can't release it.
  357. //
  358. fReleaseComponent = FALSE;
  359. // Set its check state.
  360. //
  361. if (! fForceCheck)
  362. {
  363. fCheck = NeIsComponentEnabled (pInfo, pComponent);
  364. }
  365. else
  366. {
  367. fCheck = TRUE;
  368. }
  369. ListView_SetCheck (pInfo->hwndLvComponents, iItem, fCheck);
  370. // Disable the checkbox if this is psched. We don't allow
  371. // users to change check state of psched from ras connections.
  372. // bug 255749 [raos].
  373. //
  374. if(SUCCEEDED(INetCfgComponent_GetId(pComponent, &pszwId)))
  375. {
  376. // Check to see if this is psched.
  377. //
  378. if( (0 == _wcsicmp(pszwId, L"ms_psched"))
  379. || (0 == _wcsicmp(pszwId, L"ms_NetMon")))
  380. {
  381. fDisableCheckbox = TRUE;
  382. }
  383. }
  384. if (fDisableCheckbox)
  385. {
  386. ListView_DisableCheck(pInfo->hwndLvComponents, iItem);
  387. }
  388. }
  389. skip_component:
  390. if (fReleaseComponent)
  391. {
  392. ReleaseObj (pComponent);
  393. }
  394. CoTaskMemFree (pszwName);
  395. }
  396. // Select first item
  397. ListView_SetItemState(pInfo->hwndLvComponents, 0,
  398. LVIS_SELECTED | LVIS_FOCUSED,
  399. LVIS_SELECTED | LVIS_FOCUSED);
  400. }
  401. return hr;
  402. }
  403. //+---------------------------------------------------------------------------
  404. //
  405. // Function: PComponentFromItemIndex
  406. //
  407. // Purpose: Return the INetCfgComponent associated with the specified
  408. // list view item.
  409. //
  410. // Arguments:
  411. // hwndLv [in]
  412. // iItem [in]
  413. //
  414. // Returns: A (non-AddRef'd) copy of the INetCfgComponent pointer
  415. // associated with the item.
  416. //
  417. // Author: shaunco 14 Dec 1997
  418. //
  419. // Notes: The returned value is NOT AddRef'd.
  420. //
  421. INetCfgComponent*
  422. PComponentFromItemIndex (
  423. HWND hwndLv,
  424. int iItem)
  425. {
  426. INetCfgComponent* pComponent = NULL;
  427. LV_ITEM item = {0};
  428. item.mask = LVIF_PARAM;
  429. item.iItem = iItem;
  430. if (ListView_GetItem (hwndLv, &item))
  431. {
  432. pComponent = (INetCfgComponent*)item.lParam;
  433. ASSERT (pComponent);
  434. }
  435. return pComponent;
  436. }
  437. //+---------------------------------------------------------------------------
  438. //
  439. // Function: PComponentFromCurSel
  440. //
  441. // Purpose:
  442. //
  443. // Arguments:
  444. // hwndLv [in] Window handle of list view
  445. // piItem [out] Optional address of integer to receive selected item.
  446. //
  447. // Returns:
  448. //
  449. // Author: shaunco 30 Dec 1997
  450. //
  451. // Notes:
  452. //
  453. INetCfgComponent*
  454. PComponentFromCurSel (
  455. HWND hwndLv,
  456. int* piItem)
  457. {
  458. INetCfgComponent* pComponent = NULL;
  459. // Get the current selection if it exists.
  460. //
  461. int iItem = ListView_GetNextItem (hwndLv, -1, LVNI_SELECTED);
  462. if (-1 != iItem)
  463. {
  464. // Get the component associated with the current selection. It must
  465. // exist.
  466. //
  467. pComponent = PComponentFromItemIndex (hwndLv, iItem);
  468. ASSERT (pComponent);
  469. }
  470. // Return the index of the item if requested.
  471. //
  472. if (piItem)
  473. {
  474. *piItem = iItem;
  475. }
  476. return pComponent;
  477. }
  478. //+---------------------------------------------------------------------------
  479. //
  480. // Function: PeQueryOrChangeComponentEnabled
  481. //
  482. // Purpose:
  483. //
  484. // Arguments:
  485. // pInfo []
  486. // pComponent []
  487. // fChange []
  488. // fNewValue []
  489. //
  490. // Returns:
  491. //
  492. // Author: shaunco 14 Dec 1997
  493. //
  494. // Notes:
  495. //
  496. BOOL
  497. NeQueryOrChangeComponentEnabled (
  498. PEINFO* pInfo,
  499. INetCfgComponent* pComponent,
  500. BOOL fChange,
  501. BOOL fValue)
  502. {
  503. BOOL fOldValue;
  504. GUID guidClass;
  505. HRESULT hr;
  506. hr = INetCfgComponent_GetClassGuid (pComponent, &guidClass);
  507. if (SUCCEEDED(hr))
  508. {
  509. LPWSTR pszwId;
  510. hr = INetCfgComponent_GetId (pComponent, &pszwId);
  511. if (SUCCEEDED(hr))
  512. {
  513. // We handle protocols in a hard-coded (er, well known) fashion.
  514. //
  515. if (IsEqualGUID (&guidClass, &GUID_DEVCLASS_NETTRANS))
  516. {
  517. DWORD* pdwValue = &pInfo->pArgs->pEntry->dwfExcludedProtocols;
  518. // Check if the protocol is exluded.
  519. //
  520. DWORD dwProtocol = DwProtocolFromComponentId (pszwId);
  521. if (fChange)
  522. {
  523. if (fValue)
  524. {
  525. // Include the protocol. (By not explicitly excluding
  526. // it.
  527. //
  528. *pdwValue &= ~dwProtocol;
  529. }
  530. else
  531. {
  532. // Exclude the protocol. (Remember, its a list of
  533. // excluded protocols.
  534. //
  535. *pdwValue |= dwProtocol;
  536. }
  537. }
  538. else
  539. {
  540. fValue = !(dwProtocol & *pdwValue);
  541. }
  542. }
  543. else
  544. {
  545. if (fChange)
  546. {
  547. EnableOrDisableNetComponent (pInfo->pArgs->pEntry,
  548. pszwId, fValue);
  549. }
  550. else
  551. {
  552. // Default to enabled for the case whenthe value isn't
  553. // found in the entry. This will be the case for pre-NT5
  554. // entries and entries that have not yet been to the
  555. // Networking tab for edits.
  556. //
  557. BOOL fEnabled;
  558. fValue = TRUE;
  559. if (FIsNetComponentListed(pInfo->pArgs->pEntry,
  560. pszwId, &fEnabled, NULL))
  561. {
  562. fValue = fEnabled;
  563. }
  564. }
  565. }
  566. CoTaskMemFree (pszwId);
  567. }
  568. }
  569. return fValue;
  570. }
  571. VOID
  572. NeEnableComponent (
  573. PEINFO* pInfo,
  574. INetCfgComponent* pComponent,
  575. BOOL fEnable)
  576. {
  577. NeQueryOrChangeComponentEnabled (pInfo, pComponent, TRUE, fEnable);
  578. }
  579. BOOL
  580. NeIsComponentEnabled (
  581. PEINFO* pInfo,
  582. INetCfgComponent* pComponent)
  583. {
  584. return NeQueryOrChangeComponentEnabled (pInfo, pComponent, FALSE, FALSE);
  585. }
  586. VOID
  587. NeShowComponentProperties (
  588. IN PEINFO* pInfo)
  589. {
  590. HRESULT hr;
  591. // Get the component for the current selection.
  592. //
  593. INetCfgComponent* pComponent;
  594. pComponent = PComponentFromCurSel (pInfo->hwndLvComponents, NULL);
  595. ASSERT (pComponent);
  596. if(NULL == pComponent)
  597. {
  598. return;
  599. }
  600. // Create the UI info callback object if we haven't done so yet.
  601. // If this fails, we can still show properties. TCP/IP just might
  602. // not know which UI-variant to show.
  603. //
  604. if (!pInfo->punkUiInfoCallback)
  605. {
  606. HrCreateUiInfoCallbackObject (pInfo, &pInfo->punkUiInfoCallback);
  607. }
  608. // Show the component's property UI. If S_OK is returned, it means
  609. // something changed.
  610. //
  611. hr = INetCfgComponent_RaisePropertyUi (pComponent,
  612. pInfo->hwndDlg,
  613. NCRP_SHOW_PROPERTY_UI,
  614. pInfo->punkUiInfoCallback);
  615. if (S_OK == hr)
  616. {
  617. // Get the INetCfgComponentPrivate interface so we can query the
  618. // notify object directly.
  619. //
  620. INetCfgComponentPrivate* pPrivate;
  621. hr = INetCfgComponent_QueryInterface (pComponent,
  622. &IID_INetCfgComponentPrivate,
  623. (VOID**)&pPrivate);
  624. if (SUCCEEDED(hr))
  625. {
  626. // Get the INetRasConnectionIpUiInfo interface from the notify
  627. // object.
  628. //
  629. INetRasConnectionIpUiInfo* pIpUiInfo;
  630. hr = INetCfgComponentPrivate_QueryNotifyObject (pPrivate,
  631. &IID_INetRasConnectionIpUiInfo,
  632. (VOID**)&pIpUiInfo);
  633. if (SUCCEEDED(hr))
  634. {
  635. // Get the UI info from TCP/IP.
  636. //
  637. RASCON_IPUI info;
  638. hr = INetRasConnectionIpUiInfo_GetUiInfo (pIpUiInfo, &info);
  639. if (SUCCEEDED(hr))
  640. {
  641. PBENTRY* pEntry = pInfo->pArgs->pEntry;
  642. // Get rid of our current data before we copy the new
  643. // data.
  644. //
  645. pEntry->dwIpAddressSource = ASRC_ServerAssigned;
  646. pEntry->dwIpNameSource = ASRC_ServerAssigned;
  647. Free0 (pEntry->pszIpAddress);
  648. pEntry->pszIpAddress = NULL;
  649. Free0 (pEntry->pszIpDnsAddress);
  650. pEntry->pszIpDnsAddress = NULL;
  651. Free0 (pEntry->pszIpDns2Address);
  652. pEntry->pszIpDns2Address = NULL;
  653. Free0 (pEntry->pszIpWinsAddress);
  654. pEntry->pszIpWinsAddress = NULL;
  655. Free0 (pEntry->pszIpWins2Address);
  656. pEntry->pszIpWins2Address = NULL;
  657. Free0 (pEntry->pszIpDnsSuffix);
  658. pEntry->pszIpDnsSuffix = StrDup (info.pszwDnsSuffix);
  659. if ((info.dwFlags & RCUIF_USE_IP_ADDR) &&
  660. *info.pszwIpAddr)
  661. {
  662. pEntry->dwIpAddressSource = ASRC_RequireSpecific;
  663. pEntry->pszIpAddress = StrDup (info.pszwIpAddr);
  664. }
  665. else
  666. {
  667. pEntry->dwIpAddressSource = ASRC_ServerAssigned;
  668. Free0 (pEntry->pszIpAddress);
  669. pEntry->pszIpAddress = NULL;
  670. }
  671. if (info.dwFlags & RCUIF_USE_NAME_SERVERS)
  672. {
  673. if (*info.pszwDnsAddr)
  674. {
  675. pEntry->dwIpNameSource = ASRC_RequireSpecific;
  676. pEntry->pszIpDnsAddress = StrDup (info.pszwDnsAddr);
  677. }
  678. if (*info.pszwDns2Addr)
  679. {
  680. pEntry->dwIpNameSource = ASRC_RequireSpecific;
  681. pEntry->pszIpDns2Address = StrDup (info.pszwDns2Addr);
  682. }
  683. if (*info.pszwWinsAddr)
  684. {
  685. pEntry->dwIpNameSource = ASRC_RequireSpecific;
  686. pEntry->pszIpWinsAddress = StrDup (info.pszwWinsAddr);
  687. }
  688. if (*info.pszwWins2Addr)
  689. {
  690. pEntry->dwIpNameSource = ASRC_RequireSpecific;
  691. pEntry->pszIpWins2Address = StrDup (info.pszwWins2Addr);
  692. }
  693. }
  694. // pmay: 389632
  695. //
  696. // Use this convoluted logic to store something reasonable
  697. // about the registration process.
  698. //
  699. if (info.dwFlags & RCUIF_USE_DISABLE_REGISTER_DNS)
  700. {
  701. pEntry->dwIpDnsFlags = 0;
  702. }
  703. else
  704. {
  705. BOOL bSuffix =
  706. ((pEntry->pszIpDnsSuffix) && (*(pEntry->pszIpDnsSuffix)));
  707. pEntry->dwIpDnsFlags = DNS_RegPrimary;
  708. if (info.dwFlags & RCUIF_USE_PRIVATE_DNS_SUFFIX)
  709. {
  710. if (bSuffix)
  711. {
  712. pEntry->dwIpDnsFlags |= DNS_RegPerConnection;
  713. }
  714. else
  715. {
  716. pEntry->dwIpDnsFlags |= DNS_RegDhcpInform;
  717. }
  718. }
  719. }
  720. // 277478
  721. // Enable the NBT over IP controls
  722. //
  723. if (info.dwFlags & RCUIF_ENABLE_NBT)
  724. {
  725. pEntry->dwIpNbtFlags = PBK_ENTRY_IP_NBT_Enable;
  726. }
  727. else
  728. {
  729. pEntry->dwIpNbtFlags = 0;
  730. }
  731. if (pInfo->pArgs->fRouter)
  732. {
  733. pEntry->fIpPrioritizeRemote = FALSE;
  734. }
  735. else
  736. {
  737. pEntry->fIpPrioritizeRemote = info.dwFlags & RCUIF_USE_REMOTE_GATEWAY;
  738. }
  739. pEntry->fIpHeaderCompression = info.dwFlags & RCUIF_USE_HEADER_COMPRESSION;
  740. pEntry->dwFrameSize = info.dwFrameSize;
  741. }
  742. ReleaseObj (pIpUiInfo);
  743. }
  744. ReleaseObj (pPrivate);
  745. }
  746. }
  747. }