本文整理汇总了C++中COptions::get_Command方法的典型用法代码示例。如果您正苦于以下问题:C++ COptions::get_Command方法的具体用法?C++ COptions::get_Command怎么用?C++ COptions::get_Command使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COptions
的用法示例。
在下文中一共展示了COptions::get_Command方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
//.........这里部分代码省略.........
OutputWriter::WriteLine(TEXT("Calling CalculateSourcePath"));
// TODO: We'll eventually have to deal with mount points
CString wszSource;
CalculateSourcePath(
snapshotProperties.m_pwszSnapshotDeviceObject,
options.get_Source(),
wszVolumePathName,
wszSource
);
OutputWriter::WriteLine(TEXT("Calling DefineDosDevice to mount device."));
if (0 == wszSource.Find(TEXT("\\\\?\\GLOBALROOT")))
{
wszSource = wszSource.Mid(_tcslen(TEXT("\\\\?\\GLOBALROOT")));
}
bWorked = DefineDosDevice(DDD_RAW_TARGET_PATH, options.get_Device(), wszSource);
if (!bWorked)
{
DWORD error = ::GetLastError();
CString errorMessage;
Utilities::FormatErrorMessage(error, errorMessage);
CString message;
message.AppendFormat(TEXT("There was an error calling DefineDosDevice when mounting a device. Error: %s"), errorMessage);
throw new CShadowSpawnException(message.GetString());
}
mountedDevice = options.get_Device();
STARTUPINFO startUpInfo;
memset(&startUpInfo, 0, sizeof(startUpInfo));
startUpInfo.cb = sizeof(startUpInfo);
PROCESS_INFORMATION processInformation;
size_t commandLength = options.get_Command().size();
wchar_t* copyCommand = (wchar_t*)_alloca((commandLength+1)*sizeof(wchar_t));
options.get_Command().copy(copyCommand, commandLength);
copyCommand[commandLength] = L'\0';
message.Format(TEXT("Launching command: %s"), options.get_Command().c_str());
OutputWriter::WriteLine(message, VERBOSITY_THRESHOLD_NORMAL);
bWorked = CreateProcess(NULL, copyCommand, NULL, NULL, FALSE, 0, NULL,
NULL, &startUpInfo, &processInformation);
if (!bWorked)
{
DWORD error = ::GetLastError();
CString errorMessage;
Utilities::FormatErrorMessage(error, errorMessage);
CString message;
message.AppendFormat(TEXT("There was an error calling CreateProcess. Process: %s Error: %s"),
options.get_Command().c_str(), errorMessage);
throw new CShadowSpawnException(message.GetString());
}
WaitForSingleObject(processInformation.hProcess, INFINITE);
bWorked = GetExitCodeProcess(processInformation.hProcess, &exitCode);
if (!bWorked)
{
DWORD error = ::GetLastError();
CString errorMessage;
Utilities::FormatErrorMessage(error, errorMessage);
CString message;
message.AppendFormat(TEXT("There was an error calling GetExitCodeProcess. Error: %s"), errorMessage);
throw new CShadowSpawnException(message.GetString());
}