Skip to content

Commit

Permalink
Added code to read signature URL of self executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylianst committed May 20, 2022
1 parent 4088f68 commit 5215576
Show file tree
Hide file tree
Showing 3 changed files with 400 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MeshCentralAssistant.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Management" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
Expand Down Expand Up @@ -162,6 +163,7 @@
<DependentUpon>SessionsForm.cs</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="WinCrypt.cs" />
<Compile Include="SnapShotForm.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
16 changes: 16 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,28 @@ static class Program
{
[ThreadStatic]
public static readonly bool IsMainThread = true;
public static Uri signedUrl = null;

public class CurrentAppContext : ApplicationContext
{
private static CurrentAppContext _currContext;

public CurrentAppContext() { if (_currContext == null) { _currContext = this; } }

public CurrentAppContext(Form AppMainForm) : this() { this.MainForm = AppMainForm; }

public CurrentAppContext CurrentContext { get { return _currContext; } }
}

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
// If this application is signed, get the URL of the signature, this will be used to lock this application to a server.
signedUrl = WinCrypt.GetSignatureUrl(System.Reflection.Assembly.GetEntryAssembly().Location);

if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware();

string update = null;
Expand Down Expand Up @@ -106,4 +121,5 @@ public static void UnhandledExceptionEventSink(object sender, UnhandledException
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
}

}
Loading

0 comments on commit 5215576

Please sign in to comment.