C#Opengl游戏cs 1.6截图(Opentk Library错误)

时间:2013-04-26 21:42:54

标签: c# opengl screenshot

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

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

&安培;

万维网。 opentk。 COM /节点/ 3312

有一个人对我说,我没有拍摄游戏的截图,而且我已经创建了一个dll并注入游戏(反恐精英1.6)。

但是在执行framebuffer和grabscreenshot时我遇到了一些错误!

这是打印错误:

我正在注入这个来源:

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#语言编程!

0 个答案:

没有答案