OK, I just submitted an updated change. I spent a lot of time yesterday and today getting the logic right, testing various /O options, side by side with Windows. This looks right to me. I did abstain from cleaning up the use of the global variables. This change at least does not add any. Cleaning those up will be an exercise for (another person at) another time. Let me know what you think of the change.