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.

154 lines
3.9 KiB

  1. #ifndef _PATCH_LZX_H_
  2. #define _PATCH_LZX_H_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //
  7. // BUGBUG: 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_BLOCKSIZE 0x8000 // 32K
  13. #define LZX_MINWINDOW 0x20000 // 128K
  14. #define LZX_MAXWINDOW_8 ( 8*1024*1024) // 8MB
  15. #define LZX_MAXWINDOW_32 (32*1024*1024) // 32MB
  16. #ifndef PFNALLOC
  17. typedef PVOID ( __fastcall * PFNALLOC )( HANDLE hAllocator, ULONG Size );
  18. #endif
  19. //
  20. // The PFNALLOC function must return zeroed memory its caller, or NULL to
  21. // indicate insufficient memory.
  22. //
  23. // Note that no PFNFREE corresponding to PFNALLOC is specified. Functions
  24. // that take a PFNALLOC parameter use that routine for multiple allocations,
  25. // but it is the responsibility of the caller to free any allocations made
  26. // through the PFNALLOC allocator after the function has returned. This
  27. // scheme is used to facilitate multiple allocations that can be freed with
  28. // a single call such as a HeapCreate/HeapAlloc[...]/HeapDestroy sequence.
  29. //
  30. ULONG
  31. WINAPI
  32. EstimateLzxCompressionMemoryRequirement(
  33. IN ULONG OldDataSize,
  34. IN ULONG NewDataSize,
  35. IN ULONG OptionFlags,
  36. IN ULONG MaxWindow
  37. );
  38. ULONG
  39. WINAPI
  40. EstimateLzxDecompressionMemoryRequirement(
  41. IN ULONG OldDataSize,
  42. IN ULONG NewDataSize,
  43. IN ULONG OptionFlags,
  44. IN ULONG WindowSize
  45. );
  46. ULONG
  47. WINAPI
  48. RawLzxCompressBuffer(
  49. IN PVOID InDataBuffer,
  50. IN ULONG InDataSize,
  51. IN ULONG OutDataBufferSize,
  52. OUT PVOID OutDataBuffer OPTIONAL,
  53. OUT PULONG OutDataSize,
  54. IN ULONG WindowSize,
  55. IN PFNALLOC pfnAlloc,
  56. IN HANDLE AllocHandle,
  57. IN PPATCH_PROGRESS_CALLBACK ProgressCallback,
  58. IN PVOID CallbackContext,
  59. IN ULONG ProgressInitialValue,
  60. IN ULONG ProgressMaximumValue
  61. );
  62. ULONG
  63. WINAPI
  64. CreateRawLzxPatchDataFromBuffers(
  65. IN PVOID OldDataBuffer,
  66. IN ULONG OldDataSize,
  67. IN PVOID NewDataBuffer,
  68. IN ULONG NewDataSize,
  69. IN ULONG PatchBufferSize,
  70. OUT PVOID PatchBuffer,
  71. OUT ULONG *PatchSize,
  72. IN ULONG OptionFlags,
  73. IN ULONG MaxWindowSize,
  74. IN PPATCH_INTERLEAVE_MAP InterleaveMap,
  75. IN PFNALLOC pfnAlloc,
  76. IN HANDLE AllocHandle,
  77. IN PPATCH_PROGRESS_CALLBACK ProgressCallback,
  78. IN PVOID CallbackContext,
  79. IN ULONG ProgressInitialValue,
  80. IN ULONG ProgressMaximumValue
  81. );
  82. ULONG
  83. WINAPI
  84. ApplyRawLzxPatchToBuffer(
  85. IN PVOID OldDataBuffer,
  86. IN ULONG OldDataSize,
  87. IN PVOID PatchDataBuffer,
  88. IN ULONG PatchDataSize,
  89. OUT PVOID NewDataBuffer,
  90. IN ULONG NewDataSize,
  91. IN ULONG OptionFlags,
  92. IN ULONG WindowSize,
  93. IN PPATCH_INTERLEAVE_MAP InterleaveMap,
  94. IN PFNALLOC pfnAlloc,
  95. IN HANDLE AllocHandle,
  96. IN PPATCH_PROGRESS_CALLBACK ProgressCallback,
  97. IN PVOID CallbackContext,
  98. IN ULONG ProgressInitialValue,
  99. IN ULONG ProgressMaximumValue
  100. );
  101. ULONG
  102. __fastcall
  103. LzxWindowSize(
  104. IN ULONG OldDataSize,
  105. IN ULONG NewDataSize,
  106. IN DWORD OptionFlags,
  107. IN ULONG AbsoluteMax
  108. );
  109. ULONG
  110. __fastcall
  111. LzxMaxWindowSize(
  112. IN ULONG OptionFlags,
  113. IN ULONG AbsoluteMax
  114. );
  115. ULONG
  116. __fastcall
  117. LzxOldFileInsertSize(
  118. IN ULONG OldDataSize,
  119. IN DWORD OptionFlags,
  120. IN ULONG AbsoluteMaxWindow,
  121. IN PPATCH_INTERLEAVE_MAP InterleaveMap
  122. );
  123. PPATCH_INTERLEAVE_MAP
  124. CreateDefaultInterleaveMap(
  125. IN HANDLE SubAllocator,
  126. IN ULONG OldFileSize,
  127. IN ULONG NewFileSize,
  128. IN ULONG OptionFlags,
  129. IN ULONG MaxWindow
  130. );
  131. #ifdef __cplusplus
  132. }
  133. #endif
  134. #endif // _PATCH_LZX_H_