Improve wine registry.

* Fix escape bug.
* Improve wine registry.
* Flush log file per each line.