Turns out it indeed got the right function pointer and that function is getting called correctly. What I was trying to do however was forking a process within another. One of the things I needed to do was unmapping the base module from memory from one of the exe's, align correctly and then write the second executable in the memory of the first one. NtUnmapViewOfSection seems to fail with error code STATUS_NOT_MAPPED_VIEW.
I've found out this error appears on certain kinds of executable and one's written in D seem to be one of those. Is there any reason windows complains that the main module containing the code section is not mapped?
