记得很久以前在黑基上看过的了,就修改注册表一个键值而已。

前几天翻了下旧文章,才想起有这个方法。呵呵,把它做成个小程序吧,免得老忘了。

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);