-
Notifications
You must be signed in to change notification settings - Fork 1
/
VhdToDisk.h
91 lines (71 loc) · 1.45 KB
/
VhdToDisk.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once
typedef struct
{
UINT16 cylinders;
UCHAR heads;
UCHAR sectors;
} VHD_GEOMETRY;
typedef struct _VHD_FOOTER
{
CHAR cookie[8];
UINT32 features;
UINT32 version;
UINT64 dataOffset;
UINT32 timeStamp;
CHAR creatorApplication[4];
UINT32 creatorVersion;
CHAR creatorOS[4];
UINT64 originalSize;
UINT64 currentSize;
VHD_GEOMETRY diskGeometry;
UINT32 diskType;
UINT32 checksum;
UCHAR uniqueId[16];
UCHAR savedState;
UCHAR padding[427];
}VHD_FOOTER, *PVHD_FOOTER;
typedef struct
{
CHAR cookie[8];
UINT64 dataOffset;
UINT64 tableOffset;
UINT32 headerVersion;
UINT32 maxTableEntries;
UINT32 blockSize;
UINT32 checksum;
UCHAR parentUniqueId[16];
UINT32 parentTimeStamp;
UINT32 reserved1;
UCHAR parentUnicodeName[512];
struct
{
UCHAR platformCode[4];
UINT32 platformDataSpace;
UINT32 platformDataLength;
UINT32 reserved;
UINT64 platformDataOffset;
} partentLocator[8];
UCHAR reserved2[256];
} VHD_DYNAMIC;
class CVhdToDisk
{
VHD_FOOTER m_Foot;
VHD_DYNAMIC m_Dyn;
HANDLE m_hVhdFile;
HANDLE m_hPhysicalDrive;
public:
CVhdToDisk(void);
CVhdToDisk(LPWSTR sPath);
~CVhdToDisk(void);
BOOL DumpVhdToDisk(const LPWSTR sPath, const LPWSTR sDrive, const HWND);
BOOL ParseFirstSector(HWND hDlg);
protected:
BOOL OpenVhdFile(LPWSTR sPath);
BOOL CloseVhdFile();
BOOL OpenPhysicalDrive(LPWSTR sDrive);
BOOL ClosePhysicalDrive();
BOOL ReadFooter();
BOOL ReadDynHeader();
UINT64 GetFirstSectorAddress();
BOOL Dump(HWND);
};