Hey Guys,
I need to convert a binary SID to it's decimal value e.g S-1-5-21- etc
I've spent all yesterday evening trying to google this. I don't mind code in any language, although c# is preferable but yea, I just need the solution, if anybody knows anything or can assist in anyway??
Many Thanks
Forg
Loading
Steve CordonPosted Aug 27, 2009, 12:36 PM
Many Thanks
Kirtan PatelPosted Aug 27, 2009, 12:14 PM
dont fotget to mark "Do you like Answer" please it will give me some credits :)
using System.Security.Principal;
private void button1_Click(object sender, EventArgs e)
{
string sidStr = "S-1-5-18";
SecurityIdentifier sid = new SecurityIdentifier(sidStr);
byte[] bSID = new byte[sid.BinaryLength];
sid.GetBinaryForm(bSID,0);
string ResultDecimalSid= "";
foreach ( byte b in bSID)
{
ResultDecimalSid +=b.ToString("X2");
}
MessageBox.Show(ResultDecimalSid);
}
Steve CordonPosted Aug 27, 2009, 12:03 PM
010100000000000512000000 as input would give S-1-5-18
Thank you
Kirtan PatelPosted Aug 27, 2009, 11:56 AM
SID and What you want as result i will help you
i mean what you will pass as input and what you want .