main logo
Subject: SID by SID <g>
Author: Paul Newton
Posted: 2006/09/30 14:04:42
 
View Entire Thread
New Search


Hi all

I have been looking at and playing with SIDs for Win2K/XP. I am trying
to emulate the functionality of Sysinternals's /PsGetSid.

/So far I have got two functions - GetComputerName (which is trivial
and returns the computer name, the same as SYS(0)) and GetSID which
works like this:

? GetSID("Foxpertise")
S-1-5-21-57989841-1801674531-839522115
? GetSID("Paul Newton")
S-1-5-21-57989841-1801674531-839522115-1000

GetComputerName calls GetComputername in kernel32

GetSID uses all of the following function calls:

LocalFree IN kernel32
LocalSize IN kernel32
LocalAlloc IN kernel32
GetUserName IN advapi32
LookupAccountName IN advapi32
ConvertSidToStringSid IN advapi32
RtlMoveMemory IN kernel32

Most of what I needed was here:
http://www.news2news.com/vfp/?group=-1&function=998

What I want to do now is the reverse/converse ie ?
SIDStringToName("S-1-5-21-57989841-1801674531-839522115-1000") should
return "Paul Newton"

In order to do this I know I will need, amongst others, the following
functions:

LookupAccountSid IN advapi32
ConvertStringSidToSid IN advapi32

I will probably need some other functions as well and at this point I am
stuck. News2News does not have an entry for ConvertStringSidToSid and
while it has has an entry for LookupAccountSid I am not able to get to
the accompanying code examples of its use.

Any help would be much appreciated - and of course, if anybody thinks
that these functions might be useful, I'm willing to out them on Ed's
download page.








 
©2006 Paul Newton
<-- Prior Message New Search Next Message -->