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.

357 lines
9.8 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: admin.h
  7. //
  8. // Contents: Implementation of DCOM object for RPC services
  9. //
  10. // History: July-97 xtan created
  11. //
  12. //---------------------------------------------------------------------------
  13. // Admin Interface
  14. class CCertAdminD : public ICertAdminD2
  15. {
  16. public:
  17. // IUnknown
  18. virtual STDMETHODIMP QueryInterface(const IID& iid, void**ppv);
  19. virtual ULONG STDMETHODCALLTYPE AddRef();
  20. virtual ULONG STDMETHODCALLTYPE Release();
  21. // ICertAdminD
  22. virtual STDMETHODIMP SetExtension(
  23. IN wchar_t const *pwszAuthority,
  24. IN DWORD dwRequestId,
  25. IN wchar_t const *pwszExtensionName,
  26. IN DWORD dwType,
  27. IN DWORD dwFlags,
  28. IN CERTTRANSBLOB *ptbValue);
  29. virtual STDMETHODIMP SetAttributes(
  30. IN wchar_t const *pwszAuthority,
  31. IN DWORD dwRequestId,
  32. IN wchar_t const *pwszAttributes);
  33. virtual STDMETHODIMP ResubmitRequest(
  34. IN wchar_t const *pwszAuthority,
  35. IN DWORD dwRequestId,
  36. OUT DWORD *pdwDisposition);
  37. virtual STDMETHODIMP DenyRequest(
  38. IN wchar_t const *pwszAuthority,
  39. IN DWORD dwRequestId);
  40. virtual STDMETHODIMP IsValidCertificate(
  41. IN wchar_t const *pwszAuthority,
  42. IN wchar_t const *pwszSerialNumber,
  43. OUT LONG *pRevocationReason,
  44. OUT LONG *pDisposition);
  45. virtual STDMETHODIMP PublishCRL(
  46. IN wchar_t const *pwszAuthority,
  47. IN FILETIME FileTime);
  48. virtual STDMETHODIMP GetCRL(
  49. IN wchar_t const *pwszAuthority,
  50. OUT CERTTRANSBLOB *ptbCRL);
  51. virtual STDMETHODIMP RevokeCertificate(
  52. IN wchar_t const *pwszAuthority,
  53. IN wchar_t const *pwszSerialNumber,
  54. IN DWORD Reason,
  55. IN FILETIME FileTime);
  56. virtual STDMETHODIMP EnumViewColumn(
  57. IN wchar_t const *pwszAuthority,
  58. IN DWORD iColumn,
  59. IN DWORD cColumn,
  60. OUT DWORD *pcColumn,
  61. OUT CERTTRANSBLOB *ptbColumnInfo);
  62. virtual STDMETHODIMP GetViewDefaultColumnSet(
  63. IN wchar_t const *pwszAuthority,
  64. IN DWORD iColumnSetDefault,
  65. OUT DWORD *pcColumn,
  66. OUT CERTTRANSBLOB *ptbColumnInfo);
  67. virtual STDMETHODIMP EnumAttributesOrExtensions(
  68. IN wchar_t const *pwszAuthority,
  69. IN DWORD RowId,
  70. IN DWORD Flags,
  71. OPTIONAL IN wchar_t const *pwszLast,
  72. IN DWORD celt,
  73. OUT DWORD *pceltFetched,
  74. OUT CERTTRANSBLOB *pctbOut);
  75. virtual STDMETHODIMP OpenView(
  76. IN wchar_t const *pwszAuthority,
  77. IN DWORD ccvr,
  78. IN CERTVIEWRESTRICTION const *acvr,
  79. IN DWORD ccolOut,
  80. IN DWORD const *acolOut,
  81. IN DWORD ielt,
  82. IN DWORD celt,
  83. OUT DWORD *pceltFetched,
  84. OUT CERTTRANSBLOB *pctbResultRows);
  85. virtual STDMETHODIMP EnumView(
  86. IN wchar_t const *pwszAuthority,
  87. IN DWORD ielt,
  88. IN DWORD celt,
  89. OUT DWORD *pceltFetched,
  90. OUT CERTTRANSBLOB *pctbResultRows);
  91. virtual STDMETHODIMP CloseView(
  92. IN wchar_t const *pwszAuthority);
  93. virtual STDMETHODIMP ServerControl(
  94. IN wchar_t const *pwszAuthority,
  95. IN DWORD dwControlFlags,
  96. OUT CERTTRANSBLOB *pctbOut);
  97. virtual STDMETHODIMP Ping( // test function
  98. IN wchar_t const *pwszAuthority);
  99. virtual STDMETHODIMP GetServerState(
  100. IN WCHAR const *pwszAuthority,
  101. OUT DWORD *pdwState);
  102. virtual STDMETHODIMP BackupPrepare(
  103. IN WCHAR const *pwszAuthority,
  104. IN unsigned long grbit,
  105. IN unsigned long btBackupType,
  106. IN WCHAR const *pwszBackupAnnotation,
  107. IN DWORD dwClientIdentifier);
  108. virtual STDMETHODIMP BackupEnd();
  109. virtual STDMETHODIMP BackupGetAttachmentInformation(
  110. OUT WCHAR **ppwszzDBFiles,
  111. OUT LONG *pcwcDBFiles);
  112. virtual STDMETHODIMP BackupGetBackupLogs(
  113. OUT WCHAR **ppwszzLogFiles,
  114. OUT LONG *pcwcLogFiles);
  115. virtual STDMETHODIMP BackupOpenFile(
  116. IN WCHAR const *pwszPath,
  117. OUT unsigned hyper *pliLength);
  118. virtual STDMETHODIMP BackupReadFile(
  119. OUT BYTE *pbBuffer,
  120. IN LONG cbBuffer,
  121. OUT LONG *pcbRead);
  122. virtual STDMETHODIMP BackupCloseFile();
  123. virtual STDMETHODIMP BackupTruncateLogs();
  124. virtual STDMETHODIMP ImportCertificate(
  125. IN wchar_t const *pwszAuthority,
  126. IN CERTTRANSBLOB *pctbCertificate,
  127. IN LONG dwFlags,
  128. OUT LONG *pdwRequestId);
  129. virtual STDMETHODIMP BackupGetDynamicFiles(
  130. OUT WCHAR **ppwszzFiles,
  131. OUT LONG *pcwcFiles);
  132. virtual STDMETHODIMP RestoreGetDatabaseLocations(
  133. OUT WCHAR **ppwszDatabaseLocations,
  134. OUT LONG *pcwcPaths);
  135. // ICertAdminD2
  136. virtual STDMETHODIMP PublishCRLs(
  137. IN wchar_t const *pwszAuthority,
  138. IN FILETIME FileTime,
  139. IN DWORD Flags); // CA_CRL_*
  140. virtual STDMETHODIMP GetCAProperty(
  141. IN wchar_t const *pwszAuthority,
  142. IN LONG PropId, // CR_PROP_*
  143. IN LONG PropIndex,
  144. IN LONG PropType, // PROPTYPE_*
  145. OUT CERTTRANSBLOB *pctbPropertyValue);
  146. virtual STDMETHODIMP SetCAProperty(
  147. IN wchar_t const *pwszAuthority,
  148. IN LONG PropId, // CR_PROP_*
  149. IN LONG PropIndex,
  150. IN LONG PropType, // PROPTYPE_*
  151. OUT CERTTRANSBLOB *pctbPropertyValue);
  152. virtual STDMETHODIMP GetCAPropertyInfo(
  153. IN wchar_t const *pwszAuthority,
  154. OUT LONG *pcProperty,
  155. OUT CERTTRANSBLOB *pctbPropInfo);
  156. virtual STDMETHODIMP EnumViewColumnTable(
  157. IN wchar_t const *pwszAuthority,
  158. IN DWORD iTable,
  159. IN DWORD iColumn,
  160. IN DWORD cColumn,
  161. OUT DWORD *pcColumn,
  162. OUT CERTTRANSBLOB *pctbColumnInfo);
  163. virtual STDMETHODIMP GetCASecurity(
  164. IN wchar_t const *pwszAuthority,
  165. OUT CERTTRANSBLOB *pctbSD);
  166. virtual STDMETHODIMP SetCASecurity(
  167. IN wchar_t const *pwszAuthority,
  168. IN CERTTRANSBLOB *pctbSD);
  169. // this is a test function
  170. virtual STDMETHODIMP Ping2(
  171. IN wchar_t const *pwszAuthority);
  172. virtual STDMETHODIMP GetArchivedKey(
  173. IN wchar_t const *pwszAuthority,
  174. IN DWORD dwRequestId,
  175. OUT CERTTRANSBLOB *pctbArchivedKey);
  176. virtual STDMETHODIMP GetAuditFilter(
  177. IN wchar_t const *pwszAuthority,
  178. OUT DWORD *pdwFilter);
  179. virtual STDMETHODIMP SetAuditFilter(
  180. IN wchar_t const *pwszAuthority,
  181. IN DWORD dwFilter);
  182. virtual STDMETHODIMP GetOfficerRights(
  183. IN wchar_t const *pwszAuthority,
  184. OUT BOOL *pfEnabled,
  185. OUT CERTTRANSBLOB *pctbSD);
  186. virtual STDMETHODIMP SetOfficerRights(
  187. IN wchar_t const *pwszAuthority,
  188. IN BOOL fEnable,
  189. IN CERTTRANSBLOB *pctbSD);
  190. virtual STDMETHODIMP GetConfigEntry(
  191. IN wchar_t const *pwszAuthority,
  192. IN wchar_t const *pwszNodePath,
  193. IN wchar_t const *pwszEntry,
  194. OUT VARIANT *pVariant);
  195. virtual STDMETHODIMP SetConfigEntry(
  196. IN wchar_t const *pwszAuthority,
  197. IN wchar_t const *pwszNodePath,
  198. IN wchar_t const *pwszEntry,
  199. IN VARIANT *pVariant);
  200. virtual STDMETHODIMP ImportKey(
  201. IN wchar_t const *pwszAuthority,
  202. IN DWORD RequestId,
  203. IN wchar_t const *pwszCertHash,
  204. IN DWORD Flags,
  205. IN CERTTRANSBLOB *pctbKey);
  206. virtual STDMETHODIMP GetMyRoles(
  207. IN wchar_t const *pwszAuthority,
  208. OUT LONG *pdwRoles);
  209. virtual STDMETHODIMP DeleteRow(
  210. IN wchar_t const *pwszAuthority,
  211. IN DWORD dwFlags, // CDR_*
  212. IN FILETIME FileTime,
  213. IN DWORD dwTable, // CVRC_TABLE_*
  214. IN DWORD dwRowId,
  215. OUT LONG *pcDeleted);
  216. // CCertAdminD
  217. // Constructor
  218. CCertAdminD();
  219. // Destructor
  220. ~CCertAdminD();
  221. private:
  222. HRESULT _EnumAttributes(
  223. IN ICertDBRow *prow,
  224. IN CERTDBNAME *adbn,
  225. IN DWORD celt,
  226. OUT CERTTRANSBLOB *pctbOut);
  227. HRESULT _EnumExtensions(
  228. IN ICertDBRow *prow,
  229. IN CERTDBNAME *adbn,
  230. IN DWORD celt,
  231. OUT CERTTRANSBLOB *pctbOut);
  232. HRESULT _EnumViewNext(
  233. IN IEnumCERTDBRESULTROW *pview,
  234. IN DWORD ielt,
  235. IN DWORD celt,
  236. OUT DWORD *pceltFetched,
  237. OUT CERTTRANSBLOB *pctbResultRows);
  238. HRESULT _BackupGetFileList(
  239. IN DWORD dwFileType,
  240. OUT WCHAR **ppwszzFiles,
  241. OUT LONG *pcwcFiles);
  242. HRESULT _GetDynamicFileList(
  243. IN OUT DWORD *pcwcList,
  244. OUT WCHAR *pwszzList);
  245. HRESULT _GetDatabaseLocations(
  246. IN OUT DWORD *pcwcList,
  247. OUT WCHAR *pwszzList);
  248. // this is a test function
  249. HRESULT _Ping(
  250. IN wchar_t const *pwszAuthority);
  251. private:
  252. IEnumCERTDBCOLUMN *m_pEnumCol;
  253. DWORD m_iTableEnum;
  254. ICertDBBackup *m_pBackup;
  255. JET_GRBIT m_grbitBackup;
  256. BOOL m_fHasView;
  257. // Reference count
  258. long m_cRef;
  259. long m_cNext;
  260. };
  261. // Class of Admin factory
  262. class CAdminFactory : public IClassFactory
  263. {
  264. public:
  265. // IUnknown
  266. virtual STDMETHODIMP QueryInterface(const IID& iid, void **ppv);
  267. virtual ULONG STDMETHODCALLTYPE AddRef();
  268. virtual ULONG STDMETHODCALLTYPE Release();
  269. // Interface IClassFactory
  270. virtual STDMETHODIMP CreateInstance(
  271. IUnknown *pUnknownOuter,
  272. const IID& iid,
  273. void **ppv);
  274. virtual STDMETHODIMP LockServer(BOOL bLock);
  275. // Constructor
  276. CAdminFactory() : m_cRef(1) { }
  277. // Destructor
  278. ~CAdminFactory();
  279. public:
  280. static STDMETHODIMP CanUnloadNow();
  281. static STDMETHODIMP StartFactory();
  282. static void StopFactory();
  283. private:
  284. long m_cRef;
  285. };