Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

BuildTrusteeWithSid (advapi32)
 
.
Summary
TODO - a short description

C# Signature:

[DllImport("advapi32.dll", SetLastError = true)]
private static extern void BuildTrusteeWithSid(ref TRUSTEE pTrustee, IntPtr sid);
[DllImport("advapi32.dll", SetLastError=true)]
static extern TODO BuildTrusteeWithSid(TODO);

VB Signature:

    Private Declare Auto Sub BuildTrusteeWithSid Lib "advapi32.dll" ( _
    ByVal pTrustee As IntPtr, _
    ByVal pSid As IntPtr _
    )

User-Defined Types:

TRUSTEE

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

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions