首页
社区
课程
招聘
[旧帖] hook glBegin 0.00雪花
发表于: 2011-7-10 17:31 3464

[旧帖] hook glBegin 0.00雪花

2011-7-10 17:31
3464
// RegistryInfo.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include <stdlib.h>
#include "HookInfo.h"
#include <gl/gl.h>
#pragma comment ( lib , "Opengl32.lib" )

int _stdcall Export()
{
        return 0;
}

typedef void(WINAPI * MYGLBEGIN)(DWORD mode);

MYGLBEGIN MyglBegin = NULL;

///////////////////////////////////////////////////////////////////
////////////////////回调函数///////////////////////////////////////

void WINAPI MYglBeginCallback(DWORD mode);
/////////////////////////////////
CHookInfo *ChookMyglBegin;

HINSTANCE m_hinstDll;
HWND m_hWnd;

DWORD m_ProcessId;

//初始NT系列的函数
VOID LoadNtDll()
{
HMODULE hMod = LoadLibrary("opengl32.dll");
MyglBegin = (MYGLBEGIN)GetProcAddress(hMod,"glBegin"); //得到某个Nt函数地址

FreeLibrary(hMod);
}

//DLL入口点函数
BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
m_hinstDll=hInstance;
if (dwReason == DLL_PROCESS_ATTACH)
{
  LoadNtDll();
  if (GetCurrentProcessId()!=0)
  {
   ChookMyglBegin = new CHookInfo("opengl32.dll","glBegin",(DWORD)MYglBeginCallback);
  }
}
else if (dwReason == DLL_PROCESS_DETACH)
{
  if (GetCurrentProcessId()==m_ProcessId)
  {
   delete ChookMyglBegin;
  }
}
return TRUE;   // ok
}

//MytextoutA的回调函数
void APIENTRY MYglBeginCallback(DWORD mode )
{
        switch (mode) //wall不透明
        {
        if (mode == GL_TRIANGLE_STRIP || mode == GL_TRIANGLE_FAN || mode== GL_TRIANGLES)
                {
                        glDepthRange( 0, 0.5);

                //        (*p_fnglDisable)(GL_DEPTH_TEST);
                }else
                {
                                glDepthRange( 0.5, 1);
                                glBegin(mode);       
                }
       
                break;
                        break;
        case 2:
                        break;
        default:
               
       
                break;
        }
       
}

代码写的简单啊,可是就达不到透视效果,到CS里面是满屏红色的
我就要个简单的透视就行啊。
求指点迷津

[课程]FART 脱壳王!加量不加价!FART作者讲授!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 145
活跃值: (85)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
2
代码是照网上的原理写的呃
2011-7-10 17:35
0
雪    币: 145
活跃值: (85)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
3
求指点
2011-7-10 19:21
0
游客
登录 | 注册 方可回帖
返回
//