1
0
mirror of https://github.com/bobranten/Ext4Fsd.git synced 2025-10-29 13:18:30 -05:00

line endings conversions

This commit is contained in:
Bo Brantén
2020-09-28 15:54:32 +02:00
parent 9ec6bea652
commit 0874d18db1
47 changed files with 21348 additions and 21348 deletions

View File

@@ -1,168 +1,168 @@
// DelDeadLetter.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "DelDeadLetter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDelDeadLetter dialog
CDelDeadLetter::CDelDeadLetter(CWnd* pParent /*=NULL*/)
: CDialog(CDelDeadLetter::IDD, pParent)
{
//{{AFX_DATA_INIT(CDelDeadLetter)
m_sDrvLetter = _T("");
m_bAutoRemoval = g_bAutoRemoveDeadLetters;
m_bKeepIt = TRUE;
//}}AFX_DATA_INIT
}
void CDelDeadLetter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDelDeadLetter)
DDX_CBString(pDX, IDC_DEAD_LETTER_LIST, m_sDrvLetter);
DDX_Check(pDX, IDC_AUTO_REMOVAL, m_bAutoRemoval);
DDX_Check(pDX, IDC_REMOVAL_CURRENT, m_bKeepIt);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDelDeadLetter, CDialog)
//{{AFX_MSG_MAP(CDelDeadLetter)
ON_BN_CLICKED(ID_RELOAD_DL, OnReloadDl)
ON_BN_CLICKED(IDC_AUTO_REMOVAL, OnAutoRemoval)
ON_BN_CLICKED(IDC_AUTOREMOVALTEXT, OnAutoremovaltext)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDelDeadLetter message handlers
void CDelDeadLetter::OnOK()
{
CHAR drvChar;
PEXT2_LETTER drvLetter = NULL;
UpdateData(TRUE);
drvChar = m_sDrvLetter.GetAt(0);
if ((drvChar >= '0') && (drvChar <= '9')) {
drvLetter = &drvDigits[drvChar - '0'];
}
if ((drvChar >= 'A') && (drvChar <= 'Z')) {
drvLetter = &drvLetters[drvChar - 'A'];
}
if (drvLetter) {
if (AfxMessageBox("Warning: the driver letter might be still used. Are you\r\n"
" sure that make it's a real dead driver letter ?", MB_YESNO) == IDYES) {
Ext2RemoveMountPoint(drvLetter, !m_bKeepIt);
Ext2RemoveDosSymLink(drvLetter->Letter);
UpdateDeadLetterList();
}
}
}
BOOL CDelDeadLetter::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateDeadLetterList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
VOID
CDelDeadLetter::UpdateDeadLetterList()
{
ULONGLONG LetterMask = -1;
DWORD i, j;
PEXT2_VOLUME volume;
PEXT2_DISK disk;
PEXT2_PARTITION part;
PEXT2_CDROM cdrom;
CString str;
CComboBox *cbList = (CComboBox *)GetDlgItem(IDC_DEAD_LETTER_LIST);
cbList->ResetContent();
for (volume = gVols; volume != NULL; volume = volume->Next) {
LetterMask &= ~(volume->DrvLetters);
}
for (i = 0; i < g_nDisks; i++) {
disk = &gDisks[i];
if (disk->DataParts == NULL) {
continue;
}
for (j=0; j < disk->NumParts; j++) {
part = &disk->DataParts[j];
if (part) {
LetterMask &= ~(part->DrvLetters);
}
}
}
for (i = 0; i < g_nCdroms; i++) {
cdrom = &gCdroms[i];
LetterMask &= ~(cdrom->DrvLetters);
}
for (i=0; i < 10; i++) {
if (drvDigits[i].bUsed && (drvDigits[i].Extent == NULL) &&
(LetterMask & (((ULONGLONG) 1) << (i + 32)) ) ) {
str.Format("%c: ", drvDigits[i].Letter);
str += drvDigits[i].SymLink;
cbList->AddString(str);
}
}
for (i=0; i <26; i++) {
if (drvLetters[i].bUsed && (drvLetters[i].Extent == NULL) &&
(LetterMask & (((ULONGLONG) 1) << i)) ) {
str.Format("%c: ", drvLetters[i].Letter);
str += drvLetters[i].SymLink;
cbList->AddString(str);
}
}
#if 0
if (cbList->GetCount() == 0) {
AfxMessageBox("No dead driver letters exist :)", MB_OK|MB_ICONINFORMATION);
EndDialog(TRUE);
}
#endif
cbList->SetCurSel(0);
}
void CDelDeadLetter::OnReloadDl()
{
// TODO: Add your control notification handler code here
UpdateDeadLetterList();
}
void CDelDeadLetter::OnAutoRemoval()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
g_bAutoRemoveDeadLetters = m_bAutoRemoval;
}
void CDelDeadLetter::OnAutoremovaltext()
{
}
// DelDeadLetter.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "DelDeadLetter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDelDeadLetter dialog
CDelDeadLetter::CDelDeadLetter(CWnd* pParent /*=NULL*/)
: CDialog(CDelDeadLetter::IDD, pParent)
{
//{{AFX_DATA_INIT(CDelDeadLetter)
m_sDrvLetter = _T("");
m_bAutoRemoval = g_bAutoRemoveDeadLetters;
m_bKeepIt = TRUE;
//}}AFX_DATA_INIT
}
void CDelDeadLetter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDelDeadLetter)
DDX_CBString(pDX, IDC_DEAD_LETTER_LIST, m_sDrvLetter);
DDX_Check(pDX, IDC_AUTO_REMOVAL, m_bAutoRemoval);
DDX_Check(pDX, IDC_REMOVAL_CURRENT, m_bKeepIt);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDelDeadLetter, CDialog)
//{{AFX_MSG_MAP(CDelDeadLetter)
ON_BN_CLICKED(ID_RELOAD_DL, OnReloadDl)
ON_BN_CLICKED(IDC_AUTO_REMOVAL, OnAutoRemoval)
ON_BN_CLICKED(IDC_AUTOREMOVALTEXT, OnAutoremovaltext)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDelDeadLetter message handlers
void CDelDeadLetter::OnOK()
{
CHAR drvChar;
PEXT2_LETTER drvLetter = NULL;
UpdateData(TRUE);
drvChar = m_sDrvLetter.GetAt(0);
if ((drvChar >= '0') && (drvChar <= '9')) {
drvLetter = &drvDigits[drvChar - '0'];
}
if ((drvChar >= 'A') && (drvChar <= 'Z')) {
drvLetter = &drvLetters[drvChar - 'A'];
}
if (drvLetter) {
if (AfxMessageBox("Warning: the driver letter might be still used. Are you\r\n"
" sure that make it's a real dead driver letter ?", MB_YESNO) == IDYES) {
Ext2RemoveMountPoint(drvLetter, !m_bKeepIt);
Ext2RemoveDosSymLink(drvLetter->Letter);
UpdateDeadLetterList();
}
}
}
BOOL CDelDeadLetter::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateDeadLetterList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
VOID
CDelDeadLetter::UpdateDeadLetterList()
{
ULONGLONG LetterMask = -1;
DWORD i, j;
PEXT2_VOLUME volume;
PEXT2_DISK disk;
PEXT2_PARTITION part;
PEXT2_CDROM cdrom;
CString str;
CComboBox *cbList = (CComboBox *)GetDlgItem(IDC_DEAD_LETTER_LIST);
cbList->ResetContent();
for (volume = gVols; volume != NULL; volume = volume->Next) {
LetterMask &= ~(volume->DrvLetters);
}
for (i = 0; i < g_nDisks; i++) {
disk = &gDisks[i];
if (disk->DataParts == NULL) {
continue;
}
for (j=0; j < disk->NumParts; j++) {
part = &disk->DataParts[j];
if (part) {
LetterMask &= ~(part->DrvLetters);
}
}
}
for (i = 0; i < g_nCdroms; i++) {
cdrom = &gCdroms[i];
LetterMask &= ~(cdrom->DrvLetters);
}
for (i=0; i < 10; i++) {
if (drvDigits[i].bUsed && (drvDigits[i].Extent == NULL) &&
(LetterMask & (((ULONGLONG) 1) << (i + 32)) ) ) {
str.Format("%c: ", drvDigits[i].Letter);
str += drvDigits[i].SymLink;
cbList->AddString(str);
}
}
for (i=0; i <26; i++) {
if (drvLetters[i].bUsed && (drvLetters[i].Extent == NULL) &&
(LetterMask & (((ULONGLONG) 1) << i)) ) {
str.Format("%c: ", drvLetters[i].Letter);
str += drvLetters[i].SymLink;
cbList->AddString(str);
}
}
#if 0
if (cbList->GetCount() == 0) {
AfxMessageBox("No dead driver letters exist :)", MB_OK|MB_ICONINFORMATION);
EndDialog(TRUE);
}
#endif
cbList->SetCurSel(0);
}
void CDelDeadLetter::OnReloadDl()
{
// TODO: Add your control notification handler code here
UpdateDeadLetterList();
}
void CDelDeadLetter::OnAutoRemoval()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
g_bAutoRemoveDeadLetters = m_bAutoRemoval;
}
void CDelDeadLetter::OnAutoremovaltext()
{
}

View File

@@ -1,54 +1,54 @@
#if !defined(AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_)
#define AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DelDeadLetter.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDelDeadLetter dialog
class CDelDeadLetter : public CDialog
{
// Construction
public:
CDelDeadLetter(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDelDeadLetter)
enum { IDD = IDD_REMOVE_DEADLETTER };
CString m_sDrvLetter;
BOOL m_bAutoRemoval;
BOOL m_bKeepIt;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDelDeadLetter)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
VOID UpdateDeadLetterList();
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDelDeadLetter)
virtual void OnOK();
virtual BOOL OnInitDialog();
afx_msg void OnReloadDl();
afx_msg void OnAutoRemoval();
afx_msg void OnAutoremovaltext();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_)
#if !defined(AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_)
#define AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DelDeadLetter.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDelDeadLetter dialog
class CDelDeadLetter : public CDialog
{
// Construction
public:
CDelDeadLetter(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDelDeadLetter)
enum { IDD = IDD_REMOVE_DEADLETTER };
CString m_sDrvLetter;
BOOL m_bAutoRemoval;
BOOL m_bKeepIt;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDelDeadLetter)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
VOID UpdateDeadLetterList();
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDelDeadLetter)
virtual void OnOK();
virtual BOOL OnInitDialog();
afx_msg void OnReloadDl();
afx_msg void OnAutoRemoval();
afx_msg void OnAutoremovaltext();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_)

View File

@@ -1,136 +1,136 @@
// DiskBox.cpp : implementation file
//
#include "stdafx.h"
#include "DiskBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDiskBox
CDiskBox::CDiskBox()
{
m_nID = IDC_PROPERTY_DEVICE;
m_nLeft = 10;
m_nSize = 80;
}
CDiskBox::~CDiskBox()
{
}
BEGIN_MESSAGE_MAP(CDiskBox, CButton)
//{{AFX_MSG_MAP(CDiskBox)
ON_WM_SETFOCUS()
ON_CBN_SELCHANGE(IDC_PROPERTY_DEVICE, OnSelectChanged)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDiskBox message handlers
void CDiskBox::OnSelectChanged()
{
GetParent()->SendMessage(WM_GROUP_BOX_UPDATED, 'GB', 'DVLU');
}
void CDiskBox::PreSubclassWindow()
{
//
// Make sure that this control has the BS_ICON style set.
// If not, it behaves very strangely:
// It erases itself if the user TABs to controls in the dialog,
// unless the user first clicks it. Very strange!!
//
ModifyStyle(0, BS_ICON|WS_TABSTOP|WS_GROUP);
CString strTitle;
GetWindowText(strTitle);
int nWidth = AssemblingTitle();
CRect r;
GetWindowRect(&r);
ScreenToClient(r);
r.OffsetRect(m_nLeft, 0);
r.bottom = r.top + m_nSize;
r.right = r.left + m_nSize + nWidth;
m_ComboBox.Create(WS_CHILD | CBS_DROPDOWN | WS_VSCROLL |
CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST,
r, this, m_nID);
m_ComboBox.SetFont(GetFont(), true);
m_ComboBox.ShowWindow(SW_SHOW);
SetListboxHeight(m_ComboBox.m_hWnd);
}
void CDiskBox::SetListboxHeight(HWND hWnd)
{
RECT rc;
::SendMessage(hWnd, LB_GETITEMRECT, 0, (LPARAM)&rc);
::GetClientRect(hWnd, &rc);
int cyClient= rc.bottom - rc.top;
::GetWindowRect(hWnd, &rc);
int cxListbox = rc.right - rc.left;
int cyListbox = rc.bottom - rc.top;
if (g_nDisks + g_nCdroms > 8) {
cyListbox = 18*8;
} else if (g_nDisks + g_nCdroms > 4) {
cyListbox = max(80, 18 * (g_nDisks + g_nCdroms));
} else {
cyListbox = 80;
}
::SetWindowPos(hWnd, NULL, 0, 0,
cxListbox, cyListbox,
SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS|
SWP_NOOWNERZORDER|SWP_NOZORDER
);
}
int CDiskBox::AssemblingTitle()
{
//
// The group box title needs to be erased, but I need to keep
// the border away from the check box text. I create a string
// of spaces (' ') that is the same length as the title was
// plus the size of the checkbox. plus a little more.
//
CString strOldTitle, strNewTitle;
GetWindowText(strOldTitle);
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(GetFont());
CSize czText = dc.GetTextExtent(strOldTitle);
int nRet = czText.cx;
int nTarget = czText.cx + m_nSize;
while(czText.cx < nTarget)
{
strNewTitle.Insert(0, ' ');
czText = dc.GetTextExtent(strNewTitle);
}
dc.SelectObject(pOldFont);
SetWindowText(strNewTitle);
return nRet;
}
void CDiskBox::OnSetFocus(CWnd* pOldWnd)
{
CButton::OnSetFocus(pOldWnd);
m_ComboBox.SetFocus();
}
// DiskBox.cpp : implementation file
//
#include "stdafx.h"
#include "DiskBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDiskBox
CDiskBox::CDiskBox()
{
m_nID = IDC_PROPERTY_DEVICE;
m_nLeft = 10;
m_nSize = 80;
}
CDiskBox::~CDiskBox()
{
}
BEGIN_MESSAGE_MAP(CDiskBox, CButton)
//{{AFX_MSG_MAP(CDiskBox)
ON_WM_SETFOCUS()
ON_CBN_SELCHANGE(IDC_PROPERTY_DEVICE, OnSelectChanged)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDiskBox message handlers
void CDiskBox::OnSelectChanged()
{
GetParent()->SendMessage(WM_GROUP_BOX_UPDATED, 'GB', 'DVLU');
}
void CDiskBox::PreSubclassWindow()
{
//
// Make sure that this control has the BS_ICON style set.
// If not, it behaves very strangely:
// It erases itself if the user TABs to controls in the dialog,
// unless the user first clicks it. Very strange!!
//
ModifyStyle(0, BS_ICON|WS_TABSTOP|WS_GROUP);
CString strTitle;
GetWindowText(strTitle);
int nWidth = AssemblingTitle();
CRect r;
GetWindowRect(&r);
ScreenToClient(r);
r.OffsetRect(m_nLeft, 0);
r.bottom = r.top + m_nSize;
r.right = r.left + m_nSize + nWidth;
m_ComboBox.Create(WS_CHILD | CBS_DROPDOWN | WS_VSCROLL |
CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST,
r, this, m_nID);
m_ComboBox.SetFont(GetFont(), true);
m_ComboBox.ShowWindow(SW_SHOW);
SetListboxHeight(m_ComboBox.m_hWnd);
}
void CDiskBox::SetListboxHeight(HWND hWnd)
{
RECT rc;
::SendMessage(hWnd, LB_GETITEMRECT, 0, (LPARAM)&rc);
::GetClientRect(hWnd, &rc);
int cyClient= rc.bottom - rc.top;
::GetWindowRect(hWnd, &rc);
int cxListbox = rc.right - rc.left;
int cyListbox = rc.bottom - rc.top;
if (g_nDisks + g_nCdroms > 8) {
cyListbox = 18*8;
} else if (g_nDisks + g_nCdroms > 4) {
cyListbox = max(80, 18 * (g_nDisks + g_nCdroms));
} else {
cyListbox = 80;
}
::SetWindowPos(hWnd, NULL, 0, 0,
cxListbox, cyListbox,
SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS|
SWP_NOOWNERZORDER|SWP_NOZORDER
);
}
int CDiskBox::AssemblingTitle()
{
//
// The group box title needs to be erased, but I need to keep
// the border away from the check box text. I create a string
// of spaces (' ') that is the same length as the title was
// plus the size of the checkbox. plus a little more.
//
CString strOldTitle, strNewTitle;
GetWindowText(strOldTitle);
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(GetFont());
CSize czText = dc.GetTextExtent(strOldTitle);
int nRet = czText.cx;
int nTarget = czText.cx + m_nSize;
while(czText.cx < nTarget)
{
strNewTitle.Insert(0, ' ');
czText = dc.GetTextExtent(strNewTitle);
}
dc.SelectObject(pOldFont);
SetWindowText(strNewTitle);
return nRet;
}
void CDiskBox::OnSetFocus(CWnd* pOldWnd)
{
CButton::OnSetFocus(pOldWnd);
m_ComboBox.SetFocus();
}

View File

@@ -1,60 +1,60 @@
#if !defined(AFX_DISK_BOX_H_)
#define AFX_DISK_BOX_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DiskBox.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDiskBox window
class CDiskBox : public CButton
{
// Construction
public:
CDiskBox();
// Operations
public:
void SetListboxHeight(HWND);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDiskBox)
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CDiskBox();
// Generated message map functions
protected:
//{{AFX_MSG(CDiskBox)
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSelectChanged();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
int m_nID;
int m_nLeft;
int m_nSize;
CComboBox m_ComboBox;
private:
int AssemblingTitle();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
#if !defined(AFX_DISK_BOX_H_)
#define AFX_DISK_BOX_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DiskBox.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDiskBox window
class CDiskBox : public CButton
{
// Construction
public:
CDiskBox();
// Operations
public:
void SetListboxHeight(HWND);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDiskBox)
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CDiskBox();
// Generated message map functions
protected:
//{{AFX_MSG(CDiskBox)
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSelectChanged();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
int m_nID;
int m_nLeft;
int m_nSize;
CComboBox m_ComboBox;
private:
int AssemblingTitle();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif

View File

@@ -1,78 +1,78 @@
// DlgView.cpp : implementation file
//
#include "stdafx.h"
#include "DlgView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgView
IMPLEMENT_DYNCREATE(CDlgView, CScrollView)
CDlgView::CDlgView()
{
}
CDlgView::~CDlgView()
{
}
BEGIN_MESSAGE_MAP(CDlgView, CScrollView)
//{{AFX_MSG_MAP(CDlgView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgView drawing
void CDlgView::OnDraw(CDC* pDC)
{
CRect rectClient;
CSize size = GetTotalSize();
rectClient.left = 0;
rectClient.top = 0;
rectClient.bottom = size.cy;
rectClient.right = size.cx;
rectClient.DeflateRect(15, 15);
pDC->DrawText(m_csText, rectClient, DT_LEFT);
rectClient.InflateRect(5, 5);
pDC->Draw3dRect(rectClient, RGB(0, 0, 255), RGB(0, 0, 255));
}
/////////////////////////////////////////////////////////////////////////////
// CDlgView diagnostics
#ifdef _DEBUG
void CDlgView::AssertValid() const
{
CScrollView::AssertValid();
}
void CDlgView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDlgView message handlers
void CDlgView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
}
// DlgView.cpp : implementation file
//
#include "stdafx.h"
#include "DlgView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgView
IMPLEMENT_DYNCREATE(CDlgView, CScrollView)
CDlgView::CDlgView()
{
}
CDlgView::~CDlgView()
{
}
BEGIN_MESSAGE_MAP(CDlgView, CScrollView)
//{{AFX_MSG_MAP(CDlgView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgView drawing
void CDlgView::OnDraw(CDC* pDC)
{
CRect rectClient;
CSize size = GetTotalSize();
rectClient.left = 0;
rectClient.top = 0;
rectClient.bottom = size.cy;
rectClient.right = size.cx;
rectClient.DeflateRect(15, 15);
pDC->DrawText(m_csText, rectClient, DT_LEFT);
rectClient.InflateRect(5, 5);
pDC->Draw3dRect(rectClient, RGB(0, 0, 255), RGB(0, 0, 255));
}
/////////////////////////////////////////////////////////////////////////////
// CDlgView diagnostics
#ifdef _DEBUG
void CDlgView::AssertValid() const
{
CScrollView::AssertValid();
}
void CDlgView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDlgView message handlers
void CDlgView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
}

View File

@@ -1,55 +1,55 @@
#if !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_)
#define AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgView.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDlgView view
class CDlgView : public CScrollView
{
protected:
CDlgView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CDlgView)
// Attributes
public:
// Operations
public:
CString m_csText;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgView)
public:
virtual void OnInitialUpdate();
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CDlgView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CDlgView)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_)
#if !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_)
#define AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgView.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDlgView view
class CDlgView : public CScrollView
{
protected:
CDlgView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CDlgView)
// Attributes
public:
// Operations
public:
CString m_csText;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgView)
public:
virtual void OnInitialUpdate();
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CDlgView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CDlgView)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_)

View File

@@ -1,95 +1,95 @@
// Donate.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "Donate.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDonate dialog
CDonate::CDonate(CWnd* pParent /*=NULL*/)
: CDialog(CDonate::IDD, pParent)
{
//{{AFX_DATA_INIT(CDonate)
//}}AFX_DATA_INIT
}
void CDonate::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDonate)
DDX_Control(pDX, IDC_VIA_SOURCEFORGE, m_SF);
DDX_Control(pDX, IDC_VIA_PAYPAL, m_Paypal);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDonate, CDialog)
//{{AFX_MSG_MAP(CDonate)
ON_WM_KEYDOWN()
ON_WM_KILLFOCUS()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDonate message handlers
BOOL CDonate::OnInitDialog()
{
CDialog::OnInitDialog();
//Set the target URL
m_SF.SetLinkUrl("http://sourceforge.net/project/project_donations.php?group_id=43775");
//Enable showing the Tooltip
m_SF.ActiveToolTip(TRUE);
//Set the Tooltiptext
m_SF.SetTootTipText("Donate to Ext2Fsd group via SourceForge.");
//Set the target URL
m_Paypal.SetLinkUrl("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=m@ext2fsd.com&item_name=Donation&return=https://sourceforge.net/projects/ext2fsd");
//Enable showing the Tooltip
m_Paypal.ActiveToolTip(TRUE);
//Set the Tooltiptext
m_Paypal.SetTootTipText("Donate to Ext2Fsd group via Paypal.");
#if 0
CHAR Declaration [] =
"\r\nExt2Fsd is an open source software. It acts as a bridge between Windows and Linux, making life easier to access Linux partitions under Windows systems.\r\n"
"\r\nCurrently there are still lots of jobs left to make a fully functional file system driver, such as complete ext3 support, Linux LVM, Windows Vista, Longhorn. Especially Vista and Longhorn will need driver signing.\r\n"
"\r\nNow I'm the only part-time developer. It needs about two full time developers to implement that job and also it needs some hardwares such SMP system, SCSI array for debugging and testing.\r\n"
"\r\nI'll try my best to make it out. I'm dreaming of that day.\r\n"
"\r\nAny help will be highly appreciated. Thanks and best wishes.\r\n"
"\r\n\r\nYours sincerely,\r\n"
"Matt";
#endif
CString Declaration;
Declaration.LoadString(IDS_DONATE_DECLARE);
GetDlgItem(IDC_DECLARE)->SetWindowText(Declaration);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDonate::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CDonate::OnKillFocus(CWnd* pNewWnd)
{
CDialog::OnKillFocus(pNewWnd);
}
// Donate.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "Donate.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDonate dialog
CDonate::CDonate(CWnd* pParent /*=NULL*/)
: CDialog(CDonate::IDD, pParent)
{
//{{AFX_DATA_INIT(CDonate)
//}}AFX_DATA_INIT
}
void CDonate::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDonate)
DDX_Control(pDX, IDC_VIA_SOURCEFORGE, m_SF);
DDX_Control(pDX, IDC_VIA_PAYPAL, m_Paypal);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDonate, CDialog)
//{{AFX_MSG_MAP(CDonate)
ON_WM_KEYDOWN()
ON_WM_KILLFOCUS()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDonate message handlers
BOOL CDonate::OnInitDialog()
{
CDialog::OnInitDialog();
//Set the target URL
m_SF.SetLinkUrl("http://sourceforge.net/project/project_donations.php?group_id=43775");
//Enable showing the Tooltip
m_SF.ActiveToolTip(TRUE);
//Set the Tooltiptext
m_SF.SetTootTipText("Donate to Ext2Fsd group via SourceForge.");
//Set the target URL
m_Paypal.SetLinkUrl("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=m@ext2fsd.com&item_name=Donation&return=https://sourceforge.net/projects/ext2fsd");
//Enable showing the Tooltip
m_Paypal.ActiveToolTip(TRUE);
//Set the Tooltiptext
m_Paypal.SetTootTipText("Donate to Ext2Fsd group via Paypal.");
#if 0
CHAR Declaration [] =
"\r\nExt2Fsd is an open source software. It acts as a bridge between Windows and Linux, making life easier to access Linux partitions under Windows systems.\r\n"
"\r\nCurrently there are still lots of jobs left to make a fully functional file system driver, such as complete ext3 support, Linux LVM, Windows Vista, Longhorn. Especially Vista and Longhorn will need driver signing.\r\n"
"\r\nNow I'm the only part-time developer. It needs about two full time developers to implement that job and also it needs some hardwares such SMP system, SCSI array for debugging and testing.\r\n"
"\r\nI'll try my best to make it out. I'm dreaming of that day.\r\n"
"\r\nAny help will be highly appreciated. Thanks and best wishes.\r\n"
"\r\n\r\nYours sincerely,\r\n"
"Matt";
#endif
CString Declaration;
Declaration.LoadString(IDS_DONATE_DECLARE);
GetDlgItem(IDC_DECLARE)->SetWindowText(Declaration);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDonate::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CDonate::OnKillFocus(CWnd* pNewWnd)
{
CDialog::OnKillFocus(pNewWnd);
}

View File

@@ -1,50 +1,50 @@
#if !defined(AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_)
#define AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Donate.h : header file
//
#include "HyperLink.h"
/////////////////////////////////////////////////////////////////////////////
// CDonate dialog
class CDonate : public CDialog
{
// Construction
public:
CDonate(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDonate)
enum { IDD = IDD_DONATE_DIALOG };
CMyHyperLink m_SF;
CMyHyperLink m_Paypal;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDonate)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDonate)
virtual BOOL OnInitDialog();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKillFocus(CWnd* pNewWnd);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_)
#if !defined(AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_)
#define AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Donate.h : header file
//
#include "HyperLink.h"
/////////////////////////////////////////////////////////////////////////////
// CDonate dialog
class CDonate : public CDialog
{
// Construction
public:
CDonate(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDonate)
enum { IDD = IDD_DONATE_DIALOG };
CMyHyperLink m_SF;
CMyHyperLink m_Paypal;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDonate)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDonate)
virtual BOOL OnInitDialog();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKillFocus(CWnd* pNewWnd);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_)

View File

@@ -1,447 +1,447 @@
// Ext2Attribute.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "Ext2Attribute.h"
#include "Ext2MgrDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExt2Attribute dialog
CExt2Attribute::CExt2Attribute(CWnd* pParent /*=NULL*/)
: CDialog(CExt2Attribute::IDD, pParent)
{
//{{AFX_DATA_INIT(CExt2Attribute)
m_Codepage = _T("");
m_bReadonly = FALSE;
m_FixedLetter = _T("");
m_AutoLetter = _T("");
m_sPrefix = _T("");
m_sSuffix = _T("");
m_bAutoMount = FALSE;
m_bFixMount = FALSE;
m_autoDrv = 0;
m_sUID = _T("----");
m_sGID = _T("----");
m_sEUID = _T("----");
//}}AFX_DATA_INIT
m_MainDlg = NULL;
m_EVP = NULL;
m_DevName = _T("");
m_bCdrom = FALSE;
m_fixDrv = 0;
}
void CExt2Attribute::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExt2Attribute)
DDX_CBString(pDX, IDC_COMBO_CODEPAGE, m_Codepage);
DDX_Check(pDX, IDC_READ_ONLY, m_bReadonly);
DDX_CBString(pDX, IDC_COMBO_DRVLETTER, m_FixedLetter);
DDX_Text(pDX, IDC_EXT2_PREFIX, m_sPrefix);
DDV_MaxChars(pDX, m_sPrefix, 31);
DDX_Text(pDX, IDC_EXT2_SUFFIX, m_sSuffix);
DDV_MaxChars(pDX, m_sSuffix, 31);
DDX_Check(pDX, IDC_AUTOMOUNT, m_bAutoMount);
DDX_Check(pDX, IDC_FIXMOUNT, m_bFixMount);
DDX_CBString(pDX, IDC_COMBO_AUTOMP, m_AutoLetter);
DDX_Text(pDX, IDC_EDIT_UID, m_sUID);
DDV_MaxChars(pDX, m_sUID, 8);
DDX_Text(pDX, IDC_EDIT_GID, m_sGID);
DDV_MaxChars(pDX, m_sGID, 8);
DDX_Text(pDX, IDC_EDIT_EUID, m_sEUID);
DDV_MaxChars(pDX, m_sEUID, 8);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExt2Attribute, CDialog)
//{{AFX_MSG_MAP(CExt2Attribute)
ON_BN_CLICKED(IDC_AUTOMOUNT, OnAutomount)
ON_BN_CLICKED(IDC_FIXMOUNT, OnFixmount)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExt2Attribute message handlers
BOOL CExt2Attribute::OnInitDialog()
{
int i = 0;
CString s;
CDialog::OnInitDialog();
m_Codepage = m_EVP->Codepage;
m_bReadonly = m_EVP->bReadonly || m_bCdrom;
if (m_bCdrom) {
SET_WIN(IDC_READ_ONLY, FALSE);
}
if (m_bCdrom) {
m_fixDrv = Ext2QueryMountPoint(
m_DevName.GetBuffer(MAX_PATH));
} else {
m_fixDrv = Ext2QueryRegistryMountPoint(
m_DevName.GetBuffer(MAX_PATH));
}
if (m_fixDrv) {
m_bAutoMount = FALSE;
m_bFixMount = TRUE;
m_FixedLetter.Format("%c:", m_fixDrv);
} else {
m_FixedLetter = " ";
}
if (m_EVP->Flags2 & EXT2_VPROP3_USERIDS) {
m_sUID.Format("%u", m_EVP->uid);
m_sGID.Format("%u", m_EVP->gid);
if (m_EVP->EIDS) {
m_sEUID.Format("%u", m_EVP->euid);
}
}
if (m_EVP->DrvLetter) {
m_autoDrv = m_EVP->DrvLetter & 0x7F;
if (m_autoDrv >= 'a' && m_autoDrv <= 'z')
m_autoDrv = (CHAR)toupper(m_autoDrv);
else if (m_autoDrv >= 'A' && m_autoDrv <= 'Z') {
} else {
m_autoDrv = 0;
}
if (m_autoDrv == 0)
m_AutoLetter.Format(" ");
else
m_AutoLetter.Format("%C:", m_autoDrv);
m_bAutoMount = !m_bFixMount;
}
m_sPrefix = m_EVP->sHidingPrefix;
m_sSuffix = m_EVP->sHidingSuffix;
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
cbCodepage->ResetContent();
i = 0;
while (gCodepages[i]) {
cbCodepage->AddString(gCodepages[i++]);
}
}
{
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_COMBO_DRVLETTER);
CComboBox *cbAutoLetter = (CComboBox *)GetDlgItem(IDC_COMBO_AUTOMP);
PEXT2_LETTER drvLetter = NULL;
cbDrvLetter->AddString(" ");
cbAutoLetter->AddString(" ");
if (m_autoDrv) {
m_AutoLetter.Format("%C:", m_autoDrv);
cbAutoLetter->AddString(m_AutoLetter);
}
if (m_fixDrv) {
cbDrvLetter->AddString(m_FixedLetter);
}
for (i=2; i < 26; i++) {
drvLetter = &drvLetters[i];
if (!drvLetter->bUsed) {
s.Format("%c:", drvLetter->Letter);
cbDrvLetter->AddString(s);
cbAutoLetter->AddString(s);
}
}
/*
for (i=0; i < 10; i++) {
drvLetter = &drvDigits[i];
if (!drvLetter->bUsed) {
s.Format("%c:", drvLetter->Letter);
cbDrvLetter->AddString(s);
}
}
*/
}
SET_CHECK(IDC_AUTOMOUNT, m_bAutoMount);
SET_CHECK(IDC_FIXMOUNT, m_bFixMount);
SET_WIN(IDC_COMBO_DRVLETTER, m_bFixMount);
SET_WIN(IDC_COMBO_AUTOMP, m_bAutoMount);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CExt2Attribute::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
BOOL IsStringAllDigits(CString s)
{
for (int i = 0; i < s.GetLength(); i++) {
if (!isdigit(s.GetAt(i)))
return FALSE;
}
return TRUE;
}
void CExt2Attribute::OnOK()
{
NT::NTSTATUS status;
HANDLE Handle = NULL;
CHAR DrvLetter = 0;
CString str;
BOOL rc = FALSE;
BOOL dc = FALSE;
UpdateData(TRUE);
if (m_Codepage.IsEmpty()) {
m_Codepage = "default";
}
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
int rc = cbCodepage->FindStringExact(-1, m_Codepage);
if (rc == CB_ERR) {
AfxMessageBox("Invalid codepage type: "+m_Codepage, MB_OK|MB_ICONWARNING);
return;
}
}
if (m_EVP->bReadonly && m_EVP->bExt3 && !m_bReadonly) {
str = "Are you sure to enable writing support"
" on this EXT3 volume with Ext2Fsd ?";
if (AfxMessageBox(str, MB_YESNO) != IDYES) {
m_EVP->bExt3Writable = FALSE;
} else {
m_EVP->bExt3Writable = TRUE;
}
}
/* initialize structures to communicate with ext2fsd service*/
m_EVP->Magic = EXT2_VOLUME_PROPERTY_MAGIC;
m_EVP->Command = APP_CMD_SET_PROPERTY3;
m_EVP->Flags = 0;
m_EVP->Flags2 = 0;
m_EVP->bReadonly = (BOOLEAN)m_bReadonly;
memset(m_EVP->Codepage, 0, CODEPAGE_MAXLEN);
strcpy((CHAR *)m_EVP->Codepage, m_Codepage.GetBuffer(CODEPAGE_MAXLEN));
/* initialize hiding filter patterns */
if (m_sPrefix.IsEmpty()) {
m_EVP->bHidingPrefix = FALSE;
memset(m_EVP->sHidingPrefix, 0, HIDINGPAT_LEN);
} else {
strcpy( m_EVP->sHidingPrefix,
m_sPrefix.GetBuffer(m_sPrefix.GetLength()));
m_EVP->bHidingPrefix = TRUE;
}
if (m_sSuffix.IsEmpty()) {
m_EVP->bHidingSuffix = FALSE;
memset(m_EVP->sHidingSuffix, 0, HIDINGPAT_LEN);
} else {
strcpy(m_EVP->sHidingSuffix,
m_sSuffix.GetBuffer(m_sSuffix.GetLength()));
m_EVP->bHidingSuffix = TRUE;
}
if (m_bFixMount) {
if (!m_FixedLetter.IsEmpty() && m_FixedLetter.GetAt(0) != ' ') {
DrvLetter = m_FixedLetter.GetAt(0);
} else {
DrvLetter = 0;
}
if (DrvLetter != m_fixDrv) {
if (m_fixDrv != 0) {
Ext2SetRegistryMountPoint(&m_fixDrv, NULL, FALSE);
Ext2RemoveDriveLetter(DrvLetter);
}
if (DrvLetter != 0) {
Ext2SetRegistryMountPoint(&DrvLetter, m_DevName.GetBuffer(MAX_PATH), TRUE);
}
}
if (DrvLetter && !m_fixDrv) {
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
dc = TRUE;
}
} else {
if (m_fixDrv != 0) {
Ext2RemoveDriveLetter(m_fixDrv);
Ext2SetRegistryMountPoint(&m_fixDrv, NULL, FALSE);
}
}
if (!m_sUID.IsEmpty() && !m_sGID.IsEmpty()) {
if (IsStringAllDigits(m_sUID) &&
IsStringAllDigits(m_sGID)) {
m_EVP->Flags2 |= EXT2_VPROP3_USERIDS;
m_EVP->uid = (USHORT)atoi(m_sUID.GetBuffer(8));
m_EVP->gid = (USHORT)atoi(m_sGID.GetBuffer(8));
if (!m_sEUID.IsEmpty() &&
IsStringAllDigits(m_sEUID)) {
m_EVP->EIDS = TRUE;
m_EVP->euid = (USHORT)atoi(m_sEUID.GetBuffer(8));
}
}
}
if (m_bAutoMount) {
if (m_bCdrom) {
m_EVP->DrvLetter = 0;
Ext2StorePropertyinRegistry(m_EVP);
goto store_evp;
}
if (!m_AutoLetter.IsEmpty() && m_AutoLetter.GetAt(0) != ' ') {
DrvLetter = m_AutoLetter.GetAt(0);
} else {
DrvLetter = 0;
}
if (DrvLetter > 'Z' || DrvLetter < 'A') {
DrvLetter = 0;
}
m_EVP->DrvLetter = DrvLetter | 0x80;
m_EVP->Flags2 |= EXT2_VPROP3_AUTOMOUNT;
Ext2StorePropertyinRegistry(m_EVP);
if (m_autoDrv) {
if (DrvLetter && Ext2IsDrvLetterAvailable(DrvLetter)) {
Ext2RemoveDriveLetter(m_autoDrv);
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
dc = TRUE;
}
} else {
if (DrvLetter && Ext2IsDrvLetterAvailable(DrvLetter)) {
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
dc = TRUE;
} else {
Ext2MountVolume(m_DevName.GetBuffer(MAX_PATH));
dc = TRUE;
}
}
} else {
m_EVP->DrvLetter =0 ;
Ext2StorePropertyinRegistry(m_EVP);
if (m_autoDrv && !Ext2IsDrvLetterAvailable(m_autoDrv)) {
Ext2RemoveDriveLetter(m_autoDrv);
dc = TRUE;
}
}
store_evp:
status = Ext2Open(m_DevName.GetBuffer(m_DevName.GetLength()),
&Handle, EXT2_DESIRED_ACCESS);
if (!NT_SUCCESS(status)) {
str.Format("Ext2Fsd service is not started.\n");
AfxMessageBox(str, MB_OK | MB_ICONSTOP);
rc = TRUE;
goto errorout;
}
rc = Ext2SetExt2Property(Handle, m_EVP);
if (rc) {
/* don't bother user at all */
#if 0
str = "Ext2 volume settings updated successfully!";
if (dc) {
str += "\r\n\r\nFixed mountpoint needs reboot to take into affect.";
}
AfxMessageBox(str, MB_OK | MB_ICONINFORMATION);
#endif
} else {
AfxMessageBox("Failed to save the Ext2 settings !",
MB_OK | MB_ICONWARNING);
}
errorout:
Ext2Close(&Handle);
if (rc) {
CDialog::OnOK();
}
}
void CExt2Attribute::OnAutomount()
{
UpdateData(TRUE);
SET_WIN(IDC_COMBO_AUTOMP, m_bAutoMount);
/*
if (m_bAutoMount) {
AfxMessageBox("This function is still in experiment. You'd better set a\r\n"
"fixed mountpoint for fixed disk or set partition type to\r\n"
"0x07 (NTFS) or FAT for non-bootable partition. For removable\r\n"
"disks like usb-disk it's better to use the second method.");
}
*/
if (m_bAutoMount) {
/*
CComboBox *cbAutoLetter = (CComboBox *)GetDlgItem(IDC_COMBO_AUTOMP);
if (cbAutoLetter && cbAutoLetter->GetCurSel() == CB_ERR) {
cbAutoLetter->SetCurSel(1);
}
*/
m_bFixMount = FALSE;
SET_CHECK(IDC_FIXMOUNT, FALSE);
SET_WIN(IDC_COMBO_DRVLETTER, FALSE);
UpdateData(FALSE);
}
}
void CExt2Attribute::OnFixmount()
{
UpdateData(TRUE);
SET_WIN(IDC_COMBO_DRVLETTER, m_bFixMount);
if (m_bFixMount) {
/*
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_COMBO_DRVLETTER);
if (cbDrvLetter && cbDrvLetter->GetCurSel() == CB_ERR) {
cbDrvLetter->SetCurSel(1);
}
*/
m_bAutoMount = FALSE;
SET_CHECK(IDC_AUTOMOUNT, FALSE);
SET_WIN(IDC_COMBO_AUTOMP, FALSE);
UpdateData(FALSE);
}
// Ext2Attribute.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "Ext2Attribute.h"
#include "Ext2MgrDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExt2Attribute dialog
CExt2Attribute::CExt2Attribute(CWnd* pParent /*=NULL*/)
: CDialog(CExt2Attribute::IDD, pParent)
{
//{{AFX_DATA_INIT(CExt2Attribute)
m_Codepage = _T("");
m_bReadonly = FALSE;
m_FixedLetter = _T("");
m_AutoLetter = _T("");
m_sPrefix = _T("");
m_sSuffix = _T("");
m_bAutoMount = FALSE;
m_bFixMount = FALSE;
m_autoDrv = 0;
m_sUID = _T("----");
m_sGID = _T("----");
m_sEUID = _T("----");
//}}AFX_DATA_INIT
m_MainDlg = NULL;
m_EVP = NULL;
m_DevName = _T("");
m_bCdrom = FALSE;
m_fixDrv = 0;
}
void CExt2Attribute::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExt2Attribute)
DDX_CBString(pDX, IDC_COMBO_CODEPAGE, m_Codepage);
DDX_Check(pDX, IDC_READ_ONLY, m_bReadonly);
DDX_CBString(pDX, IDC_COMBO_DRVLETTER, m_FixedLetter);
DDX_Text(pDX, IDC_EXT2_PREFIX, m_sPrefix);
DDV_MaxChars(pDX, m_sPrefix, 31);
DDX_Text(pDX, IDC_EXT2_SUFFIX, m_sSuffix);
DDV_MaxChars(pDX, m_sSuffix, 31);
DDX_Check(pDX, IDC_AUTOMOUNT, m_bAutoMount);
DDX_Check(pDX, IDC_FIXMOUNT, m_bFixMount);
DDX_CBString(pDX, IDC_COMBO_AUTOMP, m_AutoLetter);
DDX_Text(pDX, IDC_EDIT_UID, m_sUID);
DDV_MaxChars(pDX, m_sUID, 8);
DDX_Text(pDX, IDC_EDIT_GID, m_sGID);
DDV_MaxChars(pDX, m_sGID, 8);
DDX_Text(pDX, IDC_EDIT_EUID, m_sEUID);
DDV_MaxChars(pDX, m_sEUID, 8);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExt2Attribute, CDialog)
//{{AFX_MSG_MAP(CExt2Attribute)
ON_BN_CLICKED(IDC_AUTOMOUNT, OnAutomount)
ON_BN_CLICKED(IDC_FIXMOUNT, OnFixmount)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExt2Attribute message handlers
BOOL CExt2Attribute::OnInitDialog()
{
int i = 0;
CString s;
CDialog::OnInitDialog();
m_Codepage = m_EVP->Codepage;
m_bReadonly = m_EVP->bReadonly || m_bCdrom;
if (m_bCdrom) {
SET_WIN(IDC_READ_ONLY, FALSE);
}
if (m_bCdrom) {
m_fixDrv = Ext2QueryMountPoint(
m_DevName.GetBuffer(MAX_PATH));
} else {
m_fixDrv = Ext2QueryRegistryMountPoint(
m_DevName.GetBuffer(MAX_PATH));
}
if (m_fixDrv) {
m_bAutoMount = FALSE;
m_bFixMount = TRUE;
m_FixedLetter.Format("%c:", m_fixDrv);
} else {
m_FixedLetter = " ";
}
if (m_EVP->Flags2 & EXT2_VPROP3_USERIDS) {
m_sUID.Format("%u", m_EVP->uid);
m_sGID.Format("%u", m_EVP->gid);
if (m_EVP->EIDS) {
m_sEUID.Format("%u", m_EVP->euid);
}
}
if (m_EVP->DrvLetter) {
m_autoDrv = m_EVP->DrvLetter & 0x7F;
if (m_autoDrv >= 'a' && m_autoDrv <= 'z')
m_autoDrv = (CHAR)toupper(m_autoDrv);
else if (m_autoDrv >= 'A' && m_autoDrv <= 'Z') {
} else {
m_autoDrv = 0;
}
if (m_autoDrv == 0)
m_AutoLetter.Format(" ");
else
m_AutoLetter.Format("%C:", m_autoDrv);
m_bAutoMount = !m_bFixMount;
}
m_sPrefix = m_EVP->sHidingPrefix;
m_sSuffix = m_EVP->sHidingSuffix;
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
cbCodepage->ResetContent();
i = 0;
while (gCodepages[i]) {
cbCodepage->AddString(gCodepages[i++]);
}
}
{
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_COMBO_DRVLETTER);
CComboBox *cbAutoLetter = (CComboBox *)GetDlgItem(IDC_COMBO_AUTOMP);
PEXT2_LETTER drvLetter = NULL;
cbDrvLetter->AddString(" ");
cbAutoLetter->AddString(" ");
if (m_autoDrv) {
m_AutoLetter.Format("%C:", m_autoDrv);
cbAutoLetter->AddString(m_AutoLetter);
}
if (m_fixDrv) {
cbDrvLetter->AddString(m_FixedLetter);
}
for (i=2; i < 26; i++) {
drvLetter = &drvLetters[i];
if (!drvLetter->bUsed) {
s.Format("%c:", drvLetter->Letter);
cbDrvLetter->AddString(s);
cbAutoLetter->AddString(s);
}
}
/*
for (i=0; i < 10; i++) {
drvLetter = &drvDigits[i];
if (!drvLetter->bUsed) {
s.Format("%c:", drvLetter->Letter);
cbDrvLetter->AddString(s);
}
}
*/
}
SET_CHECK(IDC_AUTOMOUNT, m_bAutoMount);
SET_CHECK(IDC_FIXMOUNT, m_bFixMount);
SET_WIN(IDC_COMBO_DRVLETTER, m_bFixMount);
SET_WIN(IDC_COMBO_AUTOMP, m_bAutoMount);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CExt2Attribute::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
BOOL IsStringAllDigits(CString s)
{
for (int i = 0; i < s.GetLength(); i++) {
if (!isdigit(s.GetAt(i)))
return FALSE;
}
return TRUE;
}
void CExt2Attribute::OnOK()
{
NT::NTSTATUS status;
HANDLE Handle = NULL;
CHAR DrvLetter = 0;
CString str;
BOOL rc = FALSE;
BOOL dc = FALSE;
UpdateData(TRUE);
if (m_Codepage.IsEmpty()) {
m_Codepage = "default";
}
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
int rc = cbCodepage->FindStringExact(-1, m_Codepage);
if (rc == CB_ERR) {
AfxMessageBox("Invalid codepage type: "+m_Codepage, MB_OK|MB_ICONWARNING);
return;
}
}
if (m_EVP->bReadonly && m_EVP->bExt3 && !m_bReadonly) {
str = "Are you sure to enable writing support"
" on this EXT3 volume with Ext2Fsd ?";
if (AfxMessageBox(str, MB_YESNO) != IDYES) {
m_EVP->bExt3Writable = FALSE;
} else {
m_EVP->bExt3Writable = TRUE;
}
}
/* initialize structures to communicate with ext2fsd service*/
m_EVP->Magic = EXT2_VOLUME_PROPERTY_MAGIC;
m_EVP->Command = APP_CMD_SET_PROPERTY3;
m_EVP->Flags = 0;
m_EVP->Flags2 = 0;
m_EVP->bReadonly = (BOOLEAN)m_bReadonly;
memset(m_EVP->Codepage, 0, CODEPAGE_MAXLEN);
strcpy((CHAR *)m_EVP->Codepage, m_Codepage.GetBuffer(CODEPAGE_MAXLEN));
/* initialize hiding filter patterns */
if (m_sPrefix.IsEmpty()) {
m_EVP->bHidingPrefix = FALSE;
memset(m_EVP->sHidingPrefix, 0, HIDINGPAT_LEN);
} else {
strcpy( m_EVP->sHidingPrefix,
m_sPrefix.GetBuffer(m_sPrefix.GetLength()));
m_EVP->bHidingPrefix = TRUE;
}
if (m_sSuffix.IsEmpty()) {
m_EVP->bHidingSuffix = FALSE;
memset(m_EVP->sHidingSuffix, 0, HIDINGPAT_LEN);
} else {
strcpy(m_EVP->sHidingSuffix,
m_sSuffix.GetBuffer(m_sSuffix.GetLength()));
m_EVP->bHidingSuffix = TRUE;
}
if (m_bFixMount) {
if (!m_FixedLetter.IsEmpty() && m_FixedLetter.GetAt(0) != ' ') {
DrvLetter = m_FixedLetter.GetAt(0);
} else {
DrvLetter = 0;
}
if (DrvLetter != m_fixDrv) {
if (m_fixDrv != 0) {
Ext2SetRegistryMountPoint(&m_fixDrv, NULL, FALSE);
Ext2RemoveDriveLetter(DrvLetter);
}
if (DrvLetter != 0) {
Ext2SetRegistryMountPoint(&DrvLetter, m_DevName.GetBuffer(MAX_PATH), TRUE);
}
}
if (DrvLetter && !m_fixDrv) {
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
dc = TRUE;
}
} else {
if (m_fixDrv != 0) {
Ext2RemoveDriveLetter(m_fixDrv);
Ext2SetRegistryMountPoint(&m_fixDrv, NULL, FALSE);
}
}
if (!m_sUID.IsEmpty() && !m_sGID.IsEmpty()) {
if (IsStringAllDigits(m_sUID) &&
IsStringAllDigits(m_sGID)) {
m_EVP->Flags2 |= EXT2_VPROP3_USERIDS;
m_EVP->uid = (USHORT)atoi(m_sUID.GetBuffer(8));
m_EVP->gid = (USHORT)atoi(m_sGID.GetBuffer(8));
if (!m_sEUID.IsEmpty() &&
IsStringAllDigits(m_sEUID)) {
m_EVP->EIDS = TRUE;
m_EVP->euid = (USHORT)atoi(m_sEUID.GetBuffer(8));
}
}
}
if (m_bAutoMount) {
if (m_bCdrom) {
m_EVP->DrvLetter = 0;
Ext2StorePropertyinRegistry(m_EVP);
goto store_evp;
}
if (!m_AutoLetter.IsEmpty() && m_AutoLetter.GetAt(0) != ' ') {
DrvLetter = m_AutoLetter.GetAt(0);
} else {
DrvLetter = 0;
}
if (DrvLetter > 'Z' || DrvLetter < 'A') {
DrvLetter = 0;
}
m_EVP->DrvLetter = DrvLetter | 0x80;
m_EVP->Flags2 |= EXT2_VPROP3_AUTOMOUNT;
Ext2StorePropertyinRegistry(m_EVP);
if (m_autoDrv) {
if (DrvLetter && Ext2IsDrvLetterAvailable(DrvLetter)) {
Ext2RemoveDriveLetter(m_autoDrv);
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
dc = TRUE;
}
} else {
if (DrvLetter && Ext2IsDrvLetterAvailable(DrvLetter)) {
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
dc = TRUE;
} else {
Ext2MountVolume(m_DevName.GetBuffer(MAX_PATH));
dc = TRUE;
}
}
} else {
m_EVP->DrvLetter =0 ;
Ext2StorePropertyinRegistry(m_EVP);
if (m_autoDrv && !Ext2IsDrvLetterAvailable(m_autoDrv)) {
Ext2RemoveDriveLetter(m_autoDrv);
dc = TRUE;
}
}
store_evp:
status = Ext2Open(m_DevName.GetBuffer(m_DevName.GetLength()),
&Handle, EXT2_DESIRED_ACCESS);
if (!NT_SUCCESS(status)) {
str.Format("Ext2Fsd service is not started.\n");
AfxMessageBox(str, MB_OK | MB_ICONSTOP);
rc = TRUE;
goto errorout;
}
rc = Ext2SetExt2Property(Handle, m_EVP);
if (rc) {
/* don't bother user at all */
#if 0
str = "Ext2 volume settings updated successfully!";
if (dc) {
str += "\r\n\r\nFixed mountpoint needs reboot to take into affect.";
}
AfxMessageBox(str, MB_OK | MB_ICONINFORMATION);
#endif
} else {
AfxMessageBox("Failed to save the Ext2 settings !",
MB_OK | MB_ICONWARNING);
}
errorout:
Ext2Close(&Handle);
if (rc) {
CDialog::OnOK();
}
}
void CExt2Attribute::OnAutomount()
{
UpdateData(TRUE);
SET_WIN(IDC_COMBO_AUTOMP, m_bAutoMount);
/*
if (m_bAutoMount) {
AfxMessageBox("This function is still in experiment. You'd better set a\r\n"
"fixed mountpoint for fixed disk or set partition type to\r\n"
"0x07 (NTFS) or FAT for non-bootable partition. For removable\r\n"
"disks like usb-disk it's better to use the second method.");
}
*/
if (m_bAutoMount) {
/*
CComboBox *cbAutoLetter = (CComboBox *)GetDlgItem(IDC_COMBO_AUTOMP);
if (cbAutoLetter && cbAutoLetter->GetCurSel() == CB_ERR) {
cbAutoLetter->SetCurSel(1);
}
*/
m_bFixMount = FALSE;
SET_CHECK(IDC_FIXMOUNT, FALSE);
SET_WIN(IDC_COMBO_DRVLETTER, FALSE);
UpdateData(FALSE);
}
}
void CExt2Attribute::OnFixmount()
{
UpdateData(TRUE);
SET_WIN(IDC_COMBO_DRVLETTER, m_bFixMount);
if (m_bFixMount) {
/*
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_COMBO_DRVLETTER);
if (cbDrvLetter && cbDrvLetter->GetCurSel() == CB_ERR) {
cbDrvLetter->SetCurSel(1);
}
*/
m_bAutoMount = FALSE;
SET_CHECK(IDC_AUTOMOUNT, FALSE);
SET_WIN(IDC_COMBO_AUTOMP, FALSE);
UpdateData(FALSE);
}
}

View File

@@ -1,66 +1,66 @@
#if !defined(AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_)
#define AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Ext2Attribute.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CExt2Attribute dialog
class CExt2Attribute : public CDialog
{
// Construction
public:
CExt2Attribute(CWnd* pParent = NULL); // standard constructor
CWnd * m_MainDlg;
PEXT2_VOLUME_PROPERTY3 m_EVP;
CString m_DevName;
BOOL m_bCdrom;
CHAR m_autoDrv;
CHAR m_fixDrv;
// Dialog Data
//{{AFX_DATA(CExt2Attribute)
enum { IDD = IDD_EXT2_ATTR };
CString m_Codepage;
BOOL m_bReadonly;
CString m_FixedLetter;
CString m_sPrefix;
CString m_sSuffix;
BOOL m_bAutoMount;
BOOL m_bFixMount;
CString m_AutoLetter;
CString m_sUID;
CString m_sGID;
CString m_sEUID;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2Attribute)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CExt2Attribute)
virtual BOOL OnInitDialog();
virtual void OnCancel();
virtual void OnOK();
afx_msg void OnAutomount();
afx_msg void OnFixmount();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_)
#if !defined(AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_)
#define AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Ext2Attribute.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CExt2Attribute dialog
class CExt2Attribute : public CDialog
{
// Construction
public:
CExt2Attribute(CWnd* pParent = NULL); // standard constructor
CWnd * m_MainDlg;
PEXT2_VOLUME_PROPERTY3 m_EVP;
CString m_DevName;
BOOL m_bCdrom;
CHAR m_autoDrv;
CHAR m_fixDrv;
// Dialog Data
//{{AFX_DATA(CExt2Attribute)
enum { IDD = IDD_EXT2_ATTR };
CString m_Codepage;
BOOL m_bReadonly;
CString m_FixedLetter;
CString m_sPrefix;
CString m_sSuffix;
BOOL m_bAutoMount;
BOOL m_bFixMount;
CString m_AutoLetter;
CString m_sUID;
CString m_sGID;
CString m_sEUID;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2Attribute)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CExt2Attribute)
virtual BOOL OnInitDialog();
virtual void OnCancel();
virtual void OnOK();
afx_msg void OnAutomount();
afx_msg void OnFixmount();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_)

View File

@@ -1,301 +1,301 @@
// Ext2Mgr.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Ext2Mgr.h"
#include "Ext2MgrDlg.h"
#include "Splash.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp
BEGIN_MESSAGE_MAP(CExt2MgrApp, CWinApp)
//{{AFX_MSG_MAP(CExt2MgrApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp construction
CExt2MgrApp::CExt2MgrApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CExt2MgrApp object
CExt2MgrApp theApp;
/////////////////////////////////////////////////////////////////////////////
// globals
DWORD Checkpoint = 1;
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE ServiceHandle;
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp initialization
#if 0
void WINAPI ManagerServiceEntry(DWORD argc, char **argv);
void ManagerServiceThread(void *arg);
void ManagerStopService();
void WINAPI ManagerServiceCtrl(DWORD ctrlcode);
#endif
BOOL
ManagerReportStatus(
SERVICE_STATUS_HANDLE Handle,
SERVICE_STATUS* Status,
DWORD State,
DWORD Exitcode,
DWORD Timeout
)
{
// If we're in the start state then we don't want the control manager
// sending us control messages because they'll confuse us.
if (State == SERVICE_START_PENDING) {
Status->dwControlsAccepted = 0;
} else {
Status->dwControlsAccepted = SERVICE_ACCEPT_STOP;
}
// Save the new status we've been given
Status->dwCurrentState = State;
Status->dwWin32ExitCode = Exitcode;
Status->dwWaitHint = Timeout;
// Update the checkpoint variable to let the SCM know that we
// haven't died if requests take a long time
if ((State == SERVICE_RUNNING) || (State == SERVICE_STOPPED)) {
Status->dwCheckPoint = 0;
} else {
Status->dwCheckPoint = Checkpoint++;
}
// Tell the SCM our new status
return SetServiceStatus(Handle, Status);
}
void ManagerStopService()
{
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
theApp.m_pMainWnd->SendMessage(WM_TERMINATE_PROGRAM, 0, 0x1234);
}
void WINAPI ManagerCtrlService(DWORD ctrlcode)
{
switch(ctrlcode)
{
case SERVICE_CONTROL_STOP:
// STOP : The service must stop
ManagerStopService();
break;
case SERVICE_CONTROL_INTERROGATE:
// QUERY : Service control manager just wants to know our state
break;
default:
// Control code not recognised
break;
}
// Tell the control manager what we're up to.
ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
ServiceStatus.dwCurrentState,
NO_ERROR, 0);
}
VOID __cdecl
ManagerStartMain(VOID * arg)
{
BOOL isService = arg != 0;
CExt2MgrDlg* dlg = (CExt2MgrDlg*)theApp.m_pMainWnd;
if (dlg) {
/* always be quiet ! */
if (0 && !dlg->m_bQuiet) {
CSplash* splash = new CSplash(IDB_ABOUT_SCREEN, RGB(128, 128, 128));
splash->ShowSplash();
dlg->m_splash = splash;
}
if (isService) {
ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
SERVICE_RUNNING,
NO_ERROR, 0 );
}
dlg->DoModal();
Ext2StopPipeSrv();
}
if (isService) {
ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
SERVICE_STOPPED,
NO_ERROR, 0 );
}
}
void NTAPI
ManagerServiceEntry(DWORD argc, char**argv)
{
// register the service control handler
ServiceHandle =
RegisterServiceCtrlHandler(
"Ext2Mgr",
ManagerCtrlService );
if (ServiceHandle == 0) {
return;
}
// setup standard service state values
ServiceStatus.dwServiceType = SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS;
ServiceStatus.dwServiceSpecificExitCode = 0;
// report our status to the SCM
if (!ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
SERVICE_START_PENDING,
NO_ERROR,
600000
))
{
ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
SERVICE_STOPPED,
NO_ERROR,
0);
return;
}
// Now start the service for real
_beginthread(ManagerStartMain, 0, (PVOID)TRUE);
return;
}
VOID
ManagerStartService(VOID *arg)
{
SERVICE_TABLE_ENTRY ManagerSeriveTable[] =
{
{"Ext2Mgr", (LPSERVICE_MAIN_FUNCTION)ManagerServiceEntry},
{NULL, NULL}
};
// let service control dispatcher start Ext2Mgr
StartServiceCtrlDispatcher(ManagerSeriveTable);
}
BOOL CExt2MgrApp::InitInstance()
{
AfxEnableControlContainer();
HWND hWnd = ::FindWindow(NULL, "Ext2 Volume Manager");
if (hWnd) {
if (::GetWindowLongPtr(hWnd, DWLP_USER) == EXT2_DIALOG_MAGIC) {
::ShowWindow(hWnd, SW_SHOW);
::SetForegroundWindow(hWnd);
return FALSE;
}
}
BOOL bHide = FALSE;
BOOL bQuiet = FALSE;
BOOL bService = FALSE;
BOOL bInstall = FALSE;
BOOL bRemove = FALSE;
BOOL bStat = FALSE;
char * cmds = GetCommandLine();
int i = (int)strlen(cmds);
while (--i > 0) {
if (cmds[i] == (char)' ') {
cmds[i] = 0;
if ( strlen(&cmds[i+1]) == 5 &&
_stricmp(&cmds[i+2], "hide") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = TRUE;
} else if (strlen(&cmds[i+1]) == 6 &&
_stricmp(&cmds[i+2], "quiet") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bQuiet = TRUE;
} else if (strlen(&cmds[i+1]) == 8 &&
_stricmp(&cmds[i+2], "install") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bInstall = TRUE;
} else if (strlen(&cmds[i+1]) == 7 &&
_stricmp(&cmds[i+2], "remove") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bRemove = TRUE;
} else if (strlen(&cmds[i+1]) == 8 &&
_stricmp(&cmds[i+2], "service") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bService = TRUE;
} else if (strlen(&cmds[i+1]) == 5 &&
_stricmp(&cmds[i+2], "stat") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bStat = TRUE;
}
}
}
if (bInstall) {
Ext2SetManagerAsService(TRUE);
return FALSE;
}
if (bRemove) {
Ext2SetManagerAsService(FALSE);
return FALSE;
}
Ext2IsX64System();
CExt2MgrDlg theDlg;
theDlg.m_bHide = bHide;
theDlg.m_bQuiet = bQuiet = bHide;
theDlg.m_bService = bService;
theDlg.m_bStat = bStat;
m_pMainWnd = &theDlg;
if (bService) {
ManagerStartService(NULL);
} else {
ManagerStartMain(NULL);
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
// Ext2Mgr.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Ext2Mgr.h"
#include "Ext2MgrDlg.h"
#include "Splash.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp
BEGIN_MESSAGE_MAP(CExt2MgrApp, CWinApp)
//{{AFX_MSG_MAP(CExt2MgrApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp construction
CExt2MgrApp::CExt2MgrApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CExt2MgrApp object
CExt2MgrApp theApp;
/////////////////////////////////////////////////////////////////////////////
// globals
DWORD Checkpoint = 1;
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE ServiceHandle;
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp initialization
#if 0
void WINAPI ManagerServiceEntry(DWORD argc, char **argv);
void ManagerServiceThread(void *arg);
void ManagerStopService();
void WINAPI ManagerServiceCtrl(DWORD ctrlcode);
#endif
BOOL
ManagerReportStatus(
SERVICE_STATUS_HANDLE Handle,
SERVICE_STATUS* Status,
DWORD State,
DWORD Exitcode,
DWORD Timeout
)
{
// If we're in the start state then we don't want the control manager
// sending us control messages because they'll confuse us.
if (State == SERVICE_START_PENDING) {
Status->dwControlsAccepted = 0;
} else {
Status->dwControlsAccepted = SERVICE_ACCEPT_STOP;
}
// Save the new status we've been given
Status->dwCurrentState = State;
Status->dwWin32ExitCode = Exitcode;
Status->dwWaitHint = Timeout;
// Update the checkpoint variable to let the SCM know that we
// haven't died if requests take a long time
if ((State == SERVICE_RUNNING) || (State == SERVICE_STOPPED)) {
Status->dwCheckPoint = 0;
} else {
Status->dwCheckPoint = Checkpoint++;
}
// Tell the SCM our new status
return SetServiceStatus(Handle, Status);
}
void ManagerStopService()
{
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
theApp.m_pMainWnd->SendMessage(WM_TERMINATE_PROGRAM, 0, 0x1234);
}
void WINAPI ManagerCtrlService(DWORD ctrlcode)
{
switch(ctrlcode)
{
case SERVICE_CONTROL_STOP:
// STOP : The service must stop
ManagerStopService();
break;
case SERVICE_CONTROL_INTERROGATE:
// QUERY : Service control manager just wants to know our state
break;
default:
// Control code not recognised
break;
}
// Tell the control manager what we're up to.
ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
ServiceStatus.dwCurrentState,
NO_ERROR, 0);
}
VOID __cdecl
ManagerStartMain(VOID * arg)
{
BOOL isService = arg != 0;
CExt2MgrDlg* dlg = (CExt2MgrDlg*)theApp.m_pMainWnd;
if (dlg) {
/* always be quiet ! */
if (0 && !dlg->m_bQuiet) {
CSplash* splash = new CSplash(IDB_ABOUT_SCREEN, RGB(128, 128, 128));
splash->ShowSplash();
dlg->m_splash = splash;
}
if (isService) {
ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
SERVICE_RUNNING,
NO_ERROR, 0 );
}
dlg->DoModal();
Ext2StopPipeSrv();
}
if (isService) {
ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
SERVICE_STOPPED,
NO_ERROR, 0 );
}
}
void NTAPI
ManagerServiceEntry(DWORD argc, char**argv)
{
// register the service control handler
ServiceHandle =
RegisterServiceCtrlHandler(
"Ext2Mgr",
ManagerCtrlService );
if (ServiceHandle == 0) {
return;
}
// setup standard service state values
ServiceStatus.dwServiceType = SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS;
ServiceStatus.dwServiceSpecificExitCode = 0;
// report our status to the SCM
if (!ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
SERVICE_START_PENDING,
NO_ERROR,
600000
))
{
ManagerReportStatus(
ServiceHandle,
&ServiceStatus,
SERVICE_STOPPED,
NO_ERROR,
0);
return;
}
// Now start the service for real
_beginthread(ManagerStartMain, 0, (PVOID)TRUE);
return;
}
VOID
ManagerStartService(VOID *arg)
{
SERVICE_TABLE_ENTRY ManagerSeriveTable[] =
{
{"Ext2Mgr", (LPSERVICE_MAIN_FUNCTION)ManagerServiceEntry},
{NULL, NULL}
};
// let service control dispatcher start Ext2Mgr
StartServiceCtrlDispatcher(ManagerSeriveTable);
}
BOOL CExt2MgrApp::InitInstance()
{
AfxEnableControlContainer();
HWND hWnd = ::FindWindow(NULL, "Ext2 Volume Manager");
if (hWnd) {
if (::GetWindowLongPtr(hWnd, DWLP_USER) == EXT2_DIALOG_MAGIC) {
::ShowWindow(hWnd, SW_SHOW);
::SetForegroundWindow(hWnd);
return FALSE;
}
}
BOOL bHide = FALSE;
BOOL bQuiet = FALSE;
BOOL bService = FALSE;
BOOL bInstall = FALSE;
BOOL bRemove = FALSE;
BOOL bStat = FALSE;
char * cmds = GetCommandLine();
int i = (int)strlen(cmds);
while (--i > 0) {
if (cmds[i] == (char)' ') {
cmds[i] = 0;
if ( strlen(&cmds[i+1]) == 5 &&
_stricmp(&cmds[i+2], "hide") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = TRUE;
} else if (strlen(&cmds[i+1]) == 6 &&
_stricmp(&cmds[i+2], "quiet") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bQuiet = TRUE;
} else if (strlen(&cmds[i+1]) == 8 &&
_stricmp(&cmds[i+2], "install") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bInstall = TRUE;
} else if (strlen(&cmds[i+1]) == 7 &&
_stricmp(&cmds[i+2], "remove") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bRemove = TRUE;
} else if (strlen(&cmds[i+1]) == 8 &&
_stricmp(&cmds[i+2], "service") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bService = TRUE;
} else if (strlen(&cmds[i+1]) == 5 &&
_stricmp(&cmds[i+2], "stat") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bStat = TRUE;
}
}
}
if (bInstall) {
Ext2SetManagerAsService(TRUE);
return FALSE;
}
if (bRemove) {
Ext2SetManagerAsService(FALSE);
return FALSE;
}
Ext2IsX64System();
CExt2MgrDlg theDlg;
theDlg.m_bHide = bHide;
theDlg.m_bQuiet = bQuiet = bHide;
theDlg.m_bService = bService;
theDlg.m_bStat = bStat;
m_pMainWnd = &theDlg;
if (bService) {
ManagerStartService(NULL);
} else {
ManagerStartMain(NULL);
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}

View File

@@ -1,49 +1,49 @@
// Ext2Mgr.h : main header file for the EXT2MGR application
//
#if !defined(AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_)
#define AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp:
// See Ext2Mgr.cpp for the implementation of this class
//
class CExt2MgrApp : public CWinApp
{
public:
CExt2MgrApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2MgrApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CExt2MgrApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_)
// Ext2Mgr.h : main header file for the EXT2MGR application
//
#if !defined(AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_)
#define AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp:
// See Ext2Mgr.cpp for the implementation of this class
//
class CExt2MgrApp : public CWinApp
{
public:
CExt2MgrApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2MgrApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CExt2MgrApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,206 +1,206 @@
// Ext2MgrDlg.h : header file
//
#if !defined(AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_)
#define AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "SysTray.h"
#include "Toolbar.h"
#include "splash.h"
#include "donate.h"
#include "TreeList.h"
#include "HyperLink.h"
#include "Mountpoints.h"
#include "Properties.h"
#include "ServiceManage.h"
#include "Ext2Attribute.h"
#include "PerfStatDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CExt2List window
class CExt2List : public CListCtrl
{
// Construction
public:
CExt2List();
// Attributes
public:
CPoint m_Point;
// Operations
public:
int QuerySubItemText(int item, CHAR *Data, int length);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2List)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CExt2List();
// Generated message map functions
protected:
//{{AFX_MSG(CExt2List)
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrDlg dialog
class CDlgView;
class CExt2MgrDlg : public CDialog
{
// Construction
public:
CExt2MgrDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CExt2MgrDlg)
enum { IDD = IDD_EXT2MGR_DIALOG };
CTreeList m_DiskView;
CExt2List m_VolumeList;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2MgrDlg)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
public:
/* routines */
PVOID QuerySelectedItem(PBOOL bIsExt2);
VOID DriversChangeNotify(ULONG, BOOL);
VOID DriverLetterChangeNotify(CHAR, BOOL);
VOID DriverChangeNotify(PEXT2_LETTER, BOOL);
VOID UpdateVolume(PEXT2_VOLUME volume);
VOID UpdateCdrom(PEXT2_CDROM cdrom) ;
VOID UpdatePartition(PEXT2_PARTITION part);
VOID RegisterDeviceInterface(GUID, PHDEVNOTIFY);
VOID OnFlush();
VOID OnPartType();
VOID OnRemoveDeadLetter();
VOID OnKeyupVolumeList();
VOID OnKeyupDiskList();
ULONG m_type;
PVOID m_sdev;
/* attributes */
CSplash * m_splash;
CMenu m_Menu;
CFont m_MSSanS;
BOOL m_bHide;
BOOL m_bQuiet;
BOOL m_bService;
BOOL m_bStat;
CPerfStatDlg * m_PerfDlg;
// Implementation
protected:
HICON m_hIcon;
CSystemTray m_Tray;
CStatusBar m_bar;
CImageList m_ImageList;
BOOL m_bFsStarted;
BOOL m_bHandleChange;
BOOL m_bFocusVolume;
BOOL m_bFocusDisk;
LONG m_IndexVolume;
LONG m_IndexDisk;
HACCEL m_hAccel;
HDEVNOTIFY m_hUsbNotify;
/* global parameters */
ULONG m_nStartmode;
CString m_Codepage;
BOOL m_bExt3Writable;
BOOL m_bReadonly;
CString m_srvStatus;
CString m_sPrefix;
CString m_sSuffix;
BOOL m_bAutoMount;
// Generated message map functions
//{{AFX_MSG(CExt2MgrDlg)
virtual BOOL OnInitDialog();
virtual void OnWindowPosChanging(WINDOWPOS* lpwndpos);
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
afx_msg void OnDestroy();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnChangeProperty();
afx_msg void OnRefresh();
afx_msg void OnFormat();
afx_msg void OnService();
virtual void OnCancel();
afx_msg void OnAbout();
afx_msg void OnExit();
virtual void OnOK();
afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
afx_msg void OnDblclkDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnKillfocusDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclickDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDblclkVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnKillfocusVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclickVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClickDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClickVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSetfocusDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSetfocusVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnProperty();
afx_msg void OnDonate();
afx_msg void OnCopy();
afx_msg void OnInstallService();
afx_msg void OnRemoveService();
afx_msg void OnEnableAutorun();
afx_msg void OnDisableAutorun();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnDrvLetter();
afx_msg void OnDrvQuickMount();
afx_msg void OnShowMain();
afx_msg void OnHelp();
afx_msg void OnPerfStat();
afx_msg void OnPerfStop();
afx_msg void OnCopyAll();
//}}AFX_MSG
afx_msg LRESULT OnTrayNotification(WPARAM wParam=0,LPARAM lParam=0);
afx_msg LRESULT OnTerminate(WPARAM wParam=0,LPARAM lParam=0);
afx_msg LRESULT OnMountPointNotify(WPARAM wParam=0,LPARAM lParam=0);
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_)
// Ext2MgrDlg.h : header file
//
#if !defined(AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_)
#define AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "SysTray.h"
#include "Toolbar.h"
#include "splash.h"
#include "donate.h"
#include "TreeList.h"
#include "HyperLink.h"
#include "Mountpoints.h"
#include "Properties.h"
#include "ServiceManage.h"
#include "Ext2Attribute.h"
#include "PerfStatDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CExt2List window
class CExt2List : public CListCtrl
{
// Construction
public:
CExt2List();
// Attributes
public:
CPoint m_Point;
// Operations
public:
int QuerySubItemText(int item, CHAR *Data, int length);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2List)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CExt2List();
// Generated message map functions
protected:
//{{AFX_MSG(CExt2List)
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CExt2MgrDlg dialog
class CDlgView;
class CExt2MgrDlg : public CDialog
{
// Construction
public:
CExt2MgrDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CExt2MgrDlg)
enum { IDD = IDD_EXT2MGR_DIALOG };
CTreeList m_DiskView;
CExt2List m_VolumeList;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2MgrDlg)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
public:
/* routines */
PVOID QuerySelectedItem(PBOOL bIsExt2);
VOID DriversChangeNotify(ULONG, BOOL);
VOID DriverLetterChangeNotify(CHAR, BOOL);
VOID DriverChangeNotify(PEXT2_LETTER, BOOL);
VOID UpdateVolume(PEXT2_VOLUME volume);
VOID UpdateCdrom(PEXT2_CDROM cdrom) ;
VOID UpdatePartition(PEXT2_PARTITION part);
VOID RegisterDeviceInterface(GUID, PHDEVNOTIFY);
VOID OnFlush();
VOID OnPartType();
VOID OnRemoveDeadLetter();
VOID OnKeyupVolumeList();
VOID OnKeyupDiskList();
ULONG m_type;
PVOID m_sdev;
/* attributes */
CSplash * m_splash;
CMenu m_Menu;
CFont m_MSSanS;
BOOL m_bHide;
BOOL m_bQuiet;
BOOL m_bService;
BOOL m_bStat;
CPerfStatDlg * m_PerfDlg;
// Implementation
protected:
HICON m_hIcon;
CSystemTray m_Tray;
CStatusBar m_bar;
CImageList m_ImageList;
BOOL m_bFsStarted;
BOOL m_bHandleChange;
BOOL m_bFocusVolume;
BOOL m_bFocusDisk;
LONG m_IndexVolume;
LONG m_IndexDisk;
HACCEL m_hAccel;
HDEVNOTIFY m_hUsbNotify;
/* global parameters */
ULONG m_nStartmode;
CString m_Codepage;
BOOL m_bExt3Writable;
BOOL m_bReadonly;
CString m_srvStatus;
CString m_sPrefix;
CString m_sSuffix;
BOOL m_bAutoMount;
// Generated message map functions
//{{AFX_MSG(CExt2MgrDlg)
virtual BOOL OnInitDialog();
virtual void OnWindowPosChanging(WINDOWPOS* lpwndpos);
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
afx_msg void OnDestroy();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnChangeProperty();
afx_msg void OnRefresh();
afx_msg void OnFormat();
afx_msg void OnService();
virtual void OnCancel();
afx_msg void OnAbout();
afx_msg void OnExit();
virtual void OnOK();
afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
afx_msg void OnDblclkDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnKillfocusDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclickDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDblclkVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnKillfocusVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclickVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClickDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClickVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSetfocusDiskList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSetfocusVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnProperty();
afx_msg void OnDonate();
afx_msg void OnCopy();
afx_msg void OnInstallService();
afx_msg void OnRemoveService();
afx_msg void OnEnableAutorun();
afx_msg void OnDisableAutorun();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnDrvLetter();
afx_msg void OnDrvQuickMount();
afx_msg void OnShowMain();
afx_msg void OnHelp();
afx_msg void OnPerfStat();
afx_msg void OnPerfStop();
afx_msg void OnCopyAll();
//}}AFX_MSG
afx_msg LRESULT OnTrayNotification(WPARAM wParam=0,LPARAM lParam=0);
afx_msg LRESULT OnTerminate(WPARAM wParam=0,LPARAM lParam=0);
afx_msg LRESULT OnMountPointNotify(WPARAM wParam=0,LPARAM lParam=0);
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_)

View File

@@ -1,292 +1,292 @@
// MyHyperLink.cpp : implementation file
//
// Written By : Renjith.R
// Email : renji12renji@m2comsys.com
// Details :Derived from MFC CStatic
// Date :Nov 25 2002
#include "stdafx.h"
#include "HyperLink.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyHyperLink
CMyHyperLink::CMyHyperLink()
{
m_sLinkColor = RGB(0, 0 ,255);
m_sHoverColor = RGB(255, 0, 0);
m_sVisitedColor = RGB(5, 34, 143);
m_bFireChild = false;
m_bMouseOver = false;
m_bEnableToolTip = false;
m_bVisited = false;
//Create Tooltip
}
CMyHyperLink::~CMyHyperLink()
{
}
BEGIN_MESSAGE_MAP(CMyHyperLink, CStatic)
//{{AFX_MSG_MAP(CMyHyperLink)
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyHyperLink message handlers
//Sets the Link Color
void CMyHyperLink::SetLinkColor(COLORREF sLinkColor)
{
m_sLinkColor = sLinkColor;
}
//open the URL by Windows ShellExecute()
bool CMyHyperLink::GoToLinkUrl(CString csLink)
{
HINSTANCE hInstance = (HINSTANCE)ShellExecute(NULL, _T("open"), csLink.operator LPCTSTR(), NULL, NULL, 2);
if ((UINT_PTR)hInstance < HINSTANCE_ERROR){
return false;
}else
return true;
}
//User can Active/Inactive the Tooltip already they set
void CMyHyperLink::ActiveToolTip(int nFlag)
{
if (nFlag)
m_bEnableToolTip = true;
else
m_bEnableToolTip = false;
}
//change The Tooltip text
void CMyHyperLink::SetTootTipText(LPCSTR szToolTip)
{
if (m_bEnableToolTip )
{
m_ToolTip.UpdateTipText(szToolTip,this,1001);
}
}
//The Mouse Move Message
void CMyHyperLink::OnMouseMove(UINT nFlags, CPoint point)
{
CStatic::OnMouseMove(nFlags, point);
if (m_bMouseOver)
{
CRect oRect;
GetClientRect(&oRect);
//check if the mouse is in the rect
if (oRect.PtInRect(point) == false)
{
m_bMouseOver = false;
//Release the Mouse capture previously take
ReleaseCapture();
RedrawWindow();
return;
}
}else
{
m_bMouseOver = true;
RedrawWindow();
//capture the mouse
SetCapture();
}
}
//before Subclassing
void CMyHyperLink::PreSubclassWindow()
{
//Enable the Static to send the Window Messages To its parent
DWORD dwStyle = GetStyle();
SetWindowLongPtr(GetSafeHwnd() ,GWL_STYLE ,dwStyle | SS_NOTIFY);
char szCurretText[MAX_PATH];
GetWindowText(szCurretText, MAX_PATH);
if ((szCurretText) == NULL){
SetWindowText(m_csLinkText.operator LPCTSTR());
}
LOGFONT sLogFont;
GetFont()->GetLogFont(&sLogFont);
//Set the Link UnderLined
sLogFont.lfUnderline = true;
//Set the Font to the Control
m_oTextFont.CreateFontIndirect(&sLogFont);
this->SetFont(&m_oTextFont, true);
//Adjust the window
//IsValidURL();
//Set the Cursor Hand
//WinHlp32.exe in windows folder ResourceID 106
//is a standard window HAND cursor
//courtesy www.codeguru.com
//you can use a custom Hand cursor resourse also
// i added that as a resourse in this project with
// ID - IDC_CURSOR_HAND
char szWindowsDir[MAX_PATH*2];
GetWindowsDirectory(szWindowsDir ,MAX_PATH*2);
strcat(szWindowsDir,"\\Winhlp32.exe");
HMODULE hModule = LoadLibrary(szWindowsDir);
if (hModule){
m_hHyperCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
}
this->SetCursor(m_hHyperCursor);
//free the module
if (hModule)
FreeLibrary(hModule);
CStatic::PreSubclassWindow();
this->SetCursor(m_hHyperCursor);
m_ToolTip.Create(this,TTS_ALWAYSTIP);
CRect oRect;
GetClientRect(&oRect);
m_ToolTip.AddTool(this,"",oRect,1001);
m_ToolTip.ShowWindow(SW_HIDE);
}
void CMyHyperLink::SetLinkText(CString csLinkText)
{
m_csLinkText = csLinkText;
this->SetWindowText(csLinkText.operator LPCTSTR());
}
BOOL CMyHyperLink::PreTranslateMessage(MSG* pMsg)
{
m_ToolTip.RelayEvent(pMsg);
return CStatic::PreTranslateMessage(pMsg);
}
BOOL CMyHyperLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
::SetCursor(m_hHyperCursor);
return true;
//return CStatic::OnSetCursor(pWnd, nHitTest, message);
}
//////////////////EVENT WILL GET HERE //////////////////////
void CMyHyperLink::OnClicked()
{
if (m_bFireChild){
//Fire the Event to Parent Window
CWnd *pParent;
pParent = GetParent();
int nCtrlID = GetDlgCtrlID();
::SendMessage(pParent->m_hWnd, _HYPERLINK_EVENT, (WPARAM)nCtrlID, 0);
//::PostMessage(pParent->m_hWnd, __EVENT_ID_, (WPARAM)nCtrlID, 0);
}else
{
GoToLinkUrl(m_csUrl);
}
m_bVisited = true;
//reddraw the control
this->Invalidate(true);
}
HBRUSH CMyHyperLink::CtlColor(CDC* pDC, UINT nCtlColor)
{
if (m_bMouseOver){
if (m_bVisited)
pDC->SetTextColor(m_sVisitedColor);
else
pDC->SetTextColor(m_sHoverColor);
}else {
if (m_bVisited)
pDC->SetTextColor(m_sVisitedColor);
else
pDC->SetTextColor(m_sLinkColor);
}
pDC->SetBkMode(TRANSPARENT);
return((HBRUSH)GetStockObject(NULL_BRUSH));
}
void CMyHyperLink::SetToolTipTextColor(COLORREF sToolTipText) {
m_ToolTip.SetTipTextColor(sToolTipText);
}
void CMyHyperLink::SetToolTipBgColor(COLORREF sToolTipBgColor)
{
m_ToolTip.SetTipBkColor(sToolTipBgColor);
}
CString CMyHyperLink::GetLinkText() {
if (m_csLinkText.IsEmpty())
return CString("");
return m_csLinkText;
}
void CMyHyperLink::SetLinkUrl(CString csUrl) {
m_csUrl= csUrl;
}
CString CMyHyperLink::GetLinkUrl() {
return m_csUrl;
}
void CMyHyperLink::SetVisitedColor(COLORREF sVisitedColor) {
m_sVisitedColor = sVisitedColor ;
}
void CMyHyperLink::SetHoverColor(COLORREF cHoverColor) {
m_sHoverColor = cHoverColor;
}
void CMyHyperLink::SetFireChild(int nFlag) {
if (nFlag)
m_bFireChild = true;
else
m_bFireChild = false;
}
BOOL CMyHyperLink::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR* pMsgHdr;
pMsgHdr = (NMHDR*) lParam;
switch (pMsgHdr->code){
case NM_RCLICK:
break;
default:
;
}
return CStatic::OnNotify(wParam, lParam, pResult);
}
// MyHyperLink.cpp : implementation file
//
// Written By : Renjith.R
// Email : renji12renji@m2comsys.com
// Details :Derived from MFC CStatic
// Date :Nov 25 2002
#include "stdafx.h"
#include "HyperLink.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyHyperLink
CMyHyperLink::CMyHyperLink()
{
m_sLinkColor = RGB(0, 0 ,255);
m_sHoverColor = RGB(255, 0, 0);
m_sVisitedColor = RGB(5, 34, 143);
m_bFireChild = false;
m_bMouseOver = false;
m_bEnableToolTip = false;
m_bVisited = false;
//Create Tooltip
}
CMyHyperLink::~CMyHyperLink()
{
}
BEGIN_MESSAGE_MAP(CMyHyperLink, CStatic)
//{{AFX_MSG_MAP(CMyHyperLink)
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyHyperLink message handlers
//Sets the Link Color
void CMyHyperLink::SetLinkColor(COLORREF sLinkColor)
{
m_sLinkColor = sLinkColor;
}
//open the URL by Windows ShellExecute()
bool CMyHyperLink::GoToLinkUrl(CString csLink)
{
HINSTANCE hInstance = (HINSTANCE)ShellExecute(NULL, _T("open"), csLink.operator LPCTSTR(), NULL, NULL, 2);
if ((UINT_PTR)hInstance < HINSTANCE_ERROR){
return false;
}else
return true;
}
//User can Active/Inactive the Tooltip already they set
void CMyHyperLink::ActiveToolTip(int nFlag)
{
if (nFlag)
m_bEnableToolTip = true;
else
m_bEnableToolTip = false;
}
//change The Tooltip text
void CMyHyperLink::SetTootTipText(LPCSTR szToolTip)
{
if (m_bEnableToolTip )
{
m_ToolTip.UpdateTipText(szToolTip,this,1001);
}
}
//The Mouse Move Message
void CMyHyperLink::OnMouseMove(UINT nFlags, CPoint point)
{
CStatic::OnMouseMove(nFlags, point);
if (m_bMouseOver)
{
CRect oRect;
GetClientRect(&oRect);
//check if the mouse is in the rect
if (oRect.PtInRect(point) == false)
{
m_bMouseOver = false;
//Release the Mouse capture previously take
ReleaseCapture();
RedrawWindow();
return;
}
}else
{
m_bMouseOver = true;
RedrawWindow();
//capture the mouse
SetCapture();
}
}
//before Subclassing
void CMyHyperLink::PreSubclassWindow()
{
//Enable the Static to send the Window Messages To its parent
DWORD dwStyle = GetStyle();
SetWindowLongPtr(GetSafeHwnd() ,GWL_STYLE ,dwStyle | SS_NOTIFY);
char szCurretText[MAX_PATH];
GetWindowText(szCurretText, MAX_PATH);
if ((szCurretText) == NULL){
SetWindowText(m_csLinkText.operator LPCTSTR());
}
LOGFONT sLogFont;
GetFont()->GetLogFont(&sLogFont);
//Set the Link UnderLined
sLogFont.lfUnderline = true;
//Set the Font to the Control
m_oTextFont.CreateFontIndirect(&sLogFont);
this->SetFont(&m_oTextFont, true);
//Adjust the window
//IsValidURL();
//Set the Cursor Hand
//WinHlp32.exe in windows folder ResourceID 106
//is a standard window HAND cursor
//courtesy www.codeguru.com
//you can use a custom Hand cursor resourse also
// i added that as a resourse in this project with
// ID - IDC_CURSOR_HAND
char szWindowsDir[MAX_PATH*2];
GetWindowsDirectory(szWindowsDir ,MAX_PATH*2);
strcat(szWindowsDir,"\\Winhlp32.exe");
HMODULE hModule = LoadLibrary(szWindowsDir);
if (hModule){
m_hHyperCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
}
this->SetCursor(m_hHyperCursor);
//free the module
if (hModule)
FreeLibrary(hModule);
CStatic::PreSubclassWindow();
this->SetCursor(m_hHyperCursor);
m_ToolTip.Create(this,TTS_ALWAYSTIP);
CRect oRect;
GetClientRect(&oRect);
m_ToolTip.AddTool(this,"",oRect,1001);
m_ToolTip.ShowWindow(SW_HIDE);
}
void CMyHyperLink::SetLinkText(CString csLinkText)
{
m_csLinkText = csLinkText;
this->SetWindowText(csLinkText.operator LPCTSTR());
}
BOOL CMyHyperLink::PreTranslateMessage(MSG* pMsg)
{
m_ToolTip.RelayEvent(pMsg);
return CStatic::PreTranslateMessage(pMsg);
}
BOOL CMyHyperLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
::SetCursor(m_hHyperCursor);
return true;
//return CStatic::OnSetCursor(pWnd, nHitTest, message);
}
//////////////////EVENT WILL GET HERE //////////////////////
void CMyHyperLink::OnClicked()
{
if (m_bFireChild){
//Fire the Event to Parent Window
CWnd *pParent;
pParent = GetParent();
int nCtrlID = GetDlgCtrlID();
::SendMessage(pParent->m_hWnd, _HYPERLINK_EVENT, (WPARAM)nCtrlID, 0);
//::PostMessage(pParent->m_hWnd, __EVENT_ID_, (WPARAM)nCtrlID, 0);
}else
{
GoToLinkUrl(m_csUrl);
}
m_bVisited = true;
//reddraw the control
this->Invalidate(true);
}
HBRUSH CMyHyperLink::CtlColor(CDC* pDC, UINT nCtlColor)
{
if (m_bMouseOver){
if (m_bVisited)
pDC->SetTextColor(m_sVisitedColor);
else
pDC->SetTextColor(m_sHoverColor);
}else {
if (m_bVisited)
pDC->SetTextColor(m_sVisitedColor);
else
pDC->SetTextColor(m_sLinkColor);
}
pDC->SetBkMode(TRANSPARENT);
return((HBRUSH)GetStockObject(NULL_BRUSH));
}
void CMyHyperLink::SetToolTipTextColor(COLORREF sToolTipText) {
m_ToolTip.SetTipTextColor(sToolTipText);
}
void CMyHyperLink::SetToolTipBgColor(COLORREF sToolTipBgColor)
{
m_ToolTip.SetTipBkColor(sToolTipBgColor);
}
CString CMyHyperLink::GetLinkText() {
if (m_csLinkText.IsEmpty())
return CString("");
return m_csLinkText;
}
void CMyHyperLink::SetLinkUrl(CString csUrl) {
m_csUrl= csUrl;
}
CString CMyHyperLink::GetLinkUrl() {
return m_csUrl;
}
void CMyHyperLink::SetVisitedColor(COLORREF sVisitedColor) {
m_sVisitedColor = sVisitedColor ;
}
void CMyHyperLink::SetHoverColor(COLORREF cHoverColor) {
m_sHoverColor = cHoverColor;
}
void CMyHyperLink::SetFireChild(int nFlag) {
if (nFlag)
m_bFireChild = true;
else
m_bFireChild = false;
}
BOOL CMyHyperLink::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR* pMsgHdr;
pMsgHdr = (NMHDR*) lParam;
switch (pMsgHdr->code){
case NM_RCLICK:
break;
default:
;
}
return CStatic::OnNotify(wParam, lParam, pResult);
}

View File

@@ -1,108 +1,108 @@
////////////////////////////////////////////////////////
// Class Name : CMyHyperLink
// Written By : Renjith.R
// Email : renjith_sree@hotmail.com
// Details :Derived from MFC CStatic
// Date :Nov 25 2002
// This can be used as a Hyperlink
//Feel free to use this class in your project
///////////////////////////////////////////////////////////
#if !defined(AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_)
#define AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MyHyperLink.h : header file
//
//This is the EventID , Which Will send to the Parent
//by the hyperlink control
# define _HYPERLINK_EVENT WM_USER + 101
/////////////////////////////////////////////////////////////////////////////
// CMyHyperLink window
class CMyHyperLink : public CStatic
{
// Construction
public:
CMyHyperLink();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyHyperLink)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PreSubclassWindow();
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
// Implementation
public:
void SetFireChild(int nFlag);
CString GetLinkText();
CString GetLinkUrl();
bool GoToLinkUrl(CString csLink);
void SetHoverColor(COLORREF cHoverColor);
void SetVisitedColor(COLORREF sVisitedColor);
void SetLinkUrl(CString csUrl);
void SetToolTipBgColor(COLORREF sToolTipBgColor);
void SetToolTipTextColor(COLORREF sToolTipText);
void SetLinkText(CString csLinkText);
void SetTootTipText(LPCSTR szToolTip);
void ActiveToolTip(int nFlag);
void SetLinkColor(COLORREF sLinkColor);
virtual ~CMyHyperLink();
// Generated message map functions
protected:
bool m_bFireChild;
HCURSOR m_hHyperCursor;
bool m_bEnableToolTip;
bool m_bMouseOver;
bool m_bVisited;
CFont m_oTextFont;
CToolTipCtrl m_ToolTip;
CString m_csToolTipText;
CString m_csLinkText;
CString m_csUrl;
COLORREF m_sHoverColor;
COLORREF m_sLinkColor;
COLORREF m_sVisitedColor;
//{{AFX_MSG(CMyHyperLink)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnClicked();
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_)
////////////////////////////////////////////////////////
// Class Name : CMyHyperLink
// Written By : Renjith.R
// Email : renjith_sree@hotmail.com
// Details :Derived from MFC CStatic
// Date :Nov 25 2002
// This can be used as a Hyperlink
//Feel free to use this class in your project
///////////////////////////////////////////////////////////
#if !defined(AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_)
#define AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MyHyperLink.h : header file
//
//This is the EventID , Which Will send to the Parent
//by the hyperlink control
# define _HYPERLINK_EVENT WM_USER + 101
/////////////////////////////////////////////////////////////////////////////
// CMyHyperLink window
class CMyHyperLink : public CStatic
{
// Construction
public:
CMyHyperLink();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyHyperLink)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PreSubclassWindow();
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
// Implementation
public:
void SetFireChild(int nFlag);
CString GetLinkText();
CString GetLinkUrl();
bool GoToLinkUrl(CString csLink);
void SetHoverColor(COLORREF cHoverColor);
void SetVisitedColor(COLORREF sVisitedColor);
void SetLinkUrl(CString csUrl);
void SetToolTipBgColor(COLORREF sToolTipBgColor);
void SetToolTipTextColor(COLORREF sToolTipText);
void SetLinkText(CString csLinkText);
void SetTootTipText(LPCSTR szToolTip);
void ActiveToolTip(int nFlag);
void SetLinkColor(COLORREF sLinkColor);
virtual ~CMyHyperLink();
// Generated message map functions
protected:
bool m_bFireChild;
HCURSOR m_hHyperCursor;
bool m_bEnableToolTip;
bool m_bMouseOver;
bool m_bVisited;
CFont m_oTextFont;
CToolTipCtrl m_ToolTip;
CString m_csToolTipText;
CString m_csLinkText;
CString m_csUrl;
COLORREF m_sHoverColor;
COLORREF m_sLinkColor;
COLORREF m_sVisitedColor;
//{{AFX_MSG(CMyHyperLink)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnClicked();
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_)

View File

@@ -1,499 +1,499 @@
// MountPoints.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "MountPoints.h"
#include "Ext2MgrDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMountPoints dialog
CMountPoints::CMountPoints(CWnd* pParent /*=NULL*/)
: CDialog(CMountPoints::IDD, pParent)
{
//{{AFX_DATA_INIT(CMountPoints)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_Cdrom = NULL;
m_Volume = NULL;
m_Part = NULL;
m_Letter = "";
m_bUpdated = TRUE;
m_bMgrNoted = FALSE;
m_MainDlg = NULL;
}
void CMountPoints::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMountPoints)
DDX_Control(pDX, IDC_DRV_LETTER_LIST, m_drvList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMountPoints, CDialog)
//{{AFX_MSG_MAP(CMountPoints)
ON_NOTIFY(NM_CLICK, IDC_DRV_LETTER_LIST, OnClickDrvLetterList)
ON_BN_CLICKED(ID_ADD_MOUNTPOINT, OnAddMountpoint)
ON_BN_CLICKED(ID_CHANGE_MOUNTPOINT, OnChangeMountpoint)
ON_BN_CLICKED(ID_REMOVE_MOUNTPOINT, OnRemoveMountpoint)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMountPoints message handlers
void CMountPoints::OnClickDrvLetterList(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int item = m_drvList.GetSelectionMark();
if (item != -1) {
m_Letter = m_drvList.GetItemText(item, 0);
if (!m_Letter.IsEmpty()) {
SET_WIN(ID_CHANGE_MOUNTPOINT, TRUE);
SET_WIN(ID_REMOVE_MOUNTPOINT, TRUE);
}
}
if (pResult) {
*pResult = 0;
}
}
BOOL
CMountPoints::AddMountPoint(
CHAR drvChar,
BOOL bRegistry,
BOOL bMountMgr
)
{
CHAR devPath[MAX_PATH];
PEXT2_LETTER drvLetter = NULL;
ULONGLONG letterMask = 0;
BOOL rc = TRUE;
BOOL bMount = FALSE;
PEXT2_VOLUME_PROPERTY3 EVP = NULL;
memset(devPath, 0, MAX_PATH);
if (drvChar >= '0' && drvChar <= '9') {
drvLetter = &drvDigits[drvChar - '0'];
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
} else if (drvChar >= 'A' && drvChar <= 'Z') {
drvLetter = &drvLetters[drvChar - 'A'];
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
}
if (!drvLetter) {
return FALSE;
}
if (m_Part) {
if (m_Part->Volume) {
strcpy(devPath, m_Part->Volume->Name);
} else {
sprintf(devPath, "\\Device\\Harddisk%u\\Partition%u",
m_Part->Disk->OrderNo, m_Part->Number);
}
}
if (m_Volume) {
strcpy(devPath, m_Volume->Name);
EVP = &m_Volume->EVP;
}
if (m_Cdrom) {
strcpy(devPath, m_Cdrom->Name);
EVP = &m_Cdrom->EVP;
}
if (bRegistry) {
CString str;
if (Ext2SetRegistryMountPoint(&drvChar, devPath, bRegistry)) {
Ext2AssignDrvLetter(drvLetter, devPath, FALSE);
EndDialog(0);
} else {
str.Format("Failed to modify registry: SYSTEM\\CurrentControlSet\\Control\\Session Manager\\DOS Devices\n");
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
return FALSE;
}
}
if (drvLetter->bUsed)
return FALSE;
if ((m_Volume != NULL) && (m_Volume->DrvLetters == 0) &&
(m_Volume->EVP.bExt2 || m_Volume->EVP.bExt3) ) {
bMount = TRUE;
} else if (m_Part != NULL && m_Part->Volume &&
(m_Part->Volume->DrvLetters == 0) &&
(m_Part->Volume->EVP.bExt2 || m_Part->Volume->EVP.bExt3) ) {
EVP = &m_Part->Volume->EVP;
bMount = TRUE;
}
if (EVP) {
if (Ext2IsNullUuid(&EVP->UUID[0])) {
AfxMessageBox("UUID is 0.");
}
if (!Ext2CheckVolumeRegistryProperty(EVP)) {
Ext2SetDefaultVolumeRegistryProperty(EVP);
}
}
/* create an entry in regisgtry */
{
NT::NTSTATUS status;
HANDLE Handle = NULL;
CString str;
status = Ext2Open(devPath, &Handle, EXT2_DESIRED_ACCESS);
if (!NT_SUCCESS(status)) {
str.Format("Ext2Fsd service is not started.\n");
AfxMessageBox(str, MB_OK | MB_ICONSTOP);
return FALSE;
}
rc = Ext2QueryExt2Property(Handle, EVP);
if (!rc) {
goto errorout;
}
EVP->DrvLetter = drvLetter->Letter | 0x80;
EVP->Flags2 |= EXT2_VPROP3_AUTOMOUNT;
Ext2StorePropertyinRegistry(EVP);
rc = Ext2SetExt2Property(Handle, EVP);
errorout:
Ext2Close(&Handle);
}
if (bMount)
{
rc = Ext2AssignDrvLetter(drvLetter, devPath, bMountMgr);
if (!rc && !bMountMgr) {
CString str;
str.Format("Failed to assign new drive letter %c:\n", drvChar);
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
return FALSE;
}
} else {
rc = FALSE;
}
if (0 && bMountMgr) {
Ext2UpdateDrvLetter(drvLetter, devPath);
if (!bMount) {
Ext2RefreshVolumePoint(devPath, drvLetter->Letter);
}
Sleep(500);
drvChar = Ext2QueryMountPoint(devPath);
if (drvChar >= '0' && drvChar <= '9') {
drvLetter = &drvDigits[drvChar - '0'];
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
} else if (drvChar >= 'A' && drvChar <= 'Z') {
drvLetter = &drvLetters[drvChar - 'A'];
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
} else {
drvLetter = NULL; letterMask = 0;
}
rc = drvLetter ? TRUE : FALSE;
}
if (rc) {
m_bUpdated = TRUE;
if (m_Part) {
m_Part->DrvLetters |= letterMask;
if (m_Part->Volume) {
m_Part->Volume->DrvLetters |= letterMask;
}
InitializeList(m_Part->DrvLetters);
}
if (m_Volume) {
m_Volume->DrvLetters |= letterMask;
InitializeList(m_Volume->DrvLetters);
}
if (m_Cdrom) {
m_Cdrom->DrvLetters |= letterMask;
InitializeList(m_Cdrom->DrvLetters);
}
/*
((CExt2MgrDlg *)m_MainDlg)->DriverLetterChangeNotify(drvLetter->Letter, TRUE);
*/
m_MainDlg->SendMessage(
WM_MOUNTPOINT_NOTIFY,
'DA', (LPARAM)drvLetter->Letter);
}
return TRUE;
}
void CMountPoints::OnAddMountpoint()
{
CSelectDrvLetter drvSel;
STORAGE_BUS_TYPE busType = BusTypeAta;
if (m_Part) {
busType = m_Part->Disk->SDD.BusType;
}
if (m_Volume && m_Volume->Part) {
busType = m_Volume->Part->Disk->SDD.BusType;
}
#if TRUE
drvSel.m_bDosDev = TRUE;
drvSel.m_bMountMgr = FALSE;
drvSel.m_bRegistry = FALSE;
#else
if (m_Cdrom ||
busType == BusType1394 ||
busType == BusTypeUsb ) {
drvSel.m_bMountMgr = TRUE;
drvSel.m_bRegistry = FALSE;
drvSel.m_bDosDev = FALSE;
}
#endif
if (drvSel.DoModal() != IDOK) {
return;
}
AddMountPoint(drvSel.m_DrvLetter.GetAt(0),
drvSel.m_bRegistry,
drvSel.m_bMountMgr
);
OnOK();
}
void CMountPoints::OnChangeMountpoint()
{
CHAR odrvChar = 0;
CHAR ndrvChar = 0;
CSelectDrvLetter drvSel;
STORAGE_BUS_TYPE busType = BusTypeAta;
if (m_Part) {
busType = m_Part->Disk->SDD.BusType;
}
if (m_Volume && m_Volume->Part) {
busType = m_Volume->Part->Disk->SDD.BusType;
}
#if TRUE
drvSel.m_bMountMgr = FALSE;
drvSel.m_bRegistry = FALSE;
drvSel.m_bDosDev = TRUE;
#else
if (m_Cdrom ||
busType == BusType1394 ||
busType == BusTypeUsb ) {
drvSel.m_bMountMgr = TRUE;
drvSel.m_bRegistry = FALSE;
drvSel.m_bDosDev = FALSE;
}
#endif
if (drvSel.DoModal() != IDOK) {
return;
}
ndrvChar = drvSel.m_DrvLetter.GetAt(0);
odrvChar = m_Letter.GetAt(0);
if (RemoveMountPoint(odrvChar)) {
AddMountPoint(
ndrvChar,
drvSel.m_bRegistry,
drvSel.m_bMountMgr
);
}
OnOK();
}
BOOL
CMountPoints::RemoveMountPoint(CHAR drvChar)
{
PEXT2_LETTER drvLetter = NULL;
ULONGLONG letterMask = 0;
if (drvChar >= '0' && drvChar <= '9') {
drvLetter = &drvDigits[drvChar - '0'];
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
} else if (drvChar >= 'A' && drvChar <= 'Z') {
drvLetter = &drvLetters[drvChar - 'A'];
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
}
if (!drvLetter) {
return FALSE;
}
Ext2SetRegistryMountPoint(&drvChar, NULL, FALSE);
if (Ext2RemoveDrvLetter(drvLetter)) {
m_MainDlg->SendMessage(WM_MOUNTPOINT_NOTIFY,
'DR', (LPARAM)drvLetter->Letter);
} else {
CString str;
str.Format("Failed to remove drive letter %c:\n", drvChar);
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
return FALSE;
}
if (m_Part) {
m_Part->DrvLetters &= (~letterMask);
if (m_Part->Volume) {
m_Part->Volume->DrvLetters &= ~letterMask;
}
InitializeList(m_Part->DrvLetters);
}
if (m_Volume) {
PEXT2_PARTITION part = Ext2QueryVolumePartition(m_Volume);
m_Volume->DrvLetters &= ~letterMask;
if (part) {
part->DrvLetters &= ~letterMask;
}
InitializeList(m_Volume->DrvLetters);
}
if (m_Cdrom) {
m_Cdrom->DrvLetters &= ~letterMask;
InitializeList(m_Cdrom->DrvLetters);
}
return TRUE;
}
void CMountPoints::OnRemoveMountpoint()
{
CHAR drvChar = m_Letter.GetAt(0);
if (RemoveMountPoint(drvChar)) {
SET_WIN(ID_CHANGE_MOUNTPOINT, FALSE);
SET_WIN(ID_REMOVE_MOUNTPOINT, FALSE);
if (m_drvList.GetItemCount() == 0)
OnOK();
}
}
void CMountPoints::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
void CMountPoints::OnCancel()
{
CDialog::OnCancel();
}
void CMountPoints::InitializeList(ULONGLONG letters)
{
CHAR drvName[] = "C:\0";
int i = 0;
ULONGLONG drive = 0;
m_drvList.DeleteAllItems();
for (i=0; i < 10; i++) {
drive = ((ULONGLONG) 1) << (i + 32);
if (letters & drive) {
drvName[0] = '0' + i;
m_drvList.InsertItem(
m_drvList.GetItemCount(),
drvName);
}
}
for (i=2; i < 26; i++) {
drive = ((ULONGLONG) 1) << (i);
if (letters & drive) {
drvName[0] = 'A' + i;
m_drvList.InsertItem(
m_drvList.GetItemCount(),
drvName);
}
}
}
BOOL CMountPoints::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
ASSERT(m_Volume || m_Part);
if (m_Part) {
InitializeList(m_Part->DrvLetters);
} else if (m_Volume) {
InitializeList(m_Volume->DrvLetters);
} else {
InitializeList(m_Cdrom->DrvLetters);
}
m_drvList.SetSelectionMark(0);
m_drvList.SetFocus();
m_Letter = m_drvList.GetItemText(0, 0);
if (m_Letter.IsEmpty()) {
SET_WIN(ID_CHANGE_MOUNTPOINT, FALSE);
SET_WIN(ID_REMOVE_MOUNTPOINT, FALSE);
} else {
SET_WIN(ID_CHANGE_MOUNTPOINT, TRUE);
SET_WIN(ID_REMOVE_MOUNTPOINT, TRUE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CMountPoints::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
#if 0
if (pMsg->message==WM_KEYDOWN) {
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) {
pMsg->wParam = NULL;
}
}
#endif
return CDialog::PreTranslateMessage(pMsg);
}
// MountPoints.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "MountPoints.h"
#include "Ext2MgrDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMountPoints dialog
CMountPoints::CMountPoints(CWnd* pParent /*=NULL*/)
: CDialog(CMountPoints::IDD, pParent)
{
//{{AFX_DATA_INIT(CMountPoints)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_Cdrom = NULL;
m_Volume = NULL;
m_Part = NULL;
m_Letter = "";
m_bUpdated = TRUE;
m_bMgrNoted = FALSE;
m_MainDlg = NULL;
}
void CMountPoints::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMountPoints)
DDX_Control(pDX, IDC_DRV_LETTER_LIST, m_drvList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMountPoints, CDialog)
//{{AFX_MSG_MAP(CMountPoints)
ON_NOTIFY(NM_CLICK, IDC_DRV_LETTER_LIST, OnClickDrvLetterList)
ON_BN_CLICKED(ID_ADD_MOUNTPOINT, OnAddMountpoint)
ON_BN_CLICKED(ID_CHANGE_MOUNTPOINT, OnChangeMountpoint)
ON_BN_CLICKED(ID_REMOVE_MOUNTPOINT, OnRemoveMountpoint)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMountPoints message handlers
void CMountPoints::OnClickDrvLetterList(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int item = m_drvList.GetSelectionMark();
if (item != -1) {
m_Letter = m_drvList.GetItemText(item, 0);
if (!m_Letter.IsEmpty()) {
SET_WIN(ID_CHANGE_MOUNTPOINT, TRUE);
SET_WIN(ID_REMOVE_MOUNTPOINT, TRUE);
}
}
if (pResult) {
*pResult = 0;
}
}
BOOL
CMountPoints::AddMountPoint(
CHAR drvChar,
BOOL bRegistry,
BOOL bMountMgr
)
{
CHAR devPath[MAX_PATH];
PEXT2_LETTER drvLetter = NULL;
ULONGLONG letterMask = 0;
BOOL rc = TRUE;
BOOL bMount = FALSE;
PEXT2_VOLUME_PROPERTY3 EVP = NULL;
memset(devPath, 0, MAX_PATH);
if (drvChar >= '0' && drvChar <= '9') {
drvLetter = &drvDigits[drvChar - '0'];
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
} else if (drvChar >= 'A' && drvChar <= 'Z') {
drvLetter = &drvLetters[drvChar - 'A'];
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
}
if (!drvLetter) {
return FALSE;
}
if (m_Part) {
if (m_Part->Volume) {
strcpy(devPath, m_Part->Volume->Name);
} else {
sprintf(devPath, "\\Device\\Harddisk%u\\Partition%u",
m_Part->Disk->OrderNo, m_Part->Number);
}
}
if (m_Volume) {
strcpy(devPath, m_Volume->Name);
EVP = &m_Volume->EVP;
}
if (m_Cdrom) {
strcpy(devPath, m_Cdrom->Name);
EVP = &m_Cdrom->EVP;
}
if (bRegistry) {
CString str;
if (Ext2SetRegistryMountPoint(&drvChar, devPath, bRegistry)) {
Ext2AssignDrvLetter(drvLetter, devPath, FALSE);
EndDialog(0);
} else {
str.Format("Failed to modify registry: SYSTEM\\CurrentControlSet\\Control\\Session Manager\\DOS Devices\n");
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
return FALSE;
}
}
if (drvLetter->bUsed)
return FALSE;
if ((m_Volume != NULL) && (m_Volume->DrvLetters == 0) &&
(m_Volume->EVP.bExt2 || m_Volume->EVP.bExt3) ) {
bMount = TRUE;
} else if (m_Part != NULL && m_Part->Volume &&
(m_Part->Volume->DrvLetters == 0) &&
(m_Part->Volume->EVP.bExt2 || m_Part->Volume->EVP.bExt3) ) {
EVP = &m_Part->Volume->EVP;
bMount = TRUE;
}
if (EVP) {
if (Ext2IsNullUuid(&EVP->UUID[0])) {
AfxMessageBox("UUID is 0.");
}
if (!Ext2CheckVolumeRegistryProperty(EVP)) {
Ext2SetDefaultVolumeRegistryProperty(EVP);
}
}
/* create an entry in regisgtry */
{
NT::NTSTATUS status;
HANDLE Handle = NULL;
CString str;
status = Ext2Open(devPath, &Handle, EXT2_DESIRED_ACCESS);
if (!NT_SUCCESS(status)) {
str.Format("Ext2Fsd service is not started.\n");
AfxMessageBox(str, MB_OK | MB_ICONSTOP);
return FALSE;
}
rc = Ext2QueryExt2Property(Handle, EVP);
if (!rc) {
goto errorout;
}
EVP->DrvLetter = drvLetter->Letter | 0x80;
EVP->Flags2 |= EXT2_VPROP3_AUTOMOUNT;
Ext2StorePropertyinRegistry(EVP);
rc = Ext2SetExt2Property(Handle, EVP);
errorout:
Ext2Close(&Handle);
}
if (bMount)
{
rc = Ext2AssignDrvLetter(drvLetter, devPath, bMountMgr);
if (!rc && !bMountMgr) {
CString str;
str.Format("Failed to assign new drive letter %c:\n", drvChar);
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
return FALSE;
}
} else {
rc = FALSE;
}
if (0 && bMountMgr) {
Ext2UpdateDrvLetter(drvLetter, devPath);
if (!bMount) {
Ext2RefreshVolumePoint(devPath, drvLetter->Letter);
}
Sleep(500);
drvChar = Ext2QueryMountPoint(devPath);
if (drvChar >= '0' && drvChar <= '9') {
drvLetter = &drvDigits[drvChar - '0'];
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
} else if (drvChar >= 'A' && drvChar <= 'Z') {
drvLetter = &drvLetters[drvChar - 'A'];
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
} else {
drvLetter = NULL; letterMask = 0;
}
rc = drvLetter ? TRUE : FALSE;
}
if (rc) {
m_bUpdated = TRUE;
if (m_Part) {
m_Part->DrvLetters |= letterMask;
if (m_Part->Volume) {
m_Part->Volume->DrvLetters |= letterMask;
}
InitializeList(m_Part->DrvLetters);
}
if (m_Volume) {
m_Volume->DrvLetters |= letterMask;
InitializeList(m_Volume->DrvLetters);
}
if (m_Cdrom) {
m_Cdrom->DrvLetters |= letterMask;
InitializeList(m_Cdrom->DrvLetters);
}
/*
((CExt2MgrDlg *)m_MainDlg)->DriverLetterChangeNotify(drvLetter->Letter, TRUE);
*/
m_MainDlg->SendMessage(
WM_MOUNTPOINT_NOTIFY,
'DA', (LPARAM)drvLetter->Letter);
}
return TRUE;
}
void CMountPoints::OnAddMountpoint()
{
CSelectDrvLetter drvSel;
STORAGE_BUS_TYPE busType = BusTypeAta;
if (m_Part) {
busType = m_Part->Disk->SDD.BusType;
}
if (m_Volume && m_Volume->Part) {
busType = m_Volume->Part->Disk->SDD.BusType;
}
#if TRUE
drvSel.m_bDosDev = TRUE;
drvSel.m_bMountMgr = FALSE;
drvSel.m_bRegistry = FALSE;
#else
if (m_Cdrom ||
busType == BusType1394 ||
busType == BusTypeUsb ) {
drvSel.m_bMountMgr = TRUE;
drvSel.m_bRegistry = FALSE;
drvSel.m_bDosDev = FALSE;
}
#endif
if (drvSel.DoModal() != IDOK) {
return;
}
AddMountPoint(drvSel.m_DrvLetter.GetAt(0),
drvSel.m_bRegistry,
drvSel.m_bMountMgr
);
OnOK();
}
void CMountPoints::OnChangeMountpoint()
{
CHAR odrvChar = 0;
CHAR ndrvChar = 0;
CSelectDrvLetter drvSel;
STORAGE_BUS_TYPE busType = BusTypeAta;
if (m_Part) {
busType = m_Part->Disk->SDD.BusType;
}
if (m_Volume && m_Volume->Part) {
busType = m_Volume->Part->Disk->SDD.BusType;
}
#if TRUE
drvSel.m_bMountMgr = FALSE;
drvSel.m_bRegistry = FALSE;
drvSel.m_bDosDev = TRUE;
#else
if (m_Cdrom ||
busType == BusType1394 ||
busType == BusTypeUsb ) {
drvSel.m_bMountMgr = TRUE;
drvSel.m_bRegistry = FALSE;
drvSel.m_bDosDev = FALSE;
}
#endif
if (drvSel.DoModal() != IDOK) {
return;
}
ndrvChar = drvSel.m_DrvLetter.GetAt(0);
odrvChar = m_Letter.GetAt(0);
if (RemoveMountPoint(odrvChar)) {
AddMountPoint(
ndrvChar,
drvSel.m_bRegistry,
drvSel.m_bMountMgr
);
}
OnOK();
}
BOOL
CMountPoints::RemoveMountPoint(CHAR drvChar)
{
PEXT2_LETTER drvLetter = NULL;
ULONGLONG letterMask = 0;
if (drvChar >= '0' && drvChar <= '9') {
drvLetter = &drvDigits[drvChar - '0'];
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
} else if (drvChar >= 'A' && drvChar <= 'Z') {
drvLetter = &drvLetters[drvChar - 'A'];
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
}
if (!drvLetter) {
return FALSE;
}
Ext2SetRegistryMountPoint(&drvChar, NULL, FALSE);
if (Ext2RemoveDrvLetter(drvLetter)) {
m_MainDlg->SendMessage(WM_MOUNTPOINT_NOTIFY,
'DR', (LPARAM)drvLetter->Letter);
} else {
CString str;
str.Format("Failed to remove drive letter %c:\n", drvChar);
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
return FALSE;
}
if (m_Part) {
m_Part->DrvLetters &= (~letterMask);
if (m_Part->Volume) {
m_Part->Volume->DrvLetters &= ~letterMask;
}
InitializeList(m_Part->DrvLetters);
}
if (m_Volume) {
PEXT2_PARTITION part = Ext2QueryVolumePartition(m_Volume);
m_Volume->DrvLetters &= ~letterMask;
if (part) {
part->DrvLetters &= ~letterMask;
}
InitializeList(m_Volume->DrvLetters);
}
if (m_Cdrom) {
m_Cdrom->DrvLetters &= ~letterMask;
InitializeList(m_Cdrom->DrvLetters);
}
return TRUE;
}
void CMountPoints::OnRemoveMountpoint()
{
CHAR drvChar = m_Letter.GetAt(0);
if (RemoveMountPoint(drvChar)) {
SET_WIN(ID_CHANGE_MOUNTPOINT, FALSE);
SET_WIN(ID_REMOVE_MOUNTPOINT, FALSE);
if (m_drvList.GetItemCount() == 0)
OnOK();
}
}
void CMountPoints::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
void CMountPoints::OnCancel()
{
CDialog::OnCancel();
}
void CMountPoints::InitializeList(ULONGLONG letters)
{
CHAR drvName[] = "C:\0";
int i = 0;
ULONGLONG drive = 0;
m_drvList.DeleteAllItems();
for (i=0; i < 10; i++) {
drive = ((ULONGLONG) 1) << (i + 32);
if (letters & drive) {
drvName[0] = '0' + i;
m_drvList.InsertItem(
m_drvList.GetItemCount(),
drvName);
}
}
for (i=2; i < 26; i++) {
drive = ((ULONGLONG) 1) << (i);
if (letters & drive) {
drvName[0] = 'A' + i;
m_drvList.InsertItem(
m_drvList.GetItemCount(),
drvName);
}
}
}
BOOL CMountPoints::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
ASSERT(m_Volume || m_Part);
if (m_Part) {
InitializeList(m_Part->DrvLetters);
} else if (m_Volume) {
InitializeList(m_Volume->DrvLetters);
} else {
InitializeList(m_Cdrom->DrvLetters);
}
m_drvList.SetSelectionMark(0);
m_drvList.SetFocus();
m_Letter = m_drvList.GetItemText(0, 0);
if (m_Letter.IsEmpty()) {
SET_WIN(ID_CHANGE_MOUNTPOINT, FALSE);
SET_WIN(ID_REMOVE_MOUNTPOINT, FALSE);
} else {
SET_WIN(ID_CHANGE_MOUNTPOINT, TRUE);
SET_WIN(ID_REMOVE_MOUNTPOINT, TRUE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CMountPoints::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
#if 0
if (pMsg->message==WM_KEYDOWN) {
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) {
pMsg->wParam = NULL;
}
}
#endif
return CDialog::PreTranslateMessage(pMsg);
}

View File

@@ -1,75 +1,75 @@
#if !defined(AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_)
#define AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_
#include "SelectDrvLetter.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MountPoints.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMountPoints dialog
class CMountPoints : public CDialog
{
// Construction
public:
CMountPoints(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CMountPoints)
enum { IDD = IDD_CHANGE_MOUNTPINT };
CListCtrl m_drvList;
//}}AFX_DATA
void InitializeList(ULONGLONG letters);
// Attributes
public:
PEXT2_CDROM m_Cdrom;
PEXT2_VOLUME m_Volume;
PEXT2_PARTITION m_Part;
CString m_Letter;
BOOL m_bUpdated;
BOOL m_bMgrNoted;
CWnd * m_MainDlg;
BOOL
RemoveMountPoint(CHAR drvChar);
BOOL
AddMountPoint(CHAR drvChar, BOOL bRegistry, BOOL bMountMgr);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMountPoints)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CMountPoints)
afx_msg void OnClickDrvLetterList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnAddMountpoint();
afx_msg void OnChangeMountpoint();
afx_msg void OnRemoveMountpoint();
virtual void OnOK();
virtual void OnCancel();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_)
#if !defined(AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_)
#define AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_
#include "SelectDrvLetter.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MountPoints.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMountPoints dialog
class CMountPoints : public CDialog
{
// Construction
public:
CMountPoints(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CMountPoints)
enum { IDD = IDD_CHANGE_MOUNTPINT };
CListCtrl m_drvList;
//}}AFX_DATA
void InitializeList(ULONGLONG letters);
// Attributes
public:
PEXT2_CDROM m_Cdrom;
PEXT2_VOLUME m_Volume;
PEXT2_PARTITION m_Part;
CString m_Letter;
BOOL m_bUpdated;
BOOL m_bMgrNoted;
CWnd * m_MainDlg;
BOOL
RemoveMountPoint(CHAR drvChar);
BOOL
AddMountPoint(CHAR drvChar, BOOL bRegistry, BOOL bMountMgr);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMountPoints)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CMountPoints)
afx_msg void OnClickDrvLetterList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnAddMountpoint();
afx_msg void OnChangeMountpoint();
afx_msg void OnRemoveMountpoint();
virtual void OnOK();
virtual void OnCancel();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_)

View File

@@ -1,131 +1,131 @@
// PartBox.cpp : implementation file
//
#include "stdafx.h"
#include "PartBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPartBox
CPartBox::CPartBox()
{
m_nID = IDC_PROPERTY_SDEV;
m_nLeft = 10;
m_nSize = 80;
}
CPartBox::~CPartBox()
{
}
BEGIN_MESSAGE_MAP(CPartBox, CButton)
//{{AFX_MSG_MAP(CPartBox)
ON_WM_SETFOCUS()
ON_CBN_SELCHANGE(IDC_PROPERTY_SDEV, OnSelectChanged)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPartBox message handlers
void CPartBox::OnSelectChanged()
{
GetParent()->SendMessage(WM_GROUP_BOX_UPDATED, 'GB', 'PVLU');
}
void CPartBox::PreSubclassWindow()
{
//
// Make sure that this control has the BS_ICON style set.
// If not, it behaves very strangely:
// It erases itself if the user TABs to controls in the dialog,
// unless the user first clicks it. Very strange!!
//
ModifyStyle(0, BS_ICON|WS_TABSTOP|WS_GROUP);
CString strTitle;
GetWindowText(strTitle);
int nWidth = AssemblingTitle();
CRect r;
GetWindowRect(&r);
ScreenToClient(r);
r.OffsetRect(m_nLeft, 0);
r.bottom = r.top + m_nSize;
r.right = r.left + m_nSize + nWidth;
m_ComboBox.Create(WS_CHILD | CBS_DROPDOWN | WS_VSCROLL |
CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST,
r, this, m_nID);
m_ComboBox.SetFont(GetFont(), true);
m_ComboBox.ShowWindow(SW_SHOW);
SetListboxHeight(m_ComboBox.m_hWnd);
}
int CPartBox::AssemblingTitle()
{
//
// The group box title needs to be erased, but I need to keep
// the border away from the check box text. I create a string
// of spaces (' ') that is the same length as the title was
// plus the size of the checkbox. plus a little more.
//
CString strOldTitle, strNewTitle;
GetWindowText(strOldTitle);
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(GetFont());
CSize czText = dc.GetTextExtent(strOldTitle);
int nRet = czText.cx;
int nTarget = czText.cx + m_nSize;
while(czText.cx < nTarget)
{
strNewTitle.Insert(0, ' ');
czText = dc.GetTextExtent(strNewTitle);
}
dc.SelectObject(pOldFont);
SetWindowText(strNewTitle);
return nRet;
}
void CPartBox::OnSetFocus(CWnd* pOldWnd)
{
CButton::OnSetFocus(pOldWnd);
m_ComboBox.SetFocus();
}
void CPartBox::SetListboxHeight(HWND hWnd)
{
RECT rc;
::SendMessage(hWnd, LB_GETITEMRECT, 0, (LPARAM)&rc);
::GetClientRect(hWnd, &rc);
int cyClient= rc.bottom - rc.top;
::GetWindowRect(hWnd, &rc);
int cxListbox = rc.right - rc.left;
int cyListbox = rc.bottom - rc.top;
cyListbox = 120;
::SetWindowPos(hWnd, NULL, 0, 0,
cxListbox, cyListbox,
SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS|
SWP_NOOWNERZORDER|SWP_NOZORDER
);
}
// PartBox.cpp : implementation file
//
#include "stdafx.h"
#include "PartBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPartBox
CPartBox::CPartBox()
{
m_nID = IDC_PROPERTY_SDEV;
m_nLeft = 10;
m_nSize = 80;
}
CPartBox::~CPartBox()
{
}
BEGIN_MESSAGE_MAP(CPartBox, CButton)
//{{AFX_MSG_MAP(CPartBox)
ON_WM_SETFOCUS()
ON_CBN_SELCHANGE(IDC_PROPERTY_SDEV, OnSelectChanged)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPartBox message handlers
void CPartBox::OnSelectChanged()
{
GetParent()->SendMessage(WM_GROUP_BOX_UPDATED, 'GB', 'PVLU');
}
void CPartBox::PreSubclassWindow()
{
//
// Make sure that this control has the BS_ICON style set.
// If not, it behaves very strangely:
// It erases itself if the user TABs to controls in the dialog,
// unless the user first clicks it. Very strange!!
//
ModifyStyle(0, BS_ICON|WS_TABSTOP|WS_GROUP);
CString strTitle;
GetWindowText(strTitle);
int nWidth = AssemblingTitle();
CRect r;
GetWindowRect(&r);
ScreenToClient(r);
r.OffsetRect(m_nLeft, 0);
r.bottom = r.top + m_nSize;
r.right = r.left + m_nSize + nWidth;
m_ComboBox.Create(WS_CHILD | CBS_DROPDOWN | WS_VSCROLL |
CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST,
r, this, m_nID);
m_ComboBox.SetFont(GetFont(), true);
m_ComboBox.ShowWindow(SW_SHOW);
SetListboxHeight(m_ComboBox.m_hWnd);
}
int CPartBox::AssemblingTitle()
{
//
// The group box title needs to be erased, but I need to keep
// the border away from the check box text. I create a string
// of spaces (' ') that is the same length as the title was
// plus the size of the checkbox. plus a little more.
//
CString strOldTitle, strNewTitle;
GetWindowText(strOldTitle);
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(GetFont());
CSize czText = dc.GetTextExtent(strOldTitle);
int nRet = czText.cx;
int nTarget = czText.cx + m_nSize;
while(czText.cx < nTarget)
{
strNewTitle.Insert(0, ' ');
czText = dc.GetTextExtent(strNewTitle);
}
dc.SelectObject(pOldFont);
SetWindowText(strNewTitle);
return nRet;
}
void CPartBox::OnSetFocus(CWnd* pOldWnd)
{
CButton::OnSetFocus(pOldWnd);
m_ComboBox.SetFocus();
}
void CPartBox::SetListboxHeight(HWND hWnd)
{
RECT rc;
::SendMessage(hWnd, LB_GETITEMRECT, 0, (LPARAM)&rc);
::GetClientRect(hWnd, &rc);
int cyClient= rc.bottom - rc.top;
::GetWindowRect(hWnd, &rc);
int cxListbox = rc.right - rc.left;
int cyListbox = rc.bottom - rc.top;
cyListbox = 120;
::SetWindowPos(hWnd, NULL, 0, 0,
cxListbox, cyListbox,
SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS|
SWP_NOOWNERZORDER|SWP_NOZORDER
);
}

View File

@@ -1,61 +1,61 @@
#if !defined(AFX_PART_BOX_H_)
#define AFX_PART_BOX_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PartBox.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPartBox window
class CPartBox : public CButton
{
// Construction
public:
CPartBox();
// Operations
public:
void SetListboxHeight(HWND hWnd);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPartBox)
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CPartBox();
// Generated message map functions
protected:
//{{AFX_MSG(CPartBox)
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSelectChanged();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
int m_nID;
int m_nLeft;
int m_nSize;
CComboBox m_ComboBox;
private:
int AssemblingTitle();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
#if !defined(AFX_PART_BOX_H_)
#define AFX_PART_BOX_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PartBox.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPartBox window
class CPartBox : public CButton
{
// Construction
public:
CPartBox();
// Operations
public:
void SetListboxHeight(HWND hWnd);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPartBox)
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CPartBox();
// Generated message map functions
protected:
//{{AFX_MSG(CPartBox)
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSelectChanged();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
int m_nID;
int m_nLeft;
int m_nSize;
CComboBox m_ComboBox;
private:
int AssemblingTitle();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif

View File

@@ -1,93 +1,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
}
// 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
}

View File

@@ -1,57 +1,57 @@
#if !defined(AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_)
#define AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PartitionType.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPartitionType dialog
class CPartitionType : public CDialog
{
// Construction
public:
CPartitionType(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPartitionType)
enum { IDD = IDD_PARTITION_TYPE };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPartitionType)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
CString m_sPartType;
public:
PEXT2_PARTITION m_Part;
UCHAR m_cPartType;
CString m_sDevice;
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPartitionType)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_)
#if !defined(AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_)
#define AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PartitionType.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPartitionType dialog
class CPartitionType : public CDialog
{
// Construction
public:
CPartitionType(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPartitionType)
enum { IDD = IDD_PARTITION_TYPE };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPartitionType)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
CString m_sPartType;
public:
PEXT2_PARTITION m_Part;
UCHAR m_cPartType;
CString m_sDevice;
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPartitionType)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_)

View File

@@ -1,267 +1,267 @@
// PerfStatDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "PerfStatDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPerfStatDlg dialog
CPerfStatDlg::CPerfStatDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPerfStatDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPerfStatDlg)
m_Interval = 30;
m_Handle = 0;
//}}AFX_DATA_INIT
m_IrpList = NULL;
m_MemList = NULL;
}
void CPerfStatDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPerfStatDlg)
DDX_Text(pDX, IDC_PERFSTAT_INTERVAL, m_Interval);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPerfStatDlg, CDialog)
//{{AFX_MSG_MAP(CPerfStatDlg)
ON_WM_TIMER()
ON_WM_DESTROY()
ON_COMMAND(ID_QUERYPERF, OnQueryPerf)
ON_EN_CHANGE(IDC_PERFSTAT_INTERVAL, OnChangePerfstatInterval)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPerfStatDlg message handlers
BOOL CPerfStatDlg::OnInitDialog()
{
LONG_PTR dwStyle = 0;
int i;
CString s;
CDialog::OnInitDialog();
m_IrpList = (CListCtrl *)GetDlgItem(IDC_IRP_LIST);
m_MemList = (CListCtrl *)GetDlgItem(IDC_MEMORY_LIST);;
if (m_IrpList == NULL || m_MemList == NULL) {
return FALSE;
}
/* initialize the memory list */
dwStyle=GetWindowLongPtr(m_MemList->GetSafeHwnd(), GWL_STYLE);
dwStyle&=~LVS_TYPEMASK;
dwStyle|= (LVS_REPORT | LVS_AUTOARRANGE);
SetWindowLongPtr(m_MemList->GetSafeHwnd(),GWL_STYLE,dwStyle);
m_MemList->SetExtendedStyle(LVS_EX_GRIDLINES);
ListView_SetExtendedListViewStyleEx (
m_MemList->GetSafeHwnd(),
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );
m_MemList->DeleteAllItems();
s.LoadString(IDS_PERFSTAT_NAME);
m_MemList->InsertColumn(0, (LPCSTR)s, LVCFMT_RIGHT, 100);
s.LoadString(IDS_PERFSTAT_UNIT);
m_MemList->InsertColumn(1, (LPCSTR)s, LVCFMT_RIGHT, 40);
s.LoadString(IDS_PERFSTAT_CURRENT);
m_MemList->InsertColumn(2, (LPCSTR)s, LVCFMT_RIGHT, 56);
s.LoadString(IDS_PERFSTAT_SIZE);
m_MemList->InsertColumn(3, (LPCSTR)s, LVCFMT_RIGHT, 80);
s.LoadString(IDS_PERFSTAT_TOTAL);
m_MemList->InsertColumn(4, (LPCSTR)s, LVCFMT_RIGHT, 120);
for (i = 0; PerfStatStrings[i] != NULL ; i++) {
m_MemList->InsertItem(i, PerfStatStrings[i]);
}
/* initialize the irp list */
dwStyle=GetWindowLongPtr(m_IrpList->GetSafeHwnd(), GWL_STYLE);
dwStyle&=~LVS_TYPEMASK;
dwStyle|= (LVS_REPORT | LVS_AUTOARRANGE);
SetWindowLongPtr(m_IrpList->GetSafeHwnd(),GWL_STYLE,dwStyle);
m_IrpList->SetExtendedStyle(LVS_EX_GRIDLINES);
ListView_SetExtendedListViewStyleEx (
m_IrpList->GetSafeHwnd(),
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );
m_IrpList->DeleteAllItems();
s.LoadString(IDS_PERFSTAT_NAME);
m_IrpList->InsertColumn(0, (LPCSTR)s, LVCFMT_RIGHT, 180);
s.LoadString(IDS_PERFSTAT_PROCESSING);
m_IrpList->InsertColumn(1, (LPCSTR)s, LVCFMT_RIGHT, 110);
s.LoadString(IDS_PERFSTAT_PROCESSED);
m_IrpList->InsertColumn(2, (LPCSTR)s, LVCFMT_RIGHT, 100);
for (i=0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
m_IrpList->InsertItem(i, IrpMjStrings[i]);
}
RefreshPerfStat();
SetTimer('STAT', m_Interval * 1000, NULL);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPerfStatDlg::RefreshPerfStat()
{
int i;
CString s;
PEXT2_PERF_STATISTICS_V1 PerfV1 = NULL;
PEXT2_PERF_STATISTICS_V2 PerfV2 = NULL;
NT::NTSTATUS status;
if (m_Handle == 0) {
status = Ext2Open("\\DosDevices\\Ext2Fsd", &m_Handle,
EXT2_DESIRED_ACCESS );
if (!NT_SUCCESS(status)) {
goto errorout;
}
}
if (Ext2QueryPerfStat(m_Handle, &m_PerfStat, &PerfV1, &PerfV2)) {
if (PerfV2) {
if (m_MemList) {
for (i = 0; i < PS_MAX_TYPE_V2; i++) {
if (PerfV2->Unit.Slot[i] == 0)
break;
else if (PerfV2->Unit.Slot[i] == 1)
s = "*";
else
s.Format("%u", PerfV2->Unit.Slot[i]);
m_MemList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV2->Current.Slot[i]);
m_MemList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV2->Size.Slot[i]);
m_MemList->SetItem(i, 3, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV2->Total.Slot[i]);
m_MemList->SetItem(i, 4, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
}
}
if (m_IrpList) {
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
s.Format("%u", PerfV2->Irps[i].Current);
m_IrpList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV2->Irps[i].Processed);
m_IrpList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
}
}
} else if (PerfV1) {
if (m_MemList) {
for (i = 0; i < PS_MAX_TYPE_V1; i++) {
if (PerfV1->Unit.Slot[i] == 0)
s = "*";
else
s.Format("%u", PerfV1->Unit.Slot[i]);
m_MemList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV1->Current.Slot[i]);
m_MemList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV1->Size.Slot[i]);
m_MemList->SetItem(i, 3, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV1->Total.Slot[i]);
m_MemList->SetItem(i, 4, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
}
}
if (m_IrpList) {
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
s.Format("%u", PerfV1->Irps[i].Current);
m_IrpList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV1->Irps[i].Processed);
m_IrpList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
}
}
}
} else {
Ext2Close(&m_Handle);
}
errorout:
return;
}
void CPerfStatDlg::OnTimer(UINT_PTR nIDEvent)
{
RefreshPerfStat();
CDialog::OnTimer(nIDEvent);
}
void CPerfStatDlg::OnDestroy()
{
KillTimer('STAT');
Ext2Close(&m_Handle);
CDialog::OnDestroy();
}
void CPerfStatDlg::OnChangePerfstatInterval()
{
UpdateData(TRUE);
if (m_Interval == 0) {
m_Interval = 1;
}
SetTimer('STAT', m_Interval * 1000, NULL);
}
void CPerfStatDlg::OnOK()
{
// TODO: Add extra validation here
KillTimer('STAT');
Ext2Close(&m_Handle);
GetParent()->PostMessage(WM_COMMAND, ID_PERFSTOP, 0);
CDialog::OnOK();
}
void CPerfStatDlg::OnCancel()
{
// TODO: Add extra validation here
KillTimer('STAT');
Ext2Close(&m_Handle);
GetParent()->PostMessage(WM_COMMAND, ID_PERFSTOP, 0);
CDialog::OnCancel();
}
void CPerfStatDlg::OnQueryPerf()
{
RefreshPerfStat();
}
// PerfStatDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "PerfStatDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPerfStatDlg dialog
CPerfStatDlg::CPerfStatDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPerfStatDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPerfStatDlg)
m_Interval = 30;
m_Handle = 0;
//}}AFX_DATA_INIT
m_IrpList = NULL;
m_MemList = NULL;
}
void CPerfStatDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPerfStatDlg)
DDX_Text(pDX, IDC_PERFSTAT_INTERVAL, m_Interval);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPerfStatDlg, CDialog)
//{{AFX_MSG_MAP(CPerfStatDlg)
ON_WM_TIMER()
ON_WM_DESTROY()
ON_COMMAND(ID_QUERYPERF, OnQueryPerf)
ON_EN_CHANGE(IDC_PERFSTAT_INTERVAL, OnChangePerfstatInterval)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPerfStatDlg message handlers
BOOL CPerfStatDlg::OnInitDialog()
{
LONG_PTR dwStyle = 0;
int i;
CString s;
CDialog::OnInitDialog();
m_IrpList = (CListCtrl *)GetDlgItem(IDC_IRP_LIST);
m_MemList = (CListCtrl *)GetDlgItem(IDC_MEMORY_LIST);;
if (m_IrpList == NULL || m_MemList == NULL) {
return FALSE;
}
/* initialize the memory list */
dwStyle=GetWindowLongPtr(m_MemList->GetSafeHwnd(), GWL_STYLE);
dwStyle&=~LVS_TYPEMASK;
dwStyle|= (LVS_REPORT | LVS_AUTOARRANGE);
SetWindowLongPtr(m_MemList->GetSafeHwnd(),GWL_STYLE,dwStyle);
m_MemList->SetExtendedStyle(LVS_EX_GRIDLINES);
ListView_SetExtendedListViewStyleEx (
m_MemList->GetSafeHwnd(),
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );
m_MemList->DeleteAllItems();
s.LoadString(IDS_PERFSTAT_NAME);
m_MemList->InsertColumn(0, (LPCSTR)s, LVCFMT_RIGHT, 100);
s.LoadString(IDS_PERFSTAT_UNIT);
m_MemList->InsertColumn(1, (LPCSTR)s, LVCFMT_RIGHT, 40);
s.LoadString(IDS_PERFSTAT_CURRENT);
m_MemList->InsertColumn(2, (LPCSTR)s, LVCFMT_RIGHT, 56);
s.LoadString(IDS_PERFSTAT_SIZE);
m_MemList->InsertColumn(3, (LPCSTR)s, LVCFMT_RIGHT, 80);
s.LoadString(IDS_PERFSTAT_TOTAL);
m_MemList->InsertColumn(4, (LPCSTR)s, LVCFMT_RIGHT, 120);
for (i = 0; PerfStatStrings[i] != NULL ; i++) {
m_MemList->InsertItem(i, PerfStatStrings[i]);
}
/* initialize the irp list */
dwStyle=GetWindowLongPtr(m_IrpList->GetSafeHwnd(), GWL_STYLE);
dwStyle&=~LVS_TYPEMASK;
dwStyle|= (LVS_REPORT | LVS_AUTOARRANGE);
SetWindowLongPtr(m_IrpList->GetSafeHwnd(),GWL_STYLE,dwStyle);
m_IrpList->SetExtendedStyle(LVS_EX_GRIDLINES);
ListView_SetExtendedListViewStyleEx (
m_IrpList->GetSafeHwnd(),
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );
m_IrpList->DeleteAllItems();
s.LoadString(IDS_PERFSTAT_NAME);
m_IrpList->InsertColumn(0, (LPCSTR)s, LVCFMT_RIGHT, 180);
s.LoadString(IDS_PERFSTAT_PROCESSING);
m_IrpList->InsertColumn(1, (LPCSTR)s, LVCFMT_RIGHT, 110);
s.LoadString(IDS_PERFSTAT_PROCESSED);
m_IrpList->InsertColumn(2, (LPCSTR)s, LVCFMT_RIGHT, 100);
for (i=0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
m_IrpList->InsertItem(i, IrpMjStrings[i]);
}
RefreshPerfStat();
SetTimer('STAT', m_Interval * 1000, NULL);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPerfStatDlg::RefreshPerfStat()
{
int i;
CString s;
PEXT2_PERF_STATISTICS_V1 PerfV1 = NULL;
PEXT2_PERF_STATISTICS_V2 PerfV2 = NULL;
NT::NTSTATUS status;
if (m_Handle == 0) {
status = Ext2Open("\\DosDevices\\Ext2Fsd", &m_Handle,
EXT2_DESIRED_ACCESS );
if (!NT_SUCCESS(status)) {
goto errorout;
}
}
if (Ext2QueryPerfStat(m_Handle, &m_PerfStat, &PerfV1, &PerfV2)) {
if (PerfV2) {
if (m_MemList) {
for (i = 0; i < PS_MAX_TYPE_V2; i++) {
if (PerfV2->Unit.Slot[i] == 0)
break;
else if (PerfV2->Unit.Slot[i] == 1)
s = "*";
else
s.Format("%u", PerfV2->Unit.Slot[i]);
m_MemList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV2->Current.Slot[i]);
m_MemList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV2->Size.Slot[i]);
m_MemList->SetItem(i, 3, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV2->Total.Slot[i]);
m_MemList->SetItem(i, 4, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
}
}
if (m_IrpList) {
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
s.Format("%u", PerfV2->Irps[i].Current);
m_IrpList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV2->Irps[i].Processed);
m_IrpList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
}
}
} else if (PerfV1) {
if (m_MemList) {
for (i = 0; i < PS_MAX_TYPE_V1; i++) {
if (PerfV1->Unit.Slot[i] == 0)
s = "*";
else
s.Format("%u", PerfV1->Unit.Slot[i]);
m_MemList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV1->Current.Slot[i]);
m_MemList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV1->Size.Slot[i]);
m_MemList->SetItem(i, 3, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV1->Total.Slot[i]);
m_MemList->SetItem(i, 4, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
}
}
if (m_IrpList) {
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
s.Format("%u", PerfV1->Irps[i].Current);
m_IrpList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
s.Format("%u", PerfV1->Irps[i].Processed);
m_IrpList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
}
}
}
} else {
Ext2Close(&m_Handle);
}
errorout:
return;
}
void CPerfStatDlg::OnTimer(UINT_PTR nIDEvent)
{
RefreshPerfStat();
CDialog::OnTimer(nIDEvent);
}
void CPerfStatDlg::OnDestroy()
{
KillTimer('STAT');
Ext2Close(&m_Handle);
CDialog::OnDestroy();
}
void CPerfStatDlg::OnChangePerfstatInterval()
{
UpdateData(TRUE);
if (m_Interval == 0) {
m_Interval = 1;
}
SetTimer('STAT', m_Interval * 1000, NULL);
}
void CPerfStatDlg::OnOK()
{
// TODO: Add extra validation here
KillTimer('STAT');
Ext2Close(&m_Handle);
GetParent()->PostMessage(WM_COMMAND, ID_PERFSTOP, 0);
CDialog::OnOK();
}
void CPerfStatDlg::OnCancel()
{
// TODO: Add extra validation here
KillTimer('STAT');
Ext2Close(&m_Handle);
GetParent()->PostMessage(WM_COMMAND, ID_PERFSTOP, 0);
CDialog::OnCancel();
}
void CPerfStatDlg::OnQueryPerf()
{
RefreshPerfStat();
}

View File

@@ -1,60 +1,60 @@
#if !defined(AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_)
#define AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PerfStatDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPerfStatDlg dialog
class CPerfStatDlg : public CDialog
{
// Construction
public:
CPerfStatDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPerfStatDlg)
enum { IDD = IDD_PERFSTAT_DIALOG };
int m_Interval;
//}}AFX_DATA
CListCtrl * m_IrpList;
CListCtrl * m_MemList;
HANDLE m_Handle;
EXT2_QUERY_PERFSTAT m_PerfStat;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPerfStatDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPerfStatDlg)
virtual BOOL OnInitDialog();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnChangePerfstatInterval();
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnQueryPerf();
void RefreshPerfStat();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_)
#if !defined(AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_)
#define AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PerfStatDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPerfStatDlg dialog
class CPerfStatDlg : public CDialog
{
// Construction
public:
CPerfStatDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CPerfStatDlg)
enum { IDD = IDD_PERFSTAT_DIALOG };
int m_Interval;
//}}AFX_DATA
CListCtrl * m_IrpList;
CListCtrl * m_MemList;
HANDLE m_Handle;
EXT2_QUERY_PERFSTAT m_PerfStat;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPerfStatDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPerfStatDlg)
virtual BOOL OnInitDialog();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnChangePerfstatInterval();
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnQueryPerf();
void RefreshPerfStat();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_)

File diff suppressed because it is too large Load Diff

View File

@@ -1,76 +1,76 @@
#if !defined(AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_)
#define AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Properties.h : header file
//
#include "DiskBox.h"
#include "PartBox.h"
/////////////////////////////////////////////////////////////////////////////
// CProperties dialog
class CProperties : public CDialog
{
// Construction
public:
CProperties(CWnd* pParent = NULL); // standard constructor
BOOL m_bdisk;
ULONG m_type;
PVOID m_sdev;
// Dialog Data
//{{AFX_DATA(CProperties)
enum { IDD = IDD_PROPERTY_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
PEXT2_VOLUME m_volume;
PEXT2_CDROM m_cdrom;
PEXT2_DISK m_disk;
PEXT2_PARTITION m_part;
CDiskBox m_DiskBox;
CPartBox m_PartBox;
CComboBox *cbDiskBox;
CComboBox *cbPartBox;
// Generated message map functions
//{{AFX_MSG(CProperties)
afx_msg void OnSdevChangeMp();
afx_msg void OnSdevQuickMount();
afx_msg void OnSdevExt2Info();
virtual BOOL OnInitDialog();
LRESULT OnGroupBoxUpdated(WPARAM wParam,LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void ResetDiskGroup();
void ResetPartGroup();
void SetDisk(PEXT2_DISK disk);
void SetCdrom(PEXT2_CDROM cdrom);
void SetVolume(PEXT2_VOLUME volume);
void SetPartition(PEXT2_PARTITION part);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_)
#if !defined(AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_)
#define AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Properties.h : header file
//
#include "DiskBox.h"
#include "PartBox.h"
/////////////////////////////////////////////////////////////////////////////
// CProperties dialog
class CProperties : public CDialog
{
// Construction
public:
CProperties(CWnd* pParent = NULL); // standard constructor
BOOL m_bdisk;
ULONG m_type;
PVOID m_sdev;
// Dialog Data
//{{AFX_DATA(CProperties)
enum { IDD = IDD_PROPERTY_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
PEXT2_VOLUME m_volume;
PEXT2_CDROM m_cdrom;
PEXT2_DISK m_disk;
PEXT2_PARTITION m_part;
CDiskBox m_DiskBox;
CPartBox m_PartBox;
CComboBox *cbDiskBox;
CComboBox *cbPartBox;
// Generated message map functions
//{{AFX_MSG(CProperties)
afx_msg void OnSdevChangeMp();
afx_msg void OnSdevQuickMount();
afx_msg void OnSdevExt2Info();
virtual BOOL OnInitDialog();
LRESULT OnGroupBoxUpdated(WPARAM wParam,LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void ResetDiskGroup();
void ResetPartGroup();
void SetDisk(PEXT2_DISK disk);
void SetCdrom(PEXT2_CDROM cdrom);
void SetVolume(PEXT2_VOLUME volume);
void SetPartition(PEXT2_PARTITION part);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_)

View File

@@ -1,166 +1,166 @@
// SelectDrvLetter.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "SelectDrvLetter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSelectDrvLetter dialog
CSelectDrvLetter::CSelectDrvLetter(CWnd* pParent /*=NULL*/)
: CDialog(CSelectDrvLetter::IDD, pParent)
{
//{{AFX_DATA_INIT(CSelectDrvLetter)
m_DrvLetter = _T("");
//}}AFX_DATA_INIT
m_bMountMgr = TRUE;
m_bRegistry = FALSE;
m_bDosDev = FALSE;
}
void CSelectDrvLetter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSelectDrvLetter)
DDX_CBString(pDX, IDC_DRVLETTERS_LIST, m_DrvLetter);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSelectDrvLetter, CDialog)
//{{AFX_MSG_MAP(CSelectDrvLetter)
ON_BN_CLICKED(IDC_DOSDEV_MP, OnDosdevMount)
ON_BN_CLICKED(IDC_PERMANENT_MP, OnMMgrMount)
ON_BN_CLICKED(IDC_REGISTRY_MP, OnRegistryMount)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSelectDrvLetter message handlers
void CSelectDrvLetter::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
if (m_DrvLetter.IsEmpty()) {
AfxMessageBox("You must select a drive letter.", MB_OK|MB_ICONWARNING);
return;
}
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_DRVLETTERS_LIST);
if (cbDrvLetter) {
int rc = cbDrvLetter->FindStringExact(-1, m_DrvLetter);
if (rc == CB_ERR) {
AfxMessageBox("Invalid driver letter: "+m_DrvLetter, MB_OK|MB_ICONWARNING);
return;
}
}
CDialog::OnOK();
}
void CSelectDrvLetter::OnCancel()
{
// TODO: Add extra cleanup here
m_DrvLetter.Empty();
CDialog::OnCancel();
}
BOOL CSelectDrvLetter::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_DRVLETTERS_LIST);
if (cbDrvLetter) {
int i;
CHAR drvPath[]="A:\0";
cbDrvLetter->ResetContent();
for (i=2; i < 26; i++) {
if (!drvLetters[i].bUsed) {
drvPath[0] = drvLetters[i].Letter;
cbDrvLetter->AddString(drvPath);
}
}
/*
for (i=0; i < 10; i++) {
if (!drvDigits[i].bUsed) {
drvPath[0] = drvDigits[i].Letter;
cbDrvLetter->AddString(drvPath);
}
}
*/
cbDrvLetter->SetCurSel(0);
}
UpdateData(FALSE);
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
SET_WIN(IDC_PERMANENT_MP, FALSE);
SET_CHECK(IDC_PERMANENT_MP, 0);
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSelectDrvLetter::OnDosdevMount()
{
if (!m_bDosDev) {
m_bDosDev = !m_bDosDev;
if (m_bDosDev) {
m_bMountMgr = FALSE;
m_bRegistry = FALSE;
}
}
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
OnOK();
}
void CSelectDrvLetter::OnMMgrMount()
{
if (!m_bMountMgr) {
m_bMountMgr = !m_bMountMgr;
if (m_bMountMgr) {
m_bDosDev = FALSE;
m_bRegistry = FALSE;
}
}
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
OnOK();
}
void CSelectDrvLetter::OnRegistryMount()
{
if (!m_bRegistry) {
m_bRegistry = !m_bRegistry;
if (m_bRegistry) {
m_bDosDev = FALSE;
m_bMountMgr = FALSE;
}
}
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
OnOK();
}
// SelectDrvLetter.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "SelectDrvLetter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSelectDrvLetter dialog
CSelectDrvLetter::CSelectDrvLetter(CWnd* pParent /*=NULL*/)
: CDialog(CSelectDrvLetter::IDD, pParent)
{
//{{AFX_DATA_INIT(CSelectDrvLetter)
m_DrvLetter = _T("");
//}}AFX_DATA_INIT
m_bMountMgr = TRUE;
m_bRegistry = FALSE;
m_bDosDev = FALSE;
}
void CSelectDrvLetter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSelectDrvLetter)
DDX_CBString(pDX, IDC_DRVLETTERS_LIST, m_DrvLetter);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSelectDrvLetter, CDialog)
//{{AFX_MSG_MAP(CSelectDrvLetter)
ON_BN_CLICKED(IDC_DOSDEV_MP, OnDosdevMount)
ON_BN_CLICKED(IDC_PERMANENT_MP, OnMMgrMount)
ON_BN_CLICKED(IDC_REGISTRY_MP, OnRegistryMount)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSelectDrvLetter message handlers
void CSelectDrvLetter::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
if (m_DrvLetter.IsEmpty()) {
AfxMessageBox("You must select a drive letter.", MB_OK|MB_ICONWARNING);
return;
}
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_DRVLETTERS_LIST);
if (cbDrvLetter) {
int rc = cbDrvLetter->FindStringExact(-1, m_DrvLetter);
if (rc == CB_ERR) {
AfxMessageBox("Invalid driver letter: "+m_DrvLetter, MB_OK|MB_ICONWARNING);
return;
}
}
CDialog::OnOK();
}
void CSelectDrvLetter::OnCancel()
{
// TODO: Add extra cleanup here
m_DrvLetter.Empty();
CDialog::OnCancel();
}
BOOL CSelectDrvLetter::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_DRVLETTERS_LIST);
if (cbDrvLetter) {
int i;
CHAR drvPath[]="A:\0";
cbDrvLetter->ResetContent();
for (i=2; i < 26; i++) {
if (!drvLetters[i].bUsed) {
drvPath[0] = drvLetters[i].Letter;
cbDrvLetter->AddString(drvPath);
}
}
/*
for (i=0; i < 10; i++) {
if (!drvDigits[i].bUsed) {
drvPath[0] = drvDigits[i].Letter;
cbDrvLetter->AddString(drvPath);
}
}
*/
cbDrvLetter->SetCurSel(0);
}
UpdateData(FALSE);
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
SET_WIN(IDC_PERMANENT_MP, FALSE);
SET_CHECK(IDC_PERMANENT_MP, 0);
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSelectDrvLetter::OnDosdevMount()
{
if (!m_bDosDev) {
m_bDosDev = !m_bDosDev;
if (m_bDosDev) {
m_bMountMgr = FALSE;
m_bRegistry = FALSE;
}
}
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
OnOK();
}
void CSelectDrvLetter::OnMMgrMount()
{
if (!m_bMountMgr) {
m_bMountMgr = !m_bMountMgr;
if (m_bMountMgr) {
m_bDosDev = FALSE;
m_bRegistry = FALSE;
}
}
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
OnOK();
}
void CSelectDrvLetter::OnRegistryMount()
{
if (!m_bRegistry) {
m_bRegistry = !m_bRegistry;
if (m_bRegistry) {
m_bDosDev = FALSE;
m_bMountMgr = FALSE;
}
}
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
OnOK();
}

View File

@@ -1,54 +1,54 @@
#if !defined(AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_)
#define AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SelectDrvLetter.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSelectDrvLetter dialog
class CSelectDrvLetter : public CDialog
{
// Construction
public:
CSelectDrvLetter(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CSelectDrvLetter)
enum { IDD = IDD_NEW_MOUNTPOINT };
CString m_DrvLetter;
//}}AFX_DATA
BOOL m_bMountMgr;
BOOL m_bRegistry;
BOOL m_bDosDev;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSelectDrvLetter)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CSelectDrvLetter)
virtual void OnOK();
virtual void OnCancel();
virtual BOOL OnInitDialog();
afx_msg void OnDosdevMount();
afx_msg void OnMMgrMount();
afx_msg void OnRegistryMount();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_)
#if !defined(AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_)
#define AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SelectDrvLetter.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSelectDrvLetter dialog
class CSelectDrvLetter : public CDialog
{
// Construction
public:
CSelectDrvLetter(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CSelectDrvLetter)
enum { IDD = IDD_NEW_MOUNTPOINT };
CString m_DrvLetter;
//}}AFX_DATA
BOOL m_bMountMgr;
BOOL m_bRegistry;
BOOL m_bDosDev;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSelectDrvLetter)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CSelectDrvLetter)
virtual void OnOK();
virtual void OnCancel();
virtual BOOL OnInitDialog();
afx_msg void OnDosdevMount();
afx_msg void OnMMgrMount();
afx_msg void OnRegistryMount();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_)

View File

@@ -1,222 +1,222 @@
// ServiceManage.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "ServiceManage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CServiceManage dialog
CServiceManage::CServiceManage(CWnd* pParent /*=NULL*/)
: CDialog(CServiceManage::IDD, pParent)
{
//{{AFX_DATA_INIT(CServiceManage)
m_Codepage = _T("");
m_bExt3Writable = FALSE;
m_bReadonly = FALSE;
m_srvStatus = _T("");
m_sPrefix = _T("");
m_sSuffix = _T("");
m_bAutoMount = FALSE;
//}}AFX_DATA_INIT
m_nStartmode = 0;
m_bStarted = Ext2IsServiceStarted();
if (m_bStarted) {
m_srvStatus = _T("Ext2Fsd is already started.");
} else {
m_srvStatus = _T("Ext2Fsd is NOT started.");
}
m_bInited = TRUE;
}
void CServiceManage::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CServiceManage)
DDX_CBString(pDX, IDC_COMBO_CODEPAGE, m_Codepage);
DDX_Check(pDX, IDC_EXT3_WRITABLE, m_bExt3Writable);
DDX_Check(pDX, IDC_READ_ONLY, m_bReadonly);
DDX_Text(pDX, IDC_SERVICE_STATUS, m_srvStatus);
DDX_Text(pDX, IDC_GLOBAL_PREFIX, m_sPrefix);
DDV_MaxChars(pDX, m_sPrefix, 31);
DDX_Text(pDX, IDC_GLOBAL_SUFFIX, m_sSuffix);
DDV_MaxChars(pDX, m_sSuffix, 31);
DDX_Check(pDX, IDC_EXT3_AUTOMOUNT, m_bAutoMount);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CServiceManage, CDialog)
//{{AFX_MSG_MAP(CServiceManage)
ON_BN_CLICKED(IDC_READ_ONLY, OnReadOnly)
ON_BN_CLICKED(IDC_EXT3_WRITABLE, OnExt3Writable)
ON_BN_CLICKED(IDC_START_SERVICE, OnStartService)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CServiceManage message handlers
void CServiceManage::OnReadOnly()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if (m_bReadonly) {
m_bExt3Writable = FALSE;
}
SET_WIN(IDC_EXT3_WRITABLE, !m_bReadonly);
UpdateData(FALSE);
}
void CServiceManage::OnExt3Writable()
{
// TODO: Add your control notification handler code here
}
void CServiceManage::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CServiceManage::OnOK()
{
BOOL rc;
// TODO: Add extra validation here
UpdateData(TRUE);
CComboBox *cbStartup = (CComboBox *)GetDlgItem(IDC_COMBO_STARTUP);
if (cbStartup) {
m_nStartmode = cbStartup->GetCurSel();
} else {
m_nStartmode = CB_ERR;
}
if (m_nStartmode == CB_ERR) {
AfxMessageBox("Invalid startup mode !", MB_OK|MB_ICONWARNING);
return;
}
if (m_Codepage.IsEmpty()) {
AfxMessageBox("You must select a codepage type.", MB_OK|MB_ICONWARNING);
return;
}
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
int rc = cbCodepage->FindStringExact(-1, m_Codepage);
if (rc == CB_ERR) {
AfxMessageBox("Invalid codepage type: "+m_Codepage, MB_OK|MB_ICONWARNING);
return;
}
}
if (AfxMessageBox("Current service settings will be overwritten,\ndo you want continue ?",
MB_YESNO | MB_ICONQUESTION) != IDYES) {
return;
}
rc = Ext2SetGlobalProperty(
m_nStartmode,
(BOOLEAN)m_bReadonly,
(BOOLEAN)m_bExt3Writable,
m_Codepage.GetBuffer(CODEPAGE_MAXLEN),
m_sPrefix.GetBuffer(HIDINGPAT_LEN),
m_sSuffix.GetBuffer(HIDINGPAT_LEN),
(BOOLEAN)m_bAutoMount
);
if (rc) {
/*
AfxMessageBox("Ext2 service settings updated successfully !",
MB_OK | MB_ICONINFORMATION);
*/
CDialog::OnOK();
} else {
AfxMessageBox("Failed to save the service settings !",
MB_OK | MB_ICONWARNING);
}
}
BOOL CServiceManage::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox *cbStartup = (CComboBox *)GetDlgItem(IDC_COMBO_STARTUP);
if (cbStartup) {
cbStartup->ResetContent();
cbStartup->AddString(_T("SERVICE_BOOT_START"));
cbStartup->AddString(_T("SERVICE_SYSTEM_START"));
cbStartup->AddString(_T("SERVICE_AUTO_START"));
cbStartup->AddString(_T("SERVICE_DEMAND_START"));
cbStartup->AddString(_T("SERVICE_DISABLED"));
cbStartup->SetCurSel(m_nStartmode);
}
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
int i = 0, j = -1;
cbCodepage->ResetContent();
while (gCodepages[i]) {
cbCodepage->AddString(gCodepages[i]);
if (!m_Codepage.IsEmpty()) {
CHAR *buffer = m_Codepage.GetBuffer(CODEPAGE_MAXLEN);
if (_stricmp(buffer, gCodepages[i]) == 0) {
j = i;
}
}
i++;
}
if (j == -1) {
m_Codepage = "default";
}
}
if (m_bReadonly) {
m_bExt3Writable = FALSE;
}
SET_WIN(IDC_EXT3_WRITABLE, !m_bReadonly);
SET_WIN(IDC_START_SERVICE, !m_bStarted);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CServiceManage::OnStartService()
{
// TODO: Add your control notification handler code here
m_bStarted = Ext2StartExt2Fsd();
if (m_bStarted) {
m_srvStatus = _T("Ext2Fsd was just started.");
GetParent()->SetTimer('REFF', 500, NULL);
GetParent()->SetTimer('REFR', 3000, NULL);
} else {
m_srvStatus = _T("Ext2Fsd could NOT be started.");
}
SET_WIN(IDC_START_SERVICE, !m_bStarted);
UpdateData(FALSE);
}
// ServiceManage.cpp : implementation file
//
#include "stdafx.h"
#include "ext2mgr.h"
#include "ServiceManage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CServiceManage dialog
CServiceManage::CServiceManage(CWnd* pParent /*=NULL*/)
: CDialog(CServiceManage::IDD, pParent)
{
//{{AFX_DATA_INIT(CServiceManage)
m_Codepage = _T("");
m_bExt3Writable = FALSE;
m_bReadonly = FALSE;
m_srvStatus = _T("");
m_sPrefix = _T("");
m_sSuffix = _T("");
m_bAutoMount = FALSE;
//}}AFX_DATA_INIT
m_nStartmode = 0;
m_bStarted = Ext2IsServiceStarted();
if (m_bStarted) {
m_srvStatus = _T("Ext2Fsd is already started.");
} else {
m_srvStatus = _T("Ext2Fsd is NOT started.");
}
m_bInited = TRUE;
}
void CServiceManage::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CServiceManage)
DDX_CBString(pDX, IDC_COMBO_CODEPAGE, m_Codepage);
DDX_Check(pDX, IDC_EXT3_WRITABLE, m_bExt3Writable);
DDX_Check(pDX, IDC_READ_ONLY, m_bReadonly);
DDX_Text(pDX, IDC_SERVICE_STATUS, m_srvStatus);
DDX_Text(pDX, IDC_GLOBAL_PREFIX, m_sPrefix);
DDV_MaxChars(pDX, m_sPrefix, 31);
DDX_Text(pDX, IDC_GLOBAL_SUFFIX, m_sSuffix);
DDV_MaxChars(pDX, m_sSuffix, 31);
DDX_Check(pDX, IDC_EXT3_AUTOMOUNT, m_bAutoMount);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CServiceManage, CDialog)
//{{AFX_MSG_MAP(CServiceManage)
ON_BN_CLICKED(IDC_READ_ONLY, OnReadOnly)
ON_BN_CLICKED(IDC_EXT3_WRITABLE, OnExt3Writable)
ON_BN_CLICKED(IDC_START_SERVICE, OnStartService)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CServiceManage message handlers
void CServiceManage::OnReadOnly()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if (m_bReadonly) {
m_bExt3Writable = FALSE;
}
SET_WIN(IDC_EXT3_WRITABLE, !m_bReadonly);
UpdateData(FALSE);
}
void CServiceManage::OnExt3Writable()
{
// TODO: Add your control notification handler code here
}
void CServiceManage::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CServiceManage::OnOK()
{
BOOL rc;
// TODO: Add extra validation here
UpdateData(TRUE);
CComboBox *cbStartup = (CComboBox *)GetDlgItem(IDC_COMBO_STARTUP);
if (cbStartup) {
m_nStartmode = cbStartup->GetCurSel();
} else {
m_nStartmode = CB_ERR;
}
if (m_nStartmode == CB_ERR) {
AfxMessageBox("Invalid startup mode !", MB_OK|MB_ICONWARNING);
return;
}
if (m_Codepage.IsEmpty()) {
AfxMessageBox("You must select a codepage type.", MB_OK|MB_ICONWARNING);
return;
}
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
int rc = cbCodepage->FindStringExact(-1, m_Codepage);
if (rc == CB_ERR) {
AfxMessageBox("Invalid codepage type: "+m_Codepage, MB_OK|MB_ICONWARNING);
return;
}
}
if (AfxMessageBox("Current service settings will be overwritten,\ndo you want continue ?",
MB_YESNO | MB_ICONQUESTION) != IDYES) {
return;
}
rc = Ext2SetGlobalProperty(
m_nStartmode,
(BOOLEAN)m_bReadonly,
(BOOLEAN)m_bExt3Writable,
m_Codepage.GetBuffer(CODEPAGE_MAXLEN),
m_sPrefix.GetBuffer(HIDINGPAT_LEN),
m_sSuffix.GetBuffer(HIDINGPAT_LEN),
(BOOLEAN)m_bAutoMount
);
if (rc) {
/*
AfxMessageBox("Ext2 service settings updated successfully !",
MB_OK | MB_ICONINFORMATION);
*/
CDialog::OnOK();
} else {
AfxMessageBox("Failed to save the service settings !",
MB_OK | MB_ICONWARNING);
}
}
BOOL CServiceManage::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox *cbStartup = (CComboBox *)GetDlgItem(IDC_COMBO_STARTUP);
if (cbStartup) {
cbStartup->ResetContent();
cbStartup->AddString(_T("SERVICE_BOOT_START"));
cbStartup->AddString(_T("SERVICE_SYSTEM_START"));
cbStartup->AddString(_T("SERVICE_AUTO_START"));
cbStartup->AddString(_T("SERVICE_DEMAND_START"));
cbStartup->AddString(_T("SERVICE_DISABLED"));
cbStartup->SetCurSel(m_nStartmode);
}
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
int i = 0, j = -1;
cbCodepage->ResetContent();
while (gCodepages[i]) {
cbCodepage->AddString(gCodepages[i]);
if (!m_Codepage.IsEmpty()) {
CHAR *buffer = m_Codepage.GetBuffer(CODEPAGE_MAXLEN);
if (_stricmp(buffer, gCodepages[i]) == 0) {
j = i;
}
}
i++;
}
if (j == -1) {
m_Codepage = "default";
}
}
if (m_bReadonly) {
m_bExt3Writable = FALSE;
}
SET_WIN(IDC_EXT3_WRITABLE, !m_bReadonly);
SET_WIN(IDC_START_SERVICE, !m_bStarted);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CServiceManage::OnStartService()
{
// TODO: Add your control notification handler code here
m_bStarted = Ext2StartExt2Fsd();
if (m_bStarted) {
m_srvStatus = _T("Ext2Fsd was just started.");
GetParent()->SetTimer('REFF', 500, NULL);
GetParent()->SetTimer('REFR', 3000, NULL);
} else {
m_srvStatus = _T("Ext2Fsd could NOT be started.");
}
SET_WIN(IDC_START_SERVICE, !m_bStarted);
UpdateData(FALSE);
}

View File

@@ -1,59 +1,59 @@
#if !defined(AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_)
#define AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ServiceManage.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CServiceManage dialog
class CServiceManage : public CDialog
{
// Construction
public:
CServiceManage(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CServiceManage)
enum { IDD = IDD_SERVICE_MANAGE };
CString m_Codepage;
BOOL m_bExt3Writable;
BOOL m_bReadonly;
CString m_srvStatus;
CString m_sPrefix;
CString m_sSuffix;
BOOL m_bAutoMount;
//}}AFX_DATA
ULONG m_nStartmode;
BOOL m_bInited;
BOOL m_bStarted;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CServiceManage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CServiceManage)
afx_msg void OnReadOnly();
afx_msg void OnExt3Writable();
virtual void OnCancel();
virtual void OnOK();
virtual BOOL OnInitDialog();
afx_msg void OnStartService();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_)
#if !defined(AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_)
#define AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ServiceManage.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CServiceManage dialog
class CServiceManage : public CDialog
{
// Construction
public:
CServiceManage(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CServiceManage)
enum { IDD = IDD_SERVICE_MANAGE };
CString m_Codepage;
BOOL m_bExt3Writable;
BOOL m_bReadonly;
CString m_srvStatus;
CString m_sPrefix;
CString m_sSuffix;
BOOL m_bAutoMount;
//}}AFX_DATA
ULONG m_nStartmode;
BOOL m_bInited;
BOOL m_bStarted;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CServiceManage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CServiceManage)
afx_msg void OnReadOnly();
afx_msg void OnExt3Writable();
virtual void OnCancel();
virtual void OnOK();
virtual BOOL OnInitDialog();
afx_msg void OnStartService();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_)

View File

@@ -1,284 +1,284 @@
// ===========================================================================
// File Splash.cpp
// Desc The implementation file for the CSplash class.
// ===========================================================================
#include "stdafx.h"
#include "splash.h"
#include "windowsx.h"
// ===========================================================================
// The following is used for layering support which is used in the
// splash screen for transparency. In VC 6 these are not defined in the headers
// for user32.dll and hence we use mechanisms so that it can work in VC 6.
// We define the flags here and write code so that we can load the function
// from User32.dll explicitely and use it. This code requires Win2k and above
// to work.
// ===========================================================================
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)
(HWND hWnd, COLORREF cr, BYTE bAlpha, DWORD dwFlags);
lpfnSetLayeredWindowAttributes g_pSetLayeredWindowAttributes;
#define WS_EX_LAYERED 0x00080000
// ===========================================================================
// Func ExtWndProc
// Desc The windows procedure that is used to forward messages to the
// CSplash class. CSplash sends the "this" pointer through the
// CreateWindowEx call and the pointer reaches here in the
// WM_CREATE message. We store it here and use it for message
// forwarding.
// ===========================================================================
static LRESULT CALLBACK ExtWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static CSplash * spl = NULL;
if(uMsg == WM_CREATE)
{
spl = (CSplash*)((LPCREATESTRUCT)lParam)->lpCreateParams;
}
if(spl)
return spl->WindowProc(hwnd, uMsg, wParam, lParam);
else
return DefWindowProc (hwnd, uMsg, wParam, lParam);
}
LRESULT CALLBACK CSplash::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// We need to handle on the WM_PAINT message
switch(uMsg)
{
HANDLE_MSG(hwnd, WM_PAINT, OnPaint);
#if 0
// Stop flicker when splash screen appears
case WM_ERASEBKGND:
// stop the default processing of this message
// by returning 1
return (LRESULT)1; // say we handled it
#endif
}
return DefWindowProc (hwnd, uMsg, wParam, lParam) ;
}
void CSplash:: OnPaint(HWND hwnd)
{
if (!m_hBitmap)
return;
// =======================================================================
// Paint the background by BitBlting the bitmap
// =======================================================================
PAINTSTRUCT ps ;
HDC hDC = BeginPaint (hwnd, &ps) ;
RECT rect;
::GetClientRect(m_hwnd, &rect);
HDC hMemDC = ::CreateCompatibleDC(hDC);
HBITMAP hOldBmp = (HBITMAP)::SelectObject(hMemDC, m_hBitmap);
BitBlt(hDC, 0, 0, m_dwWidth, m_dwHeight, hMemDC, 0, 0, SRCCOPY);
::SelectObject(hMemDC, hOldBmp);
::DeleteDC(hMemDC);
EndPaint (hwnd, &ps) ;
}
void CSplash::Init()
{
// =======================================================================
// Initialize the variables
// =======================================================================
m_hwnd = NULL;
m_lpszClassName = TEXT("Ext2 Volume Manager Splash Screen");
m_colTrans = 0;
// =======================================================================
// Keep the function pointer for the SetLayeredWindowAttributes function
// in User32.dll ready
// =======================================================================
HMODULE hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
g_pSetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)
GetProcAddress(hUser32, "SetLayeredWindowAttributes");
}
CSplash::CSplash()
{
Init();
}
CSplash::CSplash(UINT id, COLORREF colTrans)
{
Init();
SetBitmap(id);
SetTransparentColor(colTrans);
}
CSplash::~CSplash()
{
FreeResources();
}
HWND CSplash::RegAndCreateWindow()
{
// =======================================================================
// Register the window with ExtWndProc as the window procedure
// =======================================================================
WNDCLASSEX wndclass;
wndclass.cbSize = sizeof (wndclass);
wndclass.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW;
wndclass.lpfnWndProc = ExtWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = ::GetModuleHandle(NULL);
wndclass.hIcon = NULL;
wndclass.hCursor = ::LoadCursor( NULL, IDC_WAIT );
wndclass.hbrBackground = (HBRUSH)::GetStockObject(LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = m_lpszClassName;
wndclass.hIconSm = NULL;
if(!RegisterClassEx (&wndclass))
return NULL;
// =======================================================================
// Create the window of the application, passing the this pointer so that
// ExtWndProc can use that for message forwarding
// =======================================================================
DWORD nScrWidth = ::GetSystemMetrics(SM_CXFULLSCREEN);
DWORD nScrHeight = ::GetSystemMetrics(SM_CYFULLSCREEN);
int x = (nScrWidth - m_dwWidth) / 2;
int y = (nScrHeight - m_dwHeight) / 2;
m_hwnd = ::CreateWindowEx(WS_EX_TOPMOST|WS_EX_TOOLWINDOW, m_lpszClassName,
TEXT("Ext2 Volume Manager"), WS_POPUP, x, y,
m_dwWidth, m_dwHeight, NULL, NULL, NULL, this);
// =======================================================================
// Display the window
// =======================================================================
if(m_hwnd)
{
MakeTransparent();
ShowWindow (m_hwnd, SW_SHOW) ;
UpdateWindow (m_hwnd);
}
return m_hwnd;
}
int CSplash::DoLoop()
{
// =======================================================================
// Show the window
// =======================================================================
if(!m_hwnd)
ShowSplash();
// =======================================================================
// Get into the modal loop
// =======================================================================
MSG msg ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return (int)msg.wParam ;
}
void CSplash::ShowSplash()
{
CloseSplash();
RegAndCreateWindow();
}
DWORD CSplash::SetBitmap(UINT id)
{
// =======================================================================
// load the bitmap
// =======================================================================
HBITMAP hBitmap = NULL;
hBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(id),
IMAGE_BITMAP, 0, 0, 0);
return SetBitmap(hBitmap);
}
DWORD CSplash::SetBitmap(HBITMAP hBitmap)
{
int nRetValue;
BITMAP csBitmapSize;
// =======================================================================
// Free loaded resource
// =======================================================================
FreeResources();
if (hBitmap)
{
m_hBitmap = hBitmap;
// ===================================================================
// Get bitmap size
// ===================================================================
nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return 0;
}
m_dwWidth = (DWORD)csBitmapSize.bmWidth;
m_dwHeight = (DWORD)csBitmapSize.bmHeight;
}
return 1;
}
void CSplash::FreeResources()
{
if (m_hBitmap)
::DeleteObject (m_hBitmap);
m_hBitmap = NULL;
}
int CSplash::CloseSplash()
{
if(m_hwnd)
{
DestroyWindow(m_hwnd);
m_hwnd = 0;
UnregisterClass(m_lpszClassName, ::GetModuleHandle(NULL));
return 1;
}
return 0;
}
bool CSplash::SetTransparentColor(COLORREF col)
{
m_colTrans = col;
return MakeTransparent();
}
bool CSplash::MakeTransparent()
{
// =======================================================================
// Set the layered window style and make the required color transparent
// =======================================================================
if(m_hwnd && g_pSetLayeredWindowAttributes && m_colTrans )
{
// set layered style for the window
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
// call it with 0 alpha for the given color
g_pSetLayeredWindowAttributes(m_hwnd, m_colTrans, 0, LWA_COLORKEY);
}
return TRUE;
}
// ===========================================================================
// File Splash.cpp
// Desc The implementation file for the CSplash class.
// ===========================================================================
#include "stdafx.h"
#include "splash.h"
#include "windowsx.h"
// ===========================================================================
// The following is used for layering support which is used in the
// splash screen for transparency. In VC 6 these are not defined in the headers
// for user32.dll and hence we use mechanisms so that it can work in VC 6.
// We define the flags here and write code so that we can load the function
// from User32.dll explicitely and use it. This code requires Win2k and above
// to work.
// ===========================================================================
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)
(HWND hWnd, COLORREF cr, BYTE bAlpha, DWORD dwFlags);
lpfnSetLayeredWindowAttributes g_pSetLayeredWindowAttributes;
#define WS_EX_LAYERED 0x00080000
// ===========================================================================
// Func ExtWndProc
// Desc The windows procedure that is used to forward messages to the
// CSplash class. CSplash sends the "this" pointer through the
// CreateWindowEx call and the pointer reaches here in the
// WM_CREATE message. We store it here and use it for message
// forwarding.
// ===========================================================================
static LRESULT CALLBACK ExtWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static CSplash * spl = NULL;
if(uMsg == WM_CREATE)
{
spl = (CSplash*)((LPCREATESTRUCT)lParam)->lpCreateParams;
}
if(spl)
return spl->WindowProc(hwnd, uMsg, wParam, lParam);
else
return DefWindowProc (hwnd, uMsg, wParam, lParam);
}
LRESULT CALLBACK CSplash::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// We need to handle on the WM_PAINT message
switch(uMsg)
{
HANDLE_MSG(hwnd, WM_PAINT, OnPaint);
#if 0
// Stop flicker when splash screen appears
case WM_ERASEBKGND:
// stop the default processing of this message
// by returning 1
return (LRESULT)1; // say we handled it
#endif
}
return DefWindowProc (hwnd, uMsg, wParam, lParam) ;
}
void CSplash:: OnPaint(HWND hwnd)
{
if (!m_hBitmap)
return;
// =======================================================================
// Paint the background by BitBlting the bitmap
// =======================================================================
PAINTSTRUCT ps ;
HDC hDC = BeginPaint (hwnd, &ps) ;
RECT rect;
::GetClientRect(m_hwnd, &rect);
HDC hMemDC = ::CreateCompatibleDC(hDC);
HBITMAP hOldBmp = (HBITMAP)::SelectObject(hMemDC, m_hBitmap);
BitBlt(hDC, 0, 0, m_dwWidth, m_dwHeight, hMemDC, 0, 0, SRCCOPY);
::SelectObject(hMemDC, hOldBmp);
::DeleteDC(hMemDC);
EndPaint (hwnd, &ps) ;
}
void CSplash::Init()
{
// =======================================================================
// Initialize the variables
// =======================================================================
m_hwnd = NULL;
m_lpszClassName = TEXT("Ext2 Volume Manager Splash Screen");
m_colTrans = 0;
// =======================================================================
// Keep the function pointer for the SetLayeredWindowAttributes function
// in User32.dll ready
// =======================================================================
HMODULE hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
g_pSetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)
GetProcAddress(hUser32, "SetLayeredWindowAttributes");
}
CSplash::CSplash()
{
Init();
}
CSplash::CSplash(UINT id, COLORREF colTrans)
{
Init();
SetBitmap(id);
SetTransparentColor(colTrans);
}
CSplash::~CSplash()
{
FreeResources();
}
HWND CSplash::RegAndCreateWindow()
{
// =======================================================================
// Register the window with ExtWndProc as the window procedure
// =======================================================================
WNDCLASSEX wndclass;
wndclass.cbSize = sizeof (wndclass);
wndclass.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW;
wndclass.lpfnWndProc = ExtWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = ::GetModuleHandle(NULL);
wndclass.hIcon = NULL;
wndclass.hCursor = ::LoadCursor( NULL, IDC_WAIT );
wndclass.hbrBackground = (HBRUSH)::GetStockObject(LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = m_lpszClassName;
wndclass.hIconSm = NULL;
if(!RegisterClassEx (&wndclass))
return NULL;
// =======================================================================
// Create the window of the application, passing the this pointer so that
// ExtWndProc can use that for message forwarding
// =======================================================================
DWORD nScrWidth = ::GetSystemMetrics(SM_CXFULLSCREEN);
DWORD nScrHeight = ::GetSystemMetrics(SM_CYFULLSCREEN);
int x = (nScrWidth - m_dwWidth) / 2;
int y = (nScrHeight - m_dwHeight) / 2;
m_hwnd = ::CreateWindowEx(WS_EX_TOPMOST|WS_EX_TOOLWINDOW, m_lpszClassName,
TEXT("Ext2 Volume Manager"), WS_POPUP, x, y,
m_dwWidth, m_dwHeight, NULL, NULL, NULL, this);
// =======================================================================
// Display the window
// =======================================================================
if(m_hwnd)
{
MakeTransparent();
ShowWindow (m_hwnd, SW_SHOW) ;
UpdateWindow (m_hwnd);
}
return m_hwnd;
}
int CSplash::DoLoop()
{
// =======================================================================
// Show the window
// =======================================================================
if(!m_hwnd)
ShowSplash();
// =======================================================================
// Get into the modal loop
// =======================================================================
MSG msg ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return (int)msg.wParam ;
}
void CSplash::ShowSplash()
{
CloseSplash();
RegAndCreateWindow();
}
DWORD CSplash::SetBitmap(UINT id)
{
// =======================================================================
// load the bitmap
// =======================================================================
HBITMAP hBitmap = NULL;
hBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(id),
IMAGE_BITMAP, 0, 0, 0);
return SetBitmap(hBitmap);
}
DWORD CSplash::SetBitmap(HBITMAP hBitmap)
{
int nRetValue;
BITMAP csBitmapSize;
// =======================================================================
// Free loaded resource
// =======================================================================
FreeResources();
if (hBitmap)
{
m_hBitmap = hBitmap;
// ===================================================================
// Get bitmap size
// ===================================================================
nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return 0;
}
m_dwWidth = (DWORD)csBitmapSize.bmWidth;
m_dwHeight = (DWORD)csBitmapSize.bmHeight;
}
return 1;
}
void CSplash::FreeResources()
{
if (m_hBitmap)
::DeleteObject (m_hBitmap);
m_hBitmap = NULL;
}
int CSplash::CloseSplash()
{
if(m_hwnd)
{
DestroyWindow(m_hwnd);
m_hwnd = 0;
UnregisterClass(m_lpszClassName, ::GetModuleHandle(NULL));
return 1;
}
return 0;
}
bool CSplash::SetTransparentColor(COLORREF col)
{
m_colTrans = col;
return MakeTransparent();
}
bool CSplash::MakeTransparent()
{
// =======================================================================
// Set the layered window style and make the required color transparent
// =======================================================================
if(m_hwnd && g_pSetLayeredWindowAttributes && m_colTrans )
{
// set layered style for the window
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
// call it with 0 alpha for the given color
g_pSetLayeredWindowAttributes(m_hwnd, m_colTrans, 0, LWA_COLORKEY);
}
return TRUE;
}

View File

@@ -1,98 +1,98 @@
// ===========================================================================
// File Splash.h
// Desc The interface of the CSplash class
// ===========================================================================
#ifndef _ABHI_SPLASH_H_
#define _ABHI_SPLASH_H_
#include "windows.h"
// ===========================================================================
// Class CSplash
// Desc Use it for displaying splash screen for applications
// Works only on Win2000 , WinXP and later versions of Windows
// ===========================================================================
class CSplash
{
public:
// =======================================================================
// Func CSplash
// Desc Default constructor
// =======================================================================
CSplash();
// =======================================================================
// Func CSplash
// Desc Constructor
// Arg Path of the Bitmap that will be show on the splash screen
// Arg The color on the bitmap that will be made transparent
// =======================================================================
CSplash(UINT id, COLORREF colTrans);
// =======================================================================
// Func ~CSplash
// Desc Desctructor
// =======================================================================
virtual ~CSplash();
// =======================================================================
// Func ShowSplash
// Desc Launches the non-modal splash screen
// Ret void
// =======================================================================
void ShowSplash();
// =======================================================================
// Func DoLoop
// Desc Launched the splash screen as a modal window. Not completely
// implemented.
// Ret int
// =======================================================================
int DoLoop();
// =======================================================================
// Func CloseSplash
// Desc Closes the splash screen started with ShowSplash
// Ret int
// =======================================================================
int CloseSplash();
// =======================================================================
// Func SetBitmap
// Desc Call this with the path of the bitmap. Not required to be used
// when the construcutor with the image path has been used.
// Ret 1 if succesfull
// Arg Either the file path or the handle to an already loaded bitmap
// =======================================================================
DWORD SetBitmap(UINT id);
DWORD SetBitmap(HBITMAP hBitmap);
// =======================================================================
// Func SetTransparentColor
// Desc This is used to make one of the color transparent
// Ret 1 if succesfull
// Arg The colors RGB value. Not required if the color is specified
// using the constructor
// =======================================================================
bool SetTransparentColor(COLORREF col);
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
HWND m_hwnd;
private:
void Init();
void OnPaint(HWND hwnd);
bool MakeTransparent();
HWND RegAndCreateWindow();
COLORREF m_colTrans;
DWORD m_dwWidth;
DWORD m_dwHeight;
void FreeResources();
HBITMAP m_hBitmap;
LPCTSTR m_lpszClassName;
};
#endif //_ABHI_SPLASH_H_
// ===========================================================================
// File Splash.h
// Desc The interface of the CSplash class
// ===========================================================================
#ifndef _ABHI_SPLASH_H_
#define _ABHI_SPLASH_H_
#include "windows.h"
// ===========================================================================
// Class CSplash
// Desc Use it for displaying splash screen for applications
// Works only on Win2000 , WinXP and later versions of Windows
// ===========================================================================
class CSplash
{
public:
// =======================================================================
// Func CSplash
// Desc Default constructor
// =======================================================================
CSplash();
// =======================================================================
// Func CSplash
// Desc Constructor
// Arg Path of the Bitmap that will be show on the splash screen
// Arg The color on the bitmap that will be made transparent
// =======================================================================
CSplash(UINT id, COLORREF colTrans);
// =======================================================================
// Func ~CSplash
// Desc Desctructor
// =======================================================================
virtual ~CSplash();
// =======================================================================
// Func ShowSplash
// Desc Launches the non-modal splash screen
// Ret void
// =======================================================================
void ShowSplash();
// =======================================================================
// Func DoLoop
// Desc Launched the splash screen as a modal window. Not completely
// implemented.
// Ret int
// =======================================================================
int DoLoop();
// =======================================================================
// Func CloseSplash
// Desc Closes the splash screen started with ShowSplash
// Ret int
// =======================================================================
int CloseSplash();
// =======================================================================
// Func SetBitmap
// Desc Call this with the path of the bitmap. Not required to be used
// when the construcutor with the image path has been used.
// Ret 1 if succesfull
// Arg Either the file path or the handle to an already loaded bitmap
// =======================================================================
DWORD SetBitmap(UINT id);
DWORD SetBitmap(HBITMAP hBitmap);
// =======================================================================
// Func SetTransparentColor
// Desc This is used to make one of the color transparent
// Ret 1 if succesfull
// Arg The colors RGB value. Not required if the color is specified
// using the constructor
// =======================================================================
bool SetTransparentColor(COLORREF col);
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
HWND m_hwnd;
private:
void Init();
void OnPaint(HWND hwnd);
bool MakeTransparent();
HWND RegAndCreateWindow();
COLORREF m_colTrans;
DWORD m_dwWidth;
DWORD m_dwHeight;
void FreeResources();
HBITMAP m_hBitmap;
LPCTSTR m_lpszClassName;
};
#endif //_ABHI_SPLASH_H_

View File

@@ -1,8 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// Ext2Mgr.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// stdafx.cpp : source file that includes just the standard includes
// Ext2Mgr.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -1,60 +1,60 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_)
#define AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxtempl.h>
#include "AfxPriv.h"
#include "enumDisk.h"
#include <process.h>
#include "resource.h"
#define EXT2_DIALOG_MAGIC 'EXTM'
#define SET_TEXT(id, s) ((CWnd *)GetDlgItem(id))->SetWindowText(s)
#define SET_WIN(id, t) ((CWnd *)GetDlgItem(id))->EnableWindow(t)
#define SET_CHECK(ID, V) ((CButton *)GetDlgItem(ID))->SetCheck(V)
//--------------our own message-----------------
#define WM_TRAY_ICON_NOTIFY WM_USER + 0x1001
#define WM_TERMINATE_PROGRAM WM_USER + 0x1002
#define WM_GROUP_BOX_UPDATED WM_USER + 0x1003
#define WM_MOUNTPOINT_NOTIFY WM_USER + 0x1004
//----------------------------------------------
extern CHAR *IrpMjStrings[];
extern CHAR *PerfStatStrings[];
/*
* Ext2Pipe.cpp
*/
BOOL Ext2DefineDosDevice(DWORD flags, CHAR *dos, CHAR *symlink);
DWORD Ext2QueryDrive(CHAR drive, CHAR *symlink);
BOOL Ext2StartPipeSrv();
VOID Ext2StopPipeSrv();
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_)
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_)
#define AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxtempl.h>
#include "AfxPriv.h"
#include "enumDisk.h"
#include <process.h>
#include "resource.h"
#define EXT2_DIALOG_MAGIC 'EXTM'
#define SET_TEXT(id, s) ((CWnd *)GetDlgItem(id))->SetWindowText(s)
#define SET_WIN(id, t) ((CWnd *)GetDlgItem(id))->EnableWindow(t)
#define SET_CHECK(ID, V) ((CButton *)GetDlgItem(ID))->SetCheck(V)
//--------------our own message-----------------
#define WM_TRAY_ICON_NOTIFY WM_USER + 0x1001
#define WM_TERMINATE_PROGRAM WM_USER + 0x1002
#define WM_GROUP_BOX_UPDATED WM_USER + 0x1003
#define WM_MOUNTPOINT_NOTIFY WM_USER + 0x1004
//----------------------------------------------
extern CHAR *IrpMjStrings[];
extern CHAR *PerfStatStrings[];
/*
* Ext2Pipe.cpp
*/
BOOL Ext2DefineDosDevice(DWORD flags, CHAR *dos, CHAR *symlink);
DWORD Ext2QueryDrive(CHAR drive, CHAR *symlink);
BOOL Ext2StartPipeSrv();
VOID Ext2StopPipeSrv();
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_)

View File

@@ -1,267 +1,267 @@
/////////////////////////////////////////////////////////////////////////////
// SystemTray.cpp : implementation file
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SysTray.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(CSystemTray, CObject)
/////////////////////////////////////////////////////////////////////////////
// CSystemTray construction/creation/destruction
CSystemTray::CSystemTray()
{
ZeroMemory(&m_tnd, sizeof(m_tnd));
m_bEnabled = FALSE;
m_bHidden = FALSE;
}
CSystemTray::CSystemTray(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szToolTip,
HICON icon, UINT uID)
{
Create(pWnd, uCallbackMessage, szToolTip, icon, uID);
m_bHidden = FALSE;
}
BOOL CSystemTray::Create(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szToolTip,
HICON icon, UINT uID)
{
// this is only for Windows 95 (or higher)
m_bEnabled = ( GetVersion() & 0xff );
ASSERT(m_bEnabled >= 4);
if (!m_bEnabled)
return FALSE;
//Make sure Notification window is valid
m_bEnabled = (pWnd && ::IsWindow(pWnd->GetSafeHwnd()));
if (!m_bEnabled) return FALSE;
//Make sure we avoid conflict with other messages
ASSERT(uCallbackMessage >= WM_USER);
//Tray only supports tooltip text up to 64 characters
ASSERT(_tcslen(szToolTip) <= 64);
// load up the NOTIFYICONDATA structure
m_tnd.cbSize = sizeof(NOTIFYICONDATA);
m_tnd.hWnd = pWnd->GetSafeHwnd();
m_tnd.uID = uID ^ GetCurrentProcessId();
m_tnd.hIcon = icon;
m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
m_tnd.uCallbackMessage = uCallbackMessage;
strcpy (m_tnd.szTip, szToolTip);
// Set the tray icon
m_bEnabled = Shell_NotifyIcon(NIM_ADD, &m_tnd);
ASSERT(m_bEnabled);
return m_bEnabled;
}
CSystemTray::~CSystemTray()
{
RemoveIcon();
}
/////////////////////////////////////////////////////////////////////////////
// CSystemTray icon manipulation
void CSystemTray::MoveToRight()
{
HideIcon();
ShowIcon();
}
void CSystemTray::RemoveIcon()
{
if (!m_bEnabled) return;
m_tnd.uFlags = 0;
Shell_NotifyIcon(NIM_DELETE, &m_tnd);
m_bEnabled = FALSE;
}
void CSystemTray::HideIcon()
{
if (m_bEnabled && !m_bHidden) {
m_tnd.uFlags = NIF_ICON;
Shell_NotifyIcon (NIM_DELETE, &m_tnd);
m_bHidden = TRUE;
}
}
void CSystemTray::ShowIcon()
{
if (m_bEnabled && m_bHidden) {
m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
Shell_NotifyIcon(NIM_ADD, &m_tnd);
m_bHidden = FALSE;
}
}
BOOL CSystemTray::SetIcon(HICON hIcon)
{
if (!m_bEnabled) return FALSE;
m_tnd.uFlags = NIF_ICON;
m_tnd.hIcon = hIcon;
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}
BOOL CSystemTray::SetIcon(LPCTSTR lpszIconName)
{
HICON hIcon = AfxGetApp()->LoadIcon(lpszIconName);
return SetIcon(hIcon);
}
BOOL CSystemTray::SetIcon(UINT nIDResource)
{
HICON hIcon = AfxGetApp()->LoadIcon(nIDResource);
return SetIcon(hIcon);
}
BOOL CSystemTray::SetStandardIcon(LPCTSTR lpIconName)
{
HICON hIcon = LoadIcon(NULL, lpIconName);
return SetIcon(hIcon);
}
BOOL CSystemTray::SetStandardIcon(UINT nIDResource)
{
HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCE(nIDResource));
return SetIcon(hIcon);
}
HICON CSystemTray::GetIcon() const
{
HICON hIcon = NULL;
if (m_bEnabled)
hIcon = m_tnd.hIcon;
return hIcon;
}
/////////////////////////////////////////////////////////////////////////////
// CSystemTray tooltip text manipulation
BOOL CSystemTray::SetTooltipText(LPCTSTR pszTip)
{
if (!m_bEnabled) return FALSE;
m_tnd.uFlags = NIF_TIP;
_tcscpy(m_tnd.szTip, pszTip);
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}
BOOL CSystemTray::SetTooltipText(UINT nID)
{
CString strText;
strText.LoadString(nID);
return SetTooltipText(strText);
}
CString CSystemTray::GetTooltipText() const
{
CString strText;
if (m_bEnabled)
strText = m_tnd.szTip;
return strText;
}
/////////////////////////////////////////////////////////////////////////////
// CSystemTray notification window stuff
BOOL CSystemTray::SetNotificationWnd(CWnd* pWnd)
{
if (!m_bEnabled) return FALSE;
//Make sure Notification window is valid
ASSERT(pWnd && ::IsWindow(pWnd->GetSafeHwnd()));
m_tnd.hWnd = pWnd->GetSafeHwnd();
m_tnd.uFlags = 0;
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}
CWnd* CSystemTray::GetNotificationWnd() const
{
return CWnd::FromHandle(m_tnd.hWnd);
}
/////////////////////////////////////////////////////////////////////////////
// CSystemTray implentation of OnTrayNotification
LRESULT CSystemTray::OnTrayNotification(WPARAM wParam, LPARAM lParam)
{
//Return quickly if its not for this tray icon
if (wParam != m_tnd.uID)
return 0L;
CMenu menu, *pSubMenu;
// Clicking with right button brings up a context menu
switch(LOWORD(lParam))
{
case WM_RBUTTONUP:
{
if (!menu.LoadMenu(m_tnd.uID ^ GetCurrentProcessId()))
return 0;
pSubMenu = menu.GetSubMenu(0);
if (!pSubMenu)
return 0;
// Make first menu item the default (bold font)
::SetMenuDefaultItem(pSubMenu->m_hMenu, 0, TRUE);
//Display and track the popup menu
CPoint pos;
GetCursorPos(&pos);
::SetForegroundWindow(m_tnd.hWnd);
::TrackPopupMenu(pSubMenu->m_hMenu, 0, pos.x, pos.y, 0, m_tnd.hWnd, NULL);
// BUGFIX: See "PRB: Menus for Notification Icons Don't Work Correctly"
::PostMessage(m_tnd.hWnd, WM_NULL, 0, 0);
menu.DestroyMenu();
}
break;
case WM_LBUTTONDBLCLK:
{
if (!menu.LoadMenu(m_tnd.uID ^ GetCurrentProcessId()))
return 0;
pSubMenu = menu.GetSubMenu(0);
if (!pSubMenu)
return 0;
// double click received, the default action is to execute first menu item
::SetForegroundWindow(m_tnd.hWnd);
::SendMessage(m_tnd.hWnd, WM_COMMAND, pSubMenu->GetMenuItemID(0), 0);
menu.DestroyMenu();
}
break;
case WM_LBUTTONUP:
::SetForegroundWindow(m_tnd.hWnd);
break;
}
return 1;
/////////////////////////////////////////////////////////////////////////////
// SystemTray.cpp : implementation file
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SysTray.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(CSystemTray, CObject)
/////////////////////////////////////////////////////////////////////////////
// CSystemTray construction/creation/destruction
CSystemTray::CSystemTray()
{
ZeroMemory(&m_tnd, sizeof(m_tnd));
m_bEnabled = FALSE;
m_bHidden = FALSE;
}
CSystemTray::CSystemTray(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szToolTip,
HICON icon, UINT uID)
{
Create(pWnd, uCallbackMessage, szToolTip, icon, uID);
m_bHidden = FALSE;
}
BOOL CSystemTray::Create(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szToolTip,
HICON icon, UINT uID)
{
// this is only for Windows 95 (or higher)
m_bEnabled = ( GetVersion() & 0xff );
ASSERT(m_bEnabled >= 4);
if (!m_bEnabled)
return FALSE;
//Make sure Notification window is valid
m_bEnabled = (pWnd && ::IsWindow(pWnd->GetSafeHwnd()));
if (!m_bEnabled) return FALSE;
//Make sure we avoid conflict with other messages
ASSERT(uCallbackMessage >= WM_USER);
//Tray only supports tooltip text up to 64 characters
ASSERT(_tcslen(szToolTip) <= 64);
// load up the NOTIFYICONDATA structure
m_tnd.cbSize = sizeof(NOTIFYICONDATA);
m_tnd.hWnd = pWnd->GetSafeHwnd();
m_tnd.uID = uID ^ GetCurrentProcessId();
m_tnd.hIcon = icon;
m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
m_tnd.uCallbackMessage = uCallbackMessage;
strcpy (m_tnd.szTip, szToolTip);
// Set the tray icon
m_bEnabled = Shell_NotifyIcon(NIM_ADD, &m_tnd);
ASSERT(m_bEnabled);
return m_bEnabled;
}
CSystemTray::~CSystemTray()
{
RemoveIcon();
}
/////////////////////////////////////////////////////////////////////////////
// CSystemTray icon manipulation
void CSystemTray::MoveToRight()
{
HideIcon();
ShowIcon();
}
void CSystemTray::RemoveIcon()
{
if (!m_bEnabled) return;
m_tnd.uFlags = 0;
Shell_NotifyIcon(NIM_DELETE, &m_tnd);
m_bEnabled = FALSE;
}
void CSystemTray::HideIcon()
{
if (m_bEnabled && !m_bHidden) {
m_tnd.uFlags = NIF_ICON;
Shell_NotifyIcon (NIM_DELETE, &m_tnd);
m_bHidden = TRUE;
}
}
void CSystemTray::ShowIcon()
{
if (m_bEnabled && m_bHidden) {
m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
Shell_NotifyIcon(NIM_ADD, &m_tnd);
m_bHidden = FALSE;
}
}
BOOL CSystemTray::SetIcon(HICON hIcon)
{
if (!m_bEnabled) return FALSE;
m_tnd.uFlags = NIF_ICON;
m_tnd.hIcon = hIcon;
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}
BOOL CSystemTray::SetIcon(LPCTSTR lpszIconName)
{
HICON hIcon = AfxGetApp()->LoadIcon(lpszIconName);
return SetIcon(hIcon);
}
BOOL CSystemTray::SetIcon(UINT nIDResource)
{
HICON hIcon = AfxGetApp()->LoadIcon(nIDResource);
return SetIcon(hIcon);
}
BOOL CSystemTray::SetStandardIcon(LPCTSTR lpIconName)
{
HICON hIcon = LoadIcon(NULL, lpIconName);
return SetIcon(hIcon);
}
BOOL CSystemTray::SetStandardIcon(UINT nIDResource)
{
HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCE(nIDResource));
return SetIcon(hIcon);
}
HICON CSystemTray::GetIcon() const
{
HICON hIcon = NULL;
if (m_bEnabled)
hIcon = m_tnd.hIcon;
return hIcon;
}
/////////////////////////////////////////////////////////////////////////////
// CSystemTray tooltip text manipulation
BOOL CSystemTray::SetTooltipText(LPCTSTR pszTip)
{
if (!m_bEnabled) return FALSE;
m_tnd.uFlags = NIF_TIP;
_tcscpy(m_tnd.szTip, pszTip);
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}
BOOL CSystemTray::SetTooltipText(UINT nID)
{
CString strText;
strText.LoadString(nID);
return SetTooltipText(strText);
}
CString CSystemTray::GetTooltipText() const
{
CString strText;
if (m_bEnabled)
strText = m_tnd.szTip;
return strText;
}
/////////////////////////////////////////////////////////////////////////////
// CSystemTray notification window stuff
BOOL CSystemTray::SetNotificationWnd(CWnd* pWnd)
{
if (!m_bEnabled) return FALSE;
//Make sure Notification window is valid
ASSERT(pWnd && ::IsWindow(pWnd->GetSafeHwnd()));
m_tnd.hWnd = pWnd->GetSafeHwnd();
m_tnd.uFlags = 0;
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}
CWnd* CSystemTray::GetNotificationWnd() const
{
return CWnd::FromHandle(m_tnd.hWnd);
}
/////////////////////////////////////////////////////////////////////////////
// CSystemTray implentation of OnTrayNotification
LRESULT CSystemTray::OnTrayNotification(WPARAM wParam, LPARAM lParam)
{
//Return quickly if its not for this tray icon
if (wParam != m_tnd.uID)
return 0L;
CMenu menu, *pSubMenu;
// Clicking with right button brings up a context menu
switch(LOWORD(lParam))
{
case WM_RBUTTONUP:
{
if (!menu.LoadMenu(m_tnd.uID ^ GetCurrentProcessId()))
return 0;
pSubMenu = menu.GetSubMenu(0);
if (!pSubMenu)
return 0;
// Make first menu item the default (bold font)
::SetMenuDefaultItem(pSubMenu->m_hMenu, 0, TRUE);
//Display and track the popup menu
CPoint pos;
GetCursorPos(&pos);
::SetForegroundWindow(m_tnd.hWnd);
::TrackPopupMenu(pSubMenu->m_hMenu, 0, pos.x, pos.y, 0, m_tnd.hWnd, NULL);
// BUGFIX: See "PRB: Menus for Notification Icons Don't Work Correctly"
::PostMessage(m_tnd.hWnd, WM_NULL, 0, 0);
menu.DestroyMenu();
}
break;
case WM_LBUTTONDBLCLK:
{
if (!menu.LoadMenu(m_tnd.uID ^ GetCurrentProcessId()))
return 0;
pSubMenu = menu.GetSubMenu(0);
if (!pSubMenu)
return 0;
// double click received, the default action is to execute first menu item
::SetForegroundWindow(m_tnd.hWnd);
::SendMessage(m_tnd.hWnd, WM_COMMAND, pSubMenu->GetMenuItemID(0), 0);
menu.DestroyMenu();
}
break;
case WM_LBUTTONUP:
::SetForegroundWindow(m_tnd.hWnd);
break;
}
return 1;
}

View File

@@ -1,89 +1,89 @@
/////////////////////////////////////////////////////////////////////////////
// SystemTray.h : header file
//
// Written by Chris Maunder (Chris.Maunder@cbr.clw.csiro.au)
// Copyright (c) 1998.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name is included. If
// the source code in this file is used in any commercial application
// then acknowledgement must be made to the author of this file
// (in whatever form you wish).
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability if it causes any damage to your
// computer, causes your pet cat to fall ill, increases baldness or
// makes you car start emitting strange noises when you start it up.
//
// Expect bugs.
//
// Please use and enjoy. Please let me know of any bugs/mods/improvements
// that you have found/implemented and I will fix/incorporate them into this
// file.
#ifndef _INCLUDED_SYSTEMTRAY_H_
#define _INCLUDED_SYSTEMTRAY_H_
/////////////////////////////////////////////////////////////////////////////
// CSystemTray window
class CSystemTray : public CObject
{
// Construction/destruction
public:
CSystemTray();
CSystemTray(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szTip, HICON icon, UINT uID);
virtual ~CSystemTray();
// Operations
public:
BOOL Enabled() { return m_bEnabled; }
BOOL Visible() { return !m_bHidden; }
//Create the tray icon
int Create(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szTip, HICON icon, UINT uID);
//Change or retrieve the Tooltip text
BOOL SetTooltipText(LPCTSTR pszTooltipText);
BOOL SetTooltipText(UINT nID);
CString GetTooltipText() const;
//Change or retrieve the icon displayed
BOOL SetIcon(HICON hIcon);
BOOL SetIcon(LPCTSTR lpIconName);
BOOL SetIcon(UINT nIDResource);
BOOL SetStandardIcon(LPCTSTR lpIconName);
BOOL SetStandardIcon(UINT nIDResource);
HICON GetIcon() const;
void HideIcon();
void ShowIcon();
void RemoveIcon();
void MoveToRight();
//Change or retrieve the window to send notification messages to
BOOL SetNotificationWnd(CWnd* pNotifyWnd);
CWnd* GetNotificationWnd() const;
//Default handler for tray notification message
virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSystemTray)
//}}AFX_VIRTUAL
// Implementation
protected:
BOOL m_bEnabled; // does O/S support tray icon?
BOOL m_bHidden; // Has the icon been hidden?
NOTIFYICONDATA m_tnd;
DECLARE_DYNAMIC(CSystemTray)
};
#endif
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// SystemTray.h : header file
//
// Written by Chris Maunder (Chris.Maunder@cbr.clw.csiro.au)
// Copyright (c) 1998.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name is included. If
// the source code in this file is used in any commercial application
// then acknowledgement must be made to the author of this file
// (in whatever form you wish).
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability if it causes any damage to your
// computer, causes your pet cat to fall ill, increases baldness or
// makes you car start emitting strange noises when you start it up.
//
// Expect bugs.
//
// Please use and enjoy. Please let me know of any bugs/mods/improvements
// that you have found/implemented and I will fix/incorporate them into this
// file.
#ifndef _INCLUDED_SYSTEMTRAY_H_
#define _INCLUDED_SYSTEMTRAY_H_
/////////////////////////////////////////////////////////////////////////////
// CSystemTray window
class CSystemTray : public CObject
{
// Construction/destruction
public:
CSystemTray();
CSystemTray(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szTip, HICON icon, UINT uID);
virtual ~CSystemTray();
// Operations
public:
BOOL Enabled() { return m_bEnabled; }
BOOL Visible() { return !m_bHidden; }
//Create the tray icon
int Create(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szTip, HICON icon, UINT uID);
//Change or retrieve the Tooltip text
BOOL SetTooltipText(LPCTSTR pszTooltipText);
BOOL SetTooltipText(UINT nID);
CString GetTooltipText() const;
//Change or retrieve the icon displayed
BOOL SetIcon(HICON hIcon);
BOOL SetIcon(LPCTSTR lpIconName);
BOOL SetIcon(UINT nIDResource);
BOOL SetStandardIcon(LPCTSTR lpIconName);
BOOL SetStandardIcon(UINT nIDResource);
HICON GetIcon() const;
void HideIcon();
void ShowIcon();
void RemoveIcon();
void MoveToRight();
//Change or retrieve the window to send notification messages to
BOOL SetNotificationWnd(CWnd* pNotifyWnd);
CWnd* GetNotificationWnd() const;
//Default handler for tray notification message
virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSystemTray)
//}}AFX_VIRTUAL
// Implementation
protected:
BOOL m_bEnabled; // does O/S support tray icon?
BOOL m_bHidden; // Has the icon been hidden?
NOTIFYICONDATA m_tnd;
DECLARE_DYNAMIC(CSystemTray)
};
#endif
/////////////////////////////////////////////////////////////////////////////

View File

@@ -1,357 +1,357 @@
// TreeList.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "TreeList.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTreeList
CTreeList::CTreeList()
{
m_SelectionRect = CRect(0,0,0,0);
m_SelectionFlag = FALSE;
m_Point = CPoint(0, 0);
m_PrevItem = -1;
m_Rows = 0;
m_Columns = 1;
m_hBitmap = NULL;
m_hMemDC = NULL;
m_hOldBmp = NULL;
m_bFocus = FALSE;
}
CTreeList::~CTreeList()
{
if (m_hBitmap) {
if (m_hMemDC) {
::SelectObject(m_hMemDC, m_hOldBmp);
::DeleteDC(m_hMemDC);
}
::DeleteObject (m_hBitmap);
m_hBitmap = NULL;
}
}
BEGIN_MESSAGE_MAP(CTreeList, CListCtrl)
//{{AFX_MSG_MAP(CTreeList)
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
ON_NOTIFY_REFLECT(NM_KILLFOCUS, OnKillfocus)
ON_NOTIFY_REFLECT(NM_SETFOCUS, OnSetfocus)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SETFONT, OnSetFont)
ON_WM_MEASUREITEM_REFLECT()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTreeList message handlers
void CTreeList::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Point = point;
m_SelectionFlag = FALSE;
Invalidate();
CListCtrl::OnLButtonDown(nFlags, point);
}
BOOL CTreeList::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
cs.style |= LVS_REPORT | LVS_OWNERDRAWFIXED| WS_BORDER;
return CListCtrl::PreCreateWindow(cs);
}
LRESULT CTreeList::OnSetFont(WPARAM wParam, LPARAM)
{
LRESULT res = Default();
CRect rc;
GetWindowRect( &rc );
WINDOWPOS wp;
wp.hwnd = m_hWnd;
wp.cx = rc.Width();
wp.cy = rc.Height();
wp.flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER;
SendMessage( WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp );
return res;
}
void CTreeList::MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct )
{
lpMeasureItemStruct->itemHeight = 16;
}
void CTreeList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
PULONG pMagic = (PULONG) lpDrawItemStruct->itemData;
TCHAR lpBuffer[256];
LV_ITEM lvi;
LV_COLUMN lvc, lvcprev ;
memset(lpBuffer, 0, 256);
lvi.mask = LVIF_TEXT | LVIF_PARAM ;
lvi.iItem = lpDrawItemStruct->itemID ;
lvi.iSubItem = 0;
lvi.pszText = lpBuffer ;
lvi.cchTextMax = sizeof(lpBuffer);
GetItem(&lvi);
::ZeroMemory(&lvc, sizeof(lvc));
::ZeroMemory(&lvcprev, sizeof(lvcprev));
lvc.mask = LVCF_WIDTH |LVCF_FMT;
lvcprev.mask = LVCF_WIDTH | LVCF_FMT;
CDC* pDC;
pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
int nCol;
CRect rcText = lpDrawItemStruct->rcItem;
CFont Fnt, *pOldFont = NULL;
LOGFONT lf;
int cyPixels = pDC->GetDeviceCaps(LOGPIXELSY);
memset(&lf, 0, sizeof(LOGFONT));
if (pMagic == NULL) {
return;
}
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
if (IsVistaOrAbove()) {
lstrcpy(lf.lfFaceName, "MS Sans Serif"); /*Courier New*/
lf.lfHeight = -MulDiv(8, cyPixels, 72);
lf.lfWeight = TRUE;
} else {
lstrcpy(lf.lfFaceName, "Arial Black"); /*Courier New*/
lf.lfHeight = -MulDiv(8, cyPixels, 72);
lf.lfWeight = TRUE;
}
} else {
lstrcpy(lf.lfFaceName, "MS Sans Serif");
lf.lfHeight = -MulDiv(8, cyPixels, 72);
}
Fnt.CreateFontIndirect(&lf);
pOldFont = (CFont *) pDC->SelectObject(&Fnt);
/* loading bitmap */
if (m_hBitmap == NULL) {
m_hBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDB_LINE_SEP),
IMAGE_BITMAP, 0, 0, 0);
if (m_hBitmap) {
m_hMemDC = ::CreateCompatibleDC(this->GetDC()->m_hDC);
m_hOldBmp = (HBITMAP)::SelectObject(m_hMemDC, m_hBitmap);
}
}
if (TRUE) {
if (!m_SelectionFlag) {
for (nCol=0; GetColumn(nCol, &lvc); nCol++) {
if (nCol > 0) {
GetSubItemRect(lpDrawItemStruct->itemID,
nCol,LVIR_BOUNDS, m_SelectionRect);
} else {
GetItemRect(lpDrawItemStruct->itemID,
m_SelectionRect,LVIR_BOUNDS);
m_SelectionRect.right = GetColumnWidth(0);
m_SelectionRect.left = 0;
}
if (m_SelectionRect.PtInRect(m_Point)) {
m_SelectionFlag = TRUE;
break;
} else {
m_SelectionFlag = FALSE;
}
}
}
if ((lpDrawItemStruct->itemState & ODS_SELECTED) && m_SelectionFlag ) {
CRect rc = lpDrawItemStruct->rcItem;
rc.left += 4; rc.right -= 4;
rc.top += 1; rc.bottom -= 0;
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
rc.bottom -= 3; rc.top -= 1;
rc.right = (rc.Width() * 7 / 8) + rc.left;
}
pDC->FillSolidRect(&rc, GetSysColor(m_bFocus ? COLOR_HIGHLIGHT : COLOR_INACTIVEBORDER));
} else {
CRect rc = lpDrawItemStruct->rcItem;
pDC->FillSolidRect(&rc, GetSysColor(COLOR_WINDOW)) ;
pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT)) ;
}
}
for (nCol=0; GetColumn(nCol, &lvc); nCol++) {
UINT uFormat = DT_LEFT ;
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
rcText = lpDrawItemStruct->rcItem;
rcText.left += 4;
rcText.bottom += 1;
rcText.top = rcText.bottom - 6 + lf.lfHeight;
::DrawText(lpDrawItemStruct->hDC, lpBuffer, (int)strlen(lpBuffer),
&rcText, DT_LEFT) ;
CRect rect = lpDrawItemStruct->rcItem;
int rc = 0;
BITMAP cs;
rect.top = rcText.bottom - 4;
rc = ::GetObject(m_hBitmap, sizeof(cs), &cs);
if (rc == 0) {
pDC->SelectObject(pOldFont);
return;
}
::StretchBlt(pDC->m_hDC, rect.left + 4, (rect.bottom + rect.top) / 2,
rect.Width() * 7 / 8, cs.bmHeight,
m_hMemDC, 0, 0, cs.bmWidth, cs.bmHeight, SRCCOPY);
} else {
if (nCol > 0) {
GetColumn(nCol, &lvcprev) ;
rcText.left = rcText.right;
rcText.right += lvcprev.cx;
rcText.left += 4;
if (nCol == 3 || nCol == 4) {
uFormat = DT_RIGHT;
rcText.right -= 4;
}
} else {
rcText = lpDrawItemStruct->rcItem;
rcText.top += (16 + lf.lfHeight) / 2;
rcText.right = rcText.left + GetColumnWidth(0);
rcText.left += 20;
}
// Get and draw the text
memset(lpBuffer, 0, 256);
::ZeroMemory(&lvi, sizeof(lvi));
lvi.iItem = lpDrawItemStruct->itemID;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iSubItem = nCol;
lvi.pszText = lpBuffer;
lvi.cchTextMax = sizeof(lpBuffer);
GetItem(&lvi);
::DrawText(lpDrawItemStruct->hDC, lpBuffer, (int)strlen(lpBuffer),
&rcText, uFormat) ;
if (nCol == 0) {
rcText.left -= 20;
} else {
rcText.left -= 4;
if (nCol == 3 || nCol == 4) {
rcText.right += 4;
}
}
}
}
pDC->SelectObject(pOldFont);
return;
}
void CTreeList::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Point = point;
m_SelectionFlag = FALSE;
Invalidate();
CListCtrl::OnRButtonDown(nFlags, point);
}
void CTreeList::OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
m_bFocus = FALSE;
Invalidate();
*pResult = 0;
}
void CTreeList::OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
m_bFocus = TRUE;
Invalidate();
*pResult = 0;
}
int CTreeList::QuerySubItemText(int item, CHAR *Data, int length)
{
LV_COLUMN lvc;
LV_ITEM lvi;
int ncol;
CRect rect;
::ZeroMemory(&lvc, sizeof(lvc));
lvc.mask = LVCF_WIDTH |LVCF_FMT;
for (ncol=0; GetColumn(ncol, &lvc); ncol++) {
if (ncol > 0) {
GetSubItemRect(item, ncol,LVIR_BOUNDS, rect);
} else {
GetItemRect(item, rect, LVIR_BOUNDS);
rect.right = GetColumnWidth(0);
rect.left = 0;
}
if (rect.PtInRect(m_Point)) {
::ZeroMemory(Data, length);
::ZeroMemory(&lvi, sizeof(lvi));
lvi.iItem = item;
lvi.mask = LVIF_TEXT;
lvi.iSubItem = ncol;
lvi.pszText = Data;
lvi.cchTextMax = length;
return GetItem(&lvi);
break;
}
}
return FALSE;
}
VOID CTreeList::Redraw()
{
m_bFocus = TRUE;
m_SelectionFlag = TRUE;
Invalidate();
// TreeList.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "TreeList.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTreeList
CTreeList::CTreeList()
{
m_SelectionRect = CRect(0,0,0,0);
m_SelectionFlag = FALSE;
m_Point = CPoint(0, 0);
m_PrevItem = -1;
m_Rows = 0;
m_Columns = 1;
m_hBitmap = NULL;
m_hMemDC = NULL;
m_hOldBmp = NULL;
m_bFocus = FALSE;
}
CTreeList::~CTreeList()
{
if (m_hBitmap) {
if (m_hMemDC) {
::SelectObject(m_hMemDC, m_hOldBmp);
::DeleteDC(m_hMemDC);
}
::DeleteObject (m_hBitmap);
m_hBitmap = NULL;
}
}
BEGIN_MESSAGE_MAP(CTreeList, CListCtrl)
//{{AFX_MSG_MAP(CTreeList)
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
ON_NOTIFY_REFLECT(NM_KILLFOCUS, OnKillfocus)
ON_NOTIFY_REFLECT(NM_SETFOCUS, OnSetfocus)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SETFONT, OnSetFont)
ON_WM_MEASUREITEM_REFLECT()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTreeList message handlers
void CTreeList::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Point = point;
m_SelectionFlag = FALSE;
Invalidate();
CListCtrl::OnLButtonDown(nFlags, point);
}
BOOL CTreeList::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
cs.style |= LVS_REPORT | LVS_OWNERDRAWFIXED| WS_BORDER;
return CListCtrl::PreCreateWindow(cs);
}
LRESULT CTreeList::OnSetFont(WPARAM wParam, LPARAM)
{
LRESULT res = Default();
CRect rc;
GetWindowRect( &rc );
WINDOWPOS wp;
wp.hwnd = m_hWnd;
wp.cx = rc.Width();
wp.cy = rc.Height();
wp.flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER;
SendMessage( WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp );
return res;
}
void CTreeList::MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct )
{
lpMeasureItemStruct->itemHeight = 16;
}
void CTreeList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
PULONG pMagic = (PULONG) lpDrawItemStruct->itemData;
TCHAR lpBuffer[256];
LV_ITEM lvi;
LV_COLUMN lvc, lvcprev ;
memset(lpBuffer, 0, 256);
lvi.mask = LVIF_TEXT | LVIF_PARAM ;
lvi.iItem = lpDrawItemStruct->itemID ;
lvi.iSubItem = 0;
lvi.pszText = lpBuffer ;
lvi.cchTextMax = sizeof(lpBuffer);
GetItem(&lvi);
::ZeroMemory(&lvc, sizeof(lvc));
::ZeroMemory(&lvcprev, sizeof(lvcprev));
lvc.mask = LVCF_WIDTH |LVCF_FMT;
lvcprev.mask = LVCF_WIDTH | LVCF_FMT;
CDC* pDC;
pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
int nCol;
CRect rcText = lpDrawItemStruct->rcItem;
CFont Fnt, *pOldFont = NULL;
LOGFONT lf;
int cyPixels = pDC->GetDeviceCaps(LOGPIXELSY);
memset(&lf, 0, sizeof(LOGFONT));
if (pMagic == NULL) {
return;
}
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
if (IsVistaOrAbove()) {
lstrcpy(lf.lfFaceName, "MS Sans Serif"); /*Courier New*/
lf.lfHeight = -MulDiv(8, cyPixels, 72);
lf.lfWeight = TRUE;
} else {
lstrcpy(lf.lfFaceName, "Arial Black"); /*Courier New*/
lf.lfHeight = -MulDiv(8, cyPixels, 72);
lf.lfWeight = TRUE;
}
} else {
lstrcpy(lf.lfFaceName, "MS Sans Serif");
lf.lfHeight = -MulDiv(8, cyPixels, 72);
}
Fnt.CreateFontIndirect(&lf);
pOldFont = (CFont *) pDC->SelectObject(&Fnt);
/* loading bitmap */
if (m_hBitmap == NULL) {
m_hBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDB_LINE_SEP),
IMAGE_BITMAP, 0, 0, 0);
if (m_hBitmap) {
m_hMemDC = ::CreateCompatibleDC(this->GetDC()->m_hDC);
m_hOldBmp = (HBITMAP)::SelectObject(m_hMemDC, m_hBitmap);
}
}
if (TRUE) {
if (!m_SelectionFlag) {
for (nCol=0; GetColumn(nCol, &lvc); nCol++) {
if (nCol > 0) {
GetSubItemRect(lpDrawItemStruct->itemID,
nCol,LVIR_BOUNDS, m_SelectionRect);
} else {
GetItemRect(lpDrawItemStruct->itemID,
m_SelectionRect,LVIR_BOUNDS);
m_SelectionRect.right = GetColumnWidth(0);
m_SelectionRect.left = 0;
}
if (m_SelectionRect.PtInRect(m_Point)) {
m_SelectionFlag = TRUE;
break;
} else {
m_SelectionFlag = FALSE;
}
}
}
if ((lpDrawItemStruct->itemState & ODS_SELECTED) && m_SelectionFlag ) {
CRect rc = lpDrawItemStruct->rcItem;
rc.left += 4; rc.right -= 4;
rc.top += 1; rc.bottom -= 0;
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
rc.bottom -= 3; rc.top -= 1;
rc.right = (rc.Width() * 7 / 8) + rc.left;
}
pDC->FillSolidRect(&rc, GetSysColor(m_bFocus ? COLOR_HIGHLIGHT : COLOR_INACTIVEBORDER));
} else {
CRect rc = lpDrawItemStruct->rcItem;
pDC->FillSolidRect(&rc, GetSysColor(COLOR_WINDOW)) ;
pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT)) ;
}
}
for (nCol=0; GetColumn(nCol, &lvc); nCol++) {
UINT uFormat = DT_LEFT ;
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
rcText = lpDrawItemStruct->rcItem;
rcText.left += 4;
rcText.bottom += 1;
rcText.top = rcText.bottom - 6 + lf.lfHeight;
::DrawText(lpDrawItemStruct->hDC, lpBuffer, (int)strlen(lpBuffer),
&rcText, DT_LEFT) ;
CRect rect = lpDrawItemStruct->rcItem;
int rc = 0;
BITMAP cs;
rect.top = rcText.bottom - 4;
rc = ::GetObject(m_hBitmap, sizeof(cs), &cs);
if (rc == 0) {
pDC->SelectObject(pOldFont);
return;
}
::StretchBlt(pDC->m_hDC, rect.left + 4, (rect.bottom + rect.top) / 2,
rect.Width() * 7 / 8, cs.bmHeight,
m_hMemDC, 0, 0, cs.bmWidth, cs.bmHeight, SRCCOPY);
} else {
if (nCol > 0) {
GetColumn(nCol, &lvcprev) ;
rcText.left = rcText.right;
rcText.right += lvcprev.cx;
rcText.left += 4;
if (nCol == 3 || nCol == 4) {
uFormat = DT_RIGHT;
rcText.right -= 4;
}
} else {
rcText = lpDrawItemStruct->rcItem;
rcText.top += (16 + lf.lfHeight) / 2;
rcText.right = rcText.left + GetColumnWidth(0);
rcText.left += 20;
}
// Get and draw the text
memset(lpBuffer, 0, 256);
::ZeroMemory(&lvi, sizeof(lvi));
lvi.iItem = lpDrawItemStruct->itemID;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iSubItem = nCol;
lvi.pszText = lpBuffer;
lvi.cchTextMax = sizeof(lpBuffer);
GetItem(&lvi);
::DrawText(lpDrawItemStruct->hDC, lpBuffer, (int)strlen(lpBuffer),
&rcText, uFormat) ;
if (nCol == 0) {
rcText.left -= 20;
} else {
rcText.left -= 4;
if (nCol == 3 || nCol == 4) {
rcText.right += 4;
}
}
}
}
pDC->SelectObject(pOldFont);
return;
}
void CTreeList::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Point = point;
m_SelectionFlag = FALSE;
Invalidate();
CListCtrl::OnRButtonDown(nFlags, point);
}
void CTreeList::OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
m_bFocus = FALSE;
Invalidate();
*pResult = 0;
}
void CTreeList::OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
m_bFocus = TRUE;
Invalidate();
*pResult = 0;
}
int CTreeList::QuerySubItemText(int item, CHAR *Data, int length)
{
LV_COLUMN lvc;
LV_ITEM lvi;
int ncol;
CRect rect;
::ZeroMemory(&lvc, sizeof(lvc));
lvc.mask = LVCF_WIDTH |LVCF_FMT;
for (ncol=0; GetColumn(ncol, &lvc); ncol++) {
if (ncol > 0) {
GetSubItemRect(item, ncol,LVIR_BOUNDS, rect);
} else {
GetItemRect(item, rect, LVIR_BOUNDS);
rect.right = GetColumnWidth(0);
rect.left = 0;
}
if (rect.PtInRect(m_Point)) {
::ZeroMemory(Data, length);
::ZeroMemory(&lvi, sizeof(lvi));
lvi.iItem = item;
lvi.mask = LVIF_TEXT;
lvi.iSubItem = ncol;
lvi.pszText = Data;
lvi.cchTextMax = length;
return GetItem(&lvi);
break;
}
}
return FALSE;
}
VOID CTreeList::Redraw()
{
m_bFocus = TRUE;
m_SelectionFlag = TRUE;
Invalidate();
}

View File

@@ -1,74 +1,74 @@
#if !defined(AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_)
#define AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TreeList.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CTreeList window
class CTreeList : public CListCtrl
{
// Construction
public:
CTreeList();
// Attributes
public:
/* Focus set or lost */
BOOL m_bFocus;
/* single item selection */
CRect m_SelectionRect;
BOOL m_SelectionFlag;
CPoint m_Point;
int m_Rows;
int m_Columns;
int m_PrevItem;
/* bitmap information */
HBITMAP m_hBitmap;
HDC m_hMemDC;
HBITMAP m_hOldBmp;
// Operations
public:
VOID Redraw();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTreeList)
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM);
afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct );
// Implementation
public:
virtual ~CTreeList();
int QuerySubItemText(int item, CHAR *Data, int length);
// Generated message map functions
protected:
//{{AFX_MSG(CTreeList)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_)
#if !defined(AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_)
#define AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TreeList.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CTreeList window
class CTreeList : public CListCtrl
{
// Construction
public:
CTreeList();
// Attributes
public:
/* Focus set or lost */
BOOL m_bFocus;
/* single item selection */
CRect m_SelectionRect;
BOOL m_SelectionFlag;
CPoint m_Point;
int m_Rows;
int m_Columns;
int m_PrevItem;
/* bitmap information */
HBITMAP m_hBitmap;
HDC m_hMemDC;
HBITMAP m_hOldBmp;
// Operations
public:
VOID Redraw();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTreeList)
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM);
afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct );
// Implementation
public:
virtual ~CTreeList();
int QuerySubItemText(int item, CHAR *Data, int length);
// Generated message map functions
protected:
//{{AFX_MSG(CTreeList)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,182 +1,182 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Ext2Mgr.rc
//
#define MANIFEST_RESOURCE_ID 1
#define ID_RELOAD_DL 3
#define IDM_ABOUTBOX 0x0010
#ifndef RT_MANIFEST
#define RT_MANIFEST 24
#endif
#define IDM_CLOSE_SPLASH 0x0020
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_EXT2MGR_DIALOG 102
#define ID_INDICATOR_MESSAGE 103
#define ID_INDICATOR_TIME 104
#define ID_INDICATOR_EXTRA 105
#define IDR_MAINFRAME 128
#define IDR_TRAY 133
#define IDI_FLOPPY 134
#define IDI_CDROM 135
#define IDI_DISK 136
#define IDI_DVD 137
#define IDI_DYNAMIC 138
#define IDR_MENU 139
#define IDB_ABOUT_SCREEN 151
#define IDR_STANDARDBAR 162
#define IDB_ABOUT_SMALL 163
#define IDI_BIG_MAINFRAME 164
#define IDB_LINE_SEP 166
#define IDD_SERVICE_MANAGE 167
#define IDD_FORMAT 169
#define IDD_EXT2_ATTR 170
#define IDD_CHANGE_MOUNTPINT 171
#define IDD_NEW_MOUNTPOINT 172
#define IDD_PROPERTY_DIALOG 173
#define IDD_DONATE_DIALOG 174
#define IDB_SMALL_PENGUIN 184
#define IDB_BIG_PENGUIN 185
#define IDD_PERFSTAT_DIALOG 186
#define IDD_PARTITION_TYPE 187
#define IDD_REMOVE_DEADLETTER 188
#define IDR_AKEY_EXT2MGR 190
#define IDR_RCDAT_SRV 191
#define IDC_VOLUME_LIST 1001
#define IDC_AUTHOR 1002
#define IDC_ABOUT_SHOW 1003
#define IDC_PROGRAM 1004
#define IDC_EXT2FSD 1005
#define IDC_DISK_VIEW 1006
#define IDC_DISK_LIST 1007
#define IDC_READ_ONLY 1013
#define IDC_EXT3_WRITABLE 1014
#define IDC_COMBO_STARTUP 1015
#define IDC_COMBO_CODEPAGE 1016
#define IDC_COMBO_DRVLETTER 1017
#define IDC_COMBO_AUTOMP 1018
#define IDC_EXT3_AUTOMOUNT 1018
#define IDC_FORMAT_PROGRESS 1019
#define IDC_COMBO_FS 1020
#define IDC_FORMAT_TITLE 1021
#define IDC_EDIT_LABEL 1022
#define IDC_COMBO_CLUSTER 1023
#define IDC_QUICK_FORMAT 1024
#define IDC_QUICK_COMPRESS 1025
#define IDC_DRV_LETTER_LIST 1026
#define IDC_DRVLETTERS_LIST 1028
#define IDC_PROPERTY_DEVICE 1029
#define IDC_PROPERTY_SDEV 1030
#define IDC_VENDOR_ID 1031
#define IDC_PRODUCT_ID 1032
#define IDC_SERIAL_NUMBER 1033
#define IDC_BUS_TYPE 1034
#define IDC_DEVICE_TYPE 1035
#define IDC_MEDIA_TYPE 1036
#define IDC_TOTAL_SIZE 1037
#define IDC_SDEV_CHANGE_MP 1038
#define IDC_MOUNT_POINTS 1039
#define IDC_VIA_SOURCEFORGE 1040
#define IDC_SDEV_SIZE 1041
#define IDC_VIA_PAYPAL 1042
#define IDC_FILE_SYSTEM 1043
#define IDC_VIA_TAOBAO 1043
#define IDC_SDEV_STATUS 1044
#define IDC_DECLARE 1045
#define IDC_SERVICE_STATUS 1046
#define IDC_SDEV_EXT2_INFO 1047
#define IDC_GLOBAL_PREFIX 1047
#define IDC_SDEV_FREE_SIZE 1048
#define IDC_GLOBAL_SUFFIX 1048
#define IDC_START_SERVICE 1049
#define IDC_PERMANENT_MP 1050
#define IDC_DOSDEV_MP 1051
#define IDC_REGISTRY_MP 1052
#define IDC_EXT2_PREFIX 1053
#define IDC_EXT2_SUFFIX 1054
#define IDC_PERFSTAT_INTERVAL 1055
#define IDC_MEMORY_LIST 1056
#define IDC_IRP_LIST 1057
#define IDC_AUTOMOUNT 1058
#define IDC_FIXMOUNT 1059
#define IDC_PARTTION_TYPE_LIST 1059
#define IDC_PARTITION_TYPE 1060
#define IDC_PARTITION_NAME 1062
#define IDC_DEAD_LETTER_LIST 1063
#define IDC_AUTO_REMOVAL 1064
#define IDC_AUTOREMOVALTEXT 1065
#define IDC_REMOVAL_CURRENT 1066
#define IDC_DRIVER 1067
#define IDC_SDEV_QUICK_MOUNT 1068
#define IDC_EDIT_UID 1070
#define IDC_EDIT_GID 1071
#define IDC_EDIT_EUID 1072
#define ID_ABOUT 32771
#define ID_NEW 32772
#define ID_CHANGE 32773
#define ID_REFRESH 32774
#define ID_EXIT 32775
#define ID_SERVICE 32776
#define ID_FORMAT 32777
#define ID_PROPERTY 32778
#define ID_COPY 32779
#define ID_SHOW_MAIN 32780
#define ID_DRV_LETTER 32781
#define ID_DONATE 32782
#define ID_ADD_MOUNTPOINT 32783
#define ID_CHANGE_MOUNTPOINT 32784
#define ID_REMOVE_MOUNTPOINT 32785
#define ID_INSTALL_SERVICE 32786
#define ID_REMOVE_SERVICE 32787
#define ID_ENABLE_AUTOSTART 32788
#define ID_DISABLE_AUTOSTART 32789
#define ID_PERFSTAT 32790
#define ID_PERFSTOP 32791
#define ID_COPYALL 32792
#define ID_QUERYPERF 32793
#define ID_FLUSH_BUFFER 32794
#define ID_CHANGE_PARTTYPE 32795
#define ID_REMOVE_DEAD_LETTER 32796
#define ID_DRV_QUICK_MOUNT 32797
#define ID_DRV_QUICK_REMOVE 32798
#define IDS_LISTITEM_FILESYSTEM 57671
#define IDS_LISTITEM_VOLUME 57672
#define IDS_LISTITEM_TYPE 57673
#define IDS_LISTITEM_TOTALSIZE 57674
#define IDS_LISTITEM_USEDSIZE 57675
#define IDS_LISTITEM_CODEPAGE 57676
#define IDS_LISTITEM_DEVOBJ 57677
#define IDS_LISTITEM_PARTID 57678
#define IDS_DISK_TYPE_BASIC 57679
#define IDS_DISK_TYPE_DYN 57680
#define IDS_DONATE_DECLARE 57681
#define IDS_SHOW_PROPERTY 57682
#define IDS_COPY_ITEM_TO_CLIP 57683
#define IDS_CHANGE_DRVLETTER 57684
#define IDS_EXT2_MANAGEMENT 57685
#define IDS_FLUSH_BUFFER 57686
#define IDS_CHANGE_PARTID 57687
#define IDS_RELOAD_REFRESH 57688
#define IDS_PERFMEM_STAT 57689
#define IDS_SERVICE_MANAGE 57690
#define IDS_REMOVE_DEAD_LETTER 57691
#define IDS_PERFSTAT_NAME 57692
#define IDS_PERFSTAT_UNIT 57693
#define IDS_PERFSTAT_CURRENT 57694
#define IDS_PERFSTAT_SIZE 57695
#define IDS_PERFSTAT_TOTAL 57696
#define IDS_PERFSTAT_PROCESSING 57697
#define IDS_PERSTAT_PROCESSED 57698
#define IDS_PERFSTAT_PROCESSED 57698
#define IDS_DRV_QUICK_MOUNT 57699
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 192
#define _APS_NEXT_COMMAND_VALUE 32799
#define _APS_NEXT_CONTROL_VALUE 1071
#define _APS_NEXT_SYMED_VALUE 106
#endif
#endif
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Ext2Mgr.rc
//
#define MANIFEST_RESOURCE_ID 1
#define ID_RELOAD_DL 3
#define IDM_ABOUTBOX 0x0010
#ifndef RT_MANIFEST
#define RT_MANIFEST 24
#endif
#define IDM_CLOSE_SPLASH 0x0020
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_EXT2MGR_DIALOG 102
#define ID_INDICATOR_MESSAGE 103
#define ID_INDICATOR_TIME 104
#define ID_INDICATOR_EXTRA 105
#define IDR_MAINFRAME 128
#define IDR_TRAY 133
#define IDI_FLOPPY 134
#define IDI_CDROM 135
#define IDI_DISK 136
#define IDI_DVD 137
#define IDI_DYNAMIC 138
#define IDR_MENU 139
#define IDB_ABOUT_SCREEN 151
#define IDR_STANDARDBAR 162
#define IDB_ABOUT_SMALL 163
#define IDI_BIG_MAINFRAME 164
#define IDB_LINE_SEP 166
#define IDD_SERVICE_MANAGE 167
#define IDD_FORMAT 169
#define IDD_EXT2_ATTR 170
#define IDD_CHANGE_MOUNTPINT 171
#define IDD_NEW_MOUNTPOINT 172
#define IDD_PROPERTY_DIALOG 173
#define IDD_DONATE_DIALOG 174
#define IDB_SMALL_PENGUIN 184
#define IDB_BIG_PENGUIN 185
#define IDD_PERFSTAT_DIALOG 186
#define IDD_PARTITION_TYPE 187
#define IDD_REMOVE_DEADLETTER 188
#define IDR_AKEY_EXT2MGR 190
#define IDR_RCDAT_SRV 191
#define IDC_VOLUME_LIST 1001
#define IDC_AUTHOR 1002
#define IDC_ABOUT_SHOW 1003
#define IDC_PROGRAM 1004
#define IDC_EXT2FSD 1005
#define IDC_DISK_VIEW 1006
#define IDC_DISK_LIST 1007
#define IDC_READ_ONLY 1013
#define IDC_EXT3_WRITABLE 1014
#define IDC_COMBO_STARTUP 1015
#define IDC_COMBO_CODEPAGE 1016
#define IDC_COMBO_DRVLETTER 1017
#define IDC_COMBO_AUTOMP 1018
#define IDC_EXT3_AUTOMOUNT 1018
#define IDC_FORMAT_PROGRESS 1019
#define IDC_COMBO_FS 1020
#define IDC_FORMAT_TITLE 1021
#define IDC_EDIT_LABEL 1022
#define IDC_COMBO_CLUSTER 1023
#define IDC_QUICK_FORMAT 1024
#define IDC_QUICK_COMPRESS 1025
#define IDC_DRV_LETTER_LIST 1026
#define IDC_DRVLETTERS_LIST 1028
#define IDC_PROPERTY_DEVICE 1029
#define IDC_PROPERTY_SDEV 1030
#define IDC_VENDOR_ID 1031
#define IDC_PRODUCT_ID 1032
#define IDC_SERIAL_NUMBER 1033
#define IDC_BUS_TYPE 1034
#define IDC_DEVICE_TYPE 1035
#define IDC_MEDIA_TYPE 1036
#define IDC_TOTAL_SIZE 1037
#define IDC_SDEV_CHANGE_MP 1038
#define IDC_MOUNT_POINTS 1039
#define IDC_VIA_SOURCEFORGE 1040
#define IDC_SDEV_SIZE 1041
#define IDC_VIA_PAYPAL 1042
#define IDC_FILE_SYSTEM 1043
#define IDC_VIA_TAOBAO 1043
#define IDC_SDEV_STATUS 1044
#define IDC_DECLARE 1045
#define IDC_SERVICE_STATUS 1046
#define IDC_SDEV_EXT2_INFO 1047
#define IDC_GLOBAL_PREFIX 1047
#define IDC_SDEV_FREE_SIZE 1048
#define IDC_GLOBAL_SUFFIX 1048
#define IDC_START_SERVICE 1049
#define IDC_PERMANENT_MP 1050
#define IDC_DOSDEV_MP 1051
#define IDC_REGISTRY_MP 1052
#define IDC_EXT2_PREFIX 1053
#define IDC_EXT2_SUFFIX 1054
#define IDC_PERFSTAT_INTERVAL 1055
#define IDC_MEMORY_LIST 1056
#define IDC_IRP_LIST 1057
#define IDC_AUTOMOUNT 1058
#define IDC_FIXMOUNT 1059
#define IDC_PARTTION_TYPE_LIST 1059
#define IDC_PARTITION_TYPE 1060
#define IDC_PARTITION_NAME 1062
#define IDC_DEAD_LETTER_LIST 1063
#define IDC_AUTO_REMOVAL 1064
#define IDC_AUTOREMOVALTEXT 1065
#define IDC_REMOVAL_CURRENT 1066
#define IDC_DRIVER 1067
#define IDC_SDEV_QUICK_MOUNT 1068
#define IDC_EDIT_UID 1070
#define IDC_EDIT_GID 1071
#define IDC_EDIT_EUID 1072
#define ID_ABOUT 32771
#define ID_NEW 32772
#define ID_CHANGE 32773
#define ID_REFRESH 32774
#define ID_EXIT 32775
#define ID_SERVICE 32776
#define ID_FORMAT 32777
#define ID_PROPERTY 32778
#define ID_COPY 32779
#define ID_SHOW_MAIN 32780
#define ID_DRV_LETTER 32781
#define ID_DONATE 32782
#define ID_ADD_MOUNTPOINT 32783
#define ID_CHANGE_MOUNTPOINT 32784
#define ID_REMOVE_MOUNTPOINT 32785
#define ID_INSTALL_SERVICE 32786
#define ID_REMOVE_SERVICE 32787
#define ID_ENABLE_AUTOSTART 32788
#define ID_DISABLE_AUTOSTART 32789
#define ID_PERFSTAT 32790
#define ID_PERFSTOP 32791
#define ID_COPYALL 32792
#define ID_QUERYPERF 32793
#define ID_FLUSH_BUFFER 32794
#define ID_CHANGE_PARTTYPE 32795
#define ID_REMOVE_DEAD_LETTER 32796
#define ID_DRV_QUICK_MOUNT 32797
#define ID_DRV_QUICK_REMOVE 32798
#define IDS_LISTITEM_FILESYSTEM 57671
#define IDS_LISTITEM_VOLUME 57672
#define IDS_LISTITEM_TYPE 57673
#define IDS_LISTITEM_TOTALSIZE 57674
#define IDS_LISTITEM_USEDSIZE 57675
#define IDS_LISTITEM_CODEPAGE 57676
#define IDS_LISTITEM_DEVOBJ 57677
#define IDS_LISTITEM_PARTID 57678
#define IDS_DISK_TYPE_BASIC 57679
#define IDS_DISK_TYPE_DYN 57680
#define IDS_DONATE_DECLARE 57681
#define IDS_SHOW_PROPERTY 57682
#define IDS_COPY_ITEM_TO_CLIP 57683
#define IDS_CHANGE_DRVLETTER 57684
#define IDS_EXT2_MANAGEMENT 57685
#define IDS_FLUSH_BUFFER 57686
#define IDS_CHANGE_PARTID 57687
#define IDS_RELOAD_REFRESH 57688
#define IDS_PERFMEM_STAT 57689
#define IDS_SERVICE_MANAGE 57690
#define IDS_REMOVE_DEAD_LETTER 57691
#define IDS_PERFSTAT_NAME 57692
#define IDS_PERFSTAT_UNIT 57693
#define IDS_PERFSTAT_CURRENT 57694
#define IDS_PERFSTAT_SIZE 57695
#define IDS_PERFSTAT_TOTAL 57696
#define IDS_PERFSTAT_PROCESSING 57697
#define IDS_PERSTAT_PROCESSED 57698
#define IDS_PERFSTAT_PROCESSED 57698
#define IDS_DRV_QUICK_MOUNT 57699
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 192
#define _APS_NEXT_COMMAND_VALUE 32799
#define _APS_NEXT_CONTROL_VALUE 1071
#define _APS_NEXT_SYMED_VALUE 106
#endif
#endif

View File

@@ -1,331 +1,331 @@
// ToolBar1.cpp : implementation file
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "afxpriv.h"
#include "resource.h"
#include "toolbar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStandardBar
CStandardBar::CStandardBar() : m_pTBButtons(NULL)
{
}
CStandardBar::~CStandardBar()
{
if (m_pTBButtons)
delete []m_pTBButtons;
}
BEGIN_MESSAGE_MAP(CStandardBar, CToolBarCtrl)
//{{AFX_MSG_MAP(CStandardBar)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CStandardBar::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, int count, PBUTTON_INFO pButton)
{
BOOL bRet = CToolBarCtrl::Create(dwStyle, rect, pParentWnd, nID);
AddBitmap(count, IDR_STANDARDBAR);
m_pTBButtons = new TBBUTTON[count];
memset(m_pTBButtons, 0, sizeof(TBBUTTON) * count);
m_nButtonCount = count;
TBBUTTON sepButton;
sepButton.idCommand = 0;
sepButton.fsStyle = TBSTYLE_SEP;
sepButton.fsState = TBSTATE_ENABLED;
sepButton.iString = 0;
sepButton.iBitmap = 0;
sepButton.dwData = 0;
for (int nIndex = 0; nIndex < count; nIndex++) {
CString string;
string.LoadString(pButton[nIndex].ID);
// Add second '\0'
int nStringLength = string.GetLength() + 1;
TCHAR * pString = string.GetBufferSetLength(nStringLength);
pString[nStringLength] = 0;
m_pTBButtons[nIndex].iString = AddStrings(pString);
string.ReleaseBuffer();
m_pTBButtons[nIndex].fsState = TBSTATE_ENABLED;
m_pTBButtons[nIndex].fsStyle = TBSTYLE_BUTTON;
m_pTBButtons[nIndex].dwData = 0;
m_pTBButtons[nIndex].iBitmap = nIndex;
m_pTBButtons[nIndex].idCommand = pButton[nIndex].ID;
if (pButton[nIndex].bSep) {
AddButtons(1,&sepButton);
AddButtons(1,&sepButton);
}
AddButtons(1, &m_pTBButtons[nIndex]);
}
return bRet;
}
/////////////////////////////////////////////////////////////////////////////
// CStandardBar message handlers
// MFC routes the notifications sent to the parent of the control to
// the control before the parent can process the notification.
// The control object can handle the notification or ignore it.
// If the notification is handled then return TRUE. Otherwise MFC
// will route it to the parent of the control.
BOOL CStandardBar::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
return CToolBarCtrl::OnChildNotify(message, wParam, lParam, pLResult);
}
BOOL CStandardBar::BeginAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_BEGINADJUST\n"));
// the customize dialog box is about to be displayed
return TRUE;
}
BOOL CStandardBar::BeginDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_BEGINDRAG\n"));
// we are not implementing custon drag and drop
* pLResult = FALSE;
return FALSE;
}
BOOL CStandardBar::CustomizeHelp(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_CUSTHELP\n"));
return TRUE;
}
BOOL CStandardBar::EndAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_ENDADJUST\n"));
// the customize dialog box has been closed
return TRUE;
}
BOOL CStandardBar::EndDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_ENDDRAG\n"));
// Code to handle custom drag and drop. This message indicates that
// the item is being dropped
* pLResult = FALSE;
return TRUE;
}
BOOL CStandardBar::GetButtonInfo(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
// This notification message has to be handled correctly if
// all operations in the custom dialogbox has to function correctly
// We have to supply information for the button specified by pTBN->tbButton
//
// This notification is sent in the following cases
//
// After TBN_BEGINADJUST the control sends these notifications until
// * pLResult is TRUE. We have to supply valid values when this value is
// set to TRUE. Here the control is collecting information for all
// the buttons that have to be displayed in the dialog box
//
// The control sends this notification to get information about
// a button if the user is trying to add it to the toolbar or
// rearranging the buttons on the toolbar from within the dialog
TRACE(_T("TBN_GETBUTTONINFO\n"));
TBNOTIFY *pTBN = (TBNOTIFY *) lParam;
if (pTBN->iItem >= m_nButtonCount)
{
* pLResult = FALSE;
}
else
{
CString buffer;
buffer.LoadString(pTBN->iItem + ID_NEW);
// set the string for the button
// truncate the string if its length is greater than the buffer
// supplied by the toolbar
_tcsncpy(pTBN->pszText, buffer, pTBN->cchText - 1);
pTBN->pszText[pTBN->cchText - 1] = '\0';
// set the button info
pTBN->tbButton = m_pTBButtons[pTBN->iItem];
// valid values are structure
*pLResult = TRUE;
}
return TRUE;
}
BOOL CStandardBar::QueryDelete(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_QUERYDELETE\n"));
// in this sample any button can be deleted
// if a particular button cannot be deleted set *pResult to FALSE for that item
*pLResult = FALSE;
return TRUE;
}
BOOL CStandardBar::QueryInsert(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_QUERYINSERT\n"));
// in this sample buttons can be inserted at any location on the
// toolbar
*pLResult = FALSE;
return TRUE;
}
BOOL CStandardBar::Reset(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_RESET\n"));
*pLResult = TRUE;
return TRUE;
}
BOOL CStandardBar::ToolBarChange(WPARAM wParam, LPARAM lParam,LRESULT* pLResult)
{
TRACE(_T("TBN_TOOLBARCHANGE\n"));
// the toolbar has changed
return TRUE;
}
// Helper function for tooltips
CString CStandardBar::NeedText( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
{
LPTOOLTIPTEXT lpTTT = (LPTOOLTIPTEXT)pNotifyStruct ;
ASSERT(nID == lpTTT->hdr.idFrom);
CString toolTipText;
toolTipText.LoadString(nID);
// szText length is 80
int nLength = (toolTipText.GetLength() > 79) ? 79 : toolTipText.GetLength();
toolTipText = toolTipText.Left(nLength);
return toolTipText;
}
void CStandardBar::OnNeedTextW( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
{
CString toolTipText = NeedText(nID, pNotifyStruct, lResult);
LPTOOLTIPTEXTW lpTTT = (LPTOOLTIPTEXTW)pNotifyStruct;
#ifndef _UNICODE
mbstowcs(lpTTT->szText,(LPCSTR)toolTipText, toolTipText.GetLength() + 1);
#else
_tcsncpy(lpTTT->szText, toolTipText, toolTipText.GetLength() + 1);
#endif
}
void CStandardBar::OnNeedTextA( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
{
CString toolTipText = NeedText(nID, pNotifyStruct, lResult);
LPTOOLTIPTEXT lpTTT = (LPTOOLTIPTEXT)pNotifyStruct;
_tcscpy(lpTTT->szText,(LPCTSTR)toolTipText);
}
///////////////////////////////////////////////////////////////////////
// This has been overridden so we can handle the tooltip TTN_NEEDTEXT//
// notification message //
///////////////////////////////////////////////////////////////////////
BOOL CStandardBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
ASSERT(pResult != NULL);
NMHDR* pNMHDR = (NMHDR*)lParam;
HWND hWndCtrl = pNMHDR->hwndFrom;
// get the child ID from the window itself
// UINT nID = _AfxGetDlgCtrlID(hWndCtrl);
//////////////////////////////////////////////////////////////////
// If TTN_NEEDTEXT we cannot get the ID from the tooltip window //
//////////////////////////////////////////////////////////////////
int nCode = pNMHDR->code;
//
// if it is the following notification message
// nID has to obtained from wParam
//
if (nCode == TTN_NEEDTEXTA || nCode == TTN_NEEDTEXTW)
{
UINT nID; // = _AfxGetDlgCtrlID(hWndCtrl);
nID = (UINT)wParam;
ASSERT((UINT)pNMHDR->idFrom == (UINT)wParam);
UNUSED(wParam); // not used in release build
ASSERT(hWndCtrl != NULL);
ASSERT(::IsWindow(hWndCtrl));
if (AfxGetThreadState()->m_hLockoutNotifyWindow == m_hWnd)
return TRUE; // locked out - ignore control notification
// reflect notification to child window control
if (ReflectLastMsg(hWndCtrl, pResult))
return TRUE; // eaten by child
AFX_NOTIFY notify;
notify.pResult = pResult;
notify.pNMHDR = pNMHDR;
return OnCmdMsg(nID, MAKELONG(nCode, WM_NOTIFY), &notify, NULL);
}
return CToolBarCtrl::OnNotify(wParam, lParam, pResult);
}
// ToolBar1.cpp : implementation file
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "afxpriv.h"
#include "resource.h"
#include "toolbar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStandardBar
CStandardBar::CStandardBar() : m_pTBButtons(NULL)
{
}
CStandardBar::~CStandardBar()
{
if (m_pTBButtons)
delete []m_pTBButtons;
}
BEGIN_MESSAGE_MAP(CStandardBar, CToolBarCtrl)
//{{AFX_MSG_MAP(CStandardBar)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CStandardBar::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, int count, PBUTTON_INFO pButton)
{
BOOL bRet = CToolBarCtrl::Create(dwStyle, rect, pParentWnd, nID);
AddBitmap(count, IDR_STANDARDBAR);
m_pTBButtons = new TBBUTTON[count];
memset(m_pTBButtons, 0, sizeof(TBBUTTON) * count);
m_nButtonCount = count;
TBBUTTON sepButton;
sepButton.idCommand = 0;
sepButton.fsStyle = TBSTYLE_SEP;
sepButton.fsState = TBSTATE_ENABLED;
sepButton.iString = 0;
sepButton.iBitmap = 0;
sepButton.dwData = 0;
for (int nIndex = 0; nIndex < count; nIndex++) {
CString string;
string.LoadString(pButton[nIndex].ID);
// Add second '\0'
int nStringLength = string.GetLength() + 1;
TCHAR * pString = string.GetBufferSetLength(nStringLength);
pString[nStringLength] = 0;
m_pTBButtons[nIndex].iString = AddStrings(pString);
string.ReleaseBuffer();
m_pTBButtons[nIndex].fsState = TBSTATE_ENABLED;
m_pTBButtons[nIndex].fsStyle = TBSTYLE_BUTTON;
m_pTBButtons[nIndex].dwData = 0;
m_pTBButtons[nIndex].iBitmap = nIndex;
m_pTBButtons[nIndex].idCommand = pButton[nIndex].ID;
if (pButton[nIndex].bSep) {
AddButtons(1,&sepButton);
AddButtons(1,&sepButton);
}
AddButtons(1, &m_pTBButtons[nIndex]);
}
return bRet;
}
/////////////////////////////////////////////////////////////////////////////
// CStandardBar message handlers
// MFC routes the notifications sent to the parent of the control to
// the control before the parent can process the notification.
// The control object can handle the notification or ignore it.
// If the notification is handled then return TRUE. Otherwise MFC
// will route it to the parent of the control.
BOOL CStandardBar::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
return CToolBarCtrl::OnChildNotify(message, wParam, lParam, pLResult);
}
BOOL CStandardBar::BeginAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_BEGINADJUST\n"));
// the customize dialog box is about to be displayed
return TRUE;
}
BOOL CStandardBar::BeginDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_BEGINDRAG\n"));
// we are not implementing custon drag and drop
* pLResult = FALSE;
return FALSE;
}
BOOL CStandardBar::CustomizeHelp(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_CUSTHELP\n"));
return TRUE;
}
BOOL CStandardBar::EndAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_ENDADJUST\n"));
// the customize dialog box has been closed
return TRUE;
}
BOOL CStandardBar::EndDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_ENDDRAG\n"));
// Code to handle custom drag and drop. This message indicates that
// the item is being dropped
* pLResult = FALSE;
return TRUE;
}
BOOL CStandardBar::GetButtonInfo(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
// This notification message has to be handled correctly if
// all operations in the custom dialogbox has to function correctly
// We have to supply information for the button specified by pTBN->tbButton
//
// This notification is sent in the following cases
//
// After TBN_BEGINADJUST the control sends these notifications until
// * pLResult is TRUE. We have to supply valid values when this value is
// set to TRUE. Here the control is collecting information for all
// the buttons that have to be displayed in the dialog box
//
// The control sends this notification to get information about
// a button if the user is trying to add it to the toolbar or
// rearranging the buttons on the toolbar from within the dialog
TRACE(_T("TBN_GETBUTTONINFO\n"));
TBNOTIFY *pTBN = (TBNOTIFY *) lParam;
if (pTBN->iItem >= m_nButtonCount)
{
* pLResult = FALSE;
}
else
{
CString buffer;
buffer.LoadString(pTBN->iItem + ID_NEW);
// set the string for the button
// truncate the string if its length is greater than the buffer
// supplied by the toolbar
_tcsncpy(pTBN->pszText, buffer, pTBN->cchText - 1);
pTBN->pszText[pTBN->cchText - 1] = '\0';
// set the button info
pTBN->tbButton = m_pTBButtons[pTBN->iItem];
// valid values are structure
*pLResult = TRUE;
}
return TRUE;
}
BOOL CStandardBar::QueryDelete(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_QUERYDELETE\n"));
// in this sample any button can be deleted
// if a particular button cannot be deleted set *pResult to FALSE for that item
*pLResult = FALSE;
return TRUE;
}
BOOL CStandardBar::QueryInsert(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_QUERYINSERT\n"));
// in this sample buttons can be inserted at any location on the
// toolbar
*pLResult = FALSE;
return TRUE;
}
BOOL CStandardBar::Reset(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
TRACE(_T("TBN_RESET\n"));
*pLResult = TRUE;
return TRUE;
}
BOOL CStandardBar::ToolBarChange(WPARAM wParam, LPARAM lParam,LRESULT* pLResult)
{
TRACE(_T("TBN_TOOLBARCHANGE\n"));
// the toolbar has changed
return TRUE;
}
// Helper function for tooltips
CString CStandardBar::NeedText( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
{
LPTOOLTIPTEXT lpTTT = (LPTOOLTIPTEXT)pNotifyStruct ;
ASSERT(nID == lpTTT->hdr.idFrom);
CString toolTipText;
toolTipText.LoadString(nID);
// szText length is 80
int nLength = (toolTipText.GetLength() > 79) ? 79 : toolTipText.GetLength();
toolTipText = toolTipText.Left(nLength);
return toolTipText;
}
void CStandardBar::OnNeedTextW( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
{
CString toolTipText = NeedText(nID, pNotifyStruct, lResult);
LPTOOLTIPTEXTW lpTTT = (LPTOOLTIPTEXTW)pNotifyStruct;
#ifndef _UNICODE
mbstowcs(lpTTT->szText,(LPCSTR)toolTipText, toolTipText.GetLength() + 1);
#else
_tcsncpy(lpTTT->szText, toolTipText, toolTipText.GetLength() + 1);
#endif
}
void CStandardBar::OnNeedTextA( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
{
CString toolTipText = NeedText(nID, pNotifyStruct, lResult);
LPTOOLTIPTEXT lpTTT = (LPTOOLTIPTEXT)pNotifyStruct;
_tcscpy(lpTTT->szText,(LPCTSTR)toolTipText);
}
///////////////////////////////////////////////////////////////////////
// This has been overridden so we can handle the tooltip TTN_NEEDTEXT//
// notification message //
///////////////////////////////////////////////////////////////////////
BOOL CStandardBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
ASSERT(pResult != NULL);
NMHDR* pNMHDR = (NMHDR*)lParam;
HWND hWndCtrl = pNMHDR->hwndFrom;
// get the child ID from the window itself
// UINT nID = _AfxGetDlgCtrlID(hWndCtrl);
//////////////////////////////////////////////////////////////////
// If TTN_NEEDTEXT we cannot get the ID from the tooltip window //
//////////////////////////////////////////////////////////////////
int nCode = pNMHDR->code;
//
// if it is the following notification message
// nID has to obtained from wParam
//
if (nCode == TTN_NEEDTEXTA || nCode == TTN_NEEDTEXTW)
{
UINT nID; // = _AfxGetDlgCtrlID(hWndCtrl);
nID = (UINT)wParam;
ASSERT((UINT)pNMHDR->idFrom == (UINT)wParam);
UNUSED(wParam); // not used in release build
ASSERT(hWndCtrl != NULL);
ASSERT(::IsWindow(hWndCtrl));
if (AfxGetThreadState()->m_hLockoutNotifyWindow == m_hWnd)
return TRUE; // locked out - ignore control notification
// reflect notification to child window control
if (ReflectLastMsg(hWndCtrl, pResult))
return TRUE; // eaten by child
AFX_NOTIFY notify;
notify.pResult = pResult;
notify.pNMHDR = pNMHDR;
return OnCmdMsg(nID, MAKELONG(nCode, WM_NOTIFY), &notify, NULL);
}
return CToolBarCtrl::OnNotify(wParam, lParam, pResult);
}

View File

@@ -1,86 +1,86 @@
// Toolbar1.h : header file
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
/////////////////////////////////////////////////////////////////////////////
// CStandardBar window
#ifndef INC_TOOLBAR1_H
#define INC_TOOLBAR1_H
typedef struct _BUTTON_INFO {
UINT ID;
BOOL bSep;
} BUTTON_INFO, *PBUTTON_INFO;
class CStandardBar : public CToolBarCtrl
{
private:
int m_nButtonCount;
TBBUTTON *m_pTBButtons;
// Construction
public:
CStandardBar();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CStandardBar)
public:
virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
virtual BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, int count, PBUTTON_INFO);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CStandardBar();
protected:
BOOL BeginAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL BeginDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL CustomizeHelp(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL EndAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL EndDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL GetButtonInfo(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL QueryDelete(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL QueryInsert(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL Reset(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL ToolBarChange(WPARAM wParam, LPARAM lParam,LRESULT* pLResult);
CString NeedText(UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult);
///////////////////////////////////////////////////////////////////////////////
// Following function has to be removed when OnNotify is fixed
//
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//
///////////////////////////////////////////////////////////////////////////////
// Generated message map functions
protected:
//{{AFX_MSG(CStandardBar)
afx_msg void OnNeedTextW( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult );
afx_msg void OnNeedTextA( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
#endif
// Toolbar1.h : header file
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
/////////////////////////////////////////////////////////////////////////////
// CStandardBar window
#ifndef INC_TOOLBAR1_H
#define INC_TOOLBAR1_H
typedef struct _BUTTON_INFO {
UINT ID;
BOOL bSep;
} BUTTON_INFO, *PBUTTON_INFO;
class CStandardBar : public CToolBarCtrl
{
private:
int m_nButtonCount;
TBBUTTON *m_pTBButtons;
// Construction
public:
CStandardBar();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CStandardBar)
public:
virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
virtual BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, int count, PBUTTON_INFO);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CStandardBar();
protected:
BOOL BeginAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL BeginDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL CustomizeHelp(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL EndAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL EndDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL GetButtonInfo(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL QueryDelete(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL QueryInsert(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL Reset(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
BOOL ToolBarChange(WPARAM wParam, LPARAM lParam,LRESULT* pLResult);
CString NeedText(UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult);
///////////////////////////////////////////////////////////////////////////////
// Following function has to be removed when OnNotify is fixed
//
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//
///////////////////////////////////////////////////////////////////////////////
// Generated message map functions
protected:
//{{AFX_MSG(CStandardBar)
afx_msg void OnNeedTextW( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult );
afx_msg void OnNeedTextA( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
#endif

View File

@@ -1,24 +1,24 @@
#ifndef _LINUX_TYPES_H
#define _LINUX_TYPES_H
#ifndef _MSC_VER
#error _MSC_VER not defined
#endif
typedef unsigned __int8 __u8;
typedef signed __int8 __s8;
typedef signed __int64 __s64;
typedef unsigned __int64 __u64;
typedef signed __int16 __s16;
typedef unsigned __int16 __u16;
typedef signed __int32 __s32;
typedef unsigned __int32 __u32;
typedef signed __int64 __s64;
typedef unsigned __int64 __u64;
#endif /* LINUX_TYPES_H */
#ifndef _LINUX_TYPES_H
#define _LINUX_TYPES_H
#ifndef _MSC_VER
#error _MSC_VER not defined
#endif
typedef unsigned __int8 __u8;
typedef signed __int8 __s8;
typedef signed __int64 __s64;
typedef unsigned __int64 __u64;
typedef signed __int16 __s16;
typedef unsigned __int16 __u16;
typedef signed __int32 __s32;
typedef unsigned __int32 __u32;
typedef signed __int64 __s64;
typedef unsigned __int64 __u64;
#endif /* LINUX_TYPES_H */