Advertisement

What are hooks?

Started by April 30, 2001 02:14 AM
40 comments, last by Merge2 23 years, 9 months ago
wait a sec, isn''t that prog''s output from a .vxd file,
or it''s just the .dll with a system wide hook?

Arkon
[QSoft Systems]
It is an output from Xylobot (www.xylobot.com). System hooks intercept win messages, not calls to DirectX COM functions. There is a way to hook API functions by dll injection, but it doesn''t work (I don''t know how to implement it) for COM yet. I guess I will have to screw with v-table and tell COM interface to report pointer to my fn instead of regular one. At least that is what I will explore next and if it doesn''t work I''ll think of something else...

Advertisement
vyer goal is to program a macro app,
or just spying DI , and put key pressings?
oh i thought the output was based on hooks..that''s why i messed the things here

that''s bitch , to touch the v-table and stuff like that in order to spy/etc there must be other elegant way i guess
does the normal hook for the API functions work for you?

Arkon
[QSoft Systems]
Well, by trying to figure out this one I''ve learned a lot and collected source code on some really cool stuff. That knowledge will come handy one day.
I know that when COM object is created it has it''s own memory segment somewhere and I can get a pointer to it. I can also get a pointer to interfaces it supports. Through that interface I SHOULD be able to get pointers to methods it supports. I also should be able to change pointer to function I want to intercept somehow to point to my function instead.
Good luck with your VxD project, when I resolve this I may do some research myself.

Just to answer one question (I think) and ask another. First I think the main reason for using asm in a VxD (for ammatures) is because all the relevent stuff for programming is supplied with Masm32 (iczillion) + I think that only certain versions of DevStudio work with the DDK (I''m not sure that 6.0 is one of those).

And my question; How is someone slowing down half-life...I guess you could redirect timing functions ( QueryPerformaceCounter etc.) via a custom DLL ? I wouldn''t want to do it at Ring 0 level for fear of stuffing some other time dependent process up...(system clock perhaps ?)
ohh.. that sounds good, i hope it will work!
COM is a bitch, many things are invisible for us

NickB-are you sure only a few vers support the ddk?
weird
slowing down a game.... why''s that??
i have no idea how to do that...
if it were in ring 0 you could play with the timer interrupt and slow down everything

maybe that someone who did it knows which functions they use for timing and somehow changed those specifically with a .dll or something



Arkon
[QSoft Systems]
Advertisement
I guess that most of the games work in virtual-real time mode (hehe, foot in my mouth). What I mean by that is that if you let''s say intercept some periodic function (like Flip() or anything that is called within a game loop) and put a time delay into it you will in most cases lower the FPS number but the game events will still appear at normal rate. Moreover, game is REQUIRED to have machine-independent event rate mechanism.
To cut it short, check for:
QueryPerformanceFrequency() and
QueryPerformanceCounter()
and if called by HL, just use dll injection to intercept it and send your own values.


you think AI should be in a computer''s time,
and not real constant time, like 100 milisecs...?
or i got you wrong?

Arkon
[QSoft Systems]
I have problems expressing myself sometimes, ; )
What I meant is that games use absolute time, and relative FPS. There is a rendering loop that in most games just goes as fast as system supports it. Inside the loop is animation mechanism (for example) that calculates absolute time period from the beginning of animation and then draws required key frame. Thus if you slow down your game by some delay mechanism you will just get less key frames per second (or frames per second, whatever) but actions (animation duration) will still take the same time.
Also, if you interfere with VMM my guess is that you will slow down the system (QueryPerformanceCounter) and accordingly get lower QueryPerformanceFrequency() value, and thus not accomplish anything if game is calculating time by high precision timers. Meaning, whatever you do in VMM, ratio of QueryPerformanceCounter()/QueryPerformanceFrequency() will stay the same.
I think that correct solution would be to let system report its freq., intercept it and report your own freq. to game. Thus the ratio QueryPerformanceCounter()/QueryPerformanceFrequency() will change.


Arkon, having looked more carefully I have found that MS have said that the DDK _samples_ will not compile with MSVC 6.0, and then they only talked in terms of MSVC 5.0 & 4.2...dunno exactly what conclusions to draw from that...

I was only pondering over slowing down a game as a result of Merge2''s second post...kinda intreged me because I''d seen another early windows 95 game (Grand Prix Legends - I wanted to seed the cars) that can''t have been doing it''s timing properly because on my Athalon it goes far too fast.

This topic is closed to new replies.

Advertisement