FileSystemBlockReaderInterface.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /******************************************************************************
  2. |* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  3. |* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4. |* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. |* PARTICULAR PURPOSE.
  6. |*
  7. |* Copyright 1995-2005 Nero AG. All Rights Reserved.
  8. |*-----------------------------------------------------------------------------
  9. |* NeroSDK / NeroAPI
  10. |*
  11. |* PROGRAM: FileSystemBlockReaderInterface.h
  12. |*
  13. |* PURPOSE: This file contains an abstract interface for reading from block
  14. |* devices. It will provide necessary data about the underlying
  15. |* medium as well as cache data if necessary.
  16. ******************************************************************************/
  17. #ifndef FILESYSTEMBLOCKREADERINTERFACE_H
  18. #define FILESYSTEMBLOCKREADERINTERFACE_H
  19. #include <windows.h>
  20. #if defined(__BORLANDC__)
  21. // NEROAPI expects structs to be 8byte aligned
  22. #pragma pack(push, 8)
  23. // tell Borland C++ Builder to treat enums as int
  24. #pragma option push -b
  25. #endif
  26. typedef __int64 NeroFSSecNo; // All sector references use this type. LBA adressing is used throughout the interface
  27. typedef enum
  28. {
  29. errOK=0,
  30. errEndOfDir, // Deprecated. Should never be returned, to be treated as errOK
  31. errEndOfFile, // Behaviour see libc read command
  32. errReadError,
  33. errInvalidFS,
  34. errNoDirectory,
  35. errNoFile,
  36. errNotSupported,
  37. errIllegalArgument,
  38. errWriteError,
  39. errInternalError,
  40. errFileLocked,
  41. errCopyProtected
  42. } NeroFSError;
  43. typedef enum
  44. {
  45. vtData=0, // track/partition contains data sectors
  46. vtAudio=1, // track/partition contains audio sectors
  47. vtReserved=2 // track/partition hasn't been written yet,
  48. // returned for reserved fragments of DVD+R media (NeroAPI 6.0.0.11+)
  49. } NeroFSTrackType;
  50. typedef struct
  51. {
  52. int PartitionNum; // The current partition number
  53. NeroFSSecNo PartitionStart; // The start sector for this Partition
  54. NeroFSSecNo PartitionSize; // The number of sectors this Partition contains
  55. NeroFSTrackType PartitionType; // The type of Partition
  56. DWORD sectorSize; // Sector size for this Partition
  57. } NeroFSPartitionInfo;
  58. class INeroFileSystemBlockReader
  59. {
  60. public:
  61. virtual int GetNumPartitions() = 0;
  62. virtual const NeroFSPartitionInfo &GetPartitionInfo(int iNumPartition) = 0;
  63. // Returns the partition a given sector resides in
  64. virtual const NeroFSPartitionInfo &GetPartitionForSector(NeroFSSecNo secNo) = 0;
  65. // Reading methods. The Buffered varient will use a cache to optimize filesystem access.
  66. // It should be used when reading directory structures while the UnBuffered method should be
  67. // used when reading file contents
  68. // Both methods return error codes as described in NeroFSError
  69. // Your read requests may not cross partition boundaries!
  70. virtual NeroFSError ReadSectorsBuffered (void *pData, NeroFSSecNo startSector, NeroFSSecNo noSectors, NeroFSSecNo &noSectorsRead) = 0;
  71. virtual NeroFSError ReadSectorsUnBuffered(void *pData, NeroFSSecNo startSector, NeroFSSecNo noSectors, NeroFSSecNo &noSectorsRead) = 0;
  72. virtual ~INeroFileSystemBlockReader() {};
  73. };
  74. #if defined(__BORLANDC__)
  75. #pragma pack(pop)
  76. #pragma option pop
  77. #endif
  78. #endif // FILESYSTEMBLOCKREADERINTERFACE_H