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.

64 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. enum.c
  5. Abstract:
  6. This module contains the code to enumerate
  7. the files in a cab file.
  8. Author:
  9. Wesley Witt (wesw) 29-Sept-1998
  10. Revision History:
  11. --*/
  12. #include <ntcabp.h>
  13. #pragma hdrstop
  14. BOOL
  15. NtCabEnumerateFiles(
  16. IN PCAB_INSTANCE_DATA CabInst,
  17. IN PNTCABFILEENUM UserEnumFunc,
  18. IN ULONG_PTR Context
  19. )
  20. {
  21. PLIST_ENTRY Next;
  22. PCAB_DIR_ENTRY CabDir;
  23. NTCAB_ENUM_DATA EnumData;
  24. BOOL Abort = FALSE;
  25. Next = CabInst->CabDir.Flink;
  26. while ((ULONG_PTR)Next != (ULONG_PTR)&CabInst->CabDir) {
  27. CabDir = CONTAINING_RECORD( Next, CAB_DIR_ENTRY, Next );
  28. Next = CabDir->Next.Flink;
  29. EnumData.FileAttributes = CabDir->FileAttributes;
  30. EnumData.CompressedFileSize = CabDir->CompressedFileSize;
  31. EnumData.CreationTime = CabDir->CreationTime;
  32. EnumData.LastAccessTime = CabDir->LastAccessTime;
  33. EnumData.LastWriteTime = CabDir->LastWriteTime;
  34. EnumData.FileName = CabDir->FileName;
  35. if (!UserEnumFunc( &EnumData, Context )) {
  36. Abort = TRUE;
  37. break;
  38. }
  39. }
  40. if (Abort) {
  41. SetLastError(ERROR_REQUEST_ABORTED);
  42. } else {
  43. SetLastError(ERROR_NO_MORE_FILES);
  44. }
  45. return TRUE;
  46. }