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.

167 lines
5.5 KiB

  1. #ifndef __IEAKSIE_RSOP_H__
  2. #define __IEAKSIE_RSOP_H__
  3. #include <comdef.h>
  4. #include <time.h>
  5. #include "wbemcli.h"
  6. #include "SComPtr.h"
  7. /////////////////////////////////////////////////////////////////////
  8. typedef struct _RSOPPAGECOOKIE
  9. {
  10. LPPROPSHEETCOOKIE psCookie;
  11. long nPageID;
  12. } RSOPPAGECOOKIE, *LPRSOPPAGECOOKIE;
  13. UINT CALLBACK RSOPPageProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp);
  14. /////////////////////////////////////////////////////////////////////
  15. typedef struct _WMI_CERT_INFO_STRUCT
  16. {
  17. LPWSTR wszSubject;
  18. LPWSTR wszIssuer;
  19. BOOL bExpirationValid;
  20. FILETIME ftExpiration;
  21. LPWSTR wszFriendlyName;
  22. LPWSTR wszPurposes;
  23. struct _WMI_CERT_INFO_STRUCT *pNext;
  24. } WMI_CERT_INFO;
  25. /////////////////////////////////////////////////////////////////////
  26. class CPSObjData
  27. {
  28. public:
  29. CPSObjData(): pObj(NULL), dwPrecedence(0) {}
  30. ComPtr<IWbemClassObject> pObj;
  31. DWORD dwPrecedence;
  32. };
  33. /////////////////////////////////////////////////////////////////////
  34. // CDlgRSoPData
  35. /////////////////////////////////////////////////////////////////////
  36. class CDlgRSoPData
  37. {
  38. public:
  39. CDlgRSoPData(CSnapIn *pCS);
  40. ~CDlgRSoPData();
  41. // operations
  42. public:
  43. ComPtr<IWbemServices> ConnectToNamespace();
  44. _bstr_t GetGPONameFromPS(ComPtr<IWbemClassObject> pPSObj);
  45. _bstr_t GetGPONameFromPSAssociation(ComPtr<IWbemClassObject> pPSObj,
  46. BSTR bstrPrecedenceProp);
  47. HRESULT GetArrayOfPSObjects(BSTR bstrClass, BSTR bstrPrecedenceProp = NULL,
  48. CPSObjData ***ppaPSObj = NULL, long *pnObjCount = NULL);
  49. HRESULT LoadContentRatingsObject();
  50. // attributes
  51. public:
  52. BSTR GetNamespace() {return m_pCS->GetRSoPNamespace();}
  53. ComPtr<IWbemServices> GetWbemServices() {return m_pWbemServices;}
  54. CPSObjData **GetPSObjArray() {return m_paPSObj;}
  55. long GetPSObjCount() {return m_nPSObjects;}
  56. CPSObjData **GetCSObjArray() {return m_paCSObj;}
  57. long GetCSObjCount() {return m_nCSObjects;}
  58. ComPtr<IWbemClassObject> GetContentRatingsObject() {return m_pCRatObj;}
  59. void SetImportedProgSettPrec(DWORD dwPrec) {m_dwImportedProgSettPrec = dwPrec;}
  60. DWORD GetImportedProgSettPrec() {return m_dwImportedProgSettPrec;}
  61. void SetImportedConnSettPrec(DWORD dwPrec) {m_dwImportedConnSettPrec = dwPrec;}
  62. DWORD GetImportedConnSettPrec() {return m_dwImportedConnSettPrec;}
  63. void SetImportedSecZonesPrec(DWORD dwPrec) {m_dwImportedSecZonesPrec = dwPrec;}
  64. DWORD GetImportedSecZonesPrec() {return m_dwImportedSecZonesPrec;}
  65. void SetImportedSecRatingsPrec(DWORD dwPrec) {m_dwImportedSecRatingsPrec = dwPrec;}
  66. DWORD GetImportedSecRatingsPrec() {return m_dwImportedSecRatingsPrec;}
  67. void SetImportedAuthenticodePrec(DWORD dwPrec) {m_dwImportedAuthenticodePrec = dwPrec;}
  68. DWORD GetImportedAuthenticodePrec() {return m_dwImportedAuthenticodePrec;}
  69. void SetImportedSecZoneCount(DWORD dwCount) {m_dwImportedSecZones = dwCount;}
  70. DWORD GetImportedSecZoneCount() {return m_dwImportedSecZones;}
  71. void SetPlanningMode(BOOL fMode) { m_fPlanning = fMode;}
  72. BOOL IsPlanningMode() { return m_fPlanning;}
  73. // for authenticode certificates
  74. WMI_CERT_INFO *m_pwci[5];
  75. int m_iCurColumn;
  76. DWORD m_rgdwSortParam[5];
  77. // implementation
  78. public:
  79. private:
  80. static int __cdecl ComparePSObjectsByPrecedence(const void *arg1, const void *arg2);
  81. void UninitCertInfo();
  82. CSnapIn *m_pCS;
  83. ComPtr<IWbemServices> m_pWbemServices;
  84. CPSObjData **m_paPSObj;
  85. long m_nPSObjects;
  86. CPSObjData **m_paCSObj;
  87. long m_nCSObjects;
  88. BOOL m_fPlanning;
  89. ComPtr<IWbemClassObject> m_pCRatObj; // store this for the multiple pages that use it
  90. DWORD m_dwImportedProgSettPrec;
  91. DWORD m_dwImportedConnSettPrec;
  92. DWORD m_dwImportedSecZonesPrec;
  93. DWORD m_dwImportedSecRatingsPrec;
  94. DWORD m_dwImportedAuthenticodePrec;
  95. DWORD m_dwImportedSecZones;
  96. };
  97. /////////////////////////////////////////////////////////////////////
  98. // cached string functions
  99. LPCTSTR GetDisabledString();
  100. LPCTSTR GetEnabledString();
  101. /////////////////////////////////////////////////////////////////////
  102. // variant utilities
  103. BOOL IsVariantNull(const VARIANT &v);
  104. BOOL GetWMIPropBool(IWbemClassObject *pObj, BSTR bstrProp, BOOL fDefault, BOOL &fHandled);
  105. DWORD GetWMIPropUL(IWbemClassObject *pObj, BSTR bstrProp, DWORD dwDefault, BOOL &fHandled);
  106. void GetWMIPropPWSTR(IWbemClassObject *pObj, BSTR bstrProp, LPWSTR wszBuffer,
  107. DWORD dwBufferLen, LPWSTR wszDefault, BOOL &fHandled);
  108. void GetWMIPropPTSTR(IWbemClassObject *pObj, BSTR bstrProp, LPTSTR szBuffer,
  109. DWORD dwBufferLen, LPTSTR szDefault, BOOL &fHandled);
  110. /////////////////////////////////////////////////////////////////////
  111. // IEAK RSoP-related functions
  112. CDlgRSoPData *GetDlgRSoPData(HWND hDlg, CSnapIn *pCS);
  113. void DestroyDlgRSoPData(HWND hDlg);
  114. /////////////////////////////////////////////////////////////////////
  115. // IEAK Policy Setting property retrieval functions
  116. _bstr_t GetGPOSetting(ComPtr<IWbemClassObject> pPSObj, BSTR bstrSettingName);
  117. DWORD GetGPOPrecedence(ComPtr<IWbemClassObject> pPSObj, BSTR bstrProp = NULL);
  118. HRESULT InitGenericPrecedencePage(CDlgRSoPData *pDRD, HWND hwndList, BSTR bstrPropName);
  119. /////////////////////////////////////////////////////////////////////
  120. // Precedence page list control functions
  121. void InsertPrecedenceListItem(HWND hwndList, long nItem, LPTSTR szName, LPTSTR szSetting);
  122. // INetCpl-related functions
  123. int CreateINetCplLookALikePage(HWND hwndParent, UINT nID, DLGPROC dlgProc,
  124. LPARAM lParam);
  125. #endif //__IEAKSIE_RSOP_H__