The API heap functions should help here. Use GlobalAlloc to allocate a handle to some memory, then pass that around.