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.

55 lines
1.0 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. init.c
  5. Abstract:
  6. This module contains the code to initialize
  7. the cab file engine.
  8. Author:
  9. Wesley Witt (wesw) 29-Sept-1998
  10. Revision History:
  11. --*/
  12. #include <ntcabp.h>
  13. #pragma hdrstop
  14. PVOID
  15. NtCabInitialize(
  16. void
  17. )
  18. {
  19. ULONG CompressBufferWorkSpaceSize;
  20. ULONG CompressFragmentWorkSpaceSize;
  21. PCAB_INSTANCE_DATA CabInst;
  22. CabInst = malloc( sizeof(CAB_INSTANCE_DATA) );
  23. ZeroMemory( CabInst, sizeof(CAB_INSTANCE_DATA) );
  24. RtlGetCompressionWorkSpaceSize(
  25. COMPRESSION_FLAGS,
  26. &CompressBufferWorkSpaceSize,
  27. &CompressFragmentWorkSpaceSize
  28. );
  29. CabInst->WorkSpace = (LPBYTE) malloc( CompressBufferWorkSpaceSize );
  30. ZeroMemory( CabInst->WorkSpace, CompressBufferWorkSpaceSize );
  31. CabInst->ReadBufSize = 4096*16;
  32. CabInst->ReadBuf = (LPBYTE) malloc( CabInst->ReadBufSize );
  33. CabInst->CompressBufSize = CabInst->ReadBufSize*2;
  34. CabInst->CompressBuf = (LPBYTE) malloc( CabInst->CompressBufSize );
  35. return CabInst;
  36. }