Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Help with VirtualProtectEx

  • 22-05-2002 9:31am
    #1
    Closed Accounts Posts: 1,567 ✭✭✭


    I'm trying to use VirtualProtectEx on processes in Windows operating system but cannot calculate the cbSize + lpvAddress properly.
    I've tried many ways to do this, all have ended with errors, usually invalid parameter or memory reference.

    BOOL VirtualProtectEx(

    HANDLE hProcess, // handle of process
    LPVOID lpvAddress, // address of region of committed pages
    DWORD cbSize, // size of region
    DWORD fdwNewProtect, // desired access protection
    PDWORD pfdwOldProtect // address of variable to get old protection
    );

    I already have a handle to the process from OpenProcess, its opened with PROCESS_ALL_ACCESS and have information on it using VirtualQueryEx.
    I know the problem is with lpvAddress + cbSize..this is what I'm stuck on.
    All processes are enumerated with Process32First/Process32Next
    I open each process seperately, use VirtualQueryEx to get information on it, and then what I want to do next is modify the memory access of those processes with different options..like PAGE_GUARD or PAGE_READONLY, PAGE_NOACCESS...etc

    If Anyone can help, thanks, I already have Win32 API documentation, but I don't understand the description for calculating cbSize.


Advertisement