IWbemClassObject 获取成功,而放置时出现错误:ERROR_SXS_KEY_NOT_FOUND 140007
代码的主要目标是自定义虚拟内存页面文件的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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用另一个解决方案,获取实例
GetObject
最后。必须执行 Put 操作;像下面这样:Use another solution, to get the instance
GetObject
and at last. has to execute the Put operation; something like the following: