Main commit

Sources & binaries
This commit is contained in:
binarymaster
2014-10-23 03:47:44 +04:00
parent 996ede6c1e
commit de975423bd
43 changed files with 5684 additions and 0 deletions

BIN
src-rdpcheck/MainUnit.dcu Normal file

Binary file not shown.

29
src-rdpcheck/MainUnit.dfm Normal file
View File

@ -0,0 +1,29 @@
object Frm: TFrm
Left = 0
Top = 0
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Local RDP Checker'
ClientHeight = 480
ClientWidth = 640
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object RDP: TMsRdpClient2
Left = 0
Top = 0
Width = 640
Height = 480
TabOrder = 0
OnDisconnected = RDPDisconnected
ControlData = {0003000008000200000000000B0000000B000000}
end
end

145
src-rdpcheck/MainUnit.pas Normal file
View File

@ -0,0 +1,145 @@
unit MainUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleServer, MSTSCLib_TLB, OleCtrls, Registry;
type
TFrm = class(TForm)
RDP: TMsRdpClient2;
procedure RDPDisconnected(ASender: TObject; discReason: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm: TFrm;
SecurityLayer, UserAuthentication: DWORD;
implementation
{$R *.dfm}
procedure TFrm.FormCreate(Sender: TObject);
var
Reg: TRegistry;
Port: Integer;
begin
RDP.DisconnectedText := 'Disconnected.';
RDP.ConnectingText := 'Connecting...';
RDP.ConnectedStatusText := 'Connected.';
RDP.UserName := '';
RDP.Server := '127.0.0.1';
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp', True) then
begin
try
SecurityLayer := Reg.ReadInteger('SecurityLayer');
UserAuthentication := Reg.ReadInteger('UserAuthentication');
Reg.WriteInteger('SecurityLayer', 0);
Reg.WriteInteger('UserAuthentication', 0);
except
end;
Reg.CloseKey;
end;
if Reg.OpenKeyReadOnly('\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp') then begin
try
RDP.AdvancedSettings2.RDPPort := Reg.ReadInteger('PortNumber');
except
end;
Reg.CloseKey;
end;
Reg.Free;
Sleep(1000);
RDP.Connect;
end;
procedure TFrm.RDPDisconnected(ASender: TObject; discReason: Integer);
var
ErrStr: String;
Reg: TRegistry;
begin
case discReason of
1: ErrStr := 'Local disconnection.';
2: ErrStr := 'Disconnected by user.';
3: ErrStr := 'Disconnected by server.';
$904: ErrStr := 'Socket closed.';
$C08: ErrStr := 'Decompress error.';
$108: ErrStr := 'Connection timed out.';
$C06: ErrStr := 'Decryption error.';
$104: ErrStr := 'DNS name lookup failure.';
$508: ErrStr := 'DNS lookup failed.';
$B06: ErrStr := 'Encryption error.';
$604: ErrStr := 'Windows Sockets gethostbyname() call failed.';
$208: ErrStr := 'Host not found error.';
$408: ErrStr := 'Internal error.';
$906: ErrStr := 'Internal security error.';
$A06: ErrStr := 'Internal security error.';
$506: ErrStr := 'The encryption method specified is not valid.';
$804: ErrStr := 'Bad IP address specified.';
$606: ErrStr := 'Server security data is not valid.';
$406: ErrStr := 'Security data is not valid.';
$308: ErrStr := 'The IP address specified is not valid.';
$808: ErrStr := 'License negotiation failed.';
$908: ErrStr := 'Licensing time-out.';
$106: ErrStr := 'Out of memory.';
$206: ErrStr := 'Out of memory.';
$306: ErrStr := 'Out of memory.';
$706: ErrStr := 'Failed to unpack server certificate.';
$204: ErrStr := 'Socket connection failed.';
$404: ErrStr := 'Windows Sockets recv() call failed.';
$704: ErrStr := 'Time-out occurred.';
$608: ErrStr := 'Internal timer error.';
$304: ErrStr := 'Windows Sockets send() call failed.';
$B07: ErrStr := 'The account is disabled.';
$E07: ErrStr := 'The account is expired.';
$D07: ErrStr := 'The account is locked out.';
$C07: ErrStr := 'The account is restricted.';
$1B07: ErrStr := 'The received certificate is expired.';
$1607: ErrStr := 'The policy does not support delegation of credentials to the target server.';
$2107: ErrStr := 'The server authentication policy does not allow connection requests using saved credentials. The user must enter new credentials.';
$807: ErrStr := 'Login failed.';
$1807: ErrStr := 'No authority could be contacted for authentication. The domain name of the authenticating party could be wrong, the domain could be unreachable, or there might have been a trust relationship failure.';
$A07: ErrStr := 'The specified user has no account.';
$F07: ErrStr := 'The password is expired.';
$1207: ErrStr := 'The user password must be changed before logging on for the first time.';
$1707: ErrStr := 'Delegation of credentials to the target server is not allowed unless mutual authentication has been achieved.';
$2207: ErrStr := 'The smart card is blocked.';
$1C07: ErrStr := 'An incorrect PIN was presented to the smart card.';
$B09: ErrStr := 'Network Level Authentication is required.';
$708: ErrStr := 'The RDP seems to work, but your client doesn''t support loopback connections. Try to connect to your PC from another device in the network.';
else ErrStr := 'Unknown code 0x'+IntToHex(discReason, 1);
end;
if (discReason > 2) then
MessageBox(Handle, PWideChar(ErrStr), 'Disconnected', mb_Ok or mb_IconError);
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp', True) then
begin
try
Reg.WriteInteger('SecurityLayer', SecurityLayer);
Reg.WriteInteger('UserAuthentication', UserAuthentication);
except
end;
Reg.CloseKey;
end;
Reg.Free;
Halt(0);
end;
end.

BIN
src-rdpcheck/RDP.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

15
src-rdpcheck/RDPCheck.dpr Normal file
View File

@ -0,0 +1,15 @@
program RDPCheck;
uses
Forms,
MainUnit in 'MainUnit.pas' {Frm};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Local RDP Checker';
Application.CreateForm(TFrm, Frm);
Application.Run;
end.

107
src-rdpcheck/RDPCheck.dproj Normal file
View File

@ -0,0 +1,107 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{90AE83F6-26B8-45D4-92FE-CF4ACCDE9F68}</ProjectGuid>
<ProjectVersion>12.0</ProjectVersion>
<MainSource>RDPCheck.dpr</MainSource>
<Config Condition="'$(Config)'==''">Release</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>RDPCheck.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="RDPCheck.dpr">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="MainUnit.pas">
<Form>Frm</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>
<Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">2</VersionInfo>
<VersionInfo Name="MinorVer">1</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&apos;M Corp.</VersionInfoKeys>
<VersionInfoKeys Name="FileDescription">Local RDP Checker</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">2.1.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName">RDPCheck</VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright">Copyright © Stas&apos;M Corp. 2014</VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks">Stas&apos;M Corp.</VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename">RDPCheck.exe</VersionInfoKeys>
<VersionInfoKeys Name="ProductName">RDP Host Support</VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.3.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>
<Source>
<Source Name="MainSource">RDPCheck.dpr</Source>
</Source>
</Delphi.Personality>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
</Project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2013.12.08 02:49:59.064.pas,C:\Users\user\Documents\RAD Studio\Projects\Unit2.pas=C:\Users\user\Documents\Delphi Projects (local)\RDPWrap\devel\rdpcheck-binarymaster\MainUnit.pas</Transaction>
<Transaction>2013.12.08 02:49:59.064.dfm,C:\Users\user\Documents\RAD Studio\Projects\Unit2.dfm=C:\Users\user\Documents\Delphi Projects (local)\RDPWrap\devel\rdpcheck-binarymaster\MainUnit.dfm</Transaction>
<Transaction>2013.12.08 02:50:08.464.dproj,C:\Users\user\Documents\RAD Studio\Projects\Project1.dproj=C:\Users\user\Documents\Delphi Projects (local)\RDPWrap\devel\rdpcheck-binarymaster\RDPCheck.dproj</Transaction>
</Transactions>
</BorlandProject>

Binary file not shown.

BIN
src-rdpcheck/RDPCheck.res Normal file

Binary file not shown.