-
December 13th, 2013, 05:53 PM
#1
Win32_NetworkAdapterConfiguration EnableDHCP method problem
This is the section code:
BSTR MethodName = SysAllocString(L"EnableDHCP");
// BSTR MethodName = SysAllocString(L"EnableStatic");
IWbemClassObject * pInClass = NULL;
IWbemClassObject * pInInst = NULL;
IWbemClassObject * pOutInst = NULL;
IWbemClassObject * pvClass = NULL;
VARIANT pathVar;
hres = pSvc->GetObject(L"Win32_NetworkAdapterConfiguration", 0, NULL, &pvClass, NULL);
if( hres != WBEM_S_NO_ERROR )
{
plogfile->WriteError(_T("Network: Failed to query Win32_NetworkAdapterConfiguration, error code: %x\r\n"), hres);
SysFreeString(MethodName);
return hres;
}
hres = pvClass->GetMethod(MethodName, 0, &pInClass, NULL);
if( hres != WBEM_S_NO_ERROR )
{
plogfile->WriteError(_T("Network: Failed to EnableDHCP method, error code: %x\r\n"), hres);
SysFreeString(MethodName);
return hres;
}
If the method name is EnableStatic, pInClass is valid pointer. Any methods related to DHCP for exampe, ReleaseDHCPLease, will return with pInClass as NULL. Other methods return with pInClass as valid pointer.
Anything I did wrong?
-
December 13th, 2013, 09:40 PM
#2
Re: Win32_NetworkAdapterConfiguration EnableDHCP method problem
This issue is solved: As EnableDHCP doesn't require parameter inputs, pvClass->GetMethod(MethodName, 0, &pInClass, NULL); returns with NULL pointer for pInClass.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|