Raised This Month: $12 Target: $400
 3% 

How to hook/call game dll function from module?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
STekLyAToR
Member
Join Date: May 2016
Old 08-06-2017 , 15:55   How to hook/call game dll function from module?
Reply With Quote #1

I have a name of function and disassembled code, can get a signature and maybe address.
What should I do to call game dll function from my module?
STekLyAToR is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 08-06-2017 , 15:56   Re: How to hook/call game dll function from module?
Reply With Quote #2

Use Orpheu.
__________________
Spirit_12 is offline
STekLyAToR
Member
Join Date: May 2016
Old 08-06-2017 , 16:08   Re: How to hook/call game dll function from module?
Reply With Quote #3

Quote:
Originally Posted by Spirit_12 View Post
Use Orpheu.
I don't need to call function from pawn script, and I know what Orphey can do it.
I could see how it is implemented in Orphey, but he contain a lot of code and i can't understand it.
STekLyAToR is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-06-2017 , 19:20   Re: How to hook/call game dll function from module?
Reply With Quote #4

Unless you want to use some library, it's really advanced and requires x86 assembly knowledge as well. Search around the forums for "CHooker" or CDetour.

However, if you can't deal with it, better stick to Pawn and Orpheu.
klippy is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 08-07-2017 , 10:07   Re: How to hook/call game dll function from module?
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
Unless you want to use some library, it's really advanced and requires x86 assembly knowledge as well. Search around the forums for "CHooker" or CDetour.

However, if you can't deal with it, better stick to Pawn and Orpheu.
The version of CDetour you linked is coupled to SourceMod, here's the version that should work with AMXX: https://github.com/alliedmodders/amx...mtools/CDetour
__________________
WildCard65 is offline
STekLyAToR
Member
Join Date: May 2016
Old 08-09-2017 , 16:25   Re: How to hook/call game dll function from module?
Reply With Quote #6

Where I can find any example or tutorial of CDetour?
I was looking for on this forum, but found nothing. Also, i was reseached source codes of ns, cstrike modules, but that work with pvPrivateData and do not contain any information about calling dll funcs.
STekLyAToR is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-09-2017 , 16:47   Re: How to hook/call game dll function from module?
Reply With Quote #7

Check amxmodx/meta_api.cpp and search for SV_DropClient.
klippy is offline
STekLyAToR
Member
Join Date: May 2016
Old 08-10-2017 , 08:38   Re: How to hook/call game dll function from module?
Reply With Quote #8

Quote:
Originally Posted by KliPPy View Post
Check amxmodx/meta_api.cpp and search for SV_DropClient.
As I understand, to detour function I need to it was declared in my code?
For example, using IDA I found out that exist is that function:
Code:
void AdjustSpecificWeapon(tsweapon_t, float, float, float, float, int)
But that function are not declared in cpp code, because that from game dll.
Will it be enough to declare a func for detour that, or i need initialize func and after detour?
STekLyAToR is offline
STekLyAToR
Member
Join Date: May 2016
Old 08-15-2017 , 23:40   Re: How to hook/call game dll function from module?
Reply With Quote #9

I worked my idea without calling any clientside functions. I have more attentively studied the code and find out that target function uses g_engfuncs[47], I started looking for declare of g_engfuncs, and found function g_engfuncs[0], this function took the path to model. And later, exploring AMXX SDK, I noticed that in defines function PrecacheModel is first, and I assumed that PrecacheModel has index 0. Experimentally I scroll through 46 lines down and mark line, this line was define of MessageBegin. I used this method on other functions for convert calling using pointer on instance of array to function names. Using the obtained information, I was able to more detail examine the code of AdjustSpecificWeapon. Examined, I was discovered that this function can be replaced to messages. Thanks to all for the help.

Last edited by STekLyAToR; 08-15-2017 at 23:40.
STekLyAToR is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 08-17-2017 , 15:04   Re: How to hook/call game dll function from module?
Reply With Quote #10

Quote:
Originally Posted by STekLyAToR View Post
I worked my idea without calling any clientside functions. I have more attentively studied the code and find out that target function uses g_engfuncs[47], I started looking for declare of g_engfuncs, and found function g_engfuncs[0], this function took the path to model. And later, exploring AMXX SDK, I noticed that in defines function PrecacheModel is first, and I assumed that PrecacheModel has index 0. Experimentally I scroll through 46 lines down and mark line, this line was define of MessageBegin. I used this method on other functions for convert calling using pointer on instance of array to function names. Using the obtained information, I was able to more detail examine the code of AdjustSpecificWeapon. Examined, I was discovered that this function can be replaced to messages. Thanks to all for the help.
Why so complicated?

Check for enginefuncs_t struct at eiface.h on hlsdk
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode