4 ms·
One thing which I always considered a misdesign in Windows, is its tendency to run third-party code in-process. This includes COM objects, printer drivers, and
by cesarb 6y ago
One thing which I always considered a misdesign in Windows, is its tendency to run third-party code in-process. This includes COM objects, printer drivers, and many more.
We had a problem similar to yours at a previous company. The software was written in a proprietary language which had its own runtime, and that runtime expected a particular value for the floating point control word. There are some third-party DLLs, including some printer drivers and Explorer extensions, which when loaded overwrite the floating point control word with their own notion of what should be the correct value (this behavior, as far as I could determine, is introduced by the compiler used to build these third-party DLLs). The unexpected value for the floating point control word would then lead to crashes, but these crashes would not happen immediately, and they would only happen if the user had done something which led to one of these third-party DLLs being loaded, like opening/saving a file (the open/save dialog in Windows loads Explorer extensions) or printing (which loads the printer driver).
The solution was to, after every point in the code which opens a file chooser or prints anything, call into a small stub DLL we wrote, which had code to reset the floating point control word to what the runtime expected.
- tonyedgecombe 6y agoIt's worse than that, at one point printer drivers were run in the kernel. I remember a customer site where just opening a queue blue screened the server.
- andi999 6y agoWhat is the floating point control word?
- adrian_b 6y agoThe floating point control word is a register in the Intel 8087 FP coprocessor and in all later Intel/AMD/etc. processors that implement the 8087 instruction set. That register contains bits that control various aspects of how the floating-point instructions must behave, e.g. rounding mode, precision and exception masks (also infinity type in coprocessors older than 80387). For the later SSE/AVX instruction sets there is another register with similar control bits for the SSE/AVX instructions.
- moonbug 6y agoYeah, I've had a variant of that, wherein the printer driver turned on fpes.