0

I am trying to make a client-sided anticheat which would work similar to BattlEye or GameGuard. In order to do this, I want to create a DLL which would do the cheat verification, which then I would inject to the executable of the game.

What language should I use for the DLL? I was planning to use C#, but I've noticed that people prefer C++ for these kinds of projects. Why that? What's the downsides of using C# for a DLL?

4
  • Typically C++ can access lower level windows functions therefore detect any tampering from a cheat client at a lower level.
    – Paradigm
    Commented Oct 11, 2019 at 11:20
  • you can decompile a C# or vb.net easily. Because it is using .net framework, of course you want to do it in C++
    – Gin May
    Commented Oct 11, 2019 at 12:10
  • @GinMay While this is probably at the core of why C++ is better suited than C# for the task, the answer is rather ... terse. Besides, any such usermode solution would simply be blind to KM-side tampering (e.g. via the driver included with CheatEngine).
    – 0xC0000022L
    Commented Oct 11, 2019 at 13:31
  • Besides from the fact that you can't inject a managed DLL into an unmanaged process. Commented Oct 16, 2019 at 4:23

1 Answer 1

0

The downsides really lie in C# being a managed language, you lose a lot of control. For example all of your code will get compiled into RWE memory at runtime which complicates self validation. The compiled code itself also relies strongly on the CLR module which provides even further opportunities to reroute your execution. Further, because of its high level, it's trivial to decompile, making RE much simpler. Finally, as an AC, you're going to eventually need more low level code such as custom assembly blocks for manual syscalls or hooking a custom prototype. None of these downsides are completely 'unfixable' (you can use a worker native module for what's needed, virtualize important code blocks, etc.) but it makes your job that much harder. In the end it depends on what your goals are, but for most purposes you're far better off native for this type of job.

Not the answer you're looking for? Browse other questions tagged or ask your own question.