0

我把这个问题放在opengl论坛上:

http://www.opengl.org/discussion_boards/showthread.php/181549-OpenGL-screenShot-a-game

&

万维网。opentk。com/node/3312

一个人对我说我什么都不会截图游戏,我在这之后创建了一个 dll 并注入到游戏中(反恐精英 1.6)。

但是在执行帧缓冲区和抓取屏幕截图时出现一些错误!

这是打印错误:

我正在注入这个来源:

void Inject()
    {
        System.IntPtr TargetProcessHandle;
        int TargetBufferSize;
        String pszLibFileRemote;
        int pfnStartAddr;
        Process[] TargetProcess = Process.GetProcessesByName("hl");
        TargetProcessHandle = OpenProcess(0x1F0FFF, false, TargetProcess[0].Id);
        pszLibFileRemote = Application.StartupPath + ("\\dll.dll");
        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32.dll"), "LoadLibraryA");
        TargetBufferSize = 1 + pszLibFileRemote.Length;
        int Rtn;
        int LoadLibParamAdr;
        LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, 4096, 4);
        Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0);
        CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0);
        CloseHandle(TargetProcessHandle);
    } 

我已将 dll 上的一些代码编辑为:

Bitmap snapShotBmp = new Bitmap(width, height);
        System.Drawing.Imaging.BitmapData bmpData = snapShotBmp.LockBits(new Rectangle(0, 0, width, height), System.Drawing.Imaging.ImageLockMode.WriteOnly,
                                                  System.Drawing.Imaging.PixelFormat.Format24bppRgb);
        GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgr, PixelType.UnsignedByte,
                      bmpData.Scan0);
        snapShotBmp.UnlockBits(bmpData);
        return snapShotBmp;

我正在用 c# 语言编程!

4

0 回答 0