Desktop Functions: Smart Device Functions:
|
LookupPrivilegeDisplayName (advapi32)
C# Signature:
[DllImport("advapi32.dll", SetLastError=true)] VB Signature:
Declare Function LookupPrivilegeDisplayName Lib "advapi32.dll" (TODO) As TODO User-Defined Types:None. Notes:If it returns false, you'll need to call Marshal.GetLastWin32Error() and handle at least these errors:
const int ERROR_INSUFFICIENT_BUFFER = 122; This is one of those "call twice" functions, so this error is just daily life. When it returns with this error, the byte count (cbDisplayName) will be set to what you need. Call EnsureCapacity on your StringBuilder and go round again.
const int ERROR_NO_SUCH_PRIVILEGE = 1313; The privileges that Windows knows about vary from one system to another. If you run your code on a Windows version other than the one you developed it on, you'll need to handle this one. TODO Does anyone know where to find a definitive reference for which privileges are present on a given OS? There doesn't seem to be an enumeration function Tips & Tricks:Please add some! Sample Code:Please add some! Alternative Managed API:Do you know one? Please contribute it! Please edit this page!Do you have...
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). |
|