Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Managing virtual memory protection on entire application

$
0
0

I am writing an assembly program which will attempt, once the program is loaded into memory, to re-write over a portion of previous instructions, move the instruction pointer to them, and begin execution. However, a general protection exception occurs because of virtual memory protection settings.

The assembly function will be called from a C++ application, e.g. like so:

#include <iostream>
#include <Windows.h>

// External assembly function 'asm_func' found
// in asm_func.asm; using C calling convention

extern "C" void asm_func();

int main(void)
{

    asm_func();
    return 0;

}

I would like to set read/write/execute permissions on the entire application, including on the memory where main() and asm_func() are loaded into. I was thinking of usingVirtualProtect(), but how do I acquire the parameters to do so?



Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>