Source code of Windows XP (NT5)
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.

81 lines
1.9 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996-1998
  5. //
  6. // File: sysapi.h
  7. //
  8. // Contents: Support APIs used by licensing code
  9. //
  10. // History: 01-10-98 FredCh Created
  11. //
  12. //-----------------------------------------------------------------------------
  13. #ifndef _SYSAPI_H_
  14. #define _SYSAPI_H_
  15. #include "protect.h"
  16. #include "licemem.h"
  17. ///////////////////////////////////////////////////////////////////////////////
  18. // Binary blob API
  19. //
  20. VOID
  21. CopyBinaryBlob(
  22. PBYTE pbBuffer,
  23. PBinary_Blob pbbBlob,
  24. DWORD * pdwCount );
  25. LICENSE_STATUS
  26. GetBinaryBlob(
  27. PBinary_Blob pBBlob,
  28. PBYTE pMessage,
  29. PDWORD pcbProcessed );
  30. VOID
  31. FreeBinaryBlob(
  32. PBinary_Blob pBlob );
  33. #define GetBinaryBlobSize( _Blob ) sizeof( WORD ) + sizeof( WORD ) + _Blob.wBlobLen
  34. #define InitBinaryBlob( _pBlob ) \
  35. ( _pBlob )->pBlob = NULL; \
  36. ( _pBlob )->wBlobLen = 0;
  37. ///////////////////////////////////////////////////////////////////////////////
  38. // Hydra server certificate, public and private key API
  39. //
  40. LICENSE_STATUS
  41. GetServerCertificate(
  42. CERT_TYPE CertType,
  43. PBinary_Blob pCertBlob,
  44. DWORD dwKeyAlg );
  45. LICENSE_STATUS
  46. GetHydraServerPrivateKey(
  47. CERT_TYPE CertType,
  48. PBYTE * ppPrivateKey,
  49. PDWORD pcbPrivateKey );
  50. ///////////////////////////////////////////////////////////////////////////////
  51. // character conversion macros. Note: These macros allocate memory from
  52. // the program stack, so the returned memory does not need to be explicitly freed.
  53. //
  54. #define M2W( _pWchar, _pMchar ) \
  55. _pWchar = _alloca( ( _mbslen( ( unsigned char * )_pMchar ) + 1 ) * sizeof( WCHAR ) ); \
  56. if( _pWchar ) \
  57. { \
  58. mbstowcs( _pWchar, ( unsigned char * )_pMchar, _mbslen( ( unsigned char * )_pMchar ) + 1 ); \
  59. }
  60. #endif