Sign in to follow this  
Followers 0
Jaque

Help for DllCall (advapi32.dll)

3 posts in this topic

Could someone tell me it is possible to use the LookupAccountSid and ConvertSidToStringSid function from advapi32.dll in AutoIt?

More information can be found here:

http://msdn.microsoft.com/library/en-us/se...paccountsid.asp

and

http://msdn.microsoft.com/library/en-us/se...tostringsid.asp

For an example binary Sid value look in the registry key HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\<SID string>\Sid

I would like to convert this binary Sid to the Username, but I don't know how to do this in AutoIt.

Could someone tell me how to do this in Autoit?

Share this post


Link to post
Share on other sites



Could someone tell me it is possible to use the LookupAccountSid and ConvertSidToStringSid function from advapi32.dll in AutoIt?

Ways too complex, as you will have to fill the SID structure. It's most probably possible with DllCreateStruct, but you can achieve your goal much easier with WMI. Here is a VB Script example. Just translate it to AutoIT and you'll get all the information you need. SID <--> Account Name.

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Account",,48)
For Each objItem in colItems
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "Domain: " & objItem.Domain
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "SID: " & objItem.SID
    Wscript.Echo "SIDType: " & objItem.SIDType
    Wscript.Echo "Status: " & objItem.Status
Next

or check out scriptomatic. http://www.autoitscript.com/forum/index.ph...opic=10534&st=0

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Ways too complex, as you will have to fill the SID structure. It's most probably possible with DllCreateStruct, but you can achieve your goal much easier with WMI. Here is a VB Script example. Just translate it to AutoIT and you'll get all the information you need. SID <--> Account Name.

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Account",,48)
For Each objItem in colItems
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "Domain: " & objItem.Domain
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "SID: " & objItem.SID
    Wscript.Echo "SIDType: " & objItem.SIDType
    Wscript.Echo "Status: " & objItem.Status
Next

or check out scriptomatic. http://www.autoitscript.com/forum/index.ph...opic=10534&st=0

Cheers

Kurt

<{POST_SNAPBACK}>

Kurt,

You are right to say that WMI is easier, however it will get you only the sid for the user account and does not convert to string as does the DLL function. To get this value you will have to use the ConvertSidToStringSid output or convert the SID into a binary by using AutoIT.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0