To protect individual fragments of the code and to protect string constants, you can insert special markers to the source code of your application. Markers are calls to functions imported from the external library (32-bit applications use DogProtectSDK32.dll, and 64-bit applications use DogProtectSDK64.dll; drivers use DogProtectDDK32.sys and DogProtectDDK64.sys respectively) - further referred to as DogProtectSDK. Procedures and functions in DogProtectSDK do not perform any actions and are merely labels DogProtect uses to determine boundaries of the protected code. The beginning and the end of the protected block are marked as follows:
uses DogProtectSDK; DogProtectBegin(MARKER_TITLE); ... DogProtectEnd;
#include "DogProtectSDK.h" DogProtectBegin(MARKER_TITLE); ... DogProtectEnd();
include DogProtectSDK.inc invoke DogProtectBegin,SADD(MARKER_TITLE) ... invoke DogProtectEnd
DogProtectBegin (StrPtr(MARKER_TITLE)) ... DogProtectEnd
Also, instead of DogProtectBegin you can use markers with the predefined compilation types:
Markers are processed as follows: when DogProtect analyzes the code of the protected application, it locates all calls to DogProtectSDK procedures and functions. Boundaries of blocks to protect are defined by marker pairs DogProtectBegin/DogProtectBeginVirtualization/DogProtectBeginMutation/DogProtectBeginUltra and DogProtectEnd. Then, when DogProtect processes the code of the protected application, it removes both the markers and any mentions of the DogProtectSDK, so there is no need to include these libraries to your setup package. Markers are removed regardless of whether they are included to compilation or not. When named markers are used, their names are also removed.
If a title for the marker is specified, it is assigned with the name like "DogProtectMarker MARKER_TITLE". If a title of the marker is not specified, it is assigned with a unique name: "DogProtectMarker"+marker serial number. However, using non-named markers has a significant disadvantage: if a new marker will be inserted to the code of the program, numeration of all non-named markers will change. So we recommend to always use named markers.
A particularly important thing to consider when working with markers is that you shouldn't allow jumps from non-protected areas inside the marker. This can happen, for example, if you enclose a part of a cycle in markers. If the application that uses markers becomes non-functional after protection, you can detect jumps from non-protected areas and addresses by enabling the "Debug mode" option. In this mode, when the protected application works under the debugger, the latter will interrupt execution of the program if a jump from a non-protected area into the protected debugger is detected. When all such jumps are found, you should either change placement of the markers, or if this is impossible, mark those addresses as external using the GUI version of DogProtect.