Ext4Fsd master
168
Ext2Mgr/DelDeadLetter.cpp
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
// DelDeadLetter.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "DelDeadLetter.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDelDeadLetter dialog
|
||||||
|
|
||||||
|
|
||||||
|
CDelDeadLetter::CDelDeadLetter(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CDelDeadLetter::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CDelDeadLetter)
|
||||||
|
m_sDrvLetter = _T("");
|
||||||
|
m_bAutoRemoval = g_bAutoRemoveDeadLetters;
|
||||||
|
m_bKeepIt = TRUE;
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDelDeadLetter::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CDelDeadLetter)
|
||||||
|
DDX_CBString(pDX, IDC_DEAD_LETTER_LIST, m_sDrvLetter);
|
||||||
|
DDX_Check(pDX, IDC_AUTO_REMOVAL, m_bAutoRemoval);
|
||||||
|
DDX_Check(pDX, IDC_REMOVAL_CURRENT, m_bKeepIt);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CDelDeadLetter, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CDelDeadLetter)
|
||||||
|
ON_BN_CLICKED(ID_RELOAD_DL, OnReloadDl)
|
||||||
|
ON_BN_CLICKED(IDC_AUTO_REMOVAL, OnAutoRemoval)
|
||||||
|
ON_BN_CLICKED(IDC_AUTOREMOVALTEXT, OnAutoremovaltext)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDelDeadLetter message handlers
|
||||||
|
|
||||||
|
void CDelDeadLetter::OnOK()
|
||||||
|
{
|
||||||
|
CHAR drvChar;
|
||||||
|
PEXT2_LETTER drvLetter = NULL;
|
||||||
|
UpdateData(TRUE);
|
||||||
|
|
||||||
|
drvChar = m_sDrvLetter.GetAt(0);
|
||||||
|
|
||||||
|
if ((drvChar >= '0') && (drvChar <= '9')) {
|
||||||
|
drvLetter = &drvDigits[drvChar - '0'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((drvChar >= 'A') && (drvChar <= 'Z')) {
|
||||||
|
drvLetter = &drvLetters[drvChar - 'A'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drvLetter) {
|
||||||
|
if (AfxMessageBox("Warning: the driver letter might be still used. Are you\r\n"
|
||||||
|
" sure that make it's a real dead driver letter ?", MB_YESNO) == IDYES) {
|
||||||
|
|
||||||
|
Ext2RemoveMountPoint(drvLetter, !m_bKeepIt);
|
||||||
|
Ext2RemoveDosSymLink(drvLetter->Letter);
|
||||||
|
UpdateDeadLetterList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CDelDeadLetter::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
UpdateDeadLetterList();
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CDelDeadLetter::UpdateDeadLetterList()
|
||||||
|
{
|
||||||
|
ULONGLONG LetterMask = -1;
|
||||||
|
DWORD i, j;
|
||||||
|
PEXT2_VOLUME volume;
|
||||||
|
PEXT2_DISK disk;
|
||||||
|
PEXT2_PARTITION part;
|
||||||
|
PEXT2_CDROM cdrom;
|
||||||
|
CString str;
|
||||||
|
|
||||||
|
CComboBox *cbList = (CComboBox *)GetDlgItem(IDC_DEAD_LETTER_LIST);
|
||||||
|
|
||||||
|
cbList->ResetContent();
|
||||||
|
|
||||||
|
for (volume = gVols; volume != NULL; volume = volume->Next) {
|
||||||
|
LetterMask &= ~(volume->DrvLetters);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < g_nDisks; i++) {
|
||||||
|
disk = &gDisks[i];
|
||||||
|
if (disk->DataParts == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (j=0; j < disk->NumParts; j++) {
|
||||||
|
part = &disk->DataParts[j];
|
||||||
|
if (part) {
|
||||||
|
LetterMask &= ~(part->DrvLetters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < g_nCdroms; i++) {
|
||||||
|
cdrom = &gCdroms[i];
|
||||||
|
LetterMask &= ~(cdrom->DrvLetters);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i < 10; i++) {
|
||||||
|
if (drvDigits[i].bUsed && (drvDigits[i].Extent == NULL) &&
|
||||||
|
(LetterMask & (((ULONGLONG) 1) << (i + 32)) ) ) {
|
||||||
|
str.Format("%c: ", drvDigits[i].Letter);
|
||||||
|
str += drvDigits[i].SymLink;
|
||||||
|
cbList->AddString(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i <26; i++) {
|
||||||
|
if (drvLetters[i].bUsed && (drvLetters[i].Extent == NULL) &&
|
||||||
|
(LetterMask & (((ULONGLONG) 1) << i)) ) {
|
||||||
|
str.Format("%c: ", drvLetters[i].Letter);
|
||||||
|
str += drvLetters[i].SymLink;
|
||||||
|
cbList->AddString(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (cbList->GetCount() == 0) {
|
||||||
|
AfxMessageBox("No dead driver letters exist :)", MB_OK|MB_ICONINFORMATION);
|
||||||
|
EndDialog(TRUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cbList->SetCurSel(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDelDeadLetter::OnReloadDl()
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
UpdateDeadLetterList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDelDeadLetter::OnAutoRemoval()
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
UpdateData(TRUE);
|
||||||
|
g_bAutoRemoveDeadLetters = m_bAutoRemoval;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDelDeadLetter::OnAutoremovaltext()
|
||||||
|
{
|
||||||
|
}
|
||||||
54
Ext2Mgr/DelDeadLetter.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#if !defined(AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_)
|
||||||
|
#define AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// DelDeadLetter.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDelDeadLetter dialog
|
||||||
|
|
||||||
|
class CDelDeadLetter : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CDelDeadLetter(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CDelDeadLetter)
|
||||||
|
enum { IDD = IDD_REMOVE_DEADLETTER };
|
||||||
|
CString m_sDrvLetter;
|
||||||
|
BOOL m_bAutoRemoval;
|
||||||
|
BOOL m_bKeepIt;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CDelDeadLetter)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
VOID UpdateDeadLetterList();
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CDelDeadLetter)
|
||||||
|
virtual void OnOK();
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnReloadDl();
|
||||||
|
afx_msg void OnAutoRemoval();
|
||||||
|
afx_msg void OnAutoremovaltext();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_DELDEADLETTER_H__289C3418_93AB_43C7_9E64_60C382CCF93B__INCLUDED_)
|
||||||
136
Ext2Mgr/DiskBox.cpp
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
// DiskBox.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "DiskBox.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDiskBox
|
||||||
|
|
||||||
|
CDiskBox::CDiskBox()
|
||||||
|
{
|
||||||
|
m_nID = IDC_PROPERTY_DEVICE;
|
||||||
|
m_nLeft = 10;
|
||||||
|
m_nSize = 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
CDiskBox::~CDiskBox()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CDiskBox, CButton)
|
||||||
|
//{{AFX_MSG_MAP(CDiskBox)
|
||||||
|
ON_WM_SETFOCUS()
|
||||||
|
ON_CBN_SELCHANGE(IDC_PROPERTY_DEVICE, OnSelectChanged)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDiskBox message handlers
|
||||||
|
|
||||||
|
void CDiskBox::OnSelectChanged()
|
||||||
|
{
|
||||||
|
GetParent()->SendMessage(WM_GROUP_BOX_UPDATED, 'GB', 'DVLU');
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskBox::PreSubclassWindow()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Make sure that this control has the BS_ICON style set.
|
||||||
|
// If not, it behaves very strangely:
|
||||||
|
// It erases itself if the user TABs to controls in the dialog,
|
||||||
|
// unless the user first clicks it. Very strange!!
|
||||||
|
//
|
||||||
|
|
||||||
|
ModifyStyle(0, BS_ICON|WS_TABSTOP|WS_GROUP);
|
||||||
|
|
||||||
|
CString strTitle;
|
||||||
|
GetWindowText(strTitle);
|
||||||
|
|
||||||
|
int nWidth = AssemblingTitle();
|
||||||
|
|
||||||
|
CRect r;
|
||||||
|
GetWindowRect(&r);
|
||||||
|
ScreenToClient(r);
|
||||||
|
|
||||||
|
r.OffsetRect(m_nLeft, 0);
|
||||||
|
r.bottom = r.top + m_nSize;
|
||||||
|
r.right = r.left + m_nSize + nWidth;
|
||||||
|
|
||||||
|
m_ComboBox.Create(WS_CHILD | CBS_DROPDOWN | WS_VSCROLL |
|
||||||
|
CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST,
|
||||||
|
r, this, m_nID);
|
||||||
|
m_ComboBox.SetFont(GetFont(), true);
|
||||||
|
m_ComboBox.ShowWindow(SW_SHOW);
|
||||||
|
|
||||||
|
SetListboxHeight(m_ComboBox.m_hWnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskBox::SetListboxHeight(HWND hWnd)
|
||||||
|
{
|
||||||
|
RECT rc;
|
||||||
|
|
||||||
|
::SendMessage(hWnd, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
||||||
|
::GetClientRect(hWnd, &rc);
|
||||||
|
int cyClient= rc.bottom - rc.top;
|
||||||
|
|
||||||
|
::GetWindowRect(hWnd, &rc);
|
||||||
|
int cxListbox = rc.right - rc.left;
|
||||||
|
int cyListbox = rc.bottom - rc.top;
|
||||||
|
|
||||||
|
if (g_nDisks + g_nCdroms > 8) {
|
||||||
|
cyListbox = 18*8;
|
||||||
|
} else if (g_nDisks + g_nCdroms > 4) {
|
||||||
|
cyListbox = max(80, 18 * (g_nDisks + g_nCdroms));
|
||||||
|
} else {
|
||||||
|
cyListbox = 80;
|
||||||
|
}
|
||||||
|
::SetWindowPos(hWnd, NULL, 0, 0,
|
||||||
|
cxListbox, cyListbox,
|
||||||
|
SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS|
|
||||||
|
SWP_NOOWNERZORDER|SWP_NOZORDER
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CDiskBox::AssemblingTitle()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// The group box title needs to be erased, but I need to keep
|
||||||
|
// the border away from the check box text. I create a string
|
||||||
|
// of spaces (' ') that is the same length as the title was
|
||||||
|
// plus the size of the checkbox. plus a little more.
|
||||||
|
//
|
||||||
|
|
||||||
|
CString strOldTitle, strNewTitle;
|
||||||
|
GetWindowText(strOldTitle);
|
||||||
|
|
||||||
|
CClientDC dc(this);
|
||||||
|
CFont* pOldFont = dc.SelectObject(GetFont());
|
||||||
|
|
||||||
|
CSize czText = dc.GetTextExtent(strOldTitle);
|
||||||
|
int nRet = czText.cx;
|
||||||
|
int nTarget = czText.cx + m_nSize;
|
||||||
|
|
||||||
|
while(czText.cx < nTarget)
|
||||||
|
{
|
||||||
|
strNewTitle.Insert(0, ' ');
|
||||||
|
czText = dc.GetTextExtent(strNewTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.SelectObject(pOldFont);
|
||||||
|
|
||||||
|
SetWindowText(strNewTitle);
|
||||||
|
return nRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskBox::OnSetFocus(CWnd* pOldWnd)
|
||||||
|
{
|
||||||
|
CButton::OnSetFocus(pOldWnd);
|
||||||
|
m_ComboBox.SetFocus();
|
||||||
|
}
|
||||||
60
Ext2Mgr/DiskBox.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
#if !defined(AFX_DISK_BOX_H_)
|
||||||
|
#define AFX_DISK_BOX_H_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// DiskBox.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDiskBox window
|
||||||
|
|
||||||
|
class CDiskBox : public CButton
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CDiskBox();
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
void SetListboxHeight(HWND);
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CDiskBox)
|
||||||
|
protected:
|
||||||
|
virtual void PreSubclassWindow();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CDiskBox();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CDiskBox)
|
||||||
|
afx_msg void OnSetFocus(CWnd* pOldWnd);
|
||||||
|
afx_msg void OnSelectChanged();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
int m_nID;
|
||||||
|
int m_nLeft;
|
||||||
|
int m_nSize;
|
||||||
|
|
||||||
|
CComboBox m_ComboBox;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
int AssemblingTitle();
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif
|
||||||
78
Ext2Mgr/DlgView.cpp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
// DlgView.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "DlgView.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDlgView
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CDlgView, CScrollView)
|
||||||
|
|
||||||
|
CDlgView::CDlgView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CDlgView::~CDlgView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CDlgView, CScrollView)
|
||||||
|
//{{AFX_MSG_MAP(CDlgView)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDlgView drawing
|
||||||
|
|
||||||
|
void CDlgView::OnDraw(CDC* pDC)
|
||||||
|
{
|
||||||
|
CRect rectClient;
|
||||||
|
CSize size = GetTotalSize();
|
||||||
|
|
||||||
|
rectClient.left = 0;
|
||||||
|
rectClient.top = 0;
|
||||||
|
rectClient.bottom = size.cy;
|
||||||
|
rectClient.right = size.cx;
|
||||||
|
|
||||||
|
rectClient.DeflateRect(15, 15);
|
||||||
|
pDC->DrawText(m_csText, rectClient, DT_LEFT);
|
||||||
|
|
||||||
|
rectClient.InflateRect(5, 5);
|
||||||
|
pDC->Draw3dRect(rectClient, RGB(0, 0, 255), RGB(0, 0, 255));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDlgView diagnostics
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CDlgView::AssertValid() const
|
||||||
|
{
|
||||||
|
CScrollView::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDlgView::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CScrollView::Dump(dc);
|
||||||
|
}
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDlgView message handlers
|
||||||
|
|
||||||
|
void CDlgView::OnInitialUpdate()
|
||||||
|
{
|
||||||
|
CScrollView::OnInitialUpdate();
|
||||||
|
|
||||||
|
// TODO: Add your specialized code here and/or call the base class
|
||||||
|
|
||||||
|
}
|
||||||
55
Ext2Mgr/DlgView.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#if !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_)
|
||||||
|
#define AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// DlgView.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDlgView view
|
||||||
|
|
||||||
|
class CDlgView : public CScrollView
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
CDlgView(); // protected constructor used by dynamic creation
|
||||||
|
DECLARE_DYNCREATE(CDlgView)
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
CString m_csText;
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CDlgView)
|
||||||
|
public:
|
||||||
|
virtual void OnInitialUpdate();
|
||||||
|
protected:
|
||||||
|
virtual void OnDraw(CDC* pDC); // overridden to draw this view
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
virtual ~CDlgView();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CDlgView)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_DLGVIEW1_H__5E7226FD_BC8E_4B9C_9769_80E378804A93__INCLUDED_)
|
||||||
95
Ext2Mgr/Donate.cpp
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
// Donate.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "Donate.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDonate dialog
|
||||||
|
|
||||||
|
|
||||||
|
CDonate::CDonate(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CDonate::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CDonate)
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDonate::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CDonate)
|
||||||
|
DDX_Control(pDX, IDC_VIA_SOURCEFORGE, m_SF);
|
||||||
|
DDX_Control(pDX, IDC_VIA_PAYPAL, m_Paypal);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CDonate, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CDonate)
|
||||||
|
ON_WM_KEYDOWN()
|
||||||
|
ON_WM_KILLFOCUS()
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDonate message handlers
|
||||||
|
|
||||||
|
BOOL CDonate::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
//Set the target URL
|
||||||
|
m_SF.SetLinkUrl("http://sourceforge.net/project/project_donations.php?group_id=43775");
|
||||||
|
//Enable showing the Tooltip
|
||||||
|
m_SF.ActiveToolTip(TRUE);
|
||||||
|
//Set the Tooltiptext
|
||||||
|
m_SF.SetTootTipText("Donate to Ext2Fsd group via SourceForge.");
|
||||||
|
|
||||||
|
|
||||||
|
//Set the target URL
|
||||||
|
m_Paypal.SetLinkUrl("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=m@ext2fsd.com&item_name=Donation&return=https://sourceforge.net/projects/ext2fsd");
|
||||||
|
//Enable showing the Tooltip
|
||||||
|
m_Paypal.ActiveToolTip(TRUE);
|
||||||
|
//Set the Tooltiptext
|
||||||
|
m_Paypal.SetTootTipText("Donate to Ext2Fsd group via Paypal.");
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
CHAR Declaration [] =
|
||||||
|
"\r\nExt2Fsd is an open source software. It acts as a bridge between Windows and Linux, making life easier to access Linux partitions under Windows systems.\r\n"
|
||||||
|
"\r\nCurrently there are still lots of jobs left to make a fully functional file system driver, such as complete ext3 support, Linux LVM, Windows Vista, Longhorn. Especially Vista and Longhorn will need driver signing.\r\n"
|
||||||
|
"\r\nNow I'm the only part-time developer. It needs about two full time developers to implement that job and also it needs some hardwares such SMP system, SCSI array for debugging and testing.\r\n"
|
||||||
|
"\r\nI'll try my best to make it out. I'm dreaming of that day.\r\n"
|
||||||
|
"\r\nAny help will be highly appreciated. Thanks and best wishes.\r\n"
|
||||||
|
"\r\n\r\nYours sincerely,\r\n"
|
||||||
|
"Matt";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CString Declaration;
|
||||||
|
Declaration.LoadString(IDS_DONATE_DECLARE);
|
||||||
|
|
||||||
|
GetDlgItem(IDC_DECLARE)->SetWindowText(Declaration);
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDonate::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||||||
|
{
|
||||||
|
// TODO: Add your message handler code here and/or call default
|
||||||
|
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDonate::OnKillFocus(CWnd* pNewWnd)
|
||||||
|
{
|
||||||
|
CDialog::OnKillFocus(pNewWnd);
|
||||||
|
|
||||||
|
}
|
||||||
50
Ext2Mgr/Donate.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#if !defined(AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_)
|
||||||
|
#define AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// Donate.h : header file
|
||||||
|
//
|
||||||
|
#include "HyperLink.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDonate dialog
|
||||||
|
|
||||||
|
class CDonate : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CDonate(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CDonate)
|
||||||
|
enum { IDD = IDD_DONATE_DIALOG };
|
||||||
|
CMyHyperLink m_SF;
|
||||||
|
CMyHyperLink m_Paypal;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CDonate)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CDonate)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||||
|
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_DONATE_H__40066CB2_EB28_4B9A_B51A_6CF889E4D5CB__INCLUDED_)
|
||||||
447
Ext2Mgr/Ext2Attribute.cpp
Normal file
@@ -0,0 +1,447 @@
|
|||||||
|
// Ext2Attribute.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "Ext2Attribute.h"
|
||||||
|
#include "Ext2MgrDlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2Attribute dialog
|
||||||
|
|
||||||
|
|
||||||
|
CExt2Attribute::CExt2Attribute(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CExt2Attribute::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CExt2Attribute)
|
||||||
|
m_Codepage = _T("");
|
||||||
|
m_bReadonly = FALSE;
|
||||||
|
m_FixedLetter = _T("");
|
||||||
|
m_AutoLetter = _T("");
|
||||||
|
m_sPrefix = _T("");
|
||||||
|
m_sSuffix = _T("");
|
||||||
|
m_bAutoMount = FALSE;
|
||||||
|
m_bFixMount = FALSE;
|
||||||
|
m_autoDrv = 0;
|
||||||
|
m_sUID = _T("----");
|
||||||
|
m_sGID = _T("----");
|
||||||
|
m_sEUID = _T("----");
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
|
||||||
|
m_MainDlg = NULL;
|
||||||
|
m_EVP = NULL;
|
||||||
|
m_DevName = _T("");
|
||||||
|
m_bCdrom = FALSE;
|
||||||
|
m_fixDrv = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CExt2Attribute::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CExt2Attribute)
|
||||||
|
DDX_CBString(pDX, IDC_COMBO_CODEPAGE, m_Codepage);
|
||||||
|
DDX_Check(pDX, IDC_READ_ONLY, m_bReadonly);
|
||||||
|
DDX_CBString(pDX, IDC_COMBO_DRVLETTER, m_FixedLetter);
|
||||||
|
DDX_Text(pDX, IDC_EXT2_PREFIX, m_sPrefix);
|
||||||
|
DDV_MaxChars(pDX, m_sPrefix, 31);
|
||||||
|
DDX_Text(pDX, IDC_EXT2_SUFFIX, m_sSuffix);
|
||||||
|
DDV_MaxChars(pDX, m_sSuffix, 31);
|
||||||
|
DDX_Check(pDX, IDC_AUTOMOUNT, m_bAutoMount);
|
||||||
|
DDX_Check(pDX, IDC_FIXMOUNT, m_bFixMount);
|
||||||
|
DDX_CBString(pDX, IDC_COMBO_AUTOMP, m_AutoLetter);
|
||||||
|
DDX_Text(pDX, IDC_EDIT_UID, m_sUID);
|
||||||
|
DDV_MaxChars(pDX, m_sUID, 8);
|
||||||
|
DDX_Text(pDX, IDC_EDIT_GID, m_sGID);
|
||||||
|
DDV_MaxChars(pDX, m_sGID, 8);
|
||||||
|
DDX_Text(pDX, IDC_EDIT_EUID, m_sEUID);
|
||||||
|
DDV_MaxChars(pDX, m_sEUID, 8);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CExt2Attribute, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CExt2Attribute)
|
||||||
|
ON_BN_CLICKED(IDC_AUTOMOUNT, OnAutomount)
|
||||||
|
ON_BN_CLICKED(IDC_FIXMOUNT, OnFixmount)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2Attribute message handlers
|
||||||
|
|
||||||
|
BOOL CExt2Attribute::OnInitDialog()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
CString s;
|
||||||
|
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
m_Codepage = m_EVP->Codepage;
|
||||||
|
m_bReadonly = m_EVP->bReadonly || m_bCdrom;
|
||||||
|
if (m_bCdrom) {
|
||||||
|
SET_WIN(IDC_READ_ONLY, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_bCdrom) {
|
||||||
|
m_fixDrv = Ext2QueryMountPoint(
|
||||||
|
m_DevName.GetBuffer(MAX_PATH));
|
||||||
|
} else {
|
||||||
|
m_fixDrv = Ext2QueryRegistryMountPoint(
|
||||||
|
m_DevName.GetBuffer(MAX_PATH));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_fixDrv) {
|
||||||
|
m_bAutoMount = FALSE;
|
||||||
|
m_bFixMount = TRUE;
|
||||||
|
m_FixedLetter.Format("%c:", m_fixDrv);
|
||||||
|
} else {
|
||||||
|
m_FixedLetter = " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_EVP->Flags2 & EXT2_VPROP3_USERIDS) {
|
||||||
|
m_sUID.Format("%u", m_EVP->uid);
|
||||||
|
m_sGID.Format("%u", m_EVP->gid);
|
||||||
|
if (m_EVP->EIDS) {
|
||||||
|
m_sEUID.Format("%u", m_EVP->euid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_EVP->DrvLetter) {
|
||||||
|
|
||||||
|
m_autoDrv = m_EVP->DrvLetter & 0x7F;
|
||||||
|
if (m_autoDrv >= 'a' && m_autoDrv <= 'z')
|
||||||
|
m_autoDrv = (CHAR)toupper(m_autoDrv);
|
||||||
|
else if (m_autoDrv >= 'A' && m_autoDrv <= 'Z') {
|
||||||
|
} else {
|
||||||
|
m_autoDrv = 0;
|
||||||
|
}
|
||||||
|
if (m_autoDrv == 0)
|
||||||
|
m_AutoLetter.Format(" ");
|
||||||
|
else
|
||||||
|
m_AutoLetter.Format("%C:", m_autoDrv);
|
||||||
|
m_bAutoMount = !m_bFixMount;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sPrefix = m_EVP->sHidingPrefix;
|
||||||
|
m_sSuffix = m_EVP->sHidingSuffix;
|
||||||
|
|
||||||
|
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
|
||||||
|
if (cbCodepage) {
|
||||||
|
cbCodepage->ResetContent();
|
||||||
|
i = 0;
|
||||||
|
while (gCodepages[i]) {
|
||||||
|
cbCodepage->AddString(gCodepages[i++]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_COMBO_DRVLETTER);
|
||||||
|
CComboBox *cbAutoLetter = (CComboBox *)GetDlgItem(IDC_COMBO_AUTOMP);
|
||||||
|
|
||||||
|
PEXT2_LETTER drvLetter = NULL;
|
||||||
|
cbDrvLetter->AddString(" ");
|
||||||
|
cbAutoLetter->AddString(" ");
|
||||||
|
|
||||||
|
if (m_autoDrv) {
|
||||||
|
m_AutoLetter.Format("%C:", m_autoDrv);
|
||||||
|
cbAutoLetter->AddString(m_AutoLetter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_fixDrv) {
|
||||||
|
cbDrvLetter->AddString(m_FixedLetter);
|
||||||
|
}
|
||||||
|
for (i=2; i < 26; i++) {
|
||||||
|
drvLetter = &drvLetters[i];
|
||||||
|
if (!drvLetter->bUsed) {
|
||||||
|
s.Format("%c:", drvLetter->Letter);
|
||||||
|
cbDrvLetter->AddString(s);
|
||||||
|
cbAutoLetter->AddString(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
for (i=0; i < 10; i++) {
|
||||||
|
drvLetter = &drvDigits[i];
|
||||||
|
if (!drvLetter->bUsed) {
|
||||||
|
s.Format("%c:", drvLetter->Letter);
|
||||||
|
cbDrvLetter->AddString(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_CHECK(IDC_AUTOMOUNT, m_bAutoMount);
|
||||||
|
SET_CHECK(IDC_FIXMOUNT, m_bFixMount);
|
||||||
|
|
||||||
|
SET_WIN(IDC_COMBO_DRVLETTER, m_bFixMount);
|
||||||
|
SET_WIN(IDC_COMBO_AUTOMP, m_bAutoMount);
|
||||||
|
|
||||||
|
UpdateData(FALSE);
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CExt2Attribute::OnCancel()
|
||||||
|
{
|
||||||
|
// TODO: Add extra cleanup here
|
||||||
|
|
||||||
|
CDialog::OnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL IsStringAllDigits(CString s)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < s.GetLength(); i++) {
|
||||||
|
if (!isdigit(s.GetAt(i)))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CExt2Attribute::OnOK()
|
||||||
|
{
|
||||||
|
NT::NTSTATUS status;
|
||||||
|
HANDLE Handle = NULL;
|
||||||
|
CHAR DrvLetter = 0;
|
||||||
|
CString str;
|
||||||
|
BOOL rc = FALSE;
|
||||||
|
BOOL dc = FALSE;
|
||||||
|
|
||||||
|
UpdateData(TRUE);
|
||||||
|
|
||||||
|
if (m_Codepage.IsEmpty()) {
|
||||||
|
m_Codepage = "default";
|
||||||
|
}
|
||||||
|
|
||||||
|
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
|
||||||
|
if (cbCodepage) {
|
||||||
|
int rc = cbCodepage->FindStringExact(-1, m_Codepage);
|
||||||
|
if (rc == CB_ERR) {
|
||||||
|
AfxMessageBox("Invalid codepage type: "+m_Codepage, MB_OK|MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_EVP->bReadonly && m_EVP->bExt3 && !m_bReadonly) {
|
||||||
|
str = "Are you sure to enable writing support"
|
||||||
|
" on this EXT3 volume with Ext2Fsd ?";
|
||||||
|
if (AfxMessageBox(str, MB_YESNO) != IDYES) {
|
||||||
|
m_EVP->bExt3Writable = FALSE;
|
||||||
|
} else {
|
||||||
|
m_EVP->bExt3Writable = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize structures to communicate with ext2fsd service*/
|
||||||
|
m_EVP->Magic = EXT2_VOLUME_PROPERTY_MAGIC;
|
||||||
|
m_EVP->Command = APP_CMD_SET_PROPERTY3;
|
||||||
|
m_EVP->Flags = 0;
|
||||||
|
m_EVP->Flags2 = 0;
|
||||||
|
m_EVP->bReadonly = (BOOLEAN)m_bReadonly;
|
||||||
|
memset(m_EVP->Codepage, 0, CODEPAGE_MAXLEN);
|
||||||
|
strcpy((CHAR *)m_EVP->Codepage, m_Codepage.GetBuffer(CODEPAGE_MAXLEN));
|
||||||
|
|
||||||
|
/* initialize hiding filter patterns */
|
||||||
|
if (m_sPrefix.IsEmpty()) {
|
||||||
|
m_EVP->bHidingPrefix = FALSE;
|
||||||
|
memset(m_EVP->sHidingPrefix, 0, HIDINGPAT_LEN);
|
||||||
|
} else {
|
||||||
|
strcpy( m_EVP->sHidingPrefix,
|
||||||
|
m_sPrefix.GetBuffer(m_sPrefix.GetLength()));
|
||||||
|
m_EVP->bHidingPrefix = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_sSuffix.IsEmpty()) {
|
||||||
|
m_EVP->bHidingSuffix = FALSE;
|
||||||
|
memset(m_EVP->sHidingSuffix, 0, HIDINGPAT_LEN);
|
||||||
|
} else {
|
||||||
|
strcpy(m_EVP->sHidingSuffix,
|
||||||
|
m_sSuffix.GetBuffer(m_sSuffix.GetLength()));
|
||||||
|
m_EVP->bHidingSuffix = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_bFixMount) {
|
||||||
|
|
||||||
|
if (!m_FixedLetter.IsEmpty() && m_FixedLetter.GetAt(0) != ' ') {
|
||||||
|
DrvLetter = m_FixedLetter.GetAt(0);
|
||||||
|
} else {
|
||||||
|
DrvLetter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DrvLetter != m_fixDrv) {
|
||||||
|
|
||||||
|
if (m_fixDrv != 0) {
|
||||||
|
Ext2SetRegistryMountPoint(&m_fixDrv, NULL, FALSE);
|
||||||
|
Ext2RemoveDriveLetter(DrvLetter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DrvLetter != 0) {
|
||||||
|
Ext2SetRegistryMountPoint(&DrvLetter, m_DevName.GetBuffer(MAX_PATH), TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DrvLetter && !m_fixDrv) {
|
||||||
|
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
|
||||||
|
dc = TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (m_fixDrv != 0) {
|
||||||
|
Ext2RemoveDriveLetter(m_fixDrv);
|
||||||
|
Ext2SetRegistryMountPoint(&m_fixDrv, NULL, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_sUID.IsEmpty() && !m_sGID.IsEmpty()) {
|
||||||
|
if (IsStringAllDigits(m_sUID) &&
|
||||||
|
IsStringAllDigits(m_sGID)) {
|
||||||
|
m_EVP->Flags2 |= EXT2_VPROP3_USERIDS;
|
||||||
|
m_EVP->uid = (USHORT)atoi(m_sUID.GetBuffer(8));
|
||||||
|
m_EVP->gid = (USHORT)atoi(m_sGID.GetBuffer(8));
|
||||||
|
if (!m_sEUID.IsEmpty() &&
|
||||||
|
IsStringAllDigits(m_sEUID)) {
|
||||||
|
m_EVP->EIDS = TRUE;
|
||||||
|
m_EVP->euid = (USHORT)atoi(m_sEUID.GetBuffer(8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_bAutoMount) {
|
||||||
|
|
||||||
|
if (m_bCdrom) {
|
||||||
|
m_EVP->DrvLetter = 0;
|
||||||
|
Ext2StorePropertyinRegistry(m_EVP);
|
||||||
|
goto store_evp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_AutoLetter.IsEmpty() && m_AutoLetter.GetAt(0) != ' ') {
|
||||||
|
DrvLetter = m_AutoLetter.GetAt(0);
|
||||||
|
} else {
|
||||||
|
DrvLetter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DrvLetter > 'Z' || DrvLetter < 'A') {
|
||||||
|
DrvLetter = 0;
|
||||||
|
}
|
||||||
|
m_EVP->DrvLetter = DrvLetter | 0x80;
|
||||||
|
m_EVP->Flags2 |= EXT2_VPROP3_AUTOMOUNT;
|
||||||
|
Ext2StorePropertyinRegistry(m_EVP);
|
||||||
|
|
||||||
|
if (m_autoDrv) {
|
||||||
|
if (DrvLetter && Ext2IsDrvLetterAvailable(DrvLetter)) {
|
||||||
|
Ext2RemoveDriveLetter(m_autoDrv);
|
||||||
|
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
|
||||||
|
dc = TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (DrvLetter && Ext2IsDrvLetterAvailable(DrvLetter)) {
|
||||||
|
Ext2MountVolumeAs(m_DevName.GetBuffer(MAX_PATH), DrvLetter);
|
||||||
|
dc = TRUE;
|
||||||
|
} else {
|
||||||
|
Ext2MountVolume(m_DevName.GetBuffer(MAX_PATH));
|
||||||
|
dc = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
m_EVP->DrvLetter =0 ;
|
||||||
|
Ext2StorePropertyinRegistry(m_EVP);
|
||||||
|
|
||||||
|
if (m_autoDrv && !Ext2IsDrvLetterAvailable(m_autoDrv)) {
|
||||||
|
Ext2RemoveDriveLetter(m_autoDrv);
|
||||||
|
dc = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
store_evp:
|
||||||
|
|
||||||
|
status = Ext2Open(m_DevName.GetBuffer(m_DevName.GetLength()),
|
||||||
|
&Handle, EXT2_DESIRED_ACCESS);
|
||||||
|
if (!NT_SUCCESS(status)) {
|
||||||
|
str.Format("Ext2Fsd service is not started.\n");
|
||||||
|
AfxMessageBox(str, MB_OK | MB_ICONSTOP);
|
||||||
|
rc = TRUE;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = Ext2SetExt2Property(Handle, m_EVP);
|
||||||
|
|
||||||
|
if (rc) {
|
||||||
|
/* don't bother user at all */
|
||||||
|
#if 0
|
||||||
|
str = "Ext2 volume settings updated successfully!";
|
||||||
|
if (dc) {
|
||||||
|
str += "\r\n\r\nFixed mountpoint needs reboot to take into affect.";
|
||||||
|
}
|
||||||
|
AfxMessageBox(str, MB_OK | MB_ICONINFORMATION);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
AfxMessageBox("Failed to save the Ext2 settings !",
|
||||||
|
MB_OK | MB_ICONWARNING);
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
Ext2Close(&Handle);
|
||||||
|
|
||||||
|
if (rc) {
|
||||||
|
CDialog::OnOK();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CExt2Attribute::OnAutomount()
|
||||||
|
{
|
||||||
|
UpdateData(TRUE);
|
||||||
|
SET_WIN(IDC_COMBO_AUTOMP, m_bAutoMount);
|
||||||
|
/*
|
||||||
|
if (m_bAutoMount) {
|
||||||
|
AfxMessageBox("This function is still in experiment. You'd better set a\r\n"
|
||||||
|
"fixed mountpoint for fixed disk or set partition type to\r\n"
|
||||||
|
"0x07 (NTFS) or FAT for non-bootable partition. For removable\r\n"
|
||||||
|
"disks like usb-disk it's better to use the second method.");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (m_bAutoMount) {
|
||||||
|
/*
|
||||||
|
CComboBox *cbAutoLetter = (CComboBox *)GetDlgItem(IDC_COMBO_AUTOMP);
|
||||||
|
if (cbAutoLetter && cbAutoLetter->GetCurSel() == CB_ERR) {
|
||||||
|
cbAutoLetter->SetCurSel(1);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
m_bFixMount = FALSE;
|
||||||
|
SET_CHECK(IDC_FIXMOUNT, FALSE);
|
||||||
|
SET_WIN(IDC_COMBO_DRVLETTER, FALSE);
|
||||||
|
|
||||||
|
UpdateData(FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CExt2Attribute::OnFixmount()
|
||||||
|
{
|
||||||
|
UpdateData(TRUE);
|
||||||
|
SET_WIN(IDC_COMBO_DRVLETTER, m_bFixMount);
|
||||||
|
|
||||||
|
if (m_bFixMount) {
|
||||||
|
/*
|
||||||
|
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_COMBO_DRVLETTER);
|
||||||
|
if (cbDrvLetter && cbDrvLetter->GetCurSel() == CB_ERR) {
|
||||||
|
cbDrvLetter->SetCurSel(1);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
m_bAutoMount = FALSE;
|
||||||
|
SET_CHECK(IDC_AUTOMOUNT, FALSE);
|
||||||
|
SET_WIN(IDC_COMBO_AUTOMP, FALSE);
|
||||||
|
|
||||||
|
UpdateData(FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
66
Ext2Mgr/Ext2Attribute.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#if !defined(AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_)
|
||||||
|
#define AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// Ext2Attribute.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2Attribute dialog
|
||||||
|
|
||||||
|
class CExt2Attribute : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CExt2Attribute(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
CWnd * m_MainDlg;
|
||||||
|
PEXT2_VOLUME_PROPERTY3 m_EVP;
|
||||||
|
CString m_DevName;
|
||||||
|
BOOL m_bCdrom;
|
||||||
|
CHAR m_autoDrv;
|
||||||
|
CHAR m_fixDrv;
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CExt2Attribute)
|
||||||
|
enum { IDD = IDD_EXT2_ATTR };
|
||||||
|
CString m_Codepage;
|
||||||
|
BOOL m_bReadonly;
|
||||||
|
CString m_FixedLetter;
|
||||||
|
CString m_sPrefix;
|
||||||
|
CString m_sSuffix;
|
||||||
|
BOOL m_bAutoMount;
|
||||||
|
BOOL m_bFixMount;
|
||||||
|
CString m_AutoLetter;
|
||||||
|
CString m_sUID;
|
||||||
|
CString m_sGID;
|
||||||
|
CString m_sEUID;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CExt2Attribute)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CExt2Attribute)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
virtual void OnCancel();
|
||||||
|
virtual void OnOK();
|
||||||
|
afx_msg void OnAutomount();
|
||||||
|
afx_msg void OnFixmount();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_EXT2ATTRIBUTE_H__59ED803F_08E4_4ADD_BDAE_E86EF7708DEF__INCLUDED_)
|
||||||
301
Ext2Mgr/Ext2Mgr.cpp
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
// Ext2Mgr.cpp : Defines the class behaviors for the application.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "Ext2Mgr.h"
|
||||||
|
#include "Ext2MgrDlg.h"
|
||||||
|
#include "Splash.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2MgrApp
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CExt2MgrApp, CWinApp)
|
||||||
|
//{{AFX_MSG_MAP(CExt2MgrApp)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code!
|
||||||
|
//}}AFX_MSG
|
||||||
|
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2MgrApp construction
|
||||||
|
|
||||||
|
CExt2MgrApp::CExt2MgrApp()
|
||||||
|
{
|
||||||
|
// TODO: add construction code here,
|
||||||
|
// Place all significant initialization in InitInstance
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// The one and only CExt2MgrApp object
|
||||||
|
|
||||||
|
CExt2MgrApp theApp;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// globals
|
||||||
|
|
||||||
|
DWORD Checkpoint = 1;
|
||||||
|
|
||||||
|
SERVICE_STATUS ServiceStatus;
|
||||||
|
SERVICE_STATUS_HANDLE ServiceHandle;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2MgrApp initialization
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void WINAPI ManagerServiceEntry(DWORD argc, char **argv);
|
||||||
|
void ManagerServiceThread(void *arg);
|
||||||
|
void ManagerStopService();
|
||||||
|
void WINAPI ManagerServiceCtrl(DWORD ctrlcode);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
ManagerReportStatus(
|
||||||
|
SERVICE_STATUS_HANDLE Handle,
|
||||||
|
SERVICE_STATUS* Status,
|
||||||
|
DWORD State,
|
||||||
|
DWORD Exitcode,
|
||||||
|
DWORD Timeout
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// If we're in the start state then we don't want the control manager
|
||||||
|
// sending us control messages because they'll confuse us.
|
||||||
|
if (State == SERVICE_START_PENDING) {
|
||||||
|
Status->dwControlsAccepted = 0;
|
||||||
|
} else {
|
||||||
|
Status->dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the new status we've been given
|
||||||
|
Status->dwCurrentState = State;
|
||||||
|
Status->dwWin32ExitCode = Exitcode;
|
||||||
|
Status->dwWaitHint = Timeout;
|
||||||
|
|
||||||
|
// Update the checkpoint variable to let the SCM know that we
|
||||||
|
// haven't died if requests take a long time
|
||||||
|
if ((State == SERVICE_RUNNING) || (State == SERVICE_STOPPED)) {
|
||||||
|
Status->dwCheckPoint = 0;
|
||||||
|
} else {
|
||||||
|
Status->dwCheckPoint = Checkpoint++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tell the SCM our new status
|
||||||
|
return SetServiceStatus(Handle, Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManagerStopService()
|
||||||
|
{
|
||||||
|
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
|
||||||
|
theApp.m_pMainWnd->SendMessage(WM_TERMINATE_PROGRAM, 0, 0x1234);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WINAPI ManagerCtrlService(DWORD ctrlcode)
|
||||||
|
{
|
||||||
|
switch(ctrlcode)
|
||||||
|
{
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_STOP:
|
||||||
|
// STOP : The service must stop
|
||||||
|
ManagerStopService();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_INTERROGATE:
|
||||||
|
// QUERY : Service control manager just wants to know our state
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Control code not recognised
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tell the control manager what we're up to.
|
||||||
|
ManagerReportStatus(
|
||||||
|
ServiceHandle,
|
||||||
|
&ServiceStatus,
|
||||||
|
ServiceStatus.dwCurrentState,
|
||||||
|
NO_ERROR, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID __cdecl
|
||||||
|
ManagerStartMain(VOID * arg)
|
||||||
|
{
|
||||||
|
BOOL isService = (BOOL) arg;
|
||||||
|
CExt2MgrDlg* dlg = (CExt2MgrDlg*)theApp.m_pMainWnd;
|
||||||
|
|
||||||
|
if (dlg) {
|
||||||
|
|
||||||
|
/* always be quiet ! */
|
||||||
|
if (0 && !dlg->m_bQuiet) {
|
||||||
|
CSplash* splash = new CSplash(IDB_ABOUT_SCREEN, RGB(128, 128, 128));
|
||||||
|
splash->ShowSplash();
|
||||||
|
dlg->m_splash = splash;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isService) {
|
||||||
|
ManagerReportStatus(
|
||||||
|
ServiceHandle,
|
||||||
|
&ServiceStatus,
|
||||||
|
SERVICE_RUNNING,
|
||||||
|
NO_ERROR, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
dlg->DoModal();
|
||||||
|
|
||||||
|
Ext2StopPipeSrv();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isService) {
|
||||||
|
ManagerReportStatus(
|
||||||
|
ServiceHandle,
|
||||||
|
&ServiceStatus,
|
||||||
|
SERVICE_STOPPED,
|
||||||
|
NO_ERROR, 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NTAPI
|
||||||
|
ManagerServiceEntry(DWORD argc, char**argv)
|
||||||
|
{
|
||||||
|
// register the service control handler
|
||||||
|
ServiceHandle =
|
||||||
|
RegisterServiceCtrlHandler(
|
||||||
|
"Ext2Mgr",
|
||||||
|
ManagerCtrlService );
|
||||||
|
|
||||||
|
if (ServiceHandle == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup standard service state values
|
||||||
|
ServiceStatus.dwServiceType = SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS;
|
||||||
|
ServiceStatus.dwServiceSpecificExitCode = 0;
|
||||||
|
|
||||||
|
// report our status to the SCM
|
||||||
|
if (!ManagerReportStatus(
|
||||||
|
ServiceHandle,
|
||||||
|
&ServiceStatus,
|
||||||
|
SERVICE_START_PENDING,
|
||||||
|
NO_ERROR,
|
||||||
|
600000
|
||||||
|
))
|
||||||
|
{
|
||||||
|
ManagerReportStatus(
|
||||||
|
ServiceHandle,
|
||||||
|
&ServiceStatus,
|
||||||
|
SERVICE_STOPPED,
|
||||||
|
NO_ERROR,
|
||||||
|
0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now start the service for real
|
||||||
|
_beginthread(ManagerStartMain, 0, (PVOID)TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ManagerStartService(VOID *arg)
|
||||||
|
{
|
||||||
|
SERVICE_TABLE_ENTRY ManagerSeriveTable[] =
|
||||||
|
{
|
||||||
|
{"Ext2Mgr", (LPSERVICE_MAIN_FUNCTION)ManagerServiceEntry},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
// let service control dispatcher start Ext2Mgr
|
||||||
|
StartServiceCtrlDispatcher(ManagerSeriveTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CExt2MgrApp::InitInstance()
|
||||||
|
{
|
||||||
|
AfxEnableControlContainer();
|
||||||
|
|
||||||
|
HWND hWnd = ::FindWindow(NULL, "Ext2 Volume Manager");
|
||||||
|
if (hWnd) {
|
||||||
|
if (::GetWindowLongPtr(hWnd, DWLP_USER) == EXT2_DIALOG_MAGIC) {
|
||||||
|
::ShowWindow(hWnd, SW_SHOW);
|
||||||
|
::SetForegroundWindow(hWnd);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL bHide = FALSE;
|
||||||
|
BOOL bQuiet = FALSE;
|
||||||
|
BOOL bService = FALSE;
|
||||||
|
BOOL bInstall = FALSE;
|
||||||
|
BOOL bRemove = FALSE;
|
||||||
|
BOOL bStat = FALSE;
|
||||||
|
|
||||||
|
char * cmds = GetCommandLine();
|
||||||
|
int i = (int)strlen(cmds);
|
||||||
|
while (--i > 0) {
|
||||||
|
if (cmds[i] == (char)' ') {
|
||||||
|
cmds[i] = 0;
|
||||||
|
if ( strlen(&cmds[i+1]) == 5 &&
|
||||||
|
_stricmp(&cmds[i+2], "hide") == 0 &&
|
||||||
|
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
|
||||||
|
bHide = TRUE;
|
||||||
|
} else if (strlen(&cmds[i+1]) == 6 &&
|
||||||
|
_stricmp(&cmds[i+2], "quiet") == 0 &&
|
||||||
|
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
|
||||||
|
bHide = bQuiet = TRUE;
|
||||||
|
} else if (strlen(&cmds[i+1]) == 8 &&
|
||||||
|
_stricmp(&cmds[i+2], "install") == 0 &&
|
||||||
|
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
|
||||||
|
bInstall = TRUE;
|
||||||
|
} else if (strlen(&cmds[i+1]) == 7 &&
|
||||||
|
_stricmp(&cmds[i+2], "remove") == 0 &&
|
||||||
|
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
|
||||||
|
bRemove = TRUE;
|
||||||
|
} else if (strlen(&cmds[i+1]) == 8 &&
|
||||||
|
_stricmp(&cmds[i+2], "service") == 0 &&
|
||||||
|
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
|
||||||
|
bHide = bService = TRUE;
|
||||||
|
} else if (strlen(&cmds[i+1]) == 5 &&
|
||||||
|
_stricmp(&cmds[i+2], "stat") == 0 &&
|
||||||
|
(cmds[i+1] == '/' || cmds[i+1] == '-')) {
|
||||||
|
bHide = bStat = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bInstall) {
|
||||||
|
Ext2SetManagerAsService(TRUE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bRemove) {
|
||||||
|
Ext2SetManagerAsService(FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext2IsX64System();
|
||||||
|
|
||||||
|
CExt2MgrDlg theDlg;
|
||||||
|
|
||||||
|
theDlg.m_bHide = bHide;
|
||||||
|
theDlg.m_bQuiet = bQuiet = bHide;
|
||||||
|
theDlg.m_bService = bService;
|
||||||
|
theDlg.m_bStat = bStat;
|
||||||
|
|
||||||
|
m_pMainWnd = &theDlg;
|
||||||
|
|
||||||
|
if (bService) {
|
||||||
|
ManagerStartService(NULL);
|
||||||
|
} else {
|
||||||
|
ManagerStartMain(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since the dialog has been closed, return FALSE so that we exit the
|
||||||
|
// application, rather than start the application's message pump.
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
19
Ext2Mgr/Ext2Mgr.exe.manifest
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly
|
||||||
|
xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||||
|
manifestVersion="1.0">
|
||||||
|
<assemblyIdentity version=SXS_ASSEMBLY_VERSION
|
||||||
|
processorArchitecture=SXS_PROCESSOR_ARCHITECTURE
|
||||||
|
name=SXS_ASSEMBLY_NAME/>
|
||||||
|
<description>Ext2Mgr</description>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges>
|
||||||
|
<requestedExecutionLevel
|
||||||
|
level="requireAdministrator"
|
||||||
|
uiAccess="false"
|
||||||
|
/>
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
</assembly>
|
||||||
49
Ext2Mgr/Ext2Mgr.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
// Ext2Mgr.h : main header file for the EXT2MGR application
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_)
|
||||||
|
#define AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error include 'stdafx.h' before including this file for PCH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // main symbols
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2MgrApp:
|
||||||
|
// See Ext2Mgr.cpp for the implementation of this class
|
||||||
|
//
|
||||||
|
|
||||||
|
class CExt2MgrApp : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CExt2MgrApp();
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CExt2MgrApp)
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
|
||||||
|
//{{AFX_MSG(CExt2MgrApp)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_EXT2MGR_H__6D13DACF_307A_4633_B268_5F4F4C2AD90E__INCLUDED_)
|
||||||
1161
Ext2Mgr/Ext2Mgr.rc
Normal file
20
Ext2Mgr/Ext2Mgr.sln
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ext2Mgr", "Ext2Mgr.vcproj", "{F0E304B5-AF20-49F7-8183-5994C6EA889D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{F0E304B5-AF20-49F7-8183-5994C6EA889D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{F0E304B5-AF20-49F7-8183-5994C6EA889D}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{F0E304B5-AF20-49F7-8183-5994C6EA889D}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{F0E304B5-AF20-49F7-8183-5994C6EA889D}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
914
Ext2Mgr/Ext2Mgr.vcproj
Normal file
@@ -0,0 +1,914 @@
|
|||||||
|
<?xml version="1.0" encoding="gb2312"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="Ext2Mgr"
|
||||||
|
ProjectGUID="{F0E304B5-AF20-49F7-8183-5994C6EA889D}"
|
||||||
|
RootNamespace="Ext2Mgr"
|
||||||
|
Keyword="MFCProj"
|
||||||
|
TargetFrameworkVersion="0"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory=".\Debug"
|
||||||
|
IntermediateDirectory=".\Debug"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||||
|
UseOfMFC="2"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
MkTypLibCompatible="true"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
TargetEnvironment="1"
|
||||||
|
TypeLibraryName=".\Debug/Ext2Mgr.tlb"
|
||||||
|
HeaderFileName=""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/I /Zm500 "
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="$(WDKINC)"
|
||||||
|
PreprocessorDefinitions="_DEBUG;_WINDOWS;_WIN32_WINNT=0x0500;"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="0"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderThrough="stdafx.h"
|
||||||
|
PrecompiledHeaderFile=".\Debug/Ext2Mgr.pch"
|
||||||
|
AssemblerListingLocation=".\Debug/"
|
||||||
|
ObjectFile=".\Debug/"
|
||||||
|
ProgramDataBaseFileName=".\Debug/"
|
||||||
|
BrowseInformation="1"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="ntdll.lib setupapi.lib"
|
||||||
|
OutputFile=".\Debug/Ext2Mgr.exe"
|
||||||
|
LinkIncremental="2"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
AdditionalLibraryDirectories="$(WDKLIBX86)"
|
||||||
|
GenerateManifest="true"
|
||||||
|
UACExecutionLevel="2"
|
||||||
|
IgnoreAllDefaultLibraries="false"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
ProgramDatabaseFile=".\Debug/Ext2Mgr.pdb"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
OutputFile=".\Debug/Ext2Mgr.bsc"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory=".\Release"
|
||||||
|
IntermediateDirectory=".\Release"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||||
|
UseOfMFC="2"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
MkTypLibCompatible="true"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
TargetEnvironment="1"
|
||||||
|
TypeLibraryName=".\Release/Ext2Mgr.tlb"
|
||||||
|
HeaderFileName=""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="$(WDKINC)"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0500;_CRT_SECURE_NO_WARNINGS=1;"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderThrough="stdafx.h"
|
||||||
|
PrecompiledHeaderFile=".\Release/Ext2Mgr.pch"
|
||||||
|
AssemblerListingLocation=".\Release/"
|
||||||
|
ObjectFile=".\Release/"
|
||||||
|
ProgramDataBaseFileName=".\Release/"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="ntdll.lib setupapi.lib"
|
||||||
|
OutputFile=".\Release/Ext2Mgr.exe"
|
||||||
|
LinkIncremental="1"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
AdditionalLibraryDirectories="$(WDKLIBX86)"
|
||||||
|
GenerateManifest="true"
|
||||||
|
UACExecutionLevel="2"
|
||||||
|
IgnoreAllDefaultLibraries="false"
|
||||||
|
ProgramDatabaseFile=".\Release/Ext2Mgr.pdb"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
OutputFile=".\Release/Ext2Mgr.bsc"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="DelDeadLetter.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="DiskBox.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Donate.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="enumDisk.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Ext2Attribute.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Ext2Mgr.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Ext2MgrDlg.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Ext2Pipe.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="HyperLink.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="MountPoints.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="PartBox.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="PartitionType.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="PerfStatDlg.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Properties.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="SelectDrvLetter.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ServiceManage.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Splash.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="StdAfx.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
UsePrecompiledHeader="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
UsePrecompiledHeader="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="SysTray.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Toolbar.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="TreeList.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="DelDeadLetter.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="DiskBox.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Donate.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="enumDisk.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Ext2Attribute.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ext2fs.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Ext2Mgr.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Ext2MgrDlg.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="HyperLink.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="MountPoints.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ntdll.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="PartBox.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="PartitionType.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="PerfStatDlg.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Properties.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Resource.h"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
Description="Making help include file..."
|
||||||
|
CommandLine="echo. >"hlp\$(TargetName).hm"
echo // Commands (ID_* and IDM_*) >>"hlp\$(TargetName).hm"
makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h >>"hlp\$(TargetName).hm"
echo. >>"hlp\$(TargetName).hm"
echo // Prompts (IDP_*) >>"hlp\$(TargetName).hm"
makehm IDP_,HIDP_,0x30000 resource.h >>"hlp\$(TargetName).hm"
echo. >>"hlp\$(TargetName).hm"
echo // Resources (IDR_*) >>"hlp\$(TargetName).hm"
makehm IDR_,HIDR_,0x20000 resource.h >>"hlp\$(TargetName).hm"
echo. >>"hlp\$(TargetName).hm"
echo // Dialogs (IDD_*) >>"hlp\$(TargetName).hm"
makehm IDD_,HIDD_,0x20000 resource.h >>"hlp\$(TargetName).hm"
echo. >>"hlp\$(TargetName).hm"
echo // Frame Controls (IDW_*) >>"hlp\$(TargetName).hm"
makehm IDW_,HIDW_,0x50000 resource.h >>"hlp\$(TargetName).hm"
"
|
||||||
|
Outputs="hlp\$(TargetName).hm"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
Description="Making help include file..."
|
||||||
|
CommandLine="echo. >"hlp\$(TargetName).hm"
echo // Commands (ID_* and IDM_*) >>"hlp\$(TargetName).hm"
makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h >>"hlp\$(TargetName).hm"
echo. >>"hlp\$(TargetName).hm"
echo // Prompts (IDP_*) >>"hlp\$(TargetName).hm"
makehm IDP_,HIDP_,0x30000 resource.h >>"hlp\$(TargetName).hm"
echo. >>"hlp\$(TargetName).hm"
echo // Resources (IDR_*) >>"hlp\$(TargetName).hm"
makehm IDR_,HIDR_,0x20000 resource.h >>"hlp\$(TargetName).hm"
echo. >>"hlp\$(TargetName).hm"
echo // Dialogs (IDD_*) >>"hlp\$(TargetName).hm"
makehm IDD_,HIDD_,0x20000 resource.h >>"hlp\$(TargetName).hm"
echo. >>"hlp\$(TargetName).hm"
echo // Frame Controls (IDW_*) >>"hlp\$(TargetName).hm"
makehm IDW_,HIDW_,0x50000 resource.h >>"hlp\$(TargetName).hm"
"
|
||||||
|
Outputs="hlp\$(TargetName).hm"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="SelectDrvLetter.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ServiceManage.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Splash.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="StdAfx.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="SysTray.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Toolbar.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="TreeList.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="types.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="res\about.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\abouts.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\bigmain.ico"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\cdrom.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\disk.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\dvd.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\dynamic.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\Ext2Mgr.ico"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Ext2Mgr.rc"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\Ext2Mgr.rc2"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\Ext2Srv\Release\X86\Ext2Srv.exe"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\floppy.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\line.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\images\penguin.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\images\smallpenguin.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\toolbar.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Help Files"
|
||||||
|
Filter="cnt;rtf"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
<File
|
||||||
|
RelativePath="ReadMe.txt"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
<Global
|
||||||
|
Name="RESOURCE_FILE"
|
||||||
|
Value="Ext2Mgr.rc"
|
||||||
|
/>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
2131
Ext2Mgr/Ext2MgrDlg.cpp
Normal file
206
Ext2Mgr/Ext2MgrDlg.h
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
// Ext2MgrDlg.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_)
|
||||||
|
#define AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "SysTray.h"
|
||||||
|
#include "Toolbar.h"
|
||||||
|
#include "splash.h"
|
||||||
|
#include "donate.h"
|
||||||
|
#include "TreeList.h"
|
||||||
|
#include "HyperLink.h"
|
||||||
|
#include "Mountpoints.h"
|
||||||
|
#include "Properties.h"
|
||||||
|
#include "ServiceManage.h"
|
||||||
|
#include "Ext2Attribute.h"
|
||||||
|
#include "PerfStatDlg.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2List window
|
||||||
|
|
||||||
|
class CExt2List : public CListCtrl
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CExt2List();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
CPoint m_Point;
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
int QuerySubItemText(int item, CHAR *Data, int length);
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CExt2List)
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CExt2List();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CExt2List)
|
||||||
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CExt2MgrDlg dialog
|
||||||
|
|
||||||
|
class CDlgView;
|
||||||
|
|
||||||
|
class CExt2MgrDlg : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CExt2MgrDlg(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CExt2MgrDlg)
|
||||||
|
enum { IDD = IDD_EXT2MGR_DIALOG };
|
||||||
|
CTreeList m_DiskView;
|
||||||
|
CExt2List m_VolumeList;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CExt2MgrDlg)
|
||||||
|
public:
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* routines */
|
||||||
|
PVOID QuerySelectedItem(PBOOL bIsExt2);
|
||||||
|
VOID DriversChangeNotify(ULONG, BOOL);
|
||||||
|
VOID DriverLetterChangeNotify(CHAR, BOOL);
|
||||||
|
|
||||||
|
VOID DriverChangeNotify(PEXT2_LETTER, BOOL);
|
||||||
|
|
||||||
|
VOID UpdateVolume(PEXT2_VOLUME volume);
|
||||||
|
VOID UpdateCdrom(PEXT2_CDROM cdrom) ;
|
||||||
|
VOID UpdatePartition(PEXT2_PARTITION part);
|
||||||
|
VOID RegisterDeviceInterface(GUID, PHDEVNOTIFY);
|
||||||
|
VOID OnFlush();
|
||||||
|
VOID OnPartType();
|
||||||
|
VOID OnRemoveDeadLetter();
|
||||||
|
|
||||||
|
VOID OnKeyupVolumeList();
|
||||||
|
VOID OnKeyupDiskList();
|
||||||
|
|
||||||
|
ULONG m_type;
|
||||||
|
PVOID m_sdev;
|
||||||
|
|
||||||
|
/* attributes */
|
||||||
|
CSplash * m_splash;
|
||||||
|
CMenu m_Menu;
|
||||||
|
|
||||||
|
CFont m_MSSanS;
|
||||||
|
BOOL m_bHide;
|
||||||
|
BOOL m_bQuiet;
|
||||||
|
BOOL m_bService;
|
||||||
|
BOOL m_bStat;
|
||||||
|
|
||||||
|
CPerfStatDlg * m_PerfDlg;
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
HICON m_hIcon;
|
||||||
|
|
||||||
|
CSystemTray m_Tray;
|
||||||
|
CStatusBar m_bar;
|
||||||
|
CImageList m_ImageList;
|
||||||
|
|
||||||
|
BOOL m_bFsStarted;
|
||||||
|
BOOL m_bHandleChange;
|
||||||
|
BOOL m_bFocusVolume;
|
||||||
|
BOOL m_bFocusDisk;
|
||||||
|
LONG m_IndexVolume;
|
||||||
|
LONG m_IndexDisk;
|
||||||
|
|
||||||
|
HACCEL m_hAccel;
|
||||||
|
HDEVNOTIFY m_hUsbNotify;
|
||||||
|
|
||||||
|
/* global parameters */
|
||||||
|
ULONG m_nStartmode;
|
||||||
|
CString m_Codepage;
|
||||||
|
BOOL m_bExt3Writable;
|
||||||
|
BOOL m_bReadonly;
|
||||||
|
CString m_srvStatus;
|
||||||
|
CString m_sPrefix;
|
||||||
|
CString m_sSuffix;
|
||||||
|
BOOL m_bAutoMount;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CExt2MgrDlg)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
virtual void OnWindowPosChanging(WINDOWPOS* lpwndpos);
|
||||||
|
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||||
|
afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD dwData);
|
||||||
|
afx_msg void OnDestroy();
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg HCURSOR OnQueryDragIcon();
|
||||||
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
|
afx_msg void OnChangeProperty();
|
||||||
|
afx_msg void OnRefresh();
|
||||||
|
afx_msg void OnFormat();
|
||||||
|
afx_msg void OnService();
|
||||||
|
virtual void OnCancel();
|
||||||
|
afx_msg void OnAbout();
|
||||||
|
afx_msg void OnExit();
|
||||||
|
virtual void OnOK();
|
||||||
|
afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
|
||||||
|
afx_msg void OnDblclkDiskList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnKillfocusDiskList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnRclickDiskList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnDblclkVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnKillfocusVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnRclickVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnClickDiskList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnClickVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnSetfocusDiskList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnSetfocusVolumeList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnProperty();
|
||||||
|
afx_msg void OnDonate();
|
||||||
|
afx_msg void OnCopy();
|
||||||
|
afx_msg void OnInstallService();
|
||||||
|
afx_msg void OnRemoveService();
|
||||||
|
afx_msg void OnEnableAutorun();
|
||||||
|
afx_msg void OnDisableAutorun();
|
||||||
|
afx_msg void OnTimer(UINT nIDEvent);
|
||||||
|
afx_msg void OnDrvLetter();
|
||||||
|
afx_msg void OnDrvQuickMount();
|
||||||
|
afx_msg void OnShowMain();
|
||||||
|
afx_msg void OnHelp();
|
||||||
|
afx_msg void OnPerfStat();
|
||||||
|
afx_msg void OnPerfStop();
|
||||||
|
afx_msg void OnCopyAll();
|
||||||
|
//}}AFX_MSG
|
||||||
|
afx_msg LRESULT OnTrayNotification(WPARAM wParam=0,LPARAM lParam=0);
|
||||||
|
afx_msg LRESULT OnTerminate(WPARAM wParam=0,LPARAM lParam=0);
|
||||||
|
afx_msg LRESULT OnMountPointNotify(WPARAM wParam=0,LPARAM lParam=0);
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_EXT2MGRDLG_H__EACC693E_C531_48BA_A0FD_4AFB090CCB29__INCLUDED_)
|
||||||
864
Ext2Mgr/Ext2Pipe.cpp
Normal file
@@ -0,0 +1,864 @@
|
|||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include <dbt.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include < tlhelp32.h>
|
||||||
|
#include "..\Ext2Srv\Ext2Pipe.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* global defintions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CL_ASSERT(cond) do {switch('x') {case (cond): case 0: break;}} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* glboal variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* pipe handles */
|
||||||
|
|
||||||
|
HANDLE g_hPipe = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* function body
|
||||||
|
*/
|
||||||
|
|
||||||
|
int Ext2StartSrv();
|
||||||
|
|
||||||
|
HANDLE Ext2OpenPipe(CHAR *PipeName)
|
||||||
|
{
|
||||||
|
DWORD rc;
|
||||||
|
|
||||||
|
if (g_hPipe != NULL && g_hPipe != INVALID_HANDLE_VALUE) {
|
||||||
|
return g_hPipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
retry:
|
||||||
|
|
||||||
|
// open pipe (created by Ext2Srv)
|
||||||
|
g_hPipe = CreateFile(PipeName,
|
||||||
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
|
|
||||||
|
// exit if the pipe handle is valid.
|
||||||
|
if (g_hPipe == INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
|
// exit if an error other than ERROR_PIPE_BUSY occurs.
|
||||||
|
rc = GetLastError();
|
||||||
|
if (rc != ERROR_PIPE_BUSY) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// all pipe instances are busy, so wait for 20 seconds.
|
||||||
|
if (!WaitNamedPipe(PipeName, 20000)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext2StartSrv();
|
||||||
|
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_hPipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ext2ClosePipe()
|
||||||
|
{
|
||||||
|
if (g_hPipe != NULL && g_hPipe != INVALID_HANDLE_VALUE) {
|
||||||
|
CloseHandle(g_hPipe);
|
||||||
|
g_hPipe = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL Ext2ReadPipe(HANDLE p, PVOID b, DWORD c, PDWORD r)
|
||||||
|
{
|
||||||
|
DWORD bytes = 0, total = 0;
|
||||||
|
BOOL rc = FALSE;
|
||||||
|
|
||||||
|
while (total < c) {
|
||||||
|
rc = ReadFile(p,(PCHAR)b + total, c - total, &bytes, NULL);
|
||||||
|
if (rc) {
|
||||||
|
total += bytes;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r)
|
||||||
|
*r = total;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL Ext2WritePipe(HANDLE p, PVOID b, DWORD c, PDWORD w)
|
||||||
|
{
|
||||||
|
DWORD bytes = 0, total = 0;
|
||||||
|
BOOL rc = FALSE;
|
||||||
|
|
||||||
|
while (total < c) {
|
||||||
|
rc = WriteFile(p, (PCHAR)b + total, c - total, &bytes, NULL);
|
||||||
|
if (rc) {
|
||||||
|
total += bytes;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w)
|
||||||
|
*w = total;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD Ext2PipeControl(PPIPE_REQ *pr, ULONG *len)
|
||||||
|
{
|
||||||
|
PPIPE_REQ p;
|
||||||
|
PREQ_QUERY_DRV q;
|
||||||
|
PIPE_REQ ac;
|
||||||
|
DWORD le;
|
||||||
|
DWORD bytes = 0;
|
||||||
|
DWORD rc = 0;
|
||||||
|
int tries = 0;
|
||||||
|
|
||||||
|
p = *pr;
|
||||||
|
q = (PREQ_QUERY_DRV)p->data;
|
||||||
|
|
||||||
|
Reopen_try:
|
||||||
|
|
||||||
|
/* just try to connect pipe anyway */
|
||||||
|
if (NULL == Ext2OpenPipe(EXT2_MGR_SRV)) {
|
||||||
|
printf("failed to connect to server.\n");
|
||||||
|
if (Ext2StartExt2Srv()) {
|
||||||
|
goto Reopen_try;
|
||||||
|
}
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
// send a message to srv
|
||||||
|
rc = Ext2WritePipe(g_hPipe, p, p->len, &bytes);
|
||||||
|
if (!rc || bytes != p->len) {
|
||||||
|
le = GetLastError();
|
||||||
|
if (le == ERROR_NO_DATA && tries++ < 10) {
|
||||||
|
Ext2ClosePipe();
|
||||||
|
Sleep(500 * tries);
|
||||||
|
goto Reopen_try;
|
||||||
|
}
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes = 0;
|
||||||
|
memset(&ac, 0, sizeof(ac));
|
||||||
|
rc = Ext2ReadPipe(g_hPipe, &ac, sizeof(ac), &bytes);
|
||||||
|
if (!rc || bytes != sizeof(ac)) {
|
||||||
|
le = GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
if (*len < ac.len) {
|
||||||
|
if (p) {
|
||||||
|
delete [] p;
|
||||||
|
}
|
||||||
|
*len = ac.len;
|
||||||
|
p = (PIPE_REQ *) new CHAR[*len];
|
||||||
|
*pr = p;
|
||||||
|
if (!p) {
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(p, 0, *len);
|
||||||
|
memcpy(p, &ac, sizeof(ac));
|
||||||
|
rc = Ext2ReadPipe(g_hPipe, &p->data[0],
|
||||||
|
ac.len - bytes, &bytes);
|
||||||
|
if (!rc || bytes != (ac.len - sizeof(ac))) {
|
||||||
|
le = GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL Ext2DefineDosDevicePipe(DWORD flags, CHAR *dos, CHAR *symlink)
|
||||||
|
{
|
||||||
|
PPIPE_REQ p = NULL;
|
||||||
|
ULONG len = REQ_BODY_SIZE;
|
||||||
|
BOOL rc = 0;
|
||||||
|
|
||||||
|
p = (PPIPE_REQ) new CHAR[len];
|
||||||
|
if (NULL == p)
|
||||||
|
goto errorout;
|
||||||
|
|
||||||
|
if (flags & DDD_REMOVE_DEFINITION) {
|
||||||
|
|
||||||
|
/* do dismount */
|
||||||
|
PREQ_REMOVE_DRV q;
|
||||||
|
memset(p, 0, len);
|
||||||
|
p->magic = PIPE_REQ_MAGIC;
|
||||||
|
p->len = sizeof(PIPE_REQ) + sizeof(REQ_REMOVE_DRV);
|
||||||
|
p->cmd = CMD_REMOVE_DRV;
|
||||||
|
q = (PREQ_REMOVE_DRV)&p->data[0];
|
||||||
|
q->pid = GetCurrentProcessId();
|
||||||
|
q->drive = (UCHAR)toupper(dos[0]);
|
||||||
|
q->flags = flags;
|
||||||
|
strcpy(&q->name[0], symlink);
|
||||||
|
p->len += strlen(symlink) + 1;
|
||||||
|
|
||||||
|
rc = Ext2PipeControl(&p, &len);
|
||||||
|
if (!rc) {
|
||||||
|
printf("pipe communication failed.\n");
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (q->result) {
|
||||||
|
printf("%C: removed.\n", q->drive);
|
||||||
|
rc = TRUE;
|
||||||
|
} else {
|
||||||
|
printf("failed to remove %C:.\n", q->drive);
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* do mount */
|
||||||
|
PREQ_DEFINE_DRV q;
|
||||||
|
memset(p, 0, len);
|
||||||
|
p->magic = PIPE_REQ_MAGIC;
|
||||||
|
p->len = sizeof(PIPE_REQ) + sizeof(REQ_DEFINE_DRV);
|
||||||
|
p->cmd = CMD_DEFINE_DRV;
|
||||||
|
q = (PREQ_DEFINE_DRV)&p->data[0];
|
||||||
|
q->pid = GetCurrentProcessId();
|
||||||
|
q->drive = (UCHAR)toupper(dos[0]);
|
||||||
|
q->flags = flags;
|
||||||
|
strcpy(&q->name[0], symlink);
|
||||||
|
p->len += strlen(symlink) + 1;
|
||||||
|
|
||||||
|
rc = Ext2PipeControl(&p, &len);
|
||||||
|
if ( !rc) {
|
||||||
|
printf("pipe communication failed.\n");
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (q->result) {
|
||||||
|
rc = TRUE;
|
||||||
|
printf("%C: assigned to %s\n", q->drive, &q->name[0]);
|
||||||
|
} else {
|
||||||
|
printf("failed to assign %C: to %s.\n", q->drive, &q->name[0]);
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
if (p)
|
||||||
|
delete []p;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL Ext2DefineDosDeviceLocal(DWORD flags, CHAR *dos, CHAR *symlink)
|
||||||
|
{
|
||||||
|
CHAR dosPath[] = "A:\0";
|
||||||
|
BOOL rc;
|
||||||
|
|
||||||
|
dosPath[0] = (CHAR)toupper(dos[0]);
|
||||||
|
rc = DefineDosDevice(flags, dosPath, symlink);
|
||||||
|
if (rc) {
|
||||||
|
if (flags & DDD_REMOVE_DEFINITION) {
|
||||||
|
Ext2DrvNotify(dosPath[0], FALSE);
|
||||||
|
} else {
|
||||||
|
Ext2DrvNotify(dosPath[0], TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL Ext2DefineDosDevice(DWORD flags, CHAR *dos, CHAR *symlink)
|
||||||
|
{
|
||||||
|
if (CanDoLocalMount()) {
|
||||||
|
return Ext2DefineDosDeviceLocal(flags, dos, symlink);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ext2DefineDosDevicePipe(flags, dos, symlink);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD Ext2QueryDrivePipe(CHAR drive, CHAR *symlink)
|
||||||
|
{
|
||||||
|
PPIPE_REQ p = NULL;
|
||||||
|
PREQ_QUERY_DRV q;
|
||||||
|
ULONG len = REQ_BODY_SIZE;
|
||||||
|
DWORD rc = 0;
|
||||||
|
|
||||||
|
p = (PPIPE_REQ) new CHAR[len];
|
||||||
|
if (NULL == p)
|
||||||
|
goto errorout;
|
||||||
|
|
||||||
|
/* do query */
|
||||||
|
memset(p, 0, len);
|
||||||
|
p->magic = PIPE_REQ_MAGIC;
|
||||||
|
p->len = sizeof(PIPE_REQ) + sizeof(REQ_QUERY_DRV);
|
||||||
|
p->cmd = CMD_QUERY_DRV;
|
||||||
|
q = (PREQ_QUERY_DRV)&p->data[0];
|
||||||
|
q->drive = (UCHAR)toupper(drive);
|
||||||
|
rc = Ext2PipeControl(&p, &len);
|
||||||
|
if ( !rc) {
|
||||||
|
printf("pipe communication failed.\n");
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = q->type;
|
||||||
|
if (q->result) {
|
||||||
|
printf("%C: -> %s\n", q->drive, &q->name[0]);
|
||||||
|
strcpy(symlink, &q->name[0]);
|
||||||
|
} else {
|
||||||
|
printf("failed to queyr %C:\n", q->drive);
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
if (p)
|
||||||
|
delete []p;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD Ext2QueryDriveLocal(CHAR drive, CHAR *symlink)
|
||||||
|
{
|
||||||
|
DWORD type;
|
||||||
|
CHAR devPath[] = "A:";
|
||||||
|
|
||||||
|
devPath[0] = drive;
|
||||||
|
type = GetDriveType(devPath);
|
||||||
|
if (type != DRIVE_NO_ROOT_DIR) {
|
||||||
|
QueryDosDevice(devPath, symlink, MAX_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD Ext2QueryDrive(CHAR drive, CHAR *symlink)
|
||||||
|
{
|
||||||
|
if (CanDoLocalMount()) {
|
||||||
|
return Ext2QueryDriveLocal(drive, symlink);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ext2QueryDrivePipe(drive, symlink);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Ext2CreateToken(DWORD pid, DWORD *sid, HANDLE *token)
|
||||||
|
{
|
||||||
|
HANDLE h = NULL, token_user = NULL;
|
||||||
|
DWORD dwTokenRights;
|
||||||
|
PSID IntegrityLevelSid = NULL;
|
||||||
|
CString SIDvalue;
|
||||||
|
TOKEN_MANDATORY_LABEL IntegrityLevelToken = {0};
|
||||||
|
|
||||||
|
int rc = -1;
|
||||||
|
|
||||||
|
rc = ProcessIdToSessionId(pid, sid);
|
||||||
|
if (!rc) {
|
||||||
|
rc = -1 * GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
|
||||||
|
if (h == NULL || h == INVALID_HANDLE_VALUE) {
|
||||||
|
rc = -1 * GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = OpenProcessToken(h, TOKEN_DUPLICATE, &token_user);
|
||||||
|
if(!rc) {
|
||||||
|
rc = -1 * GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwTokenRights = TOKEN_QUERY | TOKEN_ASSIGN_PRIMARY |
|
||||||
|
TOKEN_DUPLICATE | TOKEN_ADJUST_DEFAULT |
|
||||||
|
TOKEN_ADJUST_SESSIONID;
|
||||||
|
rc = DuplicateTokenEx(token_user, dwTokenRights, NULL,
|
||||||
|
SecurityImpersonation /*SecurityIdentification*/,
|
||||||
|
TokenPrimary, token);
|
||||||
|
if (!rc) {
|
||||||
|
rc = -1 * GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
// S-revision-authority-rid
|
||||||
|
// S-1-16-?
|
||||||
|
// 16 represents
|
||||||
|
// SECURITY_MANDATORY_LABEL_AUTHORITY
|
||||||
|
|
||||||
|
SIDvalue.Format("S-1-16-%d", SECURITY_MANDATORY_MEDIUM_RID);
|
||||||
|
if(!ConvertStringSidToSidA(SIDvalue, &IntegrityLevelSid)) {
|
||||||
|
/* not critical, ignore this error */
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntegrityLevelToken.Label.Attributes = SE_GROUP_INTEGRITY;
|
||||||
|
IntegrityLevelToken.Label.Sid = IntegrityLevelSid;
|
||||||
|
|
||||||
|
SetTokenInformation(*token,
|
||||||
|
TokenIntegrityLevel,
|
||||||
|
&IntegrityLevelToken,
|
||||||
|
sizeof(TOKEN_MANDATORY_LABEL) +
|
||||||
|
GetLengthSid(IntegrityLevelSid));
|
||||||
|
LocalFree(IntegrityLevelSid);
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
if (token_user && token_user != INVALID_HANDLE_VALUE)
|
||||||
|
CloseHandle(token_user);
|
||||||
|
|
||||||
|
if (h && h != INVALID_HANDLE_VALUE)
|
||||||
|
CloseHandle(h);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD Ext2QuerySrv(TCHAR *srv, DWORD *pids, DWORD as)
|
||||||
|
{
|
||||||
|
DWORD total = 0;
|
||||||
|
HANDLE p = NULL;
|
||||||
|
PROCESSENTRY32 r = {0};
|
||||||
|
|
||||||
|
p = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||||
|
if (INVALID_HANDLE_VALUE == p)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
r.dwSize=sizeof(PROCESSENTRY32);
|
||||||
|
if (!Process32First(p, &r)) {
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
TCHAR *n = _tcsrchr(&r.szExeFile[0], _T('\\'));
|
||||||
|
if (!n)
|
||||||
|
n = &r.szExeFile[0];
|
||||||
|
if (_tcsicmp(n, srv) == 0) {
|
||||||
|
pids[total++] = r.th32ProcessID;
|
||||||
|
if (total >= as)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} while(Process32Next(p, &r));
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
CloseHandle(p);
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCHAR *Ext2StrLastA(TCHAR *t, TCHAR *s)
|
||||||
|
{
|
||||||
|
int lt = strlen(t), ls = strlen(s), i;
|
||||||
|
|
||||||
|
for (i = lt - ls; i >= 0; i--) {
|
||||||
|
if (0 == _strnicmp(&t[i], s, ls))
|
||||||
|
return &t[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCHAR * Ext2BuildCMDA()
|
||||||
|
{
|
||||||
|
TCHAR cmd[512] = {0}, *p, *refresh = NULL;
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
|
if (GetModuleFileName(NULL, cmd, 510)) {
|
||||||
|
} else {
|
||||||
|
strcpy(cmd, GetCommandLine());
|
||||||
|
}
|
||||||
|
|
||||||
|
len = (int)_tcslen(cmd) + 2;
|
||||||
|
refresh = new TCHAR[len];
|
||||||
|
if (!refresh)
|
||||||
|
goto errorout;
|
||||||
|
memset(refresh, 0, sizeof(TCHAR)*len);
|
||||||
|
_tcscpy(refresh, cmd);
|
||||||
|
p = _tcsstr(refresh, _T("/"));
|
||||||
|
if (p)
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
|
p = Ext2StrLastA(refresh, "Ext2Mgr");
|
||||||
|
if (p) {
|
||||||
|
p[4] = 'S';
|
||||||
|
p[5] = 'r';
|
||||||
|
p[6] = 'v';
|
||||||
|
} else {
|
||||||
|
delete [] refresh;
|
||||||
|
refresh = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
return refresh;
|
||||||
|
}
|
||||||
|
|
||||||
|
WCHAR *Ext2StrLastW(WCHAR *t, WCHAR *s)
|
||||||
|
{
|
||||||
|
int lt = wcslen(t), ls = wcslen(s), i;
|
||||||
|
|
||||||
|
for (i = lt - ls; i >= 0; i--) {
|
||||||
|
if (0 == _wcsnicmp(&t[i], s, ls))
|
||||||
|
return &t[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
WCHAR *Ext2BuildCMDW()
|
||||||
|
{
|
||||||
|
WCHAR cmd[512] = {0}, *p, *refresh = NULL;
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
|
if (GetModuleFileNameW(NULL, cmd, 510)) {
|
||||||
|
} else {
|
||||||
|
wcscpy(cmd, GetCommandLineW());
|
||||||
|
}
|
||||||
|
|
||||||
|
len = (int)wcslen(cmd) + 2;
|
||||||
|
refresh = new WCHAR[len];
|
||||||
|
if (!refresh)
|
||||||
|
goto errorout;
|
||||||
|
memset(refresh, 0, sizeof(WCHAR)*len);
|
||||||
|
wcscpy(refresh, cmd);
|
||||||
|
p = wcsstr(refresh, L"/");
|
||||||
|
if (p)
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
|
p = Ext2StrLastW(refresh, L"Ext2Mgr");
|
||||||
|
if (p) {
|
||||||
|
p[4] = 'S';
|
||||||
|
p[5] = 'r';
|
||||||
|
p[6] = 'v';
|
||||||
|
} else {
|
||||||
|
delete [] refresh;
|
||||||
|
refresh = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
return refresh;
|
||||||
|
}
|
||||||
|
|
||||||
|
PROCESS_INFORMATION g_Ext2Srv;
|
||||||
|
|
||||||
|
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI *lpfnCreateProcessWithTokenW)(
|
||||||
|
HANDLE hToken,
|
||||||
|
DWORD dwLogonFlags,
|
||||||
|
LPCWSTR lpApplicationName,
|
||||||
|
LPWSTR lpCommandLine,
|
||||||
|
DWORD dwCreationFlags,
|
||||||
|
LPVOID lpEnvironment,
|
||||||
|
LPCWSTR lpCurrentDirectory,
|
||||||
|
LPSTARTUPINFOW lpStartupInfo,
|
||||||
|
LPPROCESS_INFORMATION lpProcessInformation
|
||||||
|
);
|
||||||
|
|
||||||
|
lpfnCreateProcessWithTokenW g_CreateProcessWithTokenW;
|
||||||
|
|
||||||
|
int Ext2StartSrvAsUser(HANDLE token)
|
||||||
|
{
|
||||||
|
LPWSTR cmd = NULL;
|
||||||
|
STARTUPINFOW si = {0};
|
||||||
|
PROCESS_INFORMATION pi = {0};
|
||||||
|
int rc = -1;
|
||||||
|
|
||||||
|
cmd = Ext2BuildCMDW();
|
||||||
|
if (!cmd) {
|
||||||
|
rc = -1;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
si.cb = sizeof( STARTUPINFO );
|
||||||
|
if (token && g_CreateProcessWithTokenW) {
|
||||||
|
rc = g_CreateProcessWithTokenW(
|
||||||
|
token, 0, NULL, cmd,
|
||||||
|
NORMAL_PRIORITY_CLASS |
|
||||||
|
CREATE_NO_WINDOW,
|
||||||
|
NULL, NULL,
|
||||||
|
&si, &pi );
|
||||||
|
} else {
|
||||||
|
rc = CreateProcessW( NULL, cmd, NULL, NULL,
|
||||||
|
FALSE, NORMAL_PRIORITY_CLASS |
|
||||||
|
CREATE_NO_WINDOW, NULL, NULL,
|
||||||
|
&si, &pi );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rc) {
|
||||||
|
rc = -1 * GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Ext2Srv = pi;
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
if (cmd)
|
||||||
|
delete []cmd;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Ext2StartSrvAsElevated()
|
||||||
|
{
|
||||||
|
LPTSTR cmd = NULL;
|
||||||
|
STARTUPINFO si = {0};
|
||||||
|
PROCESS_INFORMATION pi = {0};
|
||||||
|
int rc = -1;
|
||||||
|
|
||||||
|
cmd = Ext2BuildCMDA();
|
||||||
|
if (!cmd) {
|
||||||
|
rc = -1;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
si.cb = sizeof( STARTUPINFO );
|
||||||
|
rc = CreateProcess( NULL, cmd, NULL, NULL,
|
||||||
|
FALSE, NORMAL_PRIORITY_CLASS |
|
||||||
|
CREATE_NO_WINDOW, NULL, NULL,
|
||||||
|
&si, &pi );
|
||||||
|
|
||||||
|
if (!rc) {
|
||||||
|
rc = -1 * GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Ext2Srv = pi;
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
if (cmd)
|
||||||
|
delete []cmd;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Ext2StartSrv()
|
||||||
|
{
|
||||||
|
DWORD pid[12] = {0}, num;
|
||||||
|
int rc = -1;
|
||||||
|
|
||||||
|
num = Ext2QuerySrv(_T("Ext2Srv.exe"), pid, 10);
|
||||||
|
if (num) {
|
||||||
|
/* already started */
|
||||||
|
rc = num;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsVistaOrAbove()) {
|
||||||
|
|
||||||
|
DWORD sid = 0, mysid = 0;
|
||||||
|
HANDLE token = 0;
|
||||||
|
|
||||||
|
num = Ext2QuerySrv(_T("Explorer.exe"), &pid[0], 10);
|
||||||
|
if (!num) {
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
pid[num] = GetCurrentProcessId();
|
||||||
|
num++;
|
||||||
|
|
||||||
|
rc = ProcessIdToSessionId(GetCurrentProcessId(), &mysid);
|
||||||
|
if (!rc) {
|
||||||
|
rc = -1 * GetLastError();
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (num > 0 && pid[num - 1]) {
|
||||||
|
|
||||||
|
rc = Ext2CreateToken(pid[--num], &sid, &token);
|
||||||
|
if (rc > 0) {
|
||||||
|
if (sid == mysid) {
|
||||||
|
rc = Ext2StartSrvAsUser(token);
|
||||||
|
} else {
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
if (token && token != INVALID_HANDLE_VALUE) {
|
||||||
|
CloseHandle(token);
|
||||||
|
token = NULL;
|
||||||
|
}
|
||||||
|
if (rc == 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Ext2StartSrvAsElevated();
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ext2StopSrv()
|
||||||
|
{
|
||||||
|
PROCESS_INFORMATION pi = g_Ext2Srv;
|
||||||
|
|
||||||
|
memset(&g_Ext2Srv, 0, sizeof(pi));
|
||||||
|
|
||||||
|
/* wait until process exits or timeouts */
|
||||||
|
|
||||||
|
if (pi.hProcess != INVALID_HANDLE_VALUE) {
|
||||||
|
TerminateProcess(pi.hProcess, -1);
|
||||||
|
CloseHandle(pi.hProcess);
|
||||||
|
}
|
||||||
|
if (pi.hThread != INVALID_HANDLE_VALUE) {
|
||||||
|
CloseHandle(pi.hThread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ext2EnablePrivilege(SE_TCB_NAME) */
|
||||||
|
|
||||||
|
BOOL Ext2EnablePrivilege(LPCTSTR lpszPrivilegeName)
|
||||||
|
{
|
||||||
|
TOKEN_PRIVILEGES tp = {0};
|
||||||
|
HANDLE token;
|
||||||
|
LUID luid;
|
||||||
|
BOOL rc;
|
||||||
|
|
||||||
|
rc = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |
|
||||||
|
TOKEN_QUERY | TOKEN_READ, &token);
|
||||||
|
if(!rc)
|
||||||
|
goto errorout;
|
||||||
|
|
||||||
|
rc = LookupPrivilegeValue(NULL, lpszPrivilegeName, &luid);
|
||||||
|
if(!rc)
|
||||||
|
goto errorout;
|
||||||
|
|
||||||
|
/* initialize token privilege */
|
||||||
|
tp.PrivilegeCount = 1;
|
||||||
|
tp.Privileges[0].Luid = luid;
|
||||||
|
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||||
|
rc = AdjustTokenPrivileges(token, FALSE, &tp, NULL, NULL, NULL);
|
||||||
|
CloseHandle(token);
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define KEY_WOW64_64KEY (0x0100)
|
||||||
|
|
||||||
|
BOOL KdpQueryRegDWORD(CHAR *service, CHAR *value, DWORD *data)
|
||||||
|
{
|
||||||
|
int rc = TRUE;
|
||||||
|
HKEY key;
|
||||||
|
CHAR keyPath[MAX_PATH] = "SYSTEM\\CurrentControlSet\\Services\\";
|
||||||
|
LONG status, type, len = 0;
|
||||||
|
|
||||||
|
strcat(keyPath, service);
|
||||||
|
status = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
|
keyPath,
|
||||||
|
0,
|
||||||
|
KEY_ALL_ACCESS | KEY_WOW64_64KEY,
|
||||||
|
&key) ;
|
||||||
|
if (status != ERROR_SUCCESS) {
|
||||||
|
rc = FALSE;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = sizeof(DWORD);
|
||||||
|
status = RegQueryValueEx( key,
|
||||||
|
value,
|
||||||
|
0,
|
||||||
|
(LPDWORD)&type,
|
||||||
|
(BYTE *)data,
|
||||||
|
(LPDWORD)&len);
|
||||||
|
if (status != ERROR_SUCCESS) {
|
||||||
|
rc = FALSE;
|
||||||
|
}
|
||||||
|
RegCloseKey(key);
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL KdpSetRegDWORD(CHAR *service, CHAR *value, DWORD data)
|
||||||
|
{
|
||||||
|
int rc = TRUE;
|
||||||
|
HKEY key;
|
||||||
|
CHAR keyPath[MAX_PATH] = "SYSTEM\\CurrentControlSet\\Services\\";
|
||||||
|
LONG status;
|
||||||
|
|
||||||
|
strcat(keyPath, service);
|
||||||
|
status = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
|
keyPath,
|
||||||
|
0,
|
||||||
|
KEY_ALL_ACCESS | KEY_WOW64_64KEY,
|
||||||
|
&key) ;
|
||||||
|
if (status != ERROR_SUCCESS) {
|
||||||
|
rc = FALSE;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = RegSetValueEx( key,
|
||||||
|
value,
|
||||||
|
0,
|
||||||
|
REG_DWORD,
|
||||||
|
(BYTE *)&data,
|
||||||
|
sizeof(DWORD));
|
||||||
|
if (status != ERROR_SUCCESS) {
|
||||||
|
rc = FALSE;
|
||||||
|
}
|
||||||
|
RegCloseKey(key);
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL Ext2StartPipeSrv()
|
||||||
|
{
|
||||||
|
HMODULE hAdvapi32;
|
||||||
|
BOOL rc = FALSE;
|
||||||
|
|
||||||
|
if (CanDoLocalMount()) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* query advapi32!CreateProcessWithToken */
|
||||||
|
hAdvapi32 = GetModuleHandle("Advapi32.DLL");
|
||||||
|
g_CreateProcessWithTokenW = (lpfnCreateProcessWithTokenW)
|
||||||
|
GetProcAddress(hAdvapi32, "CreateProcessWithTokenW");
|
||||||
|
|
||||||
|
if (!g_CreateProcessWithTokenW) {
|
||||||
|
rc = FALSE;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add more privilege for toke duplication */
|
||||||
|
Ext2EnablePrivilege(SE_INCREASE_QUOTA_NAME);
|
||||||
|
Ext2EnablePrivilege(SE_TCB_NAME);
|
||||||
|
|
||||||
|
/* start Ext2Srv.exe */
|
||||||
|
rc = Ext2StartSrv();
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Ext2StopPipeSrv()
|
||||||
|
{
|
||||||
|
/* close pipe handles */
|
||||||
|
Ext2ClosePipe();
|
||||||
|
|
||||||
|
/* terminate process: Ext2Srv */
|
||||||
|
Ext2StopSrv();
|
||||||
|
}
|
||||||
292
Ext2Mgr/HyperLink.cpp
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
// MyHyperLink.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
// Written By : Renjith.R
|
||||||
|
// Email : renji12renji@m2comsys.com
|
||||||
|
// Details :Derived from MFC CStatic
|
||||||
|
// Date :Nov 25 2002
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "HyperLink.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMyHyperLink
|
||||||
|
|
||||||
|
CMyHyperLink::CMyHyperLink()
|
||||||
|
{
|
||||||
|
m_sLinkColor = RGB(0, 0 ,255);
|
||||||
|
m_sHoverColor = RGB(255, 0, 0);
|
||||||
|
m_sVisitedColor = RGB(5, 34, 143);
|
||||||
|
|
||||||
|
m_bFireChild = false;
|
||||||
|
m_bMouseOver = false;
|
||||||
|
m_bEnableToolTip = false;
|
||||||
|
m_bVisited = false;
|
||||||
|
|
||||||
|
//Create Tooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
CMyHyperLink::~CMyHyperLink()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMyHyperLink, CStatic)
|
||||||
|
//{{AFX_MSG_MAP(CMyHyperLink)
|
||||||
|
ON_WM_MOUSEMOVE()
|
||||||
|
ON_WM_SETCURSOR()
|
||||||
|
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
|
||||||
|
|
||||||
|
|
||||||
|
ON_WM_CTLCOLOR_REFLECT()
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMyHyperLink message handlers
|
||||||
|
|
||||||
|
//Sets the Link Color
|
||||||
|
void CMyHyperLink::SetLinkColor(COLORREF sLinkColor)
|
||||||
|
{
|
||||||
|
m_sLinkColor = sLinkColor;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//open the URL by Windows ShellExecute()
|
||||||
|
bool CMyHyperLink::GoToLinkUrl(CString csLink)
|
||||||
|
{
|
||||||
|
|
||||||
|
HINSTANCE hInstance = (HINSTANCE)ShellExecute(NULL, _T("open"), csLink.operator LPCTSTR(), NULL, NULL, 2);
|
||||||
|
|
||||||
|
if ((UINT)hInstance < HINSTANCE_ERROR){
|
||||||
|
return false;
|
||||||
|
}else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//User can Active/Inactive the Tooltip already they set
|
||||||
|
void CMyHyperLink::ActiveToolTip(int nFlag)
|
||||||
|
{
|
||||||
|
if (nFlag)
|
||||||
|
m_bEnableToolTip = true;
|
||||||
|
else
|
||||||
|
m_bEnableToolTip = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//change The Tooltip text
|
||||||
|
void CMyHyperLink::SetTootTipText(LPCSTR szToolTip)
|
||||||
|
{
|
||||||
|
if (m_bEnableToolTip )
|
||||||
|
{
|
||||||
|
m_ToolTip.UpdateTipText(szToolTip,this,1001);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//The Mouse Move Message
|
||||||
|
void CMyHyperLink::OnMouseMove(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
CStatic::OnMouseMove(nFlags, point);
|
||||||
|
if (m_bMouseOver)
|
||||||
|
{
|
||||||
|
CRect oRect;
|
||||||
|
GetClientRect(&oRect);
|
||||||
|
|
||||||
|
//check if the mouse is in the rect
|
||||||
|
if (oRect.PtInRect(point) == false)
|
||||||
|
{
|
||||||
|
m_bMouseOver = false;
|
||||||
|
//Release the Mouse capture previously take
|
||||||
|
ReleaseCapture();
|
||||||
|
RedrawWindow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_bMouseOver = true;
|
||||||
|
RedrawWindow();
|
||||||
|
//capture the mouse
|
||||||
|
SetCapture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//before Subclassing
|
||||||
|
void CMyHyperLink::PreSubclassWindow()
|
||||||
|
{
|
||||||
|
|
||||||
|
//Enable the Static to send the Window Messages To its parent
|
||||||
|
DWORD dwStyle = GetStyle();
|
||||||
|
SetWindowLongPtr(GetSafeHwnd() ,GWL_STYLE ,dwStyle | SS_NOTIFY);
|
||||||
|
|
||||||
|
char szCurretText[MAX_PATH];
|
||||||
|
GetWindowText(szCurretText, MAX_PATH);
|
||||||
|
if ((szCurretText) == NULL){
|
||||||
|
SetWindowText(m_csLinkText.operator LPCTSTR());
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGFONT sLogFont;
|
||||||
|
GetFont()->GetLogFont(&sLogFont);
|
||||||
|
//Set the Link UnderLined
|
||||||
|
sLogFont.lfUnderline = true;
|
||||||
|
//Set the Font to the Control
|
||||||
|
m_oTextFont.CreateFontIndirect(&sLogFont);
|
||||||
|
this->SetFont(&m_oTextFont, true);
|
||||||
|
|
||||||
|
//Adjust the window
|
||||||
|
//IsValidURL();
|
||||||
|
|
||||||
|
//Set the Cursor Hand
|
||||||
|
//WinHlp32.exe in windows folder ResourceID 106
|
||||||
|
//is a standard window HAND cursor
|
||||||
|
//courtesy www.codeguru.com
|
||||||
|
//you can use a custom Hand cursor resourse also
|
||||||
|
// i added that as a resourse in this project with
|
||||||
|
// ID - IDC_CURSOR_HAND
|
||||||
|
|
||||||
|
char szWindowsDir[MAX_PATH*2];
|
||||||
|
GetWindowsDirectory(szWindowsDir ,MAX_PATH*2);
|
||||||
|
strcat(szWindowsDir,"\\Winhlp32.exe");
|
||||||
|
HMODULE hModule = LoadLibrary(szWindowsDir);
|
||||||
|
|
||||||
|
if (hModule){
|
||||||
|
m_hHyperCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
|
||||||
|
}
|
||||||
|
|
||||||
|
this->SetCursor(m_hHyperCursor);
|
||||||
|
|
||||||
|
//free the module
|
||||||
|
if (hModule)
|
||||||
|
FreeLibrary(hModule);
|
||||||
|
|
||||||
|
CStatic::PreSubclassWindow();
|
||||||
|
this->SetCursor(m_hHyperCursor);
|
||||||
|
|
||||||
|
m_ToolTip.Create(this,TTS_ALWAYSTIP);
|
||||||
|
CRect oRect;
|
||||||
|
GetClientRect(&oRect);
|
||||||
|
m_ToolTip.AddTool(this,"",oRect,1001);
|
||||||
|
m_ToolTip.ShowWindow(SW_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyHyperLink::SetLinkText(CString csLinkText)
|
||||||
|
{
|
||||||
|
m_csLinkText = csLinkText;
|
||||||
|
this->SetWindowText(csLinkText.operator LPCTSTR());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMyHyperLink::PreTranslateMessage(MSG* pMsg)
|
||||||
|
{
|
||||||
|
m_ToolTip.RelayEvent(pMsg);
|
||||||
|
return CStatic::PreTranslateMessage(pMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CMyHyperLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
|
||||||
|
{
|
||||||
|
|
||||||
|
::SetCursor(m_hHyperCursor);
|
||||||
|
return true;
|
||||||
|
//return CStatic::OnSetCursor(pWnd, nHitTest, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////EVENT WILL GET HERE //////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
void CMyHyperLink::OnClicked()
|
||||||
|
{
|
||||||
|
if (m_bFireChild){
|
||||||
|
//Fire the Event to Parent Window
|
||||||
|
CWnd *pParent;
|
||||||
|
pParent = GetParent();
|
||||||
|
int nCtrlID = GetDlgCtrlID();
|
||||||
|
::SendMessage(pParent->m_hWnd, _HYPERLINK_EVENT, (WPARAM)nCtrlID, 0);
|
||||||
|
//::PostMessage(pParent->m_hWnd, __EVENT_ID_, (WPARAM)nCtrlID, 0);
|
||||||
|
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
GoToLinkUrl(m_csUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bVisited = true;
|
||||||
|
//reddraw the control
|
||||||
|
this->Invalidate(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
HBRUSH CMyHyperLink::CtlColor(CDC* pDC, UINT nCtlColor)
|
||||||
|
{
|
||||||
|
if (m_bMouseOver){
|
||||||
|
if (m_bVisited)
|
||||||
|
pDC->SetTextColor(m_sVisitedColor);
|
||||||
|
else
|
||||||
|
pDC->SetTextColor(m_sHoverColor);
|
||||||
|
}else {
|
||||||
|
if (m_bVisited)
|
||||||
|
pDC->SetTextColor(m_sVisitedColor);
|
||||||
|
else
|
||||||
|
pDC->SetTextColor(m_sLinkColor);
|
||||||
|
}
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
return((HBRUSH)GetStockObject(NULL_BRUSH));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyHyperLink::SetToolTipTextColor(COLORREF sToolTipText) {
|
||||||
|
m_ToolTip.SetTipTextColor(sToolTipText);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyHyperLink::SetToolTipBgColor(COLORREF sToolTipBgColor)
|
||||||
|
{
|
||||||
|
m_ToolTip.SetTipBkColor(sToolTipBgColor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CString CMyHyperLink::GetLinkText() {
|
||||||
|
if (m_csLinkText.IsEmpty())
|
||||||
|
return CString("");
|
||||||
|
return m_csLinkText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyHyperLink::SetLinkUrl(CString csUrl) {
|
||||||
|
m_csUrl= csUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString CMyHyperLink::GetLinkUrl() {
|
||||||
|
return m_csUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyHyperLink::SetVisitedColor(COLORREF sVisitedColor) {
|
||||||
|
m_sVisitedColor = sVisitedColor ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyHyperLink::SetHoverColor(COLORREF cHoverColor) {
|
||||||
|
m_sHoverColor = cHoverColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyHyperLink::SetFireChild(int nFlag) {
|
||||||
|
if (nFlag)
|
||||||
|
m_bFireChild = true;
|
||||||
|
else
|
||||||
|
m_bFireChild = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMyHyperLink::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
NMHDR* pMsgHdr;
|
||||||
|
pMsgHdr = (NMHDR*) lParam;
|
||||||
|
|
||||||
|
switch (pMsgHdr->code){
|
||||||
|
case NM_RCLICK:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CStatic::OnNotify(wParam, lParam, pResult);
|
||||||
|
}
|
||||||
108
Ext2Mgr/HyperLink.h
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
////////////////////////////////////////////////////////
|
||||||
|
// Class Name : CMyHyperLink
|
||||||
|
// Written By : Renjith.R
|
||||||
|
// Email : renjith_sree@hotmail.com
|
||||||
|
// Details :Derived from MFC CStatic
|
||||||
|
// Date :Nov 25 2002
|
||||||
|
// This can be used as a Hyperlink
|
||||||
|
//Feel free to use this class in your project
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_)
|
||||||
|
#define AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// MyHyperLink.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
//This is the EventID , Which Will send to the Parent
|
||||||
|
//by the hyperlink control
|
||||||
|
|
||||||
|
# define _HYPERLINK_EVENT WM_USER + 101
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMyHyperLink window
|
||||||
|
|
||||||
|
class CMyHyperLink : public CStatic
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CMyHyperLink();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMyHyperLink)
|
||||||
|
public:
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
protected:
|
||||||
|
virtual void PreSubclassWindow();
|
||||||
|
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
void SetFireChild(int nFlag);
|
||||||
|
CString GetLinkText();
|
||||||
|
CString GetLinkUrl();
|
||||||
|
|
||||||
|
bool GoToLinkUrl(CString csLink);
|
||||||
|
|
||||||
|
void SetHoverColor(COLORREF cHoverColor);
|
||||||
|
void SetVisitedColor(COLORREF sVisitedColor);
|
||||||
|
void SetLinkUrl(CString csUrl);
|
||||||
|
void SetToolTipBgColor(COLORREF sToolTipBgColor);
|
||||||
|
void SetToolTipTextColor(COLORREF sToolTipText);
|
||||||
|
void SetLinkText(CString csLinkText);
|
||||||
|
void SetTootTipText(LPCSTR szToolTip);
|
||||||
|
void ActiveToolTip(int nFlag);
|
||||||
|
void SetLinkColor(COLORREF sLinkColor);
|
||||||
|
|
||||||
|
virtual ~CMyHyperLink();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
bool m_bFireChild;
|
||||||
|
|
||||||
|
HCURSOR m_hHyperCursor;
|
||||||
|
|
||||||
|
bool m_bEnableToolTip;
|
||||||
|
bool m_bMouseOver;
|
||||||
|
bool m_bVisited;
|
||||||
|
|
||||||
|
CFont m_oTextFont;
|
||||||
|
CToolTipCtrl m_ToolTip;
|
||||||
|
|
||||||
|
CString m_csToolTipText;
|
||||||
|
CString m_csLinkText;
|
||||||
|
CString m_csUrl;
|
||||||
|
|
||||||
|
COLORREF m_sHoverColor;
|
||||||
|
COLORREF m_sLinkColor;
|
||||||
|
COLORREF m_sVisitedColor;
|
||||||
|
|
||||||
|
//{{AFX_MSG(CMyHyperLink)
|
||||||
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||||
|
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
|
||||||
|
afx_msg void OnClicked();
|
||||||
|
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MYHYPERLINK_H__699B2FB4_0C03_4B12_B117_210A97860E0D__INCLUDED_)
|
||||||
11
Ext2Mgr/MAKEFILE
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
BUILD_ALLOW_COMPILER_WARNINGS=1
|
||||||
|
BUILD_ALLOW_LINKER_WARNINGS=1
|
||||||
|
|
||||||
|
#
|
||||||
|
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
|
||||||
|
# file to this component. This file merely indirects to the real make file
|
||||||
|
# that is shared by all the driver components of the Windows NT DDK
|
||||||
|
#
|
||||||
|
|
||||||
|
!INCLUDE $(NTMAKEENV)\makefile.def
|
||||||
|
|
||||||
1
Ext2Mgr/Manifest.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
c:\tools\mt -nologo -manifest Ext2Mgr.manifest -outputresource:Ext2Mgr.exe;#1
|
||||||
499
Ext2Mgr/MountPoints.cpp
Normal file
@@ -0,0 +1,499 @@
|
|||||||
|
// MountPoints.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "MountPoints.h"
|
||||||
|
#include "Ext2MgrDlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMountPoints dialog
|
||||||
|
|
||||||
|
|
||||||
|
CMountPoints::CMountPoints(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CMountPoints::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CMountPoints)
|
||||||
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
m_Cdrom = NULL;
|
||||||
|
m_Volume = NULL;
|
||||||
|
m_Part = NULL;
|
||||||
|
m_Letter = "";
|
||||||
|
m_bUpdated = TRUE;
|
||||||
|
m_bMgrNoted = FALSE;
|
||||||
|
m_MainDlg = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMountPoints::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CMountPoints)
|
||||||
|
DDX_Control(pDX, IDC_DRV_LETTER_LIST, m_drvList);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMountPoints, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CMountPoints)
|
||||||
|
ON_NOTIFY(NM_CLICK, IDC_DRV_LETTER_LIST, OnClickDrvLetterList)
|
||||||
|
ON_BN_CLICKED(ID_ADD_MOUNTPOINT, OnAddMountpoint)
|
||||||
|
ON_BN_CLICKED(ID_CHANGE_MOUNTPOINT, OnChangeMountpoint)
|
||||||
|
ON_BN_CLICKED(ID_REMOVE_MOUNTPOINT, OnRemoveMountpoint)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMountPoints message handlers
|
||||||
|
|
||||||
|
void CMountPoints::OnClickDrvLetterList(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
int item = m_drvList.GetSelectionMark();
|
||||||
|
if (item != -1) {
|
||||||
|
m_Letter = m_drvList.GetItemText(item, 0);
|
||||||
|
|
||||||
|
if (!m_Letter.IsEmpty()) {
|
||||||
|
SET_WIN(ID_CHANGE_MOUNTPOINT, TRUE);
|
||||||
|
SET_WIN(ID_REMOVE_MOUNTPOINT, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pResult) {
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
CMountPoints::AddMountPoint(
|
||||||
|
CHAR drvChar,
|
||||||
|
BOOL bRegistry,
|
||||||
|
BOOL bMountMgr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CHAR devPath[MAX_PATH];
|
||||||
|
PEXT2_LETTER drvLetter = NULL;
|
||||||
|
ULONGLONG letterMask = 0;
|
||||||
|
BOOL rc = TRUE;
|
||||||
|
BOOL bMount = FALSE;
|
||||||
|
|
||||||
|
PEXT2_VOLUME_PROPERTY3 EVP = NULL;
|
||||||
|
|
||||||
|
memset(devPath, 0, MAX_PATH);
|
||||||
|
|
||||||
|
if (drvChar >= '0' && drvChar <= '9') {
|
||||||
|
drvLetter = &drvDigits[drvChar - '0'];
|
||||||
|
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
|
||||||
|
} else if (drvChar >= 'A' && drvChar <= 'Z') {
|
||||||
|
drvLetter = &drvLetters[drvChar - 'A'];
|
||||||
|
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!drvLetter) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Part) {
|
||||||
|
if (m_Part->Volume) {
|
||||||
|
strcpy(devPath, m_Part->Volume->Name);
|
||||||
|
} else {
|
||||||
|
sprintf(devPath, "\\Device\\Harddisk%u\\Partition%u",
|
||||||
|
m_Part->Disk->OrderNo, m_Part->Number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Volume) {
|
||||||
|
strcpy(devPath, m_Volume->Name);
|
||||||
|
EVP = &m_Volume->EVP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Cdrom) {
|
||||||
|
strcpy(devPath, m_Cdrom->Name);
|
||||||
|
EVP = &m_Cdrom->EVP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bRegistry) {
|
||||||
|
CString str;
|
||||||
|
|
||||||
|
if (Ext2SetRegistryMountPoint(&drvChar, devPath, bRegistry)) {
|
||||||
|
Ext2AssignDrvLetter(drvLetter, devPath, FALSE);
|
||||||
|
EndDialog(0);
|
||||||
|
} else {
|
||||||
|
str.Format("Failed to modify registry: SYSTEM\\CurrentControlSet\\Control\\Session Manager\\DOS Devices\n");
|
||||||
|
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drvLetter->bUsed)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if ((m_Volume != NULL) && (m_Volume->DrvLetters == 0) &&
|
||||||
|
(m_Volume->EVP.bExt2 || m_Volume->EVP.bExt3) ) {
|
||||||
|
bMount = TRUE;
|
||||||
|
} else if (m_Part != NULL && m_Part->Volume &&
|
||||||
|
(m_Part->Volume->DrvLetters == 0) &&
|
||||||
|
(m_Part->Volume->EVP.bExt2 || m_Part->Volume->EVP.bExt3) ) {
|
||||||
|
EVP = &m_Part->Volume->EVP;
|
||||||
|
bMount = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EVP) {
|
||||||
|
if (Ext2IsNullUuid(&EVP->UUID[0])) {
|
||||||
|
AfxMessageBox("UUID is 0.");
|
||||||
|
}
|
||||||
|
if (!Ext2CheckVolumeRegistryProperty(EVP)) {
|
||||||
|
Ext2SetDefaultVolumeRegistryProperty(EVP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create an entry in regisgtry */
|
||||||
|
{
|
||||||
|
|
||||||
|
NT::NTSTATUS status;
|
||||||
|
HANDLE Handle = NULL;
|
||||||
|
CString str;
|
||||||
|
|
||||||
|
status = Ext2Open(devPath, &Handle, EXT2_DESIRED_ACCESS);
|
||||||
|
if (!NT_SUCCESS(status)) {
|
||||||
|
str.Format("Ext2Fsd service is not started.\n");
|
||||||
|
AfxMessageBox(str, MB_OK | MB_ICONSTOP);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = Ext2QueryExt2Property(Handle, EVP);
|
||||||
|
if (!rc) {
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
EVP->DrvLetter = drvLetter->Letter | 0x80;
|
||||||
|
EVP->Flags2 |= EXT2_VPROP3_AUTOMOUNT;
|
||||||
|
Ext2StorePropertyinRegistry(EVP);
|
||||||
|
|
||||||
|
rc = Ext2SetExt2Property(Handle, EVP);
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
Ext2Close(&Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bMount)
|
||||||
|
{
|
||||||
|
rc = Ext2AssignDrvLetter(drvLetter, devPath, bMountMgr);
|
||||||
|
if (!rc && !bMountMgr) {
|
||||||
|
CString str;
|
||||||
|
str.Format("Failed to assign new drive letter %c:\n", drvChar);
|
||||||
|
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rc = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 && bMountMgr) {
|
||||||
|
|
||||||
|
Ext2UpdateDrvLetter(drvLetter, devPath);
|
||||||
|
|
||||||
|
if (!bMount) {
|
||||||
|
Ext2RefreshVolumePoint(devPath, drvLetter->Letter);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sleep(500);
|
||||||
|
drvChar = Ext2QueryMountPoint(devPath);
|
||||||
|
|
||||||
|
if (drvChar >= '0' && drvChar <= '9') {
|
||||||
|
drvLetter = &drvDigits[drvChar - '0'];
|
||||||
|
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
|
||||||
|
} else if (drvChar >= 'A' && drvChar <= 'Z') {
|
||||||
|
drvLetter = &drvLetters[drvChar - 'A'];
|
||||||
|
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
|
||||||
|
} else {
|
||||||
|
drvLetter = NULL; letterMask = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = drvLetter ? TRUE : FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc) {
|
||||||
|
|
||||||
|
m_bUpdated = TRUE;
|
||||||
|
if (m_Part) {
|
||||||
|
m_Part->DrvLetters |= letterMask;
|
||||||
|
if (m_Part->Volume) {
|
||||||
|
m_Part->Volume->DrvLetters |= letterMask;
|
||||||
|
}
|
||||||
|
InitializeList(m_Part->DrvLetters);
|
||||||
|
}
|
||||||
|
if (m_Volume) {
|
||||||
|
m_Volume->DrvLetters |= letterMask;
|
||||||
|
InitializeList(m_Volume->DrvLetters);
|
||||||
|
}
|
||||||
|
if (m_Cdrom) {
|
||||||
|
m_Cdrom->DrvLetters |= letterMask;
|
||||||
|
InitializeList(m_Cdrom->DrvLetters);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
((CExt2MgrDlg *)m_MainDlg)->DriverLetterChangeNotify(drvLetter->Letter, TRUE);
|
||||||
|
*/
|
||||||
|
|
||||||
|
m_MainDlg->SendMessage(
|
||||||
|
WM_MOUNTPOINT_NOTIFY,
|
||||||
|
'DA', (LPARAM)drvLetter->Letter);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMountPoints::OnAddMountpoint()
|
||||||
|
{
|
||||||
|
CSelectDrvLetter drvSel;
|
||||||
|
STORAGE_BUS_TYPE busType = BusTypeAta;
|
||||||
|
|
||||||
|
if (m_Part) {
|
||||||
|
busType = m_Part->Disk->SDD.BusType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Volume && m_Volume->Part) {
|
||||||
|
busType = m_Volume->Part->Disk->SDD.BusType;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if TRUE
|
||||||
|
drvSel.m_bDosDev = TRUE;
|
||||||
|
drvSel.m_bMountMgr = FALSE;
|
||||||
|
drvSel.m_bRegistry = FALSE;
|
||||||
|
#else
|
||||||
|
if (m_Cdrom ||
|
||||||
|
busType == BusType1394 ||
|
||||||
|
busType == BusTypeUsb ) {
|
||||||
|
|
||||||
|
drvSel.m_bMountMgr = TRUE;
|
||||||
|
drvSel.m_bRegistry = FALSE;
|
||||||
|
drvSel.m_bDosDev = FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (drvSel.DoModal() != IDOK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddMountPoint(drvSel.m_DrvLetter.GetAt(0),
|
||||||
|
drvSel.m_bRegistry,
|
||||||
|
drvSel.m_bMountMgr
|
||||||
|
);
|
||||||
|
|
||||||
|
OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMountPoints::OnChangeMountpoint()
|
||||||
|
{
|
||||||
|
CHAR odrvChar = 0;
|
||||||
|
CHAR ndrvChar = 0;
|
||||||
|
|
||||||
|
CSelectDrvLetter drvSel;
|
||||||
|
STORAGE_BUS_TYPE busType = BusTypeAta;
|
||||||
|
|
||||||
|
if (m_Part) {
|
||||||
|
busType = m_Part->Disk->SDD.BusType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Volume && m_Volume->Part) {
|
||||||
|
busType = m_Volume->Part->Disk->SDD.BusType;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if TRUE
|
||||||
|
|
||||||
|
drvSel.m_bMountMgr = FALSE;
|
||||||
|
drvSel.m_bRegistry = FALSE;
|
||||||
|
drvSel.m_bDosDev = TRUE;
|
||||||
|
|
||||||
|
#else
|
||||||
|
if (m_Cdrom ||
|
||||||
|
busType == BusType1394 ||
|
||||||
|
busType == BusTypeUsb ) {
|
||||||
|
|
||||||
|
drvSel.m_bMountMgr = TRUE;
|
||||||
|
drvSel.m_bRegistry = FALSE;
|
||||||
|
drvSel.m_bDosDev = FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (drvSel.DoModal() != IDOK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ndrvChar = drvSel.m_DrvLetter.GetAt(0);
|
||||||
|
odrvChar = m_Letter.GetAt(0);
|
||||||
|
|
||||||
|
if (RemoveMountPoint(odrvChar)) {
|
||||||
|
AddMountPoint(
|
||||||
|
ndrvChar,
|
||||||
|
drvSel.m_bRegistry,
|
||||||
|
drvSel.m_bMountMgr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
CMountPoints::RemoveMountPoint(CHAR drvChar)
|
||||||
|
{
|
||||||
|
PEXT2_LETTER drvLetter = NULL;
|
||||||
|
ULONGLONG letterMask = 0;
|
||||||
|
|
||||||
|
if (drvChar >= '0' && drvChar <= '9') {
|
||||||
|
drvLetter = &drvDigits[drvChar - '0'];
|
||||||
|
letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
|
||||||
|
} else if (drvChar >= 'A' && drvChar <= 'Z') {
|
||||||
|
drvLetter = &drvLetters[drvChar - 'A'];
|
||||||
|
letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!drvLetter) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext2SetRegistryMountPoint(&drvChar, NULL, FALSE);
|
||||||
|
if (Ext2RemoveDrvLetter(drvLetter)) {
|
||||||
|
|
||||||
|
m_MainDlg->SendMessage(WM_MOUNTPOINT_NOTIFY,
|
||||||
|
'DR', (LPARAM)drvLetter->Letter);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
CString str;
|
||||||
|
str.Format("Failed to remove drive letter %c:\n", drvChar);
|
||||||
|
AfxMessageBox(str, MB_OK|MB_ICONWARNING);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Part) {
|
||||||
|
m_Part->DrvLetters &= (~letterMask);
|
||||||
|
if (m_Part->Volume) {
|
||||||
|
m_Part->Volume->DrvLetters &= ~letterMask;
|
||||||
|
}
|
||||||
|
InitializeList(m_Part->DrvLetters);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Volume) {
|
||||||
|
PEXT2_PARTITION part = Ext2QueryVolumePartition(m_Volume);
|
||||||
|
m_Volume->DrvLetters &= ~letterMask;
|
||||||
|
if (part) {
|
||||||
|
part->DrvLetters &= ~letterMask;
|
||||||
|
}
|
||||||
|
InitializeList(m_Volume->DrvLetters);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Cdrom) {
|
||||||
|
m_Cdrom->DrvLetters &= ~letterMask;
|
||||||
|
InitializeList(m_Cdrom->DrvLetters);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMountPoints::OnRemoveMountpoint()
|
||||||
|
{
|
||||||
|
CHAR drvChar = m_Letter.GetAt(0);
|
||||||
|
|
||||||
|
if (RemoveMountPoint(drvChar)) {
|
||||||
|
SET_WIN(ID_CHANGE_MOUNTPOINT, FALSE);
|
||||||
|
SET_WIN(ID_REMOVE_MOUNTPOINT, FALSE);
|
||||||
|
if (m_drvList.GetItemCount() == 0)
|
||||||
|
OnOK();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMountPoints::OnOK()
|
||||||
|
{
|
||||||
|
// TODO: Add extra validation here
|
||||||
|
|
||||||
|
CDialog::OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMountPoints::OnCancel()
|
||||||
|
{
|
||||||
|
CDialog::OnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMountPoints::InitializeList(ULONGLONG letters)
|
||||||
|
{
|
||||||
|
CHAR drvName[] = "C:\0";
|
||||||
|
int i = 0;
|
||||||
|
ULONGLONG drive = 0;
|
||||||
|
|
||||||
|
m_drvList.DeleteAllItems();
|
||||||
|
|
||||||
|
for (i=0; i < 10; i++) {
|
||||||
|
drive = ((ULONGLONG) 1) << (i + 32);
|
||||||
|
if (letters & drive) {
|
||||||
|
drvName[0] = '0' + i;
|
||||||
|
m_drvList.InsertItem(
|
||||||
|
m_drvList.GetItemCount(),
|
||||||
|
drvName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=2; i < 26; i++) {
|
||||||
|
drive = ((ULONGLONG) 1) << (i);
|
||||||
|
if (letters & drive) {
|
||||||
|
drvName[0] = 'A' + i;
|
||||||
|
m_drvList.InsertItem(
|
||||||
|
m_drvList.GetItemCount(),
|
||||||
|
drvName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMountPoints::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
// TODO: Add extra initialization here
|
||||||
|
ASSERT(m_Volume || m_Part);
|
||||||
|
|
||||||
|
if (m_Part) {
|
||||||
|
InitializeList(m_Part->DrvLetters);
|
||||||
|
} else if (m_Volume) {
|
||||||
|
InitializeList(m_Volume->DrvLetters);
|
||||||
|
} else {
|
||||||
|
InitializeList(m_Cdrom->DrvLetters);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_drvList.SetSelectionMark(0);
|
||||||
|
m_drvList.SetFocus();
|
||||||
|
m_Letter = m_drvList.GetItemText(0, 0);
|
||||||
|
|
||||||
|
if (m_Letter.IsEmpty()) {
|
||||||
|
SET_WIN(ID_CHANGE_MOUNTPOINT, FALSE);
|
||||||
|
SET_WIN(ID_REMOVE_MOUNTPOINT, FALSE);
|
||||||
|
} else {
|
||||||
|
SET_WIN(ID_CHANGE_MOUNTPOINT, TRUE);
|
||||||
|
SET_WIN(ID_REMOVE_MOUNTPOINT, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMountPoints::PreTranslateMessage(MSG* pMsg)
|
||||||
|
{
|
||||||
|
// TODO: Add your specialized code here and/or call the base class
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (pMsg->message==WM_KEYDOWN) {
|
||||||
|
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) {
|
||||||
|
pMsg->wParam = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return CDialog::PreTranslateMessage(pMsg);
|
||||||
|
}
|
||||||
75
Ext2Mgr/MountPoints.h
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#if !defined(AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_)
|
||||||
|
#define AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_
|
||||||
|
|
||||||
|
#include "SelectDrvLetter.h"
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// MountPoints.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMountPoints dialog
|
||||||
|
|
||||||
|
class CMountPoints : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CMountPoints(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CMountPoints)
|
||||||
|
enum { IDD = IDD_CHANGE_MOUNTPINT };
|
||||||
|
CListCtrl m_drvList;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
void InitializeList(ULONGLONG letters);
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
PEXT2_CDROM m_Cdrom;
|
||||||
|
PEXT2_VOLUME m_Volume;
|
||||||
|
PEXT2_PARTITION m_Part;
|
||||||
|
CString m_Letter;
|
||||||
|
BOOL m_bUpdated;
|
||||||
|
BOOL m_bMgrNoted;
|
||||||
|
|
||||||
|
CWnd * m_MainDlg;
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
RemoveMountPoint(CHAR drvChar);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
AddMountPoint(CHAR drvChar, BOOL bRegistry, BOOL bMountMgr);
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMountPoints)
|
||||||
|
public:
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CMountPoints)
|
||||||
|
afx_msg void OnClickDrvLetterList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnAddMountpoint();
|
||||||
|
afx_msg void OnChangeMountpoint();
|
||||||
|
afx_msg void OnRemoveMountpoint();
|
||||||
|
virtual void OnOK();
|
||||||
|
virtual void OnCancel();
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MOUNTPOINTS_H__83141F47_96A4_4335_B42C_F2F7EB6F0ADD__INCLUDED_)
|
||||||
131
Ext2Mgr/PartBox.cpp
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
// PartBox.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "PartBox.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPartBox
|
||||||
|
|
||||||
|
CPartBox::CPartBox()
|
||||||
|
{
|
||||||
|
m_nID = IDC_PROPERTY_SDEV;
|
||||||
|
m_nLeft = 10;
|
||||||
|
m_nSize = 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPartBox::~CPartBox()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CPartBox, CButton)
|
||||||
|
//{{AFX_MSG_MAP(CPartBox)
|
||||||
|
ON_WM_SETFOCUS()
|
||||||
|
ON_CBN_SELCHANGE(IDC_PROPERTY_SDEV, OnSelectChanged)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPartBox message handlers
|
||||||
|
|
||||||
|
void CPartBox::OnSelectChanged()
|
||||||
|
{
|
||||||
|
GetParent()->SendMessage(WM_GROUP_BOX_UPDATED, 'GB', 'PVLU');
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPartBox::PreSubclassWindow()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Make sure that this control has the BS_ICON style set.
|
||||||
|
// If not, it behaves very strangely:
|
||||||
|
// It erases itself if the user TABs to controls in the dialog,
|
||||||
|
// unless the user first clicks it. Very strange!!
|
||||||
|
//
|
||||||
|
|
||||||
|
ModifyStyle(0, BS_ICON|WS_TABSTOP|WS_GROUP);
|
||||||
|
|
||||||
|
CString strTitle;
|
||||||
|
GetWindowText(strTitle);
|
||||||
|
|
||||||
|
int nWidth = AssemblingTitle();
|
||||||
|
|
||||||
|
CRect r;
|
||||||
|
GetWindowRect(&r);
|
||||||
|
ScreenToClient(r);
|
||||||
|
|
||||||
|
r.OffsetRect(m_nLeft, 0);
|
||||||
|
r.bottom = r.top + m_nSize;
|
||||||
|
r.right = r.left + m_nSize + nWidth;
|
||||||
|
|
||||||
|
m_ComboBox.Create(WS_CHILD | CBS_DROPDOWN | WS_VSCROLL |
|
||||||
|
CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST,
|
||||||
|
r, this, m_nID);
|
||||||
|
m_ComboBox.SetFont(GetFont(), true);
|
||||||
|
m_ComboBox.ShowWindow(SW_SHOW);
|
||||||
|
|
||||||
|
SetListboxHeight(m_ComboBox.m_hWnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CPartBox::AssemblingTitle()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// The group box title needs to be erased, but I need to keep
|
||||||
|
// the border away from the check box text. I create a string
|
||||||
|
// of spaces (' ') that is the same length as the title was
|
||||||
|
// plus the size of the checkbox. plus a little more.
|
||||||
|
//
|
||||||
|
|
||||||
|
CString strOldTitle, strNewTitle;
|
||||||
|
GetWindowText(strOldTitle);
|
||||||
|
|
||||||
|
CClientDC dc(this);
|
||||||
|
CFont* pOldFont = dc.SelectObject(GetFont());
|
||||||
|
|
||||||
|
CSize czText = dc.GetTextExtent(strOldTitle);
|
||||||
|
int nRet = czText.cx;
|
||||||
|
int nTarget = czText.cx + m_nSize;
|
||||||
|
|
||||||
|
while(czText.cx < nTarget)
|
||||||
|
{
|
||||||
|
strNewTitle.Insert(0, ' ');
|
||||||
|
czText = dc.GetTextExtent(strNewTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.SelectObject(pOldFont);
|
||||||
|
|
||||||
|
SetWindowText(strNewTitle);
|
||||||
|
return nRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPartBox::OnSetFocus(CWnd* pOldWnd)
|
||||||
|
{
|
||||||
|
CButton::OnSetFocus(pOldWnd);
|
||||||
|
m_ComboBox.SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CPartBox::SetListboxHeight(HWND hWnd)
|
||||||
|
{
|
||||||
|
RECT rc;
|
||||||
|
|
||||||
|
::SendMessage(hWnd, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
||||||
|
::GetClientRect(hWnd, &rc);
|
||||||
|
int cyClient= rc.bottom - rc.top;
|
||||||
|
|
||||||
|
::GetWindowRect(hWnd, &rc);
|
||||||
|
int cxListbox = rc.right - rc.left;
|
||||||
|
int cyListbox = rc.bottom - rc.top;
|
||||||
|
|
||||||
|
cyListbox = 120;
|
||||||
|
::SetWindowPos(hWnd, NULL, 0, 0,
|
||||||
|
cxListbox, cyListbox,
|
||||||
|
SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS|
|
||||||
|
SWP_NOOWNERZORDER|SWP_NOZORDER
|
||||||
|
);
|
||||||
|
}
|
||||||
61
Ext2Mgr/PartBox.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#if !defined(AFX_PART_BOX_H_)
|
||||||
|
#define AFX_PART_BOX_H_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// PartBox.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPartBox window
|
||||||
|
|
||||||
|
class CPartBox : public CButton
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CPartBox();
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
void SetListboxHeight(HWND hWnd);
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CPartBox)
|
||||||
|
protected:
|
||||||
|
virtual void PreSubclassWindow();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CPartBox();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CPartBox)
|
||||||
|
afx_msg void OnSetFocus(CWnd* pOldWnd);
|
||||||
|
afx_msg void OnSelectChanged();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
int m_nID;
|
||||||
|
int m_nLeft;
|
||||||
|
int m_nSize;
|
||||||
|
|
||||||
|
CComboBox m_ComboBox;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
int AssemblingTitle();
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif
|
||||||
93
Ext2Mgr/PartitionType.cpp
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
// PartitionType.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "PartitionType.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPartitionType dialog
|
||||||
|
|
||||||
|
|
||||||
|
CPartitionType::CPartitionType(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CPartitionType::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CPartitionType)
|
||||||
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
|
m_Part = NULL;
|
||||||
|
m_cPartType = 0;
|
||||||
|
m_sDevice = _T("");
|
||||||
|
m_sPartType = _T("");
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CPartitionType::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CPartitionType)
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CPartitionType, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CPartitionType)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPartitionType message handlers
|
||||||
|
|
||||||
|
void CPartitionType::OnOK()
|
||||||
|
{
|
||||||
|
CString str;
|
||||||
|
CComboBox *cbList = (CComboBox *)GetDlgItem(IDC_PARTTION_TYPE_LIST);
|
||||||
|
m_cPartType = (UCHAR) cbList->GetCurSel();
|
||||||
|
if (m_cPartType != m_Part->Entry->Mbr.PartitionType) {
|
||||||
|
if (Ext2SetPartitionType(m_Part, m_cPartType)) {
|
||||||
|
str.Format("Succeed to set partition type to %2.2X: %s",
|
||||||
|
m_cPartType, PartitionString(m_cPartType));
|
||||||
|
AfxMessageBox(str, MB_OK | MB_ICONINFORMATION);
|
||||||
|
} else {
|
||||||
|
AfxMessageBox("Failed to set the partition type!",
|
||||||
|
MB_OK | MB_ICONWARNING);
|
||||||
|
m_cPartType = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AfxMessageBox("Same partition type to the previous. Nothing is changed !",
|
||||||
|
MB_OK | MB_ICONWARNING);
|
||||||
|
}
|
||||||
|
|
||||||
|
CDialog::OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CPartitionType::OnInitDialog()
|
||||||
|
{
|
||||||
|
CString str, type;
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
SET_TEXT(IDC_PARTITION_NAME, m_sDevice);
|
||||||
|
|
||||||
|
CComboBox *cbList = (CComboBox *)GetDlgItem(IDC_PARTTION_TYPE_LIST);
|
||||||
|
for (unsigned int i=0; i < 0x100; i++) {
|
||||||
|
type = PartitionString(i);
|
||||||
|
str.Format("%2.2X ", i);
|
||||||
|
if (type.CompareNoCase("UNKNOWN")) {
|
||||||
|
str += type;
|
||||||
|
}
|
||||||
|
cbList->AddString(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_cPartType = m_Part->Entry->Mbr.PartitionType;
|
||||||
|
cbList->SetCurSel((int) m_cPartType);
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
57
Ext2Mgr/PartitionType.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#if !defined(AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_)
|
||||||
|
#define AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// PartitionType.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPartitionType dialog
|
||||||
|
|
||||||
|
class CPartitionType : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CPartitionType(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CPartitionType)
|
||||||
|
enum { IDD = IDD_PARTITION_TYPE };
|
||||||
|
// NOTE: the ClassWizard will add data members here
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CPartitionType)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
CString m_sPartType;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
PEXT2_PARTITION m_Part;
|
||||||
|
UCHAR m_cPartType;
|
||||||
|
CString m_sDevice;
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CPartitionType)
|
||||||
|
virtual void OnOK();
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_PARTITIONTYPE_H__7BBDDABB_64CE_4448_92DA_D57973E423A5__INCLUDED_)
|
||||||
267
Ext2Mgr/PerfStatDlg.cpp
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
// PerfStatDlg.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "PerfStatDlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPerfStatDlg dialog
|
||||||
|
|
||||||
|
|
||||||
|
CPerfStatDlg::CPerfStatDlg(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CPerfStatDlg::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CPerfStatDlg)
|
||||||
|
m_Interval = 30;
|
||||||
|
m_Handle = 0;
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
m_IrpList = NULL;
|
||||||
|
m_MemList = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPerfStatDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CPerfStatDlg)
|
||||||
|
DDX_Text(pDX, IDC_PERFSTAT_INTERVAL, m_Interval);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CPerfStatDlg, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CPerfStatDlg)
|
||||||
|
ON_WM_TIMER()
|
||||||
|
ON_WM_DESTROY()
|
||||||
|
ON_COMMAND(ID_QUERYPERF, OnQueryPerf)
|
||||||
|
ON_EN_CHANGE(IDC_PERFSTAT_INTERVAL, OnChangePerfstatInterval)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPerfStatDlg message handlers
|
||||||
|
|
||||||
|
BOOL CPerfStatDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
LONG_PTR dwStyle = 0;
|
||||||
|
int i;
|
||||||
|
CString s;
|
||||||
|
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
|
||||||
|
m_IrpList = (CListCtrl *)GetDlgItem(IDC_IRP_LIST);
|
||||||
|
m_MemList = (CListCtrl *)GetDlgItem(IDC_MEMORY_LIST);;
|
||||||
|
|
||||||
|
if (m_IrpList == NULL || m_MemList == NULL) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize the memory list */
|
||||||
|
dwStyle=GetWindowLongPtr(m_MemList->GetSafeHwnd(), GWL_STYLE);
|
||||||
|
dwStyle&=~LVS_TYPEMASK;
|
||||||
|
dwStyle|= (LVS_REPORT | LVS_AUTOARRANGE);
|
||||||
|
SetWindowLongPtr(m_MemList->GetSafeHwnd(),GWL_STYLE,dwStyle);
|
||||||
|
m_MemList->SetExtendedStyle(LVS_EX_GRIDLINES);
|
||||||
|
ListView_SetExtendedListViewStyleEx (
|
||||||
|
m_MemList->GetSafeHwnd(),
|
||||||
|
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );
|
||||||
|
|
||||||
|
m_MemList->DeleteAllItems();
|
||||||
|
|
||||||
|
s.LoadString(IDS_PERFSTAT_NAME);
|
||||||
|
m_MemList->InsertColumn(0, (LPCSTR)s, LVCFMT_RIGHT, 100);
|
||||||
|
|
||||||
|
s.LoadString(IDS_PERFSTAT_UNIT);
|
||||||
|
m_MemList->InsertColumn(1, (LPCSTR)s, LVCFMT_RIGHT, 40);
|
||||||
|
|
||||||
|
s.LoadString(IDS_PERFSTAT_CURRENT);
|
||||||
|
m_MemList->InsertColumn(2, (LPCSTR)s, LVCFMT_RIGHT, 56);
|
||||||
|
|
||||||
|
s.LoadString(IDS_PERFSTAT_SIZE);
|
||||||
|
m_MemList->InsertColumn(3, (LPCSTR)s, LVCFMT_RIGHT, 80);
|
||||||
|
|
||||||
|
s.LoadString(IDS_PERFSTAT_TOTAL);
|
||||||
|
m_MemList->InsertColumn(4, (LPCSTR)s, LVCFMT_RIGHT, 120);
|
||||||
|
for (i = 0; PerfStatStrings[i] != NULL ; i++) {
|
||||||
|
m_MemList->InsertItem(i, PerfStatStrings[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize the irp list */
|
||||||
|
dwStyle=GetWindowLongPtr(m_IrpList->GetSafeHwnd(), GWL_STYLE);
|
||||||
|
dwStyle&=~LVS_TYPEMASK;
|
||||||
|
dwStyle|= (LVS_REPORT | LVS_AUTOARRANGE);
|
||||||
|
SetWindowLongPtr(m_IrpList->GetSafeHwnd(),GWL_STYLE,dwStyle);
|
||||||
|
m_IrpList->SetExtendedStyle(LVS_EX_GRIDLINES);
|
||||||
|
ListView_SetExtendedListViewStyleEx (
|
||||||
|
m_IrpList->GetSafeHwnd(),
|
||||||
|
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );
|
||||||
|
|
||||||
|
m_IrpList->DeleteAllItems();
|
||||||
|
|
||||||
|
s.LoadString(IDS_PERFSTAT_NAME);
|
||||||
|
m_IrpList->InsertColumn(0, (LPCSTR)s, LVCFMT_RIGHT, 180);
|
||||||
|
|
||||||
|
s.LoadString(IDS_PERFSTAT_PROCESSING);
|
||||||
|
m_IrpList->InsertColumn(1, (LPCSTR)s, LVCFMT_RIGHT, 110);
|
||||||
|
|
||||||
|
s.LoadString(IDS_PERFSTAT_PROCESSED);
|
||||||
|
m_IrpList->InsertColumn(2, (LPCSTR)s, LVCFMT_RIGHT, 100);
|
||||||
|
for (i=0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
|
||||||
|
m_IrpList->InsertItem(i, IrpMjStrings[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshPerfStat();
|
||||||
|
|
||||||
|
SetTimer('STAT', m_Interval * 1000, NULL);
|
||||||
|
UpdateData(FALSE);
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPerfStatDlg::RefreshPerfStat()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CString s;
|
||||||
|
|
||||||
|
PEXT2_PERF_STATISTICS_V1 PerfV1 = NULL;
|
||||||
|
PEXT2_PERF_STATISTICS_V2 PerfV2 = NULL;
|
||||||
|
|
||||||
|
NT::NTSTATUS status;
|
||||||
|
|
||||||
|
if (m_Handle == 0) {
|
||||||
|
status = Ext2Open("\\DosDevices\\Ext2Fsd", &m_Handle,
|
||||||
|
EXT2_DESIRED_ACCESS );
|
||||||
|
if (!NT_SUCCESS(status)) {
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Ext2QueryPerfStat(m_Handle, &m_PerfStat, &PerfV1, &PerfV2)) {
|
||||||
|
|
||||||
|
if (PerfV2) {
|
||||||
|
|
||||||
|
if (m_MemList) {
|
||||||
|
for (i = 0; i < PS_MAX_TYPE_V2; i++) {
|
||||||
|
if (PerfV2->Unit.Slot[i] == 0)
|
||||||
|
break;
|
||||||
|
else if (PerfV2->Unit.Slot[i] == 1)
|
||||||
|
s = "*";
|
||||||
|
else
|
||||||
|
s.Format("%u", PerfV2->Unit.Slot[i]);
|
||||||
|
m_MemList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
s.Format("%u", PerfV2->Current.Slot[i]);
|
||||||
|
m_MemList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
s.Format("%u", PerfV2->Size.Slot[i]);
|
||||||
|
m_MemList->SetItem(i, 3, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
s.Format("%u", PerfV2->Total.Slot[i]);
|
||||||
|
m_MemList->SetItem(i, 4, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_IrpList) {
|
||||||
|
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
|
||||||
|
s.Format("%u", PerfV2->Irps[i].Current);
|
||||||
|
m_IrpList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
s.Format("%u", PerfV2->Irps[i].Processed);
|
||||||
|
m_IrpList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (PerfV1) {
|
||||||
|
|
||||||
|
if (m_MemList) {
|
||||||
|
for (i = 0; i < PS_MAX_TYPE_V1; i++) {
|
||||||
|
|
||||||
|
if (PerfV1->Unit.Slot[i] == 0)
|
||||||
|
s = "*";
|
||||||
|
else
|
||||||
|
s.Format("%u", PerfV1->Unit.Slot[i]);
|
||||||
|
m_MemList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
s.Format("%u", PerfV1->Current.Slot[i]);
|
||||||
|
m_MemList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
s.Format("%u", PerfV1->Size.Slot[i]);
|
||||||
|
m_MemList->SetItem(i, 3, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
s.Format("%u", PerfV1->Total.Slot[i]);
|
||||||
|
m_MemList->SetItem(i, 4, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_IrpList) {
|
||||||
|
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
|
||||||
|
s.Format("%u", PerfV1->Irps[i].Current);
|
||||||
|
m_IrpList->SetItem(i, 1, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
s.Format("%u", PerfV1->Irps[i].Processed);
|
||||||
|
m_IrpList->SetItem(i, 2, LVIF_TEXT, (LPCSTR)s, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Ext2Close(&m_Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPerfStatDlg::OnTimer(UINT nIDEvent)
|
||||||
|
{
|
||||||
|
RefreshPerfStat();
|
||||||
|
|
||||||
|
CDialog::OnTimer(nIDEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPerfStatDlg::OnDestroy()
|
||||||
|
{
|
||||||
|
KillTimer('STAT');
|
||||||
|
Ext2Close(&m_Handle);
|
||||||
|
CDialog::OnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPerfStatDlg::OnChangePerfstatInterval()
|
||||||
|
{
|
||||||
|
UpdateData(TRUE);
|
||||||
|
|
||||||
|
if (m_Interval == 0) {
|
||||||
|
m_Interval = 1;
|
||||||
|
}
|
||||||
|
SetTimer('STAT', m_Interval * 1000, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPerfStatDlg::OnOK()
|
||||||
|
{
|
||||||
|
// TODO: Add extra validation here
|
||||||
|
KillTimer('STAT');
|
||||||
|
Ext2Close(&m_Handle);
|
||||||
|
GetParent()->PostMessage(WM_COMMAND, ID_PERFSTOP, 0);
|
||||||
|
CDialog::OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPerfStatDlg::OnCancel()
|
||||||
|
{
|
||||||
|
// TODO: Add extra validation here
|
||||||
|
KillTimer('STAT');
|
||||||
|
Ext2Close(&m_Handle);
|
||||||
|
GetParent()->PostMessage(WM_COMMAND, ID_PERFSTOP, 0);
|
||||||
|
CDialog::OnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPerfStatDlg::OnQueryPerf()
|
||||||
|
{
|
||||||
|
RefreshPerfStat();
|
||||||
|
}
|
||||||
60
Ext2Mgr/PerfStatDlg.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
#if !defined(AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_)
|
||||||
|
#define AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// PerfStatDlg.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPerfStatDlg dialog
|
||||||
|
|
||||||
|
class CPerfStatDlg : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CPerfStatDlg(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CPerfStatDlg)
|
||||||
|
enum { IDD = IDD_PERFSTAT_DIALOG };
|
||||||
|
int m_Interval;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
CListCtrl * m_IrpList;
|
||||||
|
CListCtrl * m_MemList;
|
||||||
|
|
||||||
|
HANDLE m_Handle;
|
||||||
|
EXT2_QUERY_PERFSTAT m_PerfStat;
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CPerfStatDlg)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CPerfStatDlg)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnTimer(UINT nIDEvent);
|
||||||
|
afx_msg void OnDestroy();
|
||||||
|
afx_msg void OnChangePerfstatInterval();
|
||||||
|
virtual void OnOK();
|
||||||
|
virtual void OnCancel();
|
||||||
|
|
||||||
|
afx_msg void OnQueryPerf();
|
||||||
|
|
||||||
|
void RefreshPerfStat();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_PERFSTATDLG_H__E75F834E_0A81_4B82_BA17_D204EA1EC094__INCLUDED_)
|
||||||
766
Ext2Mgr/Properties.cpp
Normal file
@@ -0,0 +1,766 @@
|
|||||||
|
// Properties.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "Ext2MgrDlg.h"
|
||||||
|
#include "Properties.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "SelectDrvLetter.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CProperties dialog
|
||||||
|
|
||||||
|
|
||||||
|
CProperties::CProperties(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CProperties::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CProperties)
|
||||||
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
m_bdisk = FALSE;
|
||||||
|
m_type = 0;
|
||||||
|
m_sdev = NULL;
|
||||||
|
|
||||||
|
m_volume = NULL;
|
||||||
|
m_cdrom = NULL;
|
||||||
|
m_disk = NULL;
|
||||||
|
m_part = NULL;
|
||||||
|
|
||||||
|
cbDiskBox = &m_DiskBox.m_ComboBox;
|
||||||
|
cbPartBox = &m_PartBox.m_ComboBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CProperties::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CProperties)
|
||||||
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||||
|
DDX_Control(pDX, IDC_PROPERTY_DEVICE, m_DiskBox);
|
||||||
|
DDX_Control(pDX, IDC_PROPERTY_SDEV, m_PartBox);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CProperties, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CProperties)
|
||||||
|
ON_BN_CLICKED(IDC_SDEV_QUICK_MOUNT, OnSdevQuickMount)
|
||||||
|
ON_BN_CLICKED(IDC_SDEV_CHANGE_MP, OnSdevChangeMp)
|
||||||
|
ON_BN_CLICKED(IDC_SDEV_EXT2_INFO, OnSdevExt2Info)
|
||||||
|
ON_MESSAGE(WM_GROUP_BOX_UPDATED, OnGroupBoxUpdated)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CProperties message handlers
|
||||||
|
|
||||||
|
void CProperties::ResetDiskGroup()
|
||||||
|
{
|
||||||
|
CString s = "";
|
||||||
|
|
||||||
|
SET_TEXT(IDC_VENDOR_ID, s);
|
||||||
|
SET_TEXT(IDC_PRODUCT_ID, s);
|
||||||
|
SET_TEXT(IDC_SERIAL_NUMBER, s);
|
||||||
|
SET_TEXT(IDC_BUS_TYPE, s);
|
||||||
|
SET_TEXT(IDC_DEVICE_TYPE, s);
|
||||||
|
SET_TEXT(IDC_TOTAL_SIZE, s);
|
||||||
|
SET_TEXT(IDC_MEDIA_TYPE, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProperties::ResetPartGroup()
|
||||||
|
{
|
||||||
|
CString s = "";
|
||||||
|
|
||||||
|
SET_TEXT(IDC_MOUNT_POINTS, s);
|
||||||
|
SET_TEXT(IDC_SDEV_STATUS, s);
|
||||||
|
SET_TEXT(IDC_SDEV_SIZE, s);
|
||||||
|
SET_TEXT(IDC_SDEV_FREE_SIZE, s);
|
||||||
|
SET_TEXT(IDC_FILE_SYSTEM, s);
|
||||||
|
SET_WIN(IDC_SDEV_CHANGE_MP, FALSE);
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, FALSE);
|
||||||
|
SET_WIN(IDC_SDEV_EXT2_INFO, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProperties::OnSdevChangeMp()
|
||||||
|
{
|
||||||
|
CMountPoints mntPoint;
|
||||||
|
BOOL bInited = FALSE;
|
||||||
|
|
||||||
|
if (m_cdrom) {
|
||||||
|
ASSERT(!bInited);
|
||||||
|
mntPoint.m_Cdrom = m_cdrom;
|
||||||
|
bInited = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_part) {
|
||||||
|
ASSERT(!bInited);
|
||||||
|
mntPoint.m_Part = m_part;
|
||||||
|
bInited = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_volume) {
|
||||||
|
ASSERT(!bInited);
|
||||||
|
mntPoint.m_Volume = m_volume;
|
||||||
|
bInited = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bInited) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mntPoint.m_MainDlg = GetParent();
|
||||||
|
mntPoint.DoModal();
|
||||||
|
|
||||||
|
if (mntPoint.m_bUpdated) {
|
||||||
|
CExt2MgrDlg * Parent = (CExt2MgrDlg *)GetParent();
|
||||||
|
|
||||||
|
if (mntPoint.m_Volume) {
|
||||||
|
Parent->UpdateVolume(mntPoint.m_Volume);
|
||||||
|
}
|
||||||
|
if (mntPoint.m_Cdrom) {
|
||||||
|
Parent->UpdateCdrom(mntPoint.m_Cdrom);
|
||||||
|
}
|
||||||
|
if (mntPoint.m_Part) {
|
||||||
|
Parent->UpdatePartition(mntPoint.m_Part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProperties::OnSdevQuickMount()
|
||||||
|
{
|
||||||
|
PCHAR dev = NULL;
|
||||||
|
|
||||||
|
if (m_cdrom) {
|
||||||
|
dev = m_cdrom->Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_part) {
|
||||||
|
if (m_part->Volume)
|
||||||
|
dev = m_part->Volume->Name;
|
||||||
|
else
|
||||||
|
dev = m_part->Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_volume) {
|
||||||
|
dev = m_volume->Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dev) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Ext2MountVolume(dev)) {
|
||||||
|
CExt2MgrDlg * Parent = (CExt2MgrDlg *)GetParent();
|
||||||
|
if (m_cdrom) {
|
||||||
|
Parent->UpdateCdrom(m_cdrom);
|
||||||
|
} else if (m_volume) {
|
||||||
|
Parent->UpdateVolume(m_volume);
|
||||||
|
} else if (m_part) {
|
||||||
|
Parent->UpdateVolume(m_part->Volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProperties::OnSdevExt2Info()
|
||||||
|
{
|
||||||
|
NT::NTSTATUS status;
|
||||||
|
HANDLE Handle = NULL;
|
||||||
|
CString s;
|
||||||
|
|
||||||
|
CExt2Attribute EA;
|
||||||
|
PEXT2_VOLUME_PROPERTY3 EVP = NULL;
|
||||||
|
|
||||||
|
if (m_cdrom && (m_cdrom->EVP.bExt2 || m_cdrom->EVP.bExt3)) {
|
||||||
|
EVP = &m_cdrom->EVP;
|
||||||
|
EA.m_bCdrom = TRUE;
|
||||||
|
EA.m_DevName = m_cdrom->Name;
|
||||||
|
} else if (m_volume) {
|
||||||
|
EVP = &m_volume->EVP;
|
||||||
|
if (m_volume->Part)
|
||||||
|
EA.m_DevName = m_volume->Part->Name;
|
||||||
|
else
|
||||||
|
EA.m_DevName = m_volume->Name;
|
||||||
|
} else if (m_part) {
|
||||||
|
EVP = &m_part->Volume->EVP;
|
||||||
|
EA.m_DevName = m_part->Volume->Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EVP) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EA.m_MainDlg = GetParent();
|
||||||
|
EA.m_EVP = EVP;
|
||||||
|
|
||||||
|
status = Ext2Open(EA.m_DevName.GetBuffer(EA.m_DevName.GetLength()),
|
||||||
|
&Handle, EXT2_DESIRED_ACCESS);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(status)) {
|
||||||
|
|
||||||
|
s.Format("Ext2Fsd service isn't started.\n");
|
||||||
|
AfxMessageBox(s, MB_OK | MB_ICONSTOP);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!Ext2QueryExt2Property(Handle, EVP)) {
|
||||||
|
Ext2Close(&Handle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext2Close(&Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (EA.DoModal() == IDOK) {
|
||||||
|
CExt2MgrDlg * Parent = (CExt2MgrDlg *)GetParent();
|
||||||
|
if (m_cdrom) {
|
||||||
|
Parent->UpdateCdrom(m_cdrom);
|
||||||
|
} else if (m_volume) {
|
||||||
|
Parent->UpdateVolume(m_volume);
|
||||||
|
} else if (m_part) {
|
||||||
|
Parent->UpdateVolume(m_part->Volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProperties::SetVolume(PEXT2_VOLUME vol)
|
||||||
|
{
|
||||||
|
CString s;
|
||||||
|
|
||||||
|
if (vol->Extent->NumberOfDiskExtents == 1) {
|
||||||
|
m_disk = &gDisks[vol->Extent->Extents[0].DiskNumber];
|
||||||
|
m_part = NULL;
|
||||||
|
for (UCHAR i = 0; i < m_disk->NumParts; i++) {
|
||||||
|
if (m_disk->DataParts[i].Volume == vol) {
|
||||||
|
m_part = &m_disk->DataParts[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m_disk = NULL;
|
||||||
|
m_part = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_part) {
|
||||||
|
m_disk = NULL;
|
||||||
|
m_volume = NULL;
|
||||||
|
SetPartition(m_part);
|
||||||
|
if (0 == m_part->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
else
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, FALSE);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
m_disk = NULL;
|
||||||
|
ResetDiskGroup();
|
||||||
|
if (m_volume) {
|
||||||
|
if (0 == m_volume->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
else
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cbDiskBox->SetCurSel(-1);
|
||||||
|
ResetDiskGroup();
|
||||||
|
|
||||||
|
cbPartBox->ResetContent();
|
||||||
|
cbPartBox->AddString("Volume");
|
||||||
|
cbPartBox->SetCurSel(0);
|
||||||
|
|
||||||
|
/* set mount points */
|
||||||
|
SET_TEXT(IDC_MOUNT_POINTS,
|
||||||
|
Ext2QueryVolumeLetterStrings(
|
||||||
|
vol->DrvLetters, NULL));
|
||||||
|
|
||||||
|
/* set volume status */
|
||||||
|
s = "Online";
|
||||||
|
if (vol->bRecognized && (vol->EVP.bExt2 || vol->EVP.bExt3)) {
|
||||||
|
s += ",codepage:";
|
||||||
|
s += vol->EVP.Codepage;
|
||||||
|
if (vol->EVP.bReadonly) {
|
||||||
|
s += ",Readonly";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_SDEV_STATUS, s);
|
||||||
|
|
||||||
|
{
|
||||||
|
ULONGLONG totalSize, freeSize;
|
||||||
|
totalSize = vol->FssInfo.TotalAllocationUnits.QuadPart;
|
||||||
|
freeSize = vol->FssInfo.AvailableAllocationUnits.QuadPart;
|
||||||
|
totalSize = totalSize * vol->FssInfo.BytesPerSector *
|
||||||
|
vol->FssInfo.SectorsPerAllocationUnit;
|
||||||
|
freeSize = freeSize * vol->FssInfo.BytesPerSector *
|
||||||
|
vol->FssInfo.SectorsPerAllocationUnit;
|
||||||
|
s.Format("%I64u", totalSize);
|
||||||
|
SET_TEXT(IDC_SDEV_SIZE, s);
|
||||||
|
s.Format("%I64u", freeSize);
|
||||||
|
SET_TEXT(IDC_SDEV_FREE_SIZE, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_TEXT(IDC_FILE_SYSTEM, vol->FileSystem);
|
||||||
|
|
||||||
|
SET_WIN(IDC_SDEV_CHANGE_MP, TRUE);
|
||||||
|
if (0 == vol->DrvLetters){
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vol->bRecognized && (vol->EVP.bExt2 || vol->EVP.bExt3)) {
|
||||||
|
SET_WIN(IDC_SDEV_EXT2_INFO, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProperties::SetPartition(PEXT2_PARTITION part)
|
||||||
|
{
|
||||||
|
CString s;
|
||||||
|
|
||||||
|
ResetPartGroup();
|
||||||
|
|
||||||
|
if (m_disk != part->Disk) {
|
||||||
|
SetDisk(m_disk = part->Disk);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_disk->bLoaded || m_disk->Layout == NULL) {
|
||||||
|
cbPartBox->SetCurSel(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbPartBox->SetCurSel(part->Number - 1);
|
||||||
|
|
||||||
|
/* set mount points */
|
||||||
|
SET_TEXT(IDC_MOUNT_POINTS,
|
||||||
|
Ext2QueryVolumeLetterStrings(
|
||||||
|
part->DrvLetters, NULL));
|
||||||
|
|
||||||
|
if (m_disk->SDD.RemovableMedia) {
|
||||||
|
SET_WIN(IDC_SDEV_CHANGE_MP, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (part->Volume) {
|
||||||
|
if (!part->Volume->bDynamic) {
|
||||||
|
SET_WIN(IDC_SDEV_CHANGE_MP, TRUE);
|
||||||
|
}
|
||||||
|
if (0 == part->Volume->DrvLetters){
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s.Format("PARTITION %d", 0);
|
||||||
|
SET_TEXT(IDC_PROPERTY_SDEV, s);
|
||||||
|
|
||||||
|
if (m_disk->SDD.RemovableMedia) {
|
||||||
|
if (m_disk->bEjected) {
|
||||||
|
s = "Media ejected";
|
||||||
|
} else {
|
||||||
|
s = "Stopped";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (m_disk->Layout) {
|
||||||
|
s = "Not recognized";
|
||||||
|
} else {
|
||||||
|
s = "RAW";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == part->DrvLetters){
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_TEXT(IDC_SDEV_STATUS, s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (part->Volume->bRecognized &&
|
||||||
|
(part->Volume->EVP.bExt2 || part->Volume->EVP.bExt3)) {
|
||||||
|
SET_WIN(IDC_SDEV_EXT2_INFO, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
s = "Online,";
|
||||||
|
if (part->Entry->PartitionStyle == PARTITION_STYLE_MBR) {
|
||||||
|
s += PartitionString(part->Entry->Mbr.PartitionType);
|
||||||
|
} else {
|
||||||
|
s += "GPT";
|
||||||
|
}
|
||||||
|
if ( part->Volume->bRecognized &&
|
||||||
|
(part->Volume->EVP.bExt2 || part->Volume->EVP.bExt3)) {
|
||||||
|
s += ",codepage:";
|
||||||
|
s += part->Volume->EVP.Codepage;
|
||||||
|
if (part->Volume->EVP.bReadonly) {
|
||||||
|
s += ",Readonly";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_SDEV_STATUS, s);
|
||||||
|
|
||||||
|
if (part->Volume->bRecognized) {
|
||||||
|
ULONGLONG totalSize, freeSize;
|
||||||
|
totalSize = part->Volume->FssInfo.TotalAllocationUnits.QuadPart;
|
||||||
|
freeSize = part->Volume->FssInfo.AvailableAllocationUnits.QuadPart;
|
||||||
|
totalSize = totalSize * part->Volume->FssInfo.BytesPerSector *
|
||||||
|
part->Volume->FssInfo.SectorsPerAllocationUnit;
|
||||||
|
freeSize = freeSize * part->Volume->FssInfo.BytesPerSector *
|
||||||
|
part->Volume->FssInfo.SectorsPerAllocationUnit;
|
||||||
|
s.Format("%I64u", totalSize);
|
||||||
|
SET_TEXT(IDC_SDEV_SIZE, s);
|
||||||
|
s.Format("%I64u", freeSize);
|
||||||
|
SET_TEXT(IDC_SDEV_FREE_SIZE, s);
|
||||||
|
} else {
|
||||||
|
s.Format("%I64u", part->Entry->PartitionLength.QuadPart);
|
||||||
|
SET_TEXT(IDC_SDEV_SIZE, s);
|
||||||
|
SET_TEXT(IDC_SDEV_FREE_SIZE, "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_TEXT(IDC_FILE_SYSTEM, part->Volume->FileSystem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProperties::SetDisk(PEXT2_DISK disk)
|
||||||
|
{
|
||||||
|
CString s;
|
||||||
|
ULONGLONG size = 1;
|
||||||
|
|
||||||
|
ResetPartGroup();
|
||||||
|
cbPartBox->ResetContent();
|
||||||
|
|
||||||
|
if (!disk->bLoaded) {
|
||||||
|
ResetDiskGroup();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
cbDiskBox->SetCurSel(disk->OrderNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disk->Layout) {
|
||||||
|
for (UCHAR i=0; i < disk->NumParts; i++) {
|
||||||
|
s.Format("PARTITION %u", i+1);
|
||||||
|
cbPartBox->AddString(s.GetBuffer(s.GetLength()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disk->SDD.VendorIdOffset) {
|
||||||
|
s = (PCHAR)&disk->SDD + disk->SDD.VendorIdOffset;
|
||||||
|
} else {
|
||||||
|
s.Empty();
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_VENDOR_ID, s);
|
||||||
|
|
||||||
|
if (disk->SDD.ProductIdOffset) {
|
||||||
|
s = (PCHAR)&disk->SDD + disk->SDD.ProductIdOffset;
|
||||||
|
} else {
|
||||||
|
s.Empty();
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_PRODUCT_ID, s);
|
||||||
|
|
||||||
|
if (disk->SDD.SerialNumberOffset) {
|
||||||
|
s = (PCHAR)&disk->SDD + disk->SDD.SerialNumberOffset;
|
||||||
|
} else {
|
||||||
|
s.Empty();
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_SERIAL_NUMBER, s);
|
||||||
|
|
||||||
|
s = BusTypeString(disk->SDD.BusType);
|
||||||
|
SET_TEXT(IDC_BUS_TYPE, s);
|
||||||
|
|
||||||
|
if (disk->SDD.RemovableMedia) {
|
||||||
|
s = "Removable";
|
||||||
|
} else {
|
||||||
|
s = "RAW";
|
||||||
|
if (disk->Layout) {
|
||||||
|
if (disk->Layout->PartitionStyle == PARTITION_STYLE_MBR) {
|
||||||
|
if (disk->Layout->PartitionEntry->Mbr.PartitionType
|
||||||
|
== PARTITION_LDM) {
|
||||||
|
s.LoadString(IDS_DISK_TYPE_DYN);
|
||||||
|
} else {
|
||||||
|
s.LoadString(IDS_DISK_TYPE_BASIC);
|
||||||
|
}
|
||||||
|
} else if (disk->Layout->PartitionStyle == PARTITION_STYLE_MBR) {
|
||||||
|
s = "GUID";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_DEVICE_TYPE, s);
|
||||||
|
|
||||||
|
if (disk->bEjected) {
|
||||||
|
s = "No media";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* set size */
|
||||||
|
size = size * disk->DiskGeometry.BytesPerSector;
|
||||||
|
size = size * disk->DiskGeometry.SectorsPerTrack;
|
||||||
|
size = size * disk->DiskGeometry.TracksPerCylinder;
|
||||||
|
size = size * disk->DiskGeometry.Cylinders.QuadPart;
|
||||||
|
s.Format("%I64u", size);
|
||||||
|
SET_TEXT(IDC_TOTAL_SIZE, s);
|
||||||
|
|
||||||
|
switch (disk->DiskGeometry.MediaType) {
|
||||||
|
case FixedMedia: s="Fixed"; break;
|
||||||
|
case RemovableMedia: s="Removable"; break;
|
||||||
|
case CD_ROM: s="CDROM"; break;
|
||||||
|
case CD_R: s="CDR"; break;
|
||||||
|
case CD_RW: s="CDRW"; break;
|
||||||
|
case DVD_ROM: s="DVD"; break;
|
||||||
|
case DVD_R: s="DVDR"; break;
|
||||||
|
case DVD_RW: s="DVDRW"; break;
|
||||||
|
default: s="Unkown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_TEXT(IDC_MEDIA_TYPE, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CProperties::SetCdrom(PEXT2_CDROM cdrom)
|
||||||
|
{
|
||||||
|
CString s;
|
||||||
|
ULONGLONG size = 1;
|
||||||
|
|
||||||
|
cbDiskBox->SetCurSel(cdrom->OrderNo + g_nDisks);
|
||||||
|
|
||||||
|
ResetPartGroup();
|
||||||
|
cbPartBox->ResetContent();
|
||||||
|
cbPartBox->AddString("Media");
|
||||||
|
cbPartBox->SetCurSel(0);
|
||||||
|
|
||||||
|
SET_WIN(IDC_SDEV_CHANGE_MP, TRUE);
|
||||||
|
|
||||||
|
if (0 == cdrom->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
|
||||||
|
|
||||||
|
if (cdrom->SDD.VendorIdOffset) {
|
||||||
|
s = (PCHAR)&cdrom->SDD + cdrom->SDD.VendorIdOffset;
|
||||||
|
} else {
|
||||||
|
s.Empty();
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_VENDOR_ID, s);
|
||||||
|
|
||||||
|
if (cdrom->SDD.ProductIdOffset) {
|
||||||
|
s = (PCHAR)&cdrom->SDD + cdrom->SDD.ProductIdOffset;
|
||||||
|
} else {
|
||||||
|
s.Empty();
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_PRODUCT_ID, s);
|
||||||
|
|
||||||
|
if (cdrom->SDD.SerialNumberOffset) {
|
||||||
|
s = (PCHAR)&cdrom->SDD + cdrom->SDD.SerialNumberOffset;
|
||||||
|
} else {
|
||||||
|
s.Empty();
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_SERIAL_NUMBER, s);
|
||||||
|
|
||||||
|
s = BusTypeString(cdrom->SDD.BusType);
|
||||||
|
SET_TEXT(IDC_BUS_TYPE, s);
|
||||||
|
|
||||||
|
s.LoadString(IDS_DISK_TYPE_BASIC);
|
||||||
|
SET_TEXT(IDC_DEVICE_TYPE, s);
|
||||||
|
|
||||||
|
if (cdrom->bLoaded) {
|
||||||
|
if (cdrom->bIsDVD) {
|
||||||
|
s = "DVD";
|
||||||
|
} else {
|
||||||
|
s = "CDROM";
|
||||||
|
}
|
||||||
|
size = size * cdrom->DiskGeometry.BytesPerSector;
|
||||||
|
size = size * cdrom->DiskGeometry.SectorsPerTrack;
|
||||||
|
size = size * cdrom->DiskGeometry.TracksPerCylinder;
|
||||||
|
size = size * cdrom->DiskGeometry.Cylinders.QuadPart;
|
||||||
|
} else {
|
||||||
|
s = "No media";
|
||||||
|
size = 0;
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_MEDIA_TYPE, s);
|
||||||
|
|
||||||
|
if (cdrom->bLoaded) {
|
||||||
|
if (cdrom->bEjected) {
|
||||||
|
s = "Media ejected";
|
||||||
|
} else {
|
||||||
|
s.Format("%I64u", size);
|
||||||
|
SET_TEXT(IDC_TOTAL_SIZE, s);
|
||||||
|
SET_TEXT(IDC_SDEV_SIZE, s);
|
||||||
|
SET_TEXT(IDC_SDEV_FREE_SIZE, "0");
|
||||||
|
|
||||||
|
if (cdrom->EVP.bExt2) {
|
||||||
|
s = "EXT";
|
||||||
|
s += (CHAR)('2' + cdrom->EVP.bExt3);
|
||||||
|
SET_WIN(IDC_SDEV_EXT2_INFO, TRUE);
|
||||||
|
} else {
|
||||||
|
s = "CDFS";
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_FILE_SYSTEM, s);
|
||||||
|
|
||||||
|
s = "Online,";
|
||||||
|
switch (cdrom->DiskGeometry.MediaType) {
|
||||||
|
case FixedMedia: s +="Fixed"; break;
|
||||||
|
case RemovableMedia: s += "Media Removable"; break;
|
||||||
|
case CD_ROM: s +=" CDROM"; break;
|
||||||
|
case CD_R: s += "CDR"; break;
|
||||||
|
case CD_RW: s += "CDRW"; break;
|
||||||
|
case DVD_ROM: s += "DVD"; break;
|
||||||
|
case DVD_R: s += "DVDR"; break;
|
||||||
|
case DVD_RW: s += "DVDRW"; break;
|
||||||
|
default: s += "Unkown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s = "Device stopped";
|
||||||
|
}
|
||||||
|
SET_TEXT(IDC_SDEV_STATUS, s);
|
||||||
|
|
||||||
|
if (0 == cdrom->DrvLetters){
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_TEXT(IDC_MOUNT_POINTS,
|
||||||
|
Ext2QueryVolumeLetterStrings(
|
||||||
|
cdrom->DrvLetters, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CProperties::OnInitDialog()
|
||||||
|
{
|
||||||
|
CString str;
|
||||||
|
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
for (ULONG i = 0; i < g_nDisks; i++) {
|
||||||
|
str.Format("DISK %u", i);
|
||||||
|
cbDiskBox->AddString(str.GetBuffer(str.GetLength()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ULONG i = 0; i < g_nCdroms; i++) {
|
||||||
|
str.Format("CDROM %u", i);
|
||||||
|
cbDiskBox->AddString(str.GetBuffer(str.GetLength()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_WIN(IDC_SDEV_CHANGE_MP, FALSE);
|
||||||
|
SET_WIN(IDC_SDEV_EXT2_INFO, FALSE);
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, FALSE);
|
||||||
|
|
||||||
|
if (m_bdisk) {
|
||||||
|
if (m_type == EXT2_DISK_MAGIC) {
|
||||||
|
m_disk = (PEXT2_DISK) m_sdev;
|
||||||
|
SetDisk(m_disk);
|
||||||
|
} else if (m_type == EXT2_PART_MAGIC) {
|
||||||
|
m_part = (PEXT2_PARTITION) m_sdev;
|
||||||
|
SetPartition(m_part);
|
||||||
|
if (0 == m_part->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
if (m_part->Volume && 0 == m_part->Volume->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
} else if (m_type == EXT2_DISK_NULL_MAGIC) {
|
||||||
|
m_disk = (PEXT2_DISK)m_sdev;
|
||||||
|
SetDisk(m_disk);
|
||||||
|
} else if (m_type == EXT2_CDROM_VOLUME_MAGIC) {
|
||||||
|
m_cdrom = (PEXT2_CDROM)m_sdev;
|
||||||
|
SetCdrom(m_cdrom);
|
||||||
|
if (0 == m_cdrom->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
} else if (m_type == EXT2_CDROM_DEVICE_MAGIC){
|
||||||
|
m_cdrom = (PEXT2_CDROM)m_sdev;
|
||||||
|
SetCdrom(m_cdrom);
|
||||||
|
if (0 == m_cdrom->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_disk && NULL == m_part) {
|
||||||
|
if (m_disk->bLoaded && m_disk->NumParts > 0) {
|
||||||
|
m_part = &m_disk->DataParts[0];
|
||||||
|
SetPartition(m_part);
|
||||||
|
if (0 == m_part->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
if (m_part->Volume && 0 == m_part->Volume->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (m_type == EXT2_VOLUME_MAGIC) {
|
||||||
|
m_volume = (PEXT2_VOLUME)m_sdev;
|
||||||
|
SetVolume(m_volume);
|
||||||
|
if (m_volume && 0 == m_volume->DrvLetters) {
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ASSERT(m_type == EXT2_CDROM_DEVICE_MAGIC);
|
||||||
|
m_cdrom = (PEXT2_CDROM)m_sdev;
|
||||||
|
SetCdrom(m_cdrom);
|
||||||
|
if (0 == m_cdrom->DrvLetters)
|
||||||
|
SET_WIN(IDC_SDEV_QUICK_MOUNT, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT CProperties::OnGroupBoxUpdated(WPARAM wParam,LPARAM lParam)
|
||||||
|
{
|
||||||
|
ULONG i;
|
||||||
|
BOOL bChanged = FALSE;
|
||||||
|
|
||||||
|
if (wParam == 'GB') {
|
||||||
|
if (lParam == 'DVLU') {
|
||||||
|
i = (ULONG)cbDiskBox->GetCurSel();
|
||||||
|
if (i >= g_nDisks) {
|
||||||
|
if (m_disk != NULL || (m_cdrom != NULL &&
|
||||||
|
m_cdrom != &gCdroms[i - g_nDisks])) {
|
||||||
|
m_disk = NULL;
|
||||||
|
m_part = NULL;
|
||||||
|
m_volume = NULL;
|
||||||
|
m_cdrom = &gCdroms[i - g_nDisks];
|
||||||
|
bChanged = TRUE;
|
||||||
|
} else if (m_volume) {
|
||||||
|
m_volume = NULL;
|
||||||
|
m_cdrom = &gCdroms[i - g_nDisks];
|
||||||
|
bChanged = TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (m_cdrom != NULL || (m_disk != NULL &&
|
||||||
|
m_disk != &gDisks[i])) {
|
||||||
|
m_disk = &gDisks[i];
|
||||||
|
m_cdrom = NULL;
|
||||||
|
m_volume = NULL;
|
||||||
|
m_part = NULL;
|
||||||
|
bChanged = TRUE;
|
||||||
|
} else if (m_volume){
|
||||||
|
m_volume = NULL;
|
||||||
|
m_disk = &gDisks[i];
|
||||||
|
bChanged = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bChanged) {
|
||||||
|
|
||||||
|
if (m_cdrom) {
|
||||||
|
SetCdrom(m_cdrom);
|
||||||
|
}
|
||||||
|
if (m_disk) {
|
||||||
|
SetDisk(m_disk);
|
||||||
|
if (m_disk->bLoaded && m_disk->NumParts > 0) {
|
||||||
|
m_part = &m_disk->DataParts[0];
|
||||||
|
SetPartition(m_part);
|
||||||
|
} else {
|
||||||
|
m_part = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lParam == 'PVLU') {
|
||||||
|
i = cbPartBox->GetCurSel();
|
||||||
|
if (m_part && ((i + 1) != m_part->Number)) {
|
||||||
|
m_part = &m_disk->DataParts[i];
|
||||||
|
SetPartition(m_part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
76
Ext2Mgr/Properties.h
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#if !defined(AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_)
|
||||||
|
#define AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// Properties.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "DiskBox.h"
|
||||||
|
#include "PartBox.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CProperties dialog
|
||||||
|
|
||||||
|
class CProperties : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CProperties(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
BOOL m_bdisk;
|
||||||
|
ULONG m_type;
|
||||||
|
PVOID m_sdev;
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CProperties)
|
||||||
|
enum { IDD = IDD_PROPERTY_DIALOG };
|
||||||
|
// NOTE: the ClassWizard will add data members here
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CProperties)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
PEXT2_VOLUME m_volume;
|
||||||
|
PEXT2_CDROM m_cdrom;
|
||||||
|
PEXT2_DISK m_disk;
|
||||||
|
PEXT2_PARTITION m_part;
|
||||||
|
|
||||||
|
CDiskBox m_DiskBox;
|
||||||
|
CPartBox m_PartBox;
|
||||||
|
|
||||||
|
CComboBox *cbDiskBox;
|
||||||
|
CComboBox *cbPartBox;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CProperties)
|
||||||
|
afx_msg void OnSdevChangeMp();
|
||||||
|
afx_msg void OnSdevQuickMount();
|
||||||
|
afx_msg void OnSdevExt2Info();
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
LRESULT OnGroupBoxUpdated(WPARAM wParam,LPARAM lParam);
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
void ResetDiskGroup();
|
||||||
|
void ResetPartGroup();
|
||||||
|
|
||||||
|
void SetDisk(PEXT2_DISK disk);
|
||||||
|
void SetCdrom(PEXT2_CDROM cdrom);
|
||||||
|
void SetVolume(PEXT2_VOLUME volume);
|
||||||
|
void SetPartition(PEXT2_PARTITION part);
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_PROPERTIES_H__859C5D61_7EA7_4CC1_B69A_200D175C4ECE__INCLUDED_)
|
||||||
90
Ext2Mgr/ReadMe.txt
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
|
||||||
|
Table 6.18. GPT partition types defined by Intel. GUID Type Value
|
||||||
|
Description
|
||||||
|
|
||||||
|
00000000-0000-0000-0000-000000000000
|
||||||
|
Unallocated entry
|
||||||
|
|
||||||
|
C12A7328-F81F-11D2-BA4B-00A0C93EC93B
|
||||||
|
EFI system partition
|
||||||
|
|
||||||
|
024DEE41-33E7-11d3-9D69-0008C781F39F
|
||||||
|
Partition with DOS partition table inside
|
||||||
|
|
||||||
|
|
||||||
|
Microsoft has defined some of the type values that it uses, and they are given in Table 6.19.
|
||||||
|
|
||||||
|
Table 6.19. GPT partition types that Microsoft has defined. GUID Type Value
|
||||||
|
Description
|
||||||
|
|
||||||
|
E3C9E316-0B5C-4DB8-817D-f92DF00215AE
|
||||||
|
Microsoft Reserved Partition (MRP)
|
||||||
|
|
||||||
|
EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
|
||||||
|
Primary partition (basic disk)
|
||||||
|
|
||||||
|
5808C8AA-7E8F-42E0-85D2-E1E90434CFB3
|
||||||
|
LDM metadata partition (dynamic disk)
|
||||||
|
|
||||||
|
AF9B60A0-1431-4F62-BC68-3311714A69AD
|
||||||
|
LDM data partition (dynamic disk)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
|
||||||
|
2007/07/09
|
||||||
|
1, bTemporary or not When loading all driver letters
|
||||||
|
2, reload or trace the driver letter changes
|
||||||
|
|
||||||
|
Next version:
|
||||||
|
|
||||||
|
Ext2Mgr:
|
||||||
|
|
||||||
|
1, Format tools
|
||||||
|
7, automatically new-version check and update
|
||||||
|
8, Memory usage, i/o statistics
|
||||||
|
|
||||||
|
2, Graphics in DiskView x
|
||||||
|
3, Registry volume setttings done
|
||||||
|
4, Temporary or Permanent mountpoints done
|
||||||
|
Exit ext2mgr, thenre-open it or re-load the configuration,
|
||||||
|
the settings of "temporary/permanet" will be lost, need
|
||||||
|
re-query this feature when loading driver letters.
|
||||||
|
|
||||||
|
IOCTL via MountMgr, instead of partition editing 2006/11/16
|
||||||
|
|
||||||
|
5, Install Ext2Mgr as a service done, but worth nothing
|
||||||
|
6, Cdrom property support done
|
||||||
|
|
||||||
|
7, more partition types added
|
||||||
|
8, RAW disk support (non-partitioned disk)
|
||||||
|
9, bug in SetGlobalProperty
|
||||||
|
10, profiling/statistics : performance / memory / operation
|
||||||
|
11, Keyboard events handling
|
||||||
|
|
||||||
|
Ext2Fsd:
|
||||||
|
|
||||||
|
1, Vista / Longhorn support (vista is done.)
|
||||||
|
2, Registry settings per volume
|
||||||
|
|
||||||
|
|
||||||
|
2006/10/14
|
||||||
|
|
||||||
|
1, disk map handling (killed, a list is used)
|
||||||
|
2, buttons (donation) (done)
|
||||||
|
3, ext2 volume control, ext2fsd service control
|
||||||
|
4, filedisk
|
||||||
|
5, partition magic
|
||||||
|
6, help documents
|
||||||
|
|
||||||
|
|
||||||
|
2006/10/21
|
||||||
|
|
||||||
|
1, service control: start ext2fsd service via a button (done)
|
||||||
|
2, modify partition entry type (done)
|
||||||
|
3, drive lettre assignment (add 'permanent' checkbox ) (done)
|
||||||
32
Ext2Mgr/SOURCES
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
TARGETNAME=Ext2Mgr
|
||||||
|
TARGETPATH=obj
|
||||||
|
TARGETTYPE=PROGRAM
|
||||||
|
|
||||||
|
USE_MFC=1
|
||||||
|
|
||||||
|
!IF $(_NT_TARGET_VERSION) > 0x500
|
||||||
|
C_DEFINES=/DUSE_MFC6_WITH_ATL7=1,$(C_DEFINES)
|
||||||
|
!ENDIF
|
||||||
|
INCLUDES= .;..\Ext2Srv\;..\Ext3Fsd\include;..\Ext2Srv\Libraries; \
|
||||||
|
$(DDK_INC_PATH);$(SDK_INC_PATH); $(MFC_INC_PATH); \
|
||||||
|
$(MFC_INC_PATH)\..\atlmfc;$(INCLUDES)
|
||||||
|
TARGETLIBS= $(DDK_LIB_PATH)\ntdll.lib $(DDK_LIB_PATH)\setupapi.lib \
|
||||||
|
$(DDK_LIB_PATH)\shell32.lib $(DDK_LIB_PATH)\Comctl32.lib
|
||||||
|
|
||||||
|
PRECOMPILED_CXX=1
|
||||||
|
PRECOMPILED_INCLUDE=stdafx.h
|
||||||
|
|
||||||
|
SXS_MANIFEST=Ext2Mgr.exe.manifest
|
||||||
|
SXS_ASSEMBLY_NAME=Ext2Mgr
|
||||||
|
SXS_ASSEMBLY_VERSION=1.0
|
||||||
|
SXS_ASSEMBLY_LANGUAGE_INDEPENDENT=1
|
||||||
|
SXS_MANIFEST_IN_RESOURCES=1
|
||||||
|
|
||||||
|
SOURCES= DelDeadLetter.cpp DiskBox.cpp DlgView.cpp \
|
||||||
|
Donate.cpp enumDisk.cpp Ext2Attribute.cpp \
|
||||||
|
Ext2Mgr.cpp Ext2MgrDlg.cpp Ext2Pipe.cpp \
|
||||||
|
HyperLink.cpp MountPoints.cpp PartBox.cpp \
|
||||||
|
PartitionType.cpp PerfStatDlg.cpp Properties.cpp \
|
||||||
|
SelectDrvLetter.cpp ServiceManage.cpp Splash.cpp \
|
||||||
|
SysTray.cpp toolbar.cpp TreeList.cpp \
|
||||||
|
Ext2Mgr.rc
|
||||||
166
Ext2Mgr/SelectDrvLetter.cpp
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
// SelectDrvLetter.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "SelectDrvLetter.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSelectDrvLetter dialog
|
||||||
|
|
||||||
|
|
||||||
|
CSelectDrvLetter::CSelectDrvLetter(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CSelectDrvLetter::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CSelectDrvLetter)
|
||||||
|
m_DrvLetter = _T("");
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
|
||||||
|
m_bMountMgr = TRUE;
|
||||||
|
m_bRegistry = FALSE;
|
||||||
|
m_bDosDev = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CSelectDrvLetter::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CSelectDrvLetter)
|
||||||
|
DDX_CBString(pDX, IDC_DRVLETTERS_LIST, m_DrvLetter);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CSelectDrvLetter, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CSelectDrvLetter)
|
||||||
|
ON_BN_CLICKED(IDC_DOSDEV_MP, OnDosdevMount)
|
||||||
|
ON_BN_CLICKED(IDC_PERMANENT_MP, OnMMgrMount)
|
||||||
|
ON_BN_CLICKED(IDC_REGISTRY_MP, OnRegistryMount)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSelectDrvLetter message handlers
|
||||||
|
|
||||||
|
void CSelectDrvLetter::OnOK()
|
||||||
|
{
|
||||||
|
// TODO: Add extra validation here
|
||||||
|
UpdateData(TRUE);
|
||||||
|
|
||||||
|
if (m_DrvLetter.IsEmpty()) {
|
||||||
|
AfxMessageBox("You must select a drive letter.", MB_OK|MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_DRVLETTERS_LIST);
|
||||||
|
if (cbDrvLetter) {
|
||||||
|
int rc = cbDrvLetter->FindStringExact(-1, m_DrvLetter);
|
||||||
|
if (rc == CB_ERR) {
|
||||||
|
AfxMessageBox("Invalid driver letter: "+m_DrvLetter, MB_OK|MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CDialog::OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectDrvLetter::OnCancel()
|
||||||
|
{
|
||||||
|
// TODO: Add extra cleanup here
|
||||||
|
m_DrvLetter.Empty();
|
||||||
|
CDialog::OnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CSelectDrvLetter::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
// TODO: Add extra initialization here
|
||||||
|
|
||||||
|
CComboBox *cbDrvLetter = (CComboBox *)GetDlgItem(IDC_DRVLETTERS_LIST);
|
||||||
|
if (cbDrvLetter) {
|
||||||
|
int i;
|
||||||
|
CHAR drvPath[]="A:\0";
|
||||||
|
cbDrvLetter->ResetContent();
|
||||||
|
for (i=2; i < 26; i++) {
|
||||||
|
if (!drvLetters[i].bUsed) {
|
||||||
|
drvPath[0] = drvLetters[i].Letter;
|
||||||
|
cbDrvLetter->AddString(drvPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
for (i=0; i < 10; i++) {
|
||||||
|
if (!drvDigits[i].bUsed) {
|
||||||
|
drvPath[0] = drvDigits[i].Letter;
|
||||||
|
cbDrvLetter->AddString(drvPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
cbDrvLetter->SetCurSel(0);
|
||||||
|
}
|
||||||
|
UpdateData(FALSE);
|
||||||
|
|
||||||
|
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
|
||||||
|
SET_WIN(IDC_PERMANENT_MP, FALSE);
|
||||||
|
SET_CHECK(IDC_PERMANENT_MP, 0);
|
||||||
|
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectDrvLetter::OnDosdevMount()
|
||||||
|
{
|
||||||
|
if (!m_bDosDev) {
|
||||||
|
m_bDosDev = !m_bDosDev;
|
||||||
|
if (m_bDosDev) {
|
||||||
|
m_bMountMgr = FALSE;
|
||||||
|
m_bRegistry = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
|
||||||
|
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
|
||||||
|
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
|
||||||
|
|
||||||
|
OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectDrvLetter::OnMMgrMount()
|
||||||
|
{
|
||||||
|
if (!m_bMountMgr) {
|
||||||
|
m_bMountMgr = !m_bMountMgr;
|
||||||
|
if (m_bMountMgr) {
|
||||||
|
m_bDosDev = FALSE;
|
||||||
|
m_bRegistry = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
|
||||||
|
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
|
||||||
|
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
|
||||||
|
|
||||||
|
OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectDrvLetter::OnRegistryMount()
|
||||||
|
{
|
||||||
|
if (!m_bRegistry) {
|
||||||
|
m_bRegistry = !m_bRegistry;
|
||||||
|
if (m_bRegistry) {
|
||||||
|
m_bDosDev = FALSE;
|
||||||
|
m_bMountMgr = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_CHECK(IDC_DOSDEV_MP, m_bDosDev);
|
||||||
|
SET_CHECK(IDC_PERMANENT_MP, m_bMountMgr);
|
||||||
|
SET_CHECK(IDC_REGISTRY_MP, m_bRegistry);
|
||||||
|
|
||||||
|
OnOK();
|
||||||
|
}
|
||||||
54
Ext2Mgr/SelectDrvLetter.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#if !defined(AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_)
|
||||||
|
#define AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// SelectDrvLetter.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSelectDrvLetter dialog
|
||||||
|
|
||||||
|
class CSelectDrvLetter : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CSelectDrvLetter(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CSelectDrvLetter)
|
||||||
|
enum { IDD = IDD_NEW_MOUNTPOINT };
|
||||||
|
CString m_DrvLetter;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
BOOL m_bMountMgr;
|
||||||
|
BOOL m_bRegistry;
|
||||||
|
BOOL m_bDosDev;
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CSelectDrvLetter)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CSelectDrvLetter)
|
||||||
|
virtual void OnOK();
|
||||||
|
virtual void OnCancel();
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnDosdevMount();
|
||||||
|
afx_msg void OnMMgrMount();
|
||||||
|
afx_msg void OnRegistryMount();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_SELECTDRVLETTER_H__8FE3FD0E_B375_4956_B36F_733A7EEF2892__INCLUDED_)
|
||||||
222
Ext2Mgr/ServiceManage.cpp
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
// ServiceManage.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ext2mgr.h"
|
||||||
|
#include "ServiceManage.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CServiceManage dialog
|
||||||
|
|
||||||
|
|
||||||
|
CServiceManage::CServiceManage(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CServiceManage::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CServiceManage)
|
||||||
|
m_Codepage = _T("");
|
||||||
|
m_bExt3Writable = FALSE;
|
||||||
|
m_bReadonly = FALSE;
|
||||||
|
m_srvStatus = _T("");
|
||||||
|
m_sPrefix = _T("");
|
||||||
|
m_sSuffix = _T("");
|
||||||
|
m_bAutoMount = FALSE;
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
|
||||||
|
m_nStartmode = 0;
|
||||||
|
|
||||||
|
m_bStarted = Ext2IsServiceStarted();
|
||||||
|
|
||||||
|
if (m_bStarted) {
|
||||||
|
m_srvStatus = _T("Ext2Fsd is already started.");
|
||||||
|
} else {
|
||||||
|
m_srvStatus = _T("Ext2Fsd is NOT started.");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bInited = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CServiceManage::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CServiceManage)
|
||||||
|
DDX_CBString(pDX, IDC_COMBO_CODEPAGE, m_Codepage);
|
||||||
|
DDX_Check(pDX, IDC_EXT3_WRITABLE, m_bExt3Writable);
|
||||||
|
DDX_Check(pDX, IDC_READ_ONLY, m_bReadonly);
|
||||||
|
DDX_Text(pDX, IDC_SERVICE_STATUS, m_srvStatus);
|
||||||
|
DDX_Text(pDX, IDC_GLOBAL_PREFIX, m_sPrefix);
|
||||||
|
DDV_MaxChars(pDX, m_sPrefix, 31);
|
||||||
|
DDX_Text(pDX, IDC_GLOBAL_SUFFIX, m_sSuffix);
|
||||||
|
DDV_MaxChars(pDX, m_sSuffix, 31);
|
||||||
|
DDX_Check(pDX, IDC_EXT3_AUTOMOUNT, m_bAutoMount);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CServiceManage, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CServiceManage)
|
||||||
|
ON_BN_CLICKED(IDC_READ_ONLY, OnReadOnly)
|
||||||
|
ON_BN_CLICKED(IDC_EXT3_WRITABLE, OnExt3Writable)
|
||||||
|
ON_BN_CLICKED(IDC_START_SERVICE, OnStartService)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CServiceManage message handlers
|
||||||
|
|
||||||
|
void CServiceManage::OnReadOnly()
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
UpdateData(TRUE);
|
||||||
|
|
||||||
|
if (m_bReadonly) {
|
||||||
|
m_bExt3Writable = FALSE;
|
||||||
|
}
|
||||||
|
SET_WIN(IDC_EXT3_WRITABLE, !m_bReadonly);
|
||||||
|
|
||||||
|
UpdateData(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CServiceManage::OnExt3Writable()
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CServiceManage::OnCancel()
|
||||||
|
{
|
||||||
|
// TODO: Add extra cleanup here
|
||||||
|
|
||||||
|
CDialog::OnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CServiceManage::OnOK()
|
||||||
|
{
|
||||||
|
BOOL rc;
|
||||||
|
|
||||||
|
// TODO: Add extra validation here
|
||||||
|
UpdateData(TRUE);
|
||||||
|
|
||||||
|
CComboBox *cbStartup = (CComboBox *)GetDlgItem(IDC_COMBO_STARTUP);
|
||||||
|
if (cbStartup) {
|
||||||
|
m_nStartmode = cbStartup->GetCurSel();
|
||||||
|
} else {
|
||||||
|
m_nStartmode = CB_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_nStartmode == CB_ERR) {
|
||||||
|
AfxMessageBox("Invalid startup mode !", MB_OK|MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Codepage.IsEmpty()) {
|
||||||
|
AfxMessageBox("You must select a codepage type.", MB_OK|MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
|
||||||
|
if (cbCodepage) {
|
||||||
|
int rc = cbCodepage->FindStringExact(-1, m_Codepage);
|
||||||
|
if (rc == CB_ERR) {
|
||||||
|
AfxMessageBox("Invalid codepage type: "+m_Codepage, MB_OK|MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AfxMessageBox("Current service settings will be overwritten,\ndo you want continue ?",
|
||||||
|
MB_YESNO | MB_ICONQUESTION) != IDYES) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = Ext2SetGlobalProperty(
|
||||||
|
m_nStartmode,
|
||||||
|
(BOOLEAN)m_bReadonly,
|
||||||
|
(BOOLEAN)m_bExt3Writable,
|
||||||
|
m_Codepage.GetBuffer(CODEPAGE_MAXLEN),
|
||||||
|
m_sPrefix.GetBuffer(HIDINGPAT_LEN),
|
||||||
|
m_sSuffix.GetBuffer(HIDINGPAT_LEN),
|
||||||
|
(BOOLEAN)m_bAutoMount
|
||||||
|
);
|
||||||
|
|
||||||
|
if (rc) {
|
||||||
|
/*
|
||||||
|
AfxMessageBox("Ext2 service settings updated successfully !",
|
||||||
|
MB_OK | MB_ICONINFORMATION);
|
||||||
|
*/
|
||||||
|
CDialog::OnOK();
|
||||||
|
} else {
|
||||||
|
AfxMessageBox("Failed to save the service settings !",
|
||||||
|
MB_OK | MB_ICONWARNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CServiceManage::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
CComboBox *cbStartup = (CComboBox *)GetDlgItem(IDC_COMBO_STARTUP);
|
||||||
|
if (cbStartup) {
|
||||||
|
cbStartup->ResetContent();
|
||||||
|
cbStartup->AddString(_T("SERVICE_BOOT_START"));
|
||||||
|
cbStartup->AddString(_T("SERVICE_SYSTEM_START"));
|
||||||
|
cbStartup->AddString(_T("SERVICE_AUTO_START"));
|
||||||
|
cbStartup->AddString(_T("SERVICE_DEMAND_START"));
|
||||||
|
cbStartup->AddString(_T("SERVICE_DISABLED"));
|
||||||
|
cbStartup->SetCurSel(m_nStartmode);
|
||||||
|
}
|
||||||
|
|
||||||
|
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
|
||||||
|
if (cbCodepage) {
|
||||||
|
int i = 0, j = -1;
|
||||||
|
cbCodepage->ResetContent();
|
||||||
|
while (gCodepages[i]) {
|
||||||
|
cbCodepage->AddString(gCodepages[i]);
|
||||||
|
if (!m_Codepage.IsEmpty()) {
|
||||||
|
CHAR *buffer = m_Codepage.GetBuffer(CODEPAGE_MAXLEN);
|
||||||
|
if (_stricmp(buffer, gCodepages[i]) == 0) {
|
||||||
|
j = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (j == -1) {
|
||||||
|
m_Codepage = "default";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_bReadonly) {
|
||||||
|
m_bExt3Writable = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_WIN(IDC_EXT3_WRITABLE, !m_bReadonly);
|
||||||
|
SET_WIN(IDC_START_SERVICE, !m_bStarted);
|
||||||
|
|
||||||
|
UpdateData(FALSE);
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CServiceManage::OnStartService()
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
|
||||||
|
m_bStarted = Ext2StartExt2Fsd();
|
||||||
|
|
||||||
|
if (m_bStarted) {
|
||||||
|
m_srvStatus = _T("Ext2Fsd was just started.");
|
||||||
|
GetParent()->SetTimer('REFF', 500, NULL);
|
||||||
|
GetParent()->SetTimer('REFR', 3000, NULL);
|
||||||
|
} else {
|
||||||
|
m_srvStatus = _T("Ext2Fsd could NOT be started.");
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_WIN(IDC_START_SERVICE, !m_bStarted);
|
||||||
|
UpdateData(FALSE);
|
||||||
|
}
|
||||||
59
Ext2Mgr/ServiceManage.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#if !defined(AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_)
|
||||||
|
#define AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// ServiceManage.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CServiceManage dialog
|
||||||
|
|
||||||
|
class CServiceManage : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CServiceManage(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CServiceManage)
|
||||||
|
enum { IDD = IDD_SERVICE_MANAGE };
|
||||||
|
CString m_Codepage;
|
||||||
|
BOOL m_bExt3Writable;
|
||||||
|
BOOL m_bReadonly;
|
||||||
|
CString m_srvStatus;
|
||||||
|
CString m_sPrefix;
|
||||||
|
CString m_sSuffix;
|
||||||
|
BOOL m_bAutoMount;
|
||||||
|
//}}AFX_DATA
|
||||||
|
ULONG m_nStartmode;
|
||||||
|
BOOL m_bInited;
|
||||||
|
BOOL m_bStarted;
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CServiceManage)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CServiceManage)
|
||||||
|
afx_msg void OnReadOnly();
|
||||||
|
afx_msg void OnExt3Writable();
|
||||||
|
virtual void OnCancel();
|
||||||
|
virtual void OnOK();
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnStartService();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_SERVICEMANAGE_H__1B7348C0_0EC3_43D1_8E39_25D5F1113B8E__INCLUDED_)
|
||||||
284
Ext2Mgr/Splash.cpp
Normal file
@@ -0,0 +1,284 @@
|
|||||||
|
// ===========================================================================
|
||||||
|
// File Splash.cpp
|
||||||
|
// Desc The implementation file for the CSplash class.
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "splash.h"
|
||||||
|
#include "windowsx.h"
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
// The following is used for layering support which is used in the
|
||||||
|
// splash screen for transparency. In VC 6 these are not defined in the headers
|
||||||
|
// for user32.dll and hence we use mechanisms so that it can work in VC 6.
|
||||||
|
// We define the flags here and write code so that we can load the function
|
||||||
|
// from User32.dll explicitely and use it. This code requires Win2k and above
|
||||||
|
// to work.
|
||||||
|
// ===========================================================================
|
||||||
|
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)
|
||||||
|
(HWND hWnd, COLORREF cr, BYTE bAlpha, DWORD dwFlags);
|
||||||
|
|
||||||
|
lpfnSetLayeredWindowAttributes g_pSetLayeredWindowAttributes;
|
||||||
|
|
||||||
|
#define WS_EX_LAYERED 0x00080000
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
// Func ExtWndProc
|
||||||
|
// Desc The windows procedure that is used to forward messages to the
|
||||||
|
// CSplash class. CSplash sends the "this" pointer through the
|
||||||
|
// CreateWindowEx call and the pointer reaches here in the
|
||||||
|
// WM_CREATE message. We store it here and use it for message
|
||||||
|
// forwarding.
|
||||||
|
// ===========================================================================
|
||||||
|
static LRESULT CALLBACK ExtWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
static CSplash * spl = NULL;
|
||||||
|
if(uMsg == WM_CREATE)
|
||||||
|
{
|
||||||
|
spl = (CSplash*)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||||
|
}
|
||||||
|
if(spl)
|
||||||
|
return spl->WindowProc(hwnd, uMsg, wParam, lParam);
|
||||||
|
else
|
||||||
|
return DefWindowProc (hwnd, uMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK CSplash::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
// We need to handle on the WM_PAINT message
|
||||||
|
switch(uMsg)
|
||||||
|
{
|
||||||
|
HANDLE_MSG(hwnd, WM_PAINT, OnPaint);
|
||||||
|
#if 0
|
||||||
|
// Stop flicker when splash screen appears
|
||||||
|
case WM_ERASEBKGND:
|
||||||
|
// stop the default processing of this message
|
||||||
|
// by returning 1
|
||||||
|
return (LRESULT)1; // say we handled it
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefWindowProc (hwnd, uMsg, wParam, lParam) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSplash:: OnPaint(HWND hwnd)
|
||||||
|
{
|
||||||
|
if (!m_hBitmap)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Paint the background by BitBlting the bitmap
|
||||||
|
// =======================================================================
|
||||||
|
PAINTSTRUCT ps ;
|
||||||
|
HDC hDC = BeginPaint (hwnd, &ps) ;
|
||||||
|
|
||||||
|
RECT rect;
|
||||||
|
::GetClientRect(m_hwnd, &rect);
|
||||||
|
|
||||||
|
HDC hMemDC = ::CreateCompatibleDC(hDC);
|
||||||
|
HBITMAP hOldBmp = (HBITMAP)::SelectObject(hMemDC, m_hBitmap);
|
||||||
|
|
||||||
|
BitBlt(hDC, 0, 0, m_dwWidth, m_dwHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
|
||||||
|
::SelectObject(hMemDC, hOldBmp);
|
||||||
|
|
||||||
|
::DeleteDC(hMemDC);
|
||||||
|
|
||||||
|
EndPaint (hwnd, &ps) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSplash::Init()
|
||||||
|
{
|
||||||
|
// =======================================================================
|
||||||
|
// Initialize the variables
|
||||||
|
// =======================================================================
|
||||||
|
m_hwnd = NULL;
|
||||||
|
m_lpszClassName = TEXT("Ext2 Volume Manager Splash Screen");
|
||||||
|
m_colTrans = 0;
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Keep the function pointer for the SetLayeredWindowAttributes function
|
||||||
|
// in User32.dll ready
|
||||||
|
// =======================================================================
|
||||||
|
HMODULE hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
|
||||||
|
|
||||||
|
g_pSetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)
|
||||||
|
GetProcAddress(hUser32, "SetLayeredWindowAttributes");
|
||||||
|
}
|
||||||
|
|
||||||
|
CSplash::CSplash()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
CSplash::CSplash(UINT id, COLORREF colTrans)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
|
SetBitmap(id);
|
||||||
|
SetTransparentColor(colTrans);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSplash::~CSplash()
|
||||||
|
{
|
||||||
|
FreeResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWND CSplash::RegAndCreateWindow()
|
||||||
|
{
|
||||||
|
// =======================================================================
|
||||||
|
// Register the window with ExtWndProc as the window procedure
|
||||||
|
// =======================================================================
|
||||||
|
WNDCLASSEX wndclass;
|
||||||
|
wndclass.cbSize = sizeof (wndclass);
|
||||||
|
wndclass.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW;
|
||||||
|
wndclass.lpfnWndProc = ExtWndProc;
|
||||||
|
wndclass.cbClsExtra = 0;
|
||||||
|
wndclass.cbWndExtra = DLGWINDOWEXTRA;
|
||||||
|
wndclass.hInstance = ::GetModuleHandle(NULL);
|
||||||
|
wndclass.hIcon = NULL;
|
||||||
|
wndclass.hCursor = ::LoadCursor( NULL, IDC_WAIT );
|
||||||
|
wndclass.hbrBackground = (HBRUSH)::GetStockObject(LTGRAY_BRUSH);
|
||||||
|
wndclass.lpszMenuName = NULL;
|
||||||
|
wndclass.lpszClassName = m_lpszClassName;
|
||||||
|
wndclass.hIconSm = NULL;
|
||||||
|
|
||||||
|
if(!RegisterClassEx (&wndclass))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Create the window of the application, passing the this pointer so that
|
||||||
|
// ExtWndProc can use that for message forwarding
|
||||||
|
// =======================================================================
|
||||||
|
DWORD nScrWidth = ::GetSystemMetrics(SM_CXFULLSCREEN);
|
||||||
|
DWORD nScrHeight = ::GetSystemMetrics(SM_CYFULLSCREEN);
|
||||||
|
|
||||||
|
int x = (nScrWidth - m_dwWidth) / 2;
|
||||||
|
int y = (nScrHeight - m_dwHeight) / 2;
|
||||||
|
m_hwnd = ::CreateWindowEx(WS_EX_TOPMOST|WS_EX_TOOLWINDOW, m_lpszClassName,
|
||||||
|
TEXT("Ext2 Volume Manager"), WS_POPUP, x, y,
|
||||||
|
m_dwWidth, m_dwHeight, NULL, NULL, NULL, this);
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Display the window
|
||||||
|
// =======================================================================
|
||||||
|
if(m_hwnd)
|
||||||
|
{
|
||||||
|
MakeTransparent();
|
||||||
|
ShowWindow (m_hwnd, SW_SHOW) ;
|
||||||
|
UpdateWindow (m_hwnd);
|
||||||
|
}
|
||||||
|
return m_hwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CSplash::DoLoop()
|
||||||
|
{
|
||||||
|
// =======================================================================
|
||||||
|
// Show the window
|
||||||
|
// =======================================================================
|
||||||
|
if(!m_hwnd)
|
||||||
|
ShowSplash();
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Get into the modal loop
|
||||||
|
// =======================================================================
|
||||||
|
MSG msg ;
|
||||||
|
while (GetMessage (&msg, NULL, 0, 0))
|
||||||
|
{
|
||||||
|
TranslateMessage (&msg) ;
|
||||||
|
DispatchMessage (&msg) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int)msg.wParam ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSplash::ShowSplash()
|
||||||
|
{
|
||||||
|
CloseSplash();
|
||||||
|
RegAndCreateWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD CSplash::SetBitmap(UINT id)
|
||||||
|
{
|
||||||
|
// =======================================================================
|
||||||
|
// load the bitmap
|
||||||
|
// =======================================================================
|
||||||
|
HBITMAP hBitmap = NULL;
|
||||||
|
hBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(id),
|
||||||
|
IMAGE_BITMAP, 0, 0, 0);
|
||||||
|
return SetBitmap(hBitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD CSplash::SetBitmap(HBITMAP hBitmap)
|
||||||
|
{
|
||||||
|
int nRetValue;
|
||||||
|
BITMAP csBitmapSize;
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Free loaded resource
|
||||||
|
// =======================================================================
|
||||||
|
FreeResources();
|
||||||
|
|
||||||
|
if (hBitmap)
|
||||||
|
{
|
||||||
|
m_hBitmap = hBitmap;
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
// Get bitmap size
|
||||||
|
// ===================================================================
|
||||||
|
nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
|
||||||
|
if (nRetValue == 0)
|
||||||
|
{
|
||||||
|
FreeResources();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
m_dwWidth = (DWORD)csBitmapSize.bmWidth;
|
||||||
|
m_dwHeight = (DWORD)csBitmapSize.bmHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSplash::FreeResources()
|
||||||
|
{
|
||||||
|
if (m_hBitmap)
|
||||||
|
::DeleteObject (m_hBitmap);
|
||||||
|
m_hBitmap = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CSplash::CloseSplash()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(m_hwnd)
|
||||||
|
{
|
||||||
|
DestroyWindow(m_hwnd);
|
||||||
|
m_hwnd = 0;
|
||||||
|
UnregisterClass(m_lpszClassName, ::GetModuleHandle(NULL));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSplash::SetTransparentColor(COLORREF col)
|
||||||
|
{
|
||||||
|
m_colTrans = col;
|
||||||
|
|
||||||
|
return MakeTransparent();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSplash::MakeTransparent()
|
||||||
|
{
|
||||||
|
// =======================================================================
|
||||||
|
// Set the layered window style and make the required color transparent
|
||||||
|
// =======================================================================
|
||||||
|
if(m_hwnd && g_pSetLayeredWindowAttributes && m_colTrans )
|
||||||
|
{
|
||||||
|
// set layered style for the window
|
||||||
|
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||||
|
// call it with 0 alpha for the given color
|
||||||
|
g_pSetLayeredWindowAttributes(m_hwnd, m_colTrans, 0, LWA_COLORKEY);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
98
Ext2Mgr/Splash.h
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
// ===========================================================================
|
||||||
|
// File Splash.h
|
||||||
|
// Desc The interface of the CSplash class
|
||||||
|
// ===========================================================================
|
||||||
|
#ifndef _ABHI_SPLASH_H_
|
||||||
|
#define _ABHI_SPLASH_H_
|
||||||
|
|
||||||
|
#include "windows.h"
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
// Class CSplash
|
||||||
|
// Desc Use it for displaying splash screen for applications
|
||||||
|
// Works only on Win2000 , WinXP and later versions of Windows
|
||||||
|
// ===========================================================================
|
||||||
|
class CSplash
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// =======================================================================
|
||||||
|
// Func CSplash
|
||||||
|
// Desc Default constructor
|
||||||
|
// =======================================================================
|
||||||
|
CSplash();
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Func CSplash
|
||||||
|
// Desc Constructor
|
||||||
|
// Arg Path of the Bitmap that will be show on the splash screen
|
||||||
|
// Arg The color on the bitmap that will be made transparent
|
||||||
|
// =======================================================================
|
||||||
|
CSplash(UINT id, COLORREF colTrans);
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Func ~CSplash
|
||||||
|
// Desc Desctructor
|
||||||
|
// =======================================================================
|
||||||
|
virtual ~CSplash();
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Func ShowSplash
|
||||||
|
// Desc Launches the non-modal splash screen
|
||||||
|
// Ret void
|
||||||
|
// =======================================================================
|
||||||
|
void ShowSplash();
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Func DoLoop
|
||||||
|
// Desc Launched the splash screen as a modal window. Not completely
|
||||||
|
// implemented.
|
||||||
|
// Ret int
|
||||||
|
// =======================================================================
|
||||||
|
int DoLoop();
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Func CloseSplash
|
||||||
|
// Desc Closes the splash screen started with ShowSplash
|
||||||
|
// Ret int
|
||||||
|
// =======================================================================
|
||||||
|
int CloseSplash();
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Func SetBitmap
|
||||||
|
// Desc Call this with the path of the bitmap. Not required to be used
|
||||||
|
// when the construcutor with the image path has been used.
|
||||||
|
// Ret 1 if succesfull
|
||||||
|
// Arg Either the file path or the handle to an already loaded bitmap
|
||||||
|
// =======================================================================
|
||||||
|
DWORD SetBitmap(UINT id);
|
||||||
|
DWORD SetBitmap(HBITMAP hBitmap);
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// Func SetTransparentColor
|
||||||
|
// Desc This is used to make one of the color transparent
|
||||||
|
// Ret 1 if succesfull
|
||||||
|
// Arg The colors RGB value. Not required if the color is specified
|
||||||
|
// using the constructor
|
||||||
|
// =======================================================================
|
||||||
|
bool SetTransparentColor(COLORREF col);
|
||||||
|
|
||||||
|
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
HWND m_hwnd;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Init();
|
||||||
|
void OnPaint(HWND hwnd);
|
||||||
|
bool MakeTransparent();
|
||||||
|
HWND RegAndCreateWindow();
|
||||||
|
COLORREF m_colTrans;
|
||||||
|
DWORD m_dwWidth;
|
||||||
|
DWORD m_dwHeight;
|
||||||
|
void FreeResources();
|
||||||
|
HBITMAP m_hBitmap;
|
||||||
|
LPCTSTR m_lpszClassName;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_ABHI_SPLASH_H_
|
||||||
8
Ext2Mgr/StdAfx.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// stdafx.cpp : source file that includes just the standard includes
|
||||||
|
// Ext2Mgr.pch will be the pre-compiled header
|
||||||
|
// stdafx.obj will contain the pre-compiled type information
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
60
Ext2Mgr/StdAfx.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// stdafx.h : include file for standard system include files,
|
||||||
|
// or project specific include files that are used frequently, but
|
||||||
|
// are changed infrequently
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_)
|
||||||
|
#define AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
|
||||||
|
#include <afxwin.h> // MFC core and standard components
|
||||||
|
#include <afxext.h> // MFC extensions
|
||||||
|
#include <afxdisp.h> // MFC Automation classes
|
||||||
|
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||||
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||||
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxtempl.h>
|
||||||
|
|
||||||
|
#include "AfxPriv.h"
|
||||||
|
#include "enumDisk.h"
|
||||||
|
#include <process.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define EXT2_DIALOG_MAGIC 'EXTM'
|
||||||
|
|
||||||
|
#define SET_TEXT(id, s) ((CWnd *)GetDlgItem(id))->SetWindowText(s)
|
||||||
|
#define SET_WIN(id, t) ((CWnd *)GetDlgItem(id))->EnableWindow(t)
|
||||||
|
#define SET_CHECK(ID, V) ((CButton *)GetDlgItem(ID))->SetCheck(V)
|
||||||
|
|
||||||
|
//--------------our own message-----------------
|
||||||
|
#define WM_TRAY_ICON_NOTIFY WM_USER + 0x1001
|
||||||
|
#define WM_TERMINATE_PROGRAM WM_USER + 0x1002
|
||||||
|
#define WM_GROUP_BOX_UPDATED WM_USER + 0x1003
|
||||||
|
#define WM_MOUNTPOINT_NOTIFY WM_USER + 0x1004
|
||||||
|
//----------------------------------------------
|
||||||
|
|
||||||
|
extern CHAR *IrpMjStrings[];
|
||||||
|
extern CHAR *PerfStatStrings[];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ext2Pipe.cpp
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL Ext2DefineDosDevice(DWORD flags, CHAR *dos, CHAR *symlink);
|
||||||
|
DWORD Ext2QueryDrive(CHAR drive, CHAR *symlink);
|
||||||
|
|
||||||
|
BOOL Ext2StartPipeSrv();
|
||||||
|
VOID Ext2StopPipeSrv();
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_STDAFX_H__A7E6CA3E_7403_4367_BC73_C64644BB42F9__INCLUDED_)
|
||||||
267
Ext2Mgr/SysTray.cpp
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// SystemTray.cpp : implementation file
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "SysTray.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC(CSystemTray, CObject)
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSystemTray construction/creation/destruction
|
||||||
|
|
||||||
|
CSystemTray::CSystemTray()
|
||||||
|
{
|
||||||
|
ZeroMemory(&m_tnd, sizeof(m_tnd));
|
||||||
|
m_bEnabled = FALSE;
|
||||||
|
m_bHidden = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSystemTray::CSystemTray(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szToolTip,
|
||||||
|
HICON icon, UINT uID)
|
||||||
|
{
|
||||||
|
Create(pWnd, uCallbackMessage, szToolTip, icon, uID);
|
||||||
|
m_bHidden = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CSystemTray::Create(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szToolTip,
|
||||||
|
HICON icon, UINT uID)
|
||||||
|
{
|
||||||
|
// this is only for Windows 95 (or higher)
|
||||||
|
m_bEnabled = ( GetVersion() & 0xff );
|
||||||
|
ASSERT(m_bEnabled >= 4);
|
||||||
|
if (!m_bEnabled)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
//Make sure Notification window is valid
|
||||||
|
m_bEnabled = (pWnd && ::IsWindow(pWnd->GetSafeHwnd()));
|
||||||
|
if (!m_bEnabled) return FALSE;
|
||||||
|
|
||||||
|
//Make sure we avoid conflict with other messages
|
||||||
|
ASSERT(uCallbackMessage >= WM_USER);
|
||||||
|
|
||||||
|
//Tray only supports tooltip text up to 64 characters
|
||||||
|
ASSERT(_tcslen(szToolTip) <= 64);
|
||||||
|
|
||||||
|
// load up the NOTIFYICONDATA structure
|
||||||
|
m_tnd.cbSize = sizeof(NOTIFYICONDATA);
|
||||||
|
m_tnd.hWnd = pWnd->GetSafeHwnd();
|
||||||
|
m_tnd.uID = uID ^ GetCurrentProcessId();
|
||||||
|
m_tnd.hIcon = icon;
|
||||||
|
m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
||||||
|
m_tnd.uCallbackMessage = uCallbackMessage;
|
||||||
|
strcpy (m_tnd.szTip, szToolTip);
|
||||||
|
|
||||||
|
// Set the tray icon
|
||||||
|
m_bEnabled = Shell_NotifyIcon(NIM_ADD, &m_tnd);
|
||||||
|
ASSERT(m_bEnabled);
|
||||||
|
return m_bEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSystemTray::~CSystemTray()
|
||||||
|
{
|
||||||
|
RemoveIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSystemTray icon manipulation
|
||||||
|
|
||||||
|
void CSystemTray::MoveToRight()
|
||||||
|
{
|
||||||
|
HideIcon();
|
||||||
|
ShowIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSystemTray::RemoveIcon()
|
||||||
|
{
|
||||||
|
if (!m_bEnabled) return;
|
||||||
|
|
||||||
|
m_tnd.uFlags = 0;
|
||||||
|
Shell_NotifyIcon(NIM_DELETE, &m_tnd);
|
||||||
|
m_bEnabled = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSystemTray::HideIcon()
|
||||||
|
{
|
||||||
|
if (m_bEnabled && !m_bHidden) {
|
||||||
|
m_tnd.uFlags = NIF_ICON;
|
||||||
|
Shell_NotifyIcon (NIM_DELETE, &m_tnd);
|
||||||
|
m_bHidden = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSystemTray::ShowIcon()
|
||||||
|
{
|
||||||
|
if (m_bEnabled && m_bHidden) {
|
||||||
|
m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
||||||
|
Shell_NotifyIcon(NIM_ADD, &m_tnd);
|
||||||
|
m_bHidden = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CSystemTray::SetIcon(HICON hIcon)
|
||||||
|
{
|
||||||
|
if (!m_bEnabled) return FALSE;
|
||||||
|
|
||||||
|
m_tnd.uFlags = NIF_ICON;
|
||||||
|
m_tnd.hIcon = hIcon;
|
||||||
|
|
||||||
|
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CSystemTray::SetIcon(LPCTSTR lpszIconName)
|
||||||
|
{
|
||||||
|
HICON hIcon = AfxGetApp()->LoadIcon(lpszIconName);
|
||||||
|
|
||||||
|
return SetIcon(hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CSystemTray::SetIcon(UINT nIDResource)
|
||||||
|
{
|
||||||
|
HICON hIcon = AfxGetApp()->LoadIcon(nIDResource);
|
||||||
|
|
||||||
|
return SetIcon(hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CSystemTray::SetStandardIcon(LPCTSTR lpIconName)
|
||||||
|
{
|
||||||
|
HICON hIcon = LoadIcon(NULL, lpIconName);
|
||||||
|
|
||||||
|
return SetIcon(hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CSystemTray::SetStandardIcon(UINT nIDResource)
|
||||||
|
{
|
||||||
|
HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCE(nIDResource));
|
||||||
|
|
||||||
|
return SetIcon(hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
HICON CSystemTray::GetIcon() const
|
||||||
|
{
|
||||||
|
HICON hIcon = NULL;
|
||||||
|
if (m_bEnabled)
|
||||||
|
hIcon = m_tnd.hIcon;
|
||||||
|
|
||||||
|
return hIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSystemTray tooltip text manipulation
|
||||||
|
|
||||||
|
BOOL CSystemTray::SetTooltipText(LPCTSTR pszTip)
|
||||||
|
{
|
||||||
|
if (!m_bEnabled) return FALSE;
|
||||||
|
|
||||||
|
m_tnd.uFlags = NIF_TIP;
|
||||||
|
_tcscpy(m_tnd.szTip, pszTip);
|
||||||
|
|
||||||
|
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CSystemTray::SetTooltipText(UINT nID)
|
||||||
|
{
|
||||||
|
CString strText;
|
||||||
|
strText.LoadString(nID);
|
||||||
|
|
||||||
|
return SetTooltipText(strText);
|
||||||
|
}
|
||||||
|
|
||||||
|
CString CSystemTray::GetTooltipText() const
|
||||||
|
{
|
||||||
|
CString strText;
|
||||||
|
if (m_bEnabled)
|
||||||
|
strText = m_tnd.szTip;
|
||||||
|
|
||||||
|
return strText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSystemTray notification window stuff
|
||||||
|
|
||||||
|
BOOL CSystemTray::SetNotificationWnd(CWnd* pWnd)
|
||||||
|
{
|
||||||
|
if (!m_bEnabled) return FALSE;
|
||||||
|
|
||||||
|
//Make sure Notification window is valid
|
||||||
|
ASSERT(pWnd && ::IsWindow(pWnd->GetSafeHwnd()));
|
||||||
|
|
||||||
|
m_tnd.hWnd = pWnd->GetSafeHwnd();
|
||||||
|
m_tnd.uFlags = 0;
|
||||||
|
|
||||||
|
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
CWnd* CSystemTray::GetNotificationWnd() const
|
||||||
|
{
|
||||||
|
return CWnd::FromHandle(m_tnd.hWnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSystemTray implentation of OnTrayNotification
|
||||||
|
|
||||||
|
LRESULT CSystemTray::OnTrayNotification(WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
//Return quickly if its not for this tray icon
|
||||||
|
if (wParam != m_tnd.uID)
|
||||||
|
return 0L;
|
||||||
|
|
||||||
|
CMenu menu, *pSubMenu;
|
||||||
|
|
||||||
|
// Clicking with right button brings up a context menu
|
||||||
|
switch(LOWORD(lParam))
|
||||||
|
{
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
{
|
||||||
|
if (!menu.LoadMenu(m_tnd.uID ^ GetCurrentProcessId()))
|
||||||
|
return 0;
|
||||||
|
pSubMenu = menu.GetSubMenu(0);
|
||||||
|
if (!pSubMenu)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Make first menu item the default (bold font)
|
||||||
|
::SetMenuDefaultItem(pSubMenu->m_hMenu, 0, TRUE);
|
||||||
|
|
||||||
|
//Display and track the popup menu
|
||||||
|
CPoint pos;
|
||||||
|
GetCursorPos(&pos);
|
||||||
|
|
||||||
|
::SetForegroundWindow(m_tnd.hWnd);
|
||||||
|
::TrackPopupMenu(pSubMenu->m_hMenu, 0, pos.x, pos.y, 0, m_tnd.hWnd, NULL);
|
||||||
|
|
||||||
|
// BUGFIX: See "PRB: Menus for Notification Icons Don't Work Correctly"
|
||||||
|
::PostMessage(m_tnd.hWnd, WM_NULL, 0, 0);
|
||||||
|
|
||||||
|
menu.DestroyMenu();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
{
|
||||||
|
if (!menu.LoadMenu(m_tnd.uID ^ GetCurrentProcessId()))
|
||||||
|
return 0;
|
||||||
|
pSubMenu = menu.GetSubMenu(0);
|
||||||
|
if (!pSubMenu)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// double click received, the default action is to execute first menu item
|
||||||
|
::SetForegroundWindow(m_tnd.hWnd);
|
||||||
|
::SendMessage(m_tnd.hWnd, WM_COMMAND, pSubMenu->GetMenuItemID(0), 0);
|
||||||
|
|
||||||
|
menu.DestroyMenu();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
::SetForegroundWindow(m_tnd.hWnd);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
89
Ext2Mgr/SysTray.h
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// SystemTray.h : header file
|
||||||
|
//
|
||||||
|
// Written by Chris Maunder (Chris.Maunder@cbr.clw.csiro.au)
|
||||||
|
// Copyright (c) 1998.
|
||||||
|
//
|
||||||
|
// This code may be used in compiled form in any way you desire. This
|
||||||
|
// file may be redistributed unmodified by any means PROVIDING it is
|
||||||
|
// not sold for profit without the authors written consent, and
|
||||||
|
// providing that this notice and the authors name is included. If
|
||||||
|
// the source code in this file is used in any commercial application
|
||||||
|
// then acknowledgement must be made to the author of this file
|
||||||
|
// (in whatever form you wish).
|
||||||
|
//
|
||||||
|
// This file is provided "as is" with no expressed or implied warranty.
|
||||||
|
// The author accepts no liability if it causes any damage to your
|
||||||
|
// computer, causes your pet cat to fall ill, increases baldness or
|
||||||
|
// makes you car start emitting strange noises when you start it up.
|
||||||
|
//
|
||||||
|
// Expect bugs.
|
||||||
|
//
|
||||||
|
// Please use and enjoy. Please let me know of any bugs/mods/improvements
|
||||||
|
// that you have found/implemented and I will fix/incorporate them into this
|
||||||
|
// file.
|
||||||
|
|
||||||
|
#ifndef _INCLUDED_SYSTEMTRAY_H_
|
||||||
|
#define _INCLUDED_SYSTEMTRAY_H_
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSystemTray window
|
||||||
|
|
||||||
|
class CSystemTray : public CObject
|
||||||
|
{
|
||||||
|
// Construction/destruction
|
||||||
|
public:
|
||||||
|
CSystemTray();
|
||||||
|
CSystemTray(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szTip, HICON icon, UINT uID);
|
||||||
|
virtual ~CSystemTray();
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
BOOL Enabled() { return m_bEnabled; }
|
||||||
|
BOOL Visible() { return !m_bHidden; }
|
||||||
|
|
||||||
|
//Create the tray icon
|
||||||
|
int Create(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szTip, HICON icon, UINT uID);
|
||||||
|
|
||||||
|
//Change or retrieve the Tooltip text
|
||||||
|
BOOL SetTooltipText(LPCTSTR pszTooltipText);
|
||||||
|
BOOL SetTooltipText(UINT nID);
|
||||||
|
CString GetTooltipText() const;
|
||||||
|
|
||||||
|
//Change or retrieve the icon displayed
|
||||||
|
BOOL SetIcon(HICON hIcon);
|
||||||
|
BOOL SetIcon(LPCTSTR lpIconName);
|
||||||
|
BOOL SetIcon(UINT nIDResource);
|
||||||
|
BOOL SetStandardIcon(LPCTSTR lpIconName);
|
||||||
|
BOOL SetStandardIcon(UINT nIDResource);
|
||||||
|
HICON GetIcon() const;
|
||||||
|
void HideIcon();
|
||||||
|
void ShowIcon();
|
||||||
|
void RemoveIcon();
|
||||||
|
void MoveToRight();
|
||||||
|
|
||||||
|
//Change or retrieve the window to send notification messages to
|
||||||
|
BOOL SetNotificationWnd(CWnd* pNotifyWnd);
|
||||||
|
CWnd* GetNotificationWnd() const;
|
||||||
|
|
||||||
|
//Default handler for tray notification message
|
||||||
|
virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CSystemTray)
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
BOOL m_bEnabled; // does O/S support tray icon?
|
||||||
|
BOOL m_bHidden; // Has the icon been hidden?
|
||||||
|
NOTIFYICONDATA m_tnd;
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC(CSystemTray)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
357
Ext2Mgr/TreeList.cpp
Normal file
@@ -0,0 +1,357 @@
|
|||||||
|
// TreeList.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "TreeList.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CTreeList
|
||||||
|
|
||||||
|
CTreeList::CTreeList()
|
||||||
|
{
|
||||||
|
m_SelectionRect = CRect(0,0,0,0);
|
||||||
|
m_SelectionFlag = FALSE;
|
||||||
|
m_Point = CPoint(0, 0);
|
||||||
|
m_PrevItem = -1;
|
||||||
|
m_Rows = 0;
|
||||||
|
m_Columns = 1;
|
||||||
|
m_hBitmap = NULL;
|
||||||
|
m_hMemDC = NULL;
|
||||||
|
m_hOldBmp = NULL;
|
||||||
|
m_bFocus = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTreeList::~CTreeList()
|
||||||
|
{
|
||||||
|
if (m_hBitmap) {
|
||||||
|
|
||||||
|
if (m_hMemDC) {
|
||||||
|
::SelectObject(m_hMemDC, m_hOldBmp);
|
||||||
|
::DeleteDC(m_hMemDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
::DeleteObject (m_hBitmap);
|
||||||
|
m_hBitmap = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CTreeList, CListCtrl)
|
||||||
|
//{{AFX_MSG_MAP(CTreeList)
|
||||||
|
ON_WM_LBUTTONDOWN()
|
||||||
|
ON_WM_RBUTTONDOWN()
|
||||||
|
ON_NOTIFY_REFLECT(NM_KILLFOCUS, OnKillfocus)
|
||||||
|
ON_NOTIFY_REFLECT(NM_SETFOCUS, OnSetfocus)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
ON_MESSAGE(WM_SETFONT, OnSetFont)
|
||||||
|
ON_WM_MEASUREITEM_REFLECT()
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CTreeList message handlers
|
||||||
|
|
||||||
|
void CTreeList::OnLButtonDown(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
// TODO: Add your message handler code here and/or call default
|
||||||
|
m_Point = point;
|
||||||
|
m_SelectionFlag = FALSE;
|
||||||
|
|
||||||
|
Invalidate();
|
||||||
|
|
||||||
|
CListCtrl::OnLButtonDown(nFlags, point);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CTreeList::PreCreateWindow(CREATESTRUCT& cs)
|
||||||
|
{
|
||||||
|
// TODO: Add your specialized code here and/or call the base class
|
||||||
|
cs.style |= LVS_REPORT | LVS_OWNERDRAWFIXED| WS_BORDER;
|
||||||
|
return CListCtrl::PreCreateWindow(cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CTreeList::OnSetFont(WPARAM wParam, LPARAM)
|
||||||
|
{
|
||||||
|
LRESULT res = Default();
|
||||||
|
|
||||||
|
CRect rc;
|
||||||
|
GetWindowRect( &rc );
|
||||||
|
|
||||||
|
WINDOWPOS wp;
|
||||||
|
wp.hwnd = m_hWnd;
|
||||||
|
wp.cx = rc.Width();
|
||||||
|
wp.cy = rc.Height();
|
||||||
|
wp.flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER;
|
||||||
|
SendMessage( WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp );
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTreeList::MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct )
|
||||||
|
{
|
||||||
|
lpMeasureItemStruct->itemHeight = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTreeList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||||
|
{
|
||||||
|
PULONG pMagic = (PULONG) lpDrawItemStruct->itemData;
|
||||||
|
|
||||||
|
TCHAR lpBuffer[256];
|
||||||
|
LV_ITEM lvi;
|
||||||
|
LV_COLUMN lvc, lvcprev ;
|
||||||
|
|
||||||
|
memset(lpBuffer, 0, 256);
|
||||||
|
lvi.mask = LVIF_TEXT | LVIF_PARAM ;
|
||||||
|
lvi.iItem = lpDrawItemStruct->itemID ;
|
||||||
|
lvi.iSubItem = 0;
|
||||||
|
lvi.pszText = lpBuffer ;
|
||||||
|
lvi.cchTextMax = sizeof(lpBuffer);
|
||||||
|
GetItem(&lvi);
|
||||||
|
::ZeroMemory(&lvc, sizeof(lvc));
|
||||||
|
::ZeroMemory(&lvcprev, sizeof(lvcprev));
|
||||||
|
lvc.mask = LVCF_WIDTH |LVCF_FMT;
|
||||||
|
lvcprev.mask = LVCF_WIDTH | LVCF_FMT;
|
||||||
|
|
||||||
|
CDC* pDC;
|
||||||
|
pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||||
|
int nCol;
|
||||||
|
CRect rcText = lpDrawItemStruct->rcItem;
|
||||||
|
|
||||||
|
CFont Fnt, *pOldFont = NULL;
|
||||||
|
LOGFONT lf;
|
||||||
|
|
||||||
|
int cyPixels = pDC->GetDeviceCaps(LOGPIXELSY);
|
||||||
|
memset(&lf, 0, sizeof(LOGFONT));
|
||||||
|
|
||||||
|
if (pMagic == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
|
||||||
|
|
||||||
|
if (IsVistaOrAbove()) {
|
||||||
|
lstrcpy(lf.lfFaceName, "MS Sans Serif"); /*Courier New*/
|
||||||
|
lf.lfHeight = -MulDiv(8, cyPixels, 72);
|
||||||
|
lf.lfWeight = TRUE;
|
||||||
|
} else {
|
||||||
|
lstrcpy(lf.lfFaceName, "Arial Black"); /*Courier New*/
|
||||||
|
lf.lfHeight = -MulDiv(8, cyPixels, 72);
|
||||||
|
lf.lfWeight = TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lstrcpy(lf.lfFaceName, "MS Sans Serif");
|
||||||
|
lf.lfHeight = -MulDiv(8, cyPixels, 72);
|
||||||
|
}
|
||||||
|
|
||||||
|
Fnt.CreateFontIndirect(&lf);
|
||||||
|
pOldFont = (CFont *) pDC->SelectObject(&Fnt);
|
||||||
|
|
||||||
|
/* loading bitmap */
|
||||||
|
if (m_hBitmap == NULL) {
|
||||||
|
m_hBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL),
|
||||||
|
MAKEINTRESOURCE(IDB_LINE_SEP),
|
||||||
|
IMAGE_BITMAP, 0, 0, 0);
|
||||||
|
|
||||||
|
if (m_hBitmap) {
|
||||||
|
m_hMemDC = ::CreateCompatibleDC(this->GetDC()->m_hDC);
|
||||||
|
m_hOldBmp = (HBITMAP)::SelectObject(m_hMemDC, m_hBitmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TRUE) {
|
||||||
|
|
||||||
|
if (!m_SelectionFlag) {
|
||||||
|
for (nCol=0; GetColumn(nCol, &lvc); nCol++) {
|
||||||
|
if (nCol > 0) {
|
||||||
|
GetSubItemRect(lpDrawItemStruct->itemID,
|
||||||
|
nCol,LVIR_BOUNDS, m_SelectionRect);
|
||||||
|
} else {
|
||||||
|
GetItemRect(lpDrawItemStruct->itemID,
|
||||||
|
m_SelectionRect,LVIR_BOUNDS);
|
||||||
|
m_SelectionRect.right = GetColumnWidth(0);
|
||||||
|
m_SelectionRect.left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_SelectionRect.PtInRect(m_Point)) {
|
||||||
|
m_SelectionFlag = TRUE;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
m_SelectionFlag = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((lpDrawItemStruct->itemState & ODS_SELECTED) && m_SelectionFlag ) {
|
||||||
|
|
||||||
|
CRect rc = lpDrawItemStruct->rcItem;
|
||||||
|
rc.left += 4; rc.right -= 4;
|
||||||
|
rc.top += 1; rc.bottom -= 0;
|
||||||
|
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
|
||||||
|
rc.bottom -= 3; rc.top -= 1;
|
||||||
|
rc.right = (rc.Width() * 7 / 8) + rc.left;
|
||||||
|
}
|
||||||
|
pDC->FillSolidRect(&rc, GetSysColor(m_bFocus ? COLOR_HIGHLIGHT : COLOR_INACTIVEBORDER));
|
||||||
|
} else {
|
||||||
|
CRect rc = lpDrawItemStruct->rcItem;
|
||||||
|
pDC->FillSolidRect(&rc, GetSysColor(COLOR_WINDOW)) ;
|
||||||
|
pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT)) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (nCol=0; GetColumn(nCol, &lvc); nCol++) {
|
||||||
|
|
||||||
|
UINT uFormat = DT_LEFT ;
|
||||||
|
|
||||||
|
if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
|
||||||
|
|
||||||
|
rcText = lpDrawItemStruct->rcItem;
|
||||||
|
rcText.left += 4;
|
||||||
|
rcText.bottom += 1;
|
||||||
|
rcText.top = rcText.bottom - 6 + lf.lfHeight;
|
||||||
|
|
||||||
|
::DrawText(lpDrawItemStruct->hDC, lpBuffer, strlen(lpBuffer),
|
||||||
|
&rcText, DT_LEFT) ;
|
||||||
|
|
||||||
|
CRect rect = lpDrawItemStruct->rcItem;
|
||||||
|
int rc = 0;
|
||||||
|
BITMAP cs;
|
||||||
|
|
||||||
|
|
||||||
|
rect.top = rcText.bottom - 4;
|
||||||
|
rc = ::GetObject(m_hBitmap, sizeof(cs), &cs);
|
||||||
|
if (rc == 0) {
|
||||||
|
pDC->SelectObject(pOldFont);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
::StretchBlt(pDC->m_hDC, rect.left + 4, (rect.bottom + rect.top) / 2,
|
||||||
|
rect.Width() * 7 / 8, cs.bmHeight,
|
||||||
|
m_hMemDC, 0, 0, cs.bmWidth, cs.bmHeight, SRCCOPY);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (nCol > 0) {
|
||||||
|
GetColumn(nCol, &lvcprev) ;
|
||||||
|
rcText.left = rcText.right;
|
||||||
|
rcText.right += lvcprev.cx;
|
||||||
|
rcText.left += 4;
|
||||||
|
|
||||||
|
if (nCol == 3 || nCol == 4) {
|
||||||
|
uFormat = DT_RIGHT;
|
||||||
|
rcText.right -= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
rcText = lpDrawItemStruct->rcItem;
|
||||||
|
rcText.top += (16 + lf.lfHeight) / 2;
|
||||||
|
rcText.right = rcText.left + GetColumnWidth(0);
|
||||||
|
rcText.left += 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get and draw the text
|
||||||
|
memset(lpBuffer, 0, 256);
|
||||||
|
::ZeroMemory(&lvi, sizeof(lvi));
|
||||||
|
lvi.iItem = lpDrawItemStruct->itemID;
|
||||||
|
lvi.mask = LVIF_TEXT | LVIF_PARAM;
|
||||||
|
lvi.iSubItem = nCol;
|
||||||
|
lvi.pszText = lpBuffer;
|
||||||
|
lvi.cchTextMax = sizeof(lpBuffer);
|
||||||
|
GetItem(&lvi);
|
||||||
|
|
||||||
|
::DrawText(lpDrawItemStruct->hDC, lpBuffer, strlen(lpBuffer),
|
||||||
|
&rcText, uFormat) ;
|
||||||
|
|
||||||
|
if (nCol == 0) {
|
||||||
|
rcText.left -= 20;
|
||||||
|
} else {
|
||||||
|
rcText.left -= 4;
|
||||||
|
if (nCol == 3 || nCol == 4) {
|
||||||
|
rcText.right += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectObject(pOldFont);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTreeList::OnRButtonDown(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
// TODO: Add your message handler code here and/or call default
|
||||||
|
m_Point = point;
|
||||||
|
m_SelectionFlag = FALSE;
|
||||||
|
|
||||||
|
Invalidate();
|
||||||
|
|
||||||
|
CListCtrl::OnRButtonDown(nFlags, point);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTreeList::OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
m_bFocus = FALSE;
|
||||||
|
Invalidate();
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTreeList::OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
m_bFocus = TRUE;
|
||||||
|
Invalidate();
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CTreeList::QuerySubItemText(int item, CHAR *Data, int length)
|
||||||
|
{
|
||||||
|
LV_COLUMN lvc;
|
||||||
|
LV_ITEM lvi;
|
||||||
|
int ncol;
|
||||||
|
CRect rect;
|
||||||
|
|
||||||
|
::ZeroMemory(&lvc, sizeof(lvc));
|
||||||
|
lvc.mask = LVCF_WIDTH |LVCF_FMT;
|
||||||
|
|
||||||
|
for (ncol=0; GetColumn(ncol, &lvc); ncol++) {
|
||||||
|
|
||||||
|
if (ncol > 0) {
|
||||||
|
GetSubItemRect(item, ncol,LVIR_BOUNDS, rect);
|
||||||
|
} else {
|
||||||
|
GetItemRect(item, rect, LVIR_BOUNDS);
|
||||||
|
rect.right = GetColumnWidth(0);
|
||||||
|
rect.left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rect.PtInRect(m_Point)) {
|
||||||
|
|
||||||
|
::ZeroMemory(Data, length);
|
||||||
|
::ZeroMemory(&lvi, sizeof(lvi));
|
||||||
|
|
||||||
|
lvi.iItem = item;
|
||||||
|
lvi.mask = LVIF_TEXT;
|
||||||
|
lvi.iSubItem = ncol;
|
||||||
|
lvi.pszText = Data;
|
||||||
|
lvi.cchTextMax = length;
|
||||||
|
|
||||||
|
return GetItem(&lvi);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID CTreeList::Redraw()
|
||||||
|
{
|
||||||
|
m_bFocus = TRUE;
|
||||||
|
m_SelectionFlag = TRUE;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
74
Ext2Mgr/TreeList.h
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
#if !defined(AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_)
|
||||||
|
#define AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// TreeList.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CTreeList window
|
||||||
|
|
||||||
|
class CTreeList : public CListCtrl
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CTreeList();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* Focus set or lost */
|
||||||
|
BOOL m_bFocus;
|
||||||
|
|
||||||
|
/* single item selection */
|
||||||
|
CRect m_SelectionRect;
|
||||||
|
BOOL m_SelectionFlag;
|
||||||
|
CPoint m_Point;
|
||||||
|
int m_Rows;
|
||||||
|
int m_Columns;
|
||||||
|
int m_PrevItem;
|
||||||
|
|
||||||
|
/* bitmap information */
|
||||||
|
HBITMAP m_hBitmap;
|
||||||
|
HDC m_hMemDC;
|
||||||
|
HBITMAP m_hOldBmp;
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
VOID Redraw();
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CTreeList)
|
||||||
|
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||||
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM);
|
||||||
|
afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct );
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CTreeList();
|
||||||
|
int QuerySubItemText(int item, CHAR *Data, int length);
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CTreeList)
|
||||||
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_TREELIST_H__7C424B24_1578_47A5_8134_34901335977B__INCLUDED_)
|
||||||
2
Ext2Mgr/astyle.bat
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
for /R %%a in (*.c;*.cpp;*.h;) do astyle.exe --indent=spaces=4 %%a
|
||||||
|
for /R %%a in (*.c;*.cpp;*.h;DIRS;sources;) do dos2unix %%a
|
||||||
5512
Ext2Mgr/enumDisk.cpp
Normal file
913
Ext2Mgr/enumDisk.h
Normal file
@@ -0,0 +1,913 @@
|
|||||||
|
#ifndef _ENUM_DISK_INCLUDE_
|
||||||
|
#define _ENUM_DISK_INCLUDE_
|
||||||
|
|
||||||
|
#include "ntdll.h"
|
||||||
|
#include <objbase.h>
|
||||||
|
#include <initguid.h>
|
||||||
|
#include <cfgmgr32.h>
|
||||||
|
#include <setupapi.h>
|
||||||
|
#include <regstr.h>
|
||||||
|
#include <winsvc.h>
|
||||||
|
#include "dbt.h"
|
||||||
|
#include "ext2fs.h"
|
||||||
|
#include <winioctl.h>
|
||||||
|
|
||||||
|
//#include <devioctl.h>
|
||||||
|
//#include <mountmgr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* *
|
||||||
|
* VersionHelpers.h -- This module defines helper functions to *
|
||||||
|
* promote version check with proper *
|
||||||
|
* comparisons. *
|
||||||
|
* *
|
||||||
|
* Copyright (c) Microsoft Corp. All rights reserved. *
|
||||||
|
* *
|
||||||
|
******************************************************************/
|
||||||
|
#ifndef _versionhelpers_H_INCLUDED_
|
||||||
|
#define _versionhelpers_H_INCLUDED_
|
||||||
|
|
||||||
|
#ifndef ___XP_BUILD
|
||||||
|
#define WINAPI_PARTITION_DESKTOP (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
|
||||||
|
#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
|
||||||
|
#define WINAPI_FAMILY_PARTITION(Partitions) (Partitions)
|
||||||
|
|
||||||
|
#define _WIN32_WINNT_NT4 0x0400
|
||||||
|
#define _WIN32_WINNT_WIN2K 0x0500
|
||||||
|
#define _WIN32_WINNT_WINXP 0x0501
|
||||||
|
#define _WIN32_WINNT_WS03 0x0502
|
||||||
|
#define _WIN32_WINNT_WIN6 0x0600
|
||||||
|
#define _WIN32_WINNT_VISTA 0x0600
|
||||||
|
#define _WIN32_WINNT_WS08 0x0600
|
||||||
|
#define _WIN32_WINNT_LONGHORN 0x0600
|
||||||
|
#define _WIN32_WINNT_WIN7 0x0601
|
||||||
|
#define _WIN32_WINNT_WIN8 0x0602
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#define VERSIONHELPERAPI inline bool
|
||||||
|
|
||||||
|
#else // __cplusplus
|
||||||
|
|
||||||
|
#define VERSIONHELPERAPI FORCEINLINE BOOL
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#define _WIN32_WINNT_WINBLUE 0x0603
|
||||||
|
#define _WIN32_WINNT_WIN10 0x0A00
|
||||||
|
|
||||||
|
typedef NT::NTSTATUS( NTAPI* fnRtlGetVersion )(PRTL_OSVERSIONINFOW lpVersionInformation);
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
|
||||||
|
{
|
||||||
|
/*OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
|
||||||
|
DWORDLONG const dwlConditionMask = VerSetConditionMask(
|
||||||
|
VerSetConditionMask(
|
||||||
|
VerSetConditionMask(
|
||||||
|
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
|
||||||
|
VER_MINORVERSION, VER_GREATER_EQUAL),
|
||||||
|
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
||||||
|
osvi.dwMajorVersion = wMajorVersion;
|
||||||
|
osvi.dwMinorVersion = wMinorVersion;
|
||||||
|
osvi.wServicePackMajor = wServicePackMajor;
|
||||||
|
return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;*/
|
||||||
|
|
||||||
|
RTL_OSVERSIONINFOEXW verInfo = { 0 };
|
||||||
|
verInfo.dwOSVersionInfoSize = sizeof( verInfo );
|
||||||
|
|
||||||
|
static fnRtlGetVersion RtlGetVersion = (fnRtlGetVersion)GetProcAddress( GetModuleHandleW( L"ntdll.dll" ), "RtlGetVersion" );
|
||||||
|
|
||||||
|
if (RtlGetVersion != 0 && RtlGetVersion( (PRTL_OSVERSIONINFOW)&verInfo ) == 0)
|
||||||
|
{
|
||||||
|
if (verInfo.dwMajorVersion > wMajorVersion)
|
||||||
|
return true;
|
||||||
|
else if (verInfo.dwMajorVersion < wMajorVersion)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (verInfo.dwMinorVersion > wMinorVersion)
|
||||||
|
return true;
|
||||||
|
else if (verInfo.dwMinorVersion < wMinorVersion)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (verInfo.wServicePackMajor >= wServicePackMajor)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsXPOrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WINXP ), LOBYTE( _WIN32_WINNT_WINXP ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsXPSP1OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WINXP ), LOBYTE( _WIN32_WINNT_WINXP ), 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsXPSP2OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WINXP ), LOBYTE( _WIN32_WINNT_WINXP ), 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsXPSP3OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WINXP ), LOBYTE( _WIN32_WINNT_WINXP ), 3 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsVistaOrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_VISTA ), LOBYTE( _WIN32_WINNT_VISTA ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsVistaSP1OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_VISTA ), LOBYTE( _WIN32_WINNT_VISTA ), 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsVistaSP2OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_VISTA ), LOBYTE( _WIN32_WINNT_VISTA ), 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindows7OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WIN7 ), LOBYTE( _WIN32_WINNT_WIN7 ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindows7SP1OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WIN7 ), LOBYTE( _WIN32_WINNT_WIN7 ), 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindows8OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WIN8 ), LOBYTE( _WIN32_WINNT_WIN8 ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindows8Point1OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WINBLUE ), LOBYTE( _WIN32_WINNT_WINBLUE ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindows10OrGreater()
|
||||||
|
{
|
||||||
|
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WIN10 ), LOBYTE( _WIN32_WINNT_WIN10 ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VERSIONHELPERAPI
|
||||||
|
IsWindowsServer()
|
||||||
|
{
|
||||||
|
OSVERSIONINFOEXW osvi = { sizeof( osvi ), 0, 0, 0, 0, { 0 }, 0, 0, 0, VER_NT_WORKSTATION };
|
||||||
|
DWORDLONG const dwlConditionMask = VerSetConditionMask( 0, VER_PRODUCT_TYPE, VER_EQUAL );
|
||||||
|
|
||||||
|
return !VerifyVersionInfoW( &osvi, VER_PRODUCT_TYPE, dwlConditionMask );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _VERSIONHELPERS_H_INCLUDED_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* system definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USING_IOCTL_EX TRUE
|
||||||
|
|
||||||
|
#if (USING_IOCTL_EX)
|
||||||
|
|
||||||
|
//
|
||||||
|
// New IOCTLs for GUID Partition tabled disks.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#define IOCTL_DISK_GET_DRIVE_LAYOUT_EXT IOCTL_DISK_GET_DRIVE_LAYOUT_EX
|
||||||
|
#define IOCTL_DISK_SET_DRIVE_LAYOUT_EXT IOCTL_DISK_SET_DRIVE_LAYOUT_EX
|
||||||
|
#define PARTITION_INFORMATION_EXT PARTITION_INFORMATION_EX
|
||||||
|
#define PPARTITION_INFORMATION_EXT PARTITION_INFORMATION_EX *
|
||||||
|
#define DRIVE_LAYOUT_INFORMATION_EXT DRIVE_LAYOUT_INFORMATION_EX
|
||||||
|
#define PDRIVE_LAYOUT_INFORMATION_EXT DRIVE_LAYOUT_INFORMATION_EX *
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define IOCTL_DISK_GET_DRIVE_LAYOUT_EXT IOCTL_DISK_GET_DRIVE_LAYOUT
|
||||||
|
#define IOCTL_DISK_SET_DRIVE_LAYOUT_EXT IOCTL_DISK_SET_DRIVE_LAYOUT
|
||||||
|
typedef PARTITION_INFORMATION PARTITION_INFORMATION_EXT, *PPARTITION_INFORMATION_EXT;
|
||||||
|
typedef DRIVE_LAYOUT_INFORMATION DRIVE_LAYOUT_INFORMATION_EXT, *PDRIVE_LAYOUT_INFORMATION_EXT;
|
||||||
|
|
||||||
|
#endif // USING_IOCTL_EX
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bus Type
|
||||||
|
//
|
||||||
|
|
||||||
|
static char* BusType[] = {
|
||||||
|
"UNKNOWN", // 0x00
|
||||||
|
"SCSI",
|
||||||
|
"ATAPI",
|
||||||
|
"ATA",
|
||||||
|
"IEEE 1394",
|
||||||
|
"SSA",
|
||||||
|
"FIBRE",
|
||||||
|
"USB",
|
||||||
|
"RAID"
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// SCSI Device Type
|
||||||
|
//
|
||||||
|
|
||||||
|
static char* DeviceType[] = {
|
||||||
|
"Direct Access Device", // 0x00
|
||||||
|
"Tape Device", // 0x01
|
||||||
|
"Printer Device", // 0x02
|
||||||
|
"Processor Device", // 0x03
|
||||||
|
"WORM Device", // 0x04
|
||||||
|
"CDROM Device", // 0x05
|
||||||
|
"Scanner Device", // 0x06
|
||||||
|
"Optical Disk", // 0x07
|
||||||
|
"Media Changer", // 0x08
|
||||||
|
"Comm. Device", // 0x09
|
||||||
|
"ASCIT8", // 0x0A
|
||||||
|
"ASCIT8", // 0x0B
|
||||||
|
"Array Device", // 0x0C
|
||||||
|
"Enclosure Device", // 0x0D
|
||||||
|
"RBC Device", // 0x0E
|
||||||
|
"Unknown Device" // 0x0F
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IFS format callbacks
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// Output command
|
||||||
|
//
|
||||||
|
typedef struct {
|
||||||
|
DWORD Lines;
|
||||||
|
PCHAR Output;
|
||||||
|
} TEXTOUTPUT, *PTEXTOUTPUT;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Callback command types
|
||||||
|
//
|
||||||
|
typedef enum {
|
||||||
|
PROGRESS,
|
||||||
|
DONEWITHSTRUCTURE,
|
||||||
|
UNKNOWN2,
|
||||||
|
UNKNOWN3,
|
||||||
|
UNKNOWN4,
|
||||||
|
UNKNOWN5,
|
||||||
|
INSUFFICIENTRIGHTS,
|
||||||
|
UNKNOWN7,
|
||||||
|
UNKNOWN8,
|
||||||
|
UNKNOWN9,
|
||||||
|
UNKNOWNA,
|
||||||
|
DONE,
|
||||||
|
UNKNOWNC,
|
||||||
|
UNKNOWND,
|
||||||
|
OUTPUT,
|
||||||
|
STRUCTUREPROGRESS
|
||||||
|
} CALLBACKCOMMAND;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ext2 codepages
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern CHAR * gCodepages[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// FMIFS callback definition
|
||||||
|
//
|
||||||
|
typedef BOOL (__stdcall *PFMIFSCALLBACK)( CALLBACKCOMMAND Command, DWORD SubAction, PVOID ActionInfo );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Chkdsk command in FMIFS
|
||||||
|
//
|
||||||
|
typedef VOID (__stdcall *PCHKDSK)( PWCHAR DriveRoot,
|
||||||
|
PWCHAR Format,
|
||||||
|
BOOL CorrectErrors,
|
||||||
|
BOOL Verbose,
|
||||||
|
BOOL CheckOnlyIfDirty,
|
||||||
|
BOOL ScanDrive,
|
||||||
|
PVOID Unused2,
|
||||||
|
PVOID Unused3,
|
||||||
|
PFMIFSCALLBACK Callback );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Format command in FMIFS
|
||||||
|
//
|
||||||
|
|
||||||
|
// media flags
|
||||||
|
#define FMIFS_HARDDISK 0xC
|
||||||
|
#define FMIFS_FLOPPY 0x8
|
||||||
|
|
||||||
|
typedef VOID (__stdcall *PFORMATEX)( PWCHAR DriveRoot,
|
||||||
|
DWORD MediaFlag,
|
||||||
|
PWCHAR Format,
|
||||||
|
PWCHAR Label,
|
||||||
|
BOOL QuickFormat,
|
||||||
|
DWORD ClusterSize,
|
||||||
|
PFMIFSCALLBACK Callback );
|
||||||
|
|
||||||
|
#include "..\ext3fsd\include\common.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* structure definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _EXT2_PARTITION *PEXT2_PARTITION;
|
||||||
|
|
||||||
|
typedef struct _EXT2_DISK {
|
||||||
|
|
||||||
|
ULONG Magic;
|
||||||
|
ULONG Null;
|
||||||
|
CHAR Name[256];
|
||||||
|
ULONGLONG Size;
|
||||||
|
|
||||||
|
BOOL bEjected;
|
||||||
|
BOOL bLoaded;
|
||||||
|
BOOL IsFile;
|
||||||
|
UCHAR OrderNo;
|
||||||
|
UCHAR NumParts;
|
||||||
|
UCHAR ExtStart;
|
||||||
|
DISK_GEOMETRY DiskGeometry;
|
||||||
|
STORAGE_DEVICE_DESCRIPTOR SDD;
|
||||||
|
STORAGE_ADAPTER_DESCRIPTOR SAD;
|
||||||
|
PDRIVE_LAYOUT_INFORMATION_EXT Layout;
|
||||||
|
|
||||||
|
PEXT2_PARTITION DataParts;
|
||||||
|
} EXT2_DISK, *PEXT2_DISK;
|
||||||
|
|
||||||
|
#define EXT2_DISK_MAGIC 'EDSK'
|
||||||
|
#define EXT2_DISK_NULL_MAGIC 'ENUL'
|
||||||
|
|
||||||
|
typedef struct _EXT2_CDROM {
|
||||||
|
ULONG Magic[2];
|
||||||
|
CHAR Name[256];
|
||||||
|
ULONGLONG Size;
|
||||||
|
|
||||||
|
UCHAR OrderNo;
|
||||||
|
BOOL bLoaded;
|
||||||
|
BOOL bEjected;
|
||||||
|
BOOL bIsDVD;
|
||||||
|
ULONGLONG DrvLetters;
|
||||||
|
|
||||||
|
DISK_GEOMETRY DiskGeometry;
|
||||||
|
STORAGE_DEVICE_DESCRIPTOR SDD;
|
||||||
|
STORAGE_ADAPTER_DESCRIPTOR SAD;
|
||||||
|
EXT2_VOLUME_PROPERTY3 EVP;
|
||||||
|
} EXT2_CDROM, *PEXT2_CDROM;
|
||||||
|
|
||||||
|
#define EXT2_CDROM_DEVICE_MAGIC 'ECDR'
|
||||||
|
#define EXT2_CDROM_VOLUME_MAGIC 'ECDV'
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _EXT2_VOLUME {
|
||||||
|
ULONG Magic;
|
||||||
|
struct _EXT2_VOLUME * Next;
|
||||||
|
CHAR Name[REGSTR_VAL_MAX_HCID_LEN];
|
||||||
|
ULONGLONG DrvLetters;
|
||||||
|
BOOL bRecognized;
|
||||||
|
BOOL bDynamic;
|
||||||
|
PVOLUME_DISK_EXTENTS Extent;
|
||||||
|
NT::FILE_FS_DEVICE_INFORMATION FsdInfo;
|
||||||
|
NT::FILE_FS_SIZE_INFORMATION FssInfo;
|
||||||
|
union {
|
||||||
|
NT::FILE_FS_ATTRIBUTE_INFORMATION FsaInfo;
|
||||||
|
CHAR _tmp_alinged_buf[MAX_PATH];
|
||||||
|
};
|
||||||
|
CHAR FileSystem[64];
|
||||||
|
EXT2_VOLUME_PROPERTY3 EVP;
|
||||||
|
PEXT2_PARTITION Part;
|
||||||
|
} EXT2_VOLUME, *PEXT2_VOLUME;
|
||||||
|
|
||||||
|
#define EXT2_VOLUME_MAGIC 'EVOL'
|
||||||
|
|
||||||
|
typedef struct _EXT2_PARTITION {
|
||||||
|
ULONG Magic;
|
||||||
|
DWORD PartType;
|
||||||
|
PEXT2_DISK Disk;
|
||||||
|
PPARTITION_INFORMATION_EXT Entry;
|
||||||
|
ULONGLONG DrvLetters;
|
||||||
|
PEXT2_VOLUME Volume;
|
||||||
|
UCHAR Number;
|
||||||
|
CHAR Name[REGSTR_VAL_MAX_HCID_LEN];
|
||||||
|
} EXT2_PARTITION;
|
||||||
|
#define EXT2_PART_MAGIC 'EPRT'
|
||||||
|
|
||||||
|
typedef struct _EXT2_LETTER {
|
||||||
|
|
||||||
|
UCHAR Letter;
|
||||||
|
BOOL bInvalid;
|
||||||
|
BOOL bUsed;
|
||||||
|
BOOL bTemporary;
|
||||||
|
UINT DrvType;
|
||||||
|
|
||||||
|
PVOLUME_DISK_EXTENTS Extent;
|
||||||
|
PSTORAGE_DEVICE_NUMBER SDN;
|
||||||
|
|
||||||
|
CHAR SymLink[MAX_PATH];
|
||||||
|
} EXT2_LETTER, *PEXT2_LETTER;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* global definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern BOOL g_bAutoMount;
|
||||||
|
extern ULONG g_nFlps;
|
||||||
|
extern ULONG g_nDisks;
|
||||||
|
extern ULONG g_nCdroms;
|
||||||
|
extern ULONG g_nVols;
|
||||||
|
|
||||||
|
extern EXT2_LETTER drvLetters[26];
|
||||||
|
extern EXT2_LETTER drvDigits[10];
|
||||||
|
|
||||||
|
extern PEXT2_DISK gDisks;
|
||||||
|
extern PEXT2_CDROM gCdroms;
|
||||||
|
extern PEXT2_VOLUME gVols;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* routines definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
char *PartitionString(int type);
|
||||||
|
char *DriveTypeString(UINT type);
|
||||||
|
char *DeviceTypeString(DEVICE_TYPE type);
|
||||||
|
char *BusTypeString(STORAGE_BUS_TYPE BusType);
|
||||||
|
|
||||||
|
BOOL IsWindows2000();
|
||||||
|
BOOL IsVistaOrAbove();
|
||||||
|
|
||||||
|
BOOL CanDoLocalMount();
|
||||||
|
|
||||||
|
#define EXT2_DESIRED_ACCESS (GENERIC_READ)
|
||||||
|
|
||||||
|
NT::NTSTATUS
|
||||||
|
Ext2Open(
|
||||||
|
PCHAR FileName,
|
||||||
|
PHANDLE Handle,
|
||||||
|
ULONG DesiredAccess
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2Close(HANDLE* Handle);
|
||||||
|
|
||||||
|
NT::NTSTATUS
|
||||||
|
Ext2WriteDisk(
|
||||||
|
HANDLE Handle,
|
||||||
|
BOOL IsFile,
|
||||||
|
ULONG SectorSize,
|
||||||
|
ULONGLONG Offset,
|
||||||
|
ULONG Length,
|
||||||
|
PVOID Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
NT::NTSTATUS
|
||||||
|
Ext2Read(
|
||||||
|
IN HANDLE Handle,
|
||||||
|
IN BOOL IsFile,
|
||||||
|
IN ULONG SectorSize,
|
||||||
|
IN ULONGLONG Offset,
|
||||||
|
IN ULONG Length,
|
||||||
|
IN PVOID Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
NT::NTSTATUS
|
||||||
|
Ext2QueryDisk(
|
||||||
|
HANDLE Handle,
|
||||||
|
PDISK_GEOMETRY DiskGeometry
|
||||||
|
);
|
||||||
|
|
||||||
|
PVOLUME_DISK_EXTENTS
|
||||||
|
Ext2QueryVolumeExtents(
|
||||||
|
HANDLE hVolume
|
||||||
|
);
|
||||||
|
|
||||||
|
PVOLUME_DISK_EXTENTS
|
||||||
|
Ext2QueryDriveExtents(
|
||||||
|
CHAR DriveLetter
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2QueryDrvLetter(
|
||||||
|
PEXT2_LETTER drvLetter
|
||||||
|
);
|
||||||
|
|
||||||
|
NT::NTSTATUS
|
||||||
|
Ext2QueryMediaType(
|
||||||
|
HANDLE Handle,
|
||||||
|
PDWORD MediaType
|
||||||
|
);
|
||||||
|
|
||||||
|
NT::NTSTATUS
|
||||||
|
Ext2QueryProperty(
|
||||||
|
HANDLE Handle,
|
||||||
|
STORAGE_PROPERTY_ID Id,
|
||||||
|
PVOID DescBuf,
|
||||||
|
ULONG DescSize
|
||||||
|
);
|
||||||
|
|
||||||
|
PDRIVE_LAYOUT_INFORMATION_EXT
|
||||||
|
Ext2QueryDriveLayout(
|
||||||
|
HANDLE Handle,
|
||||||
|
PUCHAR NumOfParts
|
||||||
|
);
|
||||||
|
|
||||||
|
NT::NTSTATUS
|
||||||
|
Ext2SetDriveLayout(
|
||||||
|
HANDLE Handle,
|
||||||
|
PDRIVE_LAYOUT_INFORMATION_EXT Layout
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2SetPartitionType(
|
||||||
|
PEXT2_PARTITION Part,
|
||||||
|
BYTE Type
|
||||||
|
);
|
||||||
|
|
||||||
|
PEXT2_PARTITION
|
||||||
|
Ext2QueryVolumePartition(
|
||||||
|
PEXT2_VOLUME Volume
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2FlushVolume(CHAR *Device);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2QuerySysConfig();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2CompareExtents(
|
||||||
|
PVOLUME_DISK_EXTENTS ext1,
|
||||||
|
PVOLUME_DISK_EXTENTS ext2
|
||||||
|
);
|
||||||
|
|
||||||
|
ULONGLONG
|
||||||
|
Ext2QueryVolumeDrvLetters(PEXT2_VOLUME Volume);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2QueryVolumeDisks(PEXT2_VOLUME Volume);
|
||||||
|
|
||||||
|
ULONGLONG
|
||||||
|
Ext2QueryCdromDrvLetters(PEXT2_CDROM Cdrom);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2DrvNotify(UCHAR drive, int mount);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2QueryExt2Property (
|
||||||
|
HANDLE Handle,
|
||||||
|
PEXT2_VOLUME_PROPERTY3 EVP
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2QueryPerfStat (
|
||||||
|
HANDLE Handle,
|
||||||
|
PEXT2_QUERY_PERFSTAT Stat,
|
||||||
|
PEXT2_PERF_STATISTICS_V1 *PerfV1,
|
||||||
|
PEXT2_PERF_STATISTICS_V2 *PerfV2
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL Ext2IsNullUuid (__u8 * uuid);
|
||||||
|
BOOL
|
||||||
|
Ext2CheckVolumeRegistryProperty(
|
||||||
|
PEXT2_VOLUME_PROPERTY3 EVP
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2SetDefaultVolumeRegistryProperty(
|
||||||
|
PEXT2_VOLUME_PROPERTY3 EVP
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2StorePropertyinRegistry(
|
||||||
|
PEXT2_VOLUME_PROPERTY3 EVP
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2SetExt2Property (
|
||||||
|
HANDLE Handle,
|
||||||
|
PEXT2_VOLUME_PROPERTY3 EVP
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2QueryGlobalProperty(
|
||||||
|
ULONG * ulStartup,
|
||||||
|
BOOL * bReadonly,
|
||||||
|
BOOL * bExt3Writable,
|
||||||
|
CHAR * Codepage,
|
||||||
|
CHAR * sPrefix,
|
||||||
|
CHAR * sSuffix,
|
||||||
|
BOOL * bAutoMount
|
||||||
|
);
|
||||||
|
|
||||||
|
INT
|
||||||
|
Ext2QueryDrvVersion(
|
||||||
|
CHAR * Version,
|
||||||
|
CHAR * Date,
|
||||||
|
CHAR * Time
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2SetGlobalProperty (
|
||||||
|
ULONG ulStartup,
|
||||||
|
BOOLEAN bReadonly,
|
||||||
|
BOOLEAN bExt3Writable,
|
||||||
|
CHAR * Codepage,
|
||||||
|
CHAR * sPrefix,
|
||||||
|
CHAR * sSuffix,
|
||||||
|
BOOL bAutoMount
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL Ext2IsX64System();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2IsServiceStarted();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2StartService(CHAR *service);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2StartExt2Srv();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2StartExt2Fsd();
|
||||||
|
|
||||||
|
CString
|
||||||
|
Ext2SysInformation();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2LoadDisks();
|
||||||
|
|
||||||
|
BOOL Ext2ProcessExt2Volumes();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2CleanupDisks();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2LoadCdroms();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2LoadCdromDrvLetters();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2CleanupCdroms();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2LoadDiskPartitions(PEXT2_DISK Disk);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2LoadAllDiskPartitions();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2MountingVolumes();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2LoadVolumes();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2LoadAllVolumeDrvLetters();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2LoadRemovableVolumes();
|
||||||
|
|
||||||
|
CString
|
||||||
|
Ext2QueryVolumeLetterStrings(
|
||||||
|
ULONGLONG letters,
|
||||||
|
PEXT2_LETTER * first
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2RefreshVLVI(
|
||||||
|
CListCtrl *List,
|
||||||
|
PEXT2_VOLUME chain,
|
||||||
|
int nItem
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2InsertVolume(
|
||||||
|
CListCtrl *List,
|
||||||
|
PEXT2_VOLUME chain
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2RefreshVLCD(
|
||||||
|
CListCtrl *List,
|
||||||
|
PEXT2_CDROM Cdrom,
|
||||||
|
int nItem
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2InsertCdromAsVolume(
|
||||||
|
CListCtrl *List,
|
||||||
|
PEXT2_CDROM Cdrom
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2RefreshVolumeList(CListCtrl *List);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2RefreshDVPT(
|
||||||
|
CListCtrl* List,
|
||||||
|
PEXT2_PARTITION Part,
|
||||||
|
int nItem
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2InsertPartition(
|
||||||
|
CListCtrl* List,
|
||||||
|
PEXT2_DISK Disk,
|
||||||
|
PEXT2_PARTITION Part
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2InsertDisk(
|
||||||
|
CListCtrl *List,
|
||||||
|
PEXT2_DISK Disk
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2RefreshDVCM(
|
||||||
|
CListCtrl *List,
|
||||||
|
PEXT2_CDROM Cdrom,
|
||||||
|
int nItem
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2InsertCdromAsDisk(
|
||||||
|
CListCtrl *List,
|
||||||
|
PEXT2_CDROM Cdrom
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2RefreshDiskList(CListCtrl *List);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2CleanupVolumes();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2LoadDrvLetter(PEXT2_LETTER drvLetter, CHAR cLetter);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2LoadDrvLetters();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2CleanDrvLetter(PEXT2_LETTER drvLetter);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2CleanupDrvLetters();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2RemoveDrvLetter(
|
||||||
|
PEXT2_LETTER drvLetter
|
||||||
|
);
|
||||||
|
BOOL
|
||||||
|
Ext2RemoveDriveLetter(CHAR DrvLetter);
|
||||||
|
|
||||||
|
CHAR
|
||||||
|
Ext2QueryRegistryMountPoint (
|
||||||
|
CHAR * devName
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2SetRegistryMountPoint (
|
||||||
|
CHAR * dosPath,
|
||||||
|
CHAR * devName,
|
||||||
|
BOOL bSet
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2InsertMountPoint(
|
||||||
|
CHAR * volume,
|
||||||
|
UCHAR drvChar,
|
||||||
|
BOOL bGlobal
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2UpdateDrvLetter(
|
||||||
|
PEXT2_LETTER drvLetter,
|
||||||
|
PCHAR devPath
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2AssignDrvLetter(
|
||||||
|
PEXT2_LETTER drvLetter,
|
||||||
|
PCHAR devPath,
|
||||||
|
BOOL bPermanent
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL Ext2IsDrvLetterAvailable(CHAR drive);
|
||||||
|
CHAR Ext2MountVolume(CHAR *voldev);
|
||||||
|
|
||||||
|
CHAR Ext2MountVolumeAs(CHAR *voldev, CHAR letter);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2RemoveMountPoint(
|
||||||
|
PEXT2_LETTER drvLetter,
|
||||||
|
BOOL bPermanent
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2SymLinkRemoval(CHAR drvLetter);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2SetVolumeMountPoint (
|
||||||
|
CHAR * dosPath,
|
||||||
|
CHAR * devName
|
||||||
|
);
|
||||||
|
|
||||||
|
UCHAR
|
||||||
|
Ext2QueryMountPoint(
|
||||||
|
CHAR * volume
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2RefreshVolumePoint(
|
||||||
|
CHAR * volume,
|
||||||
|
UCHAR drvChar
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2NotifyVolumePoint(
|
||||||
|
PEXT2_VOLUME volume,
|
||||||
|
UCHAR drvChar
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2VolumeArrivalNotify(PCHAR VolumePath);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2SetAppAutorun(BOOL bInstall);
|
||||||
|
|
||||||
|
BOOL Ext2RunMgrForCurrentUser();
|
||||||
|
|
||||||
|
int
|
||||||
|
Ext2SetManagerAsService(BOOL bInstall);
|
||||||
|
|
||||||
|
extern BOOL g_bAutoRemoveDeadLetters;
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2AddLetterMask(ULONGLONG LetterMask);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2AutoRemoveDeadLetters();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2RemoveDosSymLink(CHAR drvChar);
|
||||||
|
|
||||||
|
BOOL Ext2DismountVolume(CHAR *voldev);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOL WINAPI
|
||||||
|
WTSQueryUserToken(
|
||||||
|
ULONG SessionId,
|
||||||
|
PHANDLE phToken
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL WINAPI ConvertStringSidToSidA(
|
||||||
|
LPCTSTR StringSid,
|
||||||
|
PSID* Sid
|
||||||
|
);
|
||||||
|
|
||||||
|
WINUSERAPI
|
||||||
|
HWND
|
||||||
|
WINAPI
|
||||||
|
GetShellWindow(
|
||||||
|
VOID);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _ENUM_DISK_INCLUDE_
|
||||||
584
Ext2Mgr/ext2fs.h
Normal file
@@ -0,0 +1,584 @@
|
|||||||
|
/*
|
||||||
|
* linux/include/linux/ext2_fs.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1992, 1993, 1994, 1995
|
||||||
|
* Remy Card (card@masi.ibp.fr)
|
||||||
|
* Laboratoire MASI - Institut Blaise Pascal
|
||||||
|
* Universite Pierre et Marie Curie (Paris VI)
|
||||||
|
*
|
||||||
|
* from
|
||||||
|
*
|
||||||
|
* linux/include/linux/minix_fs.h
|
||||||
|
*
|
||||||
|
* Copyright f(C) 1991, 1992 Linus Torvalds
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LINUX_EXT2_FS_H
|
||||||
|
#define _LINUX_EXT2_FS_H
|
||||||
|
|
||||||
|
#include "types.h" /* Changed from linux/types.h */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The second extended filesystem constants/structures
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define EXT2FS_DEBUG to produce debug messages
|
||||||
|
*/
|
||||||
|
#undef EXT2FS_DEBUG
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
|
||||||
|
*/
|
||||||
|
#define EXT2_PREALLOCATE
|
||||||
|
#define EXT2_DEFAULT_PREALLOC_BLOCKS 8
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The second extended file system version
|
||||||
|
*/
|
||||||
|
#define EXT2FS_DATE "95/08/09"
|
||||||
|
#define EXT2FS_VERSION "0.5b"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Special inodes numbers
|
||||||
|
*/
|
||||||
|
#define EXT2_BAD_INO 1 /* Bad blocks inode */
|
||||||
|
#define EXT2_ROOT_INO 2 /* Root inode */
|
||||||
|
#define EXT2_ACL_IDX_INO 3 /* ACL inode */
|
||||||
|
#define EXT2_ACL_DATA_INO 4 /* ACL inode */
|
||||||
|
#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
|
||||||
|
#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
|
||||||
|
#define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */
|
||||||
|
#define EXT2_JOURNAL_INO 8 /* Journal inode */
|
||||||
|
|
||||||
|
/* First non-reserved inode for old ext2 filesystems */
|
||||||
|
#define EXT2_GOOD_OLD_FIRST_INO 11
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The second extended file system magic number
|
||||||
|
*/
|
||||||
|
#define EXT2_SUPER_MAGIC 0xEF53
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Maximal count of links to a file
|
||||||
|
*/
|
||||||
|
#define EXT2_LINK_MAX 32000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro-instructions used to manage several block sizes
|
||||||
|
*/
|
||||||
|
#define EXT2_MIN_BLOCK_SIZE 512
|
||||||
|
#define EXT2_MAX_BLOCK_SIZE 4096
|
||||||
|
#define EXT2_MIN_BLOCK_LOG_SIZE 10
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
# define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
|
||||||
|
#else
|
||||||
|
# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
|
||||||
|
#endif
|
||||||
|
#define EXT2_ACLE_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry))
|
||||||
|
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
|
||||||
|
#else
|
||||||
|
# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
|
||||||
|
#endif
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
#define EXT2_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_addr_per_block_bits)
|
||||||
|
#define EXT2_INODE_SIZE(s) ((s)->u.ext2_sb.s_inode_size)
|
||||||
|
#define EXT2_FIRST_INO(s) ((s)->u.ext2_sb.s_first_ino)
|
||||||
|
#else
|
||||||
|
#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
|
||||||
|
EXT2_GOOD_OLD_INODE_SIZE : \
|
||||||
|
(s)->s_inode_size)
|
||||||
|
#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
|
||||||
|
EXT2_GOOD_OLD_FIRST_INO : \
|
||||||
|
(s)->s_first_ino)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro-instructions used to manage fragments
|
||||||
|
*/
|
||||||
|
#define EXT2_MIN_FRAG_SIZE 1024
|
||||||
|
#define EXT2_MAX_FRAG_SIZE 4096
|
||||||
|
#define EXT2_MIN_FRAG_LOG_SIZE 10
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
# define EXT2_FRAG_SIZE(s) ((s)->u.ext2_sb.s_frag_size)
|
||||||
|
# define EXT2_FRAGS_PER_BLOCK(s) ((s)->u.ext2_sb.s_frags_per_block)
|
||||||
|
#else
|
||||||
|
# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
|
||||||
|
# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ACL structures
|
||||||
|
*/
|
||||||
|
struct ext2_acl_header /* Header of Access Control Lists */
|
||||||
|
{
|
||||||
|
__u32 aclh_size;
|
||||||
|
__u32 aclh_file_count;
|
||||||
|
__u32 aclh_acle_count;
|
||||||
|
__u32 aclh_first_acle;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ext2_acl_entry /* Access Control List Entry */
|
||||||
|
{
|
||||||
|
__u32 acle_size;
|
||||||
|
__u16 acle_perms; /* Access permissions */
|
||||||
|
__u16 acle_type; /* Type of entry */
|
||||||
|
__u16 acle_tag; /* User or group identity */
|
||||||
|
__u16 acle_pad1;
|
||||||
|
__u32 acle_next; /* Pointer on next entry for the */
|
||||||
|
/* same inode or on next free entry */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure of a blocks group descriptor
|
||||||
|
*/
|
||||||
|
struct ext2_group_desc
|
||||||
|
{
|
||||||
|
__u32 bg_block_bitmap; /* Blocks bitmap block */
|
||||||
|
__u32 bg_inode_bitmap; /* Inodes bitmap block */
|
||||||
|
__u32 bg_inode_table; /* Inodes table block */
|
||||||
|
__u16 bg_free_blocks_count; /* Free blocks count */
|
||||||
|
__u16 bg_free_inodes_count; /* Free inodes count */
|
||||||
|
__u16 bg_used_dirs_count; /* Directories count */
|
||||||
|
__u16 bg_pad;
|
||||||
|
__u32 bg_reserved[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Data structures used by the directory indexing feature
|
||||||
|
*
|
||||||
|
* Note: all of the multibyte integer fields are little endian.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: dx_root_info is laid out so that if it should somehow get
|
||||||
|
* overlaid by a dirent the two low bits of the hash version will be
|
||||||
|
* zero. Therefore, the hash version mod 4 should never be 0.
|
||||||
|
* Sincerely, the paranoia department.
|
||||||
|
*/
|
||||||
|
struct ext2_dx_root_info {
|
||||||
|
__u32 reserved_zero;
|
||||||
|
__u8 hash_version; /* 0 now, 1 at release */
|
||||||
|
__u8 info_length; /* 8 */
|
||||||
|
__u8 indirect_levels;
|
||||||
|
__u8 unused_flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ext2_dx_entry {
|
||||||
|
__u32 hash;
|
||||||
|
__u32 block;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ext2_dx_countlimit {
|
||||||
|
__u16 limit;
|
||||||
|
__u16 count;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro-instructions used to manage group descriptors
|
||||||
|
*/
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
# define EXT2_BLOCKS_PER_GROUP(s) ((s)->u.ext2_sb.s_blocks_per_group)
|
||||||
|
# define EXT2_DESC_PER_BLOCK(s) ((s)->u.ext2_sb.s_desc_per_block)
|
||||||
|
# define EXT2_INODES_PER_GROUP(s) ((s)->u.ext2_sb.s_inodes_per_group)
|
||||||
|
# define EXT2_DESC_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_desc_per_block_bits)
|
||||||
|
#else
|
||||||
|
# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
|
||||||
|
# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
|
||||||
|
# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constants relative to the data blocks
|
||||||
|
*/
|
||||||
|
#define EXT2_NDIR_BLOCKS 12
|
||||||
|
#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
|
||||||
|
#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
|
||||||
|
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
|
||||||
|
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Inode flags
|
||||||
|
*/
|
||||||
|
#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */
|
||||||
|
#define EXT2_UNRM_FL 0x00000002 /* Undelete */
|
||||||
|
#define EXT2_COMPR_FL 0x00000004 /* Compress file */
|
||||||
|
#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */
|
||||||
|
#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
|
||||||
|
#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
|
||||||
|
#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
|
||||||
|
#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */
|
||||||
|
/* Reserved for compression usage... */
|
||||||
|
#define EXT2_DIRTY_FL 0x00000100
|
||||||
|
#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
|
||||||
|
#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */
|
||||||
|
#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
|
||||||
|
/* End compression flags --- maybe not all used */
|
||||||
|
#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
|
||||||
|
#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */
|
||||||
|
#define EXT2_IMAGIC_FL 0x00002000
|
||||||
|
#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
|
||||||
|
#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
|
||||||
|
#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
|
||||||
|
|
||||||
|
#define EXT2_FL_USER_VISIBLE 0x0000DFFF /* User visible flags */
|
||||||
|
#define EXT2_FL_USER_MODIFIABLE 0x000080FF /* User modifiable flags */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ioctl commands
|
||||||
|
*/
|
||||||
|
#define EXT2_IOC_GETFLAGS _IOR('f', 1, long)
|
||||||
|
#define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
|
||||||
|
#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
|
||||||
|
#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure of an inode on the disk
|
||||||
|
*/
|
||||||
|
struct ext2_inode {
|
||||||
|
__u16 i_mode; /* File mode */
|
||||||
|
__u16 i_uid; /* Low 16 bits of Owner Uid */
|
||||||
|
__u32 i_size; /* Size in bytes */
|
||||||
|
__u32 i_atime; /* Access time */
|
||||||
|
__u32 i_ctime; /* Creation time */
|
||||||
|
__u32 i_mtime; /* Modification time */
|
||||||
|
__u32 i_dtime; /* Deletion Time */
|
||||||
|
__u16 i_gid; /* Low 16 bits of Group Id */
|
||||||
|
__u16 i_links_count; /* Links count */
|
||||||
|
__u32 i_blocks; /* Blocks count */
|
||||||
|
__u32 i_flags; /* File flags */
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
__u32 l_i_reserved1;
|
||||||
|
} linux1;
|
||||||
|
struct {
|
||||||
|
__u32 h_i_translator;
|
||||||
|
} hurd1;
|
||||||
|
struct {
|
||||||
|
__u32 m_i_reserved1;
|
||||||
|
} masix1;
|
||||||
|
} osd1; /* OS dependent 1 */
|
||||||
|
__u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
|
||||||
|
__u32 i_generation; /* File version (for NFS) */
|
||||||
|
__u32 i_file_acl; /* File ACL */
|
||||||
|
__u32 i_dir_acl; /* Directory ACL */
|
||||||
|
__u32 i_faddr; /* Fragment address */
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
__u8 l_i_frag; /* Fragment number */
|
||||||
|
__u8 l_i_fsize; /* Fragment size */
|
||||||
|
__u16 i_pad1;
|
||||||
|
__u16 l_i_uid_high; /* these 2 fields */
|
||||||
|
__u16 l_i_gid_high; /* were reserved2[0] */
|
||||||
|
__u32 l_i_reserved2;
|
||||||
|
} linux2;
|
||||||
|
struct {
|
||||||
|
__u8 h_i_frag; /* Fragment number */
|
||||||
|
__u8 h_i_fsize; /* Fragment size */
|
||||||
|
__u16 h_i_mode_high;
|
||||||
|
__u16 h_i_uid_high;
|
||||||
|
__u16 h_i_gid_high;
|
||||||
|
__u32 h_i_author;
|
||||||
|
} hurd2;
|
||||||
|
struct {
|
||||||
|
__u8 m_i_frag; /* Fragment number */
|
||||||
|
__u8 m_i_fsize; /* Fragment size */
|
||||||
|
__u16 m_pad1;
|
||||||
|
__u32 m_i_reserved2[2];
|
||||||
|
} masix2;
|
||||||
|
} osd2; /* OS dependent 2 */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define i_size_high i_dir_acl
|
||||||
|
|
||||||
|
#if defined(__KERNEL__) || defined(__linux__)
|
||||||
|
#define i_reserved1 osd1.linux1.l_i_reserved1
|
||||||
|
#define i_frag osd2.linux2.l_i_frag
|
||||||
|
#define i_fsize osd2.linux2.l_i_fsize
|
||||||
|
#define i_uid_low i_uid
|
||||||
|
#define i_gid_low i_gid
|
||||||
|
#define i_uid_high osd2.linux2.l_i_uid_high
|
||||||
|
#define i_gid_high osd2.linux2.l_i_gid_high
|
||||||
|
#define i_reserved2 osd2.linux2.l_i_reserved2
|
||||||
|
|
||||||
|
#elif defined(__GNU__)
|
||||||
|
|
||||||
|
#define i_translator osd1.hurd1.h_i_translator
|
||||||
|
#define i_frag osd2.hurd2.h_i_frag;
|
||||||
|
#define i_fsize osd2.hurd2.h_i_fsize;
|
||||||
|
#define i_uid_high osd2.hurd2.h_i_uid_high
|
||||||
|
#define i_gid_high osd2.hurd2.h_i_gid_high
|
||||||
|
#define i_author osd2.hurd2.h_i_author
|
||||||
|
|
||||||
|
#elif defined(__masix__)
|
||||||
|
|
||||||
|
#define i_reserved1 osd1.masix1.m_i_reserved1
|
||||||
|
#define i_frag osd2.masix2.m_i_frag
|
||||||
|
#define i_fsize osd2.masix2.m_i_fsize
|
||||||
|
#define i_reserved2 osd2.masix2.m_i_reserved2
|
||||||
|
|
||||||
|
#endif /* defined(__KERNEL) || defined(__linux__) */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File system states
|
||||||
|
*/
|
||||||
|
#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
|
||||||
|
#define EXT2_ERROR_FS 0x0002 /* Errors detected */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mount flags
|
||||||
|
*/
|
||||||
|
#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */
|
||||||
|
#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */
|
||||||
|
#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */
|
||||||
|
#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
|
||||||
|
#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
|
||||||
|
#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
|
||||||
|
#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
|
||||||
|
#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */
|
||||||
|
|
||||||
|
#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
|
||||||
|
#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
|
||||||
|
#define test_opt(sb, opt) ((sb)->u.ext2_sb.s_mount_opt & \
|
||||||
|
EXT2_MOUNT_##opt)
|
||||||
|
/*
|
||||||
|
* Maximal mount counts between two filesystem checks
|
||||||
|
*/
|
||||||
|
#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
|
||||||
|
#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Behaviour when detecting errors
|
||||||
|
*/
|
||||||
|
#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
|
||||||
|
#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
|
||||||
|
#define EXT2_ERRORS_PANIC 3 /* Panic */
|
||||||
|
#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure of the super block
|
||||||
|
*/
|
||||||
|
struct ext2_super_block {
|
||||||
|
__u32 s_inodes_count; /* Inodes count */
|
||||||
|
__u32 s_blocks_count; /* Blocks count */
|
||||||
|
__u32 s_r_blocks_count; /* Reserved blocks count */
|
||||||
|
__u32 s_free_blocks_count; /* Free blocks count */
|
||||||
|
__u32 s_free_inodes_count; /* Free inodes count */
|
||||||
|
__u32 s_first_data_block; /* First Data Block */
|
||||||
|
__u32 s_log_block_size; /* Block size */
|
||||||
|
__s32 s_log_frag_size; /* Fragment size */
|
||||||
|
__u32 s_blocks_per_group; /* # Blocks per group */
|
||||||
|
__u32 s_frags_per_group; /* # Fragments per group */
|
||||||
|
__u32 s_inodes_per_group; /* # Inodes per group */
|
||||||
|
__u32 s_mtime; /* Mount time */
|
||||||
|
__u32 s_wtime; /* Write time */
|
||||||
|
__u16 s_mnt_count; /* Mount count */
|
||||||
|
__s16 s_max_mnt_count; /* Maximal mount count */
|
||||||
|
__u16 s_magic; /* Magic signature */
|
||||||
|
__u16 s_state; /* File system state */
|
||||||
|
__u16 s_errors; /* Behaviour when detecting errors */
|
||||||
|
__u16 s_minor_rev_level; /* minor revision level */
|
||||||
|
__u32 s_lastcheck; /* time of last check */
|
||||||
|
__u32 s_checkinterval; /* max. time between checks */
|
||||||
|
__u32 s_creator_os; /* OS */
|
||||||
|
__u32 s_rev_level; /* Revision level */
|
||||||
|
__u16 s_def_resuid; /* Default uid for reserved blocks */
|
||||||
|
__u16 s_def_resgid; /* Default gid for reserved blocks */
|
||||||
|
/*
|
||||||
|
* These fields are for EXT2_DYNAMIC_REV superblocks only.
|
||||||
|
*
|
||||||
|
* Note: the difference between the compatible feature set and
|
||||||
|
* the incompatible feature set is that if there is a bit set
|
||||||
|
* in the incompatible feature set that the kernel doesn't
|
||||||
|
* know about, it should refuse to mount the filesystem.
|
||||||
|
*
|
||||||
|
* e2fsck's requirements are more strict; if it doesn't know
|
||||||
|
* about a feature in either the compatible or incompatible
|
||||||
|
* feature set, it must abort and not try to meddle with
|
||||||
|
* things it doesn't understand...
|
||||||
|
*/
|
||||||
|
__u32 s_first_ino; /* First non-reserved inode */
|
||||||
|
__u16 s_inode_size; /* size of inode structure */
|
||||||
|
__u16 s_block_group_nr; /* block group # of this superblock */
|
||||||
|
__u32 s_feature_compat; /* compatible feature set */
|
||||||
|
__u32 s_feature_incompat; /* incompatible feature set */
|
||||||
|
__u32 s_feature_ro_compat; /* readonly-compatible feature set */
|
||||||
|
__u8 s_uuid[16]; /* 128-bit uuid for volume */
|
||||||
|
char s_volume_name[16]; /* volume name */
|
||||||
|
char s_last_mounted[64]; /* directory where last mounted */
|
||||||
|
__u32 s_algorithm_usage_bitmap; /* For compression */
|
||||||
|
/*
|
||||||
|
* Performance hints. Directory preallocation should only
|
||||||
|
* happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
|
||||||
|
*/
|
||||||
|
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
|
||||||
|
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
|
||||||
|
__u16 s_padding1;
|
||||||
|
/*
|
||||||
|
* Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
|
||||||
|
*/
|
||||||
|
__u8 s_journal_uuid[16]; /* uuid of journal superblock */
|
||||||
|
__u32 s_journal_inum; /* inode number of journal file */
|
||||||
|
__u32 s_journal_dev; /* device number of journal file */
|
||||||
|
__u32 s_last_orphan; /* start of list of inodes to delete */
|
||||||
|
|
||||||
|
__u32 s_reserved[197]; /* Padding to the end of the block */
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
#define EXT2_SB(sb) (&((sb)->u.ext2_sb))
|
||||||
|
#else
|
||||||
|
/* Assume that user mode programs are passing in an ext2fs superblock, not
|
||||||
|
* a kernel struct super_block. This will allow us to call the feature-test
|
||||||
|
* macros from user land. */
|
||||||
|
#define EXT2_SB(sb) (sb)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Codes for operating systems
|
||||||
|
*/
|
||||||
|
#define EXT2_OS_LINUX 0
|
||||||
|
#define EXT2_OS_HURD 1
|
||||||
|
#define EXT2_OS_MASIX 2
|
||||||
|
#define EXT2_OS_FREEBSD 3
|
||||||
|
#define EXT2_OS_LITES 4
|
||||||
|
#define EXT2_OS_WINNT 5
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision levels
|
||||||
|
*/
|
||||||
|
#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
|
||||||
|
#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
|
||||||
|
|
||||||
|
#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
|
||||||
|
#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
|
||||||
|
|
||||||
|
#define EXT2_GOOD_OLD_INODE_SIZE 128
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Feature set definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
|
||||||
|
( EXT2_SB(sb)->s_feature_compat & (mask) )
|
||||||
|
#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
|
||||||
|
( EXT2_SB(sb)->s_feature_ro_compat & (mask) )
|
||||||
|
#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
|
||||||
|
( EXT2_SB(sb)->s_feature_incompat & (mask) )
|
||||||
|
|
||||||
|
#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
|
||||||
|
#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
|
||||||
|
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
|
||||||
|
#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
|
||||||
|
#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010
|
||||||
|
#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
|
||||||
|
|
||||||
|
#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
|
||||||
|
#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
|
||||||
|
#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
|
||||||
|
|
||||||
|
#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
|
||||||
|
#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
|
||||||
|
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
|
||||||
|
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
|
||||||
|
|
||||||
|
#define EXT2_FEATURE_COMPAT_SUPP 0
|
||||||
|
#define EXT2_FEATURE_INCOMPAT_SUPP EXT2_FEATURE_INCOMPAT_FILETYPE
|
||||||
|
#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
|
||||||
|
EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
|
||||||
|
EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default values for user and/or group using reserved blocks
|
||||||
|
*/
|
||||||
|
#define EXT2_DEF_RESUID 0
|
||||||
|
#define EXT2_DEF_RESGID 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure of a directory entry
|
||||||
|
*/
|
||||||
|
#define EXT2_NAME_LEN 255
|
||||||
|
|
||||||
|
struct ext2_dir_entry {
|
||||||
|
__u32 inode; /* Inode number */
|
||||||
|
__u16 rec_len; /* Directory entry length */
|
||||||
|
__u16 name_len; /* Name length */
|
||||||
|
char name[EXT2_NAME_LEN]; /* File name */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new version of the directory entry. Since EXT2 structures are
|
||||||
|
* stored in intel byte order, and the name_len field could never be
|
||||||
|
* bigger than 255 chars, it's safe to reclaim the extra byte for the
|
||||||
|
* file_type field.
|
||||||
|
*/
|
||||||
|
struct ext2_dir_entry_2 {
|
||||||
|
__u32 inode; /* Inode number */
|
||||||
|
__u16 rec_len; /* Directory entry length */
|
||||||
|
__u8 name_len; /* Name length */
|
||||||
|
__u8 file_type;
|
||||||
|
char name[EXT2_NAME_LEN]; /* File name */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ext2 directory file types. Only the low 3 bits are used. The
|
||||||
|
* other bits are reserved for now.
|
||||||
|
*/
|
||||||
|
#define EXT2_FT_UNKNOWN 0
|
||||||
|
#define EXT2_FT_REG_FILE 1
|
||||||
|
#define EXT2_FT_DIR 2
|
||||||
|
#define EXT2_FT_CHRDEV 3
|
||||||
|
#define EXT2_FT_BLKDEV 4
|
||||||
|
#define EXT2_FT_FIFO 5
|
||||||
|
#define EXT2_FT_SOCK 6
|
||||||
|
#define EXT2_FT_SYMLINK 7
|
||||||
|
|
||||||
|
#define EXT2_FT_MAX 8
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EXT2_DIR_PAD defines the directory entries boundaries
|
||||||
|
*
|
||||||
|
* NOTE: It must be a multiple of 4
|
||||||
|
*/
|
||||||
|
#define EXT2_DIR_PAD 4
|
||||||
|
#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
|
||||||
|
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
|
||||||
|
~EXT2_DIR_ROUND)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SWAP information settings
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SWAP_HEADER_OFFSET 0
|
||||||
|
#define SWAP_HEADER_MAGIC_V1 "SWAP-SPACE"
|
||||||
|
#define SWAP_HEADER_MAGIC_V2 "SWAPSPACE2"
|
||||||
|
|
||||||
|
/* The following is a subset of linux/include/linux/swap.h (2.2.6) */
|
||||||
|
|
||||||
|
union swap_header {
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char reserved[PAGE_SIZE - 10];
|
||||||
|
char magic[10];
|
||||||
|
} magic;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char bootbits[1024]; /* Space for disklabel etc. */
|
||||||
|
unsigned int version;
|
||||||
|
unsigned int last_page;
|
||||||
|
unsigned int nr_badpages;
|
||||||
|
unsigned int padding[125];
|
||||||
|
unsigned int badpages[1];
|
||||||
|
} info;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* super block */
|
||||||
|
#define SUPER_BLOCK_OFFSET (0x400)
|
||||||
|
#define SUPER_BLOCK_SIZE (0x400)
|
||||||
|
|
||||||
|
#endif /* _LINUX_EXT2_FS_H */
|
||||||
BIN
Ext2Mgr/images/about.bmp
Normal file
|
After Width: | Height: | Size: 703 KiB |
BIN
Ext2Mgr/images/line.bmp
Normal file
|
After Width: | Height: | Size: 656 B |
4439
Ext2Mgr/ntdll.h
Normal file
BIN
Ext2Mgr/res/Ext2Mgr.ico
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
13
Ext2Mgr/res/Ext2Mgr.rc2
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// EXT2MGR.RC2 - resources Microsoft Visual C++ does not edit directly
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#error this file is not editable by Microsoft Visual C++
|
||||||
|
#endif //APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Add manually edited resources here...
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
BIN
Ext2Mgr/res/about.bmp
Normal file
|
After Width: | Height: | Size: 703 KiB |
BIN
Ext2Mgr/res/about.jpg
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
Ext2Mgr/res/abouts.bmp
Normal file
|
After Width: | Height: | Size: 253 KiB |
BIN
Ext2Mgr/res/bigmain.ico
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
Ext2Mgr/res/cdrom.bmp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Ext2Mgr/res/disk.bmp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Ext2Mgr/res/dvd.bmp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Ext2Mgr/res/dynamic.bmp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Ext2Mgr/res/floppy.bmp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Ext2Mgr/res/icon/16/cdrom.ico
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Ext2Mgr/res/icon/16/disk.ico
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Ext2Mgr/res/icon/16/dvd.ico
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Ext2Mgr/res/icon/16/dynamic.ico
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Ext2Mgr/res/icon/16/floppy.ico
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Ext2Mgr/res/icon/32/cdrom.ico
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
Ext2Mgr/res/icon/32/disk.ico
Normal file
|
After Width: | Height: | Size: 766 B |
BIN
Ext2Mgr/res/icon/32/dvd.ico
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
Ext2Mgr/res/icon/32/dynamic.ico
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
Ext2Mgr/res/icon/32/floppy.ico
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
Ext2Mgr/res/images/32.bmp
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
Ext2Mgr/res/images/322.bmp
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
Ext2Mgr/res/images/48.bmp
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
Ext2Mgr/res/images/482.bmp
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
Ext2Mgr/res/images/Ext2.bmp
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Ext2Mgr/res/images/penguin.bmp
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
Ext2Mgr/res/images/penguin.jpg
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
Ext2Mgr/res/images/smallpenguin.bmp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
Ext2Mgr/res/images/smallpenguin.jpg
Normal file
|
After Width: | Height: | Size: 692 B |
BIN
Ext2Mgr/res/line.bmp
Normal file
|
After Width: | Height: | Size: 656 B |
BIN
Ext2Mgr/res/penguin-1.ico
Normal file
|
After Width: | Height: | Size: 318 B |
BIN
Ext2Mgr/res/penguin-2.ico
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Ext2Mgr/res/penguin-3.ico
Normal file
|
After Width: | Height: | Size: 766 B |
BIN
Ext2Mgr/res/toolbar.bmp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
182
Ext2Mgr/resource.h
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Developer Studio generated include file.
|
||||||
|
// Used by Ext2Mgr.rc
|
||||||
|
//
|
||||||
|
#define MANIFEST_RESOURCE_ID 1
|
||||||
|
#define ID_RELOAD_DL 3
|
||||||
|
#define IDM_ABOUTBOX 0x0010
|
||||||
|
#ifndef RT_MANIFEST
|
||||||
|
#define RT_MANIFEST 24
|
||||||
|
#endif
|
||||||
|
#define IDM_CLOSE_SPLASH 0x0020
|
||||||
|
#define IDD_ABOUTBOX 100
|
||||||
|
#define IDS_ABOUTBOX 101
|
||||||
|
#define IDD_EXT2MGR_DIALOG 102
|
||||||
|
#define ID_INDICATOR_MESSAGE 103
|
||||||
|
#define ID_INDICATOR_TIME 104
|
||||||
|
#define ID_INDICATOR_EXTRA 105
|
||||||
|
#define IDR_MAINFRAME 128
|
||||||
|
#define IDR_TRAY 133
|
||||||
|
#define IDI_FLOPPY 134
|
||||||
|
#define IDI_CDROM 135
|
||||||
|
#define IDI_DISK 136
|
||||||
|
#define IDI_DVD 137
|
||||||
|
#define IDI_DYNAMIC 138
|
||||||
|
#define IDR_MENU 139
|
||||||
|
#define IDB_ABOUT_SCREEN 151
|
||||||
|
#define IDR_STANDARDBAR 162
|
||||||
|
#define IDB_ABOUT_SMALL 163
|
||||||
|
#define IDI_BIG_MAINFRAME 164
|
||||||
|
#define IDB_LINE_SEP 166
|
||||||
|
#define IDD_SERVICE_MANAGE 167
|
||||||
|
#define IDD_FORMAT 169
|
||||||
|
#define IDD_EXT2_ATTR 170
|
||||||
|
#define IDD_CHANGE_MOUNTPINT 171
|
||||||
|
#define IDD_NEW_MOUNTPOINT 172
|
||||||
|
#define IDD_PROPERTY_DIALOG 173
|
||||||
|
#define IDD_DONATE_DIALOG 174
|
||||||
|
#define IDB_SMALL_PENGUIN 184
|
||||||
|
#define IDB_BIG_PENGUIN 185
|
||||||
|
#define IDD_PERFSTAT_DIALOG 186
|
||||||
|
#define IDD_PARTITION_TYPE 187
|
||||||
|
#define IDD_REMOVE_DEADLETTER 188
|
||||||
|
#define IDR_AKEY_EXT2MGR 190
|
||||||
|
#define IDR_RCDAT_SRV 191
|
||||||
|
#define IDC_VOLUME_LIST 1001
|
||||||
|
#define IDC_AUTHOR 1002
|
||||||
|
#define IDC_ABOUT_SHOW 1003
|
||||||
|
#define IDC_PROGRAM 1004
|
||||||
|
#define IDC_EXT2FSD 1005
|
||||||
|
#define IDC_DISK_VIEW 1006
|
||||||
|
#define IDC_DISK_LIST 1007
|
||||||
|
#define IDC_READ_ONLY 1013
|
||||||
|
#define IDC_EXT3_WRITABLE 1014
|
||||||
|
#define IDC_COMBO_STARTUP 1015
|
||||||
|
#define IDC_COMBO_CODEPAGE 1016
|
||||||
|
#define IDC_COMBO_DRVLETTER 1017
|
||||||
|
#define IDC_COMBO_AUTOMP 1018
|
||||||
|
#define IDC_EXT3_AUTOMOUNT 1018
|
||||||
|
#define IDC_FORMAT_PROGRESS 1019
|
||||||
|
#define IDC_COMBO_FS 1020
|
||||||
|
#define IDC_FORMAT_TITLE 1021
|
||||||
|
#define IDC_EDIT_LABEL 1022
|
||||||
|
#define IDC_COMBO_CLUSTER 1023
|
||||||
|
#define IDC_QUICK_FORMAT 1024
|
||||||
|
#define IDC_QUICK_COMPRESS 1025
|
||||||
|
#define IDC_DRV_LETTER_LIST 1026
|
||||||
|
#define IDC_DRVLETTERS_LIST 1028
|
||||||
|
#define IDC_PROPERTY_DEVICE 1029
|
||||||
|
#define IDC_PROPERTY_SDEV 1030
|
||||||
|
#define IDC_VENDOR_ID 1031
|
||||||
|
#define IDC_PRODUCT_ID 1032
|
||||||
|
#define IDC_SERIAL_NUMBER 1033
|
||||||
|
#define IDC_BUS_TYPE 1034
|
||||||
|
#define IDC_DEVICE_TYPE 1035
|
||||||
|
#define IDC_MEDIA_TYPE 1036
|
||||||
|
#define IDC_TOTAL_SIZE 1037
|
||||||
|
#define IDC_SDEV_CHANGE_MP 1038
|
||||||
|
#define IDC_MOUNT_POINTS 1039
|
||||||
|
#define IDC_VIA_SOURCEFORGE 1040
|
||||||
|
#define IDC_SDEV_SIZE 1041
|
||||||
|
#define IDC_VIA_PAYPAL 1042
|
||||||
|
#define IDC_FILE_SYSTEM 1043
|
||||||
|
#define IDC_VIA_TAOBAO 1043
|
||||||
|
#define IDC_SDEV_STATUS 1044
|
||||||
|
#define IDC_DECLARE 1045
|
||||||
|
#define IDC_SERVICE_STATUS 1046
|
||||||
|
#define IDC_SDEV_EXT2_INFO 1047
|
||||||
|
#define IDC_GLOBAL_PREFIX 1047
|
||||||
|
#define IDC_SDEV_FREE_SIZE 1048
|
||||||
|
#define IDC_GLOBAL_SUFFIX 1048
|
||||||
|
#define IDC_START_SERVICE 1049
|
||||||
|
#define IDC_PERMANENT_MP 1050
|
||||||
|
#define IDC_DOSDEV_MP 1051
|
||||||
|
#define IDC_REGISTRY_MP 1052
|
||||||
|
#define IDC_EXT2_PREFIX 1053
|
||||||
|
#define IDC_EXT2_SUFFIX 1054
|
||||||
|
#define IDC_PERFSTAT_INTERVAL 1055
|
||||||
|
#define IDC_MEMORY_LIST 1056
|
||||||
|
#define IDC_IRP_LIST 1057
|
||||||
|
#define IDC_AUTOMOUNT 1058
|
||||||
|
#define IDC_FIXMOUNT 1059
|
||||||
|
#define IDC_PARTTION_TYPE_LIST 1059
|
||||||
|
#define IDC_PARTITION_TYPE 1060
|
||||||
|
#define IDC_PARTITION_NAME 1062
|
||||||
|
#define IDC_DEAD_LETTER_LIST 1063
|
||||||
|
#define IDC_AUTO_REMOVAL 1064
|
||||||
|
#define IDC_AUTOREMOVALTEXT 1065
|
||||||
|
#define IDC_REMOVAL_CURRENT 1066
|
||||||
|
#define IDC_DRIVER 1067
|
||||||
|
#define IDC_SDEV_QUICK_MOUNT 1068
|
||||||
|
#define IDC_EDIT_UID 1070
|
||||||
|
#define IDC_EDIT_GID 1071
|
||||||
|
#define IDC_EDIT_EUID 1072
|
||||||
|
#define ID_ABOUT 32771
|
||||||
|
#define ID_NEW 32772
|
||||||
|
#define ID_CHANGE 32773
|
||||||
|
#define ID_REFRESH 32774
|
||||||
|
#define ID_EXIT 32775
|
||||||
|
#define ID_SERVICE 32776
|
||||||
|
#define ID_FORMAT 32777
|
||||||
|
#define ID_PROPERTY 32778
|
||||||
|
#define ID_COPY 32779
|
||||||
|
#define ID_SHOW_MAIN 32780
|
||||||
|
#define ID_DRV_LETTER 32781
|
||||||
|
#define ID_DONATE 32782
|
||||||
|
#define ID_ADD_MOUNTPOINT 32783
|
||||||
|
#define ID_CHANGE_MOUNTPOINT 32784
|
||||||
|
#define ID_REMOVE_MOUNTPOINT 32785
|
||||||
|
#define ID_INSTALL_SERVICE 32786
|
||||||
|
#define ID_REMOVE_SERVICE 32787
|
||||||
|
#define ID_ENABLE_AUTOSTART 32788
|
||||||
|
#define ID_DISABLE_AUTOSTART 32789
|
||||||
|
#define ID_PERFSTAT 32790
|
||||||
|
#define ID_PERFSTOP 32791
|
||||||
|
#define ID_COPYALL 32792
|
||||||
|
#define ID_QUERYPERF 32793
|
||||||
|
#define ID_FLUSH_BUFFER 32794
|
||||||
|
#define ID_CHANGE_PARTTYPE 32795
|
||||||
|
#define ID_REMOVE_DEAD_LETTER 32796
|
||||||
|
#define ID_DRV_QUICK_MOUNT 32797
|
||||||
|
#define ID_DRV_QUICK_REMOVE 32798
|
||||||
|
#define IDS_LISTITEM_FILESYSTEM 57671
|
||||||
|
#define IDS_LISTITEM_VOLUME 57672
|
||||||
|
#define IDS_LISTITEM_TYPE 57673
|
||||||
|
#define IDS_LISTITEM_TOTALSIZE 57674
|
||||||
|
#define IDS_LISTITEM_USEDSIZE 57675
|
||||||
|
#define IDS_LISTITEM_CODEPAGE 57676
|
||||||
|
#define IDS_LISTITEM_DEVOBJ 57677
|
||||||
|
#define IDS_LISTITEM_PARTID 57678
|
||||||
|
#define IDS_DISK_TYPE_BASIC 57679
|
||||||
|
#define IDS_DISK_TYPE_DYN 57680
|
||||||
|
#define IDS_DONATE_DECLARE 57681
|
||||||
|
#define IDS_SHOW_PROPERTY 57682
|
||||||
|
#define IDS_COPY_ITEM_TO_CLIP 57683
|
||||||
|
#define IDS_CHANGE_DRVLETTER 57684
|
||||||
|
#define IDS_EXT2_MANAGEMENT 57685
|
||||||
|
#define IDS_FLUSH_BUFFER 57686
|
||||||
|
#define IDS_CHANGE_PARTID 57687
|
||||||
|
#define IDS_RELOAD_REFRESH 57688
|
||||||
|
#define IDS_PERFMEM_STAT 57689
|
||||||
|
#define IDS_SERVICE_MANAGE 57690
|
||||||
|
#define IDS_REMOVE_DEAD_LETTER 57691
|
||||||
|
#define IDS_PERFSTAT_NAME 57692
|
||||||
|
#define IDS_PERFSTAT_UNIT 57693
|
||||||
|
#define IDS_PERFSTAT_CURRENT 57694
|
||||||
|
#define IDS_PERFSTAT_SIZE 57695
|
||||||
|
#define IDS_PERFSTAT_TOTAL 57696
|
||||||
|
#define IDS_PERFSTAT_PROCESSING 57697
|
||||||
|
#define IDS_PERSTAT_PROCESSED 57698
|
||||||
|
#define IDS_PERFSTAT_PROCESSED 57698
|
||||||
|
#define IDS_DRV_QUICK_MOUNT 57699
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 192
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 32799
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1071
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 106
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
331
Ext2Mgr/toolbar.cpp
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
// ToolBar1.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
// This is a part of the Microsoft Foundation Classes C++ library.
|
||||||
|
// Copyright (C) 1992-1998 Microsoft Corporation
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This source code is only intended as a supplement to the
|
||||||
|
// Microsoft Foundation Classes Reference and related
|
||||||
|
// electronic documentation provided with the library.
|
||||||
|
// See these sources for detailed information regarding the
|
||||||
|
// Microsoft Foundation Classes product.
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "afxpriv.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "toolbar.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CStandardBar
|
||||||
|
|
||||||
|
CStandardBar::CStandardBar() : m_pTBButtons(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CStandardBar::~CStandardBar()
|
||||||
|
{
|
||||||
|
if (m_pTBButtons)
|
||||||
|
delete []m_pTBButtons;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CStandardBar, CToolBarCtrl)
|
||||||
|
//{{AFX_MSG_MAP(CStandardBar)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CStandardBar::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, int count, PBUTTON_INFO pButton)
|
||||||
|
{
|
||||||
|
BOOL bRet = CToolBarCtrl::Create(dwStyle, rect, pParentWnd, nID);
|
||||||
|
|
||||||
|
AddBitmap(count, IDR_STANDARDBAR);
|
||||||
|
|
||||||
|
m_pTBButtons = new TBBUTTON[count];
|
||||||
|
memset(m_pTBButtons, 0, sizeof(TBBUTTON) * count);
|
||||||
|
|
||||||
|
m_nButtonCount = count;
|
||||||
|
|
||||||
|
TBBUTTON sepButton;
|
||||||
|
sepButton.idCommand = 0;
|
||||||
|
sepButton.fsStyle = TBSTYLE_SEP;
|
||||||
|
sepButton.fsState = TBSTATE_ENABLED;
|
||||||
|
sepButton.iString = 0;
|
||||||
|
sepButton.iBitmap = 0;
|
||||||
|
sepButton.dwData = 0;
|
||||||
|
|
||||||
|
for (int nIndex = 0; nIndex < count; nIndex++) {
|
||||||
|
CString string;
|
||||||
|
string.LoadString(pButton[nIndex].ID);
|
||||||
|
|
||||||
|
// Add second '\0'
|
||||||
|
int nStringLength = string.GetLength() + 1;
|
||||||
|
TCHAR * pString = string.GetBufferSetLength(nStringLength);
|
||||||
|
pString[nStringLength] = 0;
|
||||||
|
|
||||||
|
m_pTBButtons[nIndex].iString = AddStrings(pString);
|
||||||
|
|
||||||
|
string.ReleaseBuffer();
|
||||||
|
|
||||||
|
|
||||||
|
m_pTBButtons[nIndex].fsState = TBSTATE_ENABLED;
|
||||||
|
m_pTBButtons[nIndex].fsStyle = TBSTYLE_BUTTON;
|
||||||
|
m_pTBButtons[nIndex].dwData = 0;
|
||||||
|
m_pTBButtons[nIndex].iBitmap = nIndex;
|
||||||
|
m_pTBButtons[nIndex].idCommand = pButton[nIndex].ID;
|
||||||
|
|
||||||
|
if (pButton[nIndex].bSep) {
|
||||||
|
AddButtons(1,&sepButton);
|
||||||
|
AddButtons(1,&sepButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddButtons(1, &m_pTBButtons[nIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CStandardBar message handlers
|
||||||
|
|
||||||
|
// MFC routes the notifications sent to the parent of the control to
|
||||||
|
// the control before the parent can process the notification.
|
||||||
|
// The control object can handle the notification or ignore it.
|
||||||
|
// If the notification is handled then return TRUE. Otherwise MFC
|
||||||
|
// will route it to the parent of the control.
|
||||||
|
|
||||||
|
BOOL CStandardBar::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
return CToolBarCtrl::OnChildNotify(message, wParam, lParam, pLResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::BeginAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_BEGINADJUST\n"));
|
||||||
|
// the customize dialog box is about to be displayed
|
||||||
|
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::BeginDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_BEGINDRAG\n"));
|
||||||
|
|
||||||
|
// we are not implementing custon drag and drop
|
||||||
|
* pLResult = FALSE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::CustomizeHelp(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_CUSTHELP\n"));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::EndAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_ENDADJUST\n"));
|
||||||
|
|
||||||
|
// the customize dialog box has been closed
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::EndDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_ENDDRAG\n"));
|
||||||
|
|
||||||
|
// Code to handle custom drag and drop. This message indicates that
|
||||||
|
// the item is being dropped
|
||||||
|
* pLResult = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::GetButtonInfo(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
// This notification message has to be handled correctly if
|
||||||
|
// all operations in the custom dialogbox has to function correctly
|
||||||
|
// We have to supply information for the button specified by pTBN->tbButton
|
||||||
|
//
|
||||||
|
// This notification is sent in the following cases
|
||||||
|
//
|
||||||
|
// After TBN_BEGINADJUST the control sends these notifications until
|
||||||
|
// * pLResult is TRUE. We have to supply valid values when this value is
|
||||||
|
// set to TRUE. Here the control is collecting information for all
|
||||||
|
// the buttons that have to be displayed in the dialog box
|
||||||
|
//
|
||||||
|
// The control sends this notification to get information about
|
||||||
|
// a button if the user is trying to add it to the toolbar or
|
||||||
|
// rearranging the buttons on the toolbar from within the dialog
|
||||||
|
|
||||||
|
TRACE(_T("TBN_GETBUTTONINFO\n"));
|
||||||
|
|
||||||
|
TBNOTIFY *pTBN = (TBNOTIFY *) lParam;
|
||||||
|
|
||||||
|
if (pTBN->iItem >= m_nButtonCount)
|
||||||
|
{
|
||||||
|
* pLResult = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CString buffer;
|
||||||
|
buffer.LoadString(pTBN->iItem + ID_NEW);
|
||||||
|
|
||||||
|
// set the string for the button
|
||||||
|
// truncate the string if its length is greater than the buffer
|
||||||
|
// supplied by the toolbar
|
||||||
|
_tcsncpy(pTBN->pszText, buffer, pTBN->cchText - 1);
|
||||||
|
pTBN->pszText[pTBN->cchText - 1] = '\0';
|
||||||
|
|
||||||
|
// set the button info
|
||||||
|
pTBN->tbButton = m_pTBButtons[pTBN->iItem];
|
||||||
|
|
||||||
|
// valid values are structure
|
||||||
|
*pLResult = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::QueryDelete(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_QUERYDELETE\n"));
|
||||||
|
|
||||||
|
// in this sample any button can be deleted
|
||||||
|
// if a particular button cannot be deleted set *pResult to FALSE for that item
|
||||||
|
*pLResult = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::QueryInsert(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_QUERYINSERT\n"));
|
||||||
|
|
||||||
|
// in this sample buttons can be inserted at any location on the
|
||||||
|
// toolbar
|
||||||
|
*pLResult = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::Reset(WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_RESET\n"));
|
||||||
|
|
||||||
|
*pLResult = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CStandardBar::ToolBarChange(WPARAM wParam, LPARAM lParam,LRESULT* pLResult)
|
||||||
|
{
|
||||||
|
TRACE(_T("TBN_TOOLBARCHANGE\n"));
|
||||||
|
|
||||||
|
// the toolbar has changed
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Helper function for tooltips
|
||||||
|
|
||||||
|
CString CStandardBar::NeedText( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
|
||||||
|
{
|
||||||
|
LPTOOLTIPTEXT lpTTT = (LPTOOLTIPTEXT)pNotifyStruct ;
|
||||||
|
ASSERT(nID == lpTTT->hdr.idFrom);
|
||||||
|
|
||||||
|
CString toolTipText;
|
||||||
|
toolTipText.LoadString(nID);
|
||||||
|
|
||||||
|
// szText length is 80
|
||||||
|
int nLength = (toolTipText.GetLength() > 79) ? 79 : toolTipText.GetLength();
|
||||||
|
|
||||||
|
toolTipText = toolTipText.Left(nLength);
|
||||||
|
|
||||||
|
return toolTipText;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CStandardBar::OnNeedTextW( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
|
||||||
|
{
|
||||||
|
CString toolTipText = NeedText(nID, pNotifyStruct, lResult);
|
||||||
|
|
||||||
|
LPTOOLTIPTEXTW lpTTT = (LPTOOLTIPTEXTW)pNotifyStruct;
|
||||||
|
|
||||||
|
#ifndef _UNICODE
|
||||||
|
mbstowcs(lpTTT->szText,(LPCSTR)toolTipText, toolTipText.GetLength() + 1);
|
||||||
|
#else
|
||||||
|
_tcsncpy(lpTTT->szText, toolTipText, toolTipText.GetLength() + 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStandardBar::OnNeedTextA( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
|
||||||
|
{
|
||||||
|
CString toolTipText = NeedText(nID, pNotifyStruct, lResult);
|
||||||
|
|
||||||
|
LPTOOLTIPTEXT lpTTT = (LPTOOLTIPTEXT)pNotifyStruct;
|
||||||
|
|
||||||
|
_tcscpy(lpTTT->szText,(LPCTSTR)toolTipText);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
// This has been overridden so we can handle the tooltip TTN_NEEDTEXT//
|
||||||
|
// notification message //
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL CStandardBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
ASSERT(pResult != NULL);
|
||||||
|
NMHDR* pNMHDR = (NMHDR*)lParam;
|
||||||
|
HWND hWndCtrl = pNMHDR->hwndFrom;
|
||||||
|
|
||||||
|
// get the child ID from the window itself
|
||||||
|
// UINT nID = _AfxGetDlgCtrlID(hWndCtrl);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
// If TTN_NEEDTEXT we cannot get the ID from the tooltip window //
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int nCode = pNMHDR->code;
|
||||||
|
|
||||||
|
//
|
||||||
|
// if it is the following notification message
|
||||||
|
// nID has to obtained from wParam
|
||||||
|
//
|
||||||
|
|
||||||
|
if (nCode == TTN_NEEDTEXTA || nCode == TTN_NEEDTEXTW)
|
||||||
|
{
|
||||||
|
UINT nID; // = _AfxGetDlgCtrlID(hWndCtrl);
|
||||||
|
nID = (UINT)wParam;
|
||||||
|
|
||||||
|
|
||||||
|
ASSERT((UINT)pNMHDR->idFrom == (UINT)wParam);
|
||||||
|
UNUSED(wParam); // not used in release build
|
||||||
|
ASSERT(hWndCtrl != NULL);
|
||||||
|
ASSERT(::IsWindow(hWndCtrl));
|
||||||
|
|
||||||
|
if (AfxGetThreadState()->m_hLockoutNotifyWindow == m_hWnd)
|
||||||
|
return TRUE; // locked out - ignore control notification
|
||||||
|
|
||||||
|
// reflect notification to child window control
|
||||||
|
if (ReflectLastMsg(hWndCtrl, pResult))
|
||||||
|
return TRUE; // eaten by child
|
||||||
|
|
||||||
|
AFX_NOTIFY notify;
|
||||||
|
notify.pResult = pResult;
|
||||||
|
notify.pNMHDR = pNMHDR;
|
||||||
|
return OnCmdMsg(nID, MAKELONG(nCode, WM_NOTIFY), ¬ify, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CToolBarCtrl::OnNotify(wParam, lParam, pResult);
|
||||||
|
}
|
||||||
86
Ext2Mgr/toolbar.h
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// Toolbar1.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
// This is a part of the Microsoft Foundation Classes C++ library.
|
||||||
|
// Copyright (C) 1992-1998 Microsoft Corporation
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This source code is only intended as a supplement to the
|
||||||
|
// Microsoft Foundation Classes Reference and related
|
||||||
|
// electronic documentation provided with the library.
|
||||||
|
// See these sources for detailed information regarding the
|
||||||
|
// Microsoft Foundation Classes product.
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CStandardBar window
|
||||||
|
#ifndef INC_TOOLBAR1_H
|
||||||
|
#define INC_TOOLBAR1_H
|
||||||
|
|
||||||
|
typedef struct _BUTTON_INFO {
|
||||||
|
UINT ID;
|
||||||
|
BOOL bSep;
|
||||||
|
} BUTTON_INFO, *PBUTTON_INFO;
|
||||||
|
|
||||||
|
class CStandardBar : public CToolBarCtrl
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
int m_nButtonCount;
|
||||||
|
TBBUTTON *m_pTBButtons;
|
||||||
|
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CStandardBar();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CStandardBar)
|
||||||
|
public:
|
||||||
|
virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
virtual BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, int count, PBUTTON_INFO);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CStandardBar();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BOOL BeginAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL BeginDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL CustomizeHelp(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL EndAdjust(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL EndDrag(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL GetButtonInfo(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL QueryDelete(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL QueryInsert(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL Reset(WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||||
|
BOOL ToolBarChange(WPARAM wParam, LPARAM lParam,LRESULT* pLResult);
|
||||||
|
|
||||||
|
CString NeedText(UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Following function has to be removed when OnNotify is fixed
|
||||||
|
//
|
||||||
|
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CStandardBar)
|
||||||
|
afx_msg void OnNeedTextW( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult );
|
||||||
|
afx_msg void OnNeedTextA( UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult );
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif
|
||||||
24
Ext2Mgr/types.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef _LINUX_TYPES_H
|
||||||
|
#define _LINUX_TYPES_H
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#error _MSC_VER not defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef unsigned __int8 __u8;
|
||||||
|
typedef signed __int8 __s8;
|
||||||
|
|
||||||
|
typedef signed __int64 __s64;
|
||||||
|
typedef unsigned __int64 __u64;
|
||||||
|
|
||||||
|
typedef signed __int16 __s16;
|
||||||
|
typedef unsigned __int16 __u16;
|
||||||
|
|
||||||
|
typedef signed __int32 __s32;
|
||||||
|
typedef unsigned __int32 __u32;
|
||||||
|
|
||||||
|
typedef signed __int64 __s64;
|
||||||
|
typedef unsigned __int64 __u64;
|
||||||
|
|
||||||
|
#endif /* LINUX_TYPES_H */
|
||||||
524
Ext2Srv/Ext2Pipe.cpp
Normal file
@@ -0,0 +1,524 @@
|
|||||||
|
#include <Ext2Srv.h>
|
||||||
|
#include <Sddl.h>
|
||||||
|
#include <Ext2Pipe.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* global defintions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CL_ASSERT(cond) do {switch('x') {case (cond): case 0: break;}} while (0)
|
||||||
|
|
||||||
|
#define DEBUG(...) do {} while(0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* glboal variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOLEAN g_stop = FALSE;
|
||||||
|
HANDLE g_wait;
|
||||||
|
|
||||||
|
/* pipe handles */
|
||||||
|
|
||||||
|
PEXT2_PIPE g_hep = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* function prototypes
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOLEAN Ext2QueryDrive (PPIPE_REQ *pr, ULONG len);
|
||||||
|
BOOLEAN Ext2DefineDrive(PPIPE_REQ *pr, ULONG len);
|
||||||
|
BOOLEAN Ext2RemoveDrive(PPIPE_REQ *pr, ULONG len);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* function body
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL Ext2ReadPipe(HANDLE p, PVOID b, DWORD c, PDWORD r)
|
||||||
|
{
|
||||||
|
DWORD bytes = 0, total = 0;
|
||||||
|
BOOL rc = FALSE;
|
||||||
|
|
||||||
|
while (total < c) {
|
||||||
|
rc = ReadFile(p,(PCHAR)b + total, c - total, &bytes, NULL);
|
||||||
|
if (rc) {
|
||||||
|
total += bytes;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r)
|
||||||
|
*r = total;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL Ext2WritePipe(HANDLE p, PVOID b, DWORD c, PDWORD w)
|
||||||
|
{
|
||||||
|
DWORD bytes = 0, total = 0;
|
||||||
|
BOOL rc = FALSE;
|
||||||
|
|
||||||
|
while (total < c) {
|
||||||
|
rc = WriteFile(p, (PCHAR)b + total, c - total, &bytes, NULL);
|
||||||
|
if (rc) {
|
||||||
|
total += bytes;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w)
|
||||||
|
*w = total;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PSECURITY_ATTRIBUTES Ext2CreateSA()
|
||||||
|
{
|
||||||
|
PSECURITY_ATTRIBUTES sa = NULL;
|
||||||
|
BOOL rc = FALSE;
|
||||||
|
|
||||||
|
PSECURITY_DESCRIPTOR SD = NULL;
|
||||||
|
LPCTSTR SACL = // ("S:(ML;;NW;;;LW)")
|
||||||
|
_T("D:") // Discretionary ACL
|
||||||
|
_T("A;OICI;GA;;;BG") // Allow access to
|
||||||
|
// built-in guests
|
||||||
|
_T("A;OICI;GA;;;AN") // Allow access to
|
||||||
|
// anonymous logon
|
||||||
|
_T("A;OICI;GA;;;AU") // Allow
|
||||||
|
// read/write/execute
|
||||||
|
// to authenticated
|
||||||
|
// users
|
||||||
|
_T("A;OICI;GA;;;BA"); // Allow full control
|
||||||
|
// to administrators
|
||||||
|
|
||||||
|
// _T("S:(ML;;NW;;;LW)D:(A;OICI;GA;;;S-1-1-0)");
|
||||||
|
// _T("S:(ML;;NW;;;LW)D:(A;;0x12019f;;;WD)");
|
||||||
|
|
||||||
|
/* convert */
|
||||||
|
rc = ConvertStringSecurityDescriptorToSecurityDescriptor(
|
||||||
|
SACL, SDDL_REVISION_1, &SD, NULL);
|
||||||
|
if (!rc) {
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize a security attributes structure.
|
||||||
|
sa = (PSECURITY_ATTRIBUTES) LocalAlloc(LPTR, sizeof(SECURITY_ATTRIBUTES));
|
||||||
|
if (NULL == sa) {
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
sa->nLength = sizeof (SECURITY_ATTRIBUTES);
|
||||||
|
sa->lpSecurityDescriptor = SD;
|
||||||
|
sa->bInheritHandle = TRUE;
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
if (!sa) {
|
||||||
|
if (SD)
|
||||||
|
LocalFree(SD);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sa;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Ext2FreeSA(PSECURITY_ATTRIBUTES sa)
|
||||||
|
{
|
||||||
|
PACL ACL = NULL;
|
||||||
|
|
||||||
|
if (NULL == sa)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (sa->lpSecurityDescriptor) {
|
||||||
|
LocalFree(sa->lpSecurityDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalFree(sa);
|
||||||
|
}
|
||||||
|
|
||||||
|
PEXT2_PIPE
|
||||||
|
Ext2CreatePipe()
|
||||||
|
{
|
||||||
|
PEXT2_PIPE ap = NULL;
|
||||||
|
LPSECURITY_ATTRIBUTES sa = NULL;
|
||||||
|
|
||||||
|
ap = new EXT2_PIPE;
|
||||||
|
if (!ap) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
memset(ap, 0, sizeof(EXT2_PIPE));
|
||||||
|
|
||||||
|
sa = Ext2CreateSA();
|
||||||
|
|
||||||
|
ap->p = CreateNamedPipe( _T(EXT2_MGR_SRV), PIPE_ACCESS_DUPLEX |
|
||||||
|
FILE_FLAG_WRITE_THROUGH /* | ACCESS_SYSTEM_SECURITY */,
|
||||||
|
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE |
|
||||||
|
PIPE_WAIT /* PIPE_REJECT_REMOTE_CLIENTS */ ,
|
||||||
|
PIPE_UNLIMITED_INSTANCES,
|
||||||
|
REQ_BODY_SIZE, REQ_BODY_SIZE,
|
||||||
|
6000, sa);
|
||||||
|
if (INVALID_HANDLE_VALUE == ap->p) {
|
||||||
|
DWORD le = GetLastError();
|
||||||
|
if (le == ERROR_PIPE_BUSY) {
|
||||||
|
WaitNamedPipe(_T(EXT2_MGR_SRV), 1000);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
delete ap;
|
||||||
|
ap = NULL;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create new sync event */
|
||||||
|
ap->q = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
|
ap->e = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
|
if (INVALID_HANDLE_VALUE == ap->e ||
|
||||||
|
INVALID_HANDLE_VALUE == ap->q) {
|
||||||
|
if (ap->e && INVALID_HANDLE_VALUE != ap->e)
|
||||||
|
CloseHandle(ap->e);
|
||||||
|
if (ap->q && INVALID_HANDLE_VALUE != ap->q)
|
||||||
|
CloseHandle(ap->q);
|
||||||
|
CloseHandle(ap->p);
|
||||||
|
delete ap;
|
||||||
|
ap = NULL;
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
if (sa)
|
||||||
|
Ext2FreeSA(sa);
|
||||||
|
|
||||||
|
return ap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID Ext2DestroyPipe(PEXT2_PIPE ap)
|
||||||
|
{
|
||||||
|
if (ap->p && ap->p != INVALID_HANDLE_VALUE)
|
||||||
|
CloseHandle(ap->p);
|
||||||
|
|
||||||
|
if (ap->e && ap->e != INVALID_HANDLE_VALUE)
|
||||||
|
CloseHandle(ap->e);
|
||||||
|
|
||||||
|
if (ap->q && INVALID_HANDLE_VALUE != ap->q)
|
||||||
|
CloseHandle(ap->q);
|
||||||
|
|
||||||
|
delete ap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN Ext2QueryDrive(PPIPE_REQ *pr, ULONG len)
|
||||||
|
{
|
||||||
|
PPIPE_REQ p;
|
||||||
|
PREQ_QUERY_DRV q;
|
||||||
|
|
||||||
|
CHAR devPath[] = "A:";
|
||||||
|
DWORD rc = FALSE;
|
||||||
|
|
||||||
|
if (!pr || !*pr)
|
||||||
|
goto errorout;
|
||||||
|
|
||||||
|
p = *pr;
|
||||||
|
q = (PREQ_QUERY_DRV)&p->data[0];
|
||||||
|
|
||||||
|
devPath[0] = q->drive;
|
||||||
|
q->type = GetDriveTypeA(devPath);
|
||||||
|
|
||||||
|
if (q->type != DRIVE_NO_ROOT_DIR) {
|
||||||
|
CHAR *s = &q->name[0];
|
||||||
|
ULONG l = len - sizeof(PIPE_REQ) - sizeof(REQ_QUERY_DRV);
|
||||||
|
rc = QueryDosDeviceA(devPath, s, l);
|
||||||
|
if (rc) {
|
||||||
|
q->result = 1;
|
||||||
|
p->len = sizeof(PIPE_REQ) + sizeof(REQ_QUERY_DRV) + strlen(s) + 1;
|
||||||
|
} else {
|
||||||
|
q->result = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
q->result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN Ext2DefineDrive(PPIPE_REQ *pr, ULONG len)
|
||||||
|
{
|
||||||
|
PPIPE_REQ p;
|
||||||
|
PREQ_DEFINE_DRV q;
|
||||||
|
BOOLEAN rc = 0;
|
||||||
|
|
||||||
|
CHAR dosPath[] = "A:\0";
|
||||||
|
|
||||||
|
if (!pr || !*pr)
|
||||||
|
goto errorout;
|
||||||
|
|
||||||
|
p = *pr;
|
||||||
|
q = (PREQ_DEFINE_DRV)&p->data[0];
|
||||||
|
|
||||||
|
dosPath[0] = q->drive;
|
||||||
|
q->result = (UCHAR)DefineDosDeviceA(q->flags, dosPath, &q->name[0]);
|
||||||
|
rc = (BOOLEAN) q->result;
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Ext2NotifyDefineDrive(PPIPE_REQ pr)
|
||||||
|
{
|
||||||
|
TCHAR task[60];
|
||||||
|
PREQ_DEFINE_DRV q;
|
||||||
|
|
||||||
|
if (!pr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
q = (PREQ_DEFINE_DRV)&pr->data[0];
|
||||||
|
|
||||||
|
if (q->result) {
|
||||||
|
_stprintf_s(task, 59, _T("/add %C"), q->drive);
|
||||||
|
Ext2NotifyUser(task, q->pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN Ext2RemoveDrive(PPIPE_REQ *pr, ULONG len)
|
||||||
|
{
|
||||||
|
PPIPE_REQ p;
|
||||||
|
PREQ_REMOVE_DRV q;
|
||||||
|
BOOLEAN rc = 0;
|
||||||
|
|
||||||
|
CHAR dosPath[] = "A:\0";
|
||||||
|
|
||||||
|
if (!pr || !*pr)
|
||||||
|
goto errorout;
|
||||||
|
|
||||||
|
p = *pr;
|
||||||
|
q = (PREQ_REMOVE_DRV)&p->data[0];
|
||||||
|
|
||||||
|
dosPath[0] = q->drive;
|
||||||
|
q->result = (UCHAR)DefineDosDeviceA(q->flags, dosPath, &q->name[0]);
|
||||||
|
rc = (BOOLEAN)q->result;
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Ext2NotifyRemoveDrive(PPIPE_REQ pr)
|
||||||
|
{
|
||||||
|
TCHAR task[60];
|
||||||
|
PREQ_REMOVE_DRV q;
|
||||||
|
|
||||||
|
if (!pr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
q = (PREQ_REMOVE_DRV)&pr->data[0];
|
||||||
|
|
||||||
|
if (q->result) {
|
||||||
|
_stprintf_s(task, 59, _T("/del %C"), q->drive);
|
||||||
|
Ext2NotifyUser(task, q->pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID __cdecl
|
||||||
|
Ext2ClientEngine(VOID *arg)
|
||||||
|
{
|
||||||
|
PEXT2_PIPE ap = (PEXT2_PIPE)arg;
|
||||||
|
PPIPE_REQ pr = NULL;
|
||||||
|
PIPE_REQ ac;
|
||||||
|
ULONG len = 0;
|
||||||
|
BOOL rc;
|
||||||
|
|
||||||
|
len = REQ_BODY_SIZE;
|
||||||
|
pr = (PIPE_REQ *) new CHAR[len];
|
||||||
|
if (!pr) {
|
||||||
|
goto errorout;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!g_stop) {
|
||||||
|
|
||||||
|
//wait for a command
|
||||||
|
DWORD bytes=0;
|
||||||
|
|
||||||
|
memset(&ac, 0, sizeof(ac));
|
||||||
|
if (!Ext2ReadPipe(ap->p, &ac, sizeof(ac), &bytes)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ac.magic != PIPE_REQ_MAGIC || ac.len <= sizeof(ac)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ac.len > len) {
|
||||||
|
if (pr)
|
||||||
|
delete [] pr;
|
||||||
|
pr = (PPIPE_REQ) new CHAR[ac.len + 4];
|
||||||
|
if (!pr) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
len = ac.len + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(pr, 0, len);
|
||||||
|
memcpy(pr, &ac, sizeof(ac));
|
||||||
|
if (!Ext2ReadPipe(ap->p, &pr->data[0],
|
||||||
|
ac.len - sizeof(ac), &bytes)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pr->cmd == CMD_QUERY_DRV) {
|
||||||
|
DEBUG("got CMD_QUERY_DRV.\n");
|
||||||
|
rc = Ext2QueryDrive(&pr, len);
|
||||||
|
} else if (pr->cmd == CMD_DEFINE_DRV) {
|
||||||
|
DEBUG("got CMD_DEFINE_DRV.\n");
|
||||||
|
rc = Ext2DefineDrive(&pr, len);
|
||||||
|
} else if (pr->cmd == CMD_REMOVE_DRV) {
|
||||||
|
DEBUG("got CMD_REMOVE_DRV.\n");
|
||||||
|
rc = Ext2RemoveDrive(&pr, len);
|
||||||
|
} else {
|
||||||
|
rc = FALSE;
|
||||||
|
DEBUG("got unknown CMD.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Ext2WritePipe(ap->p, pr, pr->len, &bytes)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc) {
|
||||||
|
if (pr->cmd == CMD_REMOVE_DRV) {
|
||||||
|
Ext2NotifyRemoveDrive(pr);
|
||||||
|
} else if (pr->cmd == CMD_DEFINE_DRV) {
|
||||||
|
Ext2NotifyDefineDrive(pr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG("client disconnected.\n");
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
if (ap && ap->q)
|
||||||
|
SetEvent(ap->q);
|
||||||
|
|
||||||
|
_endthread();
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID __cdecl
|
||||||
|
Ext2PipeEngine(VOID *arg)
|
||||||
|
{
|
||||||
|
PEXT2_PIPE ap = NULL, *cu;
|
||||||
|
DWORD le;
|
||||||
|
BOOL rc;
|
||||||
|
|
||||||
|
DEBUG("server mode is to start...\n");
|
||||||
|
|
||||||
|
SetEvent(g_wait);
|
||||||
|
|
||||||
|
while (!g_stop) {
|
||||||
|
|
||||||
|
int times = 0;
|
||||||
|
|
||||||
|
retry:
|
||||||
|
|
||||||
|
/* create named pipe */
|
||||||
|
ap = Ext2CreatePipe();
|
||||||
|
if (NULL == ap) {
|
||||||
|
if (times++ < 10) {
|
||||||
|
Sleep(250 * times);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ASSD_PIPE is valid or not */
|
||||||
|
if (!ap->p || ap->p == INVALID_HANDLE_VALUE ||
|
||||||
|
!ap->e || ap->e == INVALID_HANDLE_VALUE) {
|
||||||
|
Ext2DestroyPipe(ap);
|
||||||
|
if (times++ < 10) {
|
||||||
|
Sleep(500);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wait connection request from client */
|
||||||
|
memset(&ap->o, 0, sizeof(OVERLAPPED));
|
||||||
|
ap->o.hEvent = ap->e;
|
||||||
|
rc = ConnectNamedPipe(ap->p, &ap->o);
|
||||||
|
le = GetLastError();
|
||||||
|
if (rc != 0 || le == ERROR_PIPE_CONNECTED) {
|
||||||
|
DEBUG("got client connected.\n");
|
||||||
|
ap->l = g_hep;
|
||||||
|
g_hep = ap;
|
||||||
|
_beginthread(Ext2ClientEngine, 0, (PVOID)ap);
|
||||||
|
} else {
|
||||||
|
Ext2DestroyPipe(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_stop)
|
||||||
|
goto errorout;
|
||||||
|
|
||||||
|
/* do cleanup of closed pipes */
|
||||||
|
cu = &g_hep;
|
||||||
|
while (ap = *cu) {
|
||||||
|
if (ap->s) {
|
||||||
|
*cu = ap->l;
|
||||||
|
Ext2DestroyPipe(ap);
|
||||||
|
} else {
|
||||||
|
cu = &ap->l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG("Waiting for next client.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
|
||||||
|
SetEvent(g_wait);
|
||||||
|
_endthread();
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD Ext2StartPipeSrv()
|
||||||
|
{
|
||||||
|
DWORD rc;
|
||||||
|
|
||||||
|
do {
|
||||||
|
g_wait = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
|
} while (!g_wait || g_wait == INVALID_HANDLE_VALUE);
|
||||||
|
|
||||||
|
|
||||||
|
do {
|
||||||
|
_beginthread(Ext2PipeEngine, 0, NULL);
|
||||||
|
rc = WaitForSingleObject(g_wait, 1000*1);
|
||||||
|
} while (rc == WAIT_TIMEOUT);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Ext2StopPipeSrv()
|
||||||
|
{
|
||||||
|
PEXT2_PIPE *cu = &g_hep, ap;
|
||||||
|
DWORD rc = 0;
|
||||||
|
|
||||||
|
g_stop = TRUE;
|
||||||
|
|
||||||
|
/* do cleanup of all remained pipes */
|
||||||
|
cu = &g_hep;
|
||||||
|
while (ap = *cu) {
|
||||||
|
SetEvent(ap->e);
|
||||||
|
rc = WaitForSingleObject(ap->q, INFINITE);
|
||||||
|
if (rc != WAIT_TIMEOUT) {
|
||||||
|
*cu = ap->l;
|
||||||
|
Ext2DestroyPipe(ap);
|
||||||
|
} else {
|
||||||
|
cu = &ap->l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WaitForSingleObject(g_wait, 1000);
|
||||||
|
}
|
||||||
49
Ext2Srv/Ext2Pipe.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#ifndef EXT2_SRV_PIPE_H
|
||||||
|
#define EXT2_SRV_PIPE_H
|
||||||
|
|
||||||
|
|
||||||
|
#define EXT2_MGR_SRV "\\\\.\\pipe\\EXT2MGR_PSRV"
|
||||||
|
|
||||||
|
#define PIPE_REQ_MAGIC 0xBAD0BAD8
|
||||||
|
#define REQ_BODY_SIZE (4096)
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
#pragma warning(disable: 4200)
|
||||||
|
|
||||||
|
typedef struct _PIPE_REQ {
|
||||||
|
|
||||||
|
ULONG magic;
|
||||||
|
ULONG flag;
|
||||||
|
ULONG cmd;
|
||||||
|
ULONG len;
|
||||||
|
CHAR data[0];
|
||||||
|
} PIPE_REQ, *PPIPE_REQ;
|
||||||
|
|
||||||
|
#define CMD_QUERY_DRV 0xBAD00001
|
||||||
|
#define CMD_DEFINE_DRV 0xBAD00002
|
||||||
|
#define CMD_REMOVE_DRV 0xBAD00003
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _REQ_QUERY_DRV {
|
||||||
|
ULONG type;
|
||||||
|
UCHAR drive;
|
||||||
|
UCHAR result;
|
||||||
|
USHORT symlink;
|
||||||
|
char name[0];
|
||||||
|
} REQ_QUERY_DRV, *PREQ_QUERY_DRV;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _REQ_DEFINE_DRV {
|
||||||
|
ULONG pid;
|
||||||
|
ULONG flags;
|
||||||
|
UCHAR drive;
|
||||||
|
UCHAR result;
|
||||||
|
USHORT symlink;
|
||||||
|
char name[0];
|
||||||
|
} REQ_DEFINE_DRV, *PREQ_DEFINE_DRV,
|
||||||
|
REQ_REMOVE_DRV, *PREQ_REMOVE_DRV;
|
||||||
|
|
||||||
|
#pragma warning(default: 4200)
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
#endif // EXT2_SRV_PIPE_H
|
||||||
579
Ext2Srv/Ext2Srv.cpp
Normal file
@@ -0,0 +1,579 @@
|
|||||||
|
#include <Ext2Srv.h>
|
||||||
|
|
||||||
|
SERVICE_STATUS ServiceStatus;
|
||||||
|
SERVICE_STATUS_HANDLE ServiceHandle;
|
||||||
|
HDEVNOTIFY ServiceNotify;
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Ext2ReportStatus(
|
||||||
|
DWORD State,
|
||||||
|
DWORD Exitcode,
|
||||||
|
DWORD Timeout
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// If we're in the start state then we don't want the control manager
|
||||||
|
// sending us control messages because they'll confuse us.
|
||||||
|
ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||||
|
if (State == SERVICE_RUNNING) {
|
||||||
|
ServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_SHUTDOWN |
|
||||||
|
SERVICE_ACCEPT_POWEREVENT |
|
||||||
|
SERVICE_ACCEPT_SESSIONCHANGE ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the new status we've been given
|
||||||
|
ServiceStatus.dwCurrentState = State;
|
||||||
|
ServiceStatus.dwWin32ExitCode = Exitcode;
|
||||||
|
ServiceStatus.dwWaitHint = Timeout;
|
||||||
|
|
||||||
|
// Update the checkpoint variable to let the SCM know that we
|
||||||
|
// haven't died if requests take a long time
|
||||||
|
if ((State == SERVICE_RUNNING) || (State == SERVICE_STOPPED)) {
|
||||||
|
ServiceStatus.dwCheckPoint = 0;
|
||||||
|
} else {
|
||||||
|
ServiceStatus.dwCheckPoint++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tell the SCM our new status
|
||||||
|
return SetServiceStatus(ServiceHandle, &ServiceStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ext2StopService()
|
||||||
|
{
|
||||||
|
Ext2ReportStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
|
||||||
|
|
||||||
|
if (ServiceNotify) {
|
||||||
|
UnregisterDeviceNotification(ServiceNotify);
|
||||||
|
ServiceNotify = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* issue stop event to main thread */
|
||||||
|
Ext2StopPipeSrv();
|
||||||
|
|
||||||
|
Ext2ReportStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Ext2DrivesChangeNotify(BOOLEAN bArrival)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Ext2CleanupSession(DWORD sid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD WINAPI
|
||||||
|
Ext2CtrlService(
|
||||||
|
DWORD ctrlcode, DWORD dwEventType,
|
||||||
|
LPVOID lpEventData, LPVOID lpContext
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch(ctrlcode)
|
||||||
|
{
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_STOP:
|
||||||
|
case SERVICE_CONTROL_SHUTDOWN:
|
||||||
|
// STOP : The service must stop
|
||||||
|
Ext2StopService();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_INTERROGATE:
|
||||||
|
// QUERY : Service control manager just wants to know our state
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_DEVICEEVENT:
|
||||||
|
{
|
||||||
|
PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpEventData;
|
||||||
|
PDEV_BROADCAST_DEVICEINTERFACE lpdbi = (PDEV_BROADCAST_DEVICEINTERFACE) lpEventData;
|
||||||
|
|
||||||
|
if (lpdbv->dbcv_devicetype != DBT_DEVTYP_VOLUME &&
|
||||||
|
lpdbi->dbcc_devicetype != DBT_DEVTYP_DEVICEINTERFACE
|
||||||
|
) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dwEventType == DBT_DEVICEREMOVECOMPLETE) {
|
||||||
|
Ext2DrivesChangeNotify(FALSE);
|
||||||
|
} else if (dwEventType == DBT_DEVICEARRIVAL) {
|
||||||
|
Ext2DrivesChangeNotify(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_POWEREVENT:
|
||||||
|
|
||||||
|
switch (dwEventType) {
|
||||||
|
|
||||||
|
case PBT_APMQUERYSUSPEND:
|
||||||
|
MsgLog("Power event: PBT_APMQUERYSUSPEND.\n");
|
||||||
|
//Ext2StartFlushThread();
|
||||||
|
// Ext2FlushVolume(ASSDDISK_VOLUME);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMQUERYSUSPENDFAILED:
|
||||||
|
MsgLog("Power event: APMQUERYSUSPENDFAILED.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMSUSPEND:
|
||||||
|
MsgLog("Power event: PBT_APMSUSPEND.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMRESUMESUSPEND:
|
||||||
|
MsgLog("Power event: PBT_APMRESUMESUSPEND.\n");
|
||||||
|
Ext2DrivesChangeNotify(TRUE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMQUERYSTANDBY:
|
||||||
|
MsgLog("Power event: PBT_APMQUERYSTANDBY.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMQUERYSTANDBYFAILED:
|
||||||
|
MsgLog("Power event: APMQUERYSTANDBYFAILED.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMSTANDBY:
|
||||||
|
MsgLog("Power event: PBT_APMSTANDBY.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMRESUMESTANDBY:
|
||||||
|
MsgLog("Power event: PBT_APMRESUMESTANDBY.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMRESUMECRITICAL:
|
||||||
|
MsgLog("Power event: PBT_APMRESUMECRITICAL.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMPOWERSTATUSCHANGE:
|
||||||
|
MsgLog("Power event: PBT_APMPOWERSTATUSCHANGE\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PBT_APMRESUMEAUTOMATIC:
|
||||||
|
MsgLog("Power event: PBT_APMRESUMEAUTOMATIC\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
MsgLog("Power event: unknown value %u\n", dwEventType);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_SESSIONCHANGE:
|
||||||
|
|
||||||
|
switch (dwEventType) {
|
||||||
|
|
||||||
|
case WTS_CONSOLE_CONNECT:
|
||||||
|
MsgLog("Session event: Console connected.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WTS_CONSOLE_DISCONNECT:
|
||||||
|
MsgLog("Session event: Console disconnect.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WTS_REMOTE_CONNECT:
|
||||||
|
MsgLog("Session event: Remote connected.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WTS_REMOTE_DISCONNECT:
|
||||||
|
MsgLog("Session event: Remote disconnect.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WTS_SESSION_LOCK:
|
||||||
|
MsgLog("Session event: Session locked.\n");
|
||||||
|
break;
|
||||||
|
case WTS_SESSION_UNLOCK:
|
||||||
|
MsgLog("Session event: Session unlocked.\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WTS_SESSION_LOGON:
|
||||||
|
{
|
||||||
|
PWTSSESSION_NOTIFICATION pwn = (PWTSSESSION_NOTIFICATION)lpEventData;
|
||||||
|
MsgLog("Session event: Session logon.\n");
|
||||||
|
Ext2StartUserTask(NULL, _T("/startmgr"), pwn->dwSessionId, FALSE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WTS_SESSION_LOGOFF:
|
||||||
|
{
|
||||||
|
PWTSSESSION_NOTIFICATION pwn = (PWTSSESSION_NOTIFICATION)lpEventData;
|
||||||
|
MsgLog("Session event: Session logoff.\n");
|
||||||
|
if (pwn && pwn->cbSize >= sizeof(WTSSESSION_NOTIFICATION)) {
|
||||||
|
Ext2CleanupSession(pwn->dwSessionId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
MsgLog("Session event: unknown value: %u.\n", dwEventType);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_ACCEPT_HARDWAREPROFILECHANGE:
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Control code not recognised
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tell the control manager what we're up to.
|
||||||
|
Ext2ReportStatus(ServiceStatus.dwCurrentState, NO_ERROR, 0);
|
||||||
|
|
||||||
|
return NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2StartMain(VOID * arg)
|
||||||
|
{
|
||||||
|
Ext2StartPipeSrv();
|
||||||
|
Ext2ReportStatus(SERVICE_RUNNING, NO_ERROR, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define EXT2_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||||
|
const GUID name \
|
||||||
|
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
||||||
|
EXT2_GUID(GUID_DEVINTERFACE_DISK, 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, \
|
||||||
|
0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2RegisterDeviceInterface(SERVICE_STATUS_HANDLE handle,
|
||||||
|
GUID guid, HDEVNOTIFY *notify)
|
||||||
|
{
|
||||||
|
DEV_BROADCAST_DEVICEINTERFACE bd;
|
||||||
|
|
||||||
|
ZeroMemory (&bd, sizeof(bd));
|
||||||
|
bd.dbcc_size = sizeof(bd);
|
||||||
|
bd.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
|
||||||
|
bd.dbcc_classguid = guid;
|
||||||
|
*notify = RegisterDeviceNotification(handle, &bd,
|
||||||
|
DEVICE_NOTIFY_SERVICE_HANDLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WINAPI
|
||||||
|
Ext2ServiceEntry(DWORD argc, char**argv)
|
||||||
|
{
|
||||||
|
// register the service control handler
|
||||||
|
ServiceHandle = RegisterServiceCtrlHandlerEx(_T("Ext2Srv"), Ext2CtrlService, NULL);
|
||||||
|
if (ServiceHandle == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup standard service state values
|
||||||
|
ServiceStatus.dwServiceType = SERVICE_WIN32;
|
||||||
|
ServiceStatus.dwServiceSpecificExitCode = 0;
|
||||||
|
|
||||||
|
// report our status to the SCM
|
||||||
|
Ext2ReportStatus(SERVICE_START_PENDING, NO_ERROR, 600);
|
||||||
|
|
||||||
|
Ext2RegisterDeviceInterface(ServiceHandle, GUID_DEVINTERFACE_DISK,
|
||||||
|
&ServiceNotify);
|
||||||
|
|
||||||
|
// Now start the service for real
|
||||||
|
Ext2StartMain(NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2StartService(VOID *arg)
|
||||||
|
{
|
||||||
|
SERVICE_TABLE_ENTRY Ext2SeriveTable[] =
|
||||||
|
{
|
||||||
|
{_T("Ext2Srv"), (LPSERVICE_MAIN_FUNCTION)Ext2ServiceEntry},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
// let service control dispatcher start Ext2Mgr
|
||||||
|
StartServiceCtrlDispatcher(Ext2SeriveTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SERVICE_CMD_LENGTH MAX_PATH
|
||||||
|
|
||||||
|
int
|
||||||
|
Ext2SetupService(BOOL bInstall)
|
||||||
|
{
|
||||||
|
TCHAR Target[SERVICE_CMD_LENGTH];
|
||||||
|
SC_HANDLE hService;
|
||||||
|
SC_HANDLE hManager;
|
||||||
|
|
||||||
|
// get the filename of this executable
|
||||||
|
if (GetModuleFileName(NULL, Target, SERVICE_CMD_LENGTH - 20) == 0) {
|
||||||
|
MessageBox(NULL, _T("Ext2Srv: Unable to install as service"), NULL,
|
||||||
|
MB_OK | MB_ICONERROR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// open Service Control Manager
|
||||||
|
hManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||||
|
if (hManager == NULL) {
|
||||||
|
MessageBox(NULL, _T("Ext2Srv: cannot open Service Control Manager"),
|
||||||
|
NULL, MB_OK | MB_ICONERROR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bInstall) {
|
||||||
|
|
||||||
|
// now create service entry for Ext2Mgr
|
||||||
|
hService = CreateService(
|
||||||
|
hManager, // SCManager database
|
||||||
|
_T("Ext2Srv"), // name of service
|
||||||
|
_T("Ext2Fsd Service Manager"), // name to display
|
||||||
|
SERVICE_ALL_ACCESS, // desired access
|
||||||
|
SERVICE_WIN32_OWN_PROCESS | // service type
|
||||||
|
SERVICE_INTERACTIVE_PROCESS,
|
||||||
|
SERVICE_AUTO_START, // start type
|
||||||
|
SERVICE_ERROR_NORMAL, // error control type
|
||||||
|
Target, // service's binary
|
||||||
|
NULL, // no load ordering group
|
||||||
|
NULL, // no tag identifier
|
||||||
|
NULL, // dependencies
|
||||||
|
NULL, // LocalSystem account
|
||||||
|
NULL); // no password
|
||||||
|
|
||||||
|
if (hService == NULL) {
|
||||||
|
|
||||||
|
DWORD error = GetLastError();
|
||||||
|
if (error == ERROR_SERVICE_EXISTS) {
|
||||||
|
MessageBox(NULL, _T("Ext2Srv is already registered."), NULL,
|
||||||
|
MB_OK | MB_ICONERROR);
|
||||||
|
} else {
|
||||||
|
MessageBox(NULL, _T("Ext2Srv couldn't be registered."), NULL,
|
||||||
|
MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
CloseServiceHandle(hService);
|
||||||
|
|
||||||
|
// got Ext2Mgr installed as a service
|
||||||
|
MessageBox(NULL, _T("Ext2Srv service was successfully registered. \n\n"
|
||||||
|
"You can modify the default settings and start/stop it from Control Panel.\n"
|
||||||
|
"The service will automatically run the next time when system is restarted.\n"),
|
||||||
|
NULL, MB_OK | MB_ICONINFORMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* open the service of Pipe Event Engine */
|
||||||
|
hService = OpenService(hManager, _T("Ext2Srv"), SERVICE_ALL_ACCESS);
|
||||||
|
|
||||||
|
if (hService != NULL) {
|
||||||
|
|
||||||
|
SERVICE_STATUS status;
|
||||||
|
|
||||||
|
// stop the service
|
||||||
|
if (ControlService(hService, SERVICE_CONTROL_STOP, &status)) {
|
||||||
|
|
||||||
|
while(QueryServiceStatus(hService, &status)) {
|
||||||
|
if (status.dwCurrentState == SERVICE_STOP_PENDING) {
|
||||||
|
Sleep(1000);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status.dwCurrentState != SERVICE_STOPPED) {
|
||||||
|
MessageBox(NULL, _T("Ext2Srv: service couldn't be stopped !"),
|
||||||
|
NULL, MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the service from the SCM
|
||||||
|
if (DeleteService(hService)) {
|
||||||
|
MessageBox(NULL, _T("Ext2Srv: service has been unregistered."),
|
||||||
|
NULL, MB_OK | MB_ICONINFORMATION);
|
||||||
|
} else {
|
||||||
|
DWORD error = GetLastError();
|
||||||
|
if (error == ERROR_SERVICE_MARKED_FOR_DELETE) {
|
||||||
|
MessageBox(NULL, _T("Ext2Srv: service is already unregistered"),
|
||||||
|
NULL, MB_OK | MB_ICONEXCLAMATION);
|
||||||
|
} else {
|
||||||
|
MessageBox(NULL, _T("Ext2Srv: service could not be unregistered"),
|
||||||
|
NULL, MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseServiceHandle(hService);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseServiceHandle(hManager);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* parameter process engine
|
||||||
|
*/
|
||||||
|
|
||||||
|
int opterr = 1, /* if error message should be printed */
|
||||||
|
optind = 1, /* index into parent argv vector */
|
||||||
|
optopt, /* character checked for validity */
|
||||||
|
optreset; /* reset getopt */
|
||||||
|
char *optarg; /* argument associated with option */
|
||||||
|
|
||||||
|
#define BADCH (int)'?'
|
||||||
|
#define BADARG (int)':'
|
||||||
|
#define EMSG ""
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*/
|
||||||
|
int getopt(int argc, char * const argv[], const char *optstring)
|
||||||
|
{
|
||||||
|
static char *place = EMSG; /* option letter processing */
|
||||||
|
char *oli; /* option letter list index */
|
||||||
|
|
||||||
|
if (optreset || *place == 0) { /* update scanning pointer */
|
||||||
|
optreset = 0;
|
||||||
|
place = argv[optind];
|
||||||
|
if (optind >= argc || *place++ != '-') {
|
||||||
|
/* Argument is absent or is not an option */
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
optopt = *place++;
|
||||||
|
if (optopt == '-' && *place == 0) {
|
||||||
|
/* "--" => end of options */
|
||||||
|
++optind;
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (optopt == 0) {
|
||||||
|
/* Solitary '-', treat as a '-' option
|
||||||
|
if the program (eg su) is looking for it. */
|
||||||
|
place = EMSG;
|
||||||
|
if (strchr(optstring, '-') == NULL)
|
||||||
|
return -1;
|
||||||
|
optopt = '-';
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
optopt = *place++;
|
||||||
|
|
||||||
|
/* See if option letter is one the caller wanted */
|
||||||
|
if (optopt == ':' || (oli = strchr((char *)optstring, optopt)) == NULL) {
|
||||||
|
if (*place == 0)
|
||||||
|
++optind;
|
||||||
|
if (opterr && *optstring != ':')
|
||||||
|
(void)fprintf(stderr, "unknown option -- %c\n", optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Does this option need an argument? */
|
||||||
|
if (oli[1] != ':') {
|
||||||
|
/* don't need argument */
|
||||||
|
optarg = NULL;
|
||||||
|
if (*place == 0)
|
||||||
|
++optind;
|
||||||
|
} else {
|
||||||
|
/* Option-argument is either the rest of this argument or the
|
||||||
|
entire next argument. */
|
||||||
|
if (*place)
|
||||||
|
optarg = place;
|
||||||
|
else if (argc > ++optind)
|
||||||
|
optarg = argv[optind];
|
||||||
|
else {
|
||||||
|
/* option-argument absent */
|
||||||
|
place = EMSG;
|
||||||
|
if (*optstring == ':')
|
||||||
|
return (BADARG);
|
||||||
|
if (opterr)
|
||||||
|
(void)fprintf(stderr,"option requires an argument - %c\n", optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
place = EMSG;
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
return (optopt); /* return option letter */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Ext2Log(DWORD ll, char *fn, int ln, char *format, ... )
|
||||||
|
{
|
||||||
|
va_list ap = NULL;
|
||||||
|
SYSTEMTIME st = {0};
|
||||||
|
DWORD w = 0;
|
||||||
|
int i = 0;
|
||||||
|
CHAR s[260] = {0};
|
||||||
|
|
||||||
|
if (ll == EXT2_LOG_DUMP) {
|
||||||
|
/* do nothing for MsgDump */
|
||||||
|
} else {
|
||||||
|
GetLocalTime(&st);
|
||||||
|
sprintf_s(s, 256, "%2.2u:%2.2u:%2.2u (%x): ", st.wHour,
|
||||||
|
st.wMinute, st.wSecond, GetCurrentThreadId());
|
||||||
|
i = strlen(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write user message to buffer s */
|
||||||
|
va_start(ap, format);
|
||||||
|
_vsnprintf(&s[i], 259 - i, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
printf("%s", s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INT __cdecl _tmain(INT argc, TCHAR *argv[])
|
||||||
|
{
|
||||||
|
DWORD rc = 0;
|
||||||
|
BOOL console = FALSE;
|
||||||
|
|
||||||
|
if (argc >= 2) {
|
||||||
|
|
||||||
|
if (0 == _tcsicmp(argv[1], _T("/installasservice"))) {
|
||||||
|
return Ext2SetupService(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == _tcsicmp(argv[1], _T("/removeservice"))) {
|
||||||
|
return Ext2SetupService(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == _tcsicmp(argv[1], _T("/startmgr"))) {
|
||||||
|
return Ext2StartMgrAsUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc >= 4) {
|
||||||
|
|
||||||
|
if (0 == _tcsicmp(argv[1], _T("/mount"))) {
|
||||||
|
Ext2AssignDrvLetter(argv[3], argv[2][0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (argc >= 3) {
|
||||||
|
|
||||||
|
if (0 == _tcsicmp(argv[1], _T("/umount"))) {
|
||||||
|
Ext2RemoveDrvLetter(argv[2][0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == _tcsicmp(argv[1], _T("/add"))) {
|
||||||
|
Ext2DrvNotify(argv[2][0], TRUE);
|
||||||
|
Sleep(1000);
|
||||||
|
Ext2DrvNotify(argv[2][0], TRUE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == _tcsicmp(argv[1], _T("/del"))) {
|
||||||
|
Ext2DrvNotify(argv[2][0], FALSE);
|
||||||
|
Sleep(1000);
|
||||||
|
Ext2DrvNotify(argv[2][0], FALSE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* enable SE_TCB_NAME privilege */
|
||||||
|
Ext2EnablePrivilege(SE_TCB_NAME);
|
||||||
|
|
||||||
|
|
||||||
|
/* service mode */
|
||||||
|
Ext2StartService(NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
128
Ext2Srv/Ext2Srv.h
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
#ifndef _EXT2_SRV_INCLUDE_
|
||||||
|
#define _EXT2_SRV_INCLUDE_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <crtdbg.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <WtsApi32.h>
|
||||||
|
#include <dbt.h>
|
||||||
|
#include <shellapi.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* global defintions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CL_ASSERT(cond) do {switch('x') {case (cond): case 0: break;}} while (0)
|
||||||
|
|
||||||
|
#define DEBUG(...) do {} while(0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* resources
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define IDI_MAINFRAME 101
|
||||||
|
|
||||||
|
/*
|
||||||
|
* global defintions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
|
||||||
|
#define EXT2_BREAK() DebugBreak()
|
||||||
|
#define EXT2_ASSERT(X) _ASSERT(X)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define EXT2_BREAK() do {} while(0)
|
||||||
|
#define EXT2_ASSERT(X) do {} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* log filter level
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define EXT2_LOG_CONSOLE (0x80000000) /* print to screen */
|
||||||
|
#define EXT2_LOG_ERROR (0x00000001) /* critical messagre */
|
||||||
|
#define EXT2_LOG_MESSAGE (0x00000002) /* information */
|
||||||
|
|
||||||
|
#define EXT2_LOG_DUMP (0x40000002) /* dump and message*/
|
||||||
|
|
||||||
|
|
||||||
|
void Ext2Log(DWORD ll, char *fn, int ln, char *format, ... );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* message / error log
|
||||||
|
*/
|
||||||
|
#define MsgDump(F, ...) \
|
||||||
|
do { \
|
||||||
|
Ext2Log(EXT2_LOG_DUMP, __FUNCTION__, __LINE__, \
|
||||||
|
##F, ##__VA_ARGS__); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define MsgLog(F, ...) \
|
||||||
|
do { \
|
||||||
|
Ext2Log(EXT2_LOG_MESSAGE, __FUNCTION__, __LINE__, \
|
||||||
|
##F, ##__VA_ARGS__); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
#define ErrLog(F, ...) \
|
||||||
|
do { \
|
||||||
|
Ext2Log(EXT2_LOG_ERROR, __FUNCTION__, __LINE__, \
|
||||||
|
##F, ##__VA_ARGS__); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* structure definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _EXT2_PIPE {
|
||||||
|
struct _EXT2_PIPE *l; /* next pipe handle */
|
||||||
|
HANDLE p; /* pipe handle */
|
||||||
|
HANDLE e; /* event handle */
|
||||||
|
HANDLE q; /* quiting */
|
||||||
|
OVERLAPPED o; /* overlap info */
|
||||||
|
volatile BOOL s; /* stop flag */
|
||||||
|
} EXT2_PIPE, *PEXT2_PIPE;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ext2Pipe.cpp
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
DWORD Ext2StartPipeSrv();
|
||||||
|
VOID Ext2StopPipeSrv();
|
||||||
|
|
||||||
|
INT Ext2NotifyUser(TCHAR *task, ULONG pid);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mount.cpp (native API)
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL Ext2EnablePrivilege(LPCTSTR lpszPrivilegeName);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Ext2DrvNotify(TCHAR drive, int add);
|
||||||
|
|
||||||
|
BOOL Ext2AssignDrvLetter(TCHAR *dev, TCHAR drv);
|
||||||
|
BOOL Ext2RemoveDrvLetter(TCHAR drive);
|
||||||
|
|
||||||
|
int Ext2StartUserTask(TCHAR *usr, TCHAR *srv, DWORD sid, BOOL);
|
||||||
|
INT Ext2StartMgrAsUser();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ext2Srv.cpp
|
||||||
|
*/
|
||||||
|
|
||||||
|
VOID Ext2DrivesChangeNotify(BOOLEAN bArrival);
|
||||||
|
|
||||||
|
#endif /* _EXT2_SRV_INCLUDE_ */
|
||||||
BIN
Ext2Srv/Ext2Srv.ico
Normal file
|
After Width: | Height: | Size: 766 B |
125
Ext2Srv/Ext2Srv.rc
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||||
|
#include "windows.h"
|
||||||
|
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Chinese (P.R.C.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
|
||||||
|
#pragma code_page(936)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||||
|
"#include ""windows.h""\r\n"
|
||||||
|
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
#endif // Chinese (P.R.C.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 1,4,7,9
|
||||||
|
PRODUCTVERSION 1,4,7,9
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x9L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Comments", "Matt Wu <matt@ext2fsd.com>"
|
||||||
|
VALUE "CompanyName", "www.ext2fsd.com"
|
||||||
|
VALUE "FileDescription", "Ext2Fsd Service Management"
|
||||||
|
VALUE "FileVersion", "1.4.7.9"
|
||||||
|
VALUE "InternalName", "Ext2Srv.exe"
|
||||||
|
VALUE "LegalCopyright", "Matt Wu <matt@ext2fsd.com>"
|
||||||
|
VALUE "OriginalFilename", "Ext2Srv.exe"
|
||||||
|
VALUE "ProductName", "Ext2Fsd Service"
|
||||||
|
VALUE "ProductVersion", "1.4.7.9"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
IDI_MAINFRAME ICON "./Ext2Srv.ico"
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||