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.

123 lines
3.2 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. m_dwRoles = 0;
  58. };
  59. ~CFolder();
  60. // Interface
  61. public:
  62. BOOL IsEnumerated() { return m_enumed; };
  63. void Set(BOOL state) { m_enumed = state; };
  64. void SetCookie(MMC_COOKIE cookie) { m_cookie = cookie; }
  65. FOLDER_TYPES GetType() { ASSERT(m_type != NONE); return m_type; };
  66. BOOL operator == (const CFolder& rhs) const { return rhs.m_cookie == m_cookie; };
  67. BOOL operator == (MMC_COOKIE cookie) const { return cookie == m_cookie; };
  68. void SetName(LPWSTR pszIn)
  69. {
  70. UINT len = wcslen(pszIn) + 1;
  71. LPWSTR psz = (LPWSTR)CoTaskMemAlloc(len * sizeof(WCHAR));
  72. if (psz != NULL)
  73. {
  74. wcscpy(psz, pszIn);
  75. CoTaskMemFree(m_pszName);
  76. m_pszName = psz;
  77. }
  78. }
  79. DWORD GetRoles() { return m_dwRoles; }
  80. // Implementation
  81. private:
  82. void Create(
  83. LPCWSTR szName,
  84. int nImage,
  85. int nOpenImage,
  86. SCOPE_TYPES itemType,
  87. FOLDER_TYPES type,
  88. BOOL bHasChildren = FALSE);
  89. // Attributes
  90. private:
  91. LPSCOPEDATAITEM m_pScopeItem;
  92. MMC_COOKIE m_cookie;
  93. BOOL m_enumed;
  94. FOLDER_TYPES m_type;
  95. LPOLESTR m_pszName;
  96. CString m_szCAName;
  97. CString m_szIntendedUsages;
  98. HCAINFO m_hCAInfo;
  99. HCERTTYPE m_hCertType;
  100. DWORD m_dwSCEMode;
  101. BOOL m_fGlobalCertType;
  102. BOOL m_fMachineFolder;
  103. DWORD m_dwRoles;
  104. };
  105. #endif