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.

1425 lines
45 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1992 **/
  4. /**********************************************************************/
  5. /*
  6. UsrBrows.hxx
  7. This file contains the class definition for the User Browser dialog
  8. FILE HISTORY:
  9. Johnl 14-Feb-1992 Created
  10. beng 04-Aug-1992 Moved ordinals into blessed ranges;
  11. relocated some into applibrc.h
  12. jonn 14-Oct-1993 Use NetGetAnyDC
  13. jonn 14-Oct-1993 Moved bitmaps to SUBJECT_BITMAP_BLOCK
  14. jonn 14-Oct-1993 Minor focus fix (OnDlgDeactivation)
  15. */
  16. #ifndef _USRBROWS_HXX_
  17. #define _USRBROWS_HXX_
  18. #include "applibrc.h"
  19. //
  20. // Use USRBROWS_DIALOG_NAME as the name of the dialog passed to the constructor
  21. // of the NT_USER_BROWSER_DIALOG class.
  22. //
  23. #define USRBROWS_DIALOG_NAME MAKEINTRESOURCE(IDD_USRBROWS_DLG)
  24. #define USRBROWS_SINGLE_DIALOG_NAME MAKEINTRESOURCE(IDD_SINGLE_USRBROWS_DLG)
  25. //
  26. // Controls in the "base" dialog (single select)
  27. //
  28. #define USRBROWS_CID_BASE (2060)
  29. #define LB_ACCOUNTS (USRBROWS_CID_BASE+1)
  30. #define COL_SUBJECT_NAME (USRBROWS_CID_BASE+2)
  31. #define COL_COMMENT (USRBROWS_CID_BASE+3)
  32. #define CB_TRUSTED_DOMAINS (USRBROWS_CID_BASE+5)
  33. #define USR_COL_DOMAIN_NAME (USRBROWS_CID_BASE+6)
  34. #define BUTTON_SHOW_USERS (USRBROWS_CID_BASE+7)
  35. #define USR_BUTTON_SEARCH (USRBROWS_CID_BASE+8)
  36. #define USR_BUTTON_MEMBERS (USRBROWS_CID_BASE+9)
  37. #define USR_BUTTON_ADD (USRBROWS_CID_BASE+10)
  38. #define USR_SLT_BROWSER_ERROR (USRBROWS_CID_BASE+11)
  39. #define USR_MLE_ADD (USRBROWS_CID_BASE+12)
  40. //
  41. // These are for the security editor version only
  42. //
  43. #define CB_PERMNAMES (USRBROWS_CID_BASE+15)
  44. #define USRBROWS_SED_DIALOG_NAME MAKEINTRESOURCE(IDD_SED_USRBROWS_DLG)
  45. //
  46. // Controls in the group membership dialogs
  47. //
  48. #define SLT_SHOW_BROWSEGROUP (USRBROWS_CID_BASE+16)
  49. //
  50. // Controls in the Find Account dialog
  51. //
  52. #define USR_SLE_ACCTNAME (USRBROWS_CID_BASE+17)
  53. #define USR_RB_SEARCHALL (USRBROWS_CID_BASE+18)
  54. #define USR_RB_SEARCHONLY (USRBROWS_CID_BASE+19)
  55. #define USR_LB_SEARCH (USRBROWS_CID_BASE+20)
  56. #define USR_PB_SEARCH (USRBROWS_CID_BASE+21)
  57. #ifndef RC_INVOKED
  58. /*************************************************************************/
  59. #include "uintsam.hxx"
  60. #include "uintlsa.hxx"
  61. #include "slist.hxx"
  62. #include "fontedit.hxx" // for SLT_FONT
  63. #include "w32thred.hxx"
  64. #include "w32event.hxx"
  65. #include "array.hxx"
  66. #include "usrcache.hxx"
  67. extern "C"
  68. {
  69. #include <getuser.h>
  70. //
  71. //BUGBUG - Move to sdk\inc\getuser.h after beta II
  72. //
  73. #ifndef USRBROWS_INCL_SYSTEM
  74. #define USRBROWS_INCL_SYSTEM (0x00010000)
  75. #undef USRBROWS_INCL_ALL
  76. #define USRBROWS_INCL_ALL (USRBROWS_INCL_REMOTE_USERS|\
  77. USRBROWS_INCL_INTERACTIVE|\
  78. USRBROWS_INCL_EVERYONE|\
  79. USRBROWS_INCL_CREATOR|\
  80. USRBROWS_INCL_SYSTEM|\
  81. USRBROWS_INCL_RESTRICTED)
  82. #endif
  83. }
  84. // Forward references
  85. DLL_CLASS USER_BROWSER_LBI ;
  86. DLL_CLASS BROWSER_DOMAIN ;
  87. DLL_CLASS BROWSER_DOMAIN_CB ;
  88. DLL_CLASS BROWSER_SUBJECT ;
  89. DLL_CLASS BROWSER_SUBJECT_ITER ;
  90. DLL_CLASS NT_USER_BROWSER_DIALOG ;
  91. DLL_CLASS USER_BROWSER_LB ;
  92. DLL_CLASS USER_BROWSER_LBI_CACHE ;
  93. class SUBJECT_BITMAP_BLOCK;
  94. typedef USER_BROWSER_LBI * PUSER_BROWSER_LBI ;
  95. /*************************************************************************/
  96. DECL_SLIST_OF(USER_BROWSER_LBI,DLL_BASED) ;
  97. /*************************************************************************/
  98. //
  99. // This is the character that marks what domain/machine aliases are
  100. // enumerated for.
  101. //
  102. #define ALIAS_MARKER_CHAR (TCH('*'))
  103. //
  104. // This message is sent to the dialog after the thread is done filling the
  105. // listbox (or an error occurred). The WPARAM contains a BOOL as to whether
  106. // the listbox was filled successfully and LPARAM is a pointer to the new
  107. // LBI cache to use.
  108. //
  109. // This is needed because the 2nd thread can't get all of the window status
  110. // data it needs (like current window focus) to call EnableBrowsing().
  111. //
  112. // Warning: DM_GETDEFID/DM_SETDEFID is defined at (WM_USER+0/1).
  113. //
  114. #define WM_LB_FILLED (WM_USER+500)
  115. //
  116. // Helper routine in browmemb.cxx
  117. //
  118. APIERR CreateLBIsFromSids( const PSID * apsidMembers,
  119. ULONG cMembers,
  120. const PSID psidSamDomainTarget,
  121. LSA_POLICY * plsapolTarget,
  122. const TCHAR * pszServerTarget,
  123. USER_BROWSER_LB * publb, // Add here if !NULL
  124. SLIST_OF(USER_BROWSER_LBI) *psllbi ) ;
  125. /*************************************************************************
  126. NAME: USER_BROWSER_LBI
  127. SYNOPSIS: This class is used to list the Users, Groups and Aliases
  128. contained in the "Name" listbox.
  129. INTERFACE: Standard LBI interface
  130. PARENT: LBI
  131. CAVEATS:
  132. NOTES:
  133. HISTORY:
  134. Johnl 28-Feb-1992 Created
  135. beng 21-Apr-1992 BLT_LISTBOX -> LISTBOX
  136. Johnl 10-Jun-1992 Added Account Name & Full name as
  137. separate fields
  138. JonN 11-Aug-1992 HAW-for-Hawaii
  139. **************************************************************************/
  140. DLL_CLASS USER_BROWSER_LBI : public LBI
  141. {
  142. public:
  143. USER_BROWSER_LBI( const TCHAR * pszAccountName,
  144. const TCHAR * pszFullName,
  145. const TCHAR * pszSubjectName,
  146. const TCHAR * pszComment,
  147. const TCHAR * pszDomainName,
  148. const PSID psidAccount,
  149. enum UI_SystemSid UISysSid,
  150. SID_NAME_USE SidType,
  151. ULONG nFlags = 0 ) ;
  152. ~USER_BROWSER_LBI() ;
  153. /* This method is primarily used to determine which display map should
  154. * be used for this LBI.
  155. */
  156. SID_NAME_USE QueryType( void ) const
  157. { return _SidType ; }
  158. const TCHAR * QueryAccountName( void ) const
  159. { return _nlsAccountName.QueryPch() ; }
  160. const TCHAR * QueryFullName( void ) const
  161. { return _nlsFullName.QueryPch() ; }
  162. const TCHAR * QueryDisplayName( void ) const
  163. { return _nlsDisplayName.QueryPch() ; }
  164. const TCHAR * QueryComment( void ) const
  165. { return _nlsComment.QueryPch() ; }
  166. const TCHAR * QueryDomainName( void ) const
  167. { return _nlsDomain ; }
  168. const PSID QueryPSID( void ) const
  169. { return _ossid.QueryPSID() ; }
  170. const OS_SID * QueryOSSID( void ) const
  171. { return &_ossid ; }
  172. /* Returns a name suitable for passing to LSA or SAM
  173. */
  174. enum UI_SystemSid QueryUISysSid( void ) const
  175. { return _UISysSid ; }
  176. ULONG QueryUserAccountFlags( void ) const
  177. { return _nFlags ; }
  178. void AliasUnicodeStrToDisplayName( UNICODE_STRING * pustr )
  179. {
  180. pustr->Length = (USHORT)(_nlsDisplayName.strlen() * sizeof( TCHAR)) ;
  181. pustr->MaximumLength = pustr->Length + sizeof( TCHAR ) ;
  182. pustr->Buffer = (PWSTR) _nlsDisplayName.QueryPch() ;
  183. }
  184. //
  185. // Force the display name to be fully qualified
  186. //
  187. APIERR QualifyDisplayName( void ) ;
  188. virtual VOID Paint( LISTBOX * plb, HDC hdc, const RECT * prect,
  189. GUILTT_INFO * pGUILTT ) const;
  190. virtual INT Compare( const LBI * plbi ) const;
  191. INT CompareAux( const LBI * plbi ) const ; // needed for qsort
  192. virtual WCHAR QueryLeadingChar() const;
  193. virtual INT Compare_HAWforHawaii( const NLS_STR & nls ) const;
  194. private:
  195. NLS_STR _nlsDisplayName ; // Contains "JohnL (Ludeman, John)"
  196. NLS_STR _nlsComment ;
  197. NLS_STR _nlsAccountName ; // Contains "JohnL"
  198. NLS_STR _nlsFullName ; // Contains "Ludeman, John"
  199. NLS_STR _nlsDomain ; // Where this account lives ("NtLan")
  200. OS_SID _ossid ; // The SID of this account
  201. /* This enum (contained in ntseapi.h) defines what type of name this
  202. * lbi contains.
  203. */
  204. SID_NAME_USE _SidType ;
  205. /* If this LBI contains a well known SID, then this member will indicate
  206. * which one it is (thus we shouldn't use the DisplayName for the
  207. * account Name). Otherwise this member will contain UI_SID_Invalid
  208. * if the account name is also the account name suitable for the LSA.
  209. */
  210. enum UI_SystemSid _UISysSid ;
  211. /* This contains the user account flags
  212. */
  213. ULONG _nFlags ;
  214. } ;
  215. /*************************************************************************
  216. NAME: USER_BROWSER_LBI_CACHE
  217. SYNOPSIS:
  218. INTERFACE:
  219. PARENT: USER_LBI_CACHE
  220. USES:
  221. CAVEATS:
  222. NOTES: The non-users in the cache *must* come before the users in the
  223. cache.
  224. HISTORY:
  225. Johnl 22-Dec-1992 Created
  226. **************************************************************************/
  227. DLL_CLASS USER_BROWSER_LBI_CACHE : public USER_LBI_CACHE
  228. {
  229. public:
  230. USER_BROWSER_LBI_CACHE() ;
  231. ~USER_BROWSER_LBI_CACHE() ;
  232. //
  233. // This method adds all of the users/groups/aliases/well known SIDs.
  234. // What to add is specified by the ulFlags parameter which
  235. // contains the combination of USRBROWS_INCL* and USRBROWS_SHOW* flags.
  236. //
  237. // pAdminAuthority - Admin authority for the interested domain
  238. // pszQualifyingDomain - Appropriate domain name for qualifying accounts
  239. // ulFlags - INCL* and SHOW* flags
  240. // fIsWinNTDomain - TRUE if windows NT machine
  241. // fIsTargetDomain - TRUE if target domain
  242. // pfQuitEnum - Set by other thread to TRUE if we should get out
  243. //
  244. // This method all and all methods it calls must be MT safe!
  245. //
  246. APIERR Fill( ADMIN_AUTHORITY * pAdminAuthority,
  247. const TCHAR * pszQualifyingDomain,
  248. ULONG ulFlags,
  249. BOOL fIsWinNTDomain,
  250. BOOL fIsTargetDomain,
  251. BOOL * pfQuitEnum ) ;
  252. APIERR AddUsers( ADMIN_AUTHORITY * pAdminAuthority,
  253. const TCHAR * pszDomain,
  254. BOOL fIsTargetDomain,
  255. BOOL * pfQuitEnum ) ;
  256. ULC_ENTRY_BASE * QueryEntryPtr( INT i )
  257. { return (ULC_ENTRY_BASE*) QueryULCEntryPtr( i ) ; }
  258. //
  259. // If set to TRUE, then the cache will include users in its count,
  260. // else users will not be include in the count. AddUsers must still
  261. // be called if users are to be shown
  262. //
  263. void SetIncludeUsers( BOOL fIncludeUsers )
  264. { _fIncludeUsersInCount = fIncludeUsers ; }
  265. ULONG QueryCount( VOID ) const
  266. { return _cNonUsers + (_fIncludeUsersInCount ? _cUsers : 0) ; }
  267. LBI * RemoveItem( INT i )
  268. { LBI * plbi = USER_LBI_CACHE::RemoveItem( i ) ;
  269. if ( plbi != NULL )
  270. _cNonUsers-- ;
  271. return plbi ;
  272. }
  273. INT AddItem( LBI * plbi )
  274. { INT tmp = USER_LBI_CACHE::AddItem( plbi ) ;
  275. if ( tmp >= 0 )
  276. _cNonUsers++ ;
  277. return tmp ;
  278. }
  279. protected:
  280. virtual LBI * CreateLBI( const DOMAIN_DISPLAY_USER * pddu ) ;
  281. virtual INT Compare( const LBI * plbi,
  282. const DOMAIN_DISPLAY_USER * pddu ) const ;
  283. virtual INT Compare( const LBI * plbi0,
  284. const LBI * plbi1 ) const ;
  285. virtual PQSORT_COMPARE QueryCompareMethod( VOID ) const;
  286. static int __cdecl CompareCacheLBIs(
  287. const ULC_ENTRY_BASE * pulc1,
  288. const ULC_ENTRY_BASE * pulc2 ) ;
  289. APIERR AddAliases( ADMIN_AUTHORITY * pAdminAuthority,
  290. const TCHAR * pszQualifyingDomain,
  291. BOOL * pfQuitEnum ) ;
  292. APIERR AddGroups( ADMIN_AUTHORITY * pAdminAuthority,
  293. const TCHAR * pszQualifyingDomain,
  294. BOOL * pfQuitEnum ) ;
  295. APIERR AddWellKnownSids( ADMIN_AUTHORITY * pAdminAuthority,
  296. ULONG ulFlags,
  297. BOOL * pfQuitEnum ) ;
  298. /* Worker method for AddAliases( BROWSER_DOMAIN * )
  299. */
  300. APIERR AddAliases( SAM_DOMAIN * pSamDomain,
  301. const TCHAR * pszQualifyingDomain,
  302. BOOL * pfQuitEnum ) ;
  303. APIERR BuildAndAddLBI( const TCHAR * pszAccountName,
  304. const TCHAR * pszFullName,
  305. const TCHAR * pszDisplayName,
  306. const TCHAR * pszComment,
  307. const TCHAR * pszDomainName,
  308. const PSID psidAccount,
  309. enum UI_SystemSid UISysSid,
  310. SID_NAME_USE SidType,
  311. ULONG nFlags ) ;
  312. private:
  313. //
  314. // These are tucked away when AddUsers is called. They are needed so we
  315. // can create the user LBIs in the CreateLBI virtual.
  316. //
  317. NLS_STR _nlsDomainName ;
  318. OS_SID _ossidDomain ;
  319. //
  320. // We've successfully retrieved the users and put them in the cache
  321. //
  322. BOOL _fCacheContainsUsers ;
  323. //
  324. // There are times when we don't want to include users in the count
  325. // of cache entries
  326. //
  327. BOOL _fIncludeUsersInCount ;
  328. LONG _cUsers ;
  329. LONG _cNonUsers ;
  330. } ;
  331. /*************************************************************************
  332. NAME: DOMAIN_FILL_THREAD
  333. SYNOPSIS: This class runs in a separate thread, enumerating the
  334. appropriate groups, users and aliases
  335. INTERFACE:
  336. PARENT: WIN32_THREAD
  337. USES:
  338. NOTES:
  339. HISTORY:
  340. Johnl 07-Dec-1992 Created
  341. **************************************************************************/
  342. DLL_CLASS DOMAIN_FILL_THREAD : public WIN32_THREAD
  343. {
  344. public:
  345. DOMAIN_FILL_THREAD( NT_USER_BROWSER_DIALOG * pdlg,
  346. BROWSER_DOMAIN * pbrowdomain,
  347. const ADMIN_AUTHORITY * pAdminAuthPrimary = NULL ) ;
  348. virtual ~DOMAIN_FILL_THREAD() ;
  349. //
  350. // Tells the thread to get the account data and fill the listbox
  351. // until an UnRequestData is received or an ExitThread
  352. //
  353. //
  354. APIERR RequestAccountData( void )
  355. { _fRequestDataPending = TRUE ;
  356. return _eventRequestForData.Set() ; }
  357. //
  358. // Somebody wants to see the users (and they were not part of the
  359. // original request) so fill in the user lbi
  360. // cache if it's not already done, and return.
  361. //
  362. APIERR RequestAndWaitForUsers( void ) ;
  363. //
  364. // We've decided to browse another domain instead. In case the thread
  365. // hasn't gotten our RequestAccountData (still getting data for example)
  366. // this will prevent the thread from updating the listbox on the wrong
  367. // domain.
  368. //
  369. APIERR UnRequestAccountData( void )
  370. { _fRequestDataPending = FALSE ;
  371. return _eventRequestForData.Reset() ; }
  372. //
  373. // This signals the thread to *asynchronously* cleanup and die.
  374. //
  375. // THIS OBJECT WILL BE DELETED SOMETIME AFTER THIS CALL!
  376. //
  377. APIERR ExitThread( void )
  378. { (void) UnRequestAccountData() ;
  379. _fThreadIsTerminating = TRUE ;
  380. return _eventExitThread.Set() ; }
  381. ADMIN_AUTHORITY * QueryAdminAuthority( void ) const
  382. { return _pAdminAuthority ; }
  383. APIERR WaitForAdminAuthority( DWORD msTimeout = INFINITE,
  384. BOOL * pfTimedOut = NULL ) const;
  385. APIERR QueryErrorLoadingAuthority( void ) const
  386. { return _errLoadingAuthority; }
  387. protected:
  388. //
  389. // This method gets the data and waits on the handles
  390. //
  391. virtual APIERR Main( VOID ) ;
  392. //
  393. // THIS DELETES *this!! Don't reference any members after this
  394. // has been called!
  395. //
  396. virtual APIERR PostMain( VOID ) ;
  397. private:
  398. //
  399. // These members will be NULL until this domain is browsed
  400. //
  401. ADMIN_AUTHORITY * _pAdminAuthority ;
  402. USER_BROWSER_LBI_CACHE * _plbicache ;
  403. //
  404. // _fDeleteAdminAuthority is FALSE if pAdminAuthority was passed into
  405. // the constructor
  406. //
  407. BOOL _fDeleteAdminAuthority ;
  408. WIN32_EVENT _eventExitThread ;
  409. WIN32_EVENT _eventRequestForData ;
  410. WIN32_EVENT _eventLoadedAuthority ;
  411. //
  412. // Set when _eventExitThread has been signalled.
  413. //
  414. BOOL _fThreadIsTerminating ;
  415. //
  416. // Error which caused failure to load ADMIN_AUTHORITY (if any)
  417. //
  418. APIERR _errLoadingAuthority;
  419. //
  420. // Set when the main thread calls RequestAccountData, cleared when the
  421. // client calls UnRequestAccountData. This flag is checked immediately
  422. // prior to sending the WM_ACCOUNT_DATA message.
  423. //
  424. BOOL _fRequestDataPending ;
  425. //
  426. // Information needed from the user browser dialog window
  427. //
  428. HWND _hwndDlg;
  429. ULONG _ulDlgFlags;
  430. NLS_STR _nlsDCofPrimaryDomain;
  431. //
  432. // Information copied from the browser domain
  433. //
  434. NLS_STR _nlsDomainName;
  435. NLS_STR _nlsLsaDomainName;
  436. BOOL _fIsWinNT;
  437. BOOL _fIsTargetDomain;
  438. } ;
  439. /*************************************************************************
  440. NAME: BROWSER_DOMAIN
  441. SYNOPSIS: This class represents one of the domains listed in the
  442. drop-down-listbox.
  443. INTERFACE: QueryDomainName - Retrieves displayable name of this domain
  444. QueryDomainSid - Retrieves the SID that represents this domain
  445. GetDomainInfo - Creates a sam server and domain for
  446. this trusted domain that is suitable for enumerating
  447. stuff on. This method only needs to be called to initalize
  448. the sam domain and sam server methods. The Domain
  449. SID and Domain Name methods are initialized at
  450. construction time.
  451. PARENT: BASE
  452. USES: NLS_STR, OS_SID
  453. CAVEATS: The domain threads will delete themselves when they are done.
  454. NOTES: The "Target" domain is the domain (or machine) that the
  455. current operation is focused on. The Target domain lists
  456. Remote users and aliases, non-target domains do not.
  457. Before we finish destructing this object, we wait for this
  458. domain's thread to tell us it's OK to delete it.
  459. HISTORY:
  460. JohnL 29-Feb-1992 Created
  461. **************************************************************************/
  462. DLL_CLASS BROWSER_DOMAIN : public BASE
  463. {
  464. public:
  465. BROWSER_DOMAIN( const TCHAR * pszDomainName,
  466. PSID psidDomain,
  467. BOOL fIsTargetDomain = FALSE,
  468. BOOL fIsWinNTMachine = FALSE ) ;
  469. ~BROWSER_DOMAIN() ;
  470. //
  471. // This will return the empty string if this browser domain is the local
  472. // machine.
  473. //
  474. const TCHAR * QueryDomainName( void ) const
  475. { return _nlsDomainName.QueryPch() ; }
  476. const TCHAR * QueryDisplayName( void ) const
  477. { return _nlsDisplayName.QueryPch() ; }
  478. const TCHAR * QueryLsaLookupName( void ) const
  479. { return _nlsLsaDomainName.QueryPch() ; }
  480. //
  481. // Gets the domain name of this domain. Omitting the alias character,
  482. // stripping the "\\" if there and substituting the machine name for
  483. // the local machine.
  484. //
  485. APIERR GetQualifiedDomainName( NLS_STR * pnlsDomainName ) ;
  486. //
  487. // Indicates we want to fill the accounts listbox. plb is the listbox
  488. // that will get the items
  489. //
  490. APIERR RequestAccountData( void )
  491. { return _pFillDomainThread->RequestAccountData() ; }
  492. APIERR UnRequestAccountData( void )
  493. { return _pFillDomainThread->UnRequestAccountData() ; }
  494. //
  495. // RequestAccountData must be called before calling this method
  496. //
  497. APIERR RequestAndWaitForUsers( void )
  498. { return _pFillDomainThread->RequestAndWaitForUsers() ; }
  499. //
  500. // Returns the domain SID
  501. //
  502. const OS_SID * QueryDomainSid( void ) const
  503. { return &_ossidDomain ; }
  504. //
  505. // Returns TRUE if GetDomainInfo has already been called on this object
  506. //
  507. BOOL IsInitialized( void ) const
  508. { return _pFillDomainThread != NULL ; }
  509. //
  510. // Gets the admin authority object for this domain.
  511. //
  512. APIERR GetDomainInfo( NT_USER_BROWSER_DIALOG * pdlg, const ADMIN_AUTHORITY *pAdminAuth = NULL ) ;
  513. APIERR SetAsTargetDomain( void ) ;
  514. BOOL IsTargetDomain( void ) const
  515. { return _fIsTargetDomain ; }
  516. BOOL IsWinNTMachine( void ) const
  517. { return _fIsWinNT ; }
  518. //
  519. // These methods provide access to the individual handles for this domain
  520. //
  521. SAM_SERVER * QuerySamServer( void ) const
  522. { return _pFillDomainThread->QueryAdminAuthority()->QuerySamServer() ; }
  523. SAM_DOMAIN * QueryAccountDomain( void ) const
  524. { return _pFillDomainThread->QueryAdminAuthority()->QueryAccountDomain() ; }
  525. SAM_DOMAIN * QueryBuiltinDomain( void ) const
  526. { return _pFillDomainThread->QueryAdminAuthority()->QueryBuiltinDomain() ; }
  527. LSA_POLICY * QueryLSAPolicy( void ) const
  528. { return _pFillDomainThread->QueryAdminAuthority()->QueryLSAPolicy() ; }
  529. ADMIN_AUTHORITY * QueryAdminAuthority( void ) const
  530. { return _pFillDomainThread->QueryAdminAuthority() ; }
  531. APIERR WaitForAdminAuthority( DWORD msTimeout = INFINITE,
  532. BOOL * pfTimedOut = NULL ) const
  533. { return _pFillDomainThread->WaitForAdminAuthority( msTimeout,
  534. pfTimedOut ) ; }
  535. APIERR QueryErrorLoadingAuthority( void ) const
  536. { return _pFillDomainThread->QueryErrorLoadingAuthority() ; }
  537. private:
  538. NLS_STR _nlsDomainName ; // Used for net operations (local machine
  539. // is the empty string)
  540. NLS_STR _nlsDisplayName ; // Suitable for displaying in CB/LB
  541. NLS_STR _nlsLsaDomainName ; // Suitable for doing LSA lookups
  542. OS_SID _ossidDomain ;
  543. //
  544. // Gets all of the items for this domain. This memory is deleted by
  545. // by the thread itself when it exits. This will be NULL until the
  546. // domain is browsed
  547. //
  548. DOMAIN_FILL_THREAD * _pFillDomainThread ;
  549. //
  550. // This flag should be set if the primary domain of the focused machine
  551. // is selected and the focused machine is an NT Lanman machine (in which
  552. // case the machine name will not show up); OR the focused machine is
  553. // a Win NT machine and the focused machine is selected.
  554. //
  555. BOOL _fIsTargetDomain ;
  556. //
  557. // This flag indicates the current focus is a WinNT machine, which may
  558. // require special processing (such as not listing groups).
  559. //
  560. BOOL _fIsWinNT ;
  561. } ;
  562. /*************************************************************************
  563. NAME: USER_BROWSER_LB
  564. SYNOPSIS: This class is the container listbox for the list of aliases,
  565. groups and users.
  566. INTERFACE:
  567. PARENT: LAZY_LISTBOX
  568. NOTES:
  569. HISTORY:
  570. Johnl 20-Oct-1992 Created
  571. Johnl 28-Dec-1992 Made lazy listbox
  572. **************************************************************************/
  573. DLL_CLASS USER_BROWSER_LB : public LAZY_LISTBOX
  574. {
  575. public:
  576. USER_BROWSER_LB( OWNER_WINDOW * powin, CID cid ) ;
  577. ~USER_BROWSER_LB() ;
  578. BOOL IsSelectionExpandableGroup( void ) const
  579. { return IsSelectionExpandableGroup( QueryItem(), QuerySelCount() ) ; }
  580. DISPLAY_MAP * QueryDisplayMap( const USER_BROWSER_LBI * plbi ) ;
  581. const UINT * QueryColWidthArray( void ) const
  582. { return _adxColumns ; }
  583. USER_BROWSER_LBI * QueryItem( INT i ) const ;
  584. USER_BROWSER_LBI * QueryItem() const
  585. { return QueryItem( QueryCurrentItem() ) ; }
  586. LBI * RemoveItem( INT i )
  587. { LBI * plbi = _plbicacheCurrent->RemoveItem( i ) ;
  588. SetCount( _plbicacheCurrent->QueryCount() ) ;
  589. return plbi ;
  590. }
  591. INT AddItem( LBI * plbi )
  592. { INT tmp = _plbicacheCurrent->AddItem( plbi ) ;
  593. SetCount( _plbicacheCurrent->QueryCount() ) ;
  594. return tmp ;
  595. }
  596. USER_BROWSER_LBI_CACHE * QueryCurrentCache( void ) const
  597. { return _plbicacheCurrent ; }
  598. void SetCurrentCache( USER_BROWSER_LBI_CACHE * plbiCache )
  599. { SetCount( plbiCache->QueryCount() ) ;
  600. _plbicacheCurrent = plbiCache ;
  601. }
  602. USER_BROWSER_LBI * QueryErrorLBI( void ) const
  603. { return _plbiError ; }
  604. protected:
  605. virtual INT CD_Char( WCHAR wch, USHORT nLasPos ) ;
  606. virtual INT CD_VKey( USHORT nVKey, USHORT nLastPos ) ;
  607. INT CD_Char_HAWforHawaii( WCHAR wch,
  608. USHORT nLastPos,
  609. HAW_FOR_HAWAII_INFO * phawinfo ) ;
  610. protected:
  611. BOOL IsSelectionExpandableGroup( const USER_BROWSER_LBI * plbi,
  612. INT cSelItems ) const ;
  613. virtual LBI * OnNewItem( UINT i ) ;
  614. virtual VOID OnDeleteItem( LBI * plbi ) ;
  615. SUBJECT_BITMAP_BLOCK * _pbmpblock;
  616. /* Column widths array.
  617. */
  618. UINT _adxColumns[3] ;
  619. //
  620. // This is the current cache of the listbox
  621. //
  622. USER_BROWSER_LBI_CACHE * _plbicacheCurrent ;
  623. //
  624. // If we an error occurs during QueryItem, return this guy instead
  625. //
  626. USER_BROWSER_LBI * _plbiError ;
  627. //
  628. // Need to manually add support for "Haw" for hawaii
  629. //
  630. HAW_FOR_HAWAII_INFO _hawinfo ;
  631. } ;
  632. /*************************************************************************
  633. NAME: BROWSER_DOMAIN_LBI
  634. SYNOPSIS: LBI for the BROWSER_DOMAIN_CB
  635. PARENT: LBI
  636. NOTES: _pBrowDomain will be deleted on destruction
  637. HISTORY:
  638. Johnl 26-Oct-1992 Created
  639. **************************************************************************/
  640. DLL_CLASS BROWSER_DOMAIN_LBI : public LBI
  641. {
  642. public:
  643. BROWSER_DOMAIN_LBI( BROWSER_DOMAIN * pBrowDomain )
  644. : LBI(),
  645. _pBrowDomain( pBrowDomain )
  646. { ; }
  647. ~BROWSER_DOMAIN_LBI() ;
  648. BROWSER_DOMAIN * QueryBrowserDomain( void ) const
  649. { return _pBrowDomain ; }
  650. BOOL IsTargetDomain( void ) const
  651. { return QueryBrowserDomain()->IsTargetDomain() ; }
  652. BOOL IsWinNTMachine( void ) const
  653. { return QueryBrowserDomain()->IsWinNTMachine() ; }
  654. const TCHAR * QueryDisplayName( void ) const
  655. { return QueryBrowserDomain()->QueryDisplayName() ; }
  656. const TCHAR * QueryDomainName( void ) const
  657. { return QueryBrowserDomain()->QueryDomainName() ; }
  658. const TCHAR * QueryLsaLookupName( void ) const
  659. { return QueryBrowserDomain()->QueryLsaLookupName() ; }
  660. virtual VOID Paint( LISTBOX * plb, HDC hdc, const RECT * prect,
  661. GUILTT_INFO * pGUILTT ) const;
  662. //
  663. // Worker function, called directly by piggyback LBI class
  664. //
  665. VOID W_Paint( BROWSER_DOMAIN_CB * pcbBrowser, LISTBOX * plbActual,
  666. HDC hdc, const RECT * prect,
  667. GUILTT_INFO * pGUILTT ) const;
  668. virtual INT Compare( const LBI * plbi ) const;
  669. virtual WCHAR QueryLeadingChar() const;
  670. private:
  671. BROWSER_DOMAIN * _pBrowDomain ;
  672. } ;
  673. /*************************************************************************
  674. NAME: BROWSER_DOMAIN_CB
  675. SYNOPSIS: This combo lists the domains that can be browsed by the user
  676. PARENT: BLT_COMBOBOX
  677. NOTES: AddItem will check for NULL and delete pBrowDomain as necessary
  678. BROWSER_DOMAIN *'s added become the property of this CB.
  679. HISTORY:
  680. Johnl 26-Oct-1992 Created
  681. **************************************************************************/
  682. DLL_CLASS BROWSER_DOMAIN_CB : public BLT_COMBOBOX
  683. {
  684. public:
  685. BROWSER_DOMAIN_CB( OWNER_WINDOW * powin, CID cid ) ;
  686. ~BROWSER_DOMAIN_CB() ;
  687. APIERR AddItem( BROWSER_DOMAIN * pBrowDomain ) ;
  688. void SelectItem( BROWSER_DOMAIN * pBrowDomain ) ;
  689. DISPLAY_MAP * QueryDisplayMap( const BROWSER_DOMAIN_LBI * plbi ) ;
  690. const UINT * QueryColWidthArray( void ) const
  691. { return _adxColumns ; }
  692. private:
  693. DISPLAY_MAP _dmDomain ;
  694. DISPLAY_MAP _dmComputer ;
  695. /* Column widths array.
  696. */
  697. UINT _adxColumns[3] ;
  698. } ;
  699. /*************************************************************************
  700. NAME: ACCOUNT_NAMES_MLE
  701. SYNOPSIS: Contains methods for manipulating the user accounts MLE
  702. INTERFACE:
  703. PARENT: MLE_FONT
  704. USES:
  705. CAVEATS:
  706. NOTES: SetTargetDomain() needs to be called with the target domain
  707. name for CreateLBIListFromNames to work correctly with
  708. builtin names.
  709. HISTORY:
  710. Johnl 08-Dec-1992 Created
  711. **************************************************************************/
  712. DLL_CLASS ACCOUNT_NAMES_MLE : public MLE_FONT
  713. {
  714. public:
  715. ACCOUNT_NAMES_MLE( OWNER_WINDOW * powin,
  716. CID cid,
  717. const TCHAR * pszServer,
  718. NT_USER_BROWSER_DIALOG * pUserBrows,
  719. BOOL fIsSingleSelect,
  720. ULONG ulFlags,
  721. enum FontType fonttype = FONT_DEFAULT ) ;
  722. ~ACCOUNT_NAMES_MLE() ;
  723. //
  724. // Resets the contents of the MLE to a more suitable version for
  725. // processing (removes duplicates, qualifies as necessary etc.)
  726. // Optionally stores list of names in pstrlstNames.
  727. //
  728. APIERR CanonicalizeNames( const TCHAR * pszCurrentDomain,
  729. STRLIST * pstrlstNames = NULL ) ;
  730. //
  731. // Converts the list of names in strlstNames to a list of
  732. // USER_BROWSER_LBIs that the selection iterator can handle.
  733. //
  734. // pszServer - Server to lookup the names on
  735. // strlstNames - List of Names
  736. // pslUsrBrowLBIsCache - slist of LBIs names might be in
  737. // pslReturn - built slist of LBIs (possibly from cache)
  738. // nlsRawNames - raw MLE data
  739. // perrNameListError - Error code if can't find name etc.
  740. // pIndexFailingName - Character position of failing name
  741. //
  742. APIERR CreateLBIListFromNames( const TCHAR * pszServer,
  743. const TCHAR * pszDomain,
  744. SLIST_OF(USER_BROWSER_LBI) *pslUsrBrowLBIsCache,
  745. SLIST_OF(USER_BROWSER_LBI) *pslReturn,
  746. APIERR * perrNameListError,
  747. NLS_STR * pnlsFailingName ) ;
  748. BOOL IsSingleSelect( void ) const
  749. { return _fIsSingleSelect ; }
  750. APIERR SetTargetDomain( const TCHAR * pszTargetDomain )
  751. { return _nlsTargetDomain.CopyFrom( pszTargetDomain ) ; }
  752. ULONG QueryFlags( void ) const
  753. { return _ulFlags ; }
  754. static APIERR CheckNameType( SID_NAME_USE use, ULONG ulFlags );
  755. protected:
  756. //
  757. // Takes the raw names from the MLE, parses and returns
  758. // appropriate names in pstrlstNames
  759. //
  760. APIERR ParseUserNameList( STRLIST * pstrlstNames,
  761. const TCHAR * pszDomainName ) ;
  762. //
  763. // Removes any duplicate account names from pstrlstNames
  764. //
  765. void RemoveDuplicateAccountNames( STRLIST * pstrlstNames ) ;
  766. //
  767. // Concatenates all of the accounts in pstrlstNames and puts them into
  768. // pnlsNames
  769. //
  770. APIERR BuildNameListFromStrList( NLS_STR * pnlsNames,
  771. STRLIST * pstrlstNames ) ;
  772. //
  773. // Checks for any names the user may have typed that the client didn't
  774. // request (i.e., typing a group name when only users are allowed)
  775. //
  776. APIERR CheckLookedUpNames( LPTSTR * alptstr,
  777. LSA_TRANSLATED_SID_MEM * plsatsm,
  778. STRLIST * pstrlist,
  779. NLS_STR * pnlsFailingName,
  780. const TCHAR * pszDomain,
  781. APIERR * perrNameListError ) ;
  782. //
  783. // Looks for built in SID names and replaces the domain with "builtin"
  784. // if appropriate (only for target domain).
  785. //
  786. APIERR ReplaceDomainIfBuiltIn( NLS_STR * pnlsQualifiedAccount, BOOL *pfFound ) ;
  787. APIERR StripDomainIfWellKnown( NLS_STR * pnlsAccount ) ;
  788. BOOL IsWellKnownAccount( const NLS_STR & nlsName ) ;
  789. private:
  790. STRLIST _strlistWellKnown ;
  791. STRLIST _strlistBuiltin ;
  792. NLS_STR _nlsTargetDomain ;
  793. BOOL _fIsSingleSelect ;
  794. ULONG _ulFlags ;
  795. NT_USER_BROWSER_DIALOG * _pUserBrowser;
  796. } ;
  797. /*************************************************************************
  798. NAME: NT_USER_BROWSER_DIALOG
  799. SYNOPSIS: This class represents the standard NT User browser dialog
  800. INTERFACE: QueryCurrentDomainFocus - Returns the currently selected
  801. domain
  802. PARENT: DIALOG_WINDOW
  803. USES:
  804. CAVEATS: The domain threads own all of the LBIs that appear in the
  805. accounts listbox.
  806. The domain threads will delete themselves when they are done.
  807. NOTES: Single selection is determined by looking at the _lbAccounts
  808. member (i.e., does it have a multi-select style?).
  809. Passing in a non-NULL pAdminAuthPrimary implies that the
  810. pszServerResourceLivesOn is the PDC of the domain, and
  811. pAdminAuthPrimary is an ADMIN_AUTHORITY to this PDC with
  812. enough privilege.
  813. HISTORY:
  814. Johnl 28-Feb-1992 Created
  815. Thomaspa 31-Sept-1993 Added pAdminAuthPrimary.
  816. **************************************************************************/
  817. DLL_CLASS NT_USER_BROWSER_DIALOG : public DIALOG_WINDOW
  818. {
  819. public:
  820. NT_USER_BROWSER_DIALOG( const TCHAR * pszDlgName,
  821. HWND hwndOwner,
  822. const TCHAR * pszServerResourceLivesOn,
  823. ULONG ulHelpContext = 0,
  824. ULONG ulFlags = USRBROWS_SHOW_ALL |
  825. USRBROWS_INCL_ALL,
  826. const TCHAR * pszHelpFileName = NULL,
  827. ULONG ulHelpContextGlobalMembership = 0,
  828. ULONG ulHelpContextLocalMembership = 0,
  829. ULONG ulHelpContextSearch = 0,
  830. const ADMIN_AUTHORITY * pAdminAuthPrimary = NULL ) ;
  831. ~NT_USER_BROWSER_DIALOG() ;
  832. /* This method returns the SID of the domain that currently has
  833. * the focus.
  834. */
  835. const OS_SID * QueryDomainSid( void ) const
  836. { return QueryCurrentDomainFocus()->QueryDomainSid() ; }
  837. //
  838. // Looks at the selected items and adds them to the "Add" MLE,
  839. // optionally caching the added LBIs so we won't have to do
  840. // lookups later
  841. //
  842. APIERR AddSelectedUserBrowserLBIs( USER_BROWSER_LB * plbUserBrowser,
  843. BOOL fCopy,
  844. BOOL fAddToCache = TRUE ) ;
  845. //
  846. // Sets the error text over the "Names" listbox when a fill error
  847. // occurs
  848. //
  849. // If fIsErr is TRUE, then the message will be prefixed with
  850. // "Unable to browse domains due to the fol..."
  851. //
  852. APIERR SetAndFillErrorText( MSGID msg, BOOL fIsErr = TRUE ) ;
  853. //
  854. // The following methods allow the iterator access to the information
  855. // in the listbox.
  856. //
  857. SLIST_OF(USER_BROWSER_LBI) * QuerySelectionList( void )
  858. { return &_slUsrBrowserLBIs ; }
  859. BROWSER_DOMAIN * QueryCurrentDomainFocus( void ) const
  860. { return _pbrowdomainCurrentFocus ; }
  861. BROWSER_DOMAIN * FindDomain( const OS_SID * possid );
  862. void SetCurrentDomainFocus( BROWSER_DOMAIN * pBrowDomainNewFocus )
  863. { _pbrowdomainCurrentFocus = pBrowDomainNewFocus ; }
  864. const TCHAR * QueryServerResourceLivesOn( void ) const
  865. { return _pszServerResourceLivesOn; }
  866. BOOL IsSingleSelection( void ) const
  867. { return _fIsSingleSelection ; }
  868. ULONG QueryFlags( void ) const
  869. { return _ulFlags ; }
  870. BOOL AreUsersShown( void ) const
  871. { return _fUsersAreShown ; }
  872. // redefined from protected
  873. virtual ULONG QueryHelpContext( void ) ;
  874. virtual const TCHAR * QueryHelpFile( ULONG ulHelpContext ) ;
  875. ULONG QueryHelpContextGlobalMembership( void )
  876. { return _ulHelpContextGlobalMembership; }
  877. ULONG QueryHelpContextLocalMembership( void )
  878. { return _ulHelpContextLocalMembership; }
  879. ULONG QueryHelpContextSearch( void )
  880. { return _ulHelpContextSearch; }
  881. //
  882. // Returns DC of primary domain for use by DOMAIN_FILL_THREAD
  883. //
  884. const TCHAR * QueryDCofPrimaryDomain( void )
  885. { return _nlsDCofPrimaryDomain.QueryPch(); }
  886. SLIST_OF(USER_BROWSER_LBI) * QuerySelectionCache( void )
  887. { return &_slUsrBrowserLBIsCache; }
  888. protected:
  889. APIERR OnDomainChange( BROWSER_DOMAIN * pDomainNewSelecton,
  890. const ADMIN_AUTHORITY * pAdminAuth = NULL ) ;
  891. APIERR OnShowUsers( void ) ;
  892. APIERR OnSearch( void ) ;
  893. APIERR OnMembers( void ) ;
  894. APIERR OnAdd( void ) ;
  895. /*
  896. * To keep track of which control has focus even when this app
  897. * doesn't have focus, we must catch WM_ACTIVATE, and therefore
  898. * must hook OnDlgDeactivation().
  899. */
  900. virtual BOOL OnDlgDeactivation( const ACTIVATION_EVENT & );
  901. /* Fills in the trusted domain list from
  902. * the passed server and returns the domain that should have the
  903. * default focus in ppBrowserDomainDefaultFocus parameter. The default
  904. * focus is the domain that the server lives in (potentially the
  905. * local machine).
  906. *
  907. * The pcbDomains parameter will be filled and the default selection will be
  908. * set. The location the resource resides on will have an "*" following
  909. * the domain/computer name.
  910. */
  911. APIERR GetTrustedDomainList( const TCHAR * pszServer,
  912. BROWSER_DOMAIN * * ppBrowserDomainDefaultFocus,
  913. BROWSER_DOMAIN_CB * pcbDomains,
  914. const ADMIN_AUTHORITY * pAdminAuthPrimary = NULL ) ;
  915. //
  916. // Enables/Disables the controls associated with the accounts listbox
  917. // (i.e., account browsing, not domain browsing)
  918. //
  919. void EnableBrowsing( BOOL fEnable ) ;
  920. BOOL IsBrowsingEnabled( void ) const
  921. { return _lbAccounts.IsEnabled() ; }
  922. BOOL IsDomainComboDropped( void ) const
  923. { return _fDomainsComboIsDropped ; }
  924. void SetDomainComboDropFlag( BOOL fIsDropped )
  925. { _fDomainsComboIsDropped = fIsDropped ; }
  926. virtual BOOL OnCommand( const CONTROL_EVENT & event ) ;
  927. virtual BOOL OnUserMessage( const EVENT & event ) ;
  928. virtual BOOL OnOK( void ) ;
  929. BOOL IsShowUsersButtonUsed( void ) const
  930. { return !(!(QueryFlags() & USRBROWS_SHOW_USERS) ||
  931. (QueryFlags() & USRBROWS_EXPAND_USERS) ||
  932. ((QueryFlags() & USRBROWS_SHOW_ALL ) == USRBROWS_SHOW_USERS)) ; }
  933. //
  934. // Looks at the current state of the dialog and sets the buttons
  935. // accordingly
  936. //
  937. void UpdateButtonState( void ) ;
  938. private:
  939. BROWSER_DOMAIN_CB _cbDomains ;
  940. USER_BROWSER_LB _lbAccounts ;
  941. SLE_FONT _sleBrowseErrorText ; // Always disabled
  942. ACCOUNT_NAMES_MLE _mleAdd ;
  943. PUSH_BUTTON _buttonShowUsers ;
  944. PUSH_BUTTON _buttonSearch ;
  945. PUSH_BUTTON _buttonMembers ;
  946. PUSH_BUTTON _buttonOK ;
  947. PUSH_BUTTON _buttonAdd ;
  948. //
  949. // Points to the domain that currently has the "focus" (i.e., what machine
  950. // we are listing users/groups/aliases for.
  951. //
  952. BROWSER_DOMAIN * _pbrowdomainCurrentFocus ;
  953. //
  954. // Is set to the server name passed to the ctor.
  955. //
  956. const TCHAR * _pszServerResourceLivesOn ;
  957. //
  958. // Saves the flags passed to us for when we need to refill the listbox.
  959. //
  960. ULONG _ulFlags ;
  961. //
  962. // We cache items directly added from the listbox here (i.e., "Add" button
  963. // was pressed) so we don't have to look up the information when
  964. // the user presses OK.
  965. //
  966. SLIST_OF(USER_BROWSER_LBI) _slUsrBrowserLBIsCache ;
  967. //
  968. // These are the items that we will return to the user
  969. //
  970. SLIST_OF(USER_BROWSER_LBI) _slUsrBrowserLBIs ;
  971. //
  972. // Is set to TRUE when the combo is dropped (which means don't update
  973. // the listbox if the selection is changed).
  974. //
  975. BOOL _fDomainsComboIsDropped ;
  976. //
  977. // Is TRUE anytime users are being shown in the listbox. Used in
  978. // determining whether the Show Users button should be enabled in
  979. // in some cases
  980. //
  981. BOOL _fUsersAreShown ;
  982. const TCHAR * _pszHelpFileName ;
  983. ULONG _ulHelpContext ;
  984. ULONG _ulHelpContextGlobalMembership ;
  985. ULONG _ulHelpContextLocalMembership ;
  986. ULONG _ulHelpContextSearch ;
  987. BOOL _fIsSingleSelection ;
  988. BOOL _fEnableMembersButton ;
  989. //
  990. // Remember DC of primary domain for use by DOMAIN_FILL_THREAD
  991. //
  992. NLS_STR _nlsDCofPrimaryDomain;
  993. /*
  994. * Remember which control last had focus when dialog loses focus
  995. */
  996. HWND _hwndLastFocus;
  997. } ;
  998. /*************************************************************************
  999. NAME: BROWSER_SUBJECT
  1000. SYNOPSIS: The browser subject iter returns pointers to this class
  1001. INTERFACE: QuerySid - Returns the SID of this subject
  1002. PARENT: BASE
  1003. USES: OS_SID
  1004. CAVEATS:
  1005. NOTES: The difference between _SidType and _SysSidType is that
  1006. _SidType contains a SID_NAME_USE (i.e., group, user, alias
  1007. etc.) and _SysSidType contains a UI_SystemSid (World, Local,
  1008. Creator owner etc.).
  1009. HISTORY:
  1010. Johnl 04-Mar-1992 Created
  1011. **************************************************************************/
  1012. DLL_CLASS BROWSER_SUBJECT : public BASE
  1013. {
  1014. public:
  1015. BROWSER_SUBJECT() ;
  1016. ~BROWSER_SUBJECT() ;
  1017. /* Query the current selection account name. This will do everything
  1018. * right concerning name formatting, domain prefixing etc.
  1019. */
  1020. APIERR QueryQualifiedName( NLS_STR * pnlsQualifiedName,
  1021. const NLS_STR * pnlsDomainName = NULL,
  1022. BOOL fShowFullName = TRUE ) const ;
  1023. /* Indicates if this is a User, Group, Alias or Well known SID
  1024. */
  1025. SID_NAME_USE QueryType( void ) const
  1026. { return _pUserBrowserLBI->QueryType() ; }
  1027. /* Account name suitable for the LSA (such as "JohnL").
  1028. */
  1029. const TCHAR * QueryAccountName( void ) const
  1030. { return _pUserBrowserLBI->QueryAccountName() ; }
  1031. /* Full name, only used for User accounts (such as "Ludeman, John").
  1032. */
  1033. const TCHAR * QueryFullName( void ) const
  1034. { return _pUserBrowserLBI->QueryFullName() ; }
  1035. /* Comment set by the system admin.
  1036. */
  1037. const TCHAR * QueryComment( void ) const
  1038. { return _pUserBrowserLBI->QueryComment() ; }
  1039. const OS_SID * QuerySid( void ) const
  1040. { return &_ossidAccount ; }
  1041. const TCHAR * QueryDomainName( void ) const
  1042. { return _pUserBrowserLBI->QueryDomainName() ; }
  1043. /* Can be used for special casing some of the well known SIDs such as
  1044. * World, Creator, etc.
  1045. */
  1046. enum UI_SystemSid QuerySystemSidType( void ) const
  1047. { return _pUserBrowserLBI->QueryUISysSid() ; }
  1048. const OS_SID * QueryDomainSid( void ) const
  1049. { return &_ossidDomain ; }
  1050. ULONG QueryUserAccountFlags( void ) const
  1051. { return _pUserBrowserLBI->QueryUserAccountFlags() ; }
  1052. APIERR SetUserBrowserLBI( USER_BROWSER_LBI * pUserBrowserLBI ) ;
  1053. protected:
  1054. /* Built from the account SID
  1055. */
  1056. OS_SID _ossidDomain ;
  1057. OS_SID _ossidAccount ; // Need for historical reasons
  1058. USER_BROWSER_LBI * _pUserBrowserLBI ;
  1059. } ;
  1060. /*************************************************************************
  1061. NAME: BROWSER_SUBJECT_ITER
  1062. SYNOPSIS: This class is used to enumerate the users/aliases/groups/
  1063. well known sids the user selected in the User Browser
  1064. dialog.
  1065. INTERFACE: Next - returns the next item selected
  1066. PARENT: BASE
  1067. USES:
  1068. CAVEATS:
  1069. NOTES:
  1070. HISTORY:
  1071. Johnl 04-Mar-1992 Created
  1072. **************************************************************************/
  1073. DLL_CLASS BROWSER_SUBJECT_ITER : public BASE
  1074. {
  1075. public:
  1076. BROWSER_SUBJECT_ITER( NT_USER_BROWSER_DIALOG * pNtUserBrowserDialog ) ;
  1077. ~BROWSER_SUBJECT_ITER() ;
  1078. APIERR Next( BROWSER_SUBJECT ** ppBrowserSubject ) ;
  1079. private:
  1080. /* We will return a pointer to this member while iterating over the
  1081. * list. This may change depending on how the lists are built, whether
  1082. * this becomes a lazy listbox etc.
  1083. */
  1084. BROWSER_SUBJECT _BrowserSubject ;
  1085. NT_USER_BROWSER_DIALOG * _pUserBrowserDialog ;
  1086. ITER_SL_OF( USER_BROWSER_LBI ) _iterUserBrowserLBIs ;
  1087. } ;
  1088. #endif //RC_INVOKED
  1089. #endif //_USRBROWS_HXX_