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.2 KiB

  1. // SomFilterManager.cpp : Implementation of CSomFilterManager
  2. #include "stdafx.h"
  3. #include <wbemidl.h>
  4. #include "resource.h"
  5. #include "defines.h"
  6. #include "ntdmutils.h"
  7. #include "SchemaManager.h"
  8. #include "SomFilterManager.h"
  9. #include "SomFilterMgrDlg.h"
  10. extern CSomFilterManagerDlg * g_pFilterManagerDlg;
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CSomFilterManager
  13. CSomFilterManager::CSomFilterManager()
  14. {
  15. m_hWnd = NULL;
  16. }
  17. //---------------------------------------------------------------------------
  18. CSomFilterManager::~CSomFilterManager()
  19. {
  20. }
  21. //---------------------------------------------------------------------------
  22. STDMETHODIMP CSomFilterManager::ConnectToWMI()
  23. {
  24. HRESULT hr;
  25. CComPtr<IWbemLocator>pIWbemLocator;
  26. NTDM_BEGIN_METHOD()
  27. m_pIWbemServices = NULL;
  28. // create the webm locator
  29. NTDM_ERR_MSG_IF_FAIL(CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER,
  30. IID_IWbemLocator, (LPVOID *) &pIWbemLocator));
  31. NTDM_ERR_MSG_IF_FAIL(pIWbemLocator->ConnectServer( _T("root\\policy"),
  32. NULL,
  33. NULL,
  34. NULL,
  35. 0,
  36. NULL,
  37. NULL,
  38. &m_pIWbemServices));
  39. NTDM_ERR_MSG_IF_FAIL(CoSetProxyBlanket(m_pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
  40. RPC_C_AUTHN_LEVEL_CONNECT, RPC_C_IMP_LEVEL_IMPERSONATE ,
  41. NULL, EOAC_NONE));
  42. NTDM_END_METHOD()
  43. // cleanup
  44. return hr;
  45. }
  46. //---------------------------------------------------------------------------
  47. STDMETHODIMP CSomFilterManager::RunManager(HWND hwndParent, VARIANT *vSelection)
  48. {
  49. HRESULT hr;
  50. NTDM_BEGIN_METHOD()
  51. m_hWnd = hwndParent;
  52. NTDM_ERR_IF_FAIL(ConnectToWMI());
  53. g_pFilterManagerDlg = new CSomFilterManagerDlg(this);
  54. DialogBox(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDD_SOM_FILTER_MANAGER), (HWND)hwndParent, SomFilterManagerDlgProc);
  55. NTDM_END_METHOD()
  56. // cleanup
  57. NTDM_DELETE_OBJECT(g_pFilterManagerDlg);
  58. return hr;
  59. }
  60. //--------------------------------------------------------------------------
  61. STDMETHODIMP CSomFilterManager::SetMultiSelection(VARIANT_BOOL vbValue)
  62. {
  63. // TODO: Add your implementation code here
  64. return S_OK;
  65. }