网管文库

XP/2003下使用Delphi方法开放3389

摘要:修改注册表一个键值复制内容到剪贴板代码: program Open3389; {$APPTYPE CONSOLE} uses SysUtils, Registry, Windows; var reg:TRegistry; procedure Help; begin writeln(''); writeln('======Win XP2003 Open3389 by lanyu====== '); Writeln('Useag '+Ext...

修改注册表一个键值复制内容到剪贴板代码:
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.
 

2009-08-15
在线客服
  • 售前咨询:点击这里给我发消息
  • 售后服务:点击这里给我发消息