Manual mapping protected DLL causes "Initialization error 4"

Hello,

mapping our protected DLL manually into a process causes this error. It happens if the following options are enabled:
Imports Protection
Debugger Check
Packer

Those were the options we’ve tested and which caused that error. Do we have to do anything specific for VMP to load properly?

It seems your code for manuall mapping has a bug. Does Windows load the protected DLL?

Yes Windows loads it fine. Another mapper also works. We’re not sending the full PE headers from the server to the client. Only what’s required for the mapping. Could that be an issue?

What does “Initialization error 4” mean? What couldn’t get initialized? We’d love to continue using VMP, but with that it’s not possible.

It means that a loader section/PE header is corrupted.