Solved

virtualprotect()  problem

Posted on 2004-04-16
7
182 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
Comment Utility
>>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
Comment Utility
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
Comment Utility
is it even possible to use virtualQueryex() on DLLs or will it only work for processes ?
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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 learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now