記得很久以前在黑基上看過的了,就修改注冊表一個鍵值而已。
前幾天翻了下舊文章,才想起有這個方法。呵呵,把它做成個小程序吧,免得老忘了。
program Open3389;
{$APPTYPE CONSOLE}
uses
SysUtils, Registry, Windows;
var
reg:TRegistry;
procedure Help;
begin
writeln('');
writeln('======Win XP&2003 Open3389 by lanyu====== ');
Writeln('Useag '+ExtractFileName(Paramstr(0))+' [/n]');
end;
begin
{ TODO -oUser -cConsole Main : Insert code here }
if ParamCount>2 then
begin
help;
exit;
end;
reg:=TRegistry.Create;
reg.RootKey:=HKEY_LOCAL_MacHINE;
reg.OpenKey('SYSTEMCurrentControlSetControlTerminal Server',true);
if ParamCount=1 then
begin
if Paramstr(1)='/n' then
begin
try
reg.WriteBool('fDenyTSConnections',true);
Writeln('Close 3389 successfully');
except
Writeln('Close 3389 fail');
end;
end
else
begin
Help;
Exit;
end;
end
else
begin
try
reg.WriteBool('fDenyTSConnections',false);
writeln('Open 3389 successfully');
except
writeln('Open 3389 fail');
end;
end;
reg.Free;
end.