This repository has been archived by the owner on Mar 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAMRResumeDlg.cpp
146 lines (115 loc) · 4.12 KB
/
AMRResumeDlg.cpp
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// AMRResumeDlg.cpp : implementation file
//
#include "stdafx.h"
#include "NDBView.h"
#include "AMRResumeDlg.h"
// CAMRResumeDlg dialog
IMPLEMENT_DYNAMIC(CAMRResumeDlg, CDialog)
CAMRResumeDlg::CAMRResumeDlg(NDBViewer * pNDBViewer, CNDBViewDlg * pNDBViewDlg, CWnd* pParent)
: CNDBViewChildDlg(pNDBViewDlg, CAMRResumeDlg::IDD, pParent),
m_frc(0, pNDBViewer->GetHeader().root.ibFileEof, pNDBViewer)
{
m_pNDBViewer = pNDBViewer;
}
CAMRResumeDlg::~CAMRResumeDlg()
{
}
void CAMRResumeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_CUSTOM1, m_frc);
DDX_Control(pDX, IDC_LIST1, m_clc);
}
BEGIN_MESSAGE_MAP(CAMRResumeDlg, CDialog)
END_MESSAGE_MAP()
// CAMRResumeDlg message handlers
BOOL CAMRResumeDlg::OnInitDialog()
{
AMAPREBUILDRESUMEINFO amri;
BOOL fAMapValid;
BOOL fNBTValid;
BOOL fBBTValid;
BOOL fEofValid;
CBitmap cb;
RECT r;
BOOL fResumeValid;
WCHAR buffer[255];
int count = 0;
int nImage;
CNDBViewChildDlg::OnInitDialog();
cb.LoadBitmap(IDB_BITMAP2);
m_il.Create(16, 16, ILC_COLOR24, 10, 1);
m_il.Add(&cb, RGB(255, 0, 255));
m_il.SetBkColor(CLR_NONE);
m_clc.SetImageList(&m_il, LVSIL_SMALL);
m_clc.GetClientRect(&r);
m_clc.InsertColumn(0, L"Field", LVCFMT_LEFT, r.right / 3);
m_clc.InsertColumn(1, L"Value", LVCFMT_LEFT, r.right / 3);
m_clc.InsertColumn(2, L"Comment", LVCFMT_LEFT, r.right / 3);
m_pNDBViewer->ReadData((BYTE*)&amri, sizeof(AMAPREBUILDRESUMEINFO), NULL, NULL, ibAMapBase, sizeof(AMAPREBUILDRESUMEINFO));
fNBTValid = amri.bidNBTRoot == m_pNDBViewer->GetHeader().root.brefNBT.bid;
fBBTValid = amri.bidBBTRoot == m_pNDBViewer->GetHeader().root.brefNBT.bid;
fEofValid = amri.ibAMapRebuildWatermark < m_pNDBViewer->GetHeader().root.ibFileEof;
fResumeValid = fNBTValid && fBBTValid && fEofValid;
// Is the AMapValid?
fAMapValid = m_pNDBViewer->GetHeader().root.fAMapValid;
nImage = iconPass;
m_clc.InsertItem(count++, L"root.fAMapValid", nImage);
wsprintf(buffer, L"0x%X", m_pNDBViewer->GetHeader().root.fAMapValid);
m_clc.SetItemText(count-1, 1, buffer);
if(!fAMapValid)
{
if(fResumeValid)
{
m_frc.AddRange(0, amri.ibAMapRebuildWatermark, TYPE_BLOCK);
}
else
{
m_frc.AddRange(0, m_pNDBViewer->GetHeader().root.ibFileEof, TYPE_BLOCK);
}
// bidNBTRoot
nImage = fNBTValid ? iconPass : iconCorrupt;
m_clc.InsertItem(count++, L"amri.bidNBTRoot", nImage);
wsprintf(buffer, L"0x%I64X", amri.bidNBTRoot);
m_clc.SetItemText(count-1, 1, buffer);
if(!fNBTValid)
{
wsprintf(buffer, L"Does not match header (0x%I64X)", m_pNDBViewer->GetHeader().root.brefNBT.bid);
m_clc.SetItemText(count-1, 2, buffer);
}
// bidBBTRoot
nImage = fBBTValid ? iconPass : iconCorrupt;
m_clc.InsertItem(count++, L"amri.bidBBTRoot", nImage);
wsprintf(buffer, L"0x%I64X", amri.bidBBTRoot);
m_clc.SetItemText(count-1, 1, buffer);
if(!fBBTValid)
{
wsprintf(buffer, L"Does not match header (0x%I64X)", m_pNDBViewer->GetHeader().root.brefBBT.bid);
m_clc.SetItemText(count-1, 2, buffer);
}
// ibAMapRebuildWatermark
nImage = fEofValid ? iconPass : iconCorrupt;
m_clc.InsertItem(count++, L"amri.ibAMapRebuildWatermark", nImage);
wsprintf(buffer, L"%I64u", amri.ibAMapRebuildWatermark);
m_clc.SetItemText(count-1, 1, buffer);
if(!fEofValid)
{
wsprintf(buffer, L"Greater than header value (%I64u)", m_pNDBViewer->GetHeader().root.ibFileEof);
m_clc.SetItemText(count-1, 2, buffer);
}
// else
// {
// double d = 0.0;
// d = (((double)(m_pNDBViewer->GetHeader().root.ibFileEof) - (double)(amri.ibAMapRebuildWatermark)) / (double)(m_pNDBViewer->GetHeader().root.ibFileEof)) * 100.0;
// wsprintf(buffer, L"Percent Complete: %.2ld%%", d);
// m_clc.SetItemText(count-1, 2, buffer);
// }
// btKey
nImage = iconInternal;
m_clc.InsertItem(count++, L"amri.btKeyMax", nImage);
wsprintf(buffer, L"0x%I64X", amri.btKeyMax);
m_clc.SetItemText(count-1, 1, buffer);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}