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.

233 lines
5.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1996
  6. //
  7. // File: global.h
  8. //
  9. // Contents: Top level internal header file for CertStor APIs. This file
  10. // includes all base header files and contains other global
  11. // stuff.
  12. //
  13. // History: 14-May-96 kevinr created
  14. //
  15. //--------------------------------------------------------------------------
  16. #include <windows.h>
  17. #include <assert.h>
  18. #include <malloc.h>
  19. #include <memory.h>
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <time.h>
  24. #include <crtdbg.h>
  25. #include <shlwapi.h>
  26. #include <userenv.h>
  27. #include <shlobj.h>
  28. #include "crtem.h"
  29. #include "wincrypt.h"
  30. #include "ossutil.h"
  31. #include "asn1code.h"
  32. #include "unicode.h"
  33. #include "crypttls.h"
  34. #include "crypthlp.h"
  35. #include "certprot.h"
  36. #include "pkialloc.h"
  37. #include "asn1util.h"
  38. #include "utf8.h"
  39. extern HMODULE hCertStoreInst;
  40. #include "resource.h"
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. #if 0 // JLS
  45. // # of bytes for a hash. Such as, SHA (20) or MD5 (16)
  46. #define MAX_HASH_LEN 20
  47. #define SHA1_HASH_LEN 20
  48. // Null terminated ascii hex characters of the hash.
  49. // For Win95 Remote Registry Access:: Need extra character
  50. #define MAX_CERT_REG_VALUE_NAME_LEN (2 * MAX_HASH_LEN + 1 + 1)
  51. #define MAX_HASH_NAME_LEN MAX_CERT_REG_VALUE_NAME_LEN
  52. //+-------------------------------------------------------------------------
  53. // Compares the certificate's public key with the provider's public key
  54. // to see if they are identical.
  55. //
  56. // Returns TRUE if the keys are identical.
  57. //
  58. // Implemented in certhlpr.cpp.
  59. //--------------------------------------------------------------------------
  60. BOOL
  61. WINAPI
  62. I_CertCompareCertAndProviderPublicKey(
  63. IN PCCERT_CONTEXT pCert,
  64. IN HCRYPTPROV hProv,
  65. IN DWORD dwKeySpec
  66. );
  67. //+-------------------------------------------------------------------------
  68. // Registry support functions
  69. //
  70. // Implemented in logstor.cpp.
  71. //--------------------------------------------------------------------------
  72. void
  73. ILS_CloseRegistryKey(
  74. IN HKEY hKey
  75. );
  76. BOOL
  77. ILS_ReadDWORDValueFromRegistry(
  78. IN HKEY hKey,
  79. IN LPCWSTR pwszValueName,
  80. IN DWORD *pdwValue
  81. );
  82. BOOL
  83. ILS_ReadBINARYValueFromRegistry(
  84. IN HKEY hKey,
  85. IN LPCWSTR pwszValueName,
  86. OUT BYTE **ppbValue,
  87. OUT DWORD *pcbValue
  88. );
  89. //+-------------------------------------------------------------------------
  90. // Key Identifier registry and roaming file support functions
  91. //
  92. // Implemented in logstor.cpp.
  93. //--------------------------------------------------------------------------
  94. BOOL
  95. ILS_ReadKeyIdElement(
  96. IN const CRYPT_HASH_BLOB *pKeyIdentifier,
  97. IN BOOL fLocalMachine,
  98. IN OPTIONAL LPCWSTR pwszComputerName,
  99. OUT BYTE **ppbElement,
  100. OUT DWORD *pcbElement
  101. );
  102. BOOL
  103. ILS_WriteKeyIdElement(
  104. IN const CRYPT_HASH_BLOB *pKeyIdentifier,
  105. IN BOOL fLocalMachine,
  106. IN OPTIONAL LPCWSTR pwszComputerName,
  107. IN const BYTE *pbElement,
  108. IN DWORD cbElement
  109. );
  110. BOOL
  111. ILS_DeleteKeyIdElement(
  112. IN const CRYPT_HASH_BLOB *pKeyIdentifier,
  113. IN BOOL fLocalMachine,
  114. IN OPTIONAL LPCWSTR pwszComputerName
  115. );
  116. typedef BOOL (*PFN_ILS_OPEN_KEYID_ELEMENT)(
  117. IN const CRYPT_HASH_BLOB *pKeyIdentifier,
  118. IN const BYTE *pbElement,
  119. IN DWORD cbElement,
  120. IN void *pvArg
  121. );
  122. BOOL
  123. ILS_OpenAllKeyIdElements(
  124. IN BOOL fLocalMachine,
  125. IN OPTIONAL LPCWSTR pwszComputerName,
  126. IN void *pvArg,
  127. IN PFN_ILS_OPEN_KEYID_ELEMENT pfnOpenKeyId
  128. );
  129. //+-------------------------------------------------------------------------
  130. // Protected Root functions
  131. //
  132. // Implemented in protroot.cpp.
  133. //--------------------------------------------------------------------------
  134. BOOL
  135. IPR_IsCurrentUserRootsAllowed();
  136. BOOL
  137. IPR_OnlyLocalMachineGroupPolicyRootsAllowed();
  138. void
  139. IPR_InitProtectedRootInfo();
  140. BOOL
  141. IPR_DeleteUnprotectedRootsFromStore(
  142. IN HCERTSTORE hStore,
  143. OUT BOOL *pfProtected
  144. );
  145. int
  146. IPR_ProtectedRootMessageBox(
  147. IN PCCERT_CONTEXT pCert,
  148. IN UINT wActionID,
  149. IN UINT uFlags
  150. );
  151. //+-------------------------------------------------------------------------
  152. // Find chain helper functions
  153. //
  154. // Implemented in fndchain.cpp.
  155. //--------------------------------------------------------------------------
  156. BOOL IFC_IsEndCertValidForUsage(
  157. IN PCCERT_CONTEXT pCert,
  158. IN LPCSTR pszUsageIdentifier
  159. );
  160. //#include "ossx509.h"
  161. //+-------------------------------------------------------------------------
  162. // Convert to/from OssEncodedOID
  163. //
  164. // Implemented in oidconv.cpp.
  165. //--------------------------------------------------------------------------
  166. BOOL
  167. WINAPI
  168. I_CryptOIDConvDllMain(
  169. HMODULE hInst,
  170. ULONG ulReason,
  171. LPVOID lpReserved
  172. );
  173. #endif // 0 // JLS
  174. BOOL
  175. WINAPI
  176. I_CryptSetOssEncodedOID(
  177. IN LPCSTR pszObjId,
  178. OUT OssEncodedOID *pOss
  179. );
  180. void
  181. WINAPI
  182. I_CryptGetOssEncodedOID(
  183. IN OssEncodedOID *pOss,
  184. IN DWORD dwFlags,
  185. OUT LPSTR *ppszObjId,
  186. IN OUT BYTE **ppbExtra,
  187. IN OUT LONG *plRemainExtra
  188. );
  189. #ifdef __cplusplus
  190. } // Balance extern "C" above
  191. #endif
  192. #include "ossconv.h"
  193. #if 0 // JLS
  194. #include "ossutil.h"
  195. #include "ekuhlpr.h"
  196. #include "origin.h"
  197. #include <scrdcert.h>
  198. #include <scstore.h>
  199. #pragma hdrstop
  200. #endif // 0 //JLS