Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Access Denied for Remote Host

Access Denied for Remote Host

Scheduled Pinned Locked Moved C / C++ / MFC
helpsecurityc++databasesysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tobeymag
    wrote on last edited by
    #1

    I am using WMI in VC++. But there is to be a problem when i try to connect to a Remote Host . The machine I am trying to connect has Windows 2000 on it and I have Windows XP installed on my machine. Here is the code - // Initialize Security hrRetVal = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0); // CreateInstance hrRetVal = CoCreateInstance(CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IWbemLocator, (void **) &pWbemLocator); BSTR bsNameSpace = SysAllocString(L"//impartials/root/cimv2"); BSTR bsUserName = SysAllocString(L"dchauhan"); BSTR bsPassword = SysAllocString(L"rajvada"); // Connect to the Server hrRetVal = pWbemLocator->ConnectServer(bsNameSpace, bsUserName, bsPassword, 0, NULL, NULL, 0, &pWbemServices); // Query the Proxy Blanket for Authorization Level hrRetVal = CoQueryProxyBlanket(pWbemServices, NULL, NULL, NULL, &dwAuthLevel, NULL, NULL, NULL); // Set the Proxy Blanket to the Authorization Level hrRetVal = CoSetProxyBlanket(pWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NAME, NULL, dwAuthLevel, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); // Execute Query hrRetVal = pWbemServices->ExecQuery(L"WQL", L"Select * from Win32_Service", WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumObject); Over here, i receive an Access Denied error. I am not getting what is the problem. Any help would be appreciated. TobeyMag

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups