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.

2357 lines
59 KiB

  1. // schemavw.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "viewex.h"
  5. #include "cacls.h"
  6. #include "schemavw.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. extern IDispatch* pACEClipboard;
  13. extern IDispatch* pACLClipboard;
  14. extern IDispatch* pSDClipboard;
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CSchemaView
  17. IMPLEMENT_DYNCREATE(CSchemaView, CFormView)
  18. /***********************************************************
  19. Function:
  20. Arguments:
  21. Return:
  22. Purpose:
  23. Author(s):
  24. Revision:
  25. Date:
  26. ***********************************************************/
  27. CSchemaView::CSchemaView()
  28. : CFormView(CSchemaView::IDD)
  29. {
  30. //{{AFX_DATA_INIT(CSchemaView)
  31. //}}AFX_DATA_INIT
  32. int nIdx;
  33. m_nProperty = -1;
  34. m_bDirty = FALSE;
  35. m_bInitialized = FALSE;
  36. pSecurityDescriptor = NULL;
  37. m_nLastSD = -1;
  38. m_nLastSDValue = -1;
  39. m_nLastACE = -1;
  40. m_nLastACEValue = -1;
  41. m_nLastACL = acl_Invalid;
  42. m_bACLDisplayed = FALSE;
  43. for( nIdx = 0; nIdx < 32 ; nIdx++ )
  44. {
  45. m_arrNormalControls[ 32 ] = -1;
  46. m_arrSecurityControls[ 32 ] = -1;
  47. }
  48. nIdx = 0;
  49. m_arrNormalControls[ nIdx++ ] = IDC_STATICCLASS;
  50. m_arrNormalControls[ nIdx++ ] = IDC_STATICCLSID;
  51. m_arrNormalControls[ nIdx++ ] = IDC_STATICPRIMARYINTERFACE;
  52. m_arrNormalControls[ nIdx++ ] = IDC_STATICDERIVEDFROM;
  53. m_arrNormalControls[ nIdx++ ] = IDC_STATICCONTAINMENT;
  54. m_arrNormalControls[ nIdx++ ] = IDC_STATICCONTAINER;
  55. m_arrNormalControls[ nIdx++ ] = IDC_STATICHELPFILENAME;
  56. m_arrNormalControls[ nIdx++ ] = IDC_STATICSTATICHELPFILECONTEXT;
  57. m_arrNormalControls[ nIdx++ ] = IDC_STATICOID;
  58. m_arrNormalControls[ nIdx++ ] = IDC_STATICABSTRACT;
  59. m_arrNormalControls[ nIdx++ ] = IDC_CLASSTYPE;
  60. m_arrNormalControls[ nIdx++ ] = IDC_CLSID;
  61. m_arrNormalControls[ nIdx++ ] = IDC_PRIMARYINTERFACE;
  62. m_arrNormalControls[ nIdx++ ] = IDC_DERIVEDFROM;
  63. m_arrNormalControls[ nIdx++ ] = IDC_CONTAINEMENT;
  64. m_arrNormalControls[ nIdx++ ] = IDC_CONTAINER;
  65. m_arrNormalControls[ nIdx++ ] = IDC_HELPFILENAME;
  66. m_arrNormalControls[ nIdx++ ] = IDC_HELPFILECONTEXT;
  67. m_arrNormalControls[ nIdx++ ] = IDC_CLASSOID;
  68. m_arrNormalControls[ nIdx++ ] = IDC_CLASSABSTRACT;
  69. nIdx = 0;
  70. m_arrSecurityControls[ nIdx++ ] = IDC_GBSECURITYDESCRIPTORSTATIC;
  71. m_arrSecurityControls[ nIdx++ ] = IDC_SECURITYDESCRIPTORPROPERTIES;
  72. m_arrSecurityControls[ nIdx++ ] = IDC_SECURITYDESCRIPTORPROPERTYVALUE;
  73. m_arrSecurityControls[ nIdx++ ] = IDC_GBACCESSCONTROLENTRIES;
  74. m_arrSecurityControls[ nIdx++ ] = IDC_DACLSACL_LIST;
  75. m_arrSecurityControls[ nIdx++ ] = IDC_ACELIST;
  76. m_arrSecurityControls[ nIdx++ ] = IDC_ACEPROPERTIESLIST;
  77. m_arrSecurityControls[ nIdx++ ] = IDC_ACEPROPERTYVALUE;
  78. m_arrSecurityControls[ nIdx++ ] = IDC_COPYACE;
  79. m_arrSecurityControls[ nIdx++ ] = IDC_PASTEACE;
  80. m_arrSecurityControls[ nIdx++ ] = IDC_DELACE;
  81. m_arrSecurityControls[ nIdx++ ] = IDC_ADDACE;
  82. m_arrSecurityControls[ nIdx++ ] = IDC_COPYACL;
  83. m_arrSecurityControls[ nIdx++ ] = IDC_PASTEACL;
  84. m_arrSecurityControls[ nIdx++ ] = IDC_COPYSD;
  85. m_arrSecurityControls[ nIdx++ ] = IDC_PASTESD;
  86. }
  87. /***********************************************************
  88. Function:
  89. Arguments:
  90. Return:
  91. Purpose:
  92. Author(s):
  93. Revision:
  94. Date:
  95. ***********************************************************/
  96. CSchemaView::~CSchemaView()
  97. {
  98. if( NULL != pSecurityDescriptor )
  99. {
  100. m_pDescriptor->Release( );
  101. delete pSecurityDescriptor;
  102. }
  103. }
  104. /***********************************************************
  105. Function:
  106. Arguments:
  107. Return:
  108. Purpose:
  109. Author(s):
  110. Revision:
  111. Date:
  112. ***********************************************************/
  113. void CSchemaView::DoDataExchange(CDataExchange* pDX)
  114. {
  115. CFormView::DoDataExchange(pDX);
  116. //{{AFX_DATA_MAP(CSchemaView)
  117. DDX_Control(pDX, IDC_CLASSOID, m_ClassOID);
  118. DDX_Control(pDX, IDC_CLASSABSTRACT, m_Abstract);
  119. DDX_Control(pDX, IDC_MULTIVALUED, m_MultiValued);
  120. DDX_Control(pDX, IDC_PROPDSNAMES, m_DsNames);
  121. DDX_Control(pDX, IDC_PROPOID, m_PropOID);
  122. DDX_Control(pDX, IDC_PROPERTYMANDATORY, m_Mandatory);
  123. DDX_Control(pDX, IDC_CONTAINEMENT, m_Containment);
  124. DDX_Control(pDX, IDC_ITEMOLEDSPATH, m_ItemOleDsPath);
  125. DDX_Control(pDX, IDC_PROPERTYMINRANGE, m_PropertyMinRange);
  126. DDX_Control(pDX, IDC_PROPERTYMAXRANGE, m_PropertyMaxRange);
  127. DDX_Control(pDX, IDC_PROPERTYTYPE, m_PropertyType);
  128. DDX_Control(pDX, IDC_PRIMARYINTERFACE, m_PrimaryInterface);
  129. DDX_Control(pDX, IDC_HELPFILECONTEXT, m_HelpFileContext);
  130. DDX_Control(pDX, IDC_DERIVEDFROM, m_DerivedFrom);
  131. DDX_Control(pDX, IDC_HELPFILENAME, m_HelpFileName);
  132. DDX_Control(pDX, IDC_CLSID, m_CLSID);
  133. DDX_Control(pDX, IDC_CONTAINER, m_Container);
  134. DDX_Control(pDX, IDC_CLASSTYPE, m_ClassType);
  135. DDX_Control(pDX, IDC_PROPVALUE, m_PropValue);
  136. DDX_Control(pDX, IDC_PROPLIST, m_PropList);
  137. //DDX_Control(pDX, IDC_PROPERTIES, m_Schema);
  138. //}}AFX_DATA_MAP
  139. }
  140. BEGIN_MESSAGE_MAP(CSchemaView, CFormView)
  141. //{{AFX_MSG_MAP(CSchemaView)
  142. ON_CBN_SELCHANGE(IDC_PROPLIST, OnSelchangeProplist)
  143. ON_BN_CLICKED(IDRELOAD, OnReload)
  144. ON_BN_CLICKED(IDAPPLY, OnApply)
  145. ON_EN_SETFOCUS(IDC_PROPVALUE, OnSetfocusPropvalue)
  146. ON_BN_CLICKED(IDC_METHOD1, OnMethod1)
  147. ON_BN_CLICKED(IDC_METHOD2, OnMethod2)
  148. ON_BN_CLICKED(IDC_METHOD3, OnMethod3)
  149. ON_BN_CLICKED(IDC_METHOD4, OnMethod4)
  150. ON_BN_CLICKED(IDC_METHOD5, OnMethod5)
  151. ON_BN_CLICKED(IDC_METHOD6, OnMethod6)
  152. ON_BN_CLICKED(IDC_METHOD7, OnMethod7)
  153. ON_BN_CLICKED(IDC_METHOD8, OnMethod8)
  154. ON_BN_CLICKED(IDC_APPEND, OnAppend)
  155. ON_BN_CLICKED(IDC_DELETE, OnDelete)
  156. ON_BN_CLICKED(IDC_CHANGE, OnChange)
  157. ON_BN_CLICKED(IDC_CLEAR, OnClear)
  158. ON_BN_CLICKED(IDC_GETPROPERTY, OnGetProperty)
  159. ON_BN_CLICKED(IDC_PUTPROPERTY, OnPutProperty)
  160. ON_CBN_SELCHANGE(IDC_ACELIST, OnACEChange)
  161. ON_CBN_SELCHANGE(IDC_ACEPROPERTIESLIST, OnACEPropertyChange)
  162. ON_CBN_SELCHANGE(IDC_DACLSACL_LIST, OnACLChange)
  163. ON_CBN_SELCHANGE(IDC_SECURITYDESCRIPTORPROPERTIES, OnSDPropertyChange)
  164. ON_BN_CLICKED(IDC_ADDACE, OnAddACE)
  165. ON_BN_CLICKED(IDC_COPYACE, OnCopyACE)
  166. ON_BN_CLICKED(IDC_PASTEACE, OnPasteACE)
  167. ON_BN_CLICKED(IDC_DELACE, OnRemoveACE)
  168. //}}AFX_MSG_MAP
  169. END_MESSAGE_MAP()
  170. /////////////////////////////////////////////////////////////////////////////
  171. // CSchemaView diagnostics
  172. #ifdef _DEBUG
  173. void CSchemaView::AssertValid() const
  174. {
  175. CFormView::AssertValid();
  176. }
  177. /***********************************************************
  178. Function:
  179. Arguments:
  180. Return:
  181. Purpose:
  182. Author(s):
  183. Revision:
  184. Date:
  185. ***********************************************************/
  186. void CSchemaView::Dump(CDumpContext& dc) const
  187. {
  188. CFormView::Dump(dc);
  189. }
  190. #endif //_DEBUG
  191. /////////////////////////////////////////////////////////////////////////////
  192. // CSchemaView message handlers
  193. /***********************************************************
  194. Function:
  195. Arguments:
  196. Return:
  197. Purpose:
  198. Author(s):
  199. Revision:
  200. Date:
  201. ***********************************************************/
  202. void CSchemaView::ResetObjectView( )
  203. {
  204. COleDsObject* pObject;
  205. int nIndex;
  206. TC_ITEM tcItem;
  207. CString strName;
  208. CString strMethCount;
  209. CString strMethName;
  210. int nMethCount;
  211. CHAR szText[ 128 ];
  212. int nFirst = 0;
  213. pObject = GetDocument( )->GetCurrentObject( );
  214. if( NULL == pObject )
  215. return;
  216. //m_Schema.DeleteAllItems( );
  217. m_PropList.ResetContent( );
  218. memset( &tcItem, 0, sizeof(tcItem) );
  219. tcItem.mask = TCIF_TEXT;
  220. tcItem.pszText = (LPTSTR)szText;
  221. strName = _T("");
  222. tcItem.pszText = strName.GetBuffer( 128 );
  223. //bRez = m_Schema.InsertItem( nIndex, &tcItem );
  224. // next, we'll get methods count/names
  225. nIndex = 0;
  226. strMethCount = pObject->GetAttribute( ca_MethodsCount );
  227. nMethCount = _ttoi( strMethCount.GetBuffer( 128 ) );
  228. for( nIndex = 0; nIndex < nMethCount && nIndex < 8; nIndex++ )
  229. {
  230. GetDlgItem( nIndex + IDC_METHOD1 )->ShowWindow( SW_SHOW );
  231. GetDlgItem( nIndex + IDC_METHOD1 )->SetWindowText
  232. ( pObject->GetAttribute( nIndex, ma_Name ) );
  233. }
  234. for( ;nIndex < 8;nIndex++ )
  235. {
  236. GetDlgItem( nIndex + IDC_METHOD1 )->ShowWindow( SW_HIDE );
  237. }
  238. m_nProperty = -1;
  239. m_ItemOleDsPath.SetWindowText ( pObject->GetOleDsPath( ) );
  240. m_ClassType.SetWindowText ( pObject->GetAttribute( ca_Name ) );
  241. m_CLSID.SetWindowText ( pObject->GetAttribute( ca_CLSID ) );
  242. m_HelpFileName.SetWindowText ( pObject->GetAttribute( ca_HelpFileName ) );
  243. m_HelpFileContext.SetWindowText ( pObject->GetAttribute( ca_HelpFileContext ) );
  244. m_PrimaryInterface.SetWindowText( pObject->GetAttribute( ca_PrimaryInterface ) );
  245. m_Containment.SetWindowText ( pObject->GetAttribute( ca_Containment ) );
  246. m_Container.SetWindowText ( pObject->GetAttribute( ca_Container ) );
  247. m_DerivedFrom.SetWindowText ( pObject->GetAttribute( ca_DerivedFrom ) );
  248. m_ClassOID.SetWindowText ( pObject->GetAttribute( ca_OID ) );
  249. m_Abstract.SetWindowText ( pObject->GetAttribute( ca_Abstract ) );
  250. }
  251. /***********************************************************
  252. Function:
  253. Arguments:
  254. Return:
  255. Purpose:
  256. Author(s):
  257. Revision:
  258. Date:
  259. ***********************************************************/
  260. void CSchemaView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
  261. {
  262. if( !m_bInitialized )
  263. {
  264. return;
  265. }
  266. ResetObjectView( );
  267. DisplayPropertiesList( );
  268. m_PropList.SetCurSel( 0 );
  269. DisplayCurrentPropertyText( );
  270. }
  271. /***********************************************************
  272. Function:
  273. Arguments:
  274. Return:
  275. Purpose:
  276. Author(s):
  277. Revision:
  278. Date:
  279. ***********************************************************/
  280. void CSchemaView::DisplayPropertiesList( )
  281. {
  282. // TODO: Add your control notification handler code here
  283. int nItems, nIter;
  284. COleDsObject* pObject;
  285. CString strPropName;
  286. CString strPropValue;
  287. PutPropertyValue( );
  288. pObject = GetDocument( )->GetCurrentObject( );
  289. if( NULL == pObject )
  290. {
  291. return;
  292. }
  293. m_PropList.ResetContent( );
  294. nItems = pObject->GetPropertyCount( );
  295. for( nIter = 0; nIter < nItems ; nIter++ )
  296. {
  297. int nIdx;
  298. strPropName = pObject->GetAttribute( nIter, pa_DisplayName );
  299. nIdx = m_PropList.AddString( strPropName );
  300. m_PropList.SetItemData( nIdx, (DWORD)nIter );
  301. }
  302. m_PropValue.SetWindowText( _T("") );
  303. }
  304. /***********************************************************
  305. Function:
  306. Arguments:
  307. Return:
  308. Purpose:
  309. Author(s):
  310. Revision:
  311. Date:
  312. ***********************************************************/
  313. void CSchemaView::DisplayCurrentPropertyText()
  314. {
  315. // TODO: Add your control notification handler code here
  316. int nProp;
  317. COleDsObject* pObject;
  318. HRESULT hResult;
  319. CString strPropValue, strTemp;
  320. CString strName;
  321. BOOL bSecurityDescriptor = FALSE;
  322. // BOOL bIsACL;
  323. nProp = m_PropList.GetCurSel( );
  324. if( CB_ERR == nProp )
  325. {
  326. return;
  327. }
  328. m_nProperty = nProp;
  329. pObject = GetDocument()->GetCurrentObject( );
  330. hResult = pObject->GetProperty( nProp, strPropValue, &bSecurityDescriptor );
  331. m_PropValue.SetWindowText( strPropValue );
  332. //*************
  333. strName = pObject->GetAttribute( nProp, pa_Name );
  334. strTemp = pObject->GetAttribute( nProp, pa_Type );
  335. m_PropertyType.SetWindowText( strTemp );
  336. //*************
  337. strTemp = pObject->GetAttribute( nProp, pa_MinRange );
  338. m_PropertyMinRange.SetWindowText( strTemp );
  339. //*************
  340. strTemp = pObject->GetAttribute( nProp, pa_MaxRange );
  341. m_PropertyMaxRange.SetWindowText( strTemp );
  342. //*************
  343. strTemp = pObject->GetAttribute( nProp, pa_MultiValued );
  344. m_MultiValued.SetWindowText( strTemp );
  345. //*************
  346. strTemp = pObject->GetAttribute( nProp, pa_OID );
  347. m_PropOID.SetWindowText( strTemp );
  348. //*************
  349. strTemp = pObject->GetAttribute( nProp, pa_DsNames );
  350. m_DsNames.SetWindowText( strTemp );
  351. //*************
  352. strTemp = pObject->GetAttribute( nProp, pa_Mandatory );
  353. m_Mandatory.SetWindowText( strTemp );
  354. strTemp = pObject->GetAttribute( nProp, pa_Type );
  355. if( bSecurityDescriptor )
  356. {
  357. // we need to display the security descriptor stuff...
  358. if( !m_bACLDisplayed )
  359. {
  360. HideControls( TRUE );
  361. ShowControls( FALSE );
  362. }
  363. if( NULL != pSecurityDescriptor )
  364. {
  365. delete pSecurityDescriptor;
  366. }
  367. if( NULL != m_pDescriptor )
  368. {
  369. m_pDescriptor->Release( );
  370. }
  371. m_bACLDisplayed = TRUE;
  372. DisplayACL( pObject, strName );
  373. }
  374. else
  375. {
  376. if( m_bACLDisplayed )
  377. {
  378. HideControls( FALSE );
  379. ShowControls( TRUE );
  380. delete pSecurityDescriptor;
  381. m_pDescriptor->Release( );
  382. }
  383. m_bACLDisplayed = FALSE;
  384. m_pDescriptor = NULL;
  385. pSecurityDescriptor = NULL;
  386. }
  387. }
  388. /***********************************************************
  389. Function:
  390. Arguments:
  391. Return:
  392. Purpose:
  393. Author(s):
  394. Revision:
  395. Date:
  396. ***********************************************************/
  397. void CSchemaView::OnSelchangeProplist()
  398. {
  399. // TODO: Add your control notification handler code here
  400. PutPropertyValue( );
  401. DisplayCurrentPropertyText( );
  402. }
  403. /***********************************************************
  404. Function:
  405. Arguments:
  406. Return:
  407. Purpose:
  408. Author(s):
  409. Revision:
  410. Date:
  411. ***********************************************************/
  412. void CSchemaView::OnReload()
  413. {
  414. HRESULT hResult;
  415. COleDsObject* pObject;
  416. HCURSOR aCursor, oldCursor;
  417. pObject = GetDocument()->GetCurrentObject( );
  418. if( NULL == pObject )
  419. {
  420. return;
  421. }
  422. aCursor = LoadCursor( NULL, IDC_WAIT );
  423. oldCursor = SetCursor( aCursor );
  424. hResult = pObject->GetInfo( );
  425. DisplayPropertiesList( );
  426. if( -1 != m_nProperty )
  427. {
  428. m_PropList.SetCurSel( m_nProperty );
  429. }
  430. else
  431. {
  432. m_PropList.SetCurSel( 0 );
  433. }
  434. DisplayCurrentPropertyText( );
  435. m_bDirty = FALSE;
  436. SetCursor( oldCursor );
  437. }
  438. /***********************************************************
  439. Function:
  440. Arguments:
  441. Return:
  442. Purpose:
  443. Author(s):
  444. Revision:
  445. Date:
  446. ***********************************************************/
  447. HRESULT CSchemaView::PutPropertyValue()
  448. {
  449. COleDsObject* pObject;
  450. HRESULT hResult;
  451. CString strPropValue;
  452. // if we're displaying security descriptors, we'll force the dirty flag
  453. m_bDirty = m_bDirty || (NULL != pSecurityDescriptor);
  454. if( -1 == m_nProperty || !m_bDirty )
  455. {
  456. return S_OK;
  457. }
  458. pObject = GetDocument()->GetCurrentObject( );
  459. if( NULL == pObject )
  460. return S_OK;
  461. if( NULL != pSecurityDescriptor )
  462. {
  463. // OK, so we need to set the security descriptor
  464. VARIANT var;
  465. IUnknown* pUnk;
  466. IADs* pADs;
  467. CString strName;
  468. BSTR bstrName;
  469. strName = pObject->GetAttribute( m_nProperty, pa_Name );
  470. bstrName = AllocBSTR( strName.GetBuffer( 128 ) );
  471. VariantInit( &var );
  472. V_VT( &var ) = VT_DISPATCH;
  473. V_DISPATCH( &var ) = m_pDescriptor;
  474. m_pDescriptor->AddRef( );
  475. pObject->GetInterface( &pUnk );
  476. pUnk->QueryInterface( IID_IADs, (void**)&pADs );
  477. hResult = pADs->Put( bstrName, var );
  478. SysFreeString( bstrName );
  479. VariantClear( &var );
  480. if( FAILED( hResult ) )
  481. {
  482. AfxMessageBox( OleDsGetErrorText( hResult ) );
  483. }
  484. }
  485. else
  486. {
  487. m_PropValue.GetWindowText( strPropValue );
  488. hResult = pObject->PutProperty( m_nProperty,
  489. strPropValue );
  490. }
  491. m_bDirty = FALSE;
  492. return hResult;
  493. }
  494. /***********************************************************
  495. Function:
  496. Arguments:
  497. Return:
  498. Purpose:
  499. Author(s):
  500. Revision:
  501. Date:
  502. ***********************************************************/
  503. void CSchemaView::OnApply()
  504. {
  505. // TODO: Add your control notification handler code here
  506. HRESULT hResult;
  507. COleDsObject* pObject;
  508. HCURSOR aCursor, oldCursor;
  509. pObject = GetDocument()->GetCurrentObject( );
  510. if( NULL == pObject )
  511. {
  512. return;
  513. }
  514. aCursor = LoadCursor( NULL, IDC_WAIT );
  515. oldCursor = SetCursor( aCursor );
  516. hResult = PutPropertyValue( );
  517. hResult = pObject->SetInfo( );
  518. //hResult = pObject->GetInfo( );
  519. m_bDirty = FALSE;
  520. DisplayPropertiesList( );
  521. if( -1 != m_nProperty )
  522. {
  523. m_PropList.SetCurSel( m_nProperty );
  524. }
  525. else
  526. {
  527. m_PropList.SetCurSel( 0 );
  528. }
  529. DisplayCurrentPropertyText( );
  530. SetCursor( oldCursor );
  531. }
  532. /***********************************************************
  533. Function:
  534. Arguments:
  535. Return:
  536. Purpose:
  537. Author(s):
  538. Revision:
  539. Date:
  540. ***********************************************************/
  541. void CSchemaView::OnMethod1()
  542. {
  543. // TODO: Add your control notification handler code here
  544. HRESULT hResult;
  545. COleDsObject* pObject;
  546. pObject = GetDocument()->GetCurrentObject( );
  547. hResult = pObject->CallMethod( 0 );
  548. }
  549. /***********************************************************
  550. Function:
  551. Arguments:
  552. Return:
  553. Purpose:
  554. Author(s):
  555. Revision:
  556. Date:
  557. ***********************************************************/
  558. void CSchemaView::OnMethod2()
  559. {
  560. // TODO: Add your control notification handler code here
  561. HRESULT hResult;
  562. COleDsObject* pObject;
  563. pObject = GetDocument()->GetCurrentObject( );
  564. hResult = pObject->CallMethod( 1 );
  565. }
  566. /***********************************************************
  567. Function:
  568. Arguments:
  569. Return:
  570. Purpose:
  571. Author(s):
  572. Revision:
  573. Date:
  574. ***********************************************************/
  575. void CSchemaView::OnMethod3()
  576. {
  577. // TODO: Add your control notification handler code here
  578. HRESULT hResult;
  579. COleDsObject* pObject;
  580. pObject = GetDocument()->GetCurrentObject( );
  581. hResult = pObject->CallMethod( 2 );
  582. }
  583. /***********************************************************
  584. Function:
  585. Arguments:
  586. Return:
  587. Purpose:
  588. Author(s):
  589. Revision:
  590. Date:
  591. ***********************************************************/
  592. void CSchemaView::OnMethod4()
  593. {
  594. // TODO: Add your control notification handler code here
  595. HRESULT hResult;
  596. COleDsObject* pObject;
  597. pObject = GetDocument()->GetCurrentObject( );
  598. hResult = pObject->CallMethod( 3 );
  599. }
  600. /***********************************************************
  601. Function:
  602. Arguments:
  603. Return:
  604. Purpose:
  605. Author(s):
  606. Revision:
  607. Date:
  608. ***********************************************************/
  609. void CSchemaView::OnMethod5()
  610. {
  611. // TODO: Add your control notification handler code here
  612. HRESULT hResult;
  613. COleDsObject* pObject;
  614. pObject = GetDocument()->GetCurrentObject( );
  615. hResult = pObject->CallMethod( 4 );
  616. }
  617. /***********************************************************
  618. Function:
  619. Arguments:
  620. Return:
  621. Purpose:
  622. Author(s):
  623. Revision:
  624. Date:
  625. ***********************************************************/
  626. void CSchemaView::OnMethod6()
  627. {
  628. // TODO: Add your control notification handler code here
  629. HRESULT hResult;
  630. COleDsObject* pObject;
  631. pObject = GetDocument()->GetCurrentObject( );
  632. hResult = pObject->CallMethod( 5 );
  633. }
  634. /***********************************************************
  635. Function:
  636. Arguments:
  637. Return:
  638. Purpose:
  639. Author(s):
  640. Revision:
  641. Date:
  642. ***********************************************************/
  643. void CSchemaView::OnMethod7()
  644. {
  645. // TODO: Add your control notification handler code here
  646. HRESULT hResult;
  647. COleDsObject* pObject;
  648. pObject = GetDocument()->GetCurrentObject( );
  649. hResult = pObject->CallMethod( 6 );
  650. }
  651. /***********************************************************
  652. Function:
  653. Arguments:
  654. Return:
  655. Purpose:
  656. Author(s):
  657. Revision:
  658. Date:
  659. ***********************************************************/
  660. void CSchemaView::OnMethod8()
  661. {
  662. // TODO: Add your control notification handler code here
  663. HRESULT hResult;
  664. COleDsObject* pObject;
  665. pObject = GetDocument()->GetCurrentObject( );
  666. hResult = pObject->CallMethod( 7 );
  667. }
  668. /***********************************************************
  669. Function:
  670. Arguments:
  671. Return:
  672. Purpose:
  673. Author(s):
  674. Revision:
  675. Date:
  676. ***********************************************************/
  677. void CSchemaView::OnSetfocusPropvalue()
  678. {
  679. // TODO: Add your control notification handler code here
  680. m_bDirty = TRUE;
  681. }
  682. /***********************************************************
  683. Function:
  684. Arguments:
  685. Return:
  686. Purpose:
  687. Author(s):
  688. Revision:
  689. Date:
  690. ***********************************************************/
  691. void CSchemaView::OnInitialUpdate()
  692. {
  693. m_bInitialized = TRUE;
  694. CFormView::OnInitialUpdate();
  695. // TODO: Add your specialized code here and/or call the base class
  696. HideControls( FALSE );
  697. ShowControls( TRUE );
  698. m_bACLDisplayed = FALSE;
  699. OnUpdate( NULL, 0L, NULL);
  700. }
  701. //***********************************************************
  702. // Function:
  703. // Arguments:
  704. // Return:
  705. // Purpose:
  706. // Author(s):
  707. // Revision:
  708. // Date:
  709. //***********************************************************
  710. void CSchemaView::ShowControls( BOOL bNormal )
  711. {
  712. int* pControlArray;
  713. int nIdx;
  714. pControlArray = bNormal ? m_arrNormalControls : m_arrSecurityControls;
  715. for( nIdx = 0; nIdx < 32 ; nIdx++ )
  716. {
  717. CWnd* pWnd;
  718. if( pControlArray[ nIdx ] > 0 )
  719. {
  720. pWnd = GetDlgItem( pControlArray[ nIdx ] );
  721. if( NULL != pWnd )
  722. {
  723. pWnd->ShowWindow( SW_SHOW );
  724. }
  725. }
  726. }
  727. }
  728. //***********************************************************
  729. // Function:
  730. // Arguments:
  731. // Return:
  732. // Purpose:
  733. // Author(s):
  734. // Revision:
  735. // Date:
  736. //***********************************************************
  737. void CSchemaView::HideControls(BOOL bNormal)
  738. {
  739. int* pControlArray;
  740. int nIdx;
  741. pControlArray = bNormal ? m_arrNormalControls : m_arrSecurityControls;
  742. for( nIdx = 0; nIdx < 32 ; nIdx++ )
  743. {
  744. CWnd* pWnd;
  745. if( pControlArray[ nIdx ] > 0 )
  746. {
  747. pWnd = GetDlgItem( pControlArray[ nIdx ] );
  748. if( NULL != pWnd )
  749. {
  750. pWnd->ShowWindow( SW_HIDE );
  751. }
  752. }
  753. }
  754. }
  755. /***********************************************************
  756. Function:
  757. Arguments:
  758. Return:
  759. Purpose:
  760. Author(s):
  761. Revision:
  762. Date:
  763. ***********************************************************/
  764. void CSchemaView::OnAppend()
  765. {
  766. // TODO: Add your control notification handler code here
  767. HRESULT hResult;
  768. CString strPropValue;
  769. COleDsObject* pObject;
  770. if( -1 == m_nProperty )
  771. {
  772. return;
  773. }
  774. pObject = GetDocument()->GetCurrentObject( );
  775. if( NULL == pObject )
  776. return;
  777. m_PropValue.GetWindowText( strPropValue );
  778. hResult = pObject->PutProperty(
  779. (int)( m_PropList.GetItemData( m_nProperty ) ),
  780. strPropValue,
  781. ADS_ATTR_APPEND
  782. );
  783. m_bDirty = FALSE;
  784. }
  785. /***********************************************************
  786. Function:
  787. Arguments:
  788. Return:
  789. Purpose:
  790. Author(s):
  791. Revision:
  792. Date:
  793. ***********************************************************/
  794. void CSchemaView::OnDelete()
  795. {
  796. // TODO: Add your control notification handler code here
  797. HRESULT hResult;
  798. CString strPropValue;
  799. COleDsObject* pObject;
  800. if( -1 == m_nProperty )
  801. {
  802. return;
  803. }
  804. pObject = GetDocument()->GetCurrentObject( );
  805. if( NULL == pObject )
  806. return;
  807. m_PropValue.GetWindowText( strPropValue );
  808. hResult = pObject->PutProperty(
  809. (int)( m_PropList.GetItemData( m_nProperty ) ),
  810. strPropValue,
  811. ADS_ATTR_DELETE
  812. );
  813. m_bDirty = FALSE;
  814. }
  815. /***********************************************************
  816. Function:
  817. Arguments:
  818. Return:
  819. Purpose:
  820. Author(s):
  821. Revision:
  822. Date:
  823. ***********************************************************/
  824. void CSchemaView::OnChange()
  825. {
  826. // TODO: Add your control notification handler code here
  827. HRESULT hResult;
  828. CString strPropValue;
  829. COleDsObject* pObject;
  830. if( -1 == m_nProperty )
  831. {
  832. return;
  833. }
  834. pObject = GetDocument()->GetCurrentObject( );
  835. if( NULL == pObject )
  836. return;
  837. m_PropValue.GetWindowText( strPropValue );
  838. hResult = pObject->PutProperty(
  839. (int)( m_PropList.GetItemData( m_nProperty ) ),
  840. strPropValue,
  841. ADS_PROPERTY_UPDATE );
  842. m_bDirty = TRUE;
  843. }
  844. /***********************************************************
  845. Function:
  846. Arguments:
  847. Return:
  848. Purpose:
  849. Author(s):
  850. Revision:
  851. Date:
  852. ***********************************************************/
  853. void CSchemaView::OnClear()
  854. {
  855. // TODO: Add your control notification handler code here
  856. HRESULT hResult;
  857. CString strPropValue;
  858. COleDsObject* pObject;
  859. if( -1 == m_nProperty )
  860. {
  861. return;
  862. }
  863. pObject = GetDocument()->GetCurrentObject( );
  864. if( NULL == pObject )
  865. return;
  866. m_PropValue.GetWindowText( strPropValue );
  867. hResult = pObject->PutProperty(
  868. (int)( m_PropList.GetItemData( m_nProperty ) ),
  869. strPropValue,
  870. ADS_PROPERTY_CLEAR );
  871. m_bDirty = FALSE;
  872. }
  873. /***********************************************************
  874. Function:
  875. Arguments:
  876. Return:
  877. Purpose:
  878. Author(s):
  879. Revision:
  880. Date:
  881. ***********************************************************/
  882. void CSchemaView::OnGetProperty()
  883. {
  884. // TODO: Add your control notification handler code here
  885. CPropertyDialog pPropDialog;
  886. COleDsObject* pObject;
  887. HRESULT hResult;
  888. CString strValue;
  889. pObject = GetDocument()->GetCurrentObject( );
  890. if( NULL == pObject )
  891. return;
  892. //pPropDialog.PutFlag( FALSE );
  893. if( pPropDialog.DoModal( ) != IDOK )
  894. return;
  895. hResult = pObject->GetProperty( pPropDialog.m_PropertyName,
  896. strValue,
  897. TRUE,
  898. ADsTypeFromString( pPropDialog.m_PropertyType ) );
  899. }
  900. /***********************************************************
  901. Function:
  902. Arguments:
  903. Return:
  904. Purpose:
  905. Author(s):
  906. Revision:
  907. Date:
  908. ***********************************************************/
  909. void CSchemaView::OnPutProperty()
  910. {
  911. // TODO: Add your control notification handler code here
  912. // TODO: Add your control notification handler code here
  913. CPropertyDialog pPropDialog;
  914. COleDsObject* pObject;
  915. HRESULT hResult;
  916. CString strValue;
  917. pObject = GetDocument()->GetCurrentObject( );
  918. if( NULL == pObject )
  919. return;
  920. //pPropDialog.PutFlag( FALSE );
  921. if( pPropDialog.DoModal( ) != IDOK )
  922. return;
  923. hResult = pObject->PutProperty( pPropDialog.m_PropertyName,
  924. pPropDialog.m_PropertyValue,
  925. TRUE,
  926. ADsTypeFromString( pPropDialog.m_PropertyType ) );
  927. }
  928. /////////////////////////////////////////////////////////////////////////////
  929. // CSetMandatoryProperties dialog
  930. /***********************************************************
  931. Function:
  932. Arguments:
  933. Return:
  934. Purpose:
  935. Author(s):
  936. Revision:
  937. Date:
  938. ***********************************************************/
  939. CSetMandatoryProperties::CSetMandatoryProperties(CWnd* pParent /*=NULL*/)
  940. : CDialog(CSetMandatoryProperties::IDD, pParent)
  941. {
  942. //{{AFX_DATA_INIT(CSetMandatoryProperties)
  943. // NOTE: the ClassWizard will add member initialization here
  944. //}}AFX_DATA_INIT
  945. m_nFuncSet = -1;
  946. m_nProperty = -1;
  947. m_bDirty = FALSE;
  948. m_bInitialized = FALSE;
  949. m_pObject = NULL;
  950. }
  951. /***********************************************************
  952. Function:
  953. Arguments:
  954. Return:
  955. Purpose:
  956. Author(s):
  957. Revision:
  958. Date:
  959. ***********************************************************/
  960. void CSetMandatoryProperties::DoDataExchange(CDataExchange* pDX)
  961. {
  962. CDialog::DoDataExchange(pDX);
  963. //{{AFX_DATA_MAP(CSetMandatoryProperties)
  964. DDX_Control(pDX, IDC_CONTAINEMENT, m_Containment);
  965. DDX_Control(pDX, IDC_ITEMOLEDSPATH, m_ItemOleDsPath);
  966. DDX_Control(pDX, IDC_PROPERTYOPTIONAL, m_PropertyOptional);
  967. DDX_Control(pDX, IDC_PROPERTYNORMAL, m_PropertyNormal);
  968. DDX_Control(pDX, IDC_PROPERTYMINRANGE, m_PropertyMinRange);
  969. DDX_Control(pDX, IDC_PROPERTYMAXRANGE, m_PropertyMaxRange);
  970. DDX_Control(pDX, IDC_PROPERTYTYPE, m_PropertyType);
  971. DDX_Control(pDX, IDC_PRIMARYINTERFACE, m_PrimaryInterface);
  972. DDX_Control(pDX, IDC_HELPFILECONTEXT, m_HelpFileContext);
  973. DDX_Control(pDX, IDC_DERIVEDFROM, m_DerivedFrom);
  974. DDX_Control(pDX, IDC_HELPFILENAME, m_HelpFileName);
  975. DDX_Control(pDX, IDC_CLSID, m_CLSID);
  976. DDX_Control(pDX, IDC_CONTAINER, m_Container);
  977. DDX_Control(pDX, IDC_CLASSTYPE, m_ClassType);
  978. DDX_Control(pDX, IDC_PROPVALUE, m_PropValue);
  979. DDX_Control(pDX, IDC_PROPLIST, m_PropList);
  980. DDX_Control(pDX, IDC_PROPERTIES, m_Schema);
  981. //}}AFX_DATA_MAP
  982. }
  983. BEGIN_MESSAGE_MAP(CSetMandatoryProperties, CDialog)
  984. //{{AFX_MSG_MAP(CSetMandatoryProperties)
  985. ON_NOTIFY(TCN_SELCHANGE, IDC_PROPERTIES, OnSelchangeProperties)
  986. ON_CBN_SELCHANGE(IDC_PROPLIST, OnSelchangeProplist)
  987. ON_EN_SETFOCUS(IDC_PROPVALUE, OnSetfocusPropvalue)
  988. ON_BN_CLICKED(IDOK, OnOK)
  989. //}}AFX_MSG_MAP
  990. END_MESSAGE_MAP()
  991. /////////////////////////////////////////////////////////////////////////////
  992. // CSetMandatoryProperties message handlers
  993. /***********************************************************
  994. Function:
  995. Arguments:
  996. Return:
  997. Purpose:
  998. Author(s):
  999. Revision:
  1000. Date:
  1001. ***********************************************************/
  1002. void CSetMandatoryProperties::SetOleDsObject( COleDsObject* pObject )
  1003. {
  1004. m_pObject = pObject;
  1005. }
  1006. /***********************************************************
  1007. Function:
  1008. Arguments:
  1009. Return:
  1010. Purpose:
  1011. Author(s):
  1012. Revision:
  1013. Date:
  1014. ***********************************************************/
  1015. void CSetMandatoryProperties::OnSelchangeProperties(NMHDR* pNMHDR, LRESULT* pResult)
  1016. {
  1017. // TODO: Add your control notification handler code here
  1018. int nSel, nItems, nIter;
  1019. CString strPropName;
  1020. CString strPropValue;
  1021. CString strMandatory;
  1022. *pResult = 0;
  1023. PutPropertyValue( );
  1024. nSel = m_Schema.GetCurSel( );
  1025. if( nSel == LB_ERR )
  1026. {
  1027. return;
  1028. }
  1029. m_nFuncSet = nSel;
  1030. m_nProperty = -1;
  1031. m_PropList.ResetContent( );
  1032. nItems = m_pObject->GetPropertyCount( );
  1033. for( nIter = 0; nIter < nItems ; nIter++ )
  1034. {
  1035. int nIdx;
  1036. strMandatory = m_pObject->GetAttribute( nIter, pa_Mandatory );
  1037. if( strMandatory == _T("Yes") )
  1038. //if( TRUE )
  1039. {
  1040. strPropName = m_pObject->GetAttribute( nIter, pa_DisplayName );
  1041. nIdx = m_PropList.AddString( strPropName );
  1042. m_PropList.SetItemData( nIdx, nIter );
  1043. }
  1044. }
  1045. m_PropList.SetCurSel( 0 );
  1046. OnSelchangeProplist( );
  1047. }
  1048. /***********************************************************
  1049. Function:
  1050. Arguments:
  1051. Return:
  1052. Purpose:
  1053. Author(s):
  1054. Revision:
  1055. Date:
  1056. ***********************************************************/
  1057. void CSetMandatoryProperties::OnSelchangeProplist()
  1058. {
  1059. // TODO: Add your control notification handler code here
  1060. int nMandProp, nProp, nFuncSet;
  1061. HRESULT hResult;
  1062. CString strPropValue;
  1063. CString strTemp;
  1064. PutPropertyValue( );
  1065. m_PropValue.SetWindowText( _T("") );
  1066. nProp = m_PropList.GetCurSel( );
  1067. nMandProp = (int)m_PropList.GetItemData( nProp );
  1068. nFuncSet = m_Schema.GetCurSel( );
  1069. if( CB_ERR == nProp || CB_ERR == nFuncSet )
  1070. {
  1071. return;
  1072. }
  1073. m_nProperty = nProp;
  1074. m_nFuncSet = nFuncSet;
  1075. hResult = m_pObject->GetProperty( nMandProp, strPropValue );
  1076. m_PropValue.SetWindowText( strPropValue );
  1077. //******************
  1078. strTemp = m_pObject->GetAttribute( nMandProp, pa_Type );
  1079. m_PropertyType.SetWindowText( strTemp );
  1080. //******************
  1081. strTemp = m_pObject->GetAttribute( nMandProp, pa_MinRange );
  1082. m_PropertyMinRange.SetWindowText( strTemp );
  1083. //******************
  1084. strTemp = m_pObject->GetAttribute( nMandProp, pa_MaxRange );
  1085. m_PropertyMaxRange.SetWindowText( strTemp );
  1086. }
  1087. /***********************************************************
  1088. Function:
  1089. Arguments:
  1090. Return:
  1091. Purpose:
  1092. Author(s):
  1093. Revision:
  1094. Date:
  1095. ***********************************************************/
  1096. void CSetMandatoryProperties::OnSetfocusPropvalue()
  1097. {
  1098. // TODO: Add your control notification handler code here
  1099. m_bDirty = TRUE;
  1100. }
  1101. /***********************************************************
  1102. Function:
  1103. Arguments:
  1104. Return:
  1105. Purpose:
  1106. Author(s):
  1107. Revision:
  1108. Date:
  1109. ***********************************************************/
  1110. void CSetMandatoryProperties::OnOK()
  1111. {
  1112. // TODO: Add your control notification handler code here
  1113. PutPropertyValue( );
  1114. CDialog::OnOK( );
  1115. }
  1116. /***********************************************************
  1117. Function:
  1118. Arguments:
  1119. Return:
  1120. Purpose:
  1121. Author(s):
  1122. Revision:
  1123. Date:
  1124. ***********************************************************/
  1125. HRESULT CSetMandatoryProperties::PutPropertyValue()
  1126. {
  1127. HRESULT hResult;
  1128. CString strPropValue;
  1129. if( -1 == m_nProperty || -1 == m_nFuncSet || !m_bDirty )
  1130. {
  1131. return S_OK;
  1132. }
  1133. m_PropValue.GetWindowText( strPropValue );
  1134. hResult = m_pObject->PutProperty( (int)( m_PropList.GetItemData( m_nProperty ) ),
  1135. strPropValue );
  1136. m_bDirty = FALSE;
  1137. return S_OK;
  1138. }
  1139. /***********************************************************
  1140. Function:
  1141. Arguments:
  1142. Return:
  1143. Purpose:
  1144. Author(s):
  1145. Revision:
  1146. Date:
  1147. ***********************************************************/
  1148. BOOL CSetMandatoryProperties::OnInitDialog()
  1149. {
  1150. int nIndex;
  1151. TC_ITEM tcItem;
  1152. CString strName;
  1153. CHAR szText[ 128 ];
  1154. BOOL bRez;
  1155. LRESULT lResult;
  1156. CDialog::OnInitDialog();
  1157. // TODO: Add extra initialization here
  1158. m_Schema.DeleteAllItems( );
  1159. memset( &tcItem, 0, sizeof(tcItem) );
  1160. tcItem.mask = TCIF_TEXT;
  1161. tcItem.pszText = (LPTSTR)szText;
  1162. nIndex = 0;
  1163. strName = _T("");
  1164. tcItem.pszText = strName.GetBuffer( 128 );
  1165. bRez = m_Schema.InsertItem( nIndex, &tcItem );
  1166. m_nFuncSet = -1;
  1167. m_nProperty = -1;
  1168. m_Schema.SetCurSel( 0 );
  1169. m_ItemOleDsPath.SetWindowText( m_pObject->GetOleDsPath( ) );
  1170. m_ClassType.SetWindowText( m_pObject->GetAttribute( ca_Name ) );
  1171. m_CLSID.SetWindowText( m_pObject->GetAttribute( ca_CLSID ) );
  1172. m_HelpFileName.SetWindowText( m_pObject->GetAttribute( ca_HelpFileName ) );
  1173. m_PrimaryInterface.SetWindowText( m_pObject->GetAttribute( ca_PrimaryInterface ) );
  1174. m_Containment.SetWindowText( m_pObject->GetAttribute( ca_Containment ) );
  1175. m_Container.SetWindowText ( m_pObject->GetAttribute( ca_Container ) );
  1176. m_DerivedFrom.SetWindowText( m_pObject->GetAttribute( ca_DerivedFrom ) );
  1177. OnSelchangeProperties( NULL, &lResult );
  1178. return TRUE;
  1179. }
  1180. /////////////////////////////////////////////////////////////////////////////
  1181. // CPropertyDialog dialog
  1182. CPropertyDialog::CPropertyDialog(CWnd* pParent /*=NULL*/)
  1183. : CDialog(CPropertyDialog::IDD, pParent)
  1184. {
  1185. //{{AFX_DATA_INIT(CPropertyDialog)
  1186. m_PropertyName = _T("");
  1187. m_PropertyType = _T("");
  1188. m_PropertyValue = _T("");
  1189. //}}AFX_DATA_INIT
  1190. }
  1191. /***********************************************************
  1192. Function:
  1193. Arguments:
  1194. Return:
  1195. Purpose:
  1196. Author(s):
  1197. Revision:
  1198. Date:
  1199. ***********************************************************/
  1200. void CPropertyDialog::DoDataExchange(CDataExchange* pDX)
  1201. {
  1202. CDialog::DoDataExchange(pDX);
  1203. //{{AFX_DATA_MAP(CPropertyDialog)
  1204. DDX_CBString(pDX, IDC_NEWPROPERTYNAME, m_PropertyName);
  1205. DDX_CBString(pDX, IDC_NEWPROPERTYTYPE, m_PropertyType);
  1206. DDX_CBString(pDX, IDC_NEWPROPERTYVALUE, m_PropertyValue);
  1207. //}}AFX_DATA_MAP
  1208. }
  1209. BEGIN_MESSAGE_MAP(CPropertyDialog, CDialog)
  1210. //{{AFX_MSG_MAP(CPropertyDialog)
  1211. //}}AFX_MSG_MAP
  1212. END_MESSAGE_MAP()
  1213. /////////////////////////////////////////////////////////////////////////////
  1214. // CPropertyDialog message handlers
  1215. /***********************************************************
  1216. Function:
  1217. Arguments:
  1218. Return:
  1219. Purpose:
  1220. Author(s):
  1221. Revision:
  1222. Date:
  1223. ***********************************************************/
  1224. BOOL CPropertyDialog::OnInitDialog()
  1225. {
  1226. CString strLastValue;
  1227. CComboBox* pCombo;
  1228. CDialog::OnInitDialog();
  1229. // TODO: Add extra initialization here
  1230. //*******************
  1231. GetLRUList( IDC_NEWPROPERTYNAME, _T("PropertyDialog_Name") );
  1232. // TODO: Add extra initialization here
  1233. //*******************
  1234. pCombo = (CComboBox*)GetDlgItem( IDC_NEWPROPERTYTYPE );
  1235. pCombo->AddString( _T("ADSTYPE_DN_STRING") );
  1236. pCombo->AddString( _T("ADSTYPE_CASE_EXACT_STRING") );
  1237. pCombo->AddString( _T("ADSTYPE_CASE_IGNORE_STRING") );
  1238. pCombo->AddString( _T("ADSTYPE_PRINTABLE_STRING") );
  1239. pCombo->AddString( _T("ADSTYPE_NUMERIC_STRING") );
  1240. pCombo->AddString( _T("ADSTYPE_BOOLEAN") );
  1241. pCombo->AddString( _T("ADSTYPE_INTEGER") );
  1242. pCombo->AddString( _T("ADSTYPE_OCTET_STRING") );
  1243. pCombo->AddString( _T("ADSTYPE_UTC_TIME") );
  1244. pCombo->AddString( _T("ADSTYPE_LARGE_INTEGER") );
  1245. pCombo->AddString( _T("ADSTYPE_PROV_SPECIFIC") );
  1246. // TODO: Add extra initialization here
  1247. //*******************
  1248. GetLRUList( IDC_NEWPROPERTYVALUE, _T("PropertyDialog_Value") );
  1249. //GetLastProfileString( _T("PropertyDialog_IsMultiValued"),
  1250. // strLastValue );
  1251. //if( strLastValue.CompareNoCase( _T("Yes") ) )
  1252. //{
  1253. //m_Secure.SetCheck( 0 );
  1254. //}
  1255. return TRUE;
  1256. }
  1257. /***********************************************************
  1258. Function:
  1259. Arguments:
  1260. Return:
  1261. Purpose:
  1262. Author(s):
  1263. Revision:
  1264. Date:
  1265. ***********************************************************/
  1266. void CPropertyDialog::OnOK()
  1267. {
  1268. // TODO: Add extra validation here
  1269. //*******************
  1270. GetDlgItemText( IDC_NEWPROPERTYNAME, m_PropertyName );
  1271. SaveLRUList( IDC_NEWPROPERTYNAME, _T("PropertyDialog_Name"), 20 );
  1272. //*******************
  1273. GetDlgItemText( IDC_NEWPROPERTYTYPE, m_PropertyType );
  1274. //*******************
  1275. GetDlgItemText( IDC_NEWPROPERTYVALUE, m_PropertyValue );
  1276. SaveLRUList( IDC_NEWPROPERTYVALUE, _T("PropertyDialog_Value"), 20 );
  1277. CDialog::OnOK();
  1278. }
  1279. /***********************************************************
  1280. Function:
  1281. Arguments:
  1282. Return:
  1283. Purpose:
  1284. Author(s):
  1285. Revision:
  1286. Date:
  1287. ***********************************************************/
  1288. void CPropertyDialog::SaveLRUList( int idCBox, TCHAR* pszSection, int nMax )
  1289. {
  1290. CComboBox* pCombo;
  1291. TCHAR szEntry[ MAX_PATH ];
  1292. TCHAR szIndex[ 8 ];
  1293. CString strText, strItem;
  1294. int nVal, nIdx, nItems;
  1295. pCombo = (CComboBox*)GetDlgItem( idCBox );
  1296. pCombo->GetWindowText( strText );
  1297. _tcscpy( szEntry, _T("Value_1") );
  1298. if( strText.GetLength( ) )
  1299. {
  1300. WritePrivateProfileString( pszSection, szEntry, (LPCTSTR)strText, ADSVW_INI_FILE );
  1301. }
  1302. nItems = pCombo->GetCount( );
  1303. nVal = 2;
  1304. for( nIdx = 0; nItems != CB_ERR && nIdx < nItems && nIdx < nMax ; nIdx ++ )
  1305. {
  1306. pCombo->GetLBText( nIdx, strItem );
  1307. if( strItem.CompareNoCase( strText ) )
  1308. {
  1309. _itot( nVal++, szIndex, 10 );
  1310. _tcscpy( szEntry, _T("Value_") );
  1311. _tcscat( szEntry, szIndex );
  1312. WritePrivateProfileString( pszSection, szEntry, (LPCTSTR)strItem, ADSVW_INI_FILE );
  1313. }
  1314. }
  1315. }
  1316. //***********************************************************
  1317. // Function:
  1318. // Arguments:
  1319. // Return:
  1320. // Purpose:
  1321. // Author(s):
  1322. // Revision:
  1323. // Date:
  1324. //***********************************************************
  1325. void CPropertyDialog::GetLRUList( int idCBox, TCHAR* pszSection )
  1326. {
  1327. CComboBox* pCombo;
  1328. int nIter;
  1329. TCHAR szEntry[ MAX_PATH ];
  1330. TCHAR szIndex[ 8 ];
  1331. TCHAR szValue[ 1024 ];
  1332. pCombo = (CComboBox*)GetDlgItem( idCBox );
  1333. for( nIter = 0; nIter < 100 ; nIter++ )
  1334. {
  1335. _itot( nIter + 1, szIndex, 10 );
  1336. _tcscpy( szEntry, _T("Value_") );
  1337. _tcscat( szEntry, szIndex );
  1338. GetPrivateProfileString( pszSection, szEntry,
  1339. _T(""), szValue, 1023, ADSVW_INI_FILE );
  1340. if( _tcslen( szValue ) )
  1341. {
  1342. pCombo->AddString( szValue );
  1343. }
  1344. }
  1345. pCombo->SetCurSel( 0 );
  1346. }
  1347. //***********************************************************
  1348. // Function:
  1349. // Arguments:
  1350. // Return:
  1351. // Purpose:
  1352. // Author(s):
  1353. // Revision:
  1354. // Date:
  1355. //***********************************************************
  1356. void CSchemaView::DisplayACL(COleDsObject * pObject, CString strAttrName)
  1357. {
  1358. VARIANT var;
  1359. BSTR bstrName;
  1360. IADs* pIADs = NULL;
  1361. IUnknown* pIUnk = NULL;
  1362. HRESULT hResult;
  1363. while( TRUE )
  1364. {
  1365. hResult = pObject->GetInterface( &pIUnk );
  1366. ASSERT( SUCCEEDED( hResult ) );
  1367. if( FAILED( hResult ) )
  1368. break;
  1369. hResult = pIUnk->QueryInterface( IID_IADs, (void**)&pIADs );
  1370. pIUnk->Release( );
  1371. ASSERT( SUCCEEDED( hResult ) );
  1372. if( FAILED( hResult ) )
  1373. break;
  1374. bstrName = AllocBSTR( strAttrName.GetBuffer( 128 ) );
  1375. hResult = pIADs->Get( bstrName, &var );
  1376. SysFreeString( bstrName );
  1377. pIADs->Release( );
  1378. ASSERT( SUCCEEDED( hResult ) );
  1379. if( FAILED( hResult ) )
  1380. break;
  1381. m_pDescriptor = CopySD( V_DISPATCH( &var ) );
  1382. VariantClear( &var );
  1383. {
  1384. //SMITHA IUnknown* pIUnk;
  1385. hResult = m_pDescriptor->QueryInterface( IID_IUnknown,
  1386. (void**)&pIUnk );
  1387. pSecurityDescriptor = new CADsSecurityDescriptor( pIUnk );
  1388. pIUnk->Release( );
  1389. pSecurityDescriptor->SetDocument( GetDocument( ) );
  1390. }
  1391. VariantClear( &var );
  1392. FillACLControls( );
  1393. break;
  1394. }
  1395. }
  1396. //***********************************************************
  1397. // Function: CSchemaView::FillACLControls
  1398. // Arguments:
  1399. // Return:
  1400. // Purpose:
  1401. // Author(s):
  1402. // Revision:
  1403. // Date:
  1404. //***********************************************************
  1405. void CSchemaView::FillACLControls()
  1406. {
  1407. DisplaySDPropertiesList( 0 );
  1408. DisplaySDPropertyValue( );
  1409. DisplayACLNames( 0 );
  1410. DisplayACENames( 0 );
  1411. DisplayACEPropertiesList( 0 );
  1412. DisplayACEPropertyValue( );
  1413. }
  1414. //***********************************************************
  1415. // Function: CSchemaView::DisplayACLNames
  1416. // Arguments:
  1417. // Return:
  1418. // Purpose:
  1419. // Author(s):
  1420. // Revision:
  1421. // Date:
  1422. //***********************************************************
  1423. void CSchemaView::DisplayACLNames( int nSelect )
  1424. {
  1425. CComboBox* pACLNames;
  1426. pACLNames = (CComboBox*)GetDlgItem( IDC_DACLSACL_LIST );
  1427. pACLNames->ResetContent( );
  1428. pACLNames->AddString( _T("DACL") );
  1429. pACLNames->AddString( _T("SACL") );
  1430. pACLNames->SetCurSel( nSelect );
  1431. m_nLastACL = GetCurrentACL( );
  1432. }
  1433. //***********************************************************
  1434. // Function: CSchemaView::DisplayACENames
  1435. // Arguments:
  1436. // Return:
  1437. // Purpose:
  1438. // Author(s):
  1439. // Revision:
  1440. // Date:
  1441. //***********************************************************
  1442. void CSchemaView::DisplayACENames( int nSelect )
  1443. {
  1444. ACLTYPE eType;
  1445. int nACECount, nIdx;
  1446. CComboBox* pACENames;
  1447. CString strACEName;
  1448. CADsAccessControlEntry* pACE;
  1449. CADsAccessControlList* pACL;
  1450. eType = GetCurrentACL( );
  1451. pACENames = (CComboBox*)GetDlgItem( IDC_ACELIST );
  1452. pACENames->ResetContent( );
  1453. pACL = pSecurityDescriptor->GetACLObject( eType );
  1454. if( NULL != pACL )
  1455. {
  1456. nACECount = pACL->GetACECount( );
  1457. for( nIdx = 0; nIdx < nACECount ; nIdx++ )
  1458. {
  1459. pACE = pACL->GetACEObject( nIdx );
  1460. if( NULL != pACE )
  1461. {
  1462. strACEName = pACE->GetItemName( );
  1463. pACENames->AddString( strACEName );
  1464. }
  1465. }
  1466. }
  1467. m_nLastACE = nSelect;
  1468. pACENames->SetCurSel( nSelect );
  1469. }
  1470. //***********************************************************
  1471. // Function: CSchemaView::DisplayACEPropertiesList
  1472. // Arguments:
  1473. // Return:
  1474. // Purpose:
  1475. // Author(s):
  1476. // Revision:
  1477. // Date:
  1478. //***********************************************************
  1479. void CSchemaView::DisplayACEPropertiesList( int nSelect )
  1480. {
  1481. ACLTYPE eType;
  1482. int nACE;
  1483. CComboBox* pACEPropList;
  1484. int nAttrCount, nIdx;
  1485. CString strPropName;
  1486. CADsAccessControlEntry* pACE;
  1487. CADsAccessControlList* pACL;
  1488. eType = GetCurrentACL( );
  1489. nACE = GetCurrentACE( );
  1490. if( -1 == nACE )
  1491. {
  1492. return;
  1493. }
  1494. pACEPropList= (CComboBox*)GetDlgItem( IDC_ACEPROPERTIESLIST );
  1495. pACEPropList->ResetContent( );
  1496. pACL = pSecurityDescriptor->GetACLObject( eType );
  1497. if(NULL == pACL)
  1498. return;
  1499. pACE = pACL->GetACEObject( nACE );
  1500. if(NULL == pACE)
  1501. return;
  1502. nAttrCount = pACE->GetPropertyCount( );
  1503. for( nIdx = 0; nIdx < nAttrCount ; nIdx++ )
  1504. {
  1505. int nPos;
  1506. strPropName = pACE->GetAttribute( nIdx, pa_DisplayName );
  1507. nPos = pACEPropList->AddString( strPropName );
  1508. m_PropList.SetItemData( nPos, (DWORD)nIdx );
  1509. }
  1510. pACEPropList->SetCurSel( nSelect );
  1511. }
  1512. //***********************************************************
  1513. // Function: CSchemaView::DisplaySDPropertiesList
  1514. // Arguments:
  1515. // Return:
  1516. // Purpose:
  1517. // Author(s):
  1518. // Revision:
  1519. // Date:
  1520. //***********************************************************
  1521. void CSchemaView::DisplaySDPropertiesList(int nSelect)
  1522. {
  1523. CComboBox* pSDPropList;
  1524. int nAttrCount, nIdx;
  1525. CString strPropName;
  1526. pSDPropList = (CComboBox*)GetDlgItem( IDC_SECURITYDESCRIPTORPROPERTIES );
  1527. pSDPropList->ResetContent( );
  1528. nAttrCount = pSecurityDescriptor->GetPropertyCount( );
  1529. for( nIdx = 0; nIdx < nAttrCount ; nIdx++ )
  1530. {
  1531. int nPos;
  1532. strPropName = pSecurityDescriptor->GetAttribute( nIdx, pa_DisplayName );
  1533. nPos = pSDPropList->AddString( strPropName );
  1534. m_PropList.SetItemData( nPos, (DWORD)nIdx );
  1535. }
  1536. pSDPropList->SetCurSel( nSelect );
  1537. }
  1538. //***********************************************************
  1539. // Function: CSchemaView::DisplayACEPropertyValue
  1540. // Arguments:
  1541. // Return:
  1542. // Purpose:
  1543. // Author(s):
  1544. // Revision:
  1545. // Date:
  1546. //***********************************************************
  1547. void CSchemaView::DisplayACEPropertyValue( )
  1548. {
  1549. CString strPropValue;
  1550. HRESULT hResult;
  1551. CADsAccessControlEntry* pACE;
  1552. CADsAccessControlList* pACL;
  1553. LONG lValue;
  1554. TCHAR szHex[ 128 ];
  1555. m_nLastACEValue = GetCurrentACEProperty( );
  1556. if( -1 == m_nLastACEValue )
  1557. return;
  1558. if( acl_Invalid == m_nLastACL )
  1559. return;
  1560. if( -1 == m_nLastACE )
  1561. return;
  1562. pACL = pSecurityDescriptor->GetACLObject( m_nLastACL );
  1563. if( NULL == pACL )
  1564. {
  1565. return;
  1566. }
  1567. pACE = pACL->GetACEObject( m_nLastACE );
  1568. if( NULL == pACE )
  1569. return;
  1570. hResult = pACE->GetProperty( m_nLastACEValue, strPropValue );
  1571. switch( m_nLastACEValue )
  1572. {
  1573. case 1:
  1574. case 2:
  1575. case 3:
  1576. case 4:
  1577. lValue = _ttol( strPropValue.GetBuffer( 128 ) );
  1578. _tcscpy( szHex, _T("0x" ) );
  1579. _ltot( lValue, szHex + _tcslen(szHex), 16 );
  1580. strPropValue = szHex;
  1581. break;
  1582. default:
  1583. break;
  1584. }
  1585. GetDlgItem( IDC_ACEPROPERTYVALUE )->SetWindowText(
  1586. strPropValue );
  1587. }
  1588. //***********************************************************
  1589. // Function: CSchemaView::DisplaySDPropertyValue
  1590. // Arguments:
  1591. // Return:
  1592. // Purpose:
  1593. // Author(s):
  1594. // Revision:
  1595. // Date:
  1596. //***********************************************************
  1597. void CSchemaView::DisplaySDPropertyValue( )
  1598. {
  1599. CString strPropValue, strEditValue;
  1600. HRESULT hResult;
  1601. m_nLastSDValue = GetCurrentSDProperty( );
  1602. hResult = pSecurityDescriptor->GetProperty( m_nLastSDValue,
  1603. strPropValue );
  1604. GetDlgItem( IDC_SECURITYDESCRIPTORPROPERTYVALUE )->SetWindowText(
  1605. strPropValue );
  1606. }
  1607. //***********************************************************
  1608. // Function: CSchemaView::PutACEPropertyValue
  1609. // Arguments:
  1610. // Return:
  1611. // Purpose:
  1612. // Author(s):
  1613. // Revision:
  1614. // Date:
  1615. //***********************************************************
  1616. void CSchemaView::PutACEPropertyValue( )
  1617. {
  1618. ACLTYPE eType;
  1619. int nACE;
  1620. CString strPropValue, strEditValue;
  1621. CADsAccessControlEntry* pACE;
  1622. CADsAccessControlList* pACL;
  1623. HRESULT hResult;
  1624. if( -1 == m_nLastACEValue )
  1625. return;
  1626. if( acl_Invalid == m_nLastACL )
  1627. return;
  1628. if( -1 == m_nLastACE )
  1629. return;
  1630. eType = m_nLastACL;
  1631. nACE = m_nLastACE;
  1632. pACL = pSecurityDescriptor->GetACLObject( eType );
  1633. if( NULL == pACL )
  1634. return;
  1635. pACE = pACL->GetACEObject( nACE );
  1636. GetDlgItem( IDC_ACEPROPERTYVALUE )->GetWindowText( strEditValue );
  1637. switch( m_nLastACEValue )
  1638. {
  1639. case 1:
  1640. case 2:
  1641. case 3:
  1642. case 4:
  1643. {
  1644. LONG lValue = 0;
  1645. TCHAR szText[ 16 ];
  1646. int nRet = 0;
  1647. nRet = _stscanf( strEditValue.GetBuffer( 128 ), _T("%lx"), &lValue );
  1648. _ltot( lValue, szText, 10 );
  1649. strEditValue = szText;
  1650. break;
  1651. }
  1652. default:
  1653. break;
  1654. }
  1655. hResult = pACE->GetProperty( m_nLastACEValue, strPropValue );
  1656. if( strEditValue.Compare( strPropValue ) )
  1657. {
  1658. hResult = pACE->PutProperty( m_nLastACEValue, strEditValue );
  1659. }
  1660. }
  1661. //***********************************************************
  1662. // Function: CSchemaView::PutSDPropertyValue
  1663. // Arguments:
  1664. // Return:
  1665. // Purpose:
  1666. // Author(s):
  1667. // Revision:
  1668. // Date:
  1669. //***********************************************************
  1670. void CSchemaView::PutSDPropertyValue()
  1671. {
  1672. CString strPropValue, strEditValue;
  1673. HRESULT hResult;
  1674. if( -1 == m_nLastSDValue )
  1675. return;
  1676. hResult = pSecurityDescriptor->GetProperty( m_nLastSDValue,
  1677. strPropValue );
  1678. GetDlgItem( IDC_SECURITYDESCRIPTORPROPERTYVALUE )->GetWindowText(
  1679. strEditValue );
  1680. if( strEditValue.Compare( strPropValue ) )
  1681. {
  1682. hResult = pSecurityDescriptor->PutProperty( m_nLastACEValue,
  1683. strEditValue );
  1684. }
  1685. }
  1686. //***********************************************************
  1687. // Function: CSchemaView::GetCurrentACL
  1688. // Arguments:
  1689. // Return:
  1690. // Purpose:
  1691. // Author(s):
  1692. // Revision:
  1693. // Date:
  1694. //***********************************************************
  1695. ACLTYPE CSchemaView::GetCurrentACL()
  1696. {
  1697. CComboBox* pList;
  1698. pList = (CComboBox*) GetDlgItem( IDC_DACLSACL_LIST );
  1699. return (ACLTYPE) ( 1 + pList->GetCurSel( ) );
  1700. }
  1701. //***********************************************************
  1702. // Function: CSchemaView::GetCurrentACE
  1703. // Arguments:
  1704. // Return:
  1705. // Purpose:
  1706. // Author(s):
  1707. // Revision:
  1708. // Date:
  1709. //***********************************************************
  1710. int CSchemaView::GetCurrentACE()
  1711. {
  1712. CComboBox* pList;
  1713. pList = (CComboBox*) GetDlgItem( IDC_ACELIST );
  1714. return pList->GetCurSel( );
  1715. }
  1716. //***********************************************************
  1717. // Function: CSchemaView::GetCurrentSDProperty
  1718. // Arguments:
  1719. // Return:
  1720. // Purpose:
  1721. // Author(s):
  1722. // Revision:
  1723. // Date:
  1724. //***********************************************************
  1725. int CSchemaView::GetCurrentSDProperty( )
  1726. {
  1727. CComboBox* pList;
  1728. pList = (CComboBox*) GetDlgItem( IDC_SECURITYDESCRIPTORPROPERTIES );
  1729. return pList->GetCurSel( );
  1730. }
  1731. //***********************************************************
  1732. // Function: CSchemaView::GetCurrentACEProperty
  1733. // Arguments:
  1734. // Return:
  1735. // Purpose:
  1736. // Author(s):
  1737. // Revision:
  1738. // Date:
  1739. //***********************************************************
  1740. int CSchemaView::GetCurrentACEProperty( )
  1741. {
  1742. CComboBox* pList;
  1743. pList = (CComboBox*) GetDlgItem( IDC_ACEPROPERTIESLIST );
  1744. return pList->GetCurSel( );
  1745. }
  1746. //***********************************************************
  1747. // Function: CSchemaView::OnACEChange
  1748. // Arguments:
  1749. // Return:
  1750. // Purpose:
  1751. // Author(s):
  1752. // Revision:
  1753. // Date:
  1754. //***********************************************************
  1755. void CSchemaView::OnACEChange( )
  1756. {
  1757. // TODO: Add your control notification handler code here
  1758. PutACEPropertyValue( );
  1759. m_nLastACE = GetCurrentACE( );
  1760. DisplayACEPropertiesList( 0 );
  1761. DisplayACEPropertyValue( );
  1762. }
  1763. //***********************************************************
  1764. // Function: CSchemaView::OnACEPropertyChange
  1765. // Arguments:
  1766. // Return:
  1767. // Purpose:
  1768. // Author(s):
  1769. // Revision:
  1770. // Date:
  1771. //***********************************************************
  1772. void CSchemaView::OnACEPropertyChange()
  1773. {
  1774. // TODO: Add your control notification handler code here
  1775. PutACEPropertyValue( );
  1776. DisplayACEPropertyValue( );
  1777. }
  1778. //***********************************************************
  1779. // Function: CSchemaView::OnACLChange
  1780. // Arguments:
  1781. // Return:
  1782. // Purpose:
  1783. // Author(s):
  1784. // Revision:
  1785. // Date:
  1786. //***********************************************************
  1787. void CSchemaView::OnACLChange()
  1788. {
  1789. // TODO: Add your control notification handler code here
  1790. PutACEPropertyValue( );
  1791. m_nLastACL = GetCurrentACL( );
  1792. DisplayACENames( 0 );
  1793. DisplayACEPropertiesList( 0 );
  1794. DisplayACEPropertyValue( );
  1795. }
  1796. //***********************************************************
  1797. // Function: CSchemaView::OnSDPropertyChange
  1798. // Arguments:
  1799. // Return:
  1800. // Purpose:
  1801. // Author(s):
  1802. // Revision:
  1803. // Date:
  1804. //***********************************************************
  1805. void CSchemaView::OnSDPropertyChange()
  1806. {
  1807. // TODO: Add your control notification handler code here
  1808. PutSDPropertyValue( );
  1809. DisplaySDPropertyValue( );
  1810. }
  1811. //***********************************************************
  1812. // Function: CSchemaView::OnAddACE
  1813. // Arguments:
  1814. // Return:
  1815. // Purpose:
  1816. // Author(s):
  1817. // Revision:
  1818. // Date:
  1819. //***********************************************************
  1820. void CSchemaView::OnAddACE()
  1821. {
  1822. // TODO: Add your control notification handler code here
  1823. ACLTYPE aclType;
  1824. HRESULT hResult;
  1825. aclType = GetCurrentACL( );
  1826. if( acl_Invalid != aclType )
  1827. {
  1828. IDispatch* pACEDisp;
  1829. IUnknown* pACEUnk;
  1830. CADsAccessControlEntry* pACE = new CADsAccessControlEntry;
  1831. pACEDisp = pACE->CreateACE( );
  1832. delete pACE;
  1833. if( NULL != pACEDisp )
  1834. {
  1835. hResult = pACEDisp->QueryInterface( IID_IUnknown, (void**)&pACEUnk );
  1836. pACEDisp->Release( );
  1837. hResult = pSecurityDescriptor->AddACE( aclType, pACEUnk );
  1838. pACEUnk->Release( );
  1839. FillACLControls( );
  1840. }
  1841. }
  1842. }
  1843. //***********************************************************
  1844. // Function: CSchemaView::OnCopyACE
  1845. // Arguments:
  1846. // Return:
  1847. // Purpose:
  1848. // Author(s):
  1849. // Revision:
  1850. // Date:
  1851. //***********************************************************
  1852. void CSchemaView::OnCopyACE()
  1853. {
  1854. // TODO: Add your control notification handler code here
  1855. int nACE;
  1856. IDispatch* pDisp;
  1857. ACLTYPE aclType;
  1858. aclType = GetCurrentACL( );
  1859. nACE = GetCurrentACE( );
  1860. pDisp = CopyACE( pSecurityDescriptor->GetACLObject( aclType )->GetACEObject( nACE )->GetACE( ) );
  1861. if( NULL != pACEClipboard )
  1862. {
  1863. pACEClipboard->Release( );
  1864. }
  1865. pACEClipboard = pDisp;
  1866. }
  1867. //***********************************************************
  1868. // Function: CSchemaView::OnPasteACE
  1869. // Arguments:
  1870. // Return:
  1871. // Purpose:
  1872. // Author(s):
  1873. // Revision:
  1874. // Date:
  1875. //***********************************************************
  1876. void CSchemaView::OnPasteACE()
  1877. {
  1878. // TODO: Add your control notification handler code here
  1879. IUnknown* pACEUnk;
  1880. ACLTYPE aclType;
  1881. HRESULT hResult;
  1882. aclType = GetCurrentACL( );
  1883. if( NULL != pACEClipboard )
  1884. {
  1885. hResult = pACEClipboard->QueryInterface( IID_IUnknown, (void**)&pACEUnk );
  1886. hResult = pSecurityDescriptor->AddACE( aclType, pACEUnk );
  1887. pACEUnk->Release( );
  1888. FillACLControls( );
  1889. }
  1890. }
  1891. void CSchemaView::OnRemoveACE()
  1892. {
  1893. // TODO: Add your control notification handler code here
  1894. // TODO: Add your control notification handler code here
  1895. ACLTYPE aclType;
  1896. HRESULT hResult;
  1897. int nCurrentACE;
  1898. aclType = GetCurrentACL( );
  1899. nCurrentACE = GetCurrentACE( );
  1900. if( acl_Invalid != aclType )
  1901. {
  1902. IDispatch* pACEDisp;
  1903. IUnknown* pACEUnk;
  1904. pACEDisp = pSecurityDescriptor->GetACLObject( aclType )->GetACEObject( nCurrentACE )->GetACE( );
  1905. if( NULL != pACEDisp )
  1906. {
  1907. hResult = pACEDisp->QueryInterface( IID_IUnknown, (void**)&pACEUnk );
  1908. pACEDisp->Release( );
  1909. hResult = pSecurityDescriptor->RemoveACE( aclType, pACEUnk );
  1910. pACEUnk->Release( );
  1911. FillACLControls( );
  1912. }
  1913. }
  1914. }