当前位置: 首页>>代码示例>>C++>>正文


C++ ActionStatus::GetMostInformativeText方法代码示例

本文整理汇总了C++中ActionStatus::GetMostInformativeText方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionStatus::GetMostInformativeText方法的具体用法?C++ ActionStatus::GetMostInformativeText怎么用?C++ ActionStatus::GetMostInformativeText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActionStatus的用法示例。


在下文中一共展示了ActionStatus::GetMostInformativeText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnCbnSelchangeCdreadspeed

LRESULT CISOProgressDialog::OnCbnSelchangeCdreadspeed(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	size_t idx = m_cbReadSpeeds.GetCurSel();
	if (idx >= m_CDReadSpeeds.size())
		return 0;

	int speed = m_CDReadSpeeds[idx];
	ActionStatus st = SetCDReadSpeed(m_pReader->GetSourcePath(), speed);
	if (!st.Successful())
		MessageBox(st.GetMostInformativeText().c_str(), NULL, MB_ICONERROR);

	m_pReader->ResetRemainingTimeCalculation();
	return 0;
}
开发者ID:ChuckNorrison,项目名称:WinCDEmu,代码行数:14,代码来源:ISOProgressDialog.cpp

示例2: Call64BitKDCLIENT

ULONGLONG Call64BitKDCLIENT(KDClientCommand cmd, unsigned PID, LPWSTR lpStringResult, size_t StringSize)
{
	ULONGLONG result = 0;
	if (TryCallOutprocClientUsingVMMON(cmd, PID, lpStringResult, StringSize, &result).Successful())
		return result;
	if (TryCall64BitClientUsingRundll(cmd, PID, lpStringResult, StringSize, &result).Successful())
		return result;
	for (;;)
	{
		if (s_bDoNotSuggestLaunchingVMMON)
			return -1;
		s_bDoNotSuggestLaunchingVMMON = true;

		TCHAR tszModule[MAX_PATH] = {0,};
		GetModuleFileName(g_hThisDll, tszModule, __countof(tszModule));
		String vmmonExe = Path::Combine(Path::GetDirectoryName(TempStrPointerWrapper(tszModule)), WOW64APIProvider::sIsWow64Process() ? _T("vmmon64.exe") : _T("vmmon.exe"));
		if (File::Exists(vmmonExe))
		{
			switch(MessageBox(HWND_DESKTOP, _T("Failed to quesy VM information. This is most likely caused by insufficient privilege level. Do you want to start Virtual Machine monitor (VMMON) in Administrator mode to fix this problem?"), _T("VirtualKD"), MB_ICONQUESTION | MB_TOPMOST | MB_YESNO))
			{
			case IDYES:
				break;
			case IDNO:
				return -1;
			}
		}
		else
		{
			MessageBox(HWND_DESKTOP, _T("Failed to quesy VM information. This is most likely caused by insufficient privilege level. Running VMMON/VMMON64 will solve the problem."), _T("VirtualKD"), MB_ICONERROR | MB_TOPMOST | MB_OK);
			return -1;
		}

		ActionStatus st = TryLaunchVVMON(vmmonExe);
		if (!st.Successful())
		{
			MessageBox(HWND_DESKTOP, st.GetMostInformativeText().c_str(), _T("Failed to launch VMMON"), MB_ICONERROR | MB_TOPMOST | MB_OK);
			return -1;
		}
		s_bDoNotSuggestLaunchingVMMON = false;
		if (TryCallOutprocClientUsingVMMON(cmd, PID, lpStringResult, StringSize, &result).Successful())
			return result;
	}
	return result;
}
开发者ID:BBLN,项目名称:VirtualKD,代码行数:44,代码来源:32to64.cpp

示例3: AutorunErrorHandler

bool AutorunErrorHandler(ActionStatus st)
{
	return MessageBox(NULL, String::sFormat(_TR(IDS_AUTORUNHOOKFAILFMT, "Failed to disable autorun for this image (%s). Mount the image anyway?"), st.GetMostInformativeText().c_str()).c_str(),
		NULL, MB_ICONERROR | MB_YESNO) == IDYES;
}
开发者ID:ChuckNorrison,项目名称:WinCDEmu,代码行数:5,代码来源:vmnt.cpp

示例4: AppMain

int AppMain()
{
	int argc;
	LPCWSTR lpCmdLine = GetCommandLineW();
	LPWSTR *ppArgv = CommandLineToArgvW(lpCmdLine, &argc);
	LPCWSTR lpDiskPath = NULL;
	bool ShowSettingsDialog = false, ForceMountOptions = false, AdminModeOnNetworkShare = false;
	bool bDisableUAC = false;
	char DriveLetterToRemount = 0;
	BazisLib::String tmpString;

	for (int i = 1; i < argc; i++)
	{
		if (ppArgv[i][0] != '/')
		{
			if (!lpDiskPath)
				lpDiskPath = ppArgv[i];
		}
		else
		{
			if (!_wcsicmp(ppArgv[i], L"/settings"))
				ShowSettingsDialog = true;
			else if (!_wcsicmp(ppArgv[i], L"/ltrselect"))
				ForceMountOptions = true;
			else if (!_wcsicmp(ppArgv[i], L"/uac_on_network_share"))
				AdminModeOnNetworkShare = true;
			else if (!_wcsicmp(ppArgv[i], L"/uacdisable"))
				bDisableUAC = true;
			else if (!_wcsicmp(ppArgv[i], L"/createiso") || !_wcsicmp(ppArgv[i], L"/isofromfolder"))
			{
				if (argc < (i + 2))
				{
					MessageBox(HWND_DESKTOP, _TR(IDS_BADCMDLINE, "Invalid command line!"), NULL, MB_ICONERROR);
					return 1;
				}
				ActionStatus st;
				if (!_wcsicmp(ppArgv[i], L"/isofromfolder"))
				{
					wchar_t *pwszFolder = ppArgv[i + 1];
					if (pwszFolder[0] && pwszFolder[wcslen(pwszFolder) - 1] == '\"')
						pwszFolder[wcslen(pwszFolder) - 1] = '\\';

					st = BuildISOFromFolder(pwszFolder);
				}
				else
					st = CreateISOFile(ppArgv[i + 1]);

				if (!st.Successful() && st.GetErrorCode() != OperationAborted)
					MessageBox(HWND_DESKTOP, st.GetMostInformativeText().c_str(), NULL, MB_ICONERROR);
				return !st.Successful();
			}
			else if (!_wcsnicmp(ppArgv[i], L"/remount:", 9))
				DriveLetterToRemount = (char)ppArgv[i][9];
		}
	}

	if (bDisableUAC)
	{
		RegistryKey driverParametersKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\BazisVirtualCDBus\\Parameters"));
		int prevVal = driverParametersKey[_T("GrantAccessToEveryone")];
		int newVal = 1;
		driverParametersKey[_T("GrantAccessToEveryone")] = newVal;

		if (prevVal != newVal)
			VirtualCDClient::RestartDriver();

		return 0;
	}

	if (GetKeyState(VK_SHIFT) & (1 << 31))
		ForceMountOptions = true;

	if (!lpDiskPath && DriveLetterToRemount)
	{
		const TCHAR *pwszFilter = _TR(IDS_ISOFILTER, "ISO images (*.iso)|*.iso|All files (*.*)|*.*");
		TCHAR tszFilter[128] = { 0, };
		_tcsncpy(tszFilter, pwszFilter, _countof(tszFilter) - 1);
		for (size_t i = 0; i < _countof(tszFilter); i++)
		if (tszFilter[i] == '|')
			tszFilter[i] = '\0';

		CFileDialog dlg(true, _T("iso"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, tszFilter);
		dlg.m_ofn.lpstrTitle = _TR(IDS_MOUNTIMAGE, "Mount a disc image");

		if (dlg.DoModal() != IDOK)
			return 1;

		tmpString.assign(dlg.m_szFileName);
		lpDiskPath = tmpString.c_str();
	}

	if ((argc < 2) || !ppArgv || !lpDiskPath || ShowSettingsDialog)
	{
		return ::ShowSettingsDialog();
	}

	MMCProfile detectedProfile = mpInvalid;
	bool bFileOnNetworkShare = false;

	{
//.........这里部分代码省略.........
开发者ID:ChuckNorrison,项目名称:WinCDEmu,代码行数:101,代码来源:vmnt.cpp

示例5: holder

int WINAPI CALLBACK WinMain (
		 __in HINSTANCE hInstance,
		 __in_opt HINSTANCE hPrevInstance,
		 __in_opt LPSTR lpCmdLine,
		 __in int nShowCmd
		 )
{
	TCHAR tszMainDir[MAX_PATH] = {0,};
	GetModuleFileName(GetModuleHandle(NULL), tszMainDir, _countof(tszMainDir));
	TCHAR *p = _tcsrchr(tszMainDir, '\\');
	if (!p)
		return 0;
	p[0] = 0;

	if (strstr(lpCmdLine, "/UPDATE"))
	{
		PrivilegeHolder holder(SE_TAKE_OWNERSHIP_NAME);
		ActionStatus st = SetKeyOwnerRecursive(HKEY_LOCAL_MACHINE,  _T("SYSTEM\\CurrentControlSet\\Enum\\BazisVirtualCDBus"), Sid::CurrentUserSid());
		RegistryKey key(HKEY_LOCAL_MACHINE,  _T("SYSTEM\\CurrentControlSet\\Enum\\BazisVirtualCDBus"));
		if (st.Successful())
			st = key.DeleteSubKeyRecursive(_T("StandardDevice"));

		if (!st.Successful() && (st.ConvertToHResult() != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)))
			MessageBox(0, String::sFormat(_T("Warning: could not cleanup registry key under SYSTEM\\CurrentControlSet\\Enum\\BazisVirtualCDBus - %s\nConsider removing it manually."), st.GetMostInformativeText().c_str()).c_str(), _T("Warning"), MB_ICONWARNING);

		RemoveDiskEnumerator(_T("root\\bzsvdisk"));

		String path(tszMainDir);
		File::Delete(Path::Combine(path, _T("BazisVirtualCD.inf")));
		File::Delete(Path::Combine(path, _T("BazisVirtualCD.cat")));
		File::Delete(Path::Combine(path, _T("VirtDiskBus.inf")));
		File::Delete(Path::Combine(path, _T("VirtDiskBus.cat")));
		RemoveSelectLetterCommandKeys();

		ShellExecute(HWND_DESKTOP, _T("open"), String::sFormat(L"%s\\x86\\VirtualAutorunDisabler.exe", tszMainDir).c_str(), _T("/RegServer"), NULL, SW_SHOW);
		ShellExecute(HWND_DESKTOP, _T("open"), _T("regsvr32.exe"), String::sFormat(L"/s \"%s\\x86\\VirtualAutorunDisablerPS.dll\"", tszMainDir).c_str(), NULL, SW_SHOW);
		ShellExecute(HWND_DESKTOP, _T("open"), _T("regsvr32.exe"), String::sFormat(L"/s \"%s\\x86\\WinCDEmuContextMenu.dll\"", tszMainDir).c_str(), NULL, SW_SHOW);
#ifdef _WIN64
		ShellExecute(HWND_DESKTOP, _T("open"), String::sFormat(L"%s\\x64\\VirtualAutorunDisabler.exe", tszMainDir).c_str(), _T("/RegServer"), NULL, SW_SHOW);
		ShellExecute(HWND_DESKTOP, _T("open"), _T("regsvr32.exe"), String::sFormat(L"/s \"%s\\x64\\VirtualAutorunDisablerPS.dll\"", tszMainDir).c_str(), NULL, SW_SHOW);
		ShellExecute(HWND_DESKTOP, _T("open"), _T("regsvr32.exe"), String::sFormat(L"/s \"%s\\x64\\WinCDEmuContextMenu.dll\"", tszMainDir).c_str(), NULL, SW_SHOW);
#endif
		return 0;
	}

	TCHAR *pszProgramDir = _tcsstr(GetCommandLine(), _T("/WINCDEMUDIR:"));
	if (pszProgramDir)
		pszProgramDir += 13;
	else
	{
		if (!_tcsstr(GetCommandLine(), _T("/UNATTENDED")))
			if (MessageBox(0, _T("Do you really want to uninstall WinCDEmu?"), _T("Question"), MB_ICONQUESTION | MB_YESNO) != IDYES)
				return 0;

		TCHAR tszTemp[MAX_PATH] = {0,}, tszThis[MAX_PATH] = {0,};
		GetModuleFileName(0, tszThis, __countof(tszThis));
		GetTempPath(__countof(tszTemp), tszTemp);
		_tcsncat(tszTemp, _T("\\wcduninst.exe"), _countof(tszTemp));

		String fpThis = tszThis;
		if (CopyFile(tszThis, tszTemp, FALSE))
		{
			String cmdLine = String::sFormat(_T("%s /WINCDEMUDIR:%s"), tszTemp, Path::GetDirectoryName(fpThis).c_str());
			ActionStatus st;
			Win32::Process proc(cmdLine.c_str(), &st);
			if (st.Successful())
				return 0;
		}
	}

	RemoveDiskEnumerator(_T("root\\BazisVirtualCDBus"));
	RemoveDiskEnumerator(_T("root\\bzsvdisk"));
	RemoveRegistryKeys();

	BazisLib::Win32::Process::RunCommandLineSynchronously((LPTSTR)String::sFormat(L"%s\\x86\\VirtualAutorunDisabler.exe /UnregServer", pszProgramDir).c_str());
	BazisLib::Win32::Process::RunCommandLineSynchronously((LPTSTR)String::sFormat(L"regsvr32.exe /s /u \"%s\\x86\\VirtualAutorunDisablerPS.dll\"", pszProgramDir).c_str());
	BazisLib::Win32::Process::RunCommandLineSynchronously((LPTSTR)String::sFormat(L"regsvr32.exe /s /u \"%s\\x86\\WinCDEmuContextMenu.dll\"", pszProgramDir).c_str());
#ifdef _WIN64
	BazisLib::Win32::Process::RunCommandLineSynchronously((LPTSTR)String::sFormat(L"%s\\x64\\VirtualAutorunDisabler.exe /UnregServer", pszProgramDir).c_str());
	BazisLib::Win32::Process::RunCommandLineSynchronously((LPTSTR)String::sFormat(L"regsvr32.exe /s /u \"%s\\x64\\VirtualAutorunDisablerPS.dll\"", pszProgramDir).c_str());
	BazisLib::Win32::Process::RunCommandLineSynchronously((LPTSTR)String::sFormat(L"regsvr32.exe /s /u \"%s\\x64\\WinCDEmuContextMenu.dll\"", pszProgramDir).c_str());
#endif

	DeleteFiles(pszProgramDir);
	MessageBox(0, _T("WinCDEmu was successfully uninstalled."), _T("Information"), MB_ICONINFORMATION);
	return 0;
}
开发者ID:ChuckNorrison,项目名称:WinCDEmu,代码行数:87,代码来源:uninstall.cpp

示例6: OnInitDialog

LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
	// center the dialog on the screen
	CenterWindow();

	// set icons
	HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
	SetIcon(hIcon, TRUE);
	HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	SetIcon(hIconSmall, FALSE);

	bHandled = FALSE;

	DlgResize_Init();

	ManagedPointer<AIBootConfigurationEntry> pEntry;
	bool bAlreadyInstalled = false;

	ManagedPointer<AIBootConfigurationEditor> pEditor = CreateConfigurationEditor();
	if (!pEditor)
	{
		::MessageBox(HWND_DESKTOP,
			_T("Cannot access boot configuration data"),
			NULL,
			MB_ICONERROR);
		EndDialog(0);
		return 0;
	}

	ActionStatus st = FindBestOSEntry(&pEntry, &bAlreadyInstalled, pEditor);
	if (!st.Successful())	
	{
		::MessageBox(HWND_DESKTOP,
				   String::sFormat(_T("Cannot access boot configuration data: %s"), st.GetMostInformativeText().c_str()).c_str(),
				   NULL,
				   MB_ICONERROR);
		EndDialog(0);
		return 0;
	}

	m_ExistingEntryName = pEntry->GetDescription();
	SetDlgItemText(IDC_REUSEENTRY, String::sFormat(_T("Use existing entry (%s)"), m_ExistingEntryName.c_str()).c_str());
	SendDlgItemMessage(IDC_SETDEFAULT, BM_SETCHECK, BST_CHECKED);
	SendDlgItemMessage(IDC_KDCOM, BM_SETCHECK, BST_CHECKED);

	SendDlgItemMessage(bAlreadyInstalled ? IDC_REUSEENTRY : IDC_NEWENTRY, BM_SETCHECK, BST_CHECKED);
	::EnableWindow(GetDlgItem(IDC_ENTRYNAME), !bAlreadyInstalled);

	if (m_ExistingEntryName.ifind(_T("[VirtualKD]")) != -1)
	{
		SendDlgItemMessage(IDC_ADDSUFFIX, BM_SETCHECK, BST_UNCHECKED);
		::EnableWindow(GetDlgItem(IDC_ADDSUFFIX), FALSE);
		SetDlgItemText(IDC_ENTRYNAME, m_ExistingEntryName.c_str());
	}
	else
	{
		SendDlgItemMessage(IDC_ADDSUFFIX, BM_SETCHECK, BST_CHECKED);
		if (IsWin8OrLater())
			SetDlgItemText(IDC_ENTRYNAME, _T("Disable Signature Enforcement Manually!!! (Press F8) [VirtualKD]"));
		else
			SetDlgItemText(IDC_ENTRYNAME, (m_ExistingEntryName + _T(" [VirtualKD]")).c_str());
	}

	SetDlgItemInt(IDC_TIMEOUT, pEditor->GetTimeout());

#ifdef SUPPORT_VISUALDDK
	SendDlgItemMessage(IDC_INSTALLVDDK, BM_SETCHECK, BST_CHECKED);

	TCHAR tszWinDir[MAX_PATH] = {0,};
	GetWindowsDirectory(tszWinDir, _countof(tszWinDir));

	TCHAR *p = _tcschr(tszWinDir, '\\');
	if (p)
		p[1] = 0;

	SetDlgItemText(IDC_VDDKLOCATION, tszWinDir);

	SetWindowText(_T("Install VirtualKD and VisualDDK Monitor on Virtual Machine"));

#else
	::EnableWindow(GetDlgItem(IDC_INSTALLVDDK), FALSE);
	::EnableWindow(GetDlgItem(IDC_VDDKLOCATION), FALSE);
#endif

	if (_tcsstr(GetCommandLine(), _T("/AUTO")))
		PostMessage(WM_COMMAND, IDOK);

	return TRUE;
}
开发者ID:BBLN,项目名称:VirtualKD,代码行数:91,代码来源:MainDlg.cpp

示例7: OnOK

LRESULT CMainDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	bool createNewEntry = false, setDefault = false, replaceKdcom = false;
	String entryName, monitorLocation;
	unsigned timeout = -1;

	if (SendDlgItemMessage(IDC_SETDEFAULT, BM_GETCHECK) == BST_CHECKED)
		setDefault = true, timeout = GetDlgItemInt(IDC_TIMEOUT);

	if (SendDlgItemMessage(IDC_KDCOM, BM_GETCHECK) == BST_CHECKED)
		replaceKdcom = true;

	if (SendDlgItemMessage(IDC_NEWENTRY, BM_GETCHECK) == BST_CHECKED)
	{
		size_t len = ::GetWindowTextLength(GetDlgItem(IDC_ENTRYNAME));
		entryName.SetLength(GetDlgItemText(IDC_ENTRYNAME, entryName.PreAllocate(len, false), len + 1));
		createNewEntry = true;
	}
	else
	{
		entryName = m_ExistingEntryName;
		if (SendDlgItemMessage(IDC_ADDSUFFIX, BM_GETCHECK) == BST_CHECKED)
			entryName += _T(" [VirtualKD]");
	}

#ifdef SUPPORT_VISUALDDK
	if (SendDlgItemMessage(IDC_INSTALLVDDK, BM_GETCHECK) == BST_CHECKED)
	{
		size_t len = ::GetWindowTextLength(GetDlgItem(IDC_VDDKLOCATION));
		monitorLocation.SetLength(GetDlgItemText(IDC_VDDKLOCATION, monitorLocation.PreAllocate(len, false), len + 1));
	}
#endif

	{
		String fp = Path::Combine(Path::GetSpecialDirectoryLocation(dirSystem), replaceKdcom ? ConstString(_T("kdcom.dll")) : ConstString(_T("kdbazis.dll")));

#ifdef _WIN64
		bool is64Bit = true;
#else
		bool is64Bit = BazisLib::WOW64APIProvider::sIsWow64Process();
#endif

		ActionStatus st;

		{
			WOW64FSRedirHolder holder;
			if (replaceKdcom)
			{
				String kdcomBackup = Path::Combine(Path::GetSpecialDirectoryLocation(dirSystem), ConstString(_T("kdcom_old.dll")));
				if (!File::Exists(kdcomBackup))
				{
					st = TakeOwnership(const_cast<LPTSTR>(String(fp).c_str()));
					if (!st.Successful())
					{
						::MessageBox(HWND_DESKTOP,
							String::sFormat(_T("Cannot replace owner on kdcom.dll: %s"), st.GetMostInformativeText().c_str()).c_str(),
							NULL,
							MB_ICONERROR);
						return 0;
					}

					Win32::Security::TranslatedAcl dacl = File::GetDACLForPath(fp, &st);
					if (!st.Successful())
					{
						::MessageBox(HWND_DESKTOP,
							String::sFormat(_T("Cannot query permissions on kdcom.dll: %s"), st.GetMostInformativeText().c_str()).c_str(),
							NULL,
							MB_ICONERROR);
						return 0;
					}
					dacl.AddAllowingAce(STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL, BazisLib::Win32::Security::Sid::CurrentUserSid());
					st = File::SetDACLForPath(fp, dacl);
					if (!st.Successful())
					{
						::MessageBox(HWND_DESKTOP,
							String::sFormat(_T("Cannot set permissions on kdcom.dll: %s"), st.GetMostInformativeText().c_str()).c_str(),
							NULL,
							MB_ICONERROR);
						return 0;
					}

					if (!MoveFile(fp.c_str(), kdcomBackup.c_str()))
					{
						::MessageBox(HWND_DESKTOP,
							String::sFormat(_T("Cannot rename old kdcom.dll: %s"), MAKE_STATUS(ActionStatus::FromLastError()).GetMostInformativeText().c_str()).c_str(),
							NULL,
							MB_ICONERROR);
						return 0;
					}
				}
			}
			st = SaveResourceToFile(fp, _T("KDVMDLL"), is64Bit ? IDR_KDVM64 : IDR_KDVM32);
		}
		if (!st.Successful())
		{
			::MessageBox(HWND_DESKTOP,
				String::sFormat(_T("Cannot create KDBAZIS.DLL: %s"), st.GetMostInformativeText().c_str()).c_str(),
				NULL,
				MB_ICONERROR);
			return 0;
//.........这里部分代码省略.........
开发者ID:BBLN,项目名称:VirtualKD,代码行数:101,代码来源:MainDlg.cpp

示例8: OnTimer

LRESULT CISOProgressDialog::OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
	extern bool AutorunErrorHandler(ActionStatus st);

	BackgroundDriveReader::ProgressRecord progress = m_pReader->GetProgress();
	unsigned progressVal = (unsigned)((progress.Done * kProgressRangeMax) / progress.Total);

	if (progress.TotalBad)
	{
		if (m_pTaskbar)
			m_pTaskbar->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
		m_ProgressBar.SetPos((int)((progress.ProcessedBad * kProgressRangeMax) / progress.TotalBad));
		SetDlgItemText(IDC_PROGRESSLINE, String::sFormat(_TR(IDS_BADSECTORPROGRESSFMT, "Re-reading bad sectors (%d/%d)"), (int)progress.ProcessedBad, (int)progress.TotalBad).c_str());
	}
	else
	{
		if (m_pTaskbar)
			m_pTaskbar->SetProgressValue(m_hWnd, progress.Done, progress.Total);
		m_ProgressBar.SetPos(progressVal);
		unsigned badSectorCount = m_pReader->GetTotalBadSectorCount();
		if (!badSectorCount)
		{
			bool remainingTimeAccurate = false;
			TimeSpan remainingTime = m_pReader->GetEstimatedRemainingTime(&remainingTimeAccurate);
			String label = String::sFormat(_TR(IDS_SPEEDSTATFMT, "Average read speed: %s/s"), RateCalculator::FormatByteCount(progress.BytesPerSecond).c_str());
			if (remainingTimeAccurate && (remainingTime.GetTotalSeconds() > 3))
				label += String::sFormat(_TR(IDS_REMAININGTIMESUFFIX, ", remaining time: %02d:%02d"), remainingTime.GetTotalMinutes(), remainingTime.GetSeconds());
			SetDlgItemText(IDC_PROGRESSLINE, label.c_str());
		}
		else
			SetDlgItemText(IDC_PROGRESSLINE, String::sFormat(_TR(IDS_BADSECTFMT, "Average read speed: %s/s, %d bad sector(s) found"), RateCalculator::FormatByteCount(progress.BytesPerSecond).c_str(), badSectorCount).c_str());
	}

	if (m_pReader->QueryStatus().GetErrorCode() != Pending)
	{
		KillTimer(0);
		::EnableWindow(GetDlgItem(IDC_PAUSE), FALSE);
		ActionStatus st = m_pReader->QueryStatus();

		if (st.Successful())
		{
			FunctionThread ejectThread(&EjectDriveProc, (PVOID)m_pReader->GetSourcePath());
			if (SendDlgItemMessage(IDC_EJECTDISC, BM_GETCHECK) == BST_CHECKED)
				ejectThread.Start();

			if (SendDlgItemMessage(IDC_OPENFOLDER, BM_GETCHECK) == BST_CHECKED)
				Win32::Process(Path::GetDirectoryName(ConstString(m_pReader->GetImagePath())).c_str(), _T("open"));

			if (SendDlgItemMessage(IDC_MOUNTISO, BM_GETCHECK) == BST_CHECKED)
			{
				wchar_t wszKernelPath[512];
				if (!VirtualCDClient::Win32FileNameToKernelFileName(m_pReader->GetImagePath(), wszKernelPath, __countof(wszKernelPath)))
					MessageBox(_TR(IDS_BADIMGFN, "Invalid image file name!"), NULL, MB_ICONERROR);
				else
				{
					TCHAR tsz[3] = {0,};
					if (m_cbLetters.GetLBTextLen(m_cbLetters.GetCurSel()) < _countof(tsz))
						m_cbLetters.GetLBText(m_cbLetters.GetCurSel(), tsz);

					VirtualCDClient().ConnectDisk(wszKernelPath, (char)(tsz[0]), 0, m_RegParams.DisableAutorun, false, AutorunErrorHandler);
				}
			}

			ejectThread.Join();

			if (SendDlgItemMessage(IDC_CLOSEWINDOW, BM_GETCHECK) == BST_CHECKED)
			{
				EndDialog(IDOK);
				SaveParams();
			}
			else
			{
				SetDlgItemText(IDCANCEL, _TR(IDS_CLOSE, "Close"));
				m_ProgressBar.SetPos(kProgressRangeMax);
				::SetFocus(GetDlgItem(IDCANCEL));
				MessageBox(_TR(IDS_ISOCREATED, "The ISO image has been created successfully"), _TR(IDS_INFORMATION, "Information"), MB_ICONINFORMATION);
			}
		}
		else
		{
			if (st.GetErrorCode() != OperationAborted)
				MessageBox(st.GetMostInformativeText().c_str(), NULL, MB_ICONERROR);
			DeleteFile(m_pReader->GetImagePath());
			EndDialog(IDNO);
		}
	}
	return 0;
}
开发者ID:ChuckNorrison,项目名称:WinCDEmu,代码行数:88,代码来源:ISOProgressDialog.cpp


注:本文中的ActionStatus::GetMostInformativeText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。