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; ResStream.Free;
end; 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; procedure ExtractFiles;
begin begin
if not DirectoryExists(ExtractFilePath(ExpandPath(WrapPath))) then if not DirectoryExists(ExtractFilePath(ExpandPath(WrapPath))) then
@ -904,14 +921,16 @@ begin
if (ParamCount < 1) if (ParamCount < 1)
or ( or (
(ParamStr(1) <> '-i') (ParamStr(1) <> '-l')
and (ParamStr(1) <> '-i')
and (ParamStr(1) <> '-u') and (ParamStr(1) <> '-u')
and (ParamStr(1) <> '-r') and (ParamStr(1) <> '-r')
) then ) then
begin begin
Writeln('USAGE:'); Writeln('USAGE:');
Writeln('RDPWInst.exe [-i[-s]|-u|-r]'); Writeln('RDPWInst.exe [-l|-i[-s]|-u|-r]');
Writeln(''); Writeln('');
Writeln('-l display the license agreement');
Writeln('-i install wrapper to Program Files folder (default)'); Writeln('-i install wrapper to Program Files folder (default)');
Writeln('-i -s install wrapper to System32 folder'); Writeln('-i -s install wrapper to System32 folder');
Writeln('-u uninstall wrapper'); Writeln('-u uninstall wrapper');
@ -919,6 +938,12 @@ begin
Exit; Exit;
end; end;
if ParamStr(1) = '-l' then
begin
Writeln(ExtractResText('LICENSE'));
Exit;
end;
if not SupportedArchitecture then if not SupportedArchitecture then
begin begin
Writeln('[-] Unsupported processor architecture.'); Writeln('[-] Unsupported processor architecture.');
@ -934,6 +959,13 @@ begin
Writeln('[*] RDP Wrapper Library is already installed.'); Writeln('[*] RDP Wrapper Library is already installed.');
Halt(ERROR_INVALID_FUNCTION); Halt(ERROR_INVALID_FUNCTION);
end; 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...'); Writeln('[*] Installing...');
if ParamStr(2) = '-s' then if ParamStr(2) = '-s' then
WrapPath := '%SystemRoot%\system32\rdpwrap.dll' 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 Left = 0
Top = 0 Top = 0
BorderStyle = bsDialog BorderStyle = bsDialog
Caption = 'Remote Desktop Protocol Configuration' Caption = 'RDP Wrapper Configuration'
ClientHeight = 245 ClientHeight = 245
ClientWidth = 326 ClientWidth = 326
Color = clBtnFace Color = clBtnFace
@ -19,7 +19,7 @@ object MainForm: TMainForm
TextHeight = 13 TextHeight = 13
object lRDPPort: TLabel object lRDPPort: TLabel
Left = 203 Left = 203
Top = 22 Top = 33
Width = 47 Width = 47
Height = 13 Height = 13
Caption = 'RDP Port:' Caption = 'RDP Port:'
@ -100,7 +100,7 @@ object MainForm: TMainForm
end end
object seRDPPort: TSpinEdit object seRDPPort: TSpinEdit
Left = 256 Left = 256
Top = 19 Top = 30
Width = 62 Width = 62
Height = 22 Height = 22
MaxValue = 65535 MaxValue = 65535
@ -109,4 +109,13 @@ object MainForm: TMainForm
Value = 0 Value = 0
OnChange = seRDPPortChange OnChange = seRDPPortChange
end end
object bLicense: TButton
Left = 224
Top = 6
Width = 94
Height = 21
Caption = 'View license...'
TabOrder = 8
OnClick = bLicenseClick
end
end end

@ -33,6 +33,7 @@ type
rgShadow: TRadioGroup; rgShadow: TRadioGroup;
seRDPPort: TSpinEdit; seRDPPort: TSpinEdit;
lRDPPort: TLabel; lRDPPort: TLabel;
bLicense: TButton;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure cbAllowTSConnectionsClick(Sender: TObject); procedure cbAllowTSConnectionsClick(Sender: TObject);
procedure seRDPPortChange(Sender: TObject); procedure seRDPPortChange(Sender: TObject);
@ -40,6 +41,7 @@ type
procedure bCancelClick(Sender: TObject); procedure bCancelClick(Sender: TObject);
procedure bOKClick(Sender: TObject); procedure bOKClick(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure bLicenseClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
public public
@ -55,7 +57,27 @@ var
implementation implementation
{$R *.dfm} {$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; procedure TMainForm.ReadSettings;
var var
@ -170,6 +192,13 @@ begin
Reg.Free; Reg.Free;
end; 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); procedure TMainForm.cbAllowTSConnectionsClick(Sender: TObject);
begin begin
if Ready then if Ready then

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

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

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save