.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 2 SDK (http://forums.bots-united.com/forumdisplay.php?f=62)
-   -   Hooking into HL2 DLL ? (http://forums.bots-united.com/showthread.php?t=3400)

stefanhendriks 12-01-2005 21:04

Hooking into HL2 DLL ?
 
I got to this link via the hlcoding mailing list,

http://www.sourcemod.net/forums/viewtopic.php?t=441

i don't understand it yet. But basicly its telling how to HOOK (aka HL1 style!?) into HL2 and such... if possible, this could be more interesting...

Cpl. Shrike 12-01-2005 21:20

Re: Hooking into HL2 DLL ?
 
Reading..... brain hurts o_O
Keeps reading

Pierre-Marie Baty 12-01-2005 21:42

Re: Hooking into HL2 DLL ?
 
that guy had a clever idea. However, if I understand well, as soon as the interface changes a bit, he's left to rearrange all his function pointers in the vtable. I'm not sure it's very practical. It doesn't seem to bother the AMX guys though, as they are used to get/set info where they shouldn't, such as in HL1 edict's private data...

sfx1999 12-01-2005 23:23

Re: Hooking into HL2 DLL ?
 
You could probably code it so that if there is a new interface, it bypasses the hook.

Pierre-Marie Baty 13-01-2005 02:33

Re: Hooking into HL2 DLL ?
 
huh?
what would be the point ?

sfx1999 13-01-2005 04:59

Re: Hooking into HL2 DLL ?
 
Well, you can hook whatever functions you need, and have the ones you don't bypass it. You can also make it so that if new functions come around, they could also bypass it.

Pierre-Marie Baty 13-01-2005 15:42

Re: Hooking into HL2 DLL ?
 
No, you don't get it. The order in which the functions are may be arranged everytime a new interface version is defined. Contrarily to HL1. That's the purpose of this "interface factory" to ensure consistency between DLLs using different versions of the interface. Unless he cares about the version of the interface he hooks onto (but I don't see him doing that), he'll be in big trouble at any minor revision of the interface.

dub 17-01-2005 01:18

Re: Hooking into HL2 DLL ?
 
i thought about an easier way using the plugin interface. Technically if we chain the plugin, Is it not possible too dump any information between the server -> plugin interface like weapon bit id`s (really needed at the moment).

botman 17-01-2005 01:38

Re: Hooking into HL2 DLL ?
 
What do you mean by "chain the plugin"?

Plugins in Half-Life2 are implemented similar to the way they are in Metamod. The plugin does not sit between the engine and the game DLL.

In Half-Life2, the engine can call plugin functions when (after) game DLL functions are called. It's more of a branch off from the main engine/gameDLL connection than it is a connection between them.

For example, the engine calls the game DLL GameFrame() function, then when the game DLL returns back to the engine, the engine calls it for plugin A, then plugin B, then plugin C, like this...

engine->GameDLL::GameFrame()
<- GameDLL::GameFrame() returns back to the engine
engine->PluginA::GameFrame()
<- PluginA::GameFrame() returns back to then engine
engine->PluginB::GameFrame()
<- PluginB::GameFrame() returns back to the engine

...it's NOT like this...

engine->PluginA::GameFrame()->PluginB::GameFrame()->GameDLL::GameFrame()

..that would be more like the way the HPB bot hooks the game DLL. The Half-Life2 plugin system does not work that way.

botman

dub 17-01-2005 01:46

Re: Hooking into HL2 DLL ?
 
botman what i mean is engine call`s the hook plugin, then hook plugin calls the real plugin.
Have a hook dll that sit`s in between dumping various information on engine functions passed to the real plugin.

edit
found an intresting hooking library for injecting your own code into a remote process windows only here


All times are GMT +2. The time now is 17:46.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.