Iterating over items in the registry

Mark Hammond mhammond at skippinet.com.au
Mon May 8 19:40:54 EDT 2000


"Fred Gansevles" <gansevle at cs.utwente.nl> wrote in message
news:8f6jvc$8d8$1 at nnrp1.deja.com...
> In article 2B1262E83448D211AE4B00A0C9D61B03BA7335 at msgeuro1.creo.be,

> Here is the code of a function that returns the SID of the currentely
> loggedin user.

While it makes a nice demo of enumerating the registry, its probably not
the best way to get the current user.  Try this:

>>> import win32security, win32api
>>> win32security.LookupAccountName(None, win32api.GetUserName())
(<PySID object at 7ef288>, u'BOBCAT', 1)

(ie, the result is the SID, the system where the SID came from, and the
type of SID.)

Mark.





More information about the Python-list mailing list