Solved

virtualprotect()  problem

Posted on 2004-04-16
7
185 Views
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
0
Comment
Question by:hi_tech_assassin
  • 2
  • 2
7 Comments
 
LVL 86

Accepted Solution

by:
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.
0
 

Author Comment

by:hi_tech_assassin
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

            VirtualQueryEx(hNetLib,
                NetLibFunc,
                lpList,
                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()
0
 

Author Comment

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

Expert Comment

by:jkr
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."
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

776 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