#ifndef __TFFSREADER_H__ #define __TFFSREADER_H__ //======================================================================== // tffs bin part reading #include "itsutils.h" #define TFFS_BLOCK_SIZE 65536 #define TFFS_SECTOR_SIZE 512 #define DEVICENAMESIZE 8 #define PARTITIONNAMESIZE 32 // special values for binary partition number. #define BP_TFFSSECTOR 0xffffffff #define BP_WINCESECTOR 0xfffffffe #define BP_OTPSECTOR 0xfffffffd typedef struct tagDevStoreInfo { WCHAR szDeviceName[DEVICENAMESIZE]; ULONGLONG llStoreSize; } DevStoreInfo; typedef struct tagDevPartitionInfo { WCHAR szPartitionName[PARTITIONNAMESIZE]; ULONGLONG llPartitionSize; } DevPartitionInfo; typedef struct tagGetStoreMgrListResult { int nStores; DevStoreInfo storeInfo[1]; } GetStoreMgrListResult; #ifdef _WIN32_WCE ITSUTILS_API HRESULT STDAPICALLTYPE ITGetStoreMgrList( DWORD cbInput, void *pbInput, DWORD *pcbOutput, GetStoreMgrListResult**ppbOutput, IRAPIStream *pStream); #endif typedef struct tagGetPartitionListParams { WCHAR szDeviceName[DEVICENAMESIZE]; DWORD hStore; } GetPartitionListParams; typedef struct tagGetPartitionListResult { int nPartitions; DevPartitionInfo partInfo[1]; } GetPartitionListResult; #ifdef _WIN32_WCE ITSUTILS_API HRESULT STDAPICALLTYPE ITGetPartitionList( DWORD cbInput, GetPartitionListParams *pbInput, DWORD *pcbOutput, GetPartitionListResult **ppbOutput, IRAPIStream *pStream); #endif typedef struct tagGetSTRGHandleListResult { int nHandles; DWORD handle[1]; } GetSTRGHandleListResult; #ifdef _WIN32_WCE ITSUTILS_API HRESULT STDAPICALLTYPE ITGetSTRGHandleList( DWORD cbInput, void *pbInput, DWORD *pcbOutput, GetSTRGHandleListResult**ppbOutput, IRAPIStream *pStream); #endif // these structs are the same for several functions typedef struct tagReadDiskParams { WCHAR szDeviceName[DEVICENAMESIZE]; WCHAR szPartitionName[PARTITIONNAMESIZE]; DWORD hDisk; DWORD dwBinaryPartitionNr; char bdksign[4]; ULONGLONG llOffset; DWORD dwSize; DWORD dwSectorSize; // used to calculate sector address DWORD dwBlockSize; // data is read in blocksize chunks } ReadDiskParams; typedef struct tagReadDiskResult { DWORD dwNumberOfBytesRead; BYTE buffer[1]; } ReadDiskResult; #ifdef _WIN32_WCE ITSUTILS_API HRESULT STDAPICALLTYPE ITReadDisk( DWORD cbInput, ReadDiskParams *pbInput, DWORD *pcbOutput, ReadDiskResult **ppbOutput, IRAPIStream *pStream); #endif typedef struct tagWriteDiskParams { WCHAR szDeviceName[DEVICENAMESIZE]; WCHAR szPartitionName[PARTITIONNAMESIZE]; DWORD hDisk; DWORD dwBinaryPartitionNr; char bdksign[4]; DWORD pWriteEnableFlag; ULONGLONG llOffset; DWORD dwSize; DWORD dwSectorSize; // used to calculate sector address DWORD dwBlockSize; // data is read in blocksize chunks BYTE buffer[1]; } WriteDiskParams; typedef struct tagWriteDiskResult { DWORD dwNumberOfBytesWritten; } WriteDiskResult; #ifdef _WIN32_WCE ITSUTILS_API HRESULT STDAPICALLTYPE ITWriteDisk( DWORD cbInput, WriteDiskParams *pbInput, DWORD *pcbOutput, WriteDiskResult **ppbOutput, IRAPIStream *pStream); #endif typedef struct tagTFFSGetInfoParams { WCHAR szDeviceName[DEVICENAMESIZE]; WCHAR szPartitionName[PARTITIONNAMESIZE]; DWORD hDisk; DWORD dwBinaryPartitionNr; char bdksign[4]; } TFFSGetInfoParams; typedef struct tagTFFSGetInfoResult { DWORD dwSectorSize; ULONGLONG llDiskSize; GUID uniqueid; DWORD customerid; DWORD dwNrofBinPartitions; DWORD dwNrPartitions; } TFFSGetInfoResult; #ifdef _WIN32_WCE ITSUTILS_API HRESULT STDAPICALLTYPE ITTFFSGetInfo( DWORD cbInput, TFFSGetInfoParams *pbInput, DWORD *pcbOutput, TFFSGetInfoResult **ppbOutput, IRAPIStream *pStream); #endif typedef struct tagLogDiskInfoParams { WCHAR szDeviceName[DEVICENAMESIZE]; WCHAR szPartitionName[PARTITIONNAMESIZE]; DWORD hDisk; DWORD dwBinaryPartitionNr; char bdksign[4]; } LogDiskInfoParams; #ifdef _WIN32_WCE ITSUTILS_API HRESULT STDAPICALLTYPE ITLogDiskInfo( DWORD cbInput, LogDiskInfoParams *pbInput, DWORD *pcbOutput, BYTE **ppbOutput, IRAPIStream *pStream); #endif typedef struct tagDiskProtectParams { WCHAR szDeviceName[DEVICENAMESIZE]; WCHAR szPartitionName[PARTITIONNAMESIZE]; DWORD hDisk; DWORD dwBinaryPartitionNr; char bdksign[4]; bool bInsert; BYTE password[8]; } DiskProtectParams; typedef struct tagDiskProtectResult { DWORD dwStatus; } DiskProtectResult; #ifdef _WIN32_WCE ITSUTILS_API HRESULT STDAPICALLTYPE ITDiskProtect( DWORD cbInput, DiskProtectParams *pbInput, DWORD *pcbOutput, DiskProtectResult **ppbOutput, IRAPIStream *pStream); #endif #endif