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.

120 lines
3.0 KiB

  1. // This is a part of the Microsoft Management Console.
  2. // Copyright (C) Microsoft Corporation, 1995 - 1999
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Management Console and related
  7. // electronic documentation provided with the interfaces.
  8. #ifndef _SERVICE_H
  9. #define _SERVICE_H
  10. #include "certca.h"
  11. // Forward declarations
  12. class CSnapin;
  13. class CFolder;
  14. // Internal structure used for cookies
  15. struct FOLDER_DATA
  16. {
  17. wchar_t* szName;
  18. wchar_t* szSize;
  19. wchar_t* szType;
  20. FOLDER_TYPES type;
  21. };
  22. #define MAX_RESULTDATA_STRINGS 64
  23. struct RESULT_DATA
  24. {
  25. SCOPE_TYPES itemType;
  26. CFolder* pParentFolder;
  27. DWORD cStringArray;
  28. LPWSTR szStringArray[MAX_RESULTDATA_STRINGS];
  29. };
  30. enum
  31. {
  32. RESULTDATA_ARRAYENTRY_NAME =0,
  33. RESULTDATA_ARRAYENTRY_SIZE,
  34. RESULTDATA_ARRAYENTRY_TYPE,
  35. };
  36. class CFolder
  37. {
  38. SCOPE_TYPES m_itemType; // Used for debug purposes. This should be the first
  39. // member. The class should not have any virtual fuctions.
  40. friend class CSnapin;
  41. friend class CComponentDataImpl;
  42. public:
  43. // UNINITIALIZED is an invalid memory address and is a good cookie initializer
  44. CFolder()
  45. {
  46. m_itemType = UNINITIALIZED_ITEM;
  47. m_cookie = UNINITIALIZED;
  48. m_enumed = FALSE;
  49. m_pScopeItem = NULL;
  50. m_type = NONE;
  51. m_pszName = NULL;
  52. m_hCAInfo = NULL;
  53. m_hCertType = NULL;
  54. m_dwSCEMode = 0;
  55. m_fGlobalCertType = FALSE;
  56. m_fMachineFolder = FALSE;
  57. };
  58. ~CFolder();
  59. // Interface
  60. public:
  61. BOOL IsEnumerated() { return m_enumed; };
  62. void Set(BOOL state) { m_enumed = state; };
  63. void SetCookie(MMC_COOKIE cookie) { m_cookie = cookie; }
  64. FOLDER_TYPES GetType() { ASSERT(m_type != NONE); return m_type; };
  65. BOOL operator == (const CFolder& rhs) const { return rhs.m_cookie == m_cookie; };
  66. BOOL operator == (MMC_COOKIE cookie) const { return cookie == m_cookie; };
  67. void SetName(LPWSTR pszIn)
  68. {
  69. UINT len = wcslen(pszIn) + 1;
  70. LPWSTR psz = (LPWSTR)CoTaskMemAlloc(len * sizeof(WCHAR));
  71. if (psz != NULL)
  72. {
  73. wcscpy(psz, pszIn);
  74. CoTaskMemFree(m_pszName);
  75. m_pszName = psz;
  76. }
  77. }
  78. // Implementation
  79. private:
  80. void Create(
  81. LPCWSTR szName,
  82. int nImage,
  83. int nOpenImage,
  84. SCOPE_TYPES itemType,
  85. FOLDER_TYPES type,
  86. BOOL bHasChildren = FALSE);
  87. // Attributes
  88. private:
  89. LPSCOPEDATAITEM m_pScopeItem;
  90. MMC_COOKIE m_cookie;
  91. BOOL m_enumed;
  92. FOLDER_TYPES m_type;
  93. LPOLESTR m_pszName;
  94. CString m_szCAName;
  95. CString m_szIntendedUsages;
  96. HCAINFO m_hCAInfo;
  97. HCERTTYPE m_hCertType;
  98. DWORD m_dwSCEMode;
  99. BOOL m_fGlobalCertType;
  100. BOOL m_fMachineFolder;
  101. };
  102. #endif