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.

94 lines
2.9 KiB

  1. // mxdi.h: Memory Decryption Interface
  2. //
  3. // To be used in combination with diamond's fdi.h
  4. //
  5. // Copyright (c) 1994 Microsoft Corporation. All rights reserved.
  6. // Microsoft Confidential.
  7. //
  8. //
  9. // Include <fdi.h> before this file
  10. #ifndef _MXDI_H_
  11. #define _MXDI_H_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif // __cplusplus
  15. typedef enum tagRCA
  16. {
  17. rcaSuccess,
  18. rcaOOM, // Out of memory
  19. rcaNoKey, // No key for this product
  20. rcaBadKey, // Key does not match file being decrypted
  21. rcaWrongCd, // You bought this product from another CD
  22. rcaWrongBatch, // You bought this product from another
  23. // batch of the same CD
  24. rcaBadLkdbVersion, //
  25. rcaLkdbNotFound, // Couldn't find lkdb or lkdb.dll
  26. rcaUnknownEncryptionMethod, //
  27. rcaBadParam, // Invalid parameter given
  28. rcaLkdbFileError, // Error reading, writing, or seeking
  29. // the LKDB
  30. rcaLkdbNotOnLocalDrive, // LKDB data is on non-local drive
  31. // encryption only
  32. rcaReservedSpaceTooSmall = 100, //
  33. } RCA; // result code in Alakazam
  34. ///////////////////////////////////////////////////////////
  35. // Backward compatibility bandaids.
  36. // These will be removed sooner than you'd hope.
  37. ///
  38. typedef void FAR * HMDI;
  39. #define FMDIAllocInit FMXDIAllocInit
  40. #define FMDIAssertInit FMXDIAssertInit
  41. #define MDICreate MXDICreate
  42. #define MDIDecrypt MXDIDecrypt
  43. #define MDIDestroy MXDIDestroy
  44. #define RcaFromHmdi RcaFromHmxdi
  45. ///////////////////////////////////////////////////////////
  46. typedef void FAR * HMXDI;
  47. typedef void FAR * (*PFNCRYPTALLOC) (unsigned long); // memory allocation functions
  48. typedef void (*PFNCRYPTFREE) (void FAR *); // memory allocation functions
  49. typedef void (*PFNCRYPTASSERT) (LPCSTR szMsg, LPCSTR szFile, UINT iLine);
  50. // These are the functions to be used in conjunction with Diamond
  51. //
  52. // main (...)
  53. // {
  54. // if (!FMXDIAllocInit(...))
  55. // abort();
  56. // hmxdi = MXDICreate();
  57. // if (NULL == hmxdi)
  58. // abort();
  59. // hfdi = FDICreate(...);
  60. // For all cabinets
  61. // if (!FDICopy(..., MXDIDecrypt, &hmxdi))
  62. // HandleErrors(..., RcaFromHmxdi(hmxdi));
  63. // FDIDestroy(hfdi);
  64. // MDIDestroy(hmxdi);
  65. // }
  66. //
  67. //
  68. //
  69. BOOL FMXDIAllocInit(PFNCRYPTALLOC pfnAlloc, PFNCRYPTFREE pfnFree) ;
  70. BOOL FMXDIAssertInit(PFNCRYPTASSERT pfnAssert);
  71. HMXDI FAR CDECL MXDICreate(void);
  72. int FAR CDECL MXDIDecrypt(PFDIDECRYPT pfdid);
  73. void FAR CDECL MXDIDestroy(HMXDI hmxdi);
  74. RCA RcaFromHmxdi(HMXDI hmxdi);
  75. #ifdef __cplusplus
  76. }
  77. #endif // __cplusplus
  78. #endif // !_MXDI_H_