Desktop Functions:

   Smart Device Functions:

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

Terms of Use
Privacy Policy
getsidsubauthority (advapi32)
The GetSidSubAuthority function returns a pointer to a specified subauthority in a security identifier (SID). The subauthority value is a relative identifier (RID).

C# Signature:

[DllImport("advapi32.dll", SetLastError=true)]
static extern IntPtr GetSidSubAuthority(byte[] sid, UInt32 subAuthorityIndex);
[DllImport("advapi32.dll", SetLastError=true)]
static extern IntPtr GetSidSubAuthority(IntPtr sid, UInt32 subAuthorityIndex);

VB Signature:

Declare Function GetSidSubAuthority Lib "advapi32.dll" (ByVal psid As IntPtr, ByVal nSubAuthority As Integer) As IntPtr

User-Defined Types:




Tips & Tricks:

Please add some!

Sample Code:

' Note: the following code is an example but shouldn't be used in real life.

' The SubAuthority may be too big for an integer and needs an UInt32 but Marshal has nothing for unsigned types

Dim subAuthority As Integer = Runtime.InteropServices.Marshal.ReadInt32(GetSidSubAuthority(pSID, i), 0)

Alternative Managed API:

Do you know one? Please contribute it!


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 directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version