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.

126 lines
3.2 KiB

  1. #ifndef _PATCH_LZX_H_
  2. #define _PATCH_LZX_H_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //
  7. // The patch code is using the LZX_MAXWINDOW value to compute
  8. // progress ranges. We need a better way to compute progress
  9. // ranges that doesn't need to know the details of the underlying
  10. // compression engine.
  11. //
  12. #define LZX_MAXWINDOW_8 (8*1024*1024) // 8MB
  13. #define LZX_MAXWINDOW_32 (32*1024*1024) // 32MB
  14. #ifndef PFNALLOC
  15. typedef PVOID ( __fastcall * PFNALLOC )( HANDLE hAllocator, ULONG Size );
  16. #endif
  17. //
  18. // The PFNALLOC function must return zeroed memory its caller, or NULL to
  19. // indicate insufficient memory.
  20. //
  21. // Note that no PFNFREE corresponding to PFNALLOC is specified. Functions
  22. // that take a PFNALLOC parameter use that routine for multiple allocations,
  23. // but it is the responsibility of the caller to free any allocations made
  24. // through the PFNALLOC allocator after the function has returned. This
  25. // scheme is used to facilitate multiple allocations that can be freed with
  26. // a single call such as a HeapCreate/HeapAlloc[...]/HeapDestroy sequence.
  27. //
  28. ULONG
  29. WINAPI
  30. EstimateLzxCompressionMemoryRequirement(
  31. IN ULONG OldDataSize,
  32. IN ULONG NewDataSize,
  33. IN ULONG OptionFlags
  34. );
  35. ULONG
  36. WINAPI
  37. EstimateLzxDecompressionMemoryRequirement(
  38. IN ULONG OldDataSize,
  39. IN ULONG NewDataSize,
  40. IN ULONG OptionFlags
  41. );
  42. ULONG
  43. WINAPI
  44. RawLzxCompressBuffer(
  45. IN PVOID InDataBuffer,
  46. IN ULONG InDataSize,
  47. IN ULONG OutDataBufferSize,
  48. OUT PVOID OutDataBuffer OPTIONAL,
  49. OUT PULONG OutDataSize,
  50. IN PFNALLOC pfnAlloc,
  51. IN HANDLE AllocHandle,
  52. IN PPATCH_PROGRESS_CALLBACK ProgressCallback,
  53. IN PVOID CallbackContext,
  54. IN ULONG ProgressInitialValue,
  55. IN ULONG ProgressMaximumValue
  56. );
  57. ULONG
  58. WINAPI
  59. CreateRawLzxPatchDataFromBuffers(
  60. IN PVOID OldDataBuffer,
  61. IN ULONG OldDataSize,
  62. IN PVOID NewDataBuffer,
  63. IN ULONG NewDataSize,
  64. IN ULONG PatchBufferSize,
  65. OUT PVOID PatchBuffer,
  66. OUT ULONG *PatchSize,
  67. IN ULONG OptionFlags,
  68. IN PVOID OptionData,
  69. IN PFNALLOC pfnAlloc,
  70. IN HANDLE AllocHandle,
  71. IN PPATCH_PROGRESS_CALLBACK ProgressCallback,
  72. IN PVOID CallbackContext,
  73. IN ULONG ProgressInitialValue,
  74. IN ULONG ProgressMaximumValue
  75. );
  76. ULONG
  77. WINAPI
  78. ApplyRawLzxPatchToBuffer(
  79. IN PVOID OldDataBuffer,
  80. IN ULONG OldDataSize,
  81. IN PVOID PatchDataBuffer,
  82. IN ULONG PatchDataSize,
  83. OUT PVOID NewDataBuffer,
  84. IN ULONG NewDataSize,
  85. IN ULONG OptionFlags,
  86. IN PVOID OptionData,
  87. IN PFNALLOC pfnAlloc,
  88. IN HANDLE AllocHandle,
  89. IN PPATCH_PROGRESS_CALLBACK ProgressCallback,
  90. IN PVOID CallbackContext,
  91. IN ULONG ProgressInitialValue,
  92. IN ULONG ProgressMaximumValue
  93. );
  94. ULONG
  95. __fastcall
  96. LzxWindowSize(
  97. IN ULONG OldDataSize,
  98. IN ULONG NewDataSize,
  99. IN DWORD OptionFlags
  100. );
  101. ULONG
  102. __fastcall
  103. LzxInsertSize(
  104. IN ULONG OldDataSize,
  105. IN DWORD OptionFlags
  106. );
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #endif // _PATCH_LZX_H_