zoukankan      html  css  js  c++  java
  • RunTime Check Failure #0 The value of ESP was not properly saved across a function call.

    调用IIS管理组件时编写了下面一段代码,调用函数时提示错误:Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

     1 std::wcout.imbue(std::locale("chs"));
     2 ::CoInitialize(NULL);
     3 
     4 CLSID clsid;
     5 HRESULT hr = ::CLSIDFromProgID(PROGID_WRITABLEADMINMANAGER, &clsid);
     6 
     7 CComPtr pAdminMgr;
     8 hr = ::CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IDispatch, reinterpret_cast(&pAdminMgr));
     9 
    10 CComVariant vtServerPath(XLOG_CFGSECTION_SERVER_XPATH);
    11 CComVariant vtAppHost(CFG_PATH_APPHOST);
    12 CComVariant vtServerConfigSection;
    13 
    14 hr = pAdminMgr.PutPropertyByName(_T("CommitPath"), &vtAppHost);

    国外论坛不少人也提过这个问题将Calling Convention由原来的__cdecl (/Gd)修改为__stdcall (/Gz),其实是因为IUnknown被转换为IDispatch的问题。

  • 相关阅读:
    基于python的种子搜索网站(三)项目部署
    Python 的 Geth 封装库 PyGeth
    主题: 002.04 Tkinter 星空大战
    python 打飞机项目 (实战一)
    python使用mysql的一些坑
    Python 变量与运算符
    字符流
    IO字节流(2)
    端口转发
    IO流(1)
  • 原文地址:https://www.cnblogs.com/junchu25/p/2631133.html
Copyright © 2011-2022 走看看