forked from floaterxk/DatDefragAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlockLoader.h
57 lines (39 loc) · 1.21 KB
/
BlockLoader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
struct DATHeader;
class BlockLoader
{
public:
BlockLoader();
~BlockLoader();
// Init Stuff
void Init(HANDLE hSourceFile, HANDLE hTempFile);
BOOL LoadHeader(DATHeader *pHeader);
BOOL AllocBlockForCopying();
void FreeBlockForCopying();
DWORD GetBlockSize();
DWORD GetFileSize();
// Block Chain
BOOL CopyBlockChain(DWORD dwSourceChain);
// Read/Write
BOOL ReadSourceData(LPVOID pBuffer, DWORD dwLength, DWORD dwOffset);
BOOL WriteTempData(LPVOID pBuffer, DWORD dwLength, DWORD dwOffset);
// Read blocks
BOOL Load_Data(LPVOID pBuffer, DWORD Length, DWORD dwFirstBlock);
// How many blocks are needed to fit this allocation size?
DWORD BlocksNeededForSize(DWORD dwAllocSize);
// Write data into next blocks.
BOOL CopyDataAsBlocks(BYTE* pbData, DWORD dwSize);
// Write empty blocks
BOOL WriteEmptyBlocks(DWORD Head, DWORD *pTail, DWORD *pCount, DWORD FileSize);
// Where the new data should be written
DWORD GetTargetBlockOffset();
void SetTargetBlockOffset(DWORD dwOffset);
BOOL CalcAllocBlocks(DWORD BlockHead, DWORD *pCount);
BOOL IsValidBlock(DWORD dwOffset);
private:
HANDLE m_hSourceFile;
HANDLE m_hTempFile;
DATHeader *m_pHeader;
BYTE *m_pCopyBlock;
DWORD m_dwTargetBlock;
};