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

PowerSettingAccessCheck (powrprof)
 
.
Summary
Queries for a group policy override for specified power settings.

C# Signature:

     /* http://msdn2.microsoft.com/en-us/library/aa372761.aspx */

    /// <summary>
    /// Full call to Vista method PowerSettingAccessCheck().
    /// </summary>
    /// <param name="accessFlags">One or more check specifier flags</param>
    /// <param name="powerGuid">The relevant Power Policy GUID</param>
    /// <param name="AccessFlags">One or more check specifier flags</param>
    /// <param name="PowerGuid">The relevant Power Policy GUID</param>
    /// <returns></returns>
    [DllImport("PowrProf.dll", CharSet = CharSet.Auto, SetLastError = true)]
    [DllImport("powerprof.dll", CharSet = CharSet.Auto, SetLastError = true)]
    [return: MarshalAs(UnmanagedType.U4)]
    internal static extern UInt32 PowerSettingAccessCheck(
                            PowerSettingAccessFlags accessFlags,
                            [MarshalAs(UnmanagedType.LPStruct)] Guid powerGuid
                            POWER_DATA_ACCESSOR AccessFlags,
                            [MarshalAs(UnmanagedType.LPStruct)] Guid PowerGuid
                            );

    /// <summary>
    /// Partial call to Vista method PowerSettingAccessCheck() supporting null GUID parameter.
    /// </summary>
    /// <param name="accessFlags">One or more check specifier flags</param>
    /// <param name="powerGuid">null</param>
    /// <param name="AccessFlags">One or more check specifier flags</param>
    /// <param name="PowerGuid">null</param>
    /// <returns></returns>
    [DllImport("PowrProf.dll", CharSet = CharSet.Auto, SetLastError = true)]
    [DllImport("powerprof.dll", CharSet = CharSet.Auto, SetLastError = true)]
    [return: MarshalAs(UnmanagedType.U4)]
    private static extern UInt32 PowerSettingAccessCheck(
                            PowerSettingAccessFlags accessFlags,
                            IntPtr powerGuid
    internal static extern UInt32 PowerSettingAccessCheck(
                            POWER_DATA_ACCESSOR AccessFlags,
                            IntPtr PowerGuid
                            );

    /// <summary>
    /// Full call to Vista method PowerSettingAccessCheck() supporting empty power setting identifier.
    /// </summary>
    /// <param name="accessFlags">One or more check specifier flags</param>
    /// <returns></returns>
    internal static UInt32 PowerSettingAccessCheck(PowerSettingAccessFlags accessFlags)
    {
        return PowerSettingAccessCheck(accessFlags, IntPtr.Zero);
    }

    #region Group Policy Access FlagsAttribute

    [Flags]
    public enum PowerSettingAccessFlags
    public enum POWER_DATA_ACCESSOR
    {
        /// <summary>
        /// Check for overrides on AC power settings.
        /// </summary>
        ACCESS_AC_POWER_SETTING_INDEX = 0x0,
        /// <summary>
        /// Check for overrides on DC power settings.
        /// </summary>
        ACCESS_DC_POWER_SETTING_INDEX = 0x1,
        /// <summary>
        /// Check for restrictions on specific power schemes.
        /// </summary>
        ACCESS_SCHEME = 0x10,
        /// <summary>
        /// Check for restrictions on active power schemes.
        /// </summary>
        ACCESS_ACTIVE_SCHEME = 0x13,
        /// <summary>
        /// Check for restrictions on creating or restoring power schemes.
        /// </summary>
        ACCESS_CREATE_SCHEME = 0x14
    };

    #endregion

VB Signature:

Declare Function PowerSettingAccessCheck Lib "powrprof.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

This function is only available from Vista.

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