The following functions allocate (and free again) memory in the context of the specified process. We can read from and write to this memory from our process by using the win32 APIs "Read/WriteProcessMemory".

function AllocMemEx (size          : cardinal;
                     processHandle : cardinal = 0) : pointer; stdcall;
function FreeMemEx  (mem           : pointer;
                     processHandle : cardinal = 0) : boolean; stdcall;

To be true, the "processHandle" only has a meaning in NT based systems. In 9x/ME based systems the memory is always allocated/freed in the shared area, which is directly accessible to all processes. If you set the "processHandle" parameter to zero in NT based systems, the memory is allocated/freed in our own process.