Accessing registory remotely

  • Thread starter Thread starter rajendersaini
  • Start date Start date
R

rajendersaini

Hi

I have problem in accessing registory remoteley form one vista machine
to othe vista machine .

Here is code sip of my application

//
dwResult = WNetAddConnection2(&NetRes,
pCredential->m_szPassword.data(),
pCredential->m_szUserName.data(),
0);

if(dwResult == ERROR_SUCCESS)
{
dwResult = RegConnectRegistry(szMachineIP, rootkey,
&m_hRemRegKey);

if(dwResult == ERROR_SUCCESS)
dwResult = RegOpenKeyEx (m_hRemRegKey, pszSubkey, 0L, regFlg,
&m_hkeySubkey);

goto HANDLE_ERROR;
Everything goes fine till RegOpenKeyEx which return error code access
denied
I am passing credentail of a user who has administrator right on
machine for which i am trying to
access the registory whicle making connection .

Can anybody tell me ahow to move further ?

Rajender saini
 
I presume regFlg is KEY_ALL_ACCESS? Is the account you are connecting with a
local user or a domain user? If it is a local user then you get a filtered
token by default and your call will fail with ERROR_ACCESS_DENIED if you ask
for permissions that only administrators have.

By default only domain users who are members of the local administrators
group get a non-filtered token when connecting remotely. That means that you
cannot, by default, connect to a non-domain joined system as an administrator
using any of the SMB APIs.

There is a reg hack to change this, but it should only be used in situations
where you absolutely have to. This behavior blocks a number of interesting
attacks. Here is the key:
Hive: HKEY_LOCAL_MACHINE
Key: SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system
Value: LocalAccountTokenFilterPolicy
Type: REG_DWORD
Data: 0 (default) – Build filtered token
1 – Build elevated token
 
Back
Top