计算机病毒电子5-3-1病毒查杀程序分析.ppt

冲击波病毒杀毒源代码分析 else { #ifdef DEBUGMSG printf(GetFullPathName() GetLastError reports %d\n,erron); #endif if (hFind!=NULL) FindClose(hFind); return FALSE; } } //进行特征码匹配工作 ScanVXER(FindFileData.cFileName,FileOffset,FileLength,Contents); } } 冲击波病毒杀毒源代码分析 while (FindNextFile(hFind,FindFileData)) //继续查找文件 { count++; //以.和..除外 if (strcmp(.,FindFileData.cFileName)==0||strcmp(..,FindFileData.cFileName)==0) { #ifdef DEBUGMSG printf(File no include \.\ and \..\\n); #endif if (hFind!=NULL) FindClose(hFind); fclose(Gfp); exit(0); } 冲击波病毒杀毒源代码分析 if (GetFullPathName(FindFileData.cFileName,lpBufferLength,lpBuffer,NULL)!=0) { #ifdef DEBUGMSG fprintf(Gfp,Next File:\t%s\n,lpBuffer); #else printf(Next File:\t%s\n,lpBuffer); #endif } 冲击波病毒杀毒源代码分析 else { #ifdef DEBUGMSG printf(GetFullPathName() GetLastError reports %d\n,erron); #endif if (hFind!=NULL) FindClose(hFind); fclose(Gfp); exit(0); } ScanVXER(FindFileData.cFileName,FileOffset,FileLength,Contents); } 冲击波病毒杀毒源代码分析 fprintf(Gfp,\nFile Total:%d\n\n,count); fprintf(Gfp,%s\n\n,[-------------------------File end---------------------------]\n); printf(File Total:%d\n,count); //打印出查找到的文件各数 if (hFind!=NULL) FindClose(hFind); //关闭搜索句柄 return TRUE; } BOOL ScanVXER (LPTSTR V_FileName, /*文件名*/ long V_FileOffset, //偏移地址 int V_Length, //长度 TCHAR *V_Contents) //具体内容 { TCHAR FileContents[255]={0}; 冲击波病毒杀毒源代码分析 int cmpreturn=0; FILE *fp=NULL; fp=fopen(V_FileName,rb); //以二进制只读方式打开 if (fp==NULL) { #ifdef DEBUGMSG printf(fopen() File open FAIL\n); #endif fclose(fp); return FALSE; } fseek(fp,V_FileOffset,SEEK_SET); //把文件指针指向特征码在文件的偏移地址处 fread(FileContents,V_Length,1,fp);//读取长度为特征码长度的内容 冲击波病毒杀毒源代码分析 cmpreturn=memcmp(V_Contents,FileContents,V_Length); //进行特征码匹配。失败返回FALSE if (cmpreturn==0) { #ifdef DEBUGMSG printf(File match completely\n); //打印文件匹配消息 #endif strcpy(name,V_FileName); //将文件名保存在全局变量name中 if (fp!=NULL) fclose(fp); return TRUE; } else { fclose(fp); return FALSE; } } 冲击波病毒杀毒源代码分析 BOOL ProcessVXER (void) { DWORD lpidProcess[1024]={0}; DWORD cbNeed

文档评论(0)

1亿VIP精品文档

相关文档