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.

210 lines
5.8 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. PROVREG.H
  5. Abstract:
  6. Defines the classes for supporting the registry provider.
  7. History:
  8. a-davj 04-Mar-97 Created.
  9. --*/
  10. #ifndef _PROVREG_H_
  11. #define _PROVREG_H_
  12. #include "regprov.h"
  13. #include "ntcnfg.h"
  14. //#include <DMREG.H>
  15. #include "impdyn.h"
  16. #include "cfdyn.h"
  17. // define for calling dmreg indirectly
  18. typedef LONG (PASCAL * POPEN)(HKEY hKey,
  19. LPCTSTR lpszSubKey,
  20. DWORD dwInstanceIndex,
  21. DWORD dwReserved,
  22. REGSAM samDesired,
  23. PHKEY phkResult);
  24. typedef LONG (PASCAL * PQUERYVALUE)(HKEY hKey,
  25. LPTSTR lpszValueName,
  26. LPDWORD lpdwReserved,
  27. LPDWORD lpdwType,
  28. LPBYTE lpbData,
  29. LPDWORD lpcbData);
  30. typedef LONG (PASCAL * PCLOSE)(HKEY hKey);
  31. typedef LONG (PASCAL * PSETVALUE)(HKEY hKey,
  32. LPCTSTR lpValueName,
  33. DWORD Reserved,
  34. DWORD dwType,
  35. CONST BYTE *lpData,
  36. DWORD cbDat);
  37. typedef LONG (PASCAL *PENUMKEY)( HKEY hKey,
  38. DWORD iSubkey,
  39. LPTSTR lpszName,
  40. LPDWORD lpcchName,
  41. LPDWORD lpdwReserved,
  42. LPTSTR lpszClass,
  43. LPDWORD lpcchClass,
  44. PFILETIME lpftLastWrite);
  45. //***************************************************************************
  46. //
  47. // CLASS NAME:
  48. //
  49. // CEnumRegInfo
  50. //
  51. // DESCRIPTION:
  52. //
  53. // A collection used to hold the instance keys so as to support enumeration.
  54. //
  55. //***************************************************************************
  56. class CEnumRegInfo : public CEnumInfo{
  57. public:
  58. CEnumRegInfo(HKEY hKey, HKEY hRemoteKey,PCLOSE pClose);
  59. ~CEnumRegInfo();
  60. HKEY GetKey(void){return m_hKey;};
  61. HKEY GetRemoteKey(void){return m_hRemoteKey;};
  62. private:
  63. HKEY m_hKey;
  64. HKEY m_hRemoteKey;
  65. PCLOSE m_pClose;
  66. };
  67. //***************************************************************************
  68. //
  69. // CLASS NAME:
  70. //
  71. // CImpReg
  72. //
  73. // DESCRIPTION:
  74. //
  75. // Support the registry as an instance provider.
  76. //
  77. //***************************************************************************
  78. class CImpReg : public CImpDyn {
  79. public:
  80. CImpReg();
  81. ~CImpReg();
  82. int iGetMinTokens(void){return 2;};
  83. SCODE RefreshProperty(long lFlags, IWbemClassObject FAR * pClassInt,
  84. BSTR PropName,CProvObj & ProvObj,CObject * pPackage,
  85. CVariant * pVar, BOOL bTesterDetails);
  86. SCODE UpdateProperty(long lFlags, IWbemClassObject FAR * pClassInt,
  87. BSTR PropName,CProvObj & ProvObj,CObject * pPackage,
  88. CVariant * pVar);
  89. SCODE StartBatch(long lFlags, IWbemClassObject FAR * pClassInt,CObject **pObj,BOOL bGet);
  90. void EndBatch(long lFlags, IWbemClassObject FAR * pClassInt,CObject *pObj,BOOL bGet);
  91. SCODE MakeEnum(IWbemClassObject * pClass, CProvObj & ProvObj,
  92. CEnumInfo ** ppInfo);
  93. SCODE GetKey(CEnumInfo * pInfo, int iIndex, LPWSTR * ppKey);
  94. void Free(int iStart,CHandleCache * pCache);
  95. int GetRoot(HKEY * pKey,CProvObj &Path,const TCHAR * pMachine,
  96. CHandleCache * pCache,int & iNumToSkip);
  97. SCODE ConvertSetData(CVariant & cVar, void **ppData, DWORD * pdwRegType,
  98. DWORD * pdwBufferSize);
  99. SCODE ReadRegData(HKEY hKey, const TCHAR * pName,DWORD & dwRegType,
  100. DWORD & dwSize, void ** pData,CHandleCache * pCache);
  101. int OpenKeyForWritting(HKEY hCurr, LPTSTR pName, HKEY * pNew,CHandleCache * pCache);
  102. int iLookUpInt(const TCHAR * tpTest);
  103. int iLookUpOffset(const TCHAR * tpTest,int & iType,int & iTypeSize);
  104. BOOL bGetOffsetData(DWORD dwReg,CProvObj & ProvObj, int & iIntType,
  105. int & iBus, int & iPartial,int & iDataOffset,
  106. int & iDataType, int & iSourceSize,DWORD dwArray);
  107. PCM_PARTIAL_RESOURCE_DESCRIPTOR GetNextPartial(PCM_PARTIAL_RESOURCE_DESCRIPTOR pCurr);
  108. PCM_FULL_RESOURCE_DESCRIPTOR GetNextFull(PCM_FULL_RESOURCE_DESCRIPTOR pCurr);
  109. SCODE ConvertGetDataFromDesc(CVariant & cVar,void * pData,DWORD dwRegType,DWORD dwBufferSize,CProvObj & ProvObj);
  110. SCODE ConvertGetDataFromSimple(CVariant & cVar, void * pData,DWORD dwRegType,DWORD dwBufferSize,
  111. IWbemClassObject FAR * pClassInt, BSTR PropName);
  112. SCODE MethodAsync(BSTR ObjectPath, BSTR MethodName,
  113. long lFlags, IWbemContext* pCtx, IWbemClassObject* pInParams,
  114. IWbemObjectSink* pSink);
  115. bool NeedsEscapes(){return true;}; // so far, on reg prov needs this
  116. private:
  117. HINSTANCE hDMRegLib;
  118. POPEN pOpen;
  119. PCLOSE pClose;
  120. PQUERYVALUE pQueryValue;
  121. PSETVALUE pSetValue;
  122. PENUMKEY pEnumKey;
  123. HANDLE m_hToken;
  124. HKEY m_hRoot;
  125. bool m_bLoadedProfile;
  126. };
  127. //***************************************************************************
  128. //
  129. // CLASS NAME:
  130. //
  131. // CCFReg
  132. //
  133. // DESCRIPTION:
  134. //
  135. // class factory for CLocatorReg
  136. //
  137. //***************************************************************************
  138. class CCFReg : public CCFDyn
  139. {
  140. public:
  141. IUnknown * CreateImpObj() {return (IWbemServices*) new CImpReg;};
  142. } ;
  143. //***************************************************************************
  144. //
  145. // CLASS NAME:
  146. //
  147. // CImpRegProp
  148. //
  149. // DESCRIPTION:
  150. //
  151. // Support registry property provider
  152. //
  153. //***************************************************************************
  154. class CImpRegProp : public CImpDynProp {
  155. public:
  156. CImpRegProp();
  157. ~CImpRegProp();
  158. bool NeedsEscapes(){return true;}; // so far, on reg prov needs this
  159. };
  160. //***************************************************************************
  161. //
  162. // CLASS NAME:
  163. //
  164. // CCFRegProp
  165. //
  166. // DESCRIPTION:
  167. //
  168. // Class factory for CImpRegProp
  169. //
  170. //***************************************************************************
  171. class CCFRegProp : public CCFDyn
  172. {
  173. public:
  174. IUnknown * CreateImpObj() {return new CImpRegProp();};
  175. } ;
  176. #endif //_PROVREG_H_