GetVersion 方法返回有关模块的版本信息(假设此类信息可以成功读出标头)。 如果请求给定版本(通过非 nullptr 输出指针),并且无法读取,将从方法调用返回相应的错误代码。
语法
HRESULT GetVersion(
ULONG64 *fileVersion,
ULONG64 *productVersion
);
参数
fileVersion
如果提供了非 nullptr 地址,则会在此处返回模块的文件版本。 如果无法从模块标头读取文件版本,如果此处提供了非 nullptr 地址,此方法将失败。 如果无法从模块标头中读取文件版本,并且此值作为 nullptr 提供,则不会导致失败。
productVersion
如果提供了非 nullptr 地址,则会在此处返回模块标头中所示的模块的产品版本。 如果无法从模块标头中读取产品版本,如果此处提供了非 nullptr 地址,此方法将失败。 如果无法从模块标头中读取产品版本,并且此值作为 nullptr 提供,则不会导致失败。
返回值
此方法返回 HRESULT,指示成功或失败。
言论
示例代码
ComPtr<IDebugHostModule2> spModule; /* get a module (see FindModuleByName) */
ULONG64 fileVersion;
ULONG64 productVersion;
if (SUCCEEDED(spModule->GetVersion(&fileVersion, &productVersion)))
{
// fileVersion contains a.b.c.d (16.16.16.16) file version
// productVersion contains a.b.c.d (16.16.16.16) product version
}
要求
要求 | 价值 |
---|---|
标头 | dbgmodel.h |