A computer system on which an operating system comprising at least one application programming interface is executed, on which operating system at least one application is executed, the computer system comprising a memory and at least one processor, this memory storing processor-executable instructions corresponding to an executable piece of code injected into a process belonging to the application, the instructions comprising functionalities for:
- intercepting a call from the process belonging to the application to an application programming interface service related with the management of a data flow produced between the process and the hardware resource, wherein the intercepting at least comprises redirecting an application programming interface service to a corresponding service comprised in the piece of code;
- and managing the data flow produced between the process and the hardware resource by the piece of code on the basis of the interception of the call from the process to the application programming interface service related with the management of the data flow produced between the process and the hardware resource, wherein, the application programming interface service is:
- a function;
- or an object method, and wherein redirecting an application programming interface service related with the management of the data flow produced between the process and the hardware resource to a corresponding service comprised in the piece of code comprises:
- loading in the memory a dynamic link library comprising the application programming interface function or object method to be redirected;
- replacing, in a function pointer table for the application programming interface functions or object methods comprised in the loaded dynamic link library, the initial memory address in which the application programming interface function or object method to be redirected is stored with the initial memory address in which the corresponding function or object method comprised in the piece of code is stored, wherein the replacing, in case the application programming interface service is an object method is performed after having verified that the object associated with the method to be redirected is created for the first time.