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.

188 lines
6.9 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. regprop.h
  5. Abstract:
  6. This module contains the definition for the Server
  7. Extension Object Registry Property Bag.
  8. Author:
  9. Don Dumitru (dondu@microsoft.com)
  10. Revision History:
  11. dondu 11/26/96 created
  12. andyj 02/12/97 Converted PropertyBag's to Dictonary's
  13. --*/
  14. // REGPROP.h : Declaration of the CSEORegDictionary
  15. class CAndyString { // Temporary until we get std::string to work
  16. public:
  17. CAndyString() {m_string[0] = 0;}
  18. CAndyString(CAndyString &as) {lstrcpyn(m_string, as.m_string, sizeof(m_string));};
  19. LPCSTR data() {return m_string;};
  20. BOOL empty() {return (length() < 1);};
  21. int length() {return strlen(m_string);};
  22. void erase(int pos, int len = 1) {m_string[pos] = 0;};
  23. CAndyString &operator=(LPCSTR s) {lstrcpyn(m_string, s, sizeof(m_string)); return *this;};
  24. CAndyString &operator+=(LPCSTR s)
  25. {
  26. strncat(m_string, s, (sizeof(m_string)-strlen(m_string))-1);
  27. m_string[sizeof(m_string)-1]='\0';
  28. return *this;
  29. };
  30. char operator[](int i) {return m_string[i];};
  31. private:
  32. char m_string[MAX_PATH + 1];
  33. };
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CSEORegDictionary
  36. class ATL_NO_VTABLE CSEORegDictionary :
  37. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  38. public CComCoClass<CSEORegDictionary, &CLSID_CSEORegDictionary>,
  39. public IDispatchImpl<ISEORegDictionary, &IID_ISEORegDictionary, &LIBID_SEOLib>
  40. {
  41. friend class CSEORegDictionaryEnum; // Helper class
  42. public:
  43. HRESULT FinalConstruct();
  44. void FinalRelease();
  45. DECLARE_PROTECT_FINAL_CONSTRUCT();
  46. DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  47. L"SEORegDictionary Class",
  48. L"SEO.SEORegDictionary.1",
  49. L"SEO.SEORegDictionary");
  50. BEGIN_COM_MAP(CSEORegDictionary)
  51. COM_INTERFACE_ENTRY(ISEORegDictionary)
  52. COM_INTERFACE_ENTRY(ISEODictionary)
  53. // COM_INTERFACE_ENTRY(IDispatch)
  54. // COM_INTERFACE_ENTRY(ISupportErrorInfo)
  55. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  56. END_COM_MAP()
  57. // ISEORegDictionary
  58. public:
  59. virtual /* [id][propget][helpstring] */ HRESULT STDMETHODCALLTYPE get_Item(
  60. /* [in] */ VARIANT __RPC_FAR *pvarName,
  61. /* [retval][out] */ VARIANT __RPC_FAR *pvarResult);
  62. virtual /* [propput][helpstring] */ HRESULT STDMETHODCALLTYPE put_Item(
  63. /* [in] */ VARIANT __RPC_FAR *pvarName,
  64. /* [in] */ VARIANT __RPC_FAR *pvarValue);
  65. virtual /* [hidden][id][propget][helpstring] */ HRESULT STDMETHODCALLTYPE get__NewEnum(
  66. /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkResult);
  67. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetVariantA(
  68. /* [in] */ LPCSTR pszName,
  69. /* [retval][out] */ VARIANT __RPC_FAR *pvarResult);
  70. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetVariantW(
  71. /* [in] */ LPCWSTR pszName,
  72. /* [retval][out] */ VARIANT __RPC_FAR *pvarResult);
  73. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetVariantA(
  74. /* [in] */ LPCSTR pszName,
  75. /* [in] */ VARIANT __RPC_FAR *pvarValue);
  76. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetVariantW(
  77. /* [in] */ LPCWSTR pszName,
  78. /* [in] */ VARIANT __RPC_FAR *pvarValue);
  79. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetStringA(
  80. /* [in] */ LPCSTR pszName,
  81. /* [out][in] */ DWORD __RPC_FAR *pchCount,
  82. /* [retval][size_is][out] */ LPSTR pszResult);
  83. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetStringW(
  84. /* [in] */ LPCWSTR pszName,
  85. /* [out][in] */ DWORD __RPC_FAR *pchCount,
  86. /* [retval][size_is][out] */ LPWSTR pszResult);
  87. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetStringA(
  88. /* [in] */ LPCSTR pszName,
  89. /* [in] */ DWORD chCount,
  90. /* [size_is][in] */ LPCSTR pszValue);
  91. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetStringW(
  92. /* [in] */ LPCWSTR pszName,
  93. /* [in] */ DWORD chCount,
  94. /* [size_is][in] */ LPCWSTR pszValue);
  95. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDWordA(
  96. /* [in] */ LPCSTR pszName,
  97. /* [retval][out] */ DWORD __RPC_FAR *pdwResult);
  98. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDWordW(
  99. /* [in] */ LPCWSTR pszName,
  100. /* [retval][out] */ DWORD __RPC_FAR *pdwResult);
  101. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetDWordA(
  102. /* [in] */ LPCSTR pszName,
  103. /* [in] */ DWORD dwValue);
  104. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetDWordW(
  105. /* [in] */ LPCWSTR pszName,
  106. /* [in] */ DWORD dwValue);
  107. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetInterfaceA(
  108. /* [in] */ LPCSTR pszName,
  109. /* [in] */ REFIID iidDesired,
  110. /* [retval][iid_is][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkResult);
  111. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetInterfaceW(
  112. /* [in] */ LPCWSTR pszName,
  113. /* [in] */ REFIID iidDesired,
  114. /* [retval][iid_is][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkResult);
  115. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetInterfaceA(
  116. /* [in] */ LPCSTR pszName,
  117. /* [in] */ IUnknown __RPC_FAR *punkValue);
  118. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetInterfaceW(
  119. /* [in] */ LPCWSTR pszName,
  120. /* [in] */ IUnknown __RPC_FAR *punkValue);
  121. HRESULT STDMETHODCALLTYPE Load(LPCOLESTR pszMachine, SEO_HKEY skBaseKey, LPCOLESTR pszSubKey, IErrorLog *pErrorLog);
  122. HRESULT STDMETHODCALLTYPE Load(LPCSTR pszMachine, SEO_HKEY skBaseKey, LPCSTR pszSubKey);
  123. DECLARE_GET_CONTROLLING_UNKNOWN();
  124. private: // Methods
  125. STDMETHODIMP OpenKey();
  126. STDMETHODIMP CloseKey();
  127. STDMETHODIMP LoadItemA(LPCSTR lpValueName,
  128. DWORD &lpType,
  129. LPBYTE lpData,
  130. LPDWORD lpcbDataParam = NULL);
  131. STDMETHODIMP LoadItemW(LPCWSTR lpValueName,
  132. DWORD &lpType,
  133. LPBYTE lpData,
  134. LPDWORD lpcbDataParam = NULL);
  135. private: // Data
  136. CAndyString m_strMachine; //std::string m_strMachine;
  137. CAndyString m_strSubKey; //std::string m_strSubKey;
  138. HKEY m_hkBaseKey;
  139. HKEY m_hkThisKey;
  140. DWORD m_dwValueCount;
  141. DWORD m_dwKeyCount;
  142. DWORD m_dwcMaxValueData; // Longest Value data size.
  143. DWORD m_dwcMaxNameLen; // Longest Name length
  144. CComPtr<IUnknown> m_pUnkMarshaler;
  145. };