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.

935 lines
22 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. openfile.cxx
  7. Class definitions for the OPENS_DIALOG, OPENS_LISTBOX, and
  8. OPENS_LBI classes.
  9. The OPENS_DIALOG is used to show the remotely open files on a
  10. particular server. This listbox contains a [Close] button to
  11. allow the admin to close selected files.
  12. FILE HISTORY:
  13. NarenG 2-Oct-1992 Stole from server manager.
  14. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  15. */
  16. #define INCL_NET
  17. #define INCL_WINDOWS
  18. #define INCL_WINDOWS_GDI
  19. #define INCL_DOSERRORS
  20. #define INCL_NETERRORS
  21. #define INCL_NETLIB
  22. #include <lmui.hxx>
  23. #define INCL_BLT_WINDOW
  24. #define INCL_BLT_DIALOG
  25. #define INCL_BLT_CONTROL
  26. #define INCL_BLT_MISC
  27. #define INCL_BLT_CLIENT
  28. #define INCL_BLT_MSGPOPUP
  29. #include <blt.hxx>
  30. #if defined(DEBUG)
  31. static const CHAR szFileName[] = __FILE__;
  32. #define _FILENAME_DEFINED_ONCE szFileName
  33. #endif // DEBUG
  34. #include <ellipsis.hxx>
  35. #include <uiassert.hxx>
  36. #include <ctime.hxx>
  37. #include <intlprof.hxx>
  38. extern "C"
  39. {
  40. #include <afpmgr.h>
  41. #include <macfile.h>
  42. }
  43. #include <util.hxx>
  44. #include <prefix.hxx>
  45. #include <openfile.hxx>
  46. //
  47. // min/max macros
  48. //
  49. #define min(x,y) (((x) < (y)) ? (x) : (y))
  50. #define max(x,y) (((x) > (y)) ? (x) : (y))
  51. //
  52. // OPENS_DIALOG methods.
  53. //
  54. /*******************************************************************
  55. NAME: OPENS_DIALOG :: OPENS_DIALOG
  56. SYNOPSIS: OPENS_DIALOG class constructor.
  57. ENTRY: hwndOwner - The "owning" dialog.
  58. pszServer - Name of the target server.
  59. EXIT: The object is constructed.
  60. HISTORY:
  61. NarenG 2-Oct-1992 Stole from server manager.
  62. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  63. ********************************************************************/
  64. OPENS_DIALOG :: OPENS_DIALOG( HWND hwndOwner,
  65. AFP_SERVER_HANDLE hServer,
  66. const TCHAR * pszServerName )
  67. : DIALOG_WINDOW( IDD_OPENFILES, hwndOwner ),
  68. _hServer( hServer ),
  69. _sltOpenCount( this, IDOF_DT_OPENCOUNT ),
  70. _sltLockCount( this, IDOF_DT_LOCKCOUNT ),
  71. _pbClose( this, IDOF_PB_CLOSEFILE ),
  72. _pbCloseAll( this, IDOF_PB_CLOSEALLFILES ),
  73. _pbOk( this, IDOK ),
  74. _nlsServer( pszServerName ),
  75. _lbFiles( this, IDOF_LB_OPENLIST, hServer ),
  76. _pbRefresh( this, IDOF_PB_REFRESH )
  77. {
  78. //
  79. // Let's make sure everything constructed OK.
  80. //
  81. if( QueryError() != NERR_Success )
  82. return;
  83. //
  84. // make sure the strings constructed fine.
  85. //
  86. APIERR err = _nlsServer.QueryError();
  87. if ( err != NERR_Success )
  88. {
  89. ReportError(err) ;
  90. return;
  91. }
  92. //
  93. // Set the caption.
  94. //
  95. err = ::SetCaption( this, IDS_CAPTION_OPENFILES, pszServerName ) ;
  96. if( err != NERR_Success )
  97. {
  98. ReportError( err );
  99. return;
  100. }
  101. err = BASE_ELLIPSIS::Init();
  102. if( err != NO_ERROR )
  103. {
  104. ReportError( err );
  105. return;
  106. }
  107. //
  108. // Refresh the dialog.
  109. //
  110. DWORD error = Refresh();
  111. if( error != NO_ERROR )
  112. {
  113. ReportError( AFPERR_TO_STRINGID( error ) );
  114. }
  115. } // OPENS_DIALOG :: OPENS_DIALOG
  116. /*******************************************************************
  117. NAME: OPENS_DIALOG :: ~OPENS_DIALOG
  118. SYNOPSIS: OPENS_DIALOG class destructor.
  119. EXIT: The object is destroyed.
  120. HISTORY:
  121. NarenG 2-Oct-1992 Stole from server manager.
  122. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  123. ********************************************************************/
  124. OPENS_DIALOG :: ~OPENS_DIALOG()
  125. {
  126. BASE_ELLIPSIS::Term();
  127. } // OPENS_DIALOG :: ~OPENS_DIALOG
  128. /*******************************************************************
  129. NAME: OPENS_DIALOG :: OnCommand
  130. SYNOPSIS: Handle user commands.
  131. ENTRY: cid - Control ID.
  132. lParam - lParam from the message.
  133. RETURNS: BOOL - TRUE if we handled the msg.
  134. FALSE if we didn't.
  135. HISTORY:
  136. NarenG 2-Oct-1992 Stole from server manager.
  137. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  138. ********************************************************************/
  139. BOOL OPENS_DIALOG :: OnCommand( const CONTROL_EVENT & event )
  140. {
  141. //
  142. // Determine the control which is sending the command.
  143. //
  144. switch( event.QueryCid() )
  145. {
  146. case IDOF_PB_REFRESH:
  147. {
  148. Refresh();
  149. return TRUE;
  150. }
  151. case IDOF_PB_CLOSEFILE:
  152. {
  153. OPENS_LBI * polbi = _lbFiles.QueryItem();
  154. UIASSERT( polbi != NULL );
  155. //
  156. // See if the user really wants to close this file.
  157. //
  158. if ( ::MsgPopup( this,
  159. (polbi->IsOpenForWrite()) ? IDS_CLOSE_FILE_WRITE
  160. : IDS_CLOSE_FILE,
  161. MPSEV_WARNING,
  162. MP_YESNO,
  163. polbi->QueryUserName(),
  164. polbi->QueryPath(),
  165. MP_NO ) == IDYES )
  166. {
  167. //
  168. // Close the file And refresh dialog
  169. //
  170. DWORD err = ::AfpAdminFileClose( _hServer, polbi->QueryFileID() );
  171. if( err != NO_ERROR )
  172. {
  173. //
  174. // The file close failed. Tell the user the bad news.
  175. //
  176. if ( err == AFPERR_InvalidId )
  177. {
  178. ::MsgPopup( this, IDS_FILE_CLOSED );
  179. }
  180. else
  181. {
  182. ::MsgPopup( this, AFPERR_TO_STRINGID(err) );
  183. }
  184. }
  185. Refresh();
  186. }
  187. return TRUE;
  188. }
  189. case IDOF_PB_CLOSEALLFILES:
  190. {
  191. //
  192. // See if the user really wants to close *all* files.
  193. //
  194. if( WarnCloseMulti() )
  195. {
  196. //
  197. // Close ALL of the open files.
  198. //
  199. DWORD err = ::AfpAdminFileClose( _hServer, 0 );
  200. if( err != NO_ERROR )
  201. {
  202. //
  203. // The close fileste failed. Tell the user the bad news.
  204. //
  205. ::MsgPopup( this, AFPERR_TO_STRINGID(err) );
  206. }
  207. //
  208. // Refresh the dialog.
  209. //
  210. Refresh();
  211. }
  212. return TRUE;
  213. }
  214. case IDOF_LB_OPENLIST:
  215. {
  216. if ((event.QueryCode() == LBN_DBLCLK) && (_lbFiles.QuerySelCount()>0))
  217. {
  218. OPENS_LBI * plbi = _lbFiles.QueryItem();
  219. ::MsgPopup( this,
  220. IDS_FILE_PATH,
  221. MPSEV_INFO,
  222. 1,
  223. plbi->QueryPath(),
  224. MP_OK );
  225. }
  226. return TRUE;
  227. }
  228. default:
  229. {
  230. //
  231. // we are not interested, let parent handle
  232. //
  233. return( FALSE );
  234. }
  235. }
  236. } // OPENS_DIALOG :: OnCommand
  237. /*******************************************************************
  238. NAME: OPENS_DIALOG :: QueryHelpContext
  239. SYNOPSIS: This function returns the appropriate help context
  240. value (HC_*) for this particular dialog.
  241. RETURNS: ULONG - The help context for this
  242. dialog.
  243. HISTORY:
  244. NarenG 2-Oct-1992 Stole from server manager.
  245. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  246. ********************************************************************/
  247. ULONG OPENS_DIALOG :: QueryHelpContext( void )
  248. {
  249. return HC_OPENS_DIALOG;
  250. } // OPENS_DIALOG :: QueryHelpContext
  251. /*******************************************************************
  252. NAME: OPEN_DIALOG :: Refresh
  253. SYNOPSIS: Refreshes the Open Resources dialog.
  254. EXIT: The dialog is feeling relaxed and refreshed.
  255. HISTORY:
  256. NarenG 2-Oct-1992 Stole from server manager.
  257. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  258. ********************************************************************/
  259. DWORD OPENS_DIALOG :: Refresh( VOID )
  260. {
  261. //
  262. // Refresh the Open files listbox
  263. //
  264. DWORD err = _lbFiles.Refresh();
  265. if ( err != NO_ERROR )
  266. {
  267. //
  268. // Since we couldn't retreive the file information,
  269. // we'll just display ??.
  270. //
  271. const TCHAR * pszNotAvailable = SZ("??");
  272. _sltOpenCount.Enable( FALSE );
  273. _sltLockCount.Enable( FALSE );
  274. _sltOpenCount.SetText( pszNotAvailable );
  275. _sltLockCount.SetText( pszNotAvailable );
  276. _lbFiles.DeleteAllItems();
  277. _pbClose.Enable( FALSE );
  278. _pbCloseAll.Enable( FALSE );
  279. }
  280. else
  281. {
  282. //
  283. // Set open files and lock counts
  284. //
  285. _sltOpenCount.Enable( TRUE );
  286. _sltLockCount.Enable( TRUE );
  287. _sltOpenCount.SetValue( _lbFiles.QueryCount() );
  288. _sltLockCount.SetValue( _lbFiles.QueryLockCount() );
  289. //
  290. // Enable buttons as appropriate
  291. //
  292. if ( _lbFiles.QuerySelCount() > 0 )
  293. {
  294. _pbClose.Enable( TRUE );
  295. }
  296. else
  297. {
  298. if ( _pbClose.HasFocus() )
  299. {
  300. _pbOk.ClaimFocus();
  301. }
  302. _pbClose.Enable( FALSE );
  303. }
  304. if ( _lbFiles.QueryCount() > 0 )
  305. {
  306. _pbCloseAll.Enable( TRUE );
  307. }
  308. else
  309. {
  310. if ( _pbCloseAll.HasFocus() )
  311. {
  312. _pbOk.ClaimFocus();
  313. }
  314. _pbCloseAll.Enable( FALSE );
  315. }
  316. }
  317. return err;
  318. }
  319. /*******************************************************************
  320. NAME: OPEN_DIALOG :: WarnCloseMulti
  321. SYNOPSIS: Warn the user before closing all open resources.
  322. RETURNS: BOOL - TRUE if the wants to close the
  323. resources,
  324. FALSE otherwise.
  325. HISTORY:
  326. NarenG 2-Oct-1992 Stole from server manager.
  327. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  328. ********************************************************************/
  329. BOOL OPENS_DIALOG :: WarnCloseMulti( VOID )
  330. {
  331. //
  332. // Get the number of items in the listbox.
  333. //
  334. INT cItems = _lbFiles.QueryCount();
  335. UIASSERT( cItems > 0 );
  336. MSGID idMsg = IDS_CLOSE_FILE_ALL;
  337. //
  338. // Scan for any file that is opened for write
  339. //
  340. for( INT i = 0 ; i < cItems ; i++ )
  341. {
  342. OPENS_LBI * plbi = _lbFiles.QueryItem( i );
  343. UIASSERT( plbi != NULL );
  344. if( plbi->IsOpenForWrite() )
  345. {
  346. idMsg = IDS_CLOSE_FILE_ALL_WRITE;
  347. break;
  348. }
  349. }
  350. return( ::MsgPopup( this,
  351. idMsg,
  352. MPSEV_WARNING,
  353. MP_YESNO,
  354. _nlsServer.QueryPch(),
  355. MP_NO ) == IDYES );
  356. } // OPEN_DIALOG :: WarnCloseMulti
  357. //
  358. // OPENS_LISTBOX methods.
  359. //
  360. /*******************************************************************
  361. NAME: OPENS_LISTBOX :: OPENS_LISTBOX
  362. SYNOPSIS: OPENS_LISTBOX class constructor.
  363. ENTRY: powOwner - The "owning" window.
  364. cid - The listbox CID.
  365. nlsServer - Name of target server
  366. nlsBasePath - Base Path of File Enum
  367. EXIT: The object is constructed.
  368. RETURNS: No return value.
  369. NOTES:
  370. HISTORY:
  371. NarenG 2-Oct-1992 Stole from server manager.
  372. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  373. ********************************************************************/
  374. OPENS_LISTBOX :: OPENS_LISTBOX( OWNER_WINDOW * powOwner,
  375. CID cid,
  376. AFP_SERVER_HANDLE hServer )
  377. : BLT_LISTBOX( powOwner, cid ),
  378. _hServer( hServer ),
  379. _dmdteDataFork( IDBM_LB_DATA_FORK ),
  380. _dmdteResourceFork( IDBM_LB_RESOURCE_FORK ),
  381. _dwNumLocks( 0 )
  382. {
  383. //
  384. // Ensure we constructed properly.
  385. //
  386. if( QueryError() != NERR_Success )
  387. return;
  388. //
  389. // Build the column width table to be used by
  390. // OPENS_LBI :: Paint().
  391. //
  392. DISPLAY_TABLE::CalcColumnWidths(_adx,
  393. COLS_OF_LB_FILES,
  394. powOwner,
  395. cid,
  396. TRUE) ;
  397. } // OPENS_LISTBOX :: OPENS_LISTBOX
  398. /*******************************************************************
  399. NAME: OPENS_LISTBOX :: ~OPENS_LISTBOX
  400. SYNOPSIS: OPENS_LISTBOX class destructor.
  401. EXIT: The object is destroyed.
  402. HISTORY:
  403. NarenG 2-Oct-1992 Stole from server manager.
  404. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  405. ********************************************************************/
  406. OPENS_LISTBOX :: ~OPENS_LISTBOX()
  407. {
  408. //
  409. // This space intentionally left blank.
  410. //
  411. } // OPENS_LISTBOX :: ~OPENS_LISTBOX
  412. /*******************************************************************
  413. NAME: OPENS_LISTBOX :: Fill
  414. SYNOPSIS: Fill the list of open files.
  415. EXIT: The listbox is filled.
  416. RETURNS: DWORD - Any errors encountered.
  417. HISTORY:
  418. NarenG 2-Oct-1992 Stole from server manager.
  419. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  420. ********************************************************************/
  421. DWORD OPENS_LISTBOX :: Fill( VOID )
  422. {
  423. AUTO_CURSOR Cursor;
  424. //
  425. // Enumerate all the open files.
  426. //
  427. PAFP_FILE_INFO pAfpFiles;
  428. DWORD cEntriesRead;
  429. DWORD cTotalAvail;
  430. DWORD err = ::AfpAdminFileEnum( _hServer,
  431. (LPBYTE *)&pAfpFiles,
  432. (DWORD)-1, // Get all files
  433. &cEntriesRead,
  434. &cTotalAvail,
  435. NULL );
  436. if( err != NO_ERROR )
  437. {
  438. return err;
  439. }
  440. //
  441. // Now that we know the file info is available,
  442. // let's nuke everything in the listbox.
  443. //
  444. SetRedraw( FALSE );
  445. DeleteAllItems();
  446. //
  447. // For iterating the available files.
  448. //
  449. PAFP_FILE_INFO pFileIter = pAfpFiles;
  450. //
  451. // Iterate the files adding them to the listbox.
  452. //
  453. _dwNumLocks = 0;
  454. while( ( err == NO_ERROR ) && ( cEntriesRead-- ) )
  455. {
  456. OPENS_LBI * polbi = new OPENS_LBI( pFileIter->afpfile_id,
  457. pFileIter->afpfile_username,
  458. pFileIter->afpfile_open_mode,
  459. pFileIter->afpfile_fork_type,
  460. pFileIter->afpfile_num_locks,
  461. pFileIter->afpfile_path );
  462. if( AddItem( polbi ) < 0 )
  463. {
  464. err = ERROR_NOT_ENOUGH_MEMORY;
  465. }
  466. _dwNumLocks += pFileIter->afpfile_num_locks;
  467. pFileIter++;
  468. }
  469. ::AfpAdminBufferFree( pAfpFiles );
  470. SetRedraw( TRUE );
  471. Invalidate( TRUE );
  472. return err;
  473. } //OPENS_LISTBOX :: Fill( VOID )
  474. /*******************************************************************
  475. NAME: OPENS_LISTBOX :: Refresh
  476. SYNOPSIS: Refreshes the list of open resources.
  477. EXIT: The listbox is refreshed & redrawn.
  478. RETURNS: DWORD - Any errors encountered.
  479. HISTORY:
  480. NarenG 2-Oct-1992 Stole from server manager.
  481. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  482. ********************************************************************/
  483. DWORD OPENS_LISTBOX :: Refresh( VOID )
  484. {
  485. INT iCurrent = QueryCurrentItem();
  486. INT iTop = QueryTopIndex();
  487. DWORD err = Fill();
  488. if( err != NO_ERROR )
  489. {
  490. return err;
  491. }
  492. INT cItems = QueryCount();
  493. if( cItems > 0 )
  494. {
  495. iCurrent = min( max( iCurrent, 0 ), cItems - 1 );
  496. iTop = min( max( iTop, 0 ), cItems - 1 );
  497. SelectItem( iCurrent );
  498. SetTopIndex( iTop );
  499. }
  500. return NO_ERROR;
  501. }
  502. //
  503. // OPENS_LBI methods.
  504. //
  505. /*******************************************************************
  506. NAME: OPENS_LBI :: OPENS_LBI
  507. SYNOPSIS: OPENS_LBI class constructor.
  508. ENTRY: pszUserName - The user for this entry.
  509. usPermissions - Open permissions.
  510. cLocks - Number of locks.
  511. pszPath - The open pathname.
  512. EXIT: The object is constructed.
  513. HISTORY:
  514. NarenG 2-Oct-1992 Stole from server manager.
  515. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  516. ********************************************************************/
  517. OPENS_LBI :: OPENS_LBI( DWORD dwFileID,
  518. const TCHAR * pszUserName,
  519. DWORD dwOpenMode,
  520. DWORD dwForkType,
  521. DWORD dwNumLocks,
  522. const TCHAR * pszPath )
  523. : _dwFileID( dwFileID ),
  524. _nlsUserName(),
  525. _dwOpenMode( dwOpenMode ),
  526. _dwForkType( dwForkType ),
  527. _nlsOpenMode(),
  528. _nlsNumLocks( dwNumLocks ),
  529. _nlsPath( pszPath )
  530. {
  531. if( QueryError() != NERR_Success )
  532. {
  533. return;
  534. }
  535. APIERR err;
  536. if( ( ( err = _nlsUserName.QueryError() ) != NERR_Success ) ||
  537. ( ( err = _nlsOpenMode.QueryError() ) != NERR_Success ) ||
  538. ( ( err = _nlsNumLocks.QueryError() ) != NERR_Success ) ||
  539. ( ( err = _nlsPath.QueryError() ) != NERR_Success ) )
  540. {
  541. ReportError( err );
  542. return;
  543. }
  544. //
  545. // Initialize the more complex strings.
  546. //
  547. UINT idString =
  548. ((dwOpenMode & AFP_OPEN_MODE_READ)&&(dwOpenMode&AFP_OPEN_MODE_WRITE))
  549. ? IDS_OPEN_MODE_READ_WRITE
  550. : (( dwOpenMode & AFP_OPEN_MODE_READ )
  551. ? IDS_OPEN_MODE_READ
  552. : (( dwOpenMode & AFP_OPEN_MODE_WRITE)
  553. ? IDS_OPEN_MODE_WRITE
  554. : IDS_OPEN_MODE_NONE));
  555. err = _nlsOpenMode.Load( idString );
  556. if( err != NERR_Success )
  557. {
  558. ReportError( err );
  559. return;
  560. }
  561. //
  562. // If user name is NULL then a guest has loged on
  563. //
  564. if ( pszUserName == NULL )
  565. {
  566. err = _nlsUserName.Load( IDS_GUEST );
  567. }
  568. else
  569. {
  570. err = _nlsUserName.CopyFrom( pszUserName );
  571. }
  572. if( err != NERR_Success )
  573. {
  574. ReportError( err );
  575. return;
  576. }
  577. } //OPENS_LBI :: OPENS_LBI
  578. /********************************************************************
  579. NAME: OPENS_LBI :: ~OPENS_LBI
  580. SYNOPSIS: OPENS_LBI class destructor.
  581. EXIT: The object is destroyed.
  582. HISTORY:
  583. NarenG 2-Oct-1992 Stole from server manager.
  584. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  585. ********************************************************************/
  586. OPENS_LBI :: ~OPENS_LBI()
  587. {
  588. //
  589. // This space intentionally left blank
  590. //
  591. }
  592. /*******************************************************************
  593. NAME: OPENS_LBI :: Paint
  594. SYNOPSIS: Draw an entry in OPENS_LISTBOX.
  595. ENTRY: plb - Pointer to a BLT_LISTBOX.
  596. hdc - The DC to draw upon.
  597. prect - Clipping rectangle.
  598. pGUILTT - GUILTT info.
  599. EXIT: The item is drawn.
  600. HISTORY:
  601. NarenG 2-Oct-1992 Stole from server manager.
  602. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  603. ********************************************************************/
  604. VOID OPENS_LBI :: Paint( LISTBOX * plb,
  605. HDC hdc,
  606. const RECT * prect,
  607. GUILTT_INFO * pGUILTT ) const
  608. {
  609. STR_DTE_ELLIPSIS dteUserName( _nlsUserName.QueryPch(),
  610. plb, ELLIPSIS_RIGHT);
  611. STR_DTE dteOpenMode( _nlsOpenMode.QueryPch() );
  612. STR_DTE dteNumForks( _nlsNumLocks.QueryPch() );
  613. STR_DTE_ELLIPSIS dtePath( _nlsPath.QueryPch(), plb, ELLIPSIS_PATH );
  614. DISPLAY_TABLE dtab( COLS_OF_LB_FILES,
  615. ((OPENS_LISTBOX *)plb)->QueryColumnWidths() );
  616. dtab[0] = ( _dwForkType == AFP_FORK_DATA )
  617. ? ((OPENS_LISTBOX *) plb)->QueryDataForkBitmap()
  618. : ((OPENS_LISTBOX *) plb)->QueryResourceForkBitmap();
  619. dtab[1] = &dteUserName;
  620. dtab[2] = &dteOpenMode;
  621. dtab[3] = &dteNumForks;
  622. dtab[4] = &dtePath;
  623. dtab.Paint( plb, hdc, prect, pGUILTT );
  624. } // OPENS_LBI :: Paint
  625. /*******************************************************************
  626. NAME: OPENS_LBI :: Compare
  627. SYNOPSIS: Compare two OPENS_LBI items.
  628. ENTRY: plbi - The "other" item.
  629. RETURNS: INT - 0 if the items match.
  630. -1 if we're < the other item.
  631. +1 if we're > the other item.
  632. HISTORY:
  633. NarenG 2-Oct-1992 Stole from server manager.
  634. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  635. ********************************************************************/
  636. INT OPENS_LBI :: Compare( const LBI * plbi ) const
  637. {
  638. NLS_STR * pnls = &(((OPENS_LBI *)plbi)->_nlsUserName);
  639. INT nResult = _nlsUserName._stricmp( *pnls );
  640. if( nResult == 0 )
  641. {
  642. pnls = &(((OPENS_LBI *)plbi)->_nlsPath);
  643. nResult = _nlsPath._stricmp( *pnls );
  644. }
  645. return nResult;
  646. } // OPENS_LBI :: Compare
  647. /*******************************************************************
  648. NAME: OPENS_LBI :: QueryLeadingChar
  649. SYNOPSIS: Return the leading character of this item.
  650. RETURNS: WCHAR - The leading character.
  651. HISTORY:
  652. NarenG 2-Oct-1992 Stole from server manager.
  653. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  654. ********************************************************************/
  655. WCHAR OPENS_LBI :: QueryLeadingChar( VOID ) const
  656. {
  657. ISTR istr( _nlsUserName );
  658. return _nlsUserName.QueryChar( istr );
  659. }
  660. /*******************************************************************
  661. NAME: OPENS_LBI :: IsOpenForWrite
  662. SYNOPSIS: Checks to see if the file is opened for write
  663. RETURNS: TRUE if this file is opened for write, FALSE otherwise.
  664. HISTORY:
  665. NarenG 2-Oct-1992 Stole from server manager.
  666. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  667. ********************************************************************/
  668. BOOL OPENS_LBI :: IsOpenForWrite( VOID ) const
  669. {
  670. return ( _dwOpenMode & AFP_OPEN_MODE_WRITE );
  671. }