forked from stevencohn/OneMore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify OneNote registration at installation
- Loading branch information
1 parent
8a40725
commit ca8d224
Showing
6 changed files
with
850 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//************************************************************************************************ | ||
// Copyright © 2021 Steven M Cohn. All rights reserved. | ||
//************************************************************************************************ | ||
|
||
namespace OneMoreSetupActions | ||
{ | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
|
||
/// <summary> | ||
/// Confirms that the installer bitness matches the OS bitness | ||
/// </summary> | ||
internal class CheckBitnessAction : CustomAction | ||
{ | ||
private readonly bool x64; | ||
|
||
|
||
public CheckBitnessAction(Logger logger, Stepper stepper, bool x64) | ||
: base(logger, stepper) | ||
{ | ||
this.x64 = x64; | ||
} | ||
|
||
|
||
public override int Install() | ||
{ | ||
logger.WriteLine(); | ||
logger.WriteLine("CheckBitnessAction.Install ---"); | ||
|
||
var oarc = Environment.Is64BitOperatingSystem ? "x64" : "x86"; | ||
var iarc = Environment.Is64BitProcess ? "x64" : "x86"; | ||
var rarc = x64 ? "x64" : "x86"; | ||
logger.WriteLine($"Installer architecture ({iarc}), OS architecture ({oarc}), requesting ({rarc})"); | ||
|
||
if (Environment.Is64BitOperatingSystem != Environment.Is64BitProcess || | ||
Environment.Is64BitOperatingSystem != x64) | ||
{ | ||
var msg = $"Installer architecture ({iarc}) does not match OS ({oarc}) or request ({rarc})"; | ||
logger.WriteLine(msg); | ||
|
||
MessageBox.Show(msg, | ||
"Incompatible Installer", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
|
||
return FAILURE; | ||
} | ||
|
||
return SUCCESS; | ||
} | ||
|
||
|
||
public override int Uninstall() | ||
{ | ||
return SUCCESS; | ||
} | ||
} | ||
} |
Oops, something went wrong.