2011-11-29 20:18:23 +00:00
|
|
|
#ifndef FILE_H
|
|
|
|
#define FILE_H
|
|
|
|
|
2012-03-03 22:59:58 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2011-11-29 20:18:23 +00:00
|
|
|
/* Max valid value of uiLen for contains_data */
|
2014-11-17 23:41:46 +00:00
|
|
|
#define MAX_DATA_LEN 32768
|
2011-11-29 20:18:23 +00:00
|
|
|
|
2012-03-03 22:59:58 +00:00
|
|
|
/* Checks if a file contains a data pattern of length Len at position
|
|
|
|
Position. The file pointer will change when calling this function! */
|
|
|
|
int contains_data(FILE *fp, uint64_t Position,
|
|
|
|
const void *pData, uint64_t Len);
|
2011-11-29 20:18:23 +00:00
|
|
|
|
2012-03-03 22:59:58 +00:00
|
|
|
/* Writes a data pattern of length Len at position Position.
|
2011-11-29 20:18:23 +00:00
|
|
|
The file pointer will change when calling this function! */
|
2012-03-03 22:59:58 +00:00
|
|
|
int write_data(FILE *fp, uint64_t Position,
|
|
|
|
const void *pData, uint64_t Len);
|
2011-11-29 20:18:23 +00:00
|
|
|
|
2011-12-06 02:23:28 +00:00
|
|
|
/* Writes nSectors of size SectorSize starting at sector StartSector */
|
2012-03-03 22:59:58 +00:00
|
|
|
int64_t write_sectors(void *hDrive, uint64_t SectorSize,
|
|
|
|
uint64_t StartSector, uint64_t nSectors,
|
|
|
|
const void *pBuf);
|
2011-11-29 20:18:23 +00:00
|
|
|
|
2011-12-06 02:23:28 +00:00
|
|
|
/* Reads nSectors of size SectorSize starting at sector StartSector */
|
2012-03-03 22:59:58 +00:00
|
|
|
int64_t read_sectors(void *hDrive, uint64_t SectorSize,
|
|
|
|
uint64_t StartSector, uint64_t nSectors,
|
|
|
|
void *pBuf);
|
2011-11-29 20:18:23 +00:00
|
|
|
|
|
|
|
#endif
|