Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than advapi32, prefix the name with the module name and a period.
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!
Identifies the user account, group account, or logon session to which an ACE applies
4/1/2014 11:16:42 PM - -202.32.254.242
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).