Added license info

Now license can be viewed in applications
master
binarymaster 10 years ago
parent 6b4dadcde5
commit 64b3bf8bc1

@ -573,6 +573,23 @@ begin
ResStream.Free;
end;
function ExtractResText(ResName: String): String;
var
ResStream: TResourceStream;
Str: TStringList;
begin
ResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
Str := TStringList.Create;
try
Str.LoadFromStream(ResStream);
except
end;
ResStream.Free;
Result := Str.Text;
Str.Free;
end;
procedure ExtractFiles;
begin
if not DirectoryExists(ExtractFilePath(ExpandPath(WrapPath))) then
@ -904,14 +921,16 @@ begin
if (ParamCount < 1)
or (
(ParamStr(1) <> '-i')
(ParamStr(1) <> '-l')
and (ParamStr(1) <> '-i')
and (ParamStr(1) <> '-u')
and (ParamStr(1) <> '-r')
) then
begin
Writeln('USAGE:');
Writeln('RDPWInst.exe [-i[-s]|-u|-r]');
Writeln('RDPWInst.exe [-l|-i[-s]|-u|-r]');
Writeln('');
Writeln('-l display the license agreement');
Writeln('-i install wrapper to Program Files folder (default)');
Writeln('-i -s install wrapper to System32 folder');
Writeln('-u uninstall wrapper');
@ -919,6 +938,12 @@ begin
Exit;
end;
if ParamStr(1) = '-l' then
begin
Writeln(ExtractResText('LICENSE'));
Exit;
end;
if not SupportedArchitecture then
begin
Writeln('[-] Unsupported processor architecture.');
@ -934,6 +959,13 @@ begin
Writeln('[*] RDP Wrapper Library is already installed.');
Halt(ERROR_INVALID_FUNCTION);
end;
Writeln('[*] Notice to user:');
Writeln(' - By using all or any portion of this software, you are agreeing');
Writeln(' to be bound by all the terms and conditions of the license agreement.');
Writeln(' - To read the license agreement, run the installer with -l parameter.');
Writeln(' - If you do not agree to any terms of the license agreement,');
Writeln(' do not use the software.');
Writeln('[*] Installing...');
if ParamStr(2) = '-s' then
WrapPath := '%SystemRoot%\system32\rdpwrap.dll'

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2013.12.07 17:17:05.152.dproj,C:\Users\user\Documents\RAD Studio\Projects\Project1.dproj=C:\Users\user\Documents\Delphi Projects (local)\RDPWrapInst\RDPInstall.dproj</Transaction>
<Transaction>2013.12.07 19:48:57.905.dproj,C:\Users\user\Documents\Delphi Projects (local)\RDPWrapInst\RDPInstall.dproj=C:\Users\user\Documents\Delphi Projects (local)\RDPWrapInst\RDPWInst.dproj</Transaction>
<Transaction>2013.12.08 01:45:08.501.dproj,C:\Users\user\Documents\Delphi Projects (local)\RDPWrapInst\RDPWInst.dproj=C:\Users\user\Documents\Delphi Projects (local)\RDPWrap\devel\installer2.0-binarymaster\RDPWInst.dproj</Transaction>
</Transactions>
</BorlandProject>

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,47 @@
object LicenseForm: TLicenseForm
Left = 0
Top = 0
BorderIcons = []
BorderStyle = bsDialog
Caption = 'License Agreement'
ClientHeight = 344
ClientWidth = 386
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poOwnerFormCenter
PixelsPerInch = 96
TextHeight = 13
object mText: TMemo
Left = 8
Top = 8
Width = 370
Height = 297
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WordWrap = False
end
object bAccept: TButton
Left = 115
Top = 311
Width = 75
Height = 25
Caption = '&Accept'
ModalResult = 1
TabOrder = 1
end
object bDecline: TButton
Left = 196
Top = 311
Width = 75
Height = 25
Caption = '&Decline'
ModalResult = 2
TabOrder = 2
end
end

@ -0,0 +1,43 @@
{
Copyright 2014 Stas'M Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}
unit LicenseUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TLicenseForm = class(TForm)
mText: TMemo;
bAccept: TButton;
bDecline: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
LicenseForm: TLicenseForm;
implementation
{$R *.dfm}
end.

Binary file not shown.

@ -2,7 +2,7 @@ object MainForm: TMainForm
Left = 0
Top = 0
BorderStyle = bsDialog
Caption = 'Remote Desktop Protocol Configuration'
Caption = 'RDP Wrapper Configuration'
ClientHeight = 245
ClientWidth = 326
Color = clBtnFace
@ -19,7 +19,7 @@ object MainForm: TMainForm
TextHeight = 13
object lRDPPort: TLabel
Left = 203
Top = 22
Top = 33
Width = 47
Height = 13
Caption = 'RDP Port:'
@ -100,7 +100,7 @@ object MainForm: TMainForm
end
object seRDPPort: TSpinEdit
Left = 256
Top = 19
Top = 30
Width = 62
Height = 22
MaxValue = 65535
@ -109,4 +109,13 @@ object MainForm: TMainForm
Value = 0
OnChange = seRDPPortChange
end
object bLicense: TButton
Left = 224
Top = 6
Width = 94
Height = 21
Caption = 'View license...'
TabOrder = 8
OnClick = bLicenseClick
end
end

@ -33,6 +33,7 @@ type
rgShadow: TRadioGroup;
seRDPPort: TSpinEdit;
lRDPPort: TLabel;
bLicense: TButton;
procedure FormCreate(Sender: TObject);
procedure cbAllowTSConnectionsClick(Sender: TObject);
procedure seRDPPortChange(Sender: TObject);
@ -40,6 +41,7 @@ type
procedure bCancelClick(Sender: TObject);
procedure bOKClick(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure bLicenseClick(Sender: TObject);
private
{ Private declarations }
public
@ -55,7 +57,27 @@ var
implementation
{$R *.dfm}
{$R manifest.res}
{$R resource.res}
uses
LicenseUnit;
function ExtractResText(ResName: String): String;
var
ResStream: TResourceStream;
Str: TStringList;
begin
ResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
Str := TStringList.Create;
try
Str.LoadFromStream(ResStream);
except
end;
ResStream.Free;
Result := Str.Text;
Str.Free;
end;
procedure TMainForm.ReadSettings;
var
@ -170,6 +192,13 @@ begin
Reg.Free;
end;
procedure TMainForm.bLicenseClick(Sender: TObject);
begin
LicenseForm.mText.Text := ExtractResText('LICENSE');
if LicenseForm.ShowModal <> mrOk then
Halt(0);
end;
procedure TMainForm.cbAllowTSConnectionsClick(Sender: TObject);
begin
if Ready then

@ -18,7 +18,8 @@ program RDPConf;
uses
Forms,
MainUnit in 'MainUnit.pas' {MainForm};
MainUnit in 'MainUnit.pas' {MainForm},
LicenseUnit in 'LicenseUnit.pas' {LicenseForm};
{$R *.res}
@ -27,5 +28,6 @@ begin
Application.MainFormOnTaskbar := True;
Application.Title := 'Remote Desktop Protocol Configuration';
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(TLicenseForm, LicenseForm);
Application.Run;
end.

@ -41,6 +41,9 @@
<DCCReference Include="MainUnit.pas">
<Form>MainForm</Form>
</DCCReference>
<DCCReference Include="LicenseUnit.pas">
<Form>LicenseForm</Form>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save