Re: WMI Methods in C++
- From: Chris Richards <gizmo@xxxxxxxxxxxxx>
- Date: Sun, 04 Mar 2007 18:00:42 -0600
You have to set your impersonation level before you can make calls to WMI. After you call:
hres = ppiWmiLoc->ConnectServer(bstrserv, NULL, NULL, 0, NULL, 0, 0, &pSvc)
You need to call:
hRes = CoSetProxyBlanket(pSvc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);
That should get you fixed up (I hope).
Later,
Chris
luke_21 wrote:
For example for that code, I have no error about the execution of.
Method, but I have Error code 1346 as Returned Value from
SetStringValue function.
It says that : Either a required impersonation level was not provided,
or the provided impersonation level is invalid. But can't understand
what that could say ....
- Follow-Ups:
- Re: WMI Methods in C++
- From: luke_21
- Re: WMI Methods in C++
- From: luke_21
- Re: WMI Methods in C++
- References:
- WMI Methods in C++
- From: luke_21
- Re: WMI Methods in C++
- From: luke_21
- WMI Methods in C++
- Prev by Date: win32_diskdrive - wmi method for HD location, Channel, Target and Lun
- Next by Date: Re: WMI Methods in C++
- Previous by thread: Re: WMI Methods in C++
- Next by thread: Re: WMI Methods in C++
- Index(es):
Relevant Pages
|