我学校机房的是赛扬D+XP SP2的,应该不支持吧,我自己的电脑是T5200+XP SP2,我在其他很多同学的电脑上测试(XP SP2)大部分都没有问题,但也有一两台有问题的,我写了一个程序用来检查错问题,还修改了一下代码,将分配到的内存的属性显示出来,发现这块内存并非PAGE_EXECUTE_READWRITE,而是PAGE_READWRITE,不知道是什么原因影响了CreateFilemapping函数,加上VirtualProtect再看还是一样,不能设置成PAGE_EXECUTE_READWRITE而是自动变成了PAGE_READWRITE,但是当我是用VirtualAlloc时却可以设置成PAGE_EXECUTE_READWRITE<br>function GetNewCreateProcessW
ointer;<br>var<br> OldCreateProcAddr
ointer;<br> kdllhd:THandle; <br> maphd:THandle;<br> {$IF Defined(DEBUG)}<br> tmpstruct:TJump; //debug<br> {$IFEND}<br>begin<br> if KdllAddr=nil then<br> begin<br> kdllhd:=LoadLibrary('kernel32.dll');<br> GetModuleInformation(GetCurrentProcess,kdllhd,@KdllInfo,SizeOf(KdllInfo));<br> OldCreateProcAddr:=GetProcAddress(kdllhd,'CreateProcessW');<br> maphd:=OpenFileMapping(FILE_MAP_ALL_ACCESS,True,'AntiAutoRun_sy');<br> if maphd=0 then<br> maphd:=CreateFileMapping($FFFFFFFF,nil,PAGE_EXECUTE_READWRITE,0,KdllInfo.SizeOfImage,'AntiAutoRun_sy');<br> //GetMem(KdllAddr,KdllInfo.SizeOfImage);<br> KdllAddr:=MapViewOfFile(maphd,FILE_MAP_ALL_ACCESS,0,0,0);<br> //KdllAddr:=VirtualAlloc(nil,KdllInfo.SizeOfImage,MEM_COMMIT,PAGE_EXECUTE_READWRITE);<br> //virtualprotect(kdlladdr,KdllInfo.SizeOfImage,Page_execute_readwrite,crd);<br> //messagebox(0,pchar(inttostr(getlasterror)),'hhhhh',0);<br> VirtualQuery(KdllAddr,Debug_protect,SizeOf(Debug_protect));<br> {$IF Defined(DEBUG)}<br> begin<br> SendDebugInfo(SY_DEBUG_BEGIN);<br> SendDebugInfo(SY_DEBUG,True,'检查内存分配是否正确');<br> SendDebugInfo(SY_DEBUG,True,'Protect:',Debug_protect.AllocationProtect);<br> SendDebugInfo(SY_DEBUG,True,'MEM State:',Debug_protect.State);<br> SendDebugInfo(SY_DEBUG,False,'大小:',Debug_protect.RegionSize);<br> SendDebugInfo(SY_DEBUG,False,'kernel32.dll大小:',KdllInfo.SizeOfImage);<br> SendDebugInfo(SY_DEBUG_END);<br> end;<br> {$IFEND}<br> if debug_protect.Protect=$40 then<br> begin<br> WriteProcessMemory(GetCurrentProcess,KdllAddr,KdllInfo.lpBaseOfDll,KdllInfo.SizeOfImage,crd);<br> Result:=Pointer(Cardinal(OldCreateProcAddr)-cardinal(KdllInfo.lpBaseOfDll)+cardinal(KdllAddr));<br> end<br> else<br> Result:=nil;<br> end <br> else<br> begin<br> Result:=KdllAddr;<br> end;<br> {$IF Defined(DEBUG)}<br> ReadProcessMemory(GetCurrentProcess,KdllAddr,@tmpStruct,8,crd); //debug<br> {$IFEND} //dubug<br>end;