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.

97 lines
3.1 KiB

  1. //-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1995 - 1999
  6. //
  7. // File: tcrack.h
  8. //
  9. // Contents: The header of tcrack.cpp.
  10. //
  11. // History: 29-January-97 xiaohs created
  12. //
  13. //--------------------------------------------------------------------------
  14. #ifndef __TCRACK_H__
  15. #define __TCRACK_H__
  16. #include <windows.h>
  17. #include <stdlib.h>
  18. #include <stdio.h>
  19. #include <tchar.h>
  20. #include <assert.h>
  21. #include "wincrypt.h"
  22. //--------------------------------------------------------------------------
  23. // Contant Defines
  24. //--------------------------------------------------------------------------
  25. #define CRYPT_DECODE_FLAG CRYPT_DECODE_NOCOPY_FLAG
  26. #define CRYPT_ENCODE_TYPE X509_ASN_ENCODING
  27. //--------------------------------------------------------------------------
  28. // Macros
  29. //--------------------------------------------------------------------------
  30. //Macros for memory management
  31. #define SAFE_FREE(p1) {if(p1) {LocalFree(p1);p1=NULL;}}
  32. #define SAFE_ALLOC(p1) LocalAlloc(LPTR,p1)
  33. #define CHECK_POINTER(pv) { if(!pv) goto TCLEANUP;}
  34. //Macros for error checking
  35. #define TESTC(rev,exp) {if(!((rev)==(exp))) goto TCLEANUP; }
  36. //--------------------------------------------------------------------------
  37. // Inline Function
  38. //--------------------------------------------------------------------------
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif /* __cplusplus */
  42. //--------------------------------------------------------------------------
  43. // Function Prototype
  44. //--------------------------------------------------------------------------
  45. /////////////////////////////////////////////////////////////////////////////////
  46. //Error Manipulations
  47. void SetData(DWORD cbNewData, BYTE *pbNewData,
  48. DWORD *pcbOldData, BYTE **ppbOldData);
  49. ///////////////////////////////////////////////////////////////////////////////
  50. //Certificate Manipulations
  51. BOOL Fix7FCert(DWORD cbEncoded, BYTE *pbEncoded, DWORD *pcbEncoded,
  52. BYTE **ppbEncoded);
  53. BOOL DecodeBLOB(LPCSTR lpszStructType,DWORD cbEncoded, BYTE *pbEncoded,
  54. DWORD *pcbStructInfo, void **ppvStructInfo);
  55. BOOL EncodeStruct(LPCSTR lpszStructType, void *pStructInfo,DWORD *pcbEncoded,
  56. BYTE **ppbEncoded);
  57. BOOL DecodeX509_CERT(DWORD cbEncoded, BYTE *pbEncoded, DWORD *pcbEncoded,
  58. BYTE **ppbEncoded);
  59. BOOL DecodeX509_CERT_TO_BE_SIGNED(DWORD cbEncoded, BYTE *pbEncoded, DWORD *pcbEncoded,
  60. BYTE **ppbEncoded);
  61. BOOL DecodeX509_NAME(DWORD cbEncoded, BYTE *pbEncoded, DWORD *pcbEncoded,
  62. BYTE **ppbEncoded);
  63. ///////////////////////////////////////////////////////////////////////////////
  64. //General Decode/Encode Testing routines
  65. BOOL BadCert(DWORD cbEncoded, BYTE *pbEncoded);
  66. #ifdef __cplusplus
  67. }
  68. #endif /* __cplusplus */
  69. #endif // __TCRACK_H__