⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toolapp.cpp

📁 一个虚拟光驱程序(驱动程序和exe)-VaporCDSource141
💻 CPP
字号:
/*
    VaporCD CD-ROM Volume Emulation for Windows NT/2000
    Copyright (C) 2000  Brad Johnson

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    http://vaporcd.sourceforge.net/

    Brad Johnson
    3305 2nd PL #222
    Lubbock, TX 79415
*/

// ToolApp.cpp : implementation file
//

#include "stdafx.h"
#include "vaptool.h"
#include "ToolApp.h"

#include "VapCommandLine.h"
#include "vaporcd_mfc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CToolApp


CToolApp::CToolApp()
{
}

CToolApp::~CToolApp()
{
}

/*

VAPTOOL 
VAPTOOL {/N | /NEW} [/I | /IGNORE] {Letter} {Path} 
VAPTOOL {/M | /MOUNT} [/P | /PERSIST] {Letter} {Path}
VAPTOOL {/U | /UNMOUNT} {Letter}
VAPTOOL {/UNINSTALL}

*/

BOOL CToolApp::InitInstance()
{

	// TODO:  perform and per-thread initialization here
	SetRegistryKey("NounName");
	// 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.

    CVapCommandLine vcl;
    ParseCommandLine(vcl);

    if (vcl.m_iAction == CVapCommandLine::None || vcl.m_iAction == CVapCommandLine::Help)
    {
        printf(
            "VapTool 1.41 command line tool for VaporCD\n"
            "Copyright(c) 2000 Brad Johnson, http://vaporcd.sourceforge.net\n"
            "VapTool comes with ABSOLUTELY NO WARRANTY; for details read license.txt.\n"
            "This is free software, and you are welcome to redistribute it under certain\n"
            "conditions; read license.txt for details.\n"
            "\n"
            "VAPTOOL /M[OUNT] [/P[ERSIST]] drive imagepath\n"
            "VAPTOOL /N[EW] [/I[GNORE]] drive imagepath\n"
            "VAPTOOL /U[NMOUNT] drive\n"
            "VAPTOOL /?\n"
            //"VAPTOOL /UNINSTALL\n"
            "\n"
            "  drive\t\tDrive letter to mount or read from.\n"
            "  imagepath\tFull path to the CD image file.\n"
            "  /M\t\tMounts a CD image as a drive letter.\n"
            "  /N\t\tCreates a new CD image from the cdrom drive.\n"
            "  /U\t\tUnmounts a mounted drive that was mounted with Mount.\n"
            "  /P\t\tDrive will be remounted after boot.\n"
            "  /I\t\tBad sectors will be ignored.\n"
            "  /?\t\tDisplays this help.\n"
            );
    }else
    {
        if (vcl.m_iAction == CVapCommandLine::Mount)
        {
            HANDLE h = AttachToDriver();
            if (h)
            {
                if (vcl.m_sFirst.GetLength()>0 && Mount(h,vcl.m_sSecond, vcl.m_sFirst[0], vcl.m_bPersist ))
                    printf("Mounted image %s as drive letter %s.\n", vcl.m_sSecond, vcl.m_sFirst);
                else
                    printf("Error mounting image %s as drive letter %s.\n", vcl.m_sSecond, vcl.m_sFirst);
                CloseHandle(h);
            }
        }
        if (vcl.m_iAction == CVapCommandLine::Unmount)
        {
            if (vcl.m_sFirst.GetLength()>0 && Unmount(vcl.m_sFirst[0]))
                printf("Unmounted drive letter %s.\n", vcl.m_sFirst);
            else
                printf("Error unmounting drive letter %s.\n", vcl.m_sFirst);

        }
        if (vcl.m_iAction == CVapCommandLine::New)
        {
            printf("New is not implimentend yet.\n");
        }
        if (vcl.m_iAction == CVapCommandLine::Uninstall)
        {
            printf("Run vaporcd.exe to uninstall the driver.\n");
//            UninstallCleanup();
//		    AfxMessageBox("Driver uninstalled. You will need to reboot to unload the driver");
        }
    }
	return FALSE;
}


BEGIN_MESSAGE_MAP(CToolApp, CWinApp)
	//{{AFX_MSG_MAP(CToolApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CToolApp message handlers

⌨️ 快捷键说明

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