|
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
/// <content>
/// Contains extern methods from "POWRPROF.dll".
/// </content>
internal static partial class PInvoke
{
/// <summary>Suspends the system by shutting power down. Depending on the Hibernate parameter, the system either enters a suspend (sleep) state or hibernation (S4).</summary>
/// <param name="bHibernate">
/// <para>If this parameter is <b>TRUE</b>, the system hibernates. If the parameter is <b>FALSE</b>, the system is suspended.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/powrprof/nf-powrprof-setsuspendstate#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="bForce">This parameter has no effect.</param>
/// <param name="bWakeupEventsDisabled">
/// <para>If this parameter is <b>TRUE</b>, the system disables all wake events. If the parameter is <b>FALSE</b>, any system wake events remain enabled.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/powrprof/nf-powrprof-setsuspendstate#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call <a href="https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a>.</para>
/// </returns>
/// <remarks>
/// <para>The calling process must have the <b>SE_SHUTDOWN_NAME</b> privilege. To enable the <b>SE_SHUTDOWN_NAME</b> privilege, use the <a href="https://docs.microsoft.com/windows/desktop/api/securitybaseapi/nf-securitybaseapi-adjusttokenprivileges">AdjustTokenPrivileges</a> function. For more information, see <a href="https://docs.microsoft.com/windows/desktop/SecBP/changing-privileges-in-a-token">Changing Privileges in a Token</a>. An application may use <b>SetSuspendState</b> to transition the system from the working state to the standby (sleep), or optionally, hibernate (S4) state. This function is similar to the <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-setsystempowerstate">SetSystemPowerState</a> function. For more information on using PowrProf.h, see <a href="https://docs.microsoft.com/windows/desktop/Power/power-schemes">Power Schemes</a>. For information about events that can wake the system, see <a href="https://docs.microsoft.com/windows/desktop/Power/system-wake-up-events">System Wake-up Events</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/powrprof/nf-powrprof-setsuspendstate#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[SupportedOSPlatform("windows5.1.2600")]
internal static winmdroot.Foundation.BOOLEAN SetSuspendState(winmdroot.Foundation.BOOLEAN bHibernate, winmdroot.Foundation.BOOLEAN bForce, winmdroot.Foundation.BOOLEAN bWakeupEventsDisabled)
{
Marshal.SetLastSystemError(0);
winmdroot.Foundation.BOOLEAN __retVal = LocalExternFunction(bHibernate, bForce, bWakeupEventsDisabled);
Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
return __retVal;
[DllImport("POWRPROF.dll", ExactSpelling = true, EntryPoint = "SetSuspendState"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
static extern winmdroot.Foundation.BOOLEAN LocalExternFunction(winmdroot.Foundation.BOOLEAN bHibernate, winmdroot.Foundation.BOOLEAN bForce, winmdroot.Foundation.BOOLEAN bWakeupEventsDisabled);
}
}
}
|