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

SaferCreateLevel (advapi32)
 
.
Summary
The SaferCreateLevel function opens a SAFER_LEVEL_HANDLE.

C# Signature:

[DllImport("advapi32", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
public static extern bool SaferCreateLevel(uint dwScopeId, uint dwLevelId, int OpenFlags, out IntPtr
  pLevelHandle, IntPtr lpReserved);

VB Signature:

Declare Function SaferCreateLevel Lib "advapi32.dll" (ByVal dwScopeId As Long, ByVal dwLevelId As Long, ByVal OpenFlags As Long, pLevelHandle As Long, ByVal lpReserved As Long) As Long

User-Defined Types:

With these optional Enums:

[Flags]
public enum SaferLevelEnum
{
   Disallowed = 0,
   Untrusted = 0x1000,
   Constrained = 0x10000,
   NormalUser = 0x20000,
   FullyTrusted = 0x40000
}

[Flags]
public enum SaferScopeEnum
{
   Machine = 1,
   User = 2
}

You can then declare SaferCreateLevel as:

[DllImport("advapi32", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
public static extern bool SaferCreateLevel(uint dwScopeId, uint dwLevelId, int OpenFlags, out IntPtr
  pLevelHandle, IntPtr lpReserved);

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

Don't forget to close the handle using SaferCloseLevel.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

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