Tag Archives: cpp

Custom prolog and epilog for a function in C++

Traditionally, the compiler is responsible for creating the prolog and epilog of a function. However, custom prolog and epilog code can be written if a function has been declared with the naked attribute. The snippet below demonstrates a naked function with custom prolog and epilog code. __declspec(naked) void foo(){ // Prolog __asm { push ebp [...]

Posted in Assembler, C++ | Also tagged , , , , , , , , , , , , , | Leave a comment

Hooking with the Microsoft Detours library in C++

The DLL Injection example described how to inject a DLL into an existing process. The snippets below demonstrate a combination of hooking and DLL injection in C++ with the Microsoft Detours library. Quote: In computer programming, the term hooking covers a range of techniques used to alter or augment the behavior of an operating system, [...]

Posted in C++ | Also tagged , , , , , , , , , , , , , , , | 5 Comments

(C++) Gaussian Elimination

Numerical Methods application for solving system of equation using Gaussian Elimination based on this Wikipedia article: http://en.wikipedia.org/wiki/Gaussian_elimination

Posted in C++ | Also tagged , , , , , , , | Leave a comment

Basic client/server communication in C++ using the RakNet networking engine

Quote: RakNet is a cross-platform C++ and C# game networking engine. It is designed to be a high performance, easy to integrate, and complete solution for games and other applications. The snippets below demonstrate basic client/server communication using the RakNet library.

Posted in C++ | Also tagged , , , , , , , , , , | Leave a comment

DLL injection in C++

DLL injection in Windows can be used to inject a DLL into a process and to take over/extend functionality. For example, the distribution platform Steam uses DLL injection for the game overlay.

Posted in C++ | Also tagged , , , , , , , , , , , , | 5 Comments

Closest pair of points problem in C++

Given n points, find two points with the smallest distance to each other. The examples listed below demonstrate two algorithms in C++ to tackle this problem. One algorithm simply checks every combination of points, also known as a brute force approach. The other one is an efficient algorithm which uses a divide and conquer approach.  The [...]

Posted in C++ | Also tagged , , , , , , , , , | 2 Comments