|
[原创]驱动感染技术扫盲(C描述)
看了半天我的盲还是没扫掉^_^ |
|
[求助]getpixel小问题
这个问题比较复杂。 我没有推敲过这方面,但上个暑假写过类似的程序,希望可以提供lz一点参考 不好意思的的是,我没有调试过lz上面的程序,但按照我自己的经验+感觉,那样子getpixel确实可以得到正确的像素,是不是Point1要用相对的坐标?似乎要查msdn了 还有一个问题getpixel在vista下支持得不是很好(速度奇慢;且不是实时,而是从缓冲区读取). 用其他办法来代替: 把整个desktophwnd的图形截取下来,再一次性全保存到位图数组里,通过窗口的坐标找到屏幕(位图)的坐标,通过实验证实这样一次的速度肯定比64次getpixel快。 这种基于像素的游戏辅助工具我可以给个例子: (游戏是类似国际象棋的棋盘式的,在每个格子上取两个像素点,进行hash编号……其中calc函数对游戏的下步操作进行运算) 直接getpixel的代码: //一些申明 extern int __cdecl Calc(COLORREF [PoolSizeX][PoolSizeY][2],long*,long*,long*,long*); char temp[100]; BITMAPINFO BitmapInfo; long PoolBitmap[384][384]; COLORREF PoolPixel[384][384]; …………………… COLORREF OrgMap[PoolSizeX][PoolSizeY][2]; int i,j; POINT Point1,Point2; HWND hTarget; #ifndef AERO HDC hdcTarget; #else HWND hDesktop; HDC hdcDesktop; HDC hdc,hdcMem; HBITMAP hBitmap; HBITMAP hOldBitmap; #endif //相对坐标 enum{PoolSizeX=8,PoolSizeY=8}; enum{PoolBaseX=270,PoolBaseY=96,PoolHeight=48,PoolWidth=48}; //程序的消息处理函数 switch (message) { case WM_CREATE: /*V键不常用……寿命也比较长*/ if(RegisterHotKey(hWnd,1,/*MOD_CONTROL*/0,'V')==0)MessageBox(hWnd,"热键注册失败","错误",MB_OK); break; case WM_HOTKEY: hTarget=GetForegroundWindow(); hdcTarget=GetWindowDC(hTarget); InvalidateRect(hTarget,NULL,1); for(j=0;j<PoolSizeY;j++){ /*注意扫描顺序*/ for(i=0;i<PoolSizeX;i++){ /*经试验证实,需要用两个像素来确定棋子*/ OrgMap[i][j][0]=GetPixel(hdcTarget,PoolBaseX+PoolWidth*i+PoolWidth/2-3,PoolBaseY+PoolHeight*j+PoolHeight/2); OrgMap[i][j][1]=GetPixel(hdcTarget,PoolBaseX+PoolWidth*i+PoolWidth/2,PoolBaseY+PoolHeight*j+PoolHeight/2-3); } } ReleaseDC(hTarget,hdcTarget); /* 返回第几个格子之间交换,并不返回坐标 */ i=Calc(OrgMap,&Point1.x,&Point1.y,&Point2.x,&Point2.y); //if(i<=0)break; //For debug... if(i==-1){ SetWindowText(hWnd,"Hash Error!"); break; } if(i==0){ SetWindowText(hWnd,"Can not find!"); break; } wsprintf(temp,"(%d,%d)<->(%d,%d)",Point1.x,Point1.y,Point2.x,Point2.y); SetWindowText(hWnd,temp); Point1.x=PoolBaseX+PoolWidth*Point1.x+PoolWidth/2; Point1.y=PoolBaseY+PoolHeight*Point1.y+PoolHeight/2; MapWindowPoints(hTarget,NULL,&Point1,1); SetCursorPos(Point1.x,Point1.y); mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); Point2.x=PoolBaseX+PoolWidth*Point2.x+PoolWidth/2; Point2.y=PoolBaseY+PoolHeight*Point2.y+PoolHeight/2; MapWindowPoints(hTarget,NULL,&Point2,1); SetCursorPos(Point2.x,Point2.y); mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); break; case WM_DESTROY: PostQuitMessage (0); break; default: return DefWindowProc (hWnd, message, wParam, lParam); } ========================================================== 为了适应vista,原来代码改为截屏并保存位图: switch (message) { case WM_CREATE: /*V键不常用……寿命也比较长*/ if(RegisterHotKey(hWnd,1,/*MOD_CONTROL*/0,'V')==0){ MessageBox(hWnd,"热键注册失败","错误",MB_OK); SendMessage(hWnd,WM_CLOSE,0,0); } break; case WM_HOTKEY: hTarget=GetForegroundWindow(); #ifndef AERO hdcTarget=GetWindowDC(hTarget); #else hdc=GetDC(hWnd); hDesktop=GetDesktopWindow(); hdcDesktop=GetWindowDC(hDesktop); hdcMem=CreateCompatibleDC(hdcDesktop); hBitmap=CreateCompatibleBitmap(hdcDesktop,384,384); //hBitmap=GetSrcBit(hdcDesktop,1034,1024); Point1.x=PoolBaseX;Point1.y=PoolBaseY; MapWindowPoints(hTarget,NULL,&Point1,1); hOldBitmap=(HBITMAP)SelectObject(hdcMem,hBitmap); BitBlt(hdcMem,0,0,384,384,hdcDesktop,Point1.x-2,Point1.y-2,SRCCOPY); hBitmap=(HBITMAP)SelectObject(hdcMem,hOldBitmap); BitmapInfo.bmiHeader.biSize = sizeof(BitmapInfo.bmiHeader); BitmapInfo.bmiHeader.biWidth = 384; BitmapInfo.bmiHeader.biHeight = 384; BitmapInfo.bmiHeader.biPlanes = 1; BitmapInfo.bmiHeader.biBitCount = 32; BitmapInfo.bmiHeader.biCompression = BI_RGB; BitmapInfo.bmiHeader.biSizeImage = 384 * 32 * 384; BitmapInfo.bmiHeader.biClrUsed = 32; BitmapInfo.bmiHeader.biXPelsPerMeter=1; BitmapInfo.bmiHeader.biYPelsPerMeter=1; BitmapInfo.bmiHeader.biClrImportant = 0; GetDIBits(hdcMem,hBitmap,0,384,&PoolBitmap[0][0],&BitmapInfo,DIB_RGB_COLORS); for(i=0;i<384;i++) for(j=0;j<384;j++) PoolPixel[j][383-i]=RGB(((PoolBitmap[i][j]>>16)&0xff),((PoolBitmap[i][j]>>8)&0xff),((PoolBitmap[i][j]>>0)&0xff)); /* for(i=0;i<384;i++) for(j=0;j<384;j++){ SetPixel(hdc,i+10,j+10,PoolPixel[i][j]); }*/ #endif for(j=0;j<PoolSizeY;j++){ /*注意扫描顺序*/ for(i=0;i<PoolSizeX;i++){ /*经试验证实,需要用两个像素来确定棋子*/ #ifdef AERO OrgMap[i][j][0]=PoolPixel[PoolWidth*i+PoolWidth/2-3][PoolHeight*j+PoolHeight/2]; OrgMap[i][j][1]=PoolPixel[PoolWidth*i+PoolWidth/2][PoolHeight*j+PoolHeight/2-3]; #else OrgMap[i][j][0]=GetPixel(hdcTarget,PoolBaseX+PoolWidth*i+PoolWidth/2-3,PoolBaseY+PoolHeight*j+PoolHeight/2); OrgMap[i][j][1]=GetPixel(hdcTarget,PoolBaseX+PoolWidth*i+PoolWidth/2,PoolBaseY+PoolHeight*j+PoolHeight/2-3); #endif } } #ifndef AERO ReleaseDC(hTarget,hdcTarget); #else ReleaseDC(hWnd,hdc); ReleaseDC(hDesktop,hdcDesktop); DeleteDC(hdcMem); DeleteObject(hBitmap); #endif /* 返回第几个格子之间交换,并不返回坐标 */ i=Calc(OrgMap,&Point1.x,&Point1.y,&Point2.x,&Point2.y); //if(i<=0)break; //For debug... if(i==-1){ SetWindowText(hWnd,"Hash Error!"); break; } if(i==0){ SetWindowText(hWnd,"Can not find!"); break; } wsprintf(temp,"(%d,%d)<->(%d,%d)",Point1.x,Point1.y,Point2.x,Point2.y); SetWindowText(hWnd,temp); Point1.x=PoolBaseX+PoolWidth*Point1.x+PoolWidth/2; Point1.y=PoolBaseY+PoolHeight*Point1.y+PoolHeight/2; MapWindowPoints(hTarget,NULL,&Point1,1); SetCursorPos(Point1.x,Point1.y); mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); Point2.x=PoolBaseX+PoolWidth*Point2.x+PoolWidth/2; Point2.y=PoolBaseY+PoolHeight*Point2.y+PoolHeight/2; MapWindowPoints(hTarget,NULL,&Point2,1); SetCursorPos(Point2.x,Point2.y); mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); break; case WM_DESTROY: PostQuitMessage (0); break; default: return DefWindowProc (hWnd, message, wParam, lParam); } ===================================================== 平时在学校里没网线,可能要长期潜水了。 希望能给楼主带来帮助 |
|
|
|
[求助]关于修改中断向量表
至少在vista下debug运行到div cl再t是会出现结果的,如果cmd下运行就卡住了,像死机一样 再仔细一看,原来是iret返回到div cl,而不是div cl的后一句 |
|
[求助]关于修改中断向量表
(废话一下,我曾经挂钩过1ch) ///////////////////////////////// 1. 中断处理部分应该没错.. 只不过div cl之后进入中断,然后iret又返回div cl,又进入中断..........无穷循环 2. 网上有许多TSR的资料.可以供写驻留参考 如果更深入就要去查dos内存管理的书籍了.dos中每块内存都有一个专门的数据结构,其中有一个变量表明这块内存属于那个程序.....以前也没深入写,楼主自己查查吧 3. 想问个问题: 壹群老虎是楼主的大米吗? |
|
[求助]OD下断点的问题
1. 听论坛的前辈说, F7用的是TF F8是用了dr F2用的是int3 ......可能记错了,可以查一下论坛以前的帖子 2. int3之后由于od挂上了seh,所以中断后又回到了OD 瞎说的,不知道对不对,见笑了 |
|
[原创]基于BMP图像的信息隐藏
似乎应该变换后修改不敏感部分...... 对于 低色深 的图像,楼主用的那幅例图,将楼主的文本代码一小部分融合之后失真还是比较明显的: //论坛不能上传bmp,将融合过的bmp转化gif上传 如果坚持用这种方法,或许可以把游程编码先解压,然后将低色深转化为高色深(再RLE回去). 只不过体积会大点... 仍然表示对楼主的支持! |
|
|
|
[原创]写了个玩具编译器
支持........ |
|
Themida 1.8.0.0 Demo虚拟机分析(完成,共8章)
..............强.............................. |
|
[郁闷]Aero时慎用GetPixel
现在更郁闷....... 上面的问题通过访问屏幕dc解决了。 然而aero下访问屏幕相当的慢,无论是GetWindowDC(GetDesktopWindow()...)还是CreateDC("DISPLAY"...)建立起来的。 GetPixel的速度狂慢(汗..)即使总共只读取64个像素,需要将近6秒才能完成64个像素的读取。 然而同样在vista下若关闭aero这份工作瞬间(<1~2ms)就能解决…… 网上早已有前辈发现这个问题了...他还做了试验描述如下: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=545838&SiteID=1 汗涔涔,这时候只想说一句话:Aero真是个新鲜东西 :) |
|
[郁闷]Aero时慎用GetPixel
包括BitBlt也同样的结果。 大概和要get的那个界面是用directx画的也有关。 在通常的情况下aero中GetPixel还是正常的。 为啥对同样的窗口操作vista开了aero就不行...郁闷中…… |
|
[原创]21世纪经典奇图2福,7月21日更新1
vista下似乎不存在第一个问题......... |
|
[求助]谁有vc6.0的 sdk下载啊
嘻嘻,我们学校门口才5元,vs.net/vs6/bcb/msdn全有了 |
|
|
|
|
|
[原创]一个副产品:水晶进度条
已经将闪烁情况“完全”修正了。更新附件于上 |
|
|
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值