virtualprotect()  problem

Posted on 2004-04-16
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 125 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

689 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