汇聚知识碎片,解决技术难题,专注提供易语言源码资源,视频教程,等在线学习交流论坛
 
发新帖
楼主: 666
查看: 609|回复: 0

Nt_Compression_* - Routine

[复制链接]
666VIP1 发表于 2021-4-20 01:19:51 | 显示全部楼层
本帖最后由 666 于 2021-5-10 13:27 编辑
  1. .版本 2

  2. .局部变量 type
  3. .局部变量 CompressBufferWorkSpaceSize
  4. .局部变量 CompressFragmentWorkSpaceSize
  5. .局部变量 CompressBufferWorkSpace
  6. .局部变量 CompressBuffer
  7. .局部变量 z
  8. .局部变量 w
  9. .局部变量 PCompressBufferlen

  10. ' type = 位或 (#COMPRESSION_FORMAT_LZNT1, #COMPRESSION_ENGINE_STANDARD)
  11. type = 位或 (#COMPRESSION_FORMAT_LZNT1, #COMPRESSION_ENGINE_MAXIMUM)
  12. Nt_Compression_RtlGetCompressionWorkSpaceSize (type, Asm_GetH (CompressBufferWorkSpaceSize), Asm_GetH (CompressFragmentWorkSpaceSize))
  13. CompressBufferWorkSpace = Nt_Heap_RtlAllocateHeap (g_heap, 位或 (#HEAP_ZERO_MEMORY, #HEAP_GENERATE_EXCEPTIONS), CompressBufferWorkSpaceSize)  ' 申请算法所需缓冲长度

  14. z = Nt_Heap_RtlAllocateHeap (g_heap, #HEAP_GENERATE_EXCEPTIONS, 10240)  ' 待压缩数据
  15. CompressBuffer = Nt_Heap_RtlAllocateHeap (g_heap, 位或 (#HEAP_ZERO_MEMORY, #HEAP_GENERATE_EXCEPTIONS), 10240 + CompressBufferWorkSpaceSize)  ' 申请相应所需压缩后缓冲长度

  16. Nt_Compression_RtlCompressBuffer (type, z, Nt_Heap_RtlSizeHeap (g_heap, 0, z), CompressBuffer, Nt_Heap_RtlSizeHeap (g_heap, 0, CompressBuffer), CompressFragmentWorkSpaceSize, Asm_GetH (PCompressBufferlen), CompressBufferWorkSpace)

  17. w = Nt_Heap_RtlAllocateHeap (g_heap, 位或 (#HEAP_ZERO_MEMORY, #HEAP_GENERATE_EXCEPTIONS), 10240)  ' 待解压缩验证数据
  18. Nt_Compression_RtlDecompressBuffer (type, w, 10240, CompressBuffer, PCompressBufferlen, Asm_GetH (PCompressBufferlen))

  19. .判断开始 (Asm_memcmp (z, w, 10240) = 0)
  20.     输出调试文本 (“解压成功”)
  21. .默认
  22.     输出调试文本 (“解压错误”)
  23. .判断结束

  24. ' 释放掉内存
  25. Nt_Heap_RtlFreeHeap (g_heap, 0, CompressBufferWorkSpace)
  26. Nt_Heap_RtlFreeHeap (g_heap, 0, CompressBuffer)
  27. Nt_Heap_RtlFreeHeap (g_heap, 0, z)
  28. Nt_Heap_RtlFreeHeap (g_heap, 0, w)
复制代码

快速回复 返回顶部 返回列表