diff --git a/src-installer/RDPWInst.dpr b/src-installer/RDPWInst.dpr index 6f934f5..b4489bd 100644 --- a/src-installer/RDPWInst.dpr +++ b/src-installer/RDPWInst.dpr @@ -1,5 +1,5 @@ { - Copyright 2014 Stas'M Corp. + Copyright 2015 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. @@ -282,32 +282,45 @@ var hSvc: THandle; Code: DWORD; pch: PWideChar; + procedure ExitError(Func: String; ErrorCode: DWORD); + begin + if hSC > 0 then + CloseServiceHandle(hSC); + if hSvc > 0 then + CloseServiceHandle(hSvc); + Writeln('[-] ', Func, ' error (code ', ErrorCode, ').'); + end; begin + hSC := 0; + hSvc := 0; Writeln('[*] Starting ', SvcName, '...'); hSC := OpenSCManager(nil, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CONNECT); if hSC = 0 then begin - Code := GetLastError; - Writeln('[-] OpenSCManager error (code ', Code, ').'); + ExitError('OpenSCManager', GetLastError); Exit; end; hSvc := OpenService(hSC, PWideChar(SvcName), SERVICE_START); if hSvc = 0 then begin - CloseServiceHandle(hSC); - Code := GetLastError; - Writeln('[-] OpenService error (code ', Code, ').'); + ExitError('OpenService', GetLastError); Exit; end; pch := nil; if not StartService(hSvc, 0, pch) then begin - CloseServiceHandle(hSvc); - CloseServiceHandle(hSC); Code := GetLastError; - Writeln('[-] StartService error (code ', Code, ').'); - Exit; + if Code = 1056 then begin // Service already started + Sleep(2000); // or SCM hasn't registered killed process + if not StartService(hSvc, 0, pch) then begin + ExitError('StartService', Code); + Exit; + end; + end else begin + ExitError('StartService', Code); + Exit; + end; end; CloseServiceHandle(hSvc); CloseServiceHandle(hSC); diff --git a/src-installer/RDPWInst.dproj b/src-installer/RDPWInst.dproj index 78b7b03..3d44444 100644 --- a/src-installer/RDPWInst.dproj +++ b/src-installer/RDPWInst.dproj @@ -41,14 +41,14 @@ Base - - Cfg_2 - Base - Cfg_1 Base + + Cfg_2 + Base + diff --git a/src-installer/resource.res b/src-installer/resource.res index 8bcc9dd..402086a 100644 Binary files a/src-installer/resource.res and b/src-installer/resource.res differ diff --git a/src-rdpcheck/MainUnit.pas b/src-rdpcheck/MainUnit.pas index 1f0e201..3efe4ca 100644 --- a/src-rdpcheck/MainUnit.pas +++ b/src-rdpcheck/MainUnit.pas @@ -1,5 +1,5 @@ { - Copyright 2014 Stas'M Corp. + Copyright 2015 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. @@ -50,7 +50,7 @@ begin RDP.ConnectingText := 'Connecting...'; RDP.ConnectedStatusText := 'Connected.'; RDP.UserName := ''; - RDP.Server := '127.0.0.1'; + RDP.Server := '127.0.0.2'; Reg := TRegistry.Create; Reg.RootKey := HKEY_LOCAL_MACHINE; @@ -133,7 +133,7 @@ begin $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.'; + $708: ErrStr := 'RDP is working, but the client doesn''t allow 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 diff --git a/src-rdpconfig/MainUnit.dfm b/src-rdpconfig/MainUnit.dfm index 49a9004..d67ee28 100644 --- a/src-rdpconfig/MainUnit.dfm +++ b/src-rdpconfig/MainUnit.dfm @@ -3,7 +3,7 @@ object MainForm: TMainForm Top = 0 BorderStyle = bsDialog Caption = 'RDP Wrapper Configuration' - ClientHeight = 326 + ClientHeight = 352 ClientWidth = 351 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -27,7 +27,7 @@ object MainForm: TMainForm end object bOK: TButton Left = 10 - Top = 293 + Top = 319 Width = 75 Height = 25 Caption = 'OK' @@ -37,7 +37,7 @@ object MainForm: TMainForm end object bCancel: TButton Left = 91 - Top = 293 + Top = 319 Width = 75 Height = 25 Caption = 'Cancel' @@ -47,7 +47,7 @@ object MainForm: TMainForm end object bApply: TButton Left = 172 - Top = 293 + Top = 319 Width = 75 Height = 25 Caption = 'Apply' @@ -66,7 +66,7 @@ object MainForm: TMainForm end object rgNLA: TRadioGroup Left = 8 - Top = 135 + Top = 132 Width = 335 Height = 73 Caption = 'Security Mode' @@ -88,14 +88,16 @@ object MainForm: TMainForm end object rgShadow: TRadioGroup Left = 8 - Top = 214 + Top = 208 Width = 335 - Height = 73 + Height = 105 Caption = 'Session Shadowing Mode' Items.Strings = ( 'Disable Shadowing' - 'Shadowing will request user'#39's permission' - 'Shadow sessions immediately') + 'Full access with user'#39's permission' + 'Full access without permission' + 'View only with user'#39's permission' + 'View only without permission') TabOrder = 6 OnClick = cbAllowTSConnectionsClick end @@ -112,7 +114,7 @@ object MainForm: TMainForm end object bLicense: TButton Left = 253 - Top = 293 + Top = 319 Width = 87 Height = 25 Caption = 'View license...' diff --git a/src-rdpconfig/MainUnit.pas b/src-rdpconfig/MainUnit.pas index 8feeccf..d8608cb 100644 --- a/src-rdpconfig/MainUnit.pas +++ b/src-rdpconfig/MainUnit.pas @@ -1,5 +1,5 @@ { - Copyright 2014 Stas'M Corp. + Copyright 2015 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. @@ -439,6 +439,15 @@ begin end; end; Reg.CloseKey; + Reg.OpenKey('\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services', True); + if rgShadow.ItemIndex >= 0 then begin + try + Reg.WriteInteger('Shadow', rgShadow.ItemIndex); + except + + end; + end; + Reg.CloseKey; Reg.Free; end;