Be const-correct.
Introduce text mode to cf_popen and friends, for Windows support.

Part of issue 1884.
Use quoted path so "C:\Program Files" doesn't cause trouble.

Quoted paths are taken into account by the CommandArg0 function.

Part of issue 1884.
Add usemodule autotest for both Unix and Windows.