
Hello!
I've recently started working on my own PE packer to understand the PE format better and I generally reached the moment where everything works with one slight exception. When I pack my PE files created with MSVC++ 2005 the executable runs fine until it has to perform calculations on floating numbers. That's when the runtime R6002: "floating point not loaded error" pops up. I'm writing here, because I spent hours looking for the solution on google, but to no avail.
I found some information that the CRT library of MSVC++ is buggy and if it detects .rdata section as writeable it will crash with this error. When it's read-only it should be fine. I've tried running VirtualProtect on decrypted parts of memory, which all reside in one section, to restore the old section permissions, but it didn't work.
Someone also said that linking the VC++ application with msvcrt.lib will help and yes it does, but then I have compatibility issues running the application on different systems.
I'd be glad if anyone could lend me a hand with this problem. I know the UPX author had the same problem with his packer long time ago, but I have no idea how he solved the problem and it would take quite a long time to find the solution in the sources.
Regards,
Black Dot