Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


virtualprotect()  problem

Posted on 2004-04-16
Medium Priority
Last Modified: 2010-04-01
Hey there,
I am having a problem using virtualprotect(), i need to know the address of the memory outside the address space of my own program. The problem is thatthe API i am working with is an undocumented API and i have no idea how i can get the area of memory used by a variable inside the routine. Is there some additional functions that could perhaps help me determine the address of variable on this undocumented API. The variable in the api i am working with is NULL by default, i want to edit it so that it is a different value. Help would be much appreciated. Cheers
Question by:hi_tech_assassin
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 86

Accepted Solution

jkr earned 500 total points
ID: 10847403
>>i need to know the address of the memory outside the address space of my own program

There is no such memory. You have all the virtual 4GB, and 2GB of them at your hands.

Author Comment

ID: 10847446
Well i have determined that i need to use VirtualQueryEx(), but when i get the info from MEMORY_BASIC_INFORMATION structure it just crashes as if its empty

                sizeof (MEMORY_BASIC_INFORMATION));

the first argument is the address of the loaded library and the second is the address of the function within that dll that i am dealing with.

Any ideas where am going wrong, as when i get sufficient info from this i can use virtualprotect()

Author Comment

ID: 10847518
is it even possible to use virtualQueryex() on DLLs or will it only work for processes ?
LVL 86

Expert Comment

ID: 11076816
The question is answered by

"There is no such memory. You have all the virtual 4GB, and 2GB of them at your hands."

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question