virtualalloc

Memory allocation on Windows C code

I'd like to know which method is recommended on Windows C programming: using malloc or the Win32 HeapAlloc (maybe VirtualAlloc?) function. I've read the MSDN Memory Management Functions article and the MSDN articles regarding malloc and HeapAlloc, but they do not say which one should be used and in what situations. ...

Win32 WriteProcessMemory() magical offset value

I'm trying to read the data in a Win32 ListView owned by another process. Unfortunately, my WriteProcessMemory() call fails with the error "This function is not supported on this system." when I specify "NULL" for the base address in my VirtualAlloc() call. If, however, I offset that VirtualAlloc() address by some "magic" value that I go...

Contiguous VirtualAlloc behaviour on Windows Mobile

I have been optimising memory performance on a Windows Mobile application and have encountered some differences in behaviour between VirtualAlloc on Win32 and Windows CE. Consider the following test: // Allocate 64k of memory BYTE * a = (BYTE *)VirtualAlloc(0, 65536, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); // Allocate a second contig...

VirtualAlloc failing on certain configurations of hdd

For some reason on my application when running on some configuration of hard disk (RAID, random partitions, through a separate IDE controller, not on the operating systems partition), VirtualAlloc returns null with the GetLastError code of ERROR_INVALID_PARAMETER. The only parameter apart from the flags (MEM_COMMIT | MEM_TOP_DOWN, PAGE...

How could VirtualAlloc fail (no mem) despite plenty of phys memory on WinMobile?

I am routinely seeing VirtualAlloc calls to reserve memory fail. I'm requesting 2MB so that the allocations do not count against my per process virtual memory and instead use system shared memory. At the time of failure, the system reports having over 100 MB available in physical memory. I'm running on a windows mobile 6.1 device. So f...

Getting the lowest free virtual memory address in windows.

Title says it pretty much all : is there a way to get the lowest free virtual memory address under windows ? I should add that I am interested by this information at the beginning of the program (before any dynamic memory allocation has been done). Why I need it : trying to build a malloc implementation under Windows. If it is not possi...

Function Pointers in VS-2010 ( + Virtual Alloc call)

Hi everyone, As an experiment i am trying to write the following program which allows me to generate code during runtime. i.e. i do the following: 1. Fill a buffer with op-codes of the instructions i want to execute. 2. Declare a function-pointer and make it point to the start of the buffer. 3. Call the function using the above func-pt...