how to success OpenScManager for local machine when logged in with a user don't have administrator p

  • Thread starter Thread starter tianc
  • Start date Start date
T

tianc

Hello All,

I logged in as a local user which do not have administrator privileges on
Vista. Then I tried to use:

LogonUserA(user, domain, password, LOGON32_LOGON_NEW_CREDENTIALS,
LOGON32_PROVIDER_WINNT50, &token)
ImpersonateLoggedOnUser(token)
OpenSCManagerA(machine, NULL, SC_MANAGER_CREATE_SERVICE)

It successed when the target machine is a remote machine, but failed for the
machine itself.
I guess LOGON32_LOGON_NEW_CREDENTIALS use the credentials I put for the
remote connection but not for the local, so I have tried change
LOGON32_LOGON_NEW_CREDENTIALS to some other values but it can't work.

Is there some other solution for this?

Thanks,
tianc
 
Back
Top