XP/2003下Delphi最简单的方法开放3389

 

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(SYSTEM\CurrentControlSet\Control\Terminal 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.

 

此项目被张贴在未分类 。书签的 permalink

发表评论

电子邮件地址不会被公开。 必填项已用*标注