-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,321 additions
and
1 deletion.
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
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> | ||
</startup> | ||
</configuration> |
239 changes: 239 additions & 0 deletions
239
tools/windows-installer/NoPortsHealthCheck/Form1.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,58 @@ | ||
using Microsoft.Win32; | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
namespace NoPortsHealthCheck | ||
{ | ||
public partial class Form1 : Form | ||
{ | ||
static readonly string userHome = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); | ||
static readonly string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); | ||
readonly bool isUserAdmin = Program.IsUserAdmin(); | ||
readonly bool canWriteUserHome = Program.CanWriteToDirectory(userHome); | ||
readonly bool canWriteLocalAppData = Program.CanWriteToDirectory(localAppData); | ||
readonly bool canWriteNetworkService = Program.CanWriteToDirectory(Environment.ExpandEnvironmentVariables("%systemroot%") | ||
+ @"\ServiceProfiles\LocalService\"); | ||
readonly bool canWriteRegistry = Program.CanWriteToRegistry(Registry.LocalMachine, "SOFTWARE\\TestKey"); | ||
readonly bool canModifyPath = Program.CanModifyEnvironmentVariable(); | ||
readonly bool canCreateServices = Program.CanCreateServices(); | ||
public Form1() | ||
{ | ||
InitializeComponent(); | ||
this.Text = "NoPorts Health Check"; | ||
checkBox1.Checked = isUserAdmin; | ||
if (isUserAdmin) | ||
{ | ||
Program.Log("User is Admin"); | ||
} | ||
else | ||
{ | ||
Program.Log("User is not Admin, try running as admin."); | ||
} | ||
checkBox2.Checked = canWriteUserHome; | ||
checkBox3.Checked = canWriteLocalAppData; | ||
checkBox4.Checked = canWriteNetworkService; | ||
checkBox5.Checked = canWriteRegistry; | ||
checkBox6.Checked = canModifyPath; | ||
checkBox7.Checked = canCreateServices; | ||
if (isUserAdmin && canWriteUserHome && canWriteLocalAppData && canWriteNetworkService && canWriteRegistry && canModifyPath && canCreateServices) | ||
{ | ||
Program.ShowSuccessLogs(); | ||
} | ||
if (!isUserAdmin) | ||
{ | ||
Program.ShowErrorLogs(); | ||
} | ||
} | ||
|
||
private void label8_Click(object sender, EventArgs e) | ||
{ | ||
|
||
} | ||
|
||
private void checkBox7_CheckedChanged(object sender, EventArgs e) | ||
{ | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.