http://bugs.winehq.org/show_bug.cgi?id=26281
Summary: regedit: Doesn't export decent newline in Unicode (NT5) Format. Product: Wine Version: 1.3.14 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: programs AssignedTo: wine-bugs@winehq.org ReportedBy: sagawa.aki+winebugs@gmail.com
Created an attachment (id=33503) --> (http://bugs.winehq.org/attachment.cgi?id=33503) exported registry file
Exporting a registry in Unicode (NT5) format from wine's regedit, it generates ANSI newlines as shown in attached file.
Though the file can import to registry via regedit (this is the reason why I choose `minor' in the severity), it's hard to edit in notepad or other editors and incompatible with Windows.
% hexdump -C export.reg | head -6 00000000 ff fe 57 00 69 00 6e 00 64 00 6f 00 77 00 73 00 |..W.i.n.d.o.w.s.| 00000010 20 00 52 00 65 00 67 00 69 00 73 00 74 00 72 00 | .R.e.g.i.s.t.r.| 00000020 79 00 20 00 45 00 64 00 69 00 74 00 6f 00 72 00 |y. .E.d.i.t.o.r.| 00000030 20 00 56 00 65 00 72 00 73 00 69 00 6f 00 6e 00 | .V.e.r.s.i.o.n.| 00000040 20 00 35 00 2e 00 30 00 30 00 0d 0a 00 0d 0a 00 | .5...0.0.......| 00000050 5b 00 48 00 4b 00 45 00 59 00 5f 00 43 00 55 00 |[.H.K.E.Y._.C.U.|
As seen in above output, bytes from 0x4A to 0x4F (i.e. 0d 0a 00 0d 0a 00) represent two ANSI newlines. But they should be two Unicode newlines (i.e. 0d 00 0a 00 0d 00 0a 00).
My environment is Ubuntu 10.10 (32-bit) and locale is ja_JP.UTF-8 (also tested LANG=C).
How to reproduce: 1. Launch regedit.exe. 2. Select HKEY_CURRENT_USER\Software\Wine\Drivers in the left treeview. 3. Click [Registry]-[Export Registry File] in the menu. 4. Change [Files of type] to [Registry files (*.reg)]. 5. Enter a file name with appropriate name and click [Save] to export.
http://bugs.winehq.org/show_bug.cgi?id=26281
--- Comment #1 from Sagawa sagawa.aki+winebugs@gmail.com 2011-03-02 08:48:47 CST --- Created an attachment (id=33504) --> (http://bugs.winehq.org/attachment.cgi?id=33504) proposal patch
The cause of this behavior is exporting a file in text mode. As you probably know, in DOS/Windows text mode, writing "\n" is converted to "\r\n". For such occasions, outputting WCHAR binary "00 0a" with fwrite() changes into "00 0d 0a" on the file. Then the file has broken format.
I attach a proposal patch. The patch makes a file opened in binary mode and written WCHAR '\r' explicitly.
http://bugs.winehq.org/show_bug.cgi?id=26281
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nerv@dawncrow.de
--- Comment #2 from André H. nerv@dawncrow.de 2011-03-02 09:04:29 CST --- the patch looks fine, consider sending it to wine-patches, but is "regedit4" at the end of the patch still true?
http://bugs.winehq.org/show_bug.cgi?id=26281
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
http://bugs.winehq.org/show_bug.cgi?id=26281
--- Comment #3 from Sagawa sagawa.aki+winebugs@gmail.com 2011-03-03 07:58:25 CST --- (In reply to comment #2)
the patch looks fine, consider sending it to wine-patches, but is "regedit4" at the end of the patch still true?
In my opinion, this is no problem. Firstly, unlike puts function, fputs function doesn't put a newline character after the string. Secondly, FILE pointer `file' points a file (or stdout) opened in binary mode. Thus I wrote "\r" explicitly.
http://bugs.winehq.org/show_bug.cgi?id=26281
Sagawa sagawa.aki+winebugs@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #4 from Sagawa sagawa.aki+winebugs@gmail.com 2011-03-21 01:58:34 CDT --- The patch was committed as 3c6de3b3485e8ee3a622ef990c5b9042ad28e237. And closing bugs fixed in wine-1.3.16.
http://bugs.winehq.org/show_bug.cgi?id=26281
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org 2011-04-01 12:40:04 CDT --- Closing bugs fixed in 1.3.17.
http://bugs.winehq.org/show_bug.cgi?id=26281
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |1.2.x
http://bugs.winehq.org/show_bug.cgi?id=26281
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|1.2.x |---
https://bugs.winehq.org/show_bug.cgi?id=26281
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |3c6de3b3485e8ee3a622ef990c5 | |b9042ad28e237