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

📄 dlgsetup.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
*/

// DlgSetup.cpp : implementation file
//

#include "stdafx.h"
#include "VaporCD.h"
#include "DlgSetup.h"

#include "dynamic.h"

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

/////////////////////////////////////////////////////////////////////////////
// DlgSetup property page

IMPLEMENT_DYNCREATE(DlgSetup, CPropertyPage)

DlgSetup::DlgSetup() : CPropertyPage(DlgSetup::IDD)
{
	//{{AFX_DATA_INIT(DlgSetup)
	//}}AFX_DATA_INIT
	m_psp.dwFlags &= ~PSP_HASHELP;

}

DlgSetup::~DlgSetup()
{
}

void DlgSetup::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(DlgSetup)
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(DlgSetup, CPropertyPage)
	//{{AFX_MSG_MAP(DlgSetup)
	ON_BN_CLICKED(IDC_TEST, OnTest)
	ON_BN_CLICKED(IDC_TEST2, OnTest2)
	ON_BN_CLICKED(IDC_WEB_PAGE, OnWebPage)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// DlgSetup message handlers

void DlgSetup::OnTest() 
{
	// Open Service Control Manager on the local machine...
	SC_HANDLE hSCManager = OpenSCManager(NULL, NULL,
                           GENERIC_READ|GENERIC_WRITE);

	CString sCurrentDirectory;
    // Assume driver is in the same directory as the DLL.  Hence, create
    // a fully qualified pathname for the SCM to add to the registry.
    GetCurrentDirectory(500, sCurrentDirectory.GetBuffer(500));
	sCurrentDirectory.ReleaseBuffer();

	// Start the driver so that we can use it
	if (!InstallAndStartDriver(hSCManager, "VaporCD",sCurrentDirectory+"\\vaporcd.sys"))
	{
		// Close Service Control Manager
		CloseServiceHandle(hSCManager);
		AfxMessageBox("Unable to load driver");

	}else
	{
		// Close Service Control Manager
		CloseServiceHandle(hSCManager);
		AfxMessageBox("Driver loaded");

	}
}

void DlgSetup::OnTest2() 
{

	// Open Service Control Manager on the local machine...
	SC_HANDLE hSCManager = OpenSCManager(NULL, NULL,
                           GENERIC_READ|GENERIC_WRITE);

	if (!UninstallDriver(hSCManager, "VaporCD"))
	{
		// Close Service Control Manager
		CloseServiceHandle(hSCManager);
		AfxMessageBox("Unable to uninstall driver");
	}
	else
	{
		// Close Service Control Manager
		CloseServiceHandle(hSCManager);
		AfxMessageBox("Driver uninstalled. You will need to reboot to unload the driver");
	}

}

void DlgSetup::OnWebPage() 
{
	// TODO: Add your control notification handler code here
	ShellExecute(NULL,"open","http://vaporcd.sourceforge.net/",NULL,NULL,SW_SHOW);
	
}

⌨️ 快捷键说明

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