ioexplorer.cpp

来自「IO函数调用测试」· C++ 代码 · 共 226 行

CPP
226
字号
/*****************************************************************************
*           Change Log
*  Date     | Change
*-----------+-----------------------------------------------------------------
* 20-Sep-98 | Created change log
* 20-Sep-98 | Do not show QueryDosDevice page on Windows 95
*****************************************************************************/
// IOExplorer.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include <afxtempl.h>

#include "IOExplorer.h"

#include "MainFrm.h"
#include "ChildFrm.h"
#include "IOExplorerDoc.h"
#include "IOExplorerView.h"
#include "About.h"

#include "NumericEdit.h"
#include "idcombo.h"
#include "status.h"
#include "is95.h"

// Property pages for dialog
#include "TraceEvent.h"
  #include "handle.h"
  #include "HandleCombo.h"
    #include "handleManager.h"
    #include "TraceManager.h"
      #include "CreateFileSheet.h"

#include "FlagsAndAttributes.h"

#include "EventList.h"
  #include "EventLog.h"

#include "HandlePage.h"
  #include "CreateFileEvent.h"
    #include "CreateFile.h"

  #include "CloseHandle.h"

  #include "CreateNamedPipeEvent.h"
    #include "CreateNamedPipe.h"

  #include "DataArray.h"
  #include "HexDisp.h"
  #include "ReadFileEvent.h"
    #include "ReadFile.h"

  #include "WriteFileEvent.h"
    #include "WriteFile.h"

  #include "ioctl.h"
    #include "DeviceIoControlEvent.h"
      #include "DeviceIoControl.h"

  #include "GetFileSizeEvent.h"
    #include "GetFileSize.h"

  #include "SetFilePointer.h"

#include "DataListBox.h"
  #include "QueryDosDevice.h"

#include "HandleLog.h"
#include "handles.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CIOExplorerApp

BEGIN_MESSAGE_MAP(CIOExplorerApp, CWinApp)
	//{{AFX_MSG_MAP(CIOExplorerApp)
	ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
	ON_COMMAND(ID_IOEXPLORER, OnIoexplorer)
	//}}AFX_MSG_MAP
	// Standard file based document commands
	ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
	ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
	// Standard print setup command
	ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CIOExplorerApp construction

CIOExplorerApp::CIOExplorerApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
 sheet = NULL;

}

/////////////////////////////////////////////////////////////////////////////
// The one and only CIOExplorerApp object

CIOExplorerApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CIOExplorerApp initialization

BOOL CIOExplorerApp::InitInstance()
{
	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

#ifdef _IOEXPLORER_MDI
	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(
		IDR_IOEXPLTYPE,
		RUNTIME_CLASS(CIOExplorerDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CIOExplorerView));
	AddDocTemplate(pDocTemplate);

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;
	m_pMainWnd = pMainFrame;

	// Enable drag/drop open
	m_pMainWnd->DragAcceptFiles();

	// Enable DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	// The main window has been initialized, so show and update it.
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	return TRUE;
#else
	OnIoexplorer();
	return FALSE;
#endif
}

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About


// App command to run the dialog
void CIOExplorerApp::OnAppAbout()
{
	CAbout aboutDlg;
	aboutDlg.DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// CIOExplorerApp commands

void CIOExplorerApp::OnIoexplorer() 
{
 sheet = new CCreateFileSheet(IDS_IOEXPLORER, m_pMainWnd, 0);
 CCreateFile cf;
 CFlagsAndAttributes fa;
 CCreateNamedPipe namedPipe;
 CReadFile rf;
 CWriteFile wf;
 CSetFilePointer sfp;
 CDeviceIoControl devio;
 CGetFileSize gfs;
 CCloseHandle close;
 CQueryDosDevice qdd;
 CHandles handles;
 CEventLog log;

#ifndef _IOEXPLORER_MDI
 m_pMainWnd = sheet;
#endif

 sheet->AddPage(&cf);
 sheet->AddPage(&fa);
 // if(!Is95())
    sheet->AddPage(&namedPipe);

 sheet->AddPage(&rf);
 sheet->AddPage(&wf);
 sheet->AddPage(&sfp);
 sheet->AddPage(&devio);
 sheet->AddPage(&gfs);
 sheet->AddPage(&close);
 sheet->AddPage(&handles);

 if(!Is95())
    sheet->AddPage(&qdd);

 sheet->AddPage(&log);
 sheet->log = &log;  // make log available

 sheet->DoModal();
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?