0
代碼的主要目標是自定義虛擬內存頁面文件的InitialSize和MaximumSize。IWbemClassObject Get成功,而Put with Error:ERROR_SXS_KEY_NOT_FOUND 140007
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
...
...
}
...
感謝
感謝eeerahul – wenxzhen