_winreg and accessing registry settings of another user

News123 news123 at free.fr
Fri Mar 5 02:21:30 EST 2010


Mensanator wrote:
> On Mar 4, 3:24 pm, News123 <news... at free.fr> wrote:
>> Hi,
>>
>> I have administrator privilege  on a window host and would like to write
>> a script setting some registry entries for other users.
> 
> Why? Are you writing a virus?
> 
Writing a virus in python???? Why not? though I didn't think about it as
ideal choice of implementing viruses.
For my script to run I have to run it explicitly as administrator
(as being required by Vista / Win7).


My script shall be part of installing and configuring a PC with some
default settings with the minimal amount of human administrator
interactions.

The steps:
- install windows
- install python
- setup one admin account and one or more user accounts (without admin
privileges)
- run a script, that preconfigures registry settings for some users.

As mentioned before I see at least two possible ways and achieving this
but lack information for either.


1.) run a sub process or thread as another user (the user wouldn't even
have a password during the installation phase) and change the registry
from this thread. I have no experience of running 'suid' under windows.


2.) being able to load the 'hive' of another user into the registry and
be therefore able to change his settings. I didn't find a function
allowing _winreg to load additional 'hives'



bye


N



More information about the Python-list mailing list