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.

334 lines
9.8 KiB

  1. // CSecStr1.h : Declaration of the CSecStor
  2. #include "resource.h" // main symbols
  3. #include "pstypes.h"
  4. #include "pstrpc.h"
  5. class CRPCBinding
  6. {
  7. private:
  8. DWORD m_dwRef;
  9. BOOL m_fGoodHProv;
  10. public:
  11. LPWSTR m_wszStringBinding;
  12. RPC_BINDING_HANDLE m_hBind;
  13. PST_PROVIDER_HANDLE m_hProv;
  14. CRPCBinding();
  15. ~CRPCBinding();
  16. HRESULT Init();
  17. HRESULT Acquire(
  18. IN PPST_PROVIDERID pProviderID,
  19. IN PVOID pReserved,
  20. IN DWORD dwFlags
  21. );
  22. CRPCBinding *AddRef();
  23. void Release();
  24. };
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CPStore
  27. class CPStore :
  28. public IEnumPStoreProviders,
  29. public IPStore,
  30. public CComObjectRoot,
  31. public CComCoClass<CPStore,&CLSID_CPStore>
  32. {
  33. private:
  34. CRPCBinding *m_pBinding;
  35. DWORD m_Index;
  36. public:
  37. CPStore();
  38. ~CPStore();
  39. void Init(
  40. CRPCBinding *pBinding
  41. );
  42. static HRESULT CreateObject(
  43. CRPCBinding *pBinding,
  44. IPStore **ppv
  45. );
  46. static HRESULT CreateObject(
  47. CRPCBinding *pBinding,
  48. IEnumPStoreProviders **ppv
  49. );
  50. BEGIN_COM_MAP(CPStore)
  51. COM_INTERFACE_ENTRY(IEnumPStoreProviders)
  52. COM_INTERFACE_ENTRY(IPStore)
  53. END_COM_MAP()
  54. //DECLARE_NOT_AGGREGATABLE(CPStore)
  55. // Remove the comment from the line above if you don't want your object to
  56. // support aggregation. The default is to support it
  57. DECLARE_REGISTRY(CPStore, _T("CPStore1.CPStore.1"), _T("CPStore1.CPStore"), IDS_CPSTORE_DESC, THREADFLAGS_BOTH)
  58. // IEnumSecureProviders
  59. virtual HRESULT STDMETHODCALLTYPE Next(
  60. /* [in] */ DWORD celt,
  61. /* [out][size_is] */ PST_PROVIDERINFO __RPC_FAR *__RPC_FAR *rgelt,
  62. /* [out][in] */ DWORD __RPC_FAR *pceltFetched);
  63. virtual HRESULT STDMETHODCALLTYPE Skip(
  64. /* [in] */ DWORD celt);
  65. virtual HRESULT STDMETHODCALLTYPE Reset( void);
  66. virtual HRESULT STDMETHODCALLTYPE Clone(
  67. /* [out] */ IEnumPStoreProviders __RPC_FAR *__RPC_FAR *ppenum);
  68. // ISecureProvider
  69. virtual HRESULT STDMETHODCALLTYPE GetInfo(
  70. /* [out] */ PPST_PROVIDERINFO __RPC_FAR *ppProperties);
  71. virtual HRESULT STDMETHODCALLTYPE GetProvParam(
  72. /* [in] */ DWORD dwParam,
  73. /* [out] */ DWORD __RPC_FAR *pcbData,
  74. /* [out] */ BYTE __RPC_FAR **ppbData,
  75. /* [in] */ DWORD dwFlags);
  76. virtual HRESULT STDMETHODCALLTYPE SetProvParam(
  77. /* [in] */ DWORD dwParam,
  78. /* [in] */ DWORD cbData,
  79. /* [in] */ BYTE __RPC_FAR *pbData,
  80. /* [in] */ DWORD dwFlags);
  81. virtual HRESULT STDMETHODCALLTYPE CreateType(
  82. /* [in] */ PST_KEY Key,
  83. /* [in] */ const GUID __RPC_FAR *pType,
  84. /* [in] */ PPST_TYPEINFO pInfo,
  85. /* [in] */ DWORD dwFlags);
  86. virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(
  87. /* [in] */ PST_KEY Key,
  88. /* [in] */ const GUID __RPC_FAR *pType,
  89. /* [out] */ PPST_TYPEINFO __RPC_FAR *ppInfo,
  90. /* [in] */ DWORD dwFlags);
  91. virtual HRESULT STDMETHODCALLTYPE DeleteType(
  92. /* [in] */ PST_KEY Key,
  93. /* [in] */ const GUID __RPC_FAR *pType,
  94. /* [in] */ DWORD dwFlags);
  95. virtual HRESULT STDMETHODCALLTYPE CreateSubtype(
  96. /* [in] */ PST_KEY Key,
  97. /* [in] */ const GUID __RPC_FAR *pType,
  98. /* [in] */ const GUID __RPC_FAR *pSubtype,
  99. /* [in] */ PPST_TYPEINFO pInfo,
  100. /* [in] */ PPST_ACCESSRULESET pRules,
  101. /* [in] */ DWORD dwFlags);
  102. virtual HRESULT STDMETHODCALLTYPE GetSubtypeInfo(
  103. /* [in] */ PST_KEY Key,
  104. /* [in] */ const GUID __RPC_FAR *pType,
  105. /* [in] */ const GUID __RPC_FAR *pSubtype,
  106. /* [out] */ PPST_TYPEINFO __RPC_FAR *ppInfo,
  107. /* [in] */ DWORD dwFlags);
  108. virtual HRESULT STDMETHODCALLTYPE DeleteSubtype(
  109. /* [in] */ PST_KEY Key,
  110. /* [in] */ const GUID __RPC_FAR *pType,
  111. /* [in] */ const GUID __RPC_FAR *pSubtype,
  112. /* [in] */ DWORD dwFlags);
  113. virtual HRESULT STDMETHODCALLTYPE ReadAccessRuleset(
  114. /* [in] */ PST_KEY Key,
  115. /* [in] */ const GUID __RPC_FAR *pType,
  116. /* [in] */ const GUID __RPC_FAR *pSubtype,
  117. /* [out] */ PPST_ACCESSRULESET __RPC_FAR *ppRules,
  118. /* [in] */ DWORD dwFlags);
  119. virtual HRESULT STDMETHODCALLTYPE WriteAccessRuleset(
  120. /* [in] */ PST_KEY Key,
  121. /* [in] */ const GUID __RPC_FAR *pType,
  122. /* [in] */ const GUID __RPC_FAR *pSubtype,
  123. /* [in] */ PPST_ACCESSRULESET pRules,
  124. /* [in] */ DWORD dwFlags);
  125. virtual HRESULT STDMETHODCALLTYPE EnumTypes(
  126. /* [in] */ PST_KEY Key,
  127. /* [in] */ DWORD dwFlags,
  128. /* [in] */ IEnumPStoreTypes __RPC_FAR *__RPC_FAR *ppenum
  129. );
  130. virtual HRESULT STDMETHODCALLTYPE EnumSubtypes(
  131. /* [in] */ PST_KEY Key,
  132. /* [in] */ const GUID __RPC_FAR *pType,
  133. /* [in] */ DWORD dwFlags,
  134. /* [in] */ IEnumPStoreTypes __RPC_FAR *__RPC_FAR *ppenum
  135. );
  136. virtual HRESULT STDMETHODCALLTYPE DeleteItem(
  137. /* [in] */ PST_KEY Key,
  138. /* [in] */ const GUID __RPC_FAR *pItemType,
  139. /* [in] */ const GUID __RPC_FAR *pItemSubtype,
  140. /* [in] */ LPCWSTR szItemName,
  141. /* [in] */ PPST_PROMPTINFO pPromptInfo,
  142. /* [in] */ DWORD dwFlags);
  143. virtual HRESULT STDMETHODCALLTYPE ReadItem(
  144. /* [in] */ PST_KEY Key,
  145. /* [in] */ const GUID __RPC_FAR *pItemType,
  146. /* [in] */ const GUID __RPC_FAR *pItemSubtype,
  147. /* [in] */ LPCWSTR szItemName,
  148. /* [out][in] */ DWORD __RPC_FAR *pcbData,
  149. /* [out][size_is] */ BYTE __RPC_FAR *__RPC_FAR *ppbData,
  150. /* [in] */ PPST_PROMPTINFO pPromptInfo,
  151. /* [in] */ DWORD dwFlags);
  152. virtual HRESULT STDMETHODCALLTYPE WriteItem(
  153. /* [in] */ PST_KEY Key,
  154. /* [in] */ const GUID __RPC_FAR *pItemType,
  155. /* [in] */ const GUID __RPC_FAR *pItemSubtype,
  156. /* [in] */ LPCWSTR szItemName,
  157. /* [in] */ DWORD cbData,
  158. /* [in][size_is] */ BYTE __RPC_FAR *pbData,
  159. /* [in] */ PPST_PROMPTINFO pPromptInfo,
  160. /* [in] */ DWORD dwDefaultConfirmationStyle,
  161. /* [in] */ DWORD dwFlags);
  162. virtual HRESULT STDMETHODCALLTYPE OpenItem(
  163. /* [in] */ PST_KEY Key,
  164. /* [in] */ const GUID __RPC_FAR *pItemType,
  165. /* [in] */ const GUID __RPC_FAR *pItemSubtype,
  166. /* [in] */ LPCWSTR szItemName,
  167. /* [in] */ PST_ACCESSMODE ModeFlags,
  168. /* [in] */ PPST_PROMPTINFO pPromptInfo,
  169. /* [in] */ DWORD dwFlags);
  170. virtual HRESULT STDMETHODCALLTYPE CloseItem(
  171. /* [in] */ PST_KEY Key,
  172. /* [in] */ const GUID __RPC_FAR *pItemType,
  173. /* [in] */ const GUID __RPC_FAR *pItemSubtype,
  174. /* [in] */ LPCWSTR szItemName,
  175. /* [in] */ DWORD dwFlags);
  176. virtual HRESULT STDMETHODCALLTYPE EnumItems(
  177. /* [in] */ PST_KEY Key,
  178. /* [in] */ const GUID __RPC_FAR *pItemType,
  179. /* [in] */ const GUID __RPC_FAR *pItemSubtype,
  180. /* [in] */ DWORD dwFlags,
  181. /* [in] */ IEnumPStoreItems __RPC_FAR *__RPC_FAR *ppenum
  182. );
  183. public:
  184. };
  185. // CEnumTypes
  186. class CEnumTypes :
  187. public IEnumPStoreTypes,
  188. public CComObjectRoot,
  189. public CComCoClass<CEnumTypes,&CLSID_CEnumTypes>
  190. {
  191. public:
  192. CRPCBinding *m_pBinding;
  193. PST_KEY m_Key;
  194. DWORD m_Index;
  195. DWORD m_dwFlags;
  196. GUID m_Type;
  197. BOOL m_fEnumSubtypes;
  198. public:
  199. CEnumTypes();
  200. ~CEnumTypes();
  201. void Init(
  202. CRPCBinding *pBinding,
  203. PST_KEY Key,
  204. const GUID *pType,
  205. DWORD dwFlags
  206. );
  207. static HRESULT CreateObject(
  208. CRPCBinding *pBinding,
  209. PST_KEY Key,
  210. const GUID *pType,
  211. DWORD dwFlags,
  212. IEnumPStoreTypes **ppv
  213. );
  214. BEGIN_COM_MAP(CEnumTypes)
  215. COM_INTERFACE_ENTRY(IEnumPStoreTypes)
  216. END_COM_MAP()
  217. //DECLARE_NOT_AGGREGATABLE(CEnumTypes)
  218. // Remove the comment from the line above if you don't want your object to
  219. // support aggregation. The default is to support it
  220. DECLARE_REGISTRY(CEnumTypes, _T("CEnumTypes1.CEnumTypes.1"), _T("CEnumTypes1.CEnumTypes"), IDS_CENUMTYPES_DESC, THREADFLAGS_BOTH)
  221. virtual HRESULT STDMETHODCALLTYPE Next(
  222. /* [in] */ DWORD celt,
  223. /* [out][in][size_is] */ GUID __RPC_FAR *rgelt,
  224. /* [out][in] */ DWORD __RPC_FAR *pceltFetched);
  225. virtual HRESULT STDMETHODCALLTYPE Clone(
  226. /* [out] */ IEnumPStoreTypes __RPC_FAR *__RPC_FAR *ppenum);
  227. virtual HRESULT STDMETHODCALLTYPE Skip(
  228. /* [in] */ DWORD celt);
  229. virtual HRESULT STDMETHODCALLTYPE Reset( void);
  230. };
  231. // CEnumItems
  232. class CEnumItems :
  233. public IEnumPStoreItems,
  234. public CComObjectRoot,
  235. public CComCoClass<CEnumItems,&CLSID_CEnumItems>
  236. {
  237. private:
  238. CRPCBinding *m_pBinding;
  239. PST_KEY m_Key;
  240. DWORD m_Index;
  241. DWORD m_dwFlags;
  242. GUID m_Type;
  243. GUID m_Subtype;
  244. public:
  245. CEnumItems();
  246. ~CEnumItems();
  247. void Init(
  248. CRPCBinding *pBinding,
  249. PST_KEY Key,
  250. const GUID *pType,
  251. const GUID *pSubtype,
  252. DWORD dwFlags
  253. );
  254. static HRESULT CreateObject(
  255. CRPCBinding *pBinding,
  256. PST_KEY Key,
  257. const GUID *pType,
  258. const GUID *pSubtype,
  259. DWORD dwFlags,
  260. IEnumPStoreItems **ppv
  261. );
  262. BEGIN_COM_MAP(CEnumItems)
  263. COM_INTERFACE_ENTRY(IEnumPStoreItems)
  264. END_COM_MAP()
  265. //DECLARE_NOT_AGGREGATABLE(CPStore)
  266. // Remove the comment from the line above if you don't want your object to
  267. // support aggregation. The default is to support it
  268. DECLARE_REGISTRY(CEnumItems, _T("CEnumItems1.CEnumItems.1"), _T("CEnumItems1.CEnumItems"), IDS_CENUMITEMS_DESC, THREADFLAGS_BOTH)
  269. virtual HRESULT STDMETHODCALLTYPE Next(
  270. /* [in] */ DWORD celt,
  271. /* [out][size_is] */ LPWSTR __RPC_FAR *rgelt,
  272. /* [out][in] */ DWORD __RPC_FAR *pceltFetched);
  273. virtual HRESULT STDMETHODCALLTYPE Clone(
  274. /* [out] */ IEnumPStoreItems __RPC_FAR *__RPC_FAR *ppenum);
  275. virtual HRESULT STDMETHODCALLTYPE Skip(
  276. /* [in] */ DWORD celt);
  277. virtual HRESULT STDMETHODCALLTYPE Reset( void);
  278. };