IWbemClassObject 获取成功,而放置时出现错误:ERROR_SXS_KEY_NOT_FOUND 140007

发布于 2024-12-21 03:43:29 字数 922 浏览 0 评论 0原文

代码的主要目标是自定义虚拟内存页面文件的InitialSize和MaximumSize。

ENV:windows Server 2008

代码:

...
...
IWbemClassObject* pclsObj = NULL;
ULONG uReturn = 0;

while(pEnumerator)
{
    HRESULT hr = pEnumerator->Next(WBEM_INFINITE,1, &pclsObj, &uReturn);
    VARIANT initial_size;
    VARIANT maximum_size;


    //InitialSize 
    pclsObj->Get(L"InitialSize", 0, &initial_size, 0, 0);

    //get the maximumsize of the pagefile
    //MaximumSize  
    pclsObj->Get(L"MaximumSize", 0, &maximum_size, 0, 0); //successfully


    //use the put to adjust the pagefile size

    VARIANT in_initialsize;
    VariantInit(&in_initialsize);
    in_initialsize.vt = VT_I4;
    in_initialsize.iVal = 13000;

    //set the initialsize of the pagefile
    hr = pclsObj->Put(L"InitialSize", 0, &in_initialsize, 0); //failed with 14007
        ...
        ...
}
...

谢谢

The main goal of the code is to customize the InitialSize and MaximumSize of the virtual memory pagefile.

ENV: windows Server 2008

Code:

...
...
IWbemClassObject* pclsObj = NULL;
ULONG uReturn = 0;

while(pEnumerator)
{
    HRESULT hr = pEnumerator->Next(WBEM_INFINITE,1, &pclsObj, &uReturn);
    VARIANT initial_size;
    VARIANT maximum_size;


    //InitialSize 
    pclsObj->Get(L"InitialSize", 0, &initial_size, 0, 0);

    //get the maximumsize of the pagefile
    //MaximumSize  
    pclsObj->Get(L"MaximumSize", 0, &maximum_size, 0, 0); //successfully


    //use the put to adjust the pagefile size

    VARIANT in_initialsize;
    VariantInit(&in_initialsize);
    in_initialsize.vt = VT_I4;
    in_initialsize.iVal = 13000;

    //set the initialsize of the pagefile
    hr = pclsObj->Put(L"InitialSize", 0, &in_initialsize, 0); //failed with 14007
        ...
        ...
}
...

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

巷子口的你 2024-12-28 03:43:29

使用另一个解决方案,获取实例 GetObject 最后。必须执行 Put 操作;像下面这样:

...
l_pSVC->PutInstance(l_pinObj, WBEM_FLAG_UPDATE_ONLY, NULL, NULL);
...

Use another solution, to get the instance GetObject and at last. has to execute the Put operation; something like the following:

...
l_pSVC->PutInstance(l_pinObj, WBEM_FLAG_UPDATE_ONLY, NULL, NULL);
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文