blob: 3f1f095b32fa1c9215e787a1a4bdafc49fc5f853 (
plain)
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
|
// PartitionType.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "PartitionType.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPartitionType dialog
CPartitionType::CPartitionType(CWnd* pParent /*=NULL*/)
: CDialog(CPartitionType::IDD, pParent)
{
//{{AFX_DATA_INIT(CPartitionType)
// NOTE: the ClassWizard will add member initialization here
m_Part = NULL;
m_cPartType = 0;
m_sDevice = _T("");
m_sPartType = _T("");
//}}AFX_DATA_INIT
}
void CPartitionType::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPartitionType)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPartitionType, CDialog)
//{{AFX_MSG_MAP(CPartitionType)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPartitionType message handlers
void CPartitionType::OnOK()
{
CString str;
CComboBox *cbList = (CComboBox *)GetDlgItem(IDC_PARTTION_TYPE_LIST);
m_cPartType = (UCHAR) cbList->GetCurSel();
if (m_cPartType != m_Part->Entry->Mbr.PartitionType) {
if (Ext2SetPartitionType(m_Part, m_cPartType)) {
str.Format("Succeed to set partition type to %2.2X: %s",
m_cPartType, PartitionString(m_cPartType));
AfxMessageBox(str, MB_OK | MB_ICONINFORMATION);
} else {
AfxMessageBox("Failed to set the partition type!",
MB_OK | MB_ICONWARNING);
m_cPartType = 0;
return;
}
} else {
AfxMessageBox("Same partition type to the previous. Nothing is changed !",
MB_OK | MB_ICONWARNING);
}
CDialog::OnOK();
}
BOOL CPartitionType::OnInitDialog()
{
CString str, type;
CDialog::OnInitDialog();
SET_TEXT(IDC_PARTITION_NAME, m_sDevice);
CComboBox *cbList = (CComboBox *)GetDlgItem(IDC_PARTTION_TYPE_LIST);
for (unsigned int i=0; i < 0x100; i++) {
type = PartitionString(i);
str.Format("%2.2X ", i);
if (type.CompareNoCase("UNKNOWN")) {
str += type;
}
cbList->AddString(str);
}
m_cPartType = m_Part->Entry->Mbr.PartitionType;
cbList->SetCurSel((int) m_cPartType);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
|