Im in the process of writing an anti-cheat, why? Hobby of sorts.

Background:
Basically I have a process (target.exe) which loads my protections (1, ac.dll).
I also have another library (2, hooks.dll) which is injected into all system non-critical processes where it performs a few hooks.

I want to perform actions FROM ac.dll (dll 1) based on the actions IN hooks.dll (dll 2).

e.g.
(inside hook.dll)
.IF cheating
  mov isCheating, 1
.ENDIF

(inside ac.dll)

.IF isCheating=1

  ; bann, terminate process, etc...

.ENDIF


I'm unsure how I can communicate between DLL2 and DLL1... I've read some information regarding to Shared Memory Segments, is that the best way to go, and if so how to implement? Or is there an easier alternative...

Cheers,
Ksbunker
Posted on 2008-05-23 01:35:52 by Ksbunker
You have to realize that you aren't communicating between DLL1 and DLL2 - DLLs don't run as separate entities, they are mapped into all processes that load them. Thus, you will be communicating between processes.

The easiest way to have a global-visible shared piece of memory is by using named memory-mapped files - CreateFileMapping with hFile=INVALID_HANDLE_VALUE, and lpName=something-unique (like a GUID).
Posted on 2008-05-23 07:53:15 by f0dder