mirror of
https://github.com/kimmknight/remoteapptool.git
synced 2025-10-09 08:58:08 +00:00
Fixes issue 4
Fixes issue 4 Rebased off of host master to reduce the chance of a merge conflict * rdpsign.vb: updated to dynamically determine the path to rdpsign.exe * rdpsign.vb: updated to show an error if rdpsign.exe cannot be found (now imports system.windows.forms for MessageBox) * Create Client Connection window: Made some visual + text changes * Create Client Connection window: Disable the signing section if rdpsign.exe not detected or if no certificates are found * Create Client Connection window: Change "Disabled" checkbox text to "Sign RDP file" and reverse its logic (so that checked = sign rdp file) * Create Client Connection window: "Create Signed and Unsigned" checkbox is disabled + unticked if generating an MSI * Create Client Connection window: Certificate ComboBox defaults to the first certificate rather than blank * Create Client Connection window: Updated the save/reset settings to include the new signing section * Create Client Connection window: Updated the Tab-Order
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
Public Class RDPSign
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Public Class RDPSign
|
||||
Public ErrorNumber As Integer = 0
|
||||
Public ErrorString As String = ""
|
||||
|
||||
Sub main()
|
||||
|
||||
End Sub
|
||||
@@ -101,25 +104,37 @@
|
||||
End If
|
||||
|
||||
'If we get here, we should be good to run the command to sign the RDP file.
|
||||
Dim Command As String = "C:\Windows\System32\rdpsign.exe"
|
||||
Dim Arguments As String
|
||||
Dim FileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Command)
|
||||
' On my windows 10 computer, the argument is /sha256 instead of /sha1. /sha1 doesn't work.
|
||||
' On my windows 10 computer, the Product parts come in at 10.0.18362.1
|
||||
' On a Windows Server 2008 R2 server I have access to, the argument is /sha1.
|
||||
' On a Windows Server 2008 R2 server I have access to, the Product parts come in at 6.1.7601.17514 which is lower than the windows 10 ones.
|
||||
' I do not have other versions of windows to test, so will need external testing for this.
|
||||
' Not sure where the version number switches over, but also not sure how to determine which method to use otherwise
|
||||
If (FileVersionInfo.ProductMajorPart >= 10) Then
|
||||
Arguments = " /sha256 " & Thumbprint & " """ & RDPFileLocation & """"
|
||||
Dim Command As String = GetSysDir() & "\rdpsign.exe"
|
||||
If My.Computer.FileSystem.FileExists(Command) Then
|
||||
Dim Arguments As String
|
||||
Dim FileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Command)
|
||||
' On my windows 10 computer, the argument is /sha256 instead of /sha1. /sha1 doesn't work.
|
||||
' On my windows 10 computer, the Product parts come in at 10.0.18362.1
|
||||
' On a Windows Server 2008 R2 server I have access to, the argument is /sha1.
|
||||
' On a Windows Server 2008 R2 server I have access to, the Product parts come in at 6.1.7601.17514 which is lower than the windows 10 ones.
|
||||
' I do not have other versions of windows to test, so will need external testing for this.
|
||||
' Not sure where the version number switches over, but also not sure how to determine which method to use otherwise
|
||||
If (FileVersionInfo.ProductMajorPart >= 10) Then
|
||||
Arguments = " /sha256 " & Thumbprint & " """ & RDPFileLocation & """"
|
||||
|
||||
Else
|
||||
Arguments = " /sha1 " & Thumbprint & " """ & RDPFileLocation & """"
|
||||
End If
|
||||
Dim StartInfo As New ProcessStartInfo
|
||||
StartInfo.FileName = Command
|
||||
StartInfo.Arguments = Arguments
|
||||
StartInfo.WindowStyle = ProcessWindowStyle.Hidden
|
||||
Process.Start(StartInfo)
|
||||
Else
|
||||
Arguments = " /sha1 " & Thumbprint & " """ & RDPFileLocation & """"
|
||||
MessageBox.Show("RDPSign executable not found:" & vbNewLine & vbNewLine & Command, My.Application.Info.AssemblyName, MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||
End If
|
||||
Dim StartInfo As New ProcessStartInfo
|
||||
StartInfo.FileName = Command
|
||||
StartInfo.Arguments = Arguments
|
||||
StartInfo.WindowStyle = ProcessWindowStyle.Hidden
|
||||
Process.Start(StartInfo)
|
||||
|
||||
End Sub
|
||||
|
||||
Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
|
||||
|
||||
Function GetSysDir() As String
|
||||
Return Environment.SystemDirectory.ToString
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
@@ -48,6 +48,7 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
Reference in New Issue
Block a user