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.

124 lines
3.8 KiB

  1. //+-------------------------------------------------------------------------
  2. // Microsoft Windows
  3. //
  4. // Copyright (C) Microsoft Corporation, 1996 - 1996
  5. //
  6. // File: crypttls.h
  7. //
  8. // Contents: Crypt Thread Local Storage (TLS) and OssGlobal "world"
  9. // installation and allocation functions
  10. //
  11. // APIs:
  12. // I_CryptAllocTls
  13. // I_CryptGetTls
  14. // I_CryptSetTls
  15. // I_CryptDetachTls
  16. // I_CryptInstallOssGlobal
  17. // I_CryptGetOssGlobal
  18. //
  19. //
  20. // History: 17-Nov-96 philh created
  21. //--------------------------------------------------------------------------
  22. #ifndef __CRYPTTLS_H__
  23. #define __CRYPTTLS_H__
  24. #include "ossglobl.h"
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. // Handle to an allocated Crypt TLS entry
  29. typedef DWORD HCRYPTTLS;
  30. // Handle to an installed OssGlobal table
  31. typedef DWORD HCRYPTOSSGLOBAL;
  32. // Pointer to OssGlobal. Returned by I_CryptGetOssGlobal()
  33. typedef OssGlobal *POssGlobal;
  34. //+-------------------------------------------------------------------------
  35. // Install a thread local storage entry and return a handle for future access.
  36. //--------------------------------------------------------------------------
  37. HCRYPTTLS
  38. WINAPI
  39. I_CryptAllocTls();
  40. //+-------------------------------------------------------------------------
  41. // Get the thread specific pointer specified by the
  42. // hCryptTls returned by I_CryptAllocTls().
  43. //
  44. // Returns NULL for an error or uninitialized pointer.
  45. //--------------------------------------------------------------------------
  46. void *
  47. WINAPI
  48. I_CryptGetTls(
  49. IN HCRYPTTLS hCryptTls
  50. );
  51. //+-------------------------------------------------------------------------
  52. // Set the thread specific pointer specified by the
  53. // hCryptTls returned by I_CryptAllocTls().
  54. //
  55. // Returns FALSE for an invalid handle or unable to allocate memory.
  56. //--------------------------------------------------------------------------
  57. BOOL
  58. WINAPI
  59. I_CryptSetTls(
  60. IN HCRYPTTLS hCryptTls,
  61. IN void *pvTls
  62. );
  63. //+-------------------------------------------------------------------------
  64. // Called at DLL_PROCESS_DETACH or DLL_THREAD_DETACH to free the thread's
  65. // TLS entry specified by the hCryptTls. Returns the thread specific pointer
  66. // to be freed by the caller.
  67. //--------------------------------------------------------------------------
  68. void *
  69. WINAPI
  70. I_CryptDetachTls(
  71. IN HCRYPTTLS hCryptTls
  72. );
  73. //+-------------------------------------------------------------------------
  74. // Install an OssGlobal entry and return a handle for future access.
  75. //
  76. // Each thread has its own copy of OssGlobal. Allocation and
  77. // initialization are deferred until first referenced by the thread.
  78. //
  79. // The parameter, pvCtlTbl is passed to ossinit() to initialize the OssGlobal.
  80. //
  81. // I_CryptGetOssGlobal must be called with the handled returned by
  82. // I_CryptInstallOssGlobal to get the thread specific OssGlobal.
  83. //
  84. // Currently, dwFlags and pvReserved aren't used and must be set to 0.
  85. //--------------------------------------------------------------------------
  86. HCRYPTOSSGLOBAL
  87. WINAPI
  88. I_CryptInstallOssGlobal(
  89. IN void *pvCtlTbl,
  90. IN DWORD dwFlags,
  91. IN void *pvReserved
  92. );
  93. //+-------------------------------------------------------------------------
  94. // Get the thread specific pointer to the OssGlobal specified by the
  95. // hOssGlobal returned by CryptInstallOssGlobal. If the
  96. // OssGlobal doesn't exist, then, its allocated and initialized using
  97. // the pvCtlTbl associated with hOssGlobal.
  98. //--------------------------------------------------------------------------
  99. POssGlobal
  100. WINAPI
  101. I_CryptGetOssGlobal(
  102. IN HCRYPTOSSGLOBAL hOssGlobal
  103. );
  104. #ifdef __cplusplus
  105. } // Balance extern "C" above
  106. #endif
  107. #endif