能力值:
( LV7,RANK:100 )
5 楼
function TWorkThread.ScanFile(const FileName: string): Boolean;
var
hFile, hFileMapping:THandle;
FileSizeHigh:LongWord;
pMemory:Pointer;
MemorySize:Cardinal;
foundAddr:Cardinal;
begin
{功能: 扫描文件, 检查文件是否包含病毒}
inc( FCount); //增加扫描文件计数
Synchronize( UpdateUICount);
Result := False;
hFile := CreateFile( PChar( FileName), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if hFile <> INVALID_HANDLE_VALUE then
begin
//获得文件大小
MemorySize := GetFileSize(hFile, @FileSizeHigh);
if MemorySize <> INVALID_FILE_SIZE then
begin
hFileMapping := CreateFileMapping( hFile, nil, PAGE_READONLY,0,0,nil);
if hFileMapping <> 0 then
begin
pMemory := MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
if pMemory <> nil then
begin
//扫描打开文件
foundAddr := SearchEx(pMemory, @SearchPattern[0],
@SearchMask[0], Length( SearchPattern), MemorySize);
if foundAddr <> 0 then
begin
Inc( FFoundCount);
FVirusFileName := FileName;
FFoundAddr := foundAddr - Cardinal(pMemory);
Result := True;
end;
UnmapViewOfFile( pMemory);
end;
CloseHandle( hFileMapping);
end;
end;
CloseHandle( hFile);
end;
end;
SearchEx直接用的国外某大侠的 没涉及到pe文件验证
;**********************************************************************************************
;* Example (how to use) *
;* ------------------------------------------------------------------------------------------ *
;* search : 2A 45 EB ?? C3 ?? EF *
;* replace: 2A ?? ?? 10 33 C0 ?? *
;* *
;* .data *
;* SearchPattern db 02Ah, 045h, 0EBh, 000h, 0C3h, 000h, 0EFh *
;* SearchMask db 0, 0, 0, 1, 0, 1, 0 ;(1=Ignore Byte) *
;* *
;* ReplacePattern db 02Ah, 000h, 000h, 010h, 033h, 0C0h, 000h *
;* ReplaceMask db 0, 1, 1, 0, 0, 0, 1 ;(1=Ignore Byte) *
;* *
;* .const *
;* PatternSize equ 7 *
;* *
;* .code *
;* push FileSize ;how many bytes to search from beginning from TargetAdress *
;* push PatternSize ;lenght of Pattern *
;* push offset SearchMask *
;* push offset SearchPattern *
;* push TargetAddress ;the memory address where the search starts *
;* call SearchAndReplace *
;* *
;* ReturnValue in eax (1=Success 0=Failed) *
;**********************************************************************************************
.586
;locals
;jumps
.model flat, stdcall
option casemap :none
SearchEx PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
.code
public SearchEx
SearchEx proc _targetadress:dword,_searchpattern:dword,_searchmask:dword,_patternsize:dword,_searchsize:dword
LOCAL local_returnvalue :dword ;returns Address
pushad
mov local_returnvalue,0
mov edi,_targetadress
mov esi,_searchpattern
mov edx,_searchmask
mov ebx,_patternsize
xor ecx,ecx
.while ecx!=_searchsize
@search_again:
;---check if pattern exceed memory---
mov eax,ecx ;ecx=raw offset
add eax,ebx ;raw offset + patternsize
cmp eax,_searchsize
ja @return ;if (raw offset + patternsize) > searchsize then bad!
push ecx ;counter
push esi ;searchpattern
push edi ;targetaddress
push edx ;searchmask
mov ecx,ebx ;ebx=patternsize
@cmp_mask:
test ecx,ecx
je @pattern_found
cmp byte ptr[edx],1 ;searchmask
je @ignore
lodsb ;load searchbyte to al & inc esi
scasb ;cmp al,targetadressbyte & inc edi
jne @skip
inc edx ;searchmask
dec ecx ;patternsize
jmp @cmp_mask
@ignore:
inc edi ;targetadress
inc esi ;searchpattern
inc edx ;searchmask
dec ecx ;patternsize
jmp @cmp_mask
@skip:
pop edx
pop edi ;targetadress
pop esi ;searchpattern
pop ecx
inc edi ;targetadress
inc ecx ;counter
.endw
;---scanned whole memory size---
jmp @return
@pattern_found:
pop edx
pop edi ;targetadress
pop esi
pop ecx
mov local_returnvalue, edi
jmp @return
;---return---
@return:
popad
mov eax,local_returnvalue
ret
SearchEx endp
end
能力值:
( LV2,RANK:10 )
7 楼
我也中了
解决方法见地址
2feK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8X3u0T1M7#2)9J5k6e0f1J5M7r3!0B7K9h3g2Q4x3X3g2U0L8W2)9J5c8Y4k6A6k6i4N6@1K9s2u0W2j5h3c8Q4x3X3g2H3K9s2m8Q4x3@1k6@1K9h3c8Q4x3@1b7K6x3e0p5H3y4R3`.`.
上传个没有被感染的D7 SysConst 以备需要的朋友下载
上传的附件: