-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
b2s tools should not allow to be run as admin #75
- Loading branch information
1 parent
b366324
commit bfd7f4d
Showing
4 changed files
with
44 additions
and
3 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
12 changes: 12 additions & 0 deletions
12
b2s_screenresidentifier/b2s_screenresidentifier/B2S_ScreenResIdentifier.vb
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 |
---|---|---|
@@ -1,13 +1,25 @@ | ||
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 |
10 changes: 10 additions & 0 deletions
10
b2sbackglassserverexe/b2sbackglassserverexe/Classes/B2SBackglassServerEXE.vb
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 |
---|---|---|
@@ -1,13 +1,23 @@ | ||
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 |
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