Need help with DrawModelExecute

Posts 1–7 of 7 · Page 1 of 1
Need help with DrawModelExecute
Hey, I'm trying to hook DrawModelExecute. And in my hook, when i dont call the original one, I wont crash but obviously all my models are invisible. So when i try to call the original like i do with other hooks, my game just crashes. Attaching a debugger, I'm getting "Exception thrown at 0x0C9FBD96 (engine.dll) in csgo.exe: 0xC0000005: Access violation reading location 0x000A0503.

Don't really know what that's suposed to mean.
Anyways, here's my hook.

void __stdcall Hooks::Hooked_DrawModelExecute(void* context, void* state, const ModelRenderInfo_t &pInfo, SourceEngine::matrix3x4_t *pCustomBoneToWorld)
{



oDrawModelExecute(context, state, pInfo, pCustomBoneToWorld);

}

Thanks in advance
Quote Originally Posted by affenaff View Post
Hey, I'm trying to hook DrawModelExecute. And in my hook, when i dont call the original one, I wont crash but obviously all my models are invisible. So when i try to call the original like i do with other hooks, my game just crashes. Attaching a debugger, I'm getting "Exception thrown at 0x0C9FBD96 (engine.dll) in csgo.exe: 0xC0000005: Access violation reading location 0x000A0503.

Don't really know what that's suposed to mean.
Anyways, here's my hook.

void __stdcall Hooks::Hooked_DrawModelExecute(void* context, void* state, const ModelRenderInfo_t &pInfo, SourceEngine::matrix3x4_t *pCustomBoneToWorld)
{



oDrawModelExecute(context, state, pInfo, pCustomBoneToWorld);

}

Thanks in advance
How do you initialize the hook?
Quote Originally Posted by WildAssassinz View Post
How do you initialize the hook?
In my hook.h

typedef void(__stdcall * DrawModelExecuteFn)(void*, void*, const ModelRenderInfo_t&, SourceEngine::matrix3x4_t*);

extern DrawModelExecuteFn oDrawModelExecute;

void __stdcall Hooked_DrawModelExecute(void* context, void* state, const ModelRenderInfo_t &pInfo,SourceEngine::matrix3x4_t *pCustomBoneToWorld);


in my hook.cpp

std::unique_ptr<VFTableHook> g_ModelRender = nullptr;

DrawModelExecuteFn oDrawModelExecute = nullptr;

g_ModelRender = make_unique<VFTableHook>((PPDWORD)SourceEngine::In terfaces::ModelRender(), true);

oDrawModelExecute = g_ModelRender->Hook(21, (DrawModelExecuteFn)Hooked_DrawModelExecute);


this is what I do. When i put another hook in like overrideview or painttraverse, it worked flawlessly. So im clueless.
It most likely has something to do with calling the original one though.
Quote Originally Posted by affenaff View Post
In my hook.h

typedef void(__stdcall * DrawModelExecuteFn)(void*, void*, const ModelRenderInfo_t&, SourceEngine::matrix3x4_t*);

extern DrawModelExecuteFn oDrawModelExecute;

void __stdcall Hooked_DrawModelExecute(void* context, void* state, const ModelRenderInfo_t &pInfo,SourceEngine::matrix3x4_t *pCustomBoneToWorld);


in my hook.cpp

std::unique_ptr<VFTableHook> g_ModelRender = nullptr;

DrawModelExecuteFn oDrawModelExecute = nullptr;

g_ModelRender = make_unique<VFTableHook>((PPDWORD)SourceEngine::In terfaces::ModelRender(), true);

oDrawModelExecute = g_ModelRender->Hook(21, (DrawModelExecuteFn)Hooked_DrawModelExecute);


this is what I do. When i put another hook in like overrideview or painttraverse, it worked flawlessly. So im clueless.
It most likely has something to do with calling the original one though.
idk but , try removing what @affe2626 said and that Interfaces::ModelRender(), ture
I think you're reading from the "0x000A0503" address in memory which you don't have permission to do, check for nullptr's and such. I'm not so good at hooking so i don't really know what it is but i assume it's that.

You also have a really nice name + country, insta +rep
Quote Originally Posted by affe2626 View Post
I think you're reading from the "0x000A0503" address in memory which you don't have permission to do, check for nullptr's and such. I'm not so good at hooking so i don't really know what it is but i assume it's that.

You also have a really nice name + country, insta +rep
man bockar och bugar.

+rep'd back
Been over a week since last update/bump after answers, assuming solved.

/Closed.
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?