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.

150 lines
5.0 KiB

  1. //+-------------------------------------------------------------------------
  2. // Microsoft Windows
  3. //
  4. // Copyright (C) Microsoft Corporation, 1997 - 1997
  5. //
  6. // File: certprot.h
  7. //
  8. // Contents: Certificate Protection APIs
  9. //
  10. // APIs: I_CertProtectFunction
  11. // I_CertSrvProtectFunction
  12. //
  13. // History: 27-Nov-97 philh created
  14. //--------------------------------------------------------------------------
  15. #ifndef __CERTPROT_H__
  16. #define __CERTPROT_H__
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //+-------------------------------------------------------------------------
  21. // Calls the services process to do a protected certificate function,
  22. // such as, add or delete a protected root certificate.
  23. //
  24. // CryptMemFree must be called to free the returned *ppbOut.
  25. //--------------------------------------------------------------------------
  26. BOOL
  27. WINAPI
  28. I_CertProtectFunction(
  29. IN DWORD dwFuncId,
  30. IN DWORD dwFlags,
  31. IN OPTIONAL LPCWSTR pwszIn,
  32. IN OPTIONAL BYTE *pbIn,
  33. IN DWORD cbIn,
  34. OUT OPTIONAL BYTE **ppbOut,
  35. OUT OPTIONAL DWORD *pcbOut
  36. );
  37. #define CERT_PROT_INIT_ROOTS_FUNC_ID 1
  38. #define CERT_PROT_PURGE_LM_ROOTS_FUNC_ID 2
  39. #define CERT_PROT_ADD_ROOT_FUNC_ID 3
  40. #define CERT_PROT_DELETE_ROOT_FUNC_ID 4
  41. #define CERT_PROT_DELETE_UNKNOWN_ROOTS_FUNC_ID 5
  42. //+-------------------------------------------------------------------------
  43. // CERT_PROT_INIT_ROOTS_FUNC_ID
  44. //
  45. // Initialize the protected list of CurrentUser roots. Note, no UI.
  46. //
  47. // No IN/OUT parameters.
  48. //--------------------------------------------------------------------------
  49. //+-------------------------------------------------------------------------
  50. // CERT_PROT_PURGE_LM_ROOTS_FUNC_ID
  51. //
  52. // Purge all CurrentUser roots from the protected list that also exist
  53. // in the LocalMachine SystemRegistry "Root" store. Also removes duplicated
  54. // certificates from the CurrentUser SystemRegistry "Root" store.
  55. //
  56. // Note, no UI. Purging can be disabled by setting the
  57. // CERT_PROT_ROOT_INHIBIT_PURGE_LM_FLAG in the registry's ProtectedRootFlags
  58. // value.
  59. //
  60. // No IN/OUT parameters.
  61. //
  62. // Even if purging is disabled, the protected list of roots is still
  63. // initialized.
  64. //--------------------------------------------------------------------------
  65. //+-------------------------------------------------------------------------
  66. // CERT_PROT_ADD_ROOT_FUNC_ID
  67. //
  68. // Add the specified certificate to the CurrentUser SystemRegistry "Root"
  69. // store and the protected list of roots. The user is prompted before doing
  70. // the add.
  71. //
  72. // pbIn and cbIn must be updated with the pointer to and length of the
  73. // serialized certificate context to be added. No other IN/OUT parameters.
  74. //--------------------------------------------------------------------------
  75. //+-------------------------------------------------------------------------
  76. // CERT_PROT_DELETE_ROOT_FUNC_ID
  77. //
  78. // Delete the specified certificate from the CurrentUser SystemRegistry "Root"
  79. // store and the protected list of roots. The user is prompted before doing
  80. // the delete.
  81. //
  82. // pbIn and cbIn must be updated with the pointer to and length of the
  83. // certificate's SHA1 hash property. No other IN/OUT parameters.
  84. //--------------------------------------------------------------------------
  85. //+-------------------------------------------------------------------------
  86. // CERT_PROT_DELETE_UNKNOWN_ROOTS_FUNC_ID
  87. //
  88. // Delete all CurrentUser roots from the protected list that don't also
  89. // exist in the CurrentUser SystemRegistry "Root" store. The user is
  90. // prompted before doing the delete.
  91. //
  92. // No IN/OUT parameters.
  93. //--------------------------------------------------------------------------
  94. typedef void __RPC_FAR * (__RPC_USER *PFN_CERT_PROT_MIDL_USER_ALLOC)(
  95. IN size_t cb
  96. );
  97. typedef void (__RPC_USER *PFN_CERT_PROT_MIDL_USER_FREE)(
  98. IN void __RPC_FAR *pv
  99. );
  100. //+-------------------------------------------------------------------------
  101. // Called from the services process to process a protected certificate
  102. // function.
  103. //
  104. // Returns the error status, ie, not returned in LastError.
  105. //--------------------------------------------------------------------------
  106. DWORD
  107. WINAPI
  108. I_CertSrvProtectFunction(
  109. IN handle_t hRpc,
  110. IN DWORD dwFuncId,
  111. IN DWORD dwFlags,
  112. IN LPCWSTR pwszIn,
  113. IN BYTE *pbIn,
  114. IN DWORD cbIn,
  115. OUT BYTE **ppbOut,
  116. OUT DWORD *pcbOut,
  117. IN PFN_CERT_PROT_MIDL_USER_ALLOC pfnAlloc,
  118. IN PFN_CERT_PROT_MIDL_USER_FREE pfnFree
  119. );
  120. typedef DWORD (WINAPI *PFN_CERT_SRV_PROTECT_FUNCTION)(
  121. IN handle_t hRpc,
  122. IN DWORD dwFuncId,
  123. IN DWORD dwFlags,
  124. IN LPCWSTR pwszIn,
  125. IN BYTE *pbIn,
  126. IN DWORD cbIn,
  127. OUT BYTE **ppbOut,
  128. OUT DWORD *pcbOut,
  129. IN PFN_CERT_PROT_MIDL_USER_ALLOC pfnAlloc,
  130. IN PFN_CERT_PROT_MIDL_USER_FREE pfnFree
  131. );
  132. #ifdef __cplusplus
  133. } // Balance extern "C" above
  134. #endif
  135. #endif