mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Merge pull request #1669 from bluepilledgreat/bugfix/block-admin
Disable the ability to install in admin mode
This commit is contained in:
commit
f0cd3fbebc
@ -138,6 +138,14 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
Paths.Initialize(BaseDirectory);
|
Paths.Initialize(BaseDirectory);
|
||||||
|
|
||||||
|
// disallow running as administrator except for uninstallation
|
||||||
|
if (Utilities.IsAdministrator && !LaunchSettings.IsUninstall)
|
||||||
|
{
|
||||||
|
Frontend.ShowMessageBox(Bloxstrap.Resources.Strings.Bootstrapper_RanInAdminMode, MessageBoxImage.Error);
|
||||||
|
Terminate(ErrorCode.ERROR_INVALID_FUNCTION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// we shouldn't save settings on the first run until the first installation is finished,
|
// we shouldn't save settings on the first run until the first installation is finished,
|
||||||
// just in case the user decides to cancel the install
|
// just in case the user decides to cancel the install
|
||||||
if (!IsFirstRun)
|
if (!IsFirstRun)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
public enum ErrorCode
|
public enum ErrorCode
|
||||||
{
|
{
|
||||||
ERROR_SUCCESS = 0,
|
ERROR_SUCCESS = 0,
|
||||||
|
ERROR_INVALID_FUNCTION = 1,
|
||||||
ERROR_INSTALL_USEREXIT = 1602,
|
ERROR_INSTALL_USEREXIT = 1602,
|
||||||
ERROR_INSTALL_FAILURE = 1603,
|
ERROR_INSTALL_FAILURE = 1603,
|
||||||
ERROR_CANCELLED = 1223,
|
ERROR_CANCELLED = 1223,
|
||||||
|
9
Bloxstrap/Resources/Strings.Designer.cs
generated
9
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -153,6 +153,15 @@ namespace Bloxstrap.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Bloxstrap does not support running in administrator mode. Relaunch or reinstall Bloxstrap with lower privileges..
|
||||||
|
/// </summary>
|
||||||
|
public static string Bootstrapper_RanInAdminMode {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Bootstrapper.RanInAdminMode", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Applying Roblox modifications....
|
/// Looks up a localized string similar to Applying Roblox modifications....
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -150,6 +150,9 @@ Your ReShade configuration files will still be saved, and you can locate them by
|
|||||||
<data name="Bootstrapper.NotEnoughSpace" xml:space="preserve">
|
<data name="Bootstrapper.NotEnoughSpace" xml:space="preserve">
|
||||||
<value>Bloxstrap does not have enough disk space to download and install Roblox. Please free up some disk space and try again.</value>
|
<value>Bloxstrap does not have enough disk space to download and install Roblox. Please free up some disk space and try again.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Bootstrapper.RanInAdminMode" xml:space="preserve">
|
||||||
|
<value>Bloxstrap does not support running in administrator mode. Relaunch or reinstall Bloxstrap with lower privileges.</value>
|
||||||
|
</data>
|
||||||
<data name="Bootstrapper.Status.ApplyingModifications" xml:space="preserve">
|
<data name="Bootstrapper.Status.ApplyingModifications" xml:space="preserve">
|
||||||
<value>Applying Roblox modifications...</value>
|
<value>Applying Roblox modifications...</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Security.Principal;
|
||||||
|
|
||||||
namespace Bloxstrap
|
namespace Bloxstrap
|
||||||
{
|
{
|
||||||
static class Utilities
|
static class Utilities
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Is process running as administrator
|
||||||
|
/// https://stackoverflow.com/a/11660205
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsAdministrator =>
|
||||||
|
new WindowsPrincipal(WindowsIdentity.GetCurrent())
|
||||||
|
.IsInRole(WindowsBuiltInRole.Administrator);
|
||||||
|
|
||||||
public static void ShellExecute(string website)
|
public static void ShellExecute(string website)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user