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.

897 lines
19 KiB

  1. /*++
  2. Copyright (c) 1994-2001 Microsoft Corporation
  3. Module Name :
  4. fvdir.cpp
  5. Abstract:
  6. FTP Virtual Directory Properties dialog
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. --*/
  14. #include "stdafx.h"
  15. #include "common.h"
  16. #include "inetprop.h"
  17. #include "InetMgrApp.h"
  18. #include "supdlgs.h"
  19. #include "shts.h"
  20. #include "ftpsht.h"
  21. #include "fvdir.h"
  22. #include "iisobj.h"
  23. #include <lmcons.h>
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. //
  30. // Directory Properties Page
  31. //
  32. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  33. IMPLEMENT_DYNCREATE(CFtpDirectoryPage, CInetPropertyPage)
  34. CFtpDirectoryPage::CFtpDirectoryPage(
  35. IN CInetPropertySheet * pSheet,
  36. IN BOOL fHome
  37. )
  38. /*++
  39. Routine Description:
  40. Constructor for directory property page
  41. Arguments:
  42. CInetPropertySheet * pSheet : Sheet pointer
  43. BOOL fHome : TRUE if this is a home directory
  44. --*/
  45. : CInetPropertyPage(CFtpDirectoryPage::IDD, pSheet,
  46. fHome ? IDS_TAB_HOME_DIRECTORY : IDS_TAB_VIRTUAL_DIRECTORY),
  47. m_fHome(fHome),
  48. m_fOriginallyUNC(FALSE)
  49. {
  50. VERIFY(m_strPathPrompt.LoadString(IDS_PATH));
  51. VERIFY(m_strSharePrompt.LoadString(IDS_SHARE));
  52. #if 0 // Keep Class-wizard happy
  53. //{{AFX_DATA_INIT(CFtpDirectoryPage)
  54. m_nPathType = RADIO_DIRECTORY;
  55. m_nUnixDos = 0;
  56. m_fRead = FALSE;
  57. m_fWrite = FALSE;
  58. m_fLogAccess = FALSE;
  59. m_strPath = _T("");
  60. m_strDefaultDocument = _T("");
  61. m_strFooter = _T("");
  62. m_fBrowsingAllowed = FALSE;
  63. m_fEnableDefaultDocument = FALSE;
  64. m_fEnableFooter = FALSE;
  65. m_dwAccessPerms = 0;
  66. //}}AFX_DATA_INIT
  67. #endif // 0
  68. }
  69. CFtpDirectoryPage::~CFtpDirectoryPage()
  70. /*++
  71. Routine Description:
  72. Destructor
  73. Arguments:
  74. N/A
  75. Return Value:
  76. N/A
  77. --*/
  78. {
  79. }
  80. void
  81. CFtpDirectoryPage::DoDataExchange(
  82. IN CDataExchange * pDX
  83. )
  84. /*++
  85. Routine Description:
  86. Initialise/Store control Data
  87. Arguments:
  88. CDataExchange * pDX : DDX/DDV struct
  89. Return Value:
  90. None.
  91. --*/
  92. {
  93. CInetPropertyPage::DoDataExchange(pDX);
  94. //{{AFX_DATA_MAP(CFtpDirectoryPage)
  95. DDX_Check(pDX, IDC_CHECK_READ, m_fRead);
  96. DDX_Check(pDX, IDC_CHECK_WRITE, m_fWrite);
  97. DDX_Check(pDX, IDC_CHECK_LOG_ACCESS, m_fLogAccess);
  98. DDX_Control(pDX, IDC_CHECK_LOG_ACCESS, m_check_LogAccess);
  99. DDX_Control(pDX, IDC_CHECK_WRITE, m_check_Write);
  100. DDX_Control(pDX, IDC_CHECK_READ, m_check_Read);
  101. DDX_Control(pDX, IDC_BUTTON_EDIT_PATH_TYPE, m_button_AddPathType);
  102. DDX_Control(pDX, IDC_BUTTON_BROWSE, m_button_Browse);
  103. DDX_Control(pDX, IDC_EDIT_PATH, m_edit_Path);
  104. DDX_Control(pDX, IDC_RADIO_DIR, m_radio_Dir);
  105. DDX_Control(pDX, IDC_STATIC_PATH, m_static_PathPrompt);
  106. DDX_Radio(pDX, IDC_RADIO_DIR, m_nPathType);
  107. DDX_Radio(pDX, IDC_RADIO_UNIX, m_nUnixDos);
  108. //}}AFX_DATA_MAP
  109. DDX_Control(pDX, IDC_RADIO_UNC, m_radio_Unc);
  110. DDX_Text(pDX, IDC_EDIT_PATH, m_strPath);
  111. m_strPath.TrimLeft();
  112. DDV_MinMaxChars(pDX, m_strPath, 0, MAX_PATH);
  113. if (pDX->m_bSaveAndValidate)
  114. {
  115. CString csPathMunged;
  116. //
  117. // Make sure a field names are correct
  118. //
  119. if (m_nPathType == RADIO_NETDIRECTORY)
  120. {
  121. DDV_UNCFolderPath(pDX, m_strPath,IsLocal());
  122. if (IsLocal())
  123. {
  124. // do this check only if a change was made.
  125. if (IsDirty())
  126. {
  127. csPathMunged = m_strPath;
  128. #ifdef SUPPORT_SLASH_SLASH_QUESTIONMARK_SLASH_TYPE_PATHS
  129. GetSpecialPathRealPath(0,m_strPath,csPathMunged);
  130. #endif
  131. if (PathIsUNCServerShare(csPathMunged))
  132. {
  133. if (FALSE == DoesUNCShareExist(csPathMunged))
  134. {
  135. CError err;
  136. err = ERROR_PATH_NOT_FOUND;
  137. if (IDCANCEL == err.MessageBox(m_hWnd,MB_ICONINFORMATION | MB_OKCANCEL | MB_DEFBUTTON2,NO_HELP_CONTEXT))
  138. {
  139. pDX->Fail();
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. else // Local Directory
  147. {
  148. ASSERT(m_nPathType == RADIO_DIRECTORY);
  149. if (!IsMasterInstance())
  150. {
  151. DDV_FolderPath(pDX, m_strPath, IsLocal());
  152. }
  153. }
  154. }
  155. else
  156. {
  157. if (!IsMasterInstance())
  158. {
  159. DDV_MinMaxChars(pDX, m_strPath, 1, MAX_PATH);
  160. }
  161. }
  162. }
  163. void
  164. CFtpDirectoryPage::SetStateByType()
  165. /*++
  166. Routine Description:
  167. Set the state of the dialog by the path type currently selected
  168. Arguments:
  169. None
  170. Return Value:
  171. None
  172. --*/
  173. {
  174. switch(m_nPathType)
  175. {
  176. case RADIO_DIRECTORY:
  177. DeActivateControl(m_button_AddPathType);
  178. if (IsLocal() && !IsMasterInstance() && HasAdminAccess())
  179. {
  180. ActivateControl(m_button_Browse);
  181. }
  182. else
  183. {
  184. DeActivateControl(m_button_Browse);
  185. }
  186. m_static_PathPrompt.SetWindowText(m_strPathPrompt);
  187. break;
  188. case RADIO_NETDIRECTORY:
  189. ActivateControl(m_button_AddPathType);
  190. DeActivateControl(m_button_Browse);
  191. m_static_PathPrompt.SetWindowText(m_strSharePrompt);
  192. break;
  193. default:
  194. ASSERT(FALSE && "Invalid Selection");
  195. }
  196. }
  197. void
  198. CFtpDirectoryPage::SetPathType(
  199. IN LPCTSTR lpstrPath
  200. )
  201. /*++
  202. Routine Description:
  203. Set path type from given path
  204. Arguments:
  205. LPCTSTR lpstrPath : Path string
  206. Return Value:
  207. None
  208. --*/
  209. {
  210. CString csPathMunged;
  211. csPathMunged = lpstrPath;
  212. #ifdef SUPPORT_SLASH_SLASH_QUESTIONMARK_SLASH_TYPE_PATHS
  213. GetSpecialPathRealPath(0,lpstrPath,csPathMunged);
  214. #endif
  215. if (PathIsUNC(csPathMunged))
  216. {
  217. m_nPathType = RADIO_NETDIRECTORY;
  218. m_radio_Dir.SetCheck(0);
  219. m_radio_Unc.SetCheck(1);
  220. }
  221. else
  222. {
  223. m_nPathType = RADIO_DIRECTORY;
  224. m_radio_Unc.SetCheck(0);
  225. m_radio_Dir.SetCheck(1);
  226. }
  227. SetStateByType();
  228. }
  229. //
  230. // Message Map
  231. //
  232. BEGIN_MESSAGE_MAP(CFtpDirectoryPage, CInetPropertyPage)
  233. //{{AFX_MSG_MAP(CFtpDirectoryPage)
  234. ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnButtonBrowse)
  235. ON_BN_CLICKED(IDC_BUTTON_EDIT_PATH_TYPE, OnButtonEditPathType)
  236. ON_BN_CLICKED(IDC_RADIO_DIR, OnRadioDir)
  237. ON_BN_CLICKED(IDC_RADIO_UNC, OnRadioUnc)
  238. //}}AFX_MSG_MAP
  239. ON_EN_CHANGE(IDC_EDIT_PATH, OnItemChanged)
  240. ON_BN_CLICKED(IDC_CHECK_WRITE, OnItemChanged)
  241. ON_BN_CLICKED(IDC_CHECK_READ, OnItemChanged)
  242. ON_BN_CLICKED(IDC_CHECK_LOG_ACCESS, OnItemChanged)
  243. ON_BN_CLICKED(IDC_RADIO_MSDOS, OnItemChanged)
  244. ON_BN_CLICKED(IDC_RADIO_UNIX, OnItemChanged)
  245. END_MESSAGE_MAP()
  246. //
  247. // Message Handlers
  248. //
  249. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  250. void
  251. CFtpDirectoryPage::OnItemChanged()
  252. /*++
  253. Routine Description:
  254. Handle change in data on the item
  255. Arguments:
  256. None
  257. Return Value:
  258. None
  259. --*/
  260. {
  261. SetModified(TRUE);
  262. }
  263. static int CALLBACK
  264. FileChooserCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
  265. {
  266. CFtpDirectoryPage * pThis = (CFtpDirectoryPage *)lpData;
  267. ASSERT(pThis != NULL);
  268. return pThis->BrowseForFolderCallback(hwnd, uMsg, lParam);
  269. }
  270. int
  271. CFtpDirectoryPage::BrowseForFolderCallback(HWND hwnd, UINT uMsg, LPARAM lParam)
  272. {
  273. switch (uMsg)
  274. {
  275. case BFFM_INITIALIZED:
  276. ASSERT(m_pPathTemp != NULL);
  277. if (::PathIsNetworkPath(m_pPathTemp))
  278. return 0;
  279. while (!::PathIsDirectory(m_pPathTemp))
  280. {
  281. if (0 == ::PathRemoveFileSpec(m_pPathTemp) && !::PathIsRoot(m_pPathTemp))
  282. {
  283. return 0;
  284. }
  285. DWORD attr = GetFileAttributes(m_pPathTemp);
  286. if ((attr & FILE_ATTRIBUTE_READONLY) == 0)
  287. break;
  288. }
  289. ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)m_pPathTemp);
  290. break;
  291. case BFFM_SELCHANGED:
  292. {
  293. LPITEMIDLIST pidl = (LPITEMIDLIST)lParam;
  294. TCHAR path[MAX_PATH];
  295. if (SHGetPathFromIDList(pidl, path))
  296. {
  297. ::SendMessage(hwnd, BFFM_ENABLEOK, 0, !PathIsNetworkPath(path));
  298. }
  299. }
  300. break;
  301. case BFFM_VALIDATEFAILED:
  302. break;
  303. }
  304. return 0;
  305. }
  306. void
  307. CFtpDirectoryPage::OnButtonBrowse()
  308. /*++
  309. Routine Description:
  310. "Browse" button handler
  311. Arguments:
  312. None
  313. Return Value:
  314. None
  315. --*/
  316. {
  317. ASSERT(IsLocal());
  318. BOOL bRes = FALSE;
  319. HRESULT hr;
  320. CString str;
  321. m_edit_Path.GetWindowText(str);
  322. if (SUCCEEDED(hr = CoInitialize(NULL)))
  323. {
  324. LPITEMIDLIST pidl = NULL;
  325. if (SUCCEEDED(SHGetFolderLocation(NULL, CSIDL_DRIVES, NULL, 0, &pidl)))
  326. {
  327. LPITEMIDLIST pidList = NULL;
  328. BROWSEINFO bi;
  329. TCHAR buf[MAX_PATH];
  330. ZeroMemory(&bi, sizeof(bi));
  331. ExpandEnvironmentStrings(str, buf, MAX_PATH);
  332. str = buf;
  333. int drive = PathGetDriveNumber(str);
  334. if (GetDriveType(PathBuildRoot(buf, drive)) == DRIVE_FIXED)
  335. {
  336. StrCpy(buf, str);
  337. }
  338. else
  339. {
  340. buf[0] = 0;
  341. }
  342. m_strBrowseTitle.LoadString(m_fHome ?
  343. IDS_TAB_HOME_DIRECTORY : IDS_TAB_VIRTUAL_DIRECTORY);
  344. bi.hwndOwner = m_hWnd;
  345. bi.pidlRoot = pidl;
  346. bi.pszDisplayName = m_pPathTemp = buf;
  347. bi.lpszTitle = m_strBrowseTitle;
  348. bi.ulFlags |= BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS/* | BIF_EDITBOX*/;
  349. bi.lpfn = FileChooserCallback;
  350. bi.lParam = (LPARAM)this;
  351. pidList = SHBrowseForFolder(&bi);
  352. if ( pidList != NULL
  353. && SHGetPathFromIDList(pidList, buf)
  354. )
  355. {
  356. str = buf;
  357. bRes = TRUE;
  358. }
  359. IMalloc * pMalloc;
  360. VERIFY(SUCCEEDED(SHGetMalloc(&pMalloc)));
  361. if (pidl != NULL)
  362. pMalloc->Free(pidl);
  363. pMalloc->Release();
  364. }
  365. CoUninitialize();
  366. }
  367. if (bRes)
  368. {
  369. m_strPath = str;
  370. m_edit_Path.SetWindowText(str);
  371. SetPathType(m_strPath);
  372. OnItemChanged();
  373. }
  374. }
  375. BOOL
  376. CFtpDirectoryPage::OnInitDialog()
  377. /*++
  378. Routine Description:
  379. WM_INITDIALOG handler. Initialize the dialog.
  380. Arguments:
  381. None.
  382. Return Value:
  383. TRUE if no focus is to be set automatically, FALSE if the focus
  384. is already set.
  385. --*/
  386. {
  387. CInetPropertyPage::OnInitDialog();
  388. m_button_Browse.EnableWindow(
  389. IsLocal()
  390. && !IsMasterInstance()
  391. && HasAdminAccess());
  392. SetPathType(m_strPath);
  393. //
  394. // Directory listing style dependent on whether or not
  395. // this is a home directory
  396. //
  397. ActivateControl(*GetDlgItem(IDC_STATIC_DIRLISTING), m_fHome);
  398. ActivateControl(*GetDlgItem(IDC_RADIO_UNIX), m_fHome);
  399. ActivateControl(*GetDlgItem(IDC_RADIO_MSDOS), m_fHome);
  400. //
  401. // Some items not available on master instance
  402. //
  403. CFTPInstanceProps ip(GetSheet()->QueryAuthInfo(), GetSheet()->QueryMetaPath());
  404. ip.LoadData();
  405. BOOL bUserIsolation = ip.HasADUserIsolation() || ip.HasUserIsolation();
  406. GetDlgItem(IDC_STATIC_PATH_TYPE)->EnableWindow(!IsMasterInstance());
  407. GetDlgItem(IDC_RADIO_DIR)->EnableWindow(
  408. !IsMasterInstance() && HasAdminAccess());
  409. GetDlgItem(IDC_RADIO_UNC)->EnableWindow(
  410. !IsMasterInstance() && HasAdminAccess());
  411. GetDlgItem(IDC_STATIC_PATH)->EnableWindow(
  412. !IsMasterInstance());
  413. GetDlgItem(IDC_EDIT_PATH)->EnableWindow(
  414. !IsMasterInstance() && HasAdminAccess());
  415. GetDlgItem(IDC_BUTTON_EDIT_PATH_TYPE)->EnableWindow(
  416. !IsMasterInstance() && HasAdminAccess() && !bUserIsolation);
  417. m_check_Write.EnableWindow(HasAdminAccess());
  418. m_check_Read.EnableWindow(HasAdminAccess());
  419. //
  420. // Store the original value of fUNC of reference later when
  421. // saving out --BoydM
  422. //
  423. m_fOriginallyUNC = (m_nPathType == RADIO_NETDIRECTORY);
  424. #ifdef SUPPORT_SLASH_SLASH_QUESTIONMARK_SLASH_TYPE_PATHS
  425. LimitInputPath(CONTROL_HWND(IDC_EDIT_PATH),TRUE);
  426. #else
  427. LimitInputPath(CONTROL_HWND(IDC_EDIT_PATH),FALSE);
  428. #endif
  429. return TRUE;
  430. }
  431. void
  432. CFtpDirectoryPage::ChangeTypeTo(
  433. IN int nNewType
  434. )
  435. /*++
  436. Routine Description
  437. Change the directory type
  438. Arguments:
  439. int nNewType : New radio value
  440. Return Value:
  441. None
  442. --*/
  443. {
  444. int nOldType = m_nPathType;
  445. m_nPathType = nNewType;
  446. if (nOldType == m_nPathType)
  447. {
  448. //
  449. // No change
  450. //
  451. return;
  452. }
  453. OnItemChanged();
  454. SetStateByType();
  455. LPCTSTR lpKeepPath = NULL;
  456. int nID = -1;
  457. switch(m_nPathType)
  458. {
  459. case RADIO_DIRECTORY:
  460. {
  461. CString csPathMunged;
  462. csPathMunged = m_strPath;
  463. #ifdef SUPPORT_SLASH_SLASH_QUESTIONMARK_SLASH_TYPE_PATHS
  464. GetSpecialPathRealPath(0,m_strPath,csPathMunged);
  465. #endif
  466. if (!PathIsUNC(csPathMunged) && (!PathIsRelative(csPathMunged) || IsDevicePath(csPathMunged)))
  467. {
  468. //
  469. // The old path info is acceptable, propose it
  470. // as a default
  471. //
  472. lpKeepPath = m_strPath;
  473. }
  474. nID = IDS_DIRECTORY_MASK;
  475. break;
  476. }
  477. case RADIO_NETDIRECTORY:
  478. {
  479. CString csPathMunged;
  480. csPathMunged = m_strPath;
  481. #ifdef SUPPORT_SLASH_SLASH_QUESTIONMARK_SLASH_TYPE_PATHS
  482. GetSpecialPathRealPath(0,m_strPath,csPathMunged);
  483. #endif
  484. if (PathIsUNC(csPathMunged))
  485. {
  486. //
  487. // The old path info is acceptable, propose it
  488. // as a default
  489. //
  490. lpKeepPath = m_strPath;
  491. }
  492. nID = IDS_UNC_MASK;
  493. break;
  494. }
  495. }
  496. if (lpKeepPath != NULL)
  497. {
  498. //
  499. // Restore the old path
  500. //
  501. m_edit_Path.SetWindowText(lpKeepPath);
  502. }
  503. else
  504. {
  505. //
  506. // Load mask resource, and display
  507. // this in the directory
  508. //
  509. CString str;
  510. VERIFY(str.LoadString(nID));
  511. m_edit_Path.SetWindowText(str);
  512. }
  513. m_edit_Path.SetSel(0,-1);
  514. m_edit_Path.SetFocus();
  515. }
  516. void
  517. CFtpDirectoryPage::OnRadioDir()
  518. /*++
  519. Routine Description:
  520. 'directory' radio button handler
  521. Arguments:
  522. None
  523. Return Value:
  524. None.
  525. --*/
  526. {
  527. ChangeTypeTo(RADIO_DIRECTORY);
  528. }
  529. void
  530. CFtpDirectoryPage::OnRadioUnc()
  531. /*++
  532. Routine Description:
  533. 'network directory' radio button handler
  534. Arguments:
  535. None
  536. Return Value:
  537. None.
  538. --*/
  539. {
  540. ChangeTypeTo(RADIO_NETDIRECTORY);
  541. }
  542. /* virtual */
  543. HRESULT
  544. CFtpDirectoryPage::FetchLoadedValues()
  545. /*++
  546. Routine Description:
  547. Move configuration data from sheet to dialog controls
  548. Arguments:
  549. None
  550. Return Value:
  551. HRESULT
  552. --*/
  553. {
  554. CError err;
  555. BEGIN_META_DIR_READ(CFtpSheet)
  556. //
  557. // Use 'm_' notation because the message crackers require it.
  558. //
  559. BOOL m_fDontLog;
  560. FETCH_DIR_DATA_FROM_SHEET(m_strAlias);
  561. FETCH_DIR_DATA_FROM_SHEET(m_strUserName);
  562. FETCH_DIR_DATA_FROM_SHEET_PASSWORD(m_strPassword);
  563. FETCH_DIR_DATA_FROM_SHEET(m_strPath);
  564. FETCH_DIR_DATA_FROM_SHEET(m_dwAccessPerms);
  565. FETCH_DIR_DATA_FROM_SHEET(m_fDontLog);
  566. m_fRead = IS_FLAG_SET(m_dwAccessPerms, MD_ACCESS_READ);
  567. m_fWrite = IS_FLAG_SET(m_dwAccessPerms, MD_ACCESS_WRITE);
  568. m_fLogAccess = !m_fDontLog;
  569. END_META_DIR_READ(err)
  570. BEGIN_META_INST_READ(CFtpSheet)
  571. BOOL m_fDosDirOutput;
  572. FETCH_INST_DATA_FROM_SHEET(m_fDosDirOutput);
  573. m_nUnixDos = m_fDosDirOutput ? RADIO_DOS : RADIO_UNIX;
  574. END_META_INST_READ(err)
  575. CString csPathMunged;
  576. csPathMunged = m_strPath;
  577. #ifdef SUPPORT_SLASH_SLASH_QUESTIONMARK_SLASH_TYPE_PATHS
  578. GetSpecialPathRealPath(0,m_strPath,csPathMunged);
  579. #endif
  580. m_nPathType = PathIsUNC(csPathMunged) ?
  581. RADIO_NETDIRECTORY : RADIO_DIRECTORY;
  582. //
  583. // Make sure we were passed the right home directory
  584. // flag
  585. //
  586. ASSERT(IsMasterInstance()
  587. || (m_fHome && !::lstrcmp(m_strAlias, g_cszRoot))
  588. || (!m_fHome && ::lstrcmp(m_strAlias, g_cszRoot))
  589. );
  590. return err;
  591. }
  592. /* virtual */
  593. HRESULT
  594. CFtpDirectoryPage::SaveInfo()
  595. /*++
  596. Routine Description:
  597. Save the information on this property page
  598. Arguments:
  599. None
  600. Return Value:
  601. Error return code
  602. --*/
  603. {
  604. ASSERT(IsDirty());
  605. TRACEEOLID("Saving FTP virtual directory page now...");
  606. CError err;
  607. SET_FLAG_IF(m_fRead, m_dwAccessPerms, MD_ACCESS_READ);
  608. SET_FLAG_IF(m_fWrite, m_dwAccessPerms, MD_ACCESS_WRITE);
  609. //
  610. // Use m_ notation because the message crackers require them
  611. //
  612. BOOL m_fDontLog = !m_fLogAccess;
  613. BOOL m_fDosDirOutput = (m_nUnixDos == RADIO_DOS);
  614. BOOL fUNC = (m_nPathType == RADIO_NETDIRECTORY);
  615. // BOOL fUserNameWritten = FALSE;
  616. BeginWaitCursor();
  617. BEGIN_META_DIR_WRITE(CFtpSheet)
  618. if (fUNC)
  619. {
  620. // STORE_DIR_DATA_ON_SHEET_REMEMBER(m_strUserName, fUserNameWritten)
  621. // if (fUserNameWritten)
  622. // {
  623. STORE_DIR_DATA_ON_SHEET(m_strUserName);
  624. STORE_DIR_DATA_ON_SHEET(m_strPassword);
  625. // }
  626. }
  627. else
  628. {
  629. if (m_fOriginallyUNC)
  630. {
  631. FLAG_DIR_DATA_FOR_DELETION(MD_VR_USERNAME);
  632. FLAG_DIR_DATA_FOR_DELETION(MD_VR_PASSWORD);
  633. }
  634. }
  635. STORE_DIR_DATA_ON_SHEET(m_dwAccessPerms)
  636. STORE_DIR_DATA_ON_SHEET(m_fDontLog)
  637. STORE_DIR_DATA_ON_SHEET(m_strPath)
  638. END_META_DIR_WRITE(err)
  639. if (err.Succeeded())
  640. {
  641. BEGIN_META_INST_WRITE(CFtpSheet)
  642. STORE_INST_DATA_ON_SHEET(m_fDosDirOutput);
  643. END_META_INST_WRITE(err)
  644. }
  645. if (err.Succeeded())
  646. {
  647. NotifyMMC(PROP_CHANGE_DISPLAY_ONLY);
  648. }
  649. EndWaitCursor();
  650. return err;
  651. }
  652. void
  653. CFtpDirectoryPage::OnButtonEditPathType()
  654. /*++
  655. Routine Description:
  656. 'Connect As..." button handler
  657. Arguments:
  658. None
  659. Return Value:
  660. None
  661. --*/
  662. {
  663. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  664. CString csTempPassword;
  665. m_strPassword.CopyTo(csTempPassword);
  666. CUserAccountDlg dlg(
  667. QueryServerName(),
  668. m_strUserName,
  669. csTempPassword,
  670. this
  671. );
  672. if (dlg.DoModal() == IDOK)
  673. {
  674. m_strUserName = dlg.m_strUserName;
  675. m_strPassword = dlg.m_strPassword;
  676. OnItemChanged();
  677. }
  678. }