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.

96 lines
1.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows NT Security
  4. // Copyright (C) Microsoft Corporation, 1997 - 1999
  5. //
  6. // File: cba.h
  7. //
  8. // Contents: CCryptBlobArray class definition
  9. //
  10. // History: 23-Jul-97 kirtd Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #if !defined(__CBA_H__)
  14. #define __CBA_H__
  15. #include <windows.h>
  16. #include <wincrypt.h>
  17. //
  18. // class CCryptBlobArray. This class manages a CRYPT_BLOB_ARRAY structure.
  19. // Note that the freeing of the internal array structure must be done
  20. // explicitly
  21. //
  22. class CCryptBlobArray
  23. {
  24. public:
  25. //
  26. // Construction
  27. //
  28. CCryptBlobArray (ULONG cMinBlobs, ULONG cGrowBlobs, BOOL& rfResult);
  29. // NOTE: Only accepts native form blob arrays or read-only single buffer
  30. // encoded arrays
  31. CCryptBlobArray (PCRYPT_BLOB_ARRAY pcba, ULONG cGrowBlobs);
  32. ~CCryptBlobArray () {};
  33. //
  34. // Blob management methods
  35. //
  36. static LPBYTE AllocBlob (ULONG cb);
  37. static LPBYTE ReallocBlob (LPBYTE pb, ULONG cb);
  38. static VOID FreeBlob (LPBYTE pb);
  39. BOOL AddBlob (ULONG cb, LPBYTE pb, BOOL fCopyBlob);
  40. PCRYPT_DATA_BLOB GetBlob (ULONG index);
  41. //
  42. // Array management methods
  43. //
  44. ULONG GetBlobCount ();
  45. VOID GetArrayInNativeForm (PCRYPT_BLOB_ARRAY pcba);
  46. BOOL GetArrayInSingleBufferEncodedForm (
  47. PCRYPT_BLOB_ARRAY* ppcba,
  48. ULONG* pcb = NULL
  49. );
  50. VOID FreeArray (BOOL fFreeBlobs);
  51. private:
  52. //
  53. // Internal blob array
  54. //
  55. CRYPT_BLOB_ARRAY m_cba;
  56. //
  57. // Current blob array size
  58. //
  59. ULONG m_cArray;
  60. //
  61. // Grow blobs by
  62. //
  63. ULONG m_cGrowBlobs;
  64. //
  65. // Private methods
  66. //
  67. BOOL GrowArray ();
  68. };
  69. #endif