本文整理汇总了C++中ActionStatus类的典型用法代码示例。如果您正苦于以下问题:C++ ActionStatus类的具体用法?C++ ActionStatus怎么用?C++ ActionStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActionStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WINCDEMU_LOG_LINE
HRESULT STDMETHODCALLTYPE CDriveContextMenu::Initialize(/* [unique][in] */ __in_opt PCIDLIST_ABSOLUTE pidlFolder, /* [unique][in] */ __in_opt IDataObject *pdtobj, /* [unique][in] */ __in_opt HKEY hkeyProgID)
{
WINCDEMU_LOG_LINE(L"CDriveContextMenu::Initialize()");
HRESULT hR = ContextMenuBase::Initialize(pidlFolder, pdtobj, hkeyProgID);
if (!SUCCEEDED(hR))
return hR;
if (m_FileName.length() == 3 && m_FileName[1] == ':' && GetDriveType(m_FileName.c_str()) == DRIVE_CDROM)
{
m_bIsOpticalDrive = true;
if (m_FileName.length() == 3 && m_FileName[1] == ':' && m_FileName[2] == '\\')
{
wchar_t wszPath [] = L"\\\\.\\?:";
wszPath[4] = m_FileName[0];
ActionStatus status;
VirtualDriveClient clt(wszPath, &status);
m_bIsWinCDEmuDrive = status.Successful();
}
}
WINCDEMU_LOG_LINE(L"CDriveContextMenu::Initialize(): isDrive = %d, isWinCDEmu = %d", m_bIsOpticalDrive, m_bIsWinCDEmuDrive);
return S_OK;
}
示例2: TryLaunchVVMON
ActionStatus TryLaunchVVMON(const String &exePath, bool WaitForPipeAvailable = true)
{
const int kVMMONStartTimeout = 10000;
ActionStatus st;
BazisLib::Win32::Process vmmon(exePath.c_str(), true, &st);
if (!st.Successful())
return st;
if (!WaitForPipeAvailable)
return MAKE_STATUS(Success);
DateTime start = DateTime::Now();
for (;;)
{
Sleep(100);
if ((DateTime::Now() - start).GetTotalMilliseconds() >= kVMMONStartTimeout)
return MAKE_STATUS(UnknownError);
ULONGLONG result = 0;
if (TryCallOutprocClientUsingVMMON(kQueryVersion, 0, NULL, 0, &result).Successful())
break;
if (!vmmon.IsRunning())
return MAKE_STATUS(UnknownError);
}
return MAKE_STATUS(Success);
}
示例3: SaveResourceToFile
static ActionStatus SaveResourceToFile(const String &filePath, LPCTSTR lpResType, DWORD dwID)
{
HMODULE hModule = GetModuleHandle(NULL);
HRSRC hRes = FindResource(hModule, MAKEINTRESOURCE(dwID), lpResType);
if (!hRes)
return MAKE_STATUS(ActionStatus::FailFromLastError());
DWORD len = SizeofResource(hModule, hRes);
if (!len)
return MAKE_STATUS(ActionStatus::FailFromLastError());
HGLOBAL hResObj = LoadResource(hModule, hRes);
if (!hResObj)
return MAKE_STATUS(ActionStatus::FailFromLastError());
PVOID p = LockResource(hResObj);
if (!p)
return MAKE_STATUS(ActionStatus::FailFromLastError());
ActionStatus st;
File file(filePath, FileModes::CreateOrTruncateRW, &st);
if (!st.Successful())
return st;
file.Write(p, len, &st);
if (!st.Successful())
return st;
return MAKE_STATUS(Success);
}
示例4: InstallRootEnumeratedDriver
LRESULT CMainDlg::OnBnClickedButton1(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled)
{
int idx = m_ComboBox.GetCurSel();
if (idx >= 0 && idx < m_Projects.size())
{
ActionStatus st = InstallRootEnumeratedDriver((String(L"root\\") + m_Projects[idx].SampleName).c_str(), m_Projects[idx].INFFile.c_str());
if (!st.Successful())
MessageBox(String::sFormat(L"Cannot install driver: %s", st.GetErrorText().c_str()).c_str(), NULL, MB_ICONERROR);
OnCbnSelchangeCombo1(0,0,0,bHandled);
}
return 0;
}
示例5: EnableCustomKD
virtual ActionStatus EnableCustomKD(LPCWSTR pCustomKDName)
{
if (!pCustomKDName)
return MAKE_STATUS(InvalidParameter);
ActionStatus st = m_Object.SetElement(BcdOSLoaderString_DbgTransportPath, pCustomKDName);
if (!st.Successful())
return st;
st = m_Object.SetElement(BcdLibraryBoolean_AllowPrereleaseSignatures, true);
ActionStatus st2 = m_Object.SetElement(BcdOSLoaderBoolean_AllowPrereleaseSignatures, true);
if (!st.Successful() && !st2.Successful())
return st;
return m_Object.SetElement(BcdOSLoaderBoolean_KernelDebuggerEnabled, true);
}
示例6: SetCDReadSpeed
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;
}
示例7: MountNewImage
BazisLib::ActionStatus VirtualDriveClient::MountNewImage(const wchar_t *pwszImage, unsigned timeout)
{
ActionStatus status;
ULONGLONG hWait = 0;
m_Drive.DeviceIoControl(IOCTL_VDEV_MOUNT_IMAGE, pwszImage, pwszImage ? ((wcslen(pwszImage) + 1) * sizeof(wchar_t)) : 0, &hWait, timeout ? sizeof(hWait) : 0, &status);
if (!status.Successful())
return status;
if (timeout && hWait)
{
if (WaitForSingleObject(reinterpret_cast<HANDLE>(hWait), timeout) != WAIT_OBJECT_0)
return MAKE_STATUS(TimeoutExpired);
}
return status;
}
示例8: CopyEntry
virtual ManagedPointer<AIBootConfigurationEntry> CopyEntry(const ConstManagedPointer<AIBootConfigurationEntry> &pEntry, bool AddToSelectionList = true, ActionStatus *pStatus = NULL)
{
if (!pEntry)
{
ASSIGN_STATUS(pStatus, InvalidParameter);
return NULL;
}
ManagedPointer<BootEntry> pBootEntry = pEntry;
if (!pBootEntry->Valid())
{
ASSIGN_STATUS(pStatus, InvalidParameter);
return NULL;
}
BCDObject newObj = m_Store.CopyObject(pBootEntry->m_Object, pStatus);
if (!newObj.Valid())
{
ASSIGN_SUBSTATUS(pStatus, *pStatus, UnknownError);
return NULL;
}
if (AddToSelectionList)
{
BCDObject globalSettings = m_Store.GetFirstObjectOfType(BCDObject::GlobalSettings);
if (!globalSettings.Valid())
{
ASSIGN_STATUS(pStatus, UnknownError);
return NULL;
}
BCDObjectList selectionList = globalSettings.GetElement(BcdBootMgrObjectList_DisplayOrder).GetObjectList();
if (!selectionList.Valid())
{
ASSIGN_STATUS(pStatus, UnknownError);
return NULL;
}
ActionStatus st = selectionList.InsertObject(newObj);
if (!st.Successful())
{
ASSIGN_SUBSTATUS(pStatus, st, UnknownError);
return NULL;
}
}
ASSIGN_STATUS(pStatus, Success);
return new BootEntry(newObj);
}
示例9: WorkerThread
int BasicTCPServer::WorkerThread::ThreadBody()
{
InternetAddress addr;
TCPSocket sock;
ActionStatus st = m_pServer->m_Listener.Accept(&sock, &addr);
if (st.Successful() && sock.Valid())
{
m_pServer->m_ActiveThreadCount++;
WorkerThread *pThread = new WorkerThread(m_pServer);
if (!pThread || !pThread->Start())
delete pThread;
m_pServer->ConnectionHandler(sock, addr);
}
if (!--m_pServer->m_ActiveThreadCount)
m_pServer->m_LastThreadDone.Set();
return 0;
}
示例10: 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;
}
示例11: FindBestOSEntry
ActionStatus FindBestOSEntry(ManagedPointer<AIBootConfigurationEntry> *ppEntry, bool *pbAlreadyInstalled, ManagedPointer<AIBootConfigurationEditor> pEditor)
{
ASSERT(ppEntry);
*ppEntry = NULL;
if (!pEditor)
pEditor = CreateConfigurationEditor();
if (!pEditor)
return MAKE_STATUS(UnknownError);
ActionStatus st = pEditor->StartEnumeration();
if (!st.Successful())
return st;
if (pbAlreadyInstalled)
*pbAlreadyInstalled = false;
ManagedPointer<AIBootConfigurationEntry> pEntry, pCurrentOSEntry;
while (pEntry = pEditor->GetNextEntry())
{
if (pEntry->IsCurrentOS())
{
if (!pCurrentOSEntry)
pCurrentOSEntry = pEntry;
if ((pEntry->GetDebuggerMode() == kdCustom) && (!pEntry->GetCustomKDName().icompare(_T("kdbazis.dll"))))
{
pCurrentOSEntry = pEntry;
if (pbAlreadyInstalled)
*pbAlreadyInstalled = true;
break;
}
}
}
*ppEntry = pCurrentOSEntry;
if (!pCurrentOSEntry)
return MAKE_STATUS(NotSupported);
return MAKE_STATUS(Success);
}
示例12: ShowSettingsDialog
int ShowSettingsDialog()
{
ActionStatus status;
RegistryKey key(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\BazisVirtualCDBus\\Parameters"), 0, true, &status);
if (!key.Valid() && (status.GetErrorCode() == AccessDenied))
{
TCHAR tsz[MAX_PATH + 2] = {0,};
tsz[0] = '\"';
GetModuleFileName(GetModuleHandle(0), tsz + 1, _countof(tsz) - 1);
size_t len = _tcslen(tsz);
tsz[len] = '\"';
tsz[len + 1] = 0;
return (int)CUACInvokerDialog(tsz).DoModal();
}
else
{
CSettingsDialog dlg;
dlg.DoModal();
}
return 0;
}
示例13: CreateVirtualKDBootEntry
ActionStatus CreateVirtualKDBootEntry(bool CreateNewEntry, bool SetNewEntryDefault, LPCWSTR lpEntryName, unsigned Timeout)
{
ManagedPointer<AIBootConfigurationEditor> pEditor = CreateConfigurationEditor();
if (!pEditor)
return MAKE_STATUS(UnknownError);
bool alreadyInstalled = false;
ManagedPointer<AIBootConfigurationEntry> pEntry;
ActionStatus st = FindBestOSEntry(&pEntry, &alreadyInstalled, pEditor);
if (!st.Successful())
return st;
if (!pEntry)
return MAKE_STATUS(NotSupported);
if (CreateNewEntry && !alreadyInstalled)
pEntry = pEditor->CopyEntry(pEntry, true, &st);
if (!pEntry)
return MAKE_STATUS(NotSupported);
st = pEntry->EnableCustomKD(L"kdbazis.dll");
if (!st.Successful())
return COPY_STATUS(st);
if (!st.Successful())
return COPY_STATUS(st);
if (!pEntry)
return MAKE_STATUS(UnknownError);
if (lpEntryName)
{
st = pEntry->SetDescription(lpEntryName);
if (!st.Successful())
return COPY_STATUS(st);
}
if (SetNewEntryDefault)
{
st = pEditor->SetDefaultEntry(pEntry);
if (!st.Successful())
return COPY_STATUS(st);
}
if (Timeout != -1)
{
st = pEditor->SetTimeout(Timeout);
if (!st.Successful())
return COPY_STATUS(st);
}
return pEditor->FinishEditing();
}
示例14: MAKE_STATUS
ActionStatus BasicTCPServer::Start(unsigned PortNumber)
{
if (m_ActiveThreadCount)
return MAKE_STATUS(InvalidState);
ActionStatus st = m_Listener.Listen(PortNumber);
if (!st.Successful())
return st;
m_LastThreadDone.Reset();
m_ActiveThreadCount++;
WorkerThread *pThread = new WorkerThread(this);
if (!pThread)
return MAKE_STATUS(NoMemory);
if (!pThread->Start())
{
delete pThread;
m_ActiveThreadCount--;
return MAKE_STATUS(UnknownError);
}
return MAKE_STATUS(Success);
}
示例15: GetDlgItemInt
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;
//.........这里部分代码省略.........