[python-win32] HKLM\SOFTWARE\...\ProfileList\... registry subkeyquery

Tim Roberts timr at probo.com
Fri Sep 7 18:51:49 CEST 2012


raf wrote:
>
> if you look at the code i supplied, you'll see that that is precisely
> where i get the sid from:
>
>   sid = win32security.ConvertSidToStringSid(win32security.LookupAccountName(None, username)[0])
>
> so win32security.LookupAccountName is not giving me the complete sid for the username.
> any idea why it isn't doing so? any idea what i'm doing wrong?

You are assuming that the user name you got is a local user on this
machine, and never a domain user.  That may be true for the computer
you're using, but it's not safe in the general case.  In my case,
LookupAccountName('timr2-pc', 'timr') produces a very different result
from LookupAccountName('probo','timr').

BTW, I've tried your code on XP and on Win 7 64, and in both cases I get
the full string including the last set of digits.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list