使用本辅助工具,要小心,别让人举报被封锁了游戏,呵呵~
前天,用VB6写了一个QQ游戏大家来找茬的辅助工具,可是,运行速度太慢了,等到出结果的时候,基本上游戏时间都用了三分之二以上了,所以没有什么实际的意义. 因此,我又用VC#重新写了一下,这样马马虎虎还可以用,原理是这样的: 先用红蜻蜓抓图精灵将QQ游戏大家来找茬的游戏窗口抓图保存成JPG图片,然后用程序读入这幅图片,并截取游戏中的两幅图片,在每隔0.5秒交替显示,这样的话,左右两幅图里面不同的地方就会闪烁,这是只要在游戏的图片上面点击下就可以了.
这么做的程序也只能称之为辅助工具,称不上外挂,所以不用担心会被腾讯发现或封锁. 以我的看法真正的游戏外挂的原理,应该这么做: 分析游戏的内存,找到这两幅图在内存中的地址,然后对内存中的图片数据做对比,最后使用HOOK来在有差异的地方模拟点击鼠标左键就可以了. 但是,这样的外挂也存在一个问题,一是要读取游戏的内存内容,很有可能被杀毒软件当作是木马等恶意程序,二是,这些图片很有可能是存储在腾讯的游戏服务器上的,而客户端在和服务端通讯的时候,仅仅是发送了鼠标相对于图片上的位置数据给服务器而已,然后服务器根据接收到的位置数据来判断,你是否找到了两幅图片不一样的地方. 这种情况的话,本地内存中就并没有图片的像素数据,就无从谈起来做对比了,此时,仍然需要通过截图来实现获取图片的数据.
【下载说明】
1、单击上面这个地址,打开下载页面。
2、点普通下载--等待30秒--点“下载”按钮--保存
演示视频地址:http://v.youku.com/v_show/id_XMjEyMDQ1NzQ0.html
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace QQHelper
{
public partial class frmMain : Form
{
private Bitmap wndBitmap = null;
private Bitmap leftBitmap = null;
private Bitmap rightBitmap = null;
private int width1 = 380;
private int height1 = 285;
private int x11 = 10;
private int y11 = 185;
private int x12 = 390;
private int y12 = 470;
private int a1 = 392+1;
private int width2 = 498;
private int height2 = 448;
private int x21 = 7;
private int y21 = 191;
private int x22 = 505;
private int y22 = 639;
private int a2 = 508+1;
private int ShowFlag = 0;
public frmMain()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (wndBitmap != null)
{
wndBitmap.Dispose();
wndBitmap = null;
}
SendKeys.Send("%{PRTSC}");
IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.Bitmap))
{
wndBitmap = (Bitmap)Clipboard.GetImage();
timer3.Enabled = true;
}
else
{
timer3.Enabled = false;
return;
}
}
private void timer2_Tick(object sender, EventArgs e)
{
if (ShowFlag == 0)
{
pictureBox1.Image = (Bitmap)leftBitmap;
ShowFlag = 1;
}
else
{
pictureBox1.Image = (Bitmap)rightBitmap;
ShowFlag = 0;
}
}
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (leftBitmap != null)
{
leftBitmap.Dispose();
leftBitmap = null;
}
if (rightBitmap != null)
{
rightBitmap.Dispose();
rightBitmap = null;
}
if (wndBitmap != null)
{
wndBitmap.Dispose();
wndBitmap = null;
}
}
private void frmMain_Load(object sender, EventArgs e)
{
}
private void timer3_Tick(object sender, EventArgs e)
{
if (wndBitmap == null) return;
if (wndBitmap.Width != 1024 && wndBitmap.Width != 800)
{
label1.Visible = true;
label1.Text = "请将游戏窗口打开,并不要在屏幕外!";
wndBitmap.Dispose();
wndBitmap = null;
return;
}
label1.Visible = false;
int w1 = 0, h1 = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0, a = 0;
if (wndBitmap.Width == 1024)
{
w1 = width2;
h1 = height2;
x1 = x21;
y1 = y21;
x2 = x22;
y2 = y22;
a = a2;
}
else
{
w1 = width1;
h1 = height1;
x1 = x11;
y1 = y11;
x2 = x12;
y2 = y12;
a = a1;
}
if (leftBitmap == null) leftBitmap = new Bitmap(w1, h1, PixelFormat.Format24bppRgb);
if (rightBitmap == null) rightBitmap = new Bitmap(w1, h1, PixelFormat.Format24bppRgb);
BitmapData wndBitmapData = wndBitmap.LockBits(new Rectangle(0, 0, wndBitmap.Width, wndBitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
BitmapData leftBitmapData = leftBitmap.LockBits(new Rectangle(0, 0, leftBitmap.Width, leftBitmap.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
BitmapData rightBitmapData = rightBitmap.LockBits(new Rectangle(0, 0, rightBitmap.Width, rightBitmap.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
unsafe
{
byte* ptrWnd = (byte*)wndBitmapData.Scan0.ToPointer();
byte* ptrlef = (byte*)leftBitmapData.Scan0.ToPointer();
byte* ptrRig = (byte*)rightBitmapData.Scan0.ToPointer();
int i = 0, j = 0;
for (i = y1; i < y2; i++)
{
for (j = x1; j < x2; j++)
{
*(ptrlef++) = *(ptrWnd + i * wndBitmapData.Stride + j * 3);
*(ptrlef++) = *(ptrWnd + i * wndBitmapData.Stride + j * 3 + 1);
*(ptrlef++) = *(ptrWnd + i * wndBitmapData.Stride + j * 3 + 2);
*(ptrRig++) = *(ptrWnd + i * wndBitmapData.Stride + (j + a) * 3);
*(ptrRig++) = *(ptrWnd + i * wndBitmapData.Stride + (j + a) * 3 + 1);
*(ptrRig++) = *(ptrWnd + i * wndBitmapData.Stride + (j + a) * 3 + 2);
}
ptrlef += leftBitmapData.Stride - leftBitmap.Width * 3;
ptrRig += rightBitmapData.Stride - rightBitmap.Width * 3;
}
wndBitmap.UnlockBits(wndBitmapData);
leftBitmap.UnlockBits(leftBitmapData);
rightBitmap.UnlockBits(rightBitmapData);
ptrWnd = null;
ptrlef = null;
ptrRig = null;
}
wndBitmap.Dispose();
wndBitmap = null;
}
}
}【更多文章】
本文介绍了如何使用VB6和VC#制作QQ游戏大家来找茬的辅助工具,通过抓图对比帮助玩家找到不同之处。虽然这种方法仅能称为辅助,而非外挂,但讨论了真正的外挂可能涉及内存分析和HOOK技术。同时提供了程序下载和演示视频链接。
3628

被折叠的 条评论
为什么被折叠?



