Index: win32_api.hpp =================================================================== --- win32_api.hpp (revision 73272) +++ win32_api.hpp (working copy) @@ -160,7 +160,10 @@ static unsigned long key_query_value = 0x0001; //COM API +const long RPC_C_AUTHZ_NONE_IG = 0; +const long RPC_C_AUTHN_LEVEL_CALL_IG = 3; const long RPC_C_AUTHN_LEVEL_PKT_IG = 4; +const long RPC_C_AUTHN_WINNT_IG = 10; const long RPC_C_IMP_LEVEL_IMPERSONATE_IG = 3; const long EOAC_NONE_IG = 0; const long CLSCTX_INPROC_SERVER_IG = 0x1; @@ -858,9 +861,18 @@ extern "C" __declspec(dllimport) long __stdcall CoCreateInstance(const GUID_IG & rclsid, IUnknown_IG *pUnkOuter, unsigned long dwClsContext, const GUID_IG & riid, void** ppv); extern "C" __declspec(dllimport) void __stdcall CoUninitialize(void); +extern "C" __declspec(dllimport) long __stdcall CoSetProxyBlanket( + IUnknown_IG *pProxy, + DWORD dwAuthnSvc, + DWORD dwAuthzSvc, + OLECHAR *pServerPrincName, + DWORD dwAuthnLevel, + DWORD dwImpLevel, + RPC_AUTH_IDENTITY_HANDLE pAuthInfo, + DWORD dwCapabilities + ); - //API function typedefs //Pointer to functions typedef long (__stdcall *NtDeleteFile_t)(object_attributes_t *ObjectAttributes); @@ -1516,6 +1528,21 @@ com_releaser IWbemServices_releaser(pWbemServices); + // addition to fix ticket #5392 + // @see http://support.microsoft.com/kb/948829 + // @see http://msdn.microsoft.com/en-us/library/ms692692%28v=vs.85%29.aspx + // ignoring the return value, because the following lines may work anyway + CoSetProxyBlanket( + pWbemServices, // Indicates the proxy to set + RPC_C_AUTHN_WINNT_IG, // RPC_C_AUTHN_xxx + RPC_C_AUTHZ_NONE_IG, // RPC_C_AUTHZ_xxx + NULL, // Server principal name + RPC_C_AUTHN_LEVEL_CALL_IG, // RPC_C_AUTHN_LEVEL_xxx + RPC_C_IMP_LEVEL_IMPERSONATE_IG, // RPC_C_IMP_LEVEL_xxx + NULL, // client identity + EOAC_NONE_IG // proxy capabilities + ); + strValue.clear(); strValue += L"Select "; strValue += wmi_class_var;