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.

111 lines
3.1 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright (c) 1998-1999 Microsoft Corporation
  4. //
  5. // pathcrak.h
  6. //
  7. // alanbos 27-Mar-00 Created.
  8. //
  9. // CWbemPathCracker definition
  10. //
  11. //***************************************************************************
  12. #ifndef _PATHCRAK_H_
  13. #define _PATHCRAK_H_
  14. class CWbemPathCracker : public IUnknown
  15. {
  16. public:
  17. CWbemPathCracker (const CComBSTR & bsPath);
  18. CWbemPathCracker (CWbemPathCracker & path);
  19. CWbemPathCracker (void);
  20. virtual ~CWbemPathCracker (void);
  21. STDMETHODIMP QueryInterface(REFIID, LPVOID*);
  22. STDMETHODIMP_(ULONG) AddRef(void);
  23. STDMETHODIMP_(ULONG) Release(void);
  24. typedef enum {
  25. wbemPathTypeError = 0,
  26. wbemPathTypeWmi,
  27. } WbemPathType;
  28. WbemPathType GetType () const
  29. {
  30. return m_type;
  31. }
  32. bool GetParent (CWbemPathCracker & path);
  33. bool operator == (const CComBSTR & path);
  34. const CWbemPathCracker & operator = (CWbemPathCracker & path);
  35. bool operator = (const CComBSTR & path);
  36. // Path composition
  37. bool operator += (const CComBSTR & bsObjectPath);
  38. // Server
  39. bool GetServer (CComBSTR & bsPath);
  40. bool SetServer (const CComBSTR & bsPath);
  41. // Namespace
  42. bool GetNamespacePath (CComBSTR & bsPath, bool bParentOnly = false);
  43. bool SetNamespacePath (const CComBSTR & bsPath);
  44. bool GetNamespaceCount (unsigned long & lCount);
  45. // Component
  46. bool GetComponent (ULONG iIndex, CComBSTR & bsPath);
  47. bool GetComponentCount (ULONG & iCount);
  48. bool AddComponent (ULONG iIndex, const CComBSTR &bsComponent);
  49. bool SetComponent (ULONG iIndex, const CComBSTR &bsComponent);
  50. bool RemoveComponent (ULONG iIndex);
  51. bool RemoveAllComponents ();
  52. // Keys
  53. bool GetKeys(ISWbemNamedValueSet **objKeys);
  54. bool GetKey (ULONG iIndex, CComBSTR & bsName, VARIANT & var, WbemCimtypeEnum &cimType);
  55. bool GetKeyCount (ULONG & iCount);
  56. bool SetKey (const CComBSTR & bsName, WbemCimtypeEnum cimType, VARIANT & var);
  57. bool RemoveKey (const CComBSTR & bsName);
  58. bool RemoveAllKeys ();
  59. // Class & Instance
  60. bool IsClassOrInstance ();
  61. bool IsClass ();
  62. bool IsInstance ();
  63. bool IsSingleton ();
  64. bool SetAsClass ();
  65. bool SetAsSingleton ();
  66. bool IsRelative ();
  67. bool GetPathText (CComBSTR & bsPath, bool bRelativeOnly = false,
  68. bool bIncludeServer = false, bool bNamespaceOnly = false);
  69. bool SetRelativePath (const CComBSTR & bsPath);
  70. bool GetClass (CComBSTR & bsPath);
  71. bool SetClass (const CComBSTR &bsPath);
  72. private:
  73. CComPtr<IWbemPath> m_pIWbemPath;
  74. CComBSTR m_bsNativePath;
  75. long m_cRef;
  76. WbemPathType m_type;
  77. void CreateParsers ();
  78. void SetText (const CComBSTR & bsPath, bool bForceAsNamespace = false);
  79. static WbemPathType GetTypeFromText (const CComBSTR & bsPath);
  80. bool CopyServerAndNamespace (CWbemPathCracker &pathCracker);
  81. bool GetNamespaceAt (ULONG iIndex, CComBSTR & bsPath);
  82. bool SetNamespaceAt (ULONG iIndex, const CComBSTR & bsPath);
  83. bool RemoveNamespace (ULONG iIndex);
  84. void ClearNamespace ();
  85. bool SetAsParent ();
  86. bool ClearKeys (bool bTreatAsClass = true);
  87. };
  88. #endif