IDebugHostModule2::GetImageName 方法 (dbgmodel.h)
GetImageName 方法返回模块的图像名称。 根据 allowPath 参数的值,返回的图像名称可能包含或不包含图像的完整路径。
语法
HRESULT GetImageName(
bool allowPath,
BSTR *imageName
);
参数
allowPath
如果为 true,则指示模块的完整路径可能包含在输出中。 此类路径是否包含在特定的调试主机和模块加载方式上。 如果为 false,则指示仅将模块的图像名称包含在输出中。
imageName
模块的图像名称(或完整路径)将作为分配的字符串返回在此处。 调用方负责调用 SysFreeString,以便在使用后释放字符串。
返回值
此方法返回 HRESULT,指示成功或失败。
言论
示例代码
ComPtr<IDebugHostModule> spModule; /* get a module (see FindModuleByName) */
BSTR imageName;
if (SUCCEEDED(spModule->GetImageName(false, &imageName)))
{
// imageName is the name of the image (guaranteed not to have a path
// in it). For instance, this might be "notepad.exe"
SysFreeString(imageName);
}
要求
要求 | 价值 |
---|---|
标头 | dbgmodel.h |