@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: TODO - a short description !!!!C# Signature: [DllImport("advapi32.dll", SetLastError = true)] private static extern void BuildTrusteeWithSid(ref TRUSTEE pTrustee, IntPtr sid); !!!!VB Signature: Private Declare Auto Sub BuildTrusteeWithSid Lib "advapi32.dll" ( _ ByVal pTrustee As IntPtr, _ ByVal pSid As IntPtr _ ) !!!!User-Defined Types: [TRUSTEE] !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!VB.Net Sample Code: Dim Domain, UserName As String Dim lenDomain, lenSid, peUse, LastError As Integer Dim Win32Error As Win32Exception Dim pSID as IntPtr Dim t As TRUSTEE ' do a "dry run" to get the size of the SID and Domain string LookupAccountName(Nothing, _UserName, Nothing, lenSid, Nothing, lenDomain, peUse) Domain = Space(lenDomain) pSID = Marshal.AllocHGlobal(lenSid) ' do it again, for real this time If LookupAccountName(Nothing, _UserName, pSID, lenSid, Domain, lenDomain, peUse) = False Then LastError = Marshal.GetLastWin32Error() Win32Error = New Win32Exception(LastError) Throw New Exception(Win32Error.Message) End If ' Build a trustee pTrustee = Marshal.AllocHGlobal(Marshal.SizeOf(t)) BuildTrusteeWithSid(pTrustee, pSID) !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: BuildTrusteeWithSid@msdn on MSDN
Edit advapi32.BuildTru...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.