diff options
author | binarymaster <x86corez@gmail.com> | 2014-11-14 01:59:28 +0300 |
---|---|---|
committer | binarymaster <x86corez@gmail.com> | 2014-11-14 01:59:28 +0300 |
commit | bca7e90e484f85ab92222a8fa089dc027e2dd3f5 (patch) | |
tree | 6b544fd6d7b3a693f115be7a6904dce588c40fea /src-rdpconfig | |
parent | 9120dcc9ac3275e4c900aa882f49607a363e2d0c (diff) |
Added RDP Configuration Program
Diffstat (limited to 'src-rdpconfig')
-rw-r--r-- | src-rdpconfig/MainUnit.dcu | bin | 0 -> 11088 bytes | |||
-rw-r--r-- | src-rdpconfig/MainUnit.dfm | 112 | ||||
-rw-r--r-- | src-rdpconfig/MainUnit.pas | 202 | ||||
-rw-r--r-- | src-rdpconfig/RDPConf.dpr | 15 | ||||
-rw-r--r-- | src-rdpconfig/RDPConf.dproj | 107 | ||||
-rw-r--r-- | src-rdpconfig/RDPConf.res | bin | 0 -> 165700 bytes | |||
-rw-r--r-- | src-rdpconfig/manifest.res | bin | 0 -> 1836 bytes |
7 files changed, 436 insertions, 0 deletions
diff --git a/src-rdpconfig/MainUnit.dcu b/src-rdpconfig/MainUnit.dcu Binary files differnew file mode 100644 index 0000000..2e2f289 --- /dev/null +++ b/src-rdpconfig/MainUnit.dcu diff --git a/src-rdpconfig/MainUnit.dfm b/src-rdpconfig/MainUnit.dfm new file mode 100644 index 0000000..887995d --- /dev/null +++ b/src-rdpconfig/MainUnit.dfm @@ -0,0 +1,112 @@ +object MainForm: TMainForm + Left = 0 + Top = 0 + BorderStyle = bsDialog + Caption = 'Remote Desktop Protocol Configuration' + ClientHeight = 245 + ClientWidth = 326 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poDesktopCenter + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object lRDPPort: TLabel + Left = 203 + Top = 22 + Width = 47 + Height = 13 + Caption = 'RDP Port:' + end + object bOK: TButton + Left = 45 + Top = 212 + Width = 75 + Height = 25 + Caption = 'OK' + ModalResult = 1 + TabOrder = 0 + OnClick = bOKClick + end + object bCancel: TButton + Left = 126 + Top = 212 + Width = 75 + Height = 25 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 1 + OnClick = bCancelClick + end + object bApply: TButton + Left = 207 + Top = 212 + Width = 75 + Height = 25 + Caption = 'Apply' + Enabled = False + TabOrder = 2 + OnClick = bApplyClick + end + object cbSingleSessionPerUser: TCheckBox + Left = 8 + Top = 31 + Width = 130 + Height = 17 + Caption = 'Single Session Per User' + TabOrder = 3 + OnClick = cbAllowTSConnectionsClick + end + object rgNLA: TRadioGroup + Left = 8 + Top = 54 + Width = 310 + Height = 73 + Caption = 'Security Mode' + Items.Strings = ( + 'Disable Security (not recommended)' + 'Default Authentication (compatibility with older clients)' + 'Network Level Authentication (best)') + TabOrder = 4 + OnClick = cbAllowTSConnectionsClick + end + object cbAllowTSConnections: TCheckBox + Left = 8 + Top = 8 + Width = 174 + Height = 17 + Caption = 'Enable Remote Desktop Protocol' + TabOrder = 5 + OnClick = cbAllowTSConnectionsClick + end + object rgShadow: TRadioGroup + Left = 8 + Top = 133 + Width = 310 + Height = 73 + Caption = 'Session Shadowing Mode' + Items.Strings = ( + 'Disable Shadowing' + 'Shadowing will request user permission' + 'Shadowing sessions immediately') + TabOrder = 6 + OnClick = cbAllowTSConnectionsClick + end + object seRDPPort: TSpinEdit + Left = 256 + Top = 19 + Width = 62 + Height = 22 + MaxValue = 65535 + MinValue = 0 + TabOrder = 7 + Value = 0 + OnChange = seRDPPortChange + end +end diff --git a/src-rdpconfig/MainUnit.pas b/src-rdpconfig/MainUnit.pas new file mode 100644 index 0000000..5d7a033 --- /dev/null +++ b/src-rdpconfig/MainUnit.pas @@ -0,0 +1,202 @@ +unit MainUnit; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, Spin, ExtCtrls, Registry; + +type + TMainForm = class(TForm) + bOK: TButton; + bCancel: TButton; + bApply: TButton; + cbSingleSessionPerUser: TCheckBox; + rgNLA: TRadioGroup; + cbAllowTSConnections: TCheckBox; + rgShadow: TRadioGroup; + seRDPPort: TSpinEdit; + lRDPPort: TLabel; + procedure FormCreate(Sender: TObject); + procedure cbAllowTSConnectionsClick(Sender: TObject); + procedure seRDPPortChange(Sender: TObject); + procedure bApplyClick(Sender: TObject); + procedure bCancelClick(Sender: TObject); + procedure bOKClick(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + private + { Private declarations } + public + { Public declarations } + procedure ReadSettings; + procedure WriteSettings; + end; + +var + MainForm: TMainForm; + Ready: Boolean = False; + +implementation + +{$R *.dfm} +{$R manifest.res} + +procedure TMainForm.ReadSettings; +var + Reg: TRegistry; + SecurityLayer, UserAuthentication: Integer; +begin + Reg := TRegistry.Create; + Reg.RootKey := HKEY_LOCAL_MACHINE; + Reg.OpenKeyReadOnly('\SYSTEM\CurrentControlSet\Control\Terminal Server'); + try + cbAllowTSConnections.Checked := not Reg.ReadBool('fDenyTSConnections'); + except + + end; + try + cbSingleSessionPerUser.Checked := Reg.ReadBool('fSingleSessionPerUser'); + except + + end; + Reg.CloseKey; + + Reg.OpenKeyReadOnly('\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp'); + seRDPPort.Value := 3389; + try + seRDPPort.Value := Reg.ReadInteger('PortNumber'); + except + + end; + SecurityLayer := 0; + UserAuthentication := 0; + try + SecurityLayer := Reg.ReadInteger('SecurityLayer'); + UserAuthentication := Reg.ReadInteger('UserAuthentication'); + except + + end; + if (SecurityLayer = 0) and (UserAuthentication = 0) then + rgNLA.ItemIndex := 0; + if (SecurityLayer = 1) and (UserAuthentication = 0) then + rgNLA.ItemIndex := 1; + if (SecurityLayer = 2) and (UserAuthentication = 1) then + rgNLA.ItemIndex := 2; + try + rgShadow.ItemIndex := Reg.ReadInteger('Shadow'); + except + + end; + Reg.CloseKey; + Reg.Free; +end; + +procedure TMainForm.WriteSettings; +var + Reg: TRegistry; + SecurityLayer, UserAuthentication: Integer; +begin + Reg := TRegistry.Create; + Reg.RootKey := HKEY_LOCAL_MACHINE; + Reg.OpenKey('\SYSTEM\CurrentControlSet\Control\Terminal Server', True); + try + Reg.WriteBool('fDenyTSConnections', not cbAllowTSConnections.Checked); + except + + end; + try + Reg.WriteBool('fSingleSessionPerUser', cbSingleSessionPerUser.Checked); + except + + end; + Reg.CloseKey; + + Reg.OpenKey('\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp', True); + try + Reg.WriteInteger('PortNumber', seRDPPort.Value); + except + + end; + case rgNLA.ItemIndex of + 0: begin + SecurityLayer := 0; + UserAuthentication := 0; + end; + 1: begin + SecurityLayer := 1; + UserAuthentication := 0; + end; + 2: begin + SecurityLayer := 2; + UserAuthentication := 1; + end; + else begin + SecurityLayer := -1; + UserAuthentication := -1; + end; + end; + if SecurityLayer >= 0 then begin + try + Reg.WriteInteger('SecurityLayer', SecurityLayer); + Reg.WriteInteger('UserAuthentication', UserAuthentication); + except + + end; + end; + if rgShadow.ItemIndex >= 0 then begin + try + Reg.WriteInteger('Shadow', rgShadow.ItemIndex); + except + + end; + end; + Reg.CloseKey; + Reg.Free; +end; + +procedure TMainForm.cbAllowTSConnectionsClick(Sender: TObject); +begin + if Ready then + bApply.Enabled := True; +end; + +procedure TMainForm.seRDPPortChange(Sender: TObject); +begin + if Ready then + bApply.Enabled := True; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + ReadSettings; + Ready := True; +end; + +procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + if bApply.Enabled then + CanClose := MessageBox(Handle, 'Settings are not saved. Do you want to exit?', + 'Warning', mb_IconWarning or mb_YesNo) = mrYes; +end; + +procedure TMainForm.bOKClick(Sender: TObject); +begin + if bApply.Enabled then begin + WriteSettings; + bApply.Enabled := False; + end; + Close; +end; + +procedure TMainForm.bCancelClick(Sender: TObject); +begin + Close; +end; + +procedure TMainForm.bApplyClick(Sender: TObject); +begin + WriteSettings; + bApply.Enabled := False; +end; + +end. diff --git a/src-rdpconfig/RDPConf.dpr b/src-rdpconfig/RDPConf.dpr new file mode 100644 index 0000000..2076e60 --- /dev/null +++ b/src-rdpconfig/RDPConf.dpr @@ -0,0 +1,15 @@ +program RDPConf; + +uses + Forms, + MainUnit in 'MainUnit.pas' {MainForm}; + +{$R *.res} + +begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.Title := 'Remote Desktop Protocol Configuration'; + Application.CreateForm(TMainForm, MainForm); + Application.Run; +end. diff --git a/src-rdpconfig/RDPConf.dproj b/src-rdpconfig/RDPConf.dproj new file mode 100644 index 0000000..e333e60 --- /dev/null +++ b/src-rdpconfig/RDPConf.dproj @@ -0,0 +1,107 @@ + <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ProjectGuid>{A7CB4C30-85F5-4D96-B510-6F0CDCF7C2DA}</ProjectGuid> + <ProjectVersion>12.0</ProjectVersion> + <MainSource>RDPConf.dpr</MainSource> + <Config Condition="'$(Config)'==''">Debug</Config> + <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> + </PropertyGroup> + <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''"> + <Cfg_1>true</Cfg_1> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''"> + <Cfg_2>true</Cfg_2> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="'$(Base)'!=''"> + <DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias> + <DCC_DependencyCheckOutputName>RDPConf.exe</DCC_DependencyCheckOutputName> + <DCC_ImageBase>00400000</DCC_ImageBase> + <DCC_Platform>x86</DCC_Platform> + </PropertyGroup> + <PropertyGroup Condition="'$(Cfg_1)'!=''"> + <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> + <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define> + <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo> + <DCC_DebugInformation>false</DCC_DebugInformation> + </PropertyGroup> + <PropertyGroup Condition="'$(Cfg_2)'!=''"> + <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define> + </PropertyGroup> + <ItemGroup> + <DelphiCompile Include="RDPConf.dpr"> + <MainSource>MainSource</MainSource> + </DelphiCompile> + <DCCReference Include="MainUnit.pas"> + <Form>MainForm</Form> + </DCCReference> + <BuildConfiguration Include="Base"> + <Key>Base</Key> + </BuildConfiguration> + <BuildConfiguration Include="Debug"> + <Key>Cfg_2</Key> + <CfgParent>Base</CfgParent> + </BuildConfiguration> + <BuildConfiguration Include="Release"> + <Key>Cfg_1</Key> + <CfgParent>Base</CfgParent> + </BuildConfiguration> + </ItemGroup> + <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/> + <ProjectExtensions> + <Borland.Personality>Delphi.Personality.12</Borland.Personality> + <Borland.ProjectType/> + <BorlandProject> + <Delphi.Personality> + <Source> + <Source Name="MainSource">RDPConf.dpr</Source> + </Source> + <Parameters> + <Parameters Name="UseLauncher">False</Parameters> + <Parameters Name="LoadAllSymbols">True</Parameters> + <Parameters Name="LoadUnspecifiedSymbols">False</Parameters> + </Parameters> + <VersionInfo> + <VersionInfo Name="IncludeVerInfo">False</VersionInfo> + <VersionInfo Name="AutoIncBuild">False</VersionInfo> + <VersionInfo Name="MajorVer">1</VersionInfo> + <VersionInfo Name="MinorVer">0</VersionInfo> + <VersionInfo Name="Release">0</VersionInfo> + <VersionInfo Name="Build">0</VersionInfo> + <VersionInfo Name="Debug">False</VersionInfo> + <VersionInfo Name="PreRelease">False</VersionInfo> + <VersionInfo Name="Special">False</VersionInfo> + <VersionInfo Name="Private">False</VersionInfo> + <VersionInfo Name="DLL">False</VersionInfo> + <VersionInfo Name="Locale">1033</VersionInfo> + <VersionInfo Name="CodePage">1252</VersionInfo> + </VersionInfo> + <VersionInfoKeys> + <VersionInfoKeys Name="CompanyName">Stas'M Corp.</VersionInfoKeys> + <VersionInfoKeys Name="FileDescription">RDP Configuration Program</VersionInfoKeys> + <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys> + <VersionInfoKeys Name="InternalName">RDPConf</VersionInfoKeys> + <VersionInfoKeys Name="LegalCopyright">Copyright © Stas'M Corp. 2014</VersionInfoKeys> + <VersionInfoKeys Name="LegalTrademarks">Stas'M Corp.</VersionInfoKeys> + <VersionInfoKeys Name="OriginalFilename">RDPConf.exe</VersionInfoKeys> + <VersionInfoKeys Name="ProductName">RDP Host Support</VersionInfoKeys> + <VersionInfoKeys Name="ProductVersion">1.4.0.0</VersionInfoKeys> + <VersionInfoKeys Name="Comments">http://stascorp.com</VersionInfoKeys> + </VersionInfoKeys> + <Excluded_Packages> + <Excluded_Packages Name="$(BDS)\bin\bcboffice2k140.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages> + <Excluded_Packages Name="$(BDS)\bin\bcbofficexp140.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages> + <Excluded_Packages Name="$(BDS)\bin\dcloffice2k140.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages> + <Excluded_Packages Name="$(BDS)\bin\dclofficexp140.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages> + </Excluded_Packages> + </Delphi.Personality> + </BorlandProject> + <ProjectFileVersion>12</ProjectFileVersion> + </ProjectExtensions> + </Project> diff --git a/src-rdpconfig/RDPConf.res b/src-rdpconfig/RDPConf.res Binary files differnew file mode 100644 index 0000000..db065ef --- /dev/null +++ b/src-rdpconfig/RDPConf.res diff --git a/src-rdpconfig/manifest.res b/src-rdpconfig/manifest.res Binary files differnew file mode 100644 index 0000000..82e8f47 --- /dev/null +++ b/src-rdpconfig/manifest.res |