Skip to content

Commit

Permalink
Initial Hyper-V stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinDrab committed Mar 1, 2021
1 parent 84b6119 commit 8617fb5
Show file tree
Hide file tree
Showing 18 changed files with 725 additions and 57 deletions.
84 changes: 60 additions & 24 deletions gui/ConnectorSelectionForm.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object ConnectorSelectionFrm: TConnectorSelectionFrm
Top = 0
BorderIcons = [biSystemMenu]
Caption = 'Connect to the driver'
ClientHeight = 219
ClientHeight = 291
ClientWidth = 320
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Expand All @@ -20,20 +20,18 @@ object ConnectorSelectionFrm: TConnectorSelectionFrm
Left = 0
Top = 0
Width = 320
Height = 185
ActivePage = DeviceTabSheet
Height = 255
ActivePage = NetworkTabSheet
Align = alTop
TabOrder = 0
object NoneTabSheet: TTabSheet
Caption = 'None'
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 0
ExplicitHeight = 157
end
object DeviceTabSheet: TTabSheet
Caption = 'Device'
ImageIndex = 1
ExplicitHeight = 157
object Label1: TLabel
Left = 8
Top = 8
Expand All @@ -52,34 +50,50 @@ object ConnectorSelectionFrm: TConnectorSelectionFrm
object NetworkTabSheet: TTabSheet
Caption = 'Network'
ImageIndex = 2
ExplicitLeft = 0
ExplicitTop = 28
object DomainLabel: TLabel
Left = 3
Top = 0
Top = 8
Width = 49
Height = 13
Caption = 'Domain/IP'
end
object PortLabel: TLabel
Left = 3
Top = 38
Top = 35
Width = 20
Height = 13
Caption = 'Port'
end
object VSockVersionLabel: TLabel
Left = 0
Top = 88
Top = 85
Width = 66
Height = 13
Caption = 'vSock version'
end
object VSockAddressLabel: TLabel
Left = 5
Top = 115
Left = -4
Top = 112
Width = 69
Height = 13
Caption = 'vSock address'
end
object HyperVVMLabel: TLabel
Left = 3
Top = 139
Width = 56
Height = 13
Caption = 'Hyper-V VM'
end
object HyperVAppLabel: TLabel
Left = 3
Top = 166
Width = 61
Height = 13
Caption = 'Hyper-V App'
end
object NetworkDomainEdit: TEdit
Left = 80
Top = 8
Expand All @@ -94,36 +108,58 @@ object ConnectorSelectionFrm: TConnectorSelectionFrm
Height = 21
TabOrder = 1
end
object VSocketCheckBox: TCheckBox
Left = 80
Top = 62
Width = 129
Height = 17
Caption = 'Use VMWare sockets'
TabOrder = 2
OnClick = VSocketCheckBoxClick
end
object VSockVersionEdit: TEdit
Left = 80
Top = 85
Width = 129
Height = 21
ReadOnly = True
TabOrder = 3
TabOrder = 2
end
object VSockAddressEdit: TEdit
Left = 80
Top = 112
Width = 129
Height = 21
ReadOnly = True
TabOrder = 3
end
object NetworkTypeComboBox: TComboBox
Left = 80
Top = 58
Width = 129
Height = 21
Style = csDropDownList
ItemIndex = 0
TabOrder = 4
Text = 'Classic (Ethernet)'
OnClick = NetworkTypeComboBoxClick
Items.Strings = (
'Classic (Ethernet)'
'VMWare vSockets'
'Microsoft Hyper-V')
end
object HyperVVMIdEdit: TEdit
Left = 80
Top = 139
Width = 129
Height = 21
ReadOnly = True
TabOrder = 5
end
object HyperVAppIdEdit: TEdit
Left = 80
Top = 166
Width = 129
Height = 21
ReadOnly = True
TabOrder = 6
end
end
end
object OkButton: TButton
Left = 200
Top = 187
Top = 261
Width = 57
Height = 30
Caption = 'Ok'
Expand All @@ -132,7 +168,7 @@ object ConnectorSelectionFrm: TConnectorSelectionFrm
end
object StornoButton: TButton
Left = 263
Top = 187
Top = 261
Width = 57
Height = 30
Caption = 'Storno'
Expand Down
64 changes: 43 additions & 21 deletions gui/ConnectorSelectionForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@
PortLabel: TLabel;
NetworkDomainEdit: TEdit;
NetworkPortEdit: TEdit;
VSocketCheckBox: TCheckBox;
VSockVersionEdit: TEdit;
VSockAddressEdit: TEdit;
VSockVersionLabel: TLabel;
VSockAddressLabel: TLabel;
NetworkTypeComboBox: TComboBox;
HyperVVMIdEdit: TEdit;
HyperVAppIdEdit: TEdit;
HyperVVMLabel: TLabel;
HyperVAppLabel: TLabel;
procedure StornoButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure VSocketCheckBoxClick(Sender: TObject);
procedure NetworkTypeComboBoxClick(Sender: TObject);
Private
FConnectionType : EIRPMonConnectorType;
FCancelled : Boolean;
Expand All @@ -39,6 +43,8 @@
FNetworkPort : WideString;
FVSockTargetAddress : Cardinal;
FVSockTargetPort : Cardinal;
FHyperVVMId : TGuid;
FHyperVAppId : TGuid;
Function IsWOW64:Boolean;
Public
Property Cancelled : Boolean Read FCancelled;
Expand All @@ -48,6 +54,8 @@
Property NetworkPort : WideString Read FNetworkPort;
Property VSockTargetAddress : Cardinal Read FVSockTargetAddress;
Property VSockTargetPort : Cardinal Read FVSockTargetPort;
Property HyperVVMId : TGuid Read FHyperVVMId;
Property HyperVAppId : TGuid Read FHyperVAppId;
end;

Implementation
Expand All @@ -72,6 +80,24 @@
Result := b;
end;

Procedure TConnectorSelectionFrm.NetworkTypeComboBoxClick(Sender: TObject);
begin
Case NetworkTypeComboBox.ItemIndex Of
0 : begin
DomainLabel.Caption := 'Domain/IP';
PortLabel.Caption := 'Port';
end;
1 : begin
DomainLabel.Caption := 'CID';
PortLabel.Caption := 'Port';
end;
2 : begin
DomainLabel.Caption := 'VM GUID';
PortLabel.Caption := 'App GUID';
end;
end;
end;

Procedure TConnectorSelectionFrm.FormCreate(Sender: TObject);
Var
vnciVersion : Cardinal;
Expand All @@ -85,7 +111,6 @@
end;

vnciVersion := VSockConn_VMCIVersion;
VSocketCheckBox.Enabled := (vnciVersion <> VNCI_VERSION_INVALID);
If vnciVersion <> VNCI_VERSION_INVALID Then
begin
vnciAddress := VSockConn_LocalId;
Expand All @@ -105,15 +130,21 @@
ictNone: ;
ictDevice: FDeviceName := DeviceNameEdit.Text;
ictNetwork: begin
If VSocketCheckBox.Checked THen
begin
FConnectionType := ictVSockets;
FVSockTargetAddress := StrToUInt(NetworkDomainEdit.Text);
FVSockTargetPort := StrToUInt(NetworkPortEdit.Text);
end
Else begin
FNetworkAddress := NetworkDomainEdit.Text;
FNetworkPort := NetworkPortEdit.Text;
Case NetworkTypeComboBox.ItemIndex Of
0 : begin
FNetworkAddress := NetworkDomainEdit.Text;
FNetworkPort := NetworkPortEdit.Text;
end;
1 : begin
FConnectionType := ictVSockets;
FVSockTargetAddress := StrToUInt(NetworkDomainEdit.Text);
FVSockTargetPort := StrToUInt(NetworkPortEdit.Text);
end;
2 : begin
FConnectionType := ictHyperV;
FHyperVVMId := StringToGuid(NetworkDomainEdit.Text);
FHyperVAppId := StringToGuid(NetworkPortEdit.Text);
end;
end;
end;
end;
Expand All @@ -127,14 +158,5 @@
Close;
end;

Procedure TConnectorSelectionFrm.VSocketCheckBoxClick(Sender: TObject);
begin
If VSocketCheckBox.Checked Then
begin
DomainLabel.Caption := 'Context ID';
end
Else DomainLabel.Caption := 'Domain/IP';
end;

End.

4 changes: 4 additions & 0 deletions gui/IRPMon.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ Begin
initInfo.VMCICID := VSockTargetAddress;
initInfo.VMCIPort := VSockTargetPort;
end;
ictHyperV : begin
initInfo.VMId := HyperVVMId;
initInfo.AppGuid := HyperVAppId;
end;
end;
end;
end;
Expand Down
Loading

0 comments on commit 8617fb5

Please sign in to comment.