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.

83 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. ntcabp.h
  5. Abstract:
  6. This is the private header file used
  7. by the nt cab file engine.
  8. Author:
  9. Wesley Witt (wesw) 29-Sept-1998
  10. Revision History:
  11. --*/
  12. #include <nt.h>
  13. #include <ntrtl.h>
  14. #include <nturtl.h>
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17. #include <string.h>
  18. #include <windows.h>
  19. #include <imagehlp.h>
  20. #include <ntcabapi.h>
  21. #define ALIGNMENT_VALUE (512)
  22. #define ROUNDUP_ALIGNMENT(_x) (((_x)+(ALIGNMENT_VALUE-1)) & ~(ALIGNMENT_VALUE-1))
  23. #define ROUNDDOWN_ALIGNMENT(_x) ((_x) & ~(ALIGNMENT_VALUE-1))
  24. #define COMPRESSION_FLAGS (COMPRESSION_FORMAT_LZNT1|COMPRESSION_ENGINE_STANDARD)
  25. #define NTCAB_SIGNATURE (DWORD)'NTCB'
  26. #define NTCAB_VERSION 0x00010001
  27. typedef struct _CAB_HEADER {
  28. DWORD Signature;
  29. DWORD Version;
  30. DWORD DirOffset;
  31. } CAB_HEADER, *PCAB_HEADER;
  32. typedef struct _CAB_DIR_ENTRY {
  33. LIST_ENTRY Next;
  34. DWORD ChkSum;
  35. DWORD Offset;
  36. DWORD FileSize;
  37. DWORD CompressedFileSize;
  38. DWORD Segments;
  39. DWORD FileAttributes;
  40. FILETIME CreationTime;
  41. FILETIME LastAccessTime;
  42. FILETIME LastWriteTime;
  43. WCHAR FileName[16];
  44. DWORD Segment[0];
  45. } CAB_DIR_ENTRY, *PCAB_DIR_ENTRY;
  46. typedef struct _CAB_INSTANCE_DATA {
  47. LPBYTE WorkSpace;
  48. LPBYTE ReadBuf;
  49. ULONG ReadBufSize;
  50. LPBYTE CompressBuf;
  51. ULONG CompressBufSize;
  52. LIST_ENTRY CabDir;
  53. ULONG CabNum;
  54. HANDLE hCab;
  55. BOOL NewCabFile;
  56. LPWSTR CabFileName;
  57. ULONG CabDirOffset;
  58. } CAB_INSTANCE_DATA, *PCAB_INSTANCE_DATA;
  59. PCAB_DIR_ENTRY
  60. FindFileInCab(
  61. IN PCAB_INSTANCE_DATA CabInst,
  62. IN PCWSTR FileName
  63. );