【问题标题】:Getting ICLRRuntimeInfo instance is null C++获取 ICLRRuntimeInfo 实例为空 C++
【发布时间】:2017-12-12 09:03:58
【问题描述】:

我得到 ICLRRuntimeInfo 实例为空 C++

DWORD pid = 2076;
HRESULT hr;
HANDLE hProcess;
ICLRMetaHost  *pMetaHost = NULL;
IEnumUnknown *ppEnumerator = NULL;
ICLRRuntimeInfo  *CLRRuntimeInfo = NULL;
ULONG    pFetched = 0;
DWORD versionLength;

hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);

if (hProcess == NULL) {
  printf("process unable to open");
  return 0;
} 

hr = CLRCreateInstance(CLSID_CLRMetaHost, IID_ICLRMetaHost,*)&pMetaHost);
pMetaHost->EnumerateLoadedRuntimes(hProcess, &ppEnumerator);

if (ppEnumerator == 0) {
  return 0;
}

hr = ppEnumerator->Next(1, (IUnknown **)&CLRRuntimeInfo, &pFetched);
if (hr == S_FALSE) {
  printError(TEXT("CLRRuntimeInfo"));
  return 0;
}

当我尝试使用 EnumerateInstalledRuntimes 时,得到了所有已安装的运行时 pMetaHost->EnumerateInstalledRuntimes(&ppEnumerator) 我得到的 Windows 错误:失败并出现错误 18(没有更多文件)

【问题讨论】:

    标签: api debugging interop clr


    【解决方案1】:

    在项目属性 -> VC++ 目录 -> 库目录-> $(NETFXKitsDir)Lib\um\x86

    但我正在使用 x64 构建解决方案。现在改为x86。工作正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-18
      • 2015-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-15
      • 1970-01-01
      相关资源
      最近更新 更多