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

Kirtan PatelRank #292 · 8.6K reputationPosted Aug 27, 2009, 7:56 AM EDT
SID and What you want as result i will help you
i mean what you will pass as input and what you want .
Steve Cordon9 reputationPosted Aug 27, 2009, 8:03 AM EDT
010100000000000512000000 as input would give S-1-5-18
Thank you
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 27, 2009, 8:14 AM EDT
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 Cordon9 reputationPosted Aug 27, 2009, 8:36 AM EDT
Many Thanks