Re: Using the LogonUser API
From: Olof Lagerkvist (no_at_email.address)
Date: 10/05/04
- Next message: Andrew Dunn: "Re: VB6 Restore Minimized Window - External Application"
- Previous message: winston: "Re: Highlitening file in commondialog box"
- In reply to: Jerry West: "Re: Using the LogonUser API"
- Next in thread: Jerry West: "Re: Using the LogonUser API"
- Reply: Jerry West: "Re: Using the LogonUser API"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 05 Oct 2004 09:23:10 GMT
Jerry West wrote:
> Thank you, that did solve the issue, sort of. Perhaps what I want to do
> isn't possible. Maybe you can tell me? The solution I am attempting to solve
> using the code posted below is this:
>
> I am the admin of a NT based computer. There are other user accounts on the
> computer which are not admin accounts. I do not always know the passwords to
> these accounts, or, to be more precise, my program does not know the
> passwords to these accounts. This program, which is not running as a
> service, needs to access the user accounts' registry programmically in order
> to read data from them. Is this possible? It seems it is from what I have
> read in the MSDN. However, using the code below I always get a handle to my
> own registry versus the user account's registry that I need. Maybe I am
> passing the wrong credentials? In the Impersonate function below I pass the
> following parameter values:
>
> sUser = the admin account name which is me
> sDomain = the name of the local computer the program is running on
> sPwd = the clear text admin account password
>
> When the LoadProfile call is made I pass for UserAcct the name of the
> account, or profile, that I want to get a handle to. It seems to work, no
> errors and I get a valid handle. Yet the handle is to my own registry and
> not the user's name which I passed. Can you shed some light on what I am
> doing wrong? Is the solution I am trying to solve possible?
>
> Thank you for your consideration.
To load a profile is much more than loading the user's registry.
Therefore, if you only need the registry you do not have to use any
logon at all since the administrator can access the users registries.
If the other user is logged on you can find the users registry settings
under HKEY_USERS\<sid-number-of-user> or if the user is not logged on
you can load the user's registry. The user's registry file is called
ntuser.dat in the user's profile directory and the name of that
directory is saved in HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProfileList. Use RegLoadKey() to load the user's
registry and RegUnloadKey() when you do not need it anymore.
-- Olof Lagerkvist ICQ: 724451 Web page: http://here.is/olof
- Next message: Andrew Dunn: "Re: VB6 Restore Minimized Window - External Application"
- Previous message: winston: "Re: Highlitening file in commondialog box"
- In reply to: Jerry West: "Re: Using the LogonUser API"
- Next in thread: Jerry West: "Re: Using the LogonUser API"
- Reply: Jerry West: "Re: Using the LogonUser API"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|