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.

94 lines
2.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation 1996-2001.
  5. //
  6. // File: lright.cpp
  7. //
  8. // Contents: implementation of CLocalPolRight
  9. //
  10. //----------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include "wsecmgr.h"
  13. #include "snapmgr.h"
  14. #include "attr.h"
  15. #include "util.h"
  16. #include "chklist.h"
  17. #include "getuser.h"
  18. #include "lright.h"
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CLocalPolRight dialog
  26. CLocalPolRight::CLocalPolRight()
  27. : CConfigPrivs(IDD)
  28. {
  29. m_pHelpIDs = (DWORD_PTR)a231HelpIDs;
  30. m_uTemplateResID = IDD;
  31. }
  32. BEGIN_MESSAGE_MAP(CLocalPolRight, CConfigPrivs)
  33. //{{AFX_MSG_MAP(CConfigPrivs)
  34. ON_BN_CLICKED(IDC_ADD, OnAdd)
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. PSCE_PRIVILEGE_ASSIGNMENT
  38. CLocalPolRight::GetPrivData() {
  39. ASSERT(m_pData);
  40. if (m_pData) {
  41. return (PSCE_PRIVILEGE_ASSIGNMENT) m_pData->GetBase();
  42. }
  43. return NULL;
  44. }
  45. void
  46. CLocalPolRight::SetPrivData(PSCE_PRIVILEGE_ASSIGNMENT ppa) {
  47. ASSERT(m_pData);
  48. if (m_pData) {
  49. m_pSnapin->UpdateLocalPolInfo(m_pData,
  50. FALSE,
  51. &ppa,
  52. m_pData->GetUnits()
  53. );
  54. m_pData->SetBase((LONG_PTR)ppa);
  55. }
  56. }
  57. void CLocalPolRight::OnAdd() {
  58. CGetUser gu;
  59. if (gu.Create( GetSafeHwnd(),
  60. SCE_SHOW_USERS |
  61. SCE_SHOW_LOCALGROUPS |
  62. SCE_SHOW_GLOBAL |
  63. SCE_SHOW_WELLKNOWN |
  64. SCE_SHOW_BUILTIN |
  65. SCE_SHOW_SCOPE_ALL |
  66. SCE_SHOW_DIFF_MODE_OFF_DC |
  67. SCE_SHOW_COMPUTER)) { //Raid #477428, Yanggao
  68. PSCE_NAME_LIST pName = gu.GetUsers();
  69. CListBox *plbGrant = (CListBox*)GetDlgItem(IDC_GRANTLIST);
  70. while(pName)
  71. {
  72. if (plbGrant &&
  73. (LB_ERR == plbGrant->FindStringExact(-1,pName->Name)))
  74. {
  75. plbGrant->AddString(pName->Name);
  76. m_fDirty = true;
  77. SetModified(TRUE); //Raid #389890, 5/11/2001
  78. }
  79. pName = pName->Next;
  80. }
  81. }
  82. }