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

View File

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

View File

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

View File

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

View File

@@ -1,78 +1,78 @@
// DlgView.cpp : implementation file // DlgView.cpp : implementation file
// //
#include "stdafx.h" #include "stdafx.h"
#include "DlgView.h" #include "DlgView.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
#undef THIS_FILE #undef THIS_FILE
static char THIS_FILE[] = __FILE__; static char THIS_FILE[] = __FILE__;
#endif #endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CDlgView // CDlgView
IMPLEMENT_DYNCREATE(CDlgView, CScrollView) IMPLEMENT_DYNCREATE(CDlgView, CScrollView)
CDlgView::CDlgView() CDlgView::CDlgView()
{ {
} }
CDlgView::~CDlgView() CDlgView::~CDlgView()
{ {
} }
BEGIN_MESSAGE_MAP(CDlgView, CScrollView) BEGIN_MESSAGE_MAP(CDlgView, CScrollView)
//{{AFX_MSG_MAP(CDlgView) //{{AFX_MSG_MAP(CDlgView)
// NOTE - the ClassWizard will add and remove mapping macros here. // NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
END_MESSAGE_MAP() END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CDlgView drawing // CDlgView drawing
void CDlgView::OnDraw(CDC* pDC) void CDlgView::OnDraw(CDC* pDC)
{ {
CRect rectClient; CRect rectClient;
CSize size = GetTotalSize(); CSize size = GetTotalSize();
rectClient.left = 0; rectClient.left = 0;
rectClient.top = 0; rectClient.top = 0;
rectClient.bottom = size.cy; rectClient.bottom = size.cy;
rectClient.right = size.cx; rectClient.right = size.cx;
rectClient.DeflateRect(15, 15); rectClient.DeflateRect(15, 15);
pDC->DrawText(m_csText, rectClient, DT_LEFT); pDC->DrawText(m_csText, rectClient, DT_LEFT);
rectClient.InflateRect(5, 5); rectClient.InflateRect(5, 5);
pDC->Draw3dRect(rectClient, RGB(0, 0, 255), RGB(0, 0, 255)); pDC->Draw3dRect(rectClient, RGB(0, 0, 255), RGB(0, 0, 255));
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CDlgView diagnostics // CDlgView diagnostics
#ifdef _DEBUG #ifdef _DEBUG
void CDlgView::AssertValid() const void CDlgView::AssertValid() const
{ {
CScrollView::AssertValid(); CScrollView::AssertValid();
} }
void CDlgView::Dump(CDumpContext& dc) const void CDlgView::Dump(CDumpContext& dc) const
{ {
CScrollView::Dump(dc); CScrollView::Dump(dc);
} }
#endif //_DEBUG #endif //_DEBUG
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CDlgView message handlers // CDlgView message handlers
void CDlgView::OnInitialUpdate() void CDlgView::OnInitialUpdate()
{ {
CScrollView::OnInitialUpdate(); CScrollView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class // 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_) #if !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_)
#define AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_ #define AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
// DlgView.h : header file // DlgView.h : header file
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CDlgView view // CDlgView view
class CDlgView : public CScrollView class CDlgView : public CScrollView
{ {
protected: protected:
CDlgView(); // protected constructor used by dynamic creation CDlgView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CDlgView) DECLARE_DYNCREATE(CDlgView)
// Attributes // Attributes
public: public:
// Operations // Operations
public: public:
CString m_csText; CString m_csText;
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgView) //{{AFX_VIRTUAL(CDlgView)
public: public:
virtual void OnInitialUpdate(); virtual void OnInitialUpdate();
protected: protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual void OnDraw(CDC* pDC); // overridden to draw this view
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
// Implementation // Implementation
protected: protected:
virtual ~CDlgView(); virtual ~CDlgView();
#ifdef _DEBUG #ifdef _DEBUG
virtual void AssertValid() const; virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const; virtual void Dump(CDumpContext& dc) const;
#endif #endif
// Generated message map functions // Generated message map functions
protected: protected:
//{{AFX_MSG(CDlgView) //{{AFX_MSG(CDlgView)
// NOTE - the ClassWizard will add and remove member functions here. // NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_) #endif // !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_)

View File

@@ -1,95 +1,95 @@
// Donate.cpp : implementation file // Donate.cpp : implementation file
// //
#include "stdafx.h" #include "stdafx.h"
#include "ext2mgr.h" #include "ext2mgr.h"
#include "Donate.h" #include "Donate.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
#undef THIS_FILE #undef THIS_FILE
static char THIS_FILE[] = __FILE__; static char THIS_FILE[] = __FILE__;
#endif #endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CDonate dialog // CDonate dialog
CDonate::CDonate(CWnd* pParent /*=NULL*/) CDonate::CDonate(CWnd* pParent /*=NULL*/)
: CDialog(CDonate::IDD, pParent) : CDialog(CDonate::IDD, pParent)
{ {
//{{AFX_DATA_INIT(CDonate) //{{AFX_DATA_INIT(CDonate)
//}}AFX_DATA_INIT //}}AFX_DATA_INIT
} }
void CDonate::DoDataExchange(CDataExchange* pDX) void CDonate::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDonate) //{{AFX_DATA_MAP(CDonate)
DDX_Control(pDX, IDC_VIA_SOURCEFORGE, m_SF); DDX_Control(pDX, IDC_VIA_SOURCEFORGE, m_SF);
DDX_Control(pDX, IDC_VIA_PAYPAL, m_Paypal); DDX_Control(pDX, IDC_VIA_PAYPAL, m_Paypal);
//}}AFX_DATA_MAP //}}AFX_DATA_MAP
} }
BEGIN_MESSAGE_MAP(CDonate, CDialog) BEGIN_MESSAGE_MAP(CDonate, CDialog)
//{{AFX_MSG_MAP(CDonate) //{{AFX_MSG_MAP(CDonate)
ON_WM_KEYDOWN() ON_WM_KEYDOWN()
ON_WM_KILLFOCUS() ON_WM_KILLFOCUS()
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
END_MESSAGE_MAP() END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CDonate message handlers // CDonate message handlers
BOOL CDonate::OnInitDialog() BOOL CDonate::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
//Set the target URL //Set the target URL
m_SF.SetLinkUrl("http://sourceforge.net/project/project_donations.php?group_id=43775"); m_SF.SetLinkUrl("http://sourceforge.net/project/project_donations.php?group_id=43775");
//Enable showing the Tooltip //Enable showing the Tooltip
m_SF.ActiveToolTip(TRUE); m_SF.ActiveToolTip(TRUE);
//Set the Tooltiptext //Set the Tooltiptext
m_SF.SetTootTipText("Donate to Ext2Fsd group via SourceForge."); m_SF.SetTootTipText("Donate to Ext2Fsd group via SourceForge.");
//Set the target URL //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"); 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 //Enable showing the Tooltip
m_Paypal.ActiveToolTip(TRUE); m_Paypal.ActiveToolTip(TRUE);
//Set the Tooltiptext //Set the Tooltiptext
m_Paypal.SetTootTipText("Donate to Ext2Fsd group via Paypal."); m_Paypal.SetTootTipText("Donate to Ext2Fsd group via Paypal.");
#if 0 #if 0
CHAR Declaration [] = 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\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\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\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\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\nAny help will be highly appreciated. Thanks and best wishes.\r\n"
"\r\n\r\nYours sincerely,\r\n" "\r\n\r\nYours sincerely,\r\n"
"Matt"; "Matt";
#endif #endif
CString Declaration; CString Declaration;
Declaration.LoadString(IDS_DONATE_DECLARE); Declaration.LoadString(IDS_DONATE_DECLARE);
GetDlgItem(IDC_DECLARE)->SetWindowText(Declaration); GetDlgItem(IDC_DECLARE)->SetWindowText(Declaration);
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE // EXCEPTION: OCX Property Pages should return FALSE
} }
void CDonate::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) void CDonate::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{ {
// TODO: Add your message handler code here and/or call default // TODO: Add your message handler code here and/or call default
CDialog::OnKeyDown(nChar, nRepCnt, nFlags); CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
} }
void CDonate::OnKillFocus(CWnd* pNewWnd) void CDonate::OnKillFocus(CWnd* pNewWnd)
{ {
CDialog::OnKillFocus(pNewWnd); CDialog::OnKillFocus(pNewWnd);
} }

View File

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

View File

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

View File

@@ -1,66 +1,66 @@
#if !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_ #define AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
// Ext2Attribute.h : header file // Ext2Attribute.h : header file
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CExt2Attribute dialog // CExt2Attribute dialog
class CExt2Attribute : public CDialog class CExt2Attribute : public CDialog
{ {
// Construction // Construction
public: public:
CExt2Attribute(CWnd* pParent = NULL); // standard constructor CExt2Attribute(CWnd* pParent = NULL); // standard constructor
CWnd * m_MainDlg; CWnd * m_MainDlg;
PEXT2_VOLUME_PROPERTY3 m_EVP; PEXT2_VOLUME_PROPERTY3 m_EVP;
CString m_DevName; CString m_DevName;
BOOL m_bCdrom; BOOL m_bCdrom;
CHAR m_autoDrv; CHAR m_autoDrv;
CHAR m_fixDrv; CHAR m_fixDrv;
// Dialog Data // Dialog Data
//{{AFX_DATA(CExt2Attribute) //{{AFX_DATA(CExt2Attribute)
enum { IDD = IDD_EXT2_ATTR }; enum { IDD = IDD_EXT2_ATTR };
CString m_Codepage; CString m_Codepage;
BOOL m_bReadonly; BOOL m_bReadonly;
CString m_FixedLetter; CString m_FixedLetter;
CString m_sPrefix; CString m_sPrefix;
CString m_sSuffix; CString m_sSuffix;
BOOL m_bAutoMount; BOOL m_bAutoMount;
BOOL m_bFixMount; BOOL m_bFixMount;
CString m_AutoLetter; CString m_AutoLetter;
CString m_sUID; CString m_sUID;
CString m_sGID; CString m_sGID;
CString m_sEUID; CString m_sEUID;
//}}AFX_DATA //}}AFX_DATA
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExt2Attribute) //{{AFX_VIRTUAL(CExt2Attribute)
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
// Implementation // Implementation
protected: protected:
// Generated message map functions // Generated message map functions
//{{AFX_MSG(CExt2Attribute) //{{AFX_MSG(CExt2Attribute)
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
virtual void OnCancel(); virtual void OnCancel();
virtual void OnOK(); virtual void OnOK();
afx_msg void OnAutomount(); afx_msg void OnAutomount();
afx_msg void OnFixmount(); afx_msg void OnFixmount();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_) #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. // Ext2Mgr.cpp : Defines the class behaviors for the application.
// //
#include "stdafx.h" #include "stdafx.h"
#include "Ext2Mgr.h" #include "Ext2Mgr.h"
#include "Ext2MgrDlg.h" #include "Ext2MgrDlg.h"
#include "Splash.h" #include "Splash.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
#undef THIS_FILE #undef THIS_FILE
static char THIS_FILE[] = __FILE__; static char THIS_FILE[] = __FILE__;
#endif #endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp // CExt2MgrApp
BEGIN_MESSAGE_MAP(CExt2MgrApp, CWinApp) BEGIN_MESSAGE_MAP(CExt2MgrApp, CWinApp)
//{{AFX_MSG_MAP(CExt2MgrApp) //{{AFX_MSG_MAP(CExt2MgrApp)
// NOTE - the ClassWizard will add and remove mapping macros here. // NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code! // DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG //}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp) ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP() END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp construction // CExt2MgrApp construction
CExt2MgrApp::CExt2MgrApp() CExt2MgrApp::CExt2MgrApp()
{ {
// TODO: add construction code here, // TODO: add construction code here,
// Place all significant initialization in InitInstance // Place all significant initialization in InitInstance
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// The one and only CExt2MgrApp object // The one and only CExt2MgrApp object
CExt2MgrApp theApp; CExt2MgrApp theApp;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// globals // globals
DWORD Checkpoint = 1; DWORD Checkpoint = 1;
SERVICE_STATUS ServiceStatus; SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE ServiceHandle; SERVICE_STATUS_HANDLE ServiceHandle;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CExt2MgrApp initialization // CExt2MgrApp initialization
#if 0 #if 0
void WINAPI ManagerServiceEntry(DWORD argc, char **argv); void WINAPI ManagerServiceEntry(DWORD argc, char **argv);
void ManagerServiceThread(void *arg); void ManagerServiceThread(void *arg);
void ManagerStopService(); void ManagerStopService();
void WINAPI ManagerServiceCtrl(DWORD ctrlcode); void WINAPI ManagerServiceCtrl(DWORD ctrlcode);
#endif #endif
BOOL BOOL
ManagerReportStatus( ManagerReportStatus(
SERVICE_STATUS_HANDLE Handle, SERVICE_STATUS_HANDLE Handle,
SERVICE_STATUS* Status, SERVICE_STATUS* Status,
DWORD State, DWORD State,
DWORD Exitcode, DWORD Exitcode,
DWORD Timeout DWORD Timeout
) )
{ {
// If we're in the start state then we don't want the control manager // If we're in the start state then we don't want the control manager
// sending us control messages because they'll confuse us. // sending us control messages because they'll confuse us.
if (State == SERVICE_START_PENDING) { if (State == SERVICE_START_PENDING) {
Status->dwControlsAccepted = 0; Status->dwControlsAccepted = 0;
} else { } else {
Status->dwControlsAccepted = SERVICE_ACCEPT_STOP; Status->dwControlsAccepted = SERVICE_ACCEPT_STOP;
} }
// Save the new status we've been given // Save the new status we've been given
Status->dwCurrentState = State; Status->dwCurrentState = State;
Status->dwWin32ExitCode = Exitcode; Status->dwWin32ExitCode = Exitcode;
Status->dwWaitHint = Timeout; Status->dwWaitHint = Timeout;
// Update the checkpoint variable to let the SCM know that we // Update the checkpoint variable to let the SCM know that we
// haven't died if requests take a long time // haven't died if requests take a long time
if ((State == SERVICE_RUNNING) || (State == SERVICE_STOPPED)) { if ((State == SERVICE_RUNNING) || (State == SERVICE_STOPPED)) {
Status->dwCheckPoint = 0; Status->dwCheckPoint = 0;
} else { } else {
Status->dwCheckPoint = Checkpoint++; Status->dwCheckPoint = Checkpoint++;
} }
// Tell the SCM our new status // Tell the SCM our new status
return SetServiceStatus(Handle, Status); return SetServiceStatus(Handle, Status);
} }
void ManagerStopService() void ManagerStopService()
{ {
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
theApp.m_pMainWnd->SendMessage(WM_TERMINATE_PROGRAM, 0, 0x1234); theApp.m_pMainWnd->SendMessage(WM_TERMINATE_PROGRAM, 0, 0x1234);
} }
void WINAPI ManagerCtrlService(DWORD ctrlcode) void WINAPI ManagerCtrlService(DWORD ctrlcode)
{ {
switch(ctrlcode) switch(ctrlcode)
{ {
case SERVICE_CONTROL_STOP: case SERVICE_CONTROL_STOP:
// STOP : The service must stop // STOP : The service must stop
ManagerStopService(); ManagerStopService();
break; break;
case SERVICE_CONTROL_INTERROGATE: case SERVICE_CONTROL_INTERROGATE:
// QUERY : Service control manager just wants to know our state // QUERY : Service control manager just wants to know our state
break; break;
default: default:
// Control code not recognised // Control code not recognised
break; break;
} }
// Tell the control manager what we're up to. // Tell the control manager what we're up to.
ManagerReportStatus( ManagerReportStatus(
ServiceHandle, ServiceHandle,
&ServiceStatus, &ServiceStatus,
ServiceStatus.dwCurrentState, ServiceStatus.dwCurrentState,
NO_ERROR, 0); NO_ERROR, 0);
} }
VOID __cdecl VOID __cdecl
ManagerStartMain(VOID * arg) ManagerStartMain(VOID * arg)
{ {
BOOL isService = arg != 0; BOOL isService = arg != 0;
CExt2MgrDlg* dlg = (CExt2MgrDlg*)theApp.m_pMainWnd; CExt2MgrDlg* dlg = (CExt2MgrDlg*)theApp.m_pMainWnd;
if (dlg) { if (dlg) {
/* always be quiet ! */ /* always be quiet ! */
if (0 && !dlg->m_bQuiet) { if (0 && !dlg->m_bQuiet) {
CSplash* splash = new CSplash(IDB_ABOUT_SCREEN, RGB(128, 128, 128)); CSplash* splash = new CSplash(IDB_ABOUT_SCREEN, RGB(128, 128, 128));
splash->ShowSplash(); splash->ShowSplash();
dlg->m_splash = splash; dlg->m_splash = splash;
} }
if (isService) { if (isService) {
ManagerReportStatus( ManagerReportStatus(
ServiceHandle, ServiceHandle,
&ServiceStatus, &ServiceStatus,
SERVICE_RUNNING, SERVICE_RUNNING,
NO_ERROR, 0 ); NO_ERROR, 0 );
} }
dlg->DoModal(); dlg->DoModal();
Ext2StopPipeSrv(); Ext2StopPipeSrv();
} }
if (isService) { if (isService) {
ManagerReportStatus( ManagerReportStatus(
ServiceHandle, ServiceHandle,
&ServiceStatus, &ServiceStatus,
SERVICE_STOPPED, SERVICE_STOPPED,
NO_ERROR, 0 ); NO_ERROR, 0 );
} }
} }
void NTAPI void NTAPI
ManagerServiceEntry(DWORD argc, char**argv) ManagerServiceEntry(DWORD argc, char**argv)
{ {
// register the service control handler // register the service control handler
ServiceHandle = ServiceHandle =
RegisterServiceCtrlHandler( RegisterServiceCtrlHandler(
"Ext2Mgr", "Ext2Mgr",
ManagerCtrlService ); ManagerCtrlService );
if (ServiceHandle == 0) { if (ServiceHandle == 0) {
return; return;
} }
// setup standard service state values // setup standard service state values
ServiceStatus.dwServiceType = SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS; ServiceStatus.dwServiceType = SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS;
ServiceStatus.dwServiceSpecificExitCode = 0; ServiceStatus.dwServiceSpecificExitCode = 0;
// report our status to the SCM // report our status to the SCM
if (!ManagerReportStatus( if (!ManagerReportStatus(
ServiceHandle, ServiceHandle,
&ServiceStatus, &ServiceStatus,
SERVICE_START_PENDING, SERVICE_START_PENDING,
NO_ERROR, NO_ERROR,
600000 600000
)) ))
{ {
ManagerReportStatus( ManagerReportStatus(
ServiceHandle, ServiceHandle,
&ServiceStatus, &ServiceStatus,
SERVICE_STOPPED, SERVICE_STOPPED,
NO_ERROR, NO_ERROR,
0); 0);
return; return;
} }
// Now start the service for real // Now start the service for real
_beginthread(ManagerStartMain, 0, (PVOID)TRUE); _beginthread(ManagerStartMain, 0, (PVOID)TRUE);
return; return;
} }
VOID VOID
ManagerStartService(VOID *arg) ManagerStartService(VOID *arg)
{ {
SERVICE_TABLE_ENTRY ManagerSeriveTable[] = SERVICE_TABLE_ENTRY ManagerSeriveTable[] =
{ {
{"Ext2Mgr", (LPSERVICE_MAIN_FUNCTION)ManagerServiceEntry}, {"Ext2Mgr", (LPSERVICE_MAIN_FUNCTION)ManagerServiceEntry},
{NULL, NULL} {NULL, NULL}
}; };
// let service control dispatcher start Ext2Mgr // let service control dispatcher start Ext2Mgr
StartServiceCtrlDispatcher(ManagerSeriveTable); StartServiceCtrlDispatcher(ManagerSeriveTable);
} }
BOOL CExt2MgrApp::InitInstance() BOOL CExt2MgrApp::InitInstance()
{ {
AfxEnableControlContainer(); AfxEnableControlContainer();
HWND hWnd = ::FindWindow(NULL, "Ext2 Volume Manager"); HWND hWnd = ::FindWindow(NULL, "Ext2 Volume Manager");
if (hWnd) { if (hWnd) {
if (::GetWindowLongPtr(hWnd, DWLP_USER) == EXT2_DIALOG_MAGIC) { if (::GetWindowLongPtr(hWnd, DWLP_USER) == EXT2_DIALOG_MAGIC) {
::ShowWindow(hWnd, SW_SHOW); ::ShowWindow(hWnd, SW_SHOW);
::SetForegroundWindow(hWnd); ::SetForegroundWindow(hWnd);
return FALSE; return FALSE;
} }
} }
BOOL bHide = FALSE; BOOL bHide = FALSE;
BOOL bQuiet = FALSE; BOOL bQuiet = FALSE;
BOOL bService = FALSE; BOOL bService = FALSE;
BOOL bInstall = FALSE; BOOL bInstall = FALSE;
BOOL bRemove = FALSE; BOOL bRemove = FALSE;
BOOL bStat = FALSE; BOOL bStat = FALSE;
char * cmds = GetCommandLine(); char * cmds = GetCommandLine();
int i = (int)strlen(cmds); int i = (int)strlen(cmds);
while (--i > 0) { while (--i > 0) {
if (cmds[i] == (char)' ') { if (cmds[i] == (char)' ') {
cmds[i] = 0; cmds[i] = 0;
if ( strlen(&cmds[i+1]) == 5 && if ( strlen(&cmds[i+1]) == 5 &&
_stricmp(&cmds[i+2], "hide") == 0 && _stricmp(&cmds[i+2], "hide") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) { (cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = TRUE; bHide = TRUE;
} else if (strlen(&cmds[i+1]) == 6 && } else if (strlen(&cmds[i+1]) == 6 &&
_stricmp(&cmds[i+2], "quiet") == 0 && _stricmp(&cmds[i+2], "quiet") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) { (cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bQuiet = TRUE; bHide = bQuiet = TRUE;
} else if (strlen(&cmds[i+1]) == 8 && } else if (strlen(&cmds[i+1]) == 8 &&
_stricmp(&cmds[i+2], "install") == 0 && _stricmp(&cmds[i+2], "install") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) { (cmds[i+1] == '/' || cmds[i+1] == '-')) {
bInstall = TRUE; bInstall = TRUE;
} else if (strlen(&cmds[i+1]) == 7 && } else if (strlen(&cmds[i+1]) == 7 &&
_stricmp(&cmds[i+2], "remove") == 0 && _stricmp(&cmds[i+2], "remove") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) { (cmds[i+1] == '/' || cmds[i+1] == '-')) {
bRemove = TRUE; bRemove = TRUE;
} else if (strlen(&cmds[i+1]) == 8 && } else if (strlen(&cmds[i+1]) == 8 &&
_stricmp(&cmds[i+2], "service") == 0 && _stricmp(&cmds[i+2], "service") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) { (cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bService = TRUE; bHide = bService = TRUE;
} else if (strlen(&cmds[i+1]) == 5 && } else if (strlen(&cmds[i+1]) == 5 &&
_stricmp(&cmds[i+2], "stat") == 0 && _stricmp(&cmds[i+2], "stat") == 0 &&
(cmds[i+1] == '/' || cmds[i+1] == '-')) { (cmds[i+1] == '/' || cmds[i+1] == '-')) {
bHide = bStat = TRUE; bHide = bStat = TRUE;
} }
} }
} }
if (bInstall) { if (bInstall) {
Ext2SetManagerAsService(TRUE); Ext2SetManagerAsService(TRUE);
return FALSE; return FALSE;
} }
if (bRemove) { if (bRemove) {
Ext2SetManagerAsService(FALSE); Ext2SetManagerAsService(FALSE);
return FALSE; return FALSE;
} }
Ext2IsX64System(); Ext2IsX64System();
CExt2MgrDlg theDlg; CExt2MgrDlg theDlg;
theDlg.m_bHide = bHide; theDlg.m_bHide = bHide;
theDlg.m_bQuiet = bQuiet = bHide; theDlg.m_bQuiet = bQuiet = bHide;
theDlg.m_bService = bService; theDlg.m_bService = bService;
theDlg.m_bStat = bStat; theDlg.m_bStat = bStat;
m_pMainWnd = &theDlg; m_pMainWnd = &theDlg;
if (bService) { if (bService) {
ManagerStartService(NULL); ManagerStartService(NULL);
} else { } else {
ManagerStartMain(NULL); ManagerStartMain(NULL);
} }
// Since the dialog has been closed, return FALSE so that we exit the // Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump. // application, rather than start the application's message pump.
return FALSE; return FALSE;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,74 +1,74 @@
#if !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_ #define AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
// TreeList.h : header file // TreeList.h : header file
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CTreeList window // CTreeList window
class CTreeList : public CListCtrl class CTreeList : public CListCtrl
{ {
// Construction // Construction
public: public:
CTreeList(); CTreeList();
// Attributes // Attributes
public: public:
/* Focus set or lost */ /* Focus set or lost */
BOOL m_bFocus; BOOL m_bFocus;
/* single item selection */ /* single item selection */
CRect m_SelectionRect; CRect m_SelectionRect;
BOOL m_SelectionFlag; BOOL m_SelectionFlag;
CPoint m_Point; CPoint m_Point;
int m_Rows; int m_Rows;
int m_Columns; int m_Columns;
int m_PrevItem; int m_PrevItem;
/* bitmap information */ /* bitmap information */
HBITMAP m_hBitmap; HBITMAP m_hBitmap;
HDC m_hMemDC; HDC m_hMemDC;
HBITMAP m_hOldBmp; HBITMAP m_hOldBmp;
// Operations // Operations
public: public:
VOID Redraw(); VOID Redraw();
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTreeList) //{{AFX_VIRTUAL(CTreeList)
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM); afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM);
afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct ); afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct );
// Implementation // Implementation
public: public:
virtual ~CTreeList(); virtual ~CTreeList();
int QuerySubItemText(int item, CHAR *Data, int length); int QuerySubItemText(int item, CHAR *Data, int length);
// Generated message map functions // Generated message map functions
protected: protected:
//{{AFX_MSG(CTreeList) //{{AFX_MSG(CTreeList)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_) #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}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by Ext2Mgr.rc // Used by Ext2Mgr.rc
// //
#define MANIFEST_RESOURCE_ID 1 #define MANIFEST_RESOURCE_ID 1
#define ID_RELOAD_DL 3 #define ID_RELOAD_DL 3
#define IDM_ABOUTBOX 0x0010 #define IDM_ABOUTBOX 0x0010
#ifndef RT_MANIFEST #ifndef RT_MANIFEST
#define RT_MANIFEST 24 #define RT_MANIFEST 24
#endif #endif
#define IDM_CLOSE_SPLASH 0x0020 #define IDM_CLOSE_SPLASH 0x0020
#define IDD_ABOUTBOX 100 #define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101 #define IDS_ABOUTBOX 101
#define IDD_EXT2MGR_DIALOG 102 #define IDD_EXT2MGR_DIALOG 102
#define ID_INDICATOR_MESSAGE 103 #define ID_INDICATOR_MESSAGE 103
#define ID_INDICATOR_TIME 104 #define ID_INDICATOR_TIME 104
#define ID_INDICATOR_EXTRA 105 #define ID_INDICATOR_EXTRA 105
#define IDR_MAINFRAME 128 #define IDR_MAINFRAME 128
#define IDR_TRAY 133 #define IDR_TRAY 133
#define IDI_FLOPPY 134 #define IDI_FLOPPY 134
#define IDI_CDROM 135 #define IDI_CDROM 135
#define IDI_DISK 136 #define IDI_DISK 136
#define IDI_DVD 137 #define IDI_DVD 137
#define IDI_DYNAMIC 138 #define IDI_DYNAMIC 138
#define IDR_MENU 139 #define IDR_MENU 139
#define IDB_ABOUT_SCREEN 151 #define IDB_ABOUT_SCREEN 151
#define IDR_STANDARDBAR 162 #define IDR_STANDARDBAR 162
#define IDB_ABOUT_SMALL 163 #define IDB_ABOUT_SMALL 163
#define IDI_BIG_MAINFRAME 164 #define IDI_BIG_MAINFRAME 164
#define IDB_LINE_SEP 166 #define IDB_LINE_SEP 166
#define IDD_SERVICE_MANAGE 167 #define IDD_SERVICE_MANAGE 167
#define IDD_FORMAT 169 #define IDD_FORMAT 169
#define IDD_EXT2_ATTR 170 #define IDD_EXT2_ATTR 170
#define IDD_CHANGE_MOUNTPINT 171 #define IDD_CHANGE_MOUNTPINT 171
#define IDD_NEW_MOUNTPOINT 172 #define IDD_NEW_MOUNTPOINT 172
#define IDD_PROPERTY_DIALOG 173 #define IDD_PROPERTY_DIALOG 173
#define IDD_DONATE_DIALOG 174 #define IDD_DONATE_DIALOG 174
#define IDB_SMALL_PENGUIN 184 #define IDB_SMALL_PENGUIN 184
#define IDB_BIG_PENGUIN 185 #define IDB_BIG_PENGUIN 185
#define IDD_PERFSTAT_DIALOG 186 #define IDD_PERFSTAT_DIALOG 186
#define IDD_PARTITION_TYPE 187 #define IDD_PARTITION_TYPE 187
#define IDD_REMOVE_DEADLETTER 188 #define IDD_REMOVE_DEADLETTER 188
#define IDR_AKEY_EXT2MGR 190 #define IDR_AKEY_EXT2MGR 190
#define IDR_RCDAT_SRV 191 #define IDR_RCDAT_SRV 191
#define IDC_VOLUME_LIST 1001 #define IDC_VOLUME_LIST 1001
#define IDC_AUTHOR 1002 #define IDC_AUTHOR 1002
#define IDC_ABOUT_SHOW 1003 #define IDC_ABOUT_SHOW 1003
#define IDC_PROGRAM 1004 #define IDC_PROGRAM 1004
#define IDC_EXT2FSD 1005 #define IDC_EXT2FSD 1005
#define IDC_DISK_VIEW 1006 #define IDC_DISK_VIEW 1006
#define IDC_DISK_LIST 1007 #define IDC_DISK_LIST 1007
#define IDC_READ_ONLY 1013 #define IDC_READ_ONLY 1013
#define IDC_EXT3_WRITABLE 1014 #define IDC_EXT3_WRITABLE 1014
#define IDC_COMBO_STARTUP 1015 #define IDC_COMBO_STARTUP 1015
#define IDC_COMBO_CODEPAGE 1016 #define IDC_COMBO_CODEPAGE 1016
#define IDC_COMBO_DRVLETTER 1017 #define IDC_COMBO_DRVLETTER 1017
#define IDC_COMBO_AUTOMP 1018 #define IDC_COMBO_AUTOMP 1018
#define IDC_EXT3_AUTOMOUNT 1018 #define IDC_EXT3_AUTOMOUNT 1018
#define IDC_FORMAT_PROGRESS 1019 #define IDC_FORMAT_PROGRESS 1019
#define IDC_COMBO_FS 1020 #define IDC_COMBO_FS 1020
#define IDC_FORMAT_TITLE 1021 #define IDC_FORMAT_TITLE 1021
#define IDC_EDIT_LABEL 1022 #define IDC_EDIT_LABEL 1022
#define IDC_COMBO_CLUSTER 1023 #define IDC_COMBO_CLUSTER 1023
#define IDC_QUICK_FORMAT 1024 #define IDC_QUICK_FORMAT 1024
#define IDC_QUICK_COMPRESS 1025 #define IDC_QUICK_COMPRESS 1025
#define IDC_DRV_LETTER_LIST 1026 #define IDC_DRV_LETTER_LIST 1026
#define IDC_DRVLETTERS_LIST 1028 #define IDC_DRVLETTERS_LIST 1028
#define IDC_PROPERTY_DEVICE 1029 #define IDC_PROPERTY_DEVICE 1029
#define IDC_PROPERTY_SDEV 1030 #define IDC_PROPERTY_SDEV 1030
#define IDC_VENDOR_ID 1031 #define IDC_VENDOR_ID 1031
#define IDC_PRODUCT_ID 1032 #define IDC_PRODUCT_ID 1032
#define IDC_SERIAL_NUMBER 1033 #define IDC_SERIAL_NUMBER 1033
#define IDC_BUS_TYPE 1034 #define IDC_BUS_TYPE 1034
#define IDC_DEVICE_TYPE 1035 #define IDC_DEVICE_TYPE 1035
#define IDC_MEDIA_TYPE 1036 #define IDC_MEDIA_TYPE 1036
#define IDC_TOTAL_SIZE 1037 #define IDC_TOTAL_SIZE 1037
#define IDC_SDEV_CHANGE_MP 1038 #define IDC_SDEV_CHANGE_MP 1038
#define IDC_MOUNT_POINTS 1039 #define IDC_MOUNT_POINTS 1039
#define IDC_VIA_SOURCEFORGE 1040 #define IDC_VIA_SOURCEFORGE 1040
#define IDC_SDEV_SIZE 1041 #define IDC_SDEV_SIZE 1041
#define IDC_VIA_PAYPAL 1042 #define IDC_VIA_PAYPAL 1042
#define IDC_FILE_SYSTEM 1043 #define IDC_FILE_SYSTEM 1043
#define IDC_VIA_TAOBAO 1043 #define IDC_VIA_TAOBAO 1043
#define IDC_SDEV_STATUS 1044 #define IDC_SDEV_STATUS 1044
#define IDC_DECLARE 1045 #define IDC_DECLARE 1045
#define IDC_SERVICE_STATUS 1046 #define IDC_SERVICE_STATUS 1046
#define IDC_SDEV_EXT2_INFO 1047 #define IDC_SDEV_EXT2_INFO 1047
#define IDC_GLOBAL_PREFIX 1047 #define IDC_GLOBAL_PREFIX 1047
#define IDC_SDEV_FREE_SIZE 1048 #define IDC_SDEV_FREE_SIZE 1048
#define IDC_GLOBAL_SUFFIX 1048 #define IDC_GLOBAL_SUFFIX 1048
#define IDC_START_SERVICE 1049 #define IDC_START_SERVICE 1049
#define IDC_PERMANENT_MP 1050 #define IDC_PERMANENT_MP 1050
#define IDC_DOSDEV_MP 1051 #define IDC_DOSDEV_MP 1051
#define IDC_REGISTRY_MP 1052 #define IDC_REGISTRY_MP 1052
#define IDC_EXT2_PREFIX 1053 #define IDC_EXT2_PREFIX 1053
#define IDC_EXT2_SUFFIX 1054 #define IDC_EXT2_SUFFIX 1054
#define IDC_PERFSTAT_INTERVAL 1055 #define IDC_PERFSTAT_INTERVAL 1055
#define IDC_MEMORY_LIST 1056 #define IDC_MEMORY_LIST 1056
#define IDC_IRP_LIST 1057 #define IDC_IRP_LIST 1057
#define IDC_AUTOMOUNT 1058 #define IDC_AUTOMOUNT 1058
#define IDC_FIXMOUNT 1059 #define IDC_FIXMOUNT 1059
#define IDC_PARTTION_TYPE_LIST 1059 #define IDC_PARTTION_TYPE_LIST 1059
#define IDC_PARTITION_TYPE 1060 #define IDC_PARTITION_TYPE 1060
#define IDC_PARTITION_NAME 1062 #define IDC_PARTITION_NAME 1062
#define IDC_DEAD_LETTER_LIST 1063 #define IDC_DEAD_LETTER_LIST 1063
#define IDC_AUTO_REMOVAL 1064 #define IDC_AUTO_REMOVAL 1064
#define IDC_AUTOREMOVALTEXT 1065 #define IDC_AUTOREMOVALTEXT 1065
#define IDC_REMOVAL_CURRENT 1066 #define IDC_REMOVAL_CURRENT 1066
#define IDC_DRIVER 1067 #define IDC_DRIVER 1067
#define IDC_SDEV_QUICK_MOUNT 1068 #define IDC_SDEV_QUICK_MOUNT 1068
#define IDC_EDIT_UID 1070 #define IDC_EDIT_UID 1070
#define IDC_EDIT_GID 1071 #define IDC_EDIT_GID 1071
#define IDC_EDIT_EUID 1072 #define IDC_EDIT_EUID 1072
#define ID_ABOUT 32771 #define ID_ABOUT 32771
#define ID_NEW 32772 #define ID_NEW 32772
#define ID_CHANGE 32773 #define ID_CHANGE 32773
#define ID_REFRESH 32774 #define ID_REFRESH 32774
#define ID_EXIT 32775 #define ID_EXIT 32775
#define ID_SERVICE 32776 #define ID_SERVICE 32776
#define ID_FORMAT 32777 #define ID_FORMAT 32777
#define ID_PROPERTY 32778 #define ID_PROPERTY 32778
#define ID_COPY 32779 #define ID_COPY 32779
#define ID_SHOW_MAIN 32780 #define ID_SHOW_MAIN 32780
#define ID_DRV_LETTER 32781 #define ID_DRV_LETTER 32781
#define ID_DONATE 32782 #define ID_DONATE 32782
#define ID_ADD_MOUNTPOINT 32783 #define ID_ADD_MOUNTPOINT 32783
#define ID_CHANGE_MOUNTPOINT 32784 #define ID_CHANGE_MOUNTPOINT 32784
#define ID_REMOVE_MOUNTPOINT 32785 #define ID_REMOVE_MOUNTPOINT 32785
#define ID_INSTALL_SERVICE 32786 #define ID_INSTALL_SERVICE 32786
#define ID_REMOVE_SERVICE 32787 #define ID_REMOVE_SERVICE 32787
#define ID_ENABLE_AUTOSTART 32788 #define ID_ENABLE_AUTOSTART 32788
#define ID_DISABLE_AUTOSTART 32789 #define ID_DISABLE_AUTOSTART 32789
#define ID_PERFSTAT 32790 #define ID_PERFSTAT 32790
#define ID_PERFSTOP 32791 #define ID_PERFSTOP 32791
#define ID_COPYALL 32792 #define ID_COPYALL 32792
#define ID_QUERYPERF 32793 #define ID_QUERYPERF 32793
#define ID_FLUSH_BUFFER 32794 #define ID_FLUSH_BUFFER 32794
#define ID_CHANGE_PARTTYPE 32795 #define ID_CHANGE_PARTTYPE 32795
#define ID_REMOVE_DEAD_LETTER 32796 #define ID_REMOVE_DEAD_LETTER 32796
#define ID_DRV_QUICK_MOUNT 32797 #define ID_DRV_QUICK_MOUNT 32797
#define ID_DRV_QUICK_REMOVE 32798 #define ID_DRV_QUICK_REMOVE 32798
#define IDS_LISTITEM_FILESYSTEM 57671 #define IDS_LISTITEM_FILESYSTEM 57671
#define IDS_LISTITEM_VOLUME 57672 #define IDS_LISTITEM_VOLUME 57672
#define IDS_LISTITEM_TYPE 57673 #define IDS_LISTITEM_TYPE 57673
#define IDS_LISTITEM_TOTALSIZE 57674 #define IDS_LISTITEM_TOTALSIZE 57674
#define IDS_LISTITEM_USEDSIZE 57675 #define IDS_LISTITEM_USEDSIZE 57675
#define IDS_LISTITEM_CODEPAGE 57676 #define IDS_LISTITEM_CODEPAGE 57676
#define IDS_LISTITEM_DEVOBJ 57677 #define IDS_LISTITEM_DEVOBJ 57677
#define IDS_LISTITEM_PARTID 57678 #define IDS_LISTITEM_PARTID 57678
#define IDS_DISK_TYPE_BASIC 57679 #define IDS_DISK_TYPE_BASIC 57679
#define IDS_DISK_TYPE_DYN 57680 #define IDS_DISK_TYPE_DYN 57680
#define IDS_DONATE_DECLARE 57681 #define IDS_DONATE_DECLARE 57681
#define IDS_SHOW_PROPERTY 57682 #define IDS_SHOW_PROPERTY 57682
#define IDS_COPY_ITEM_TO_CLIP 57683 #define IDS_COPY_ITEM_TO_CLIP 57683
#define IDS_CHANGE_DRVLETTER 57684 #define IDS_CHANGE_DRVLETTER 57684
#define IDS_EXT2_MANAGEMENT 57685 #define IDS_EXT2_MANAGEMENT 57685
#define IDS_FLUSH_BUFFER 57686 #define IDS_FLUSH_BUFFER 57686
#define IDS_CHANGE_PARTID 57687 #define IDS_CHANGE_PARTID 57687
#define IDS_RELOAD_REFRESH 57688 #define IDS_RELOAD_REFRESH 57688
#define IDS_PERFMEM_STAT 57689 #define IDS_PERFMEM_STAT 57689
#define IDS_SERVICE_MANAGE 57690 #define IDS_SERVICE_MANAGE 57690
#define IDS_REMOVE_DEAD_LETTER 57691 #define IDS_REMOVE_DEAD_LETTER 57691
#define IDS_PERFSTAT_NAME 57692 #define IDS_PERFSTAT_NAME 57692
#define IDS_PERFSTAT_UNIT 57693 #define IDS_PERFSTAT_UNIT 57693
#define IDS_PERFSTAT_CURRENT 57694 #define IDS_PERFSTAT_CURRENT 57694
#define IDS_PERFSTAT_SIZE 57695 #define IDS_PERFSTAT_SIZE 57695
#define IDS_PERFSTAT_TOTAL 57696 #define IDS_PERFSTAT_TOTAL 57696
#define IDS_PERFSTAT_PROCESSING 57697 #define IDS_PERFSTAT_PROCESSING 57697
#define IDS_PERSTAT_PROCESSED 57698 #define IDS_PERSTAT_PROCESSED 57698
#define IDS_PERFSTAT_PROCESSED 57698 #define IDS_PERFSTAT_PROCESSED 57698
#define IDS_DRV_QUICK_MOUNT 57699 #define IDS_DRV_QUICK_MOUNT 57699
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 192 #define _APS_NEXT_RESOURCE_VALUE 192
#define _APS_NEXT_COMMAND_VALUE 32799 #define _APS_NEXT_COMMAND_VALUE 32799
#define _APS_NEXT_CONTROL_VALUE 1071 #define _APS_NEXT_CONTROL_VALUE 1071
#define _APS_NEXT_SYMED_VALUE 106 #define _APS_NEXT_SYMED_VALUE 106
#endif #endif
#endif #endif

View File

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

View File

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

View File

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