在XP系统下使用
[email protected]
谢谢了

解决方案 »

  1.   

    用socket发送一组命令字,接受方根据命令字执行关机操作。
    socket相关代码网上多的很,就不多说了。
      

  2.   

    远程关机的例子:
    http://www.2ccc.com/article.asp?articleid=1871
      

  3.   

    以下是在NT系统内核上实现关机,不能想98那样利用现有的API必须进行权限设置
    然后利用木马技术在客户端利用以下程序关机等操作uses
      Windows;function GetSysTypes: Boolean; // & 获取操作系统类型 &
    function SetPrivilege(sPrivilegeName: AnsiString; bEnable: Boolean): Boolean; // & 设置权限 &
    procedure ExitWin32Sys(iFlags: Integer); // & 执行注销、退出或重启系统的操作 &implementationfunction GetSysTypes: Boolean;
    var
      Ver: TOSVersionInfo;
    begin
      Result := False;
      Ver.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
      if GetVersionEx(Ver) then
        if Ver.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then
          Result := True
        else
          Result := False;
    end;function SetPrivilege(sPrivilegeName: AnsiString; bEnable: Boolean): Boolean;
    var
      TPPrev, TP: TTokenPrivileges;
      Token : THandle;
      dwRetLen : DWord;
    begin
      Result := False;
      OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or
                       TOKEN_QUERY, Token);
      TP.PrivilegeCount := 1;
      if LookupPrivilegeValue(nil,PAnsiChar(sPrivilegeName),TP.Privileges[0].LUID) then
      begin
        if bEnable then
          TP.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
        else
          TP.Privileges[0].Attributes := 0;
        dwRetLen := 0;
        Result := AdjustTokenPrivileges(Token, False, TP, SizeOf(TPPrev), TPPrev, dwRetLen);
      end;
      CloseHandle(Token);
    end;procedure ExitWin32Sys(iFlags: Integer);
    begin
      if GetSysTypes then
        ExitWindowsEx(iFlags,0)
      else
        if SetPrivilege('SeShutdownPrivilege',True) then
          if not ExitWindowsEx(iFlags,0) then
            SetPrivilege('SeShutdownPrivilege',False);
    end;
      

  4.   

    对于没有重新配置过的XP系统着实有一定难度……
    2k和2003都没问题,也就是说只需要使用XP/2003自带的Shutdown.exe就可以控制(win2k亦可以使用),但XP默认配置就是不行。
      

  5.   

    unit shutdown;interfaceuses
      Windows,
      StdCtrls;  procedure shut(system, nachricht: string; force, reboot: boolean; countdown: integer);
      procedure abortshut(system: string);implementation  const
      SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
      var
      hdlg: DWORD = 0;procedure shut(system, nachricht: string; force, reboot: boolean; countdown: integer);
    var
      otoken, hToken: THandle;
      tp: TTokenPrivileges;
      h: Dword;
    begin
      OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES, hToken);
      otoken := htoken;
      LookupPrivilegeValue(nil, SE_SHUTDOWN_NAME, tp.Privileges[0].luid);
      tp.privilegecount := 1;
      tp.privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
      h := 0;
      AdjustTokenPrivileges(hToken, False, tp, 0, PTokenPrivileges(nil)^, h);
      InitiateSystemShutdown(PChar(system), pchar(nachricht), countdown, force, reboot);
      tp.privilegecount := 1;
      tp.privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
      h := 0;
      AdjustTokenPrivileges(oToken, False, tp, 0, PTokenPrivileges(nil)^, h);
      CloseHandle(hToken);
    end;procedure abortshut(system: string);
    var
      hToken: THandle;
      tp: TTokenPrivileges;
      h: Dword;
    begin
      OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES, hToken);
      LookupPrivilegeValue(pchar(system), SE_SHUTDOWN_NAME, tp.Privileges[0].luid);
      tp.privilegecount := 1;
      tp.privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
      h := 0;
      AdjustTokenPrivileges(hToken, False, tp, 0, PTokenPrivileges(nil)^, h);
      CloseHandle(hToken);
      abortSystemShutdown(pchar(system));
    end;end.
      

  6.   

    要设置远程启动,必须是要你去重新启动它,否则别人拔了电源线,你的程序再好也没有用。
    不过pcanywhere可以做到这种效果,我想是它在计算机重启之前做好了很多东西,然后在启动的时候把这些加载进去。
      

  7.   

    方法有2种:
    1、使用c/s结构,在远程安装一个服务器端程序,类似木马,随时监听特定端口的信息,接到指令后,执行……
    2、在nt/2000操作系统下,利用NetRemoteTOD取得远程机器时间,再利用NetScheduleJobAdd函数添加命令(类似nt下的at命令,同时需要取得对方管理员口令,对方须启动Schedule服务),这两个函数在delphi中没有声明,需要自己声明(使用WNetAddConnection2 建立连接,delphi可直接使用);