本文整理汇总了C++中CComQIPtr::GetAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr::GetAddress方法的具体用法?C++ CComQIPtr::GetAddress怎么用?C++ CComQIPtr::GetAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComQIPtr
的用法示例。
在下文中一共展示了CComQIPtr::GetAddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteAt
HRESULT MemoryBytes::WriteAt(
IDebugMemoryContext2* pStartContext,
DWORD dwCount,
BYTE* rgbMemory )
{
if ( pStartContext == NULL )
return E_INVALIDARG;
if ( rgbMemory == NULL )
return E_INVALIDARG;
HRESULT hr = S_OK;
Address addr = 0;
SIZE_T lenWritten = 0;
CComQIPtr<IMagoMemoryContext> memCxt = pStartContext;
if ( memCxt == NULL )
return E_INVALIDARG;
memCxt->GetAddress( addr );
hr = mDebugger->WriteMemory(
mProc,
addr,
dwCount,
lenWritten,
rgbMemory );
if ( FAILED( hr ) )
return hr;
return S_OK;
}
示例2: ReadAt
HRESULT MemoryBytes::ReadAt(
IDebugMemoryContext2* pStartContext,
DWORD dwCount,
BYTE* rgbMemory,
DWORD* pdwRead,
DWORD* pdwUnreadable )
{
if ( pStartContext == NULL )
return E_INVALIDARG;
if ( (rgbMemory == NULL) || (pdwRead == NULL) )
return E_INVALIDARG;
HRESULT hr = S_OK;
Address addr = 0;
SIZE_T lenRead = 0;
SIZE_T lenUnreadable = 0;
CComQIPtr<IMagoMemoryContext> memCxt = pStartContext;
if ( memCxt == NULL )
return E_INVALIDARG;
memCxt->GetAddress( addr );
hr = mDebugger->ReadMemory(
mProc,
addr,
dwCount,
lenRead,
lenUnreadable,
rgbMemory );
if ( FAILED( hr ) )
return hr;
*pdwRead = lenRead;
if ( pdwUnreadable != NULL )
*pdwUnreadable = lenUnreadable;
return S_OK;
}
示例3: array
List<CallStackFrame^>^ Debuggee::GetCallStack(uint32_t threadId)
{
CComModule _Module;
List<CallStackFrame^>^ frames = gcnew List<CallStackFrame^>();
RefPtr<Mago::Thread> thread;
HRESULT hr = mProg->FindThread(threadId, thread);
if (FAILED(hr))
return frames;
FRAMEINFO_FLAGS flags =
FIF_DEBUGINFO
| FIF_FUNCNAME
| FIF_RETURNTYPE
| FIF_ARGS
| FIF_LANGUAGE
| FIF_MODULE
| FIF_FUNCNAME_MODULE
| FIF_FUNCNAME_ARGS_ALL
| FIF_FUNCNAME_LINES
| FIF_FUNCNAME_OFFSET
| FIF_FUNCNAME_ARGS_TYPES
| FIF_FUNCNAME_ARGS_NAMES
| FIF_FUNCNAME_ARGS_VALUES
| FIF_FRAME;
DWORD tid = NULL;
hr = thread->GetThreadId(&tid);
if (FAILED(hr))
return frames;
CComPtr<IEnumDebugFrameInfo2> edfi = NULL;
hr = thread->EnumFrameInfo(flags, 10, &edfi);
if (FAILED(hr))
return frames;
ULONG cnt = 0;
hr = edfi->GetCount(&cnt);
if (FAILED(hr))
return frames;
ULONG fetched = 0;
Mago::FrameInfoArray array(cnt);
while (fetched < cnt)
{
ULONG ft = 0;
hr = edfi->Next(cnt - fetched, &array[fetched], &ft);
if (FAILED(hr))
return frames;
fetched += ft;
}
for (ULONG i = 0; i < fetched; i++)
{
FRAMEINFO* fi = &array[i];
CComPtr<IDebugCodeContext2> dcCtx = NULL;
hr = fi->m_pFrame->GetCodeContext(&dcCtx);
if (FAILED(hr))
continue;
CComQIPtr<Mago::IMagoMemoryContext> mmCtx = dcCtx; //how else to get address?
Mago::Address64 addr = 0;
hr = mmCtx->GetAddress(addr);
CallStackFrame^ frame = gcnew CallStackFrame();
frame->AddressMin = fi->m_addrMin;
frame->AddressMax = fi->m_addrMax;
frame->FunctionName = gcnew String(fi->m_bstrFuncName);
frame->Args = gcnew String(fi->m_bstrArgs);
frame->ReturnType = gcnew String(fi->m_bstrReturnType);
frame->Language = gcnew String(fi->m_bstrLanguage);
frame->InstructionPointer = addr;
frames->Add(frame);
}
return frames;
}