First i would like to say that this forum is great.
am currently learning most of it on my own, c++ and the win32 api.
so to my problem:
am looking inside this api VirtualAlloc and am trying to achieve the following:
- Reserve 40 megs of virtual memory and commit 10 megs from it.
- Then i want to fill strings inside the commited memory.
am looking at api on msdn:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366887(v=vs.85).aspx
my sample code:
int main()
{
int p0 = (int) VirtualAlloc(NULL,40*1024*1024 ,MEM_RESERVE,PAGE_READWRITE);;
int p1 = (int) VirtualAlloc(NULL,10*1024*1024 ,MEM_COMMIT ,PAGE_READWRITE);;
system("pause");
}
when i looked at task manager commited i get only 30 megs instead of 40 megs.
i tried changing the values ,but seems am missing something here.
what am i doing wrong here?
and how do i put repeated string in the commited area?
again thank you all and appriciate the help here.