Iterating over items in the registry

Fred Gansevles gansevle at my-deja.com
Tue May 9 04:45:35 EDT 2000


In article <agIR4.14959$v85.97301 at news-server.bigpond.net.au>,
  "Mark Hammond" <mhammond at skippinet.com.au> wrote:
> "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.)

What I needed here was the string-representation of the SID,
not a PySID instance.

BTW Is there another way than `get_sid()' to get the string-
representation of a PySID?
I mean the representatin used in the registry, like:

    S-1-5-21-287209118-495725318-452798024-1257


>
> Mark.
>
>

--
-----------------------------------------------------------------------
----          Linux/Windows-NT/IntraNetware Administrator          ----
-- Whenever it sounds simple, I've probably missed something! ... Me --
-----------------------------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list