Skip to content

Commit

Permalink
Revert "b2s tools should not allow to be run as admin #75"
Browse files Browse the repository at this point in the history
This reverts commit bfd7f4d.
  • Loading branch information
JockeJarre committed Mar 20, 2024
1 parent 107a1f9 commit 6f13aef
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 35 deletions.
14 changes: 1 addition & 13 deletions B2SWindowPunch/B2SWindowPunch/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Text.RegularExpressions;
using System.ComponentModel;
using System.Drawing;
using System.Security.Principal;
using System.Windows.Forms;
using Microsoft.Win32;

Expand Down Expand Up @@ -75,20 +74,9 @@ public class Options
public string cutter { get; set; }

}
private static bool IsAdmin()
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}

private static int Main(string[] args)
{
if (IsAdmin())
{
PrintUsage();
Console.WriteLine("You should not start B2SWindowPunch as Administrator!");
return 1;
}
string[] cargs = Environment.GetCommandLineArgs();
Options inputOptions = new Options();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
Imports System
Imports System.Drawing
Imports System.IO
Imports System.Security.Principal
Imports System.Windows.Forms
Imports Microsoft.Win32
Imports MessageBox = System.Windows.MessageBox

Module B2S_ScreenResIdentifier
Sub Main()
If IsAdmin() Then
MessageBox.Show("You should not start this as Administrator!", My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
Exit Sub
End If

Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(New formPlayfield())
End Sub
Private Function IsAdmin() As Boolean
Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim principal As New WindowsPrincipal(identity)
Return principal.IsInRole(WindowsBuiltInRole.Administrator)
End Function
End Module
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
Imports System
Imports System.Drawing
Imports System.IO
Imports System.Security.Principal
Imports System.Windows.Forms
Imports Microsoft.Win32

Module B2SBackglassServerEXE
Sub Main()
If IsAdmin() Then
MessageBox.Show("You should not start this as Administrator!", My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
Exit Sub
End If
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(New formBackglass())
End Sub
Private Function IsAdmin() As Boolean
Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim principal As New WindowsPrincipal(identity)
Return principal.IsInRole(WindowsBuiltInRole.Administrator)
End Function
End Module

0 comments on commit 6f13aef

Please sign in to comment.