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.

80 lines
2.4 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. MRCICLASS.H
  5. Abstract:
  6. Wrapper class for MRCI 1 & MRCI 2 maxcompress
  7. and decompress functions
  8. History:
  9. paulall 1-Jul-97 Created
  10. --*/
  11. #include "MRCIcode.h"
  12. #include "corepol.h"
  13. #define DEFAULT_MRCI_BUFFER_SIZE (32*1024)
  14. class POLARITY CMRCIControl
  15. {
  16. private:
  17. BOOL bStop; //Do we need to abort compression...
  18. public:
  19. CMRCIControl() : bStop(FALSE) {} //Constructor
  20. void AbortCompression() { bStop = TRUE; } //Abort the compression request
  21. BOOL AbortRequested() { return bStop; } //Queries if an abort was requested
  22. void Reset() { bStop = FALSE; } //Reset everything to the norm
  23. };
  24. class POLARITY CMRCICompression : public CBaseMrciCompression
  25. {
  26. public:
  27. enum CompressionLevel { level1 = 1,
  28. level2 = 2 };
  29. CMRCICompression();
  30. ~CMRCICompression();
  31. BOOL CompressFile(const TCHAR *pchFromFile,
  32. const TCHAR *pchToFile,
  33. DWORD dwBufferSize = DEFAULT_MRCI_BUFFER_SIZE,
  34. CompressionLevel compressionLevel = level1,
  35. CMRCIControl *pControlObject = NULL);
  36. BOOL UncompressFile(const TCHAR *pchFromFile, const TCHAR *pchToFile);
  37. unsigned CompressBuffer(unsigned char *pFromBuffer,
  38. DWORD dwFromBufferSize,
  39. unsigned char *pToBuffer,
  40. DWORD dwToBufferSize,
  41. CompressionLevel compressionLevel = level1);
  42. unsigned UncompressBuffer(unsigned char *pFromBuffer,
  43. DWORD dwFromBufferSize,
  44. unsigned char *pToBuffer,
  45. DWORD dwToBufferSize,
  46. CompressionLevel compressionLevel = level1);
  47. static BOOL GetCompressedFileInfo(const TCHAR *pchFile,
  48. CompressionLevel &compressionLevel,
  49. DWORD &dwReadBufferSize,
  50. FILETIME &ftCreateTime,
  51. __int64 &dwOriginalSize);
  52. protected:
  53. BOOL CompressFileV1(int hFileFrom,
  54. int hFileTo,
  55. DWORD dwBufferSize,
  56. CompressionLevel compressionLevel,
  57. CMRCIControl *pControlObject);
  58. BOOL UncompressFileV1(int hFileFrom, int hFileTo);
  59. };