http://bugs.winehq.org/show_bug.cgi?id=24369
Summary: UCS-4 trick not working with resource files Product: Wine Version: unspecified Platform: x86 OS/Version: Windows 98 Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: carlo.bramix@libero.it
Created an attachment (id=30717) --> (http://bugs.winehq.org/attachment.cgi?id=30717) Resource file for testing
Here there is an extract of my email sent to wine-devel mailing list about this problem:
==== CUT = CUT = CUT
Let's take for example this piece of code from richedit.h:
#if defined(__GNUC__) # define RICHEDIT_CLASS20W (const WCHAR []){ 'R','i','c','h','E','d','i','t','2','0','W',0 } #elif defined(_MSC_VER) # define RICHEDIT_CLASS20W L"RichEdit20W" #else static const WCHAR RICHEDIT_CLASS20W[] = { 'R','i','c','h','E','d','i','t','2','0','W',0 }; #endif
Because the famous UCS-4 "issue", the control name is splitted in its single letters. While this can work in almost all situations with C/C++ sources, it is absolutely not possible to put a richedit control in RC files. For example, if I put a Richedit control into a dialog box, it will crash since the letter by letter format won't be recognized by the resource compiler.
From the above example, I was wondering what you think about doing a change
like this one:
#if defined _MSC_VER || defined RC_INVOKED || sizeof(wchar_t) == 2 # define RICHEDIT_CLASS20W L"RichEdit20W" #elif defined(__GNUC__) # define RICHEDIT_CLASS20W (const WCHAR []){ 'R','i','c','h','E','d','i','t','2','0','W',0 } #else static const WCHAR RICHEDIT_CLASS20W[] = { 'R','i','c','h','E','d','i','t','2','0','W',0 }; #endif
We will fall in the first case when the name expressed as string is currently recognized: 1) because we are running under Microsoft Visual C++ 2) because it is used by resource compiler 3) because the string format is currently safe since we are under UCS-2 instead of UCS-4. Perhaps this point is not written as good as you want... I do not know if you prefer to use some informations emitted by configure script or you will prefer to simply check the size of wchar_t.
The second case is the specific hack normally used until now with GCC.
The third case is the last chance solution, as it was before.
I moved the __GNUC__ case after the one used by _MSC_VER because __GNUC__ and RC_INVOKED are both declared in windres. Now I took this fragment from richedit.h as example, but perhaps I have also seen other places where the resource compiler could be "rejected".
==== CUT = CUT = CUT
According to the reply I received, I'm creating a bug here and I tried to create a resource file that could be used for inspecting the problem.
I tried my best but unfortunately, as you can see on top of this bug, I'm not using directly an operating system that allows the testing of WINE. The defect has been noticed by me when trying to compile an application with ReactOS' sources which uses the same exact system include files normally used by WINE.
I hope all this could be useful.
http://bugs.winehq.org/show_bug.cgi?id=24369
--- Comment #1 from Carlo Bramini carlo.bramix@libero.it 2010-09-12 11:06:46 CDT --- For testing the issue I did the following steps:
1) I downloaded the wine-1.3.2.tar.bz2 source package.
2) I unpacked the source archive.
3) I tried to compile the attached resource file with this command:
windres -i resource.rc --input-format=rc -o resource.o -O coff -Ie:\WINE-1.3.2\include
The compilation halts with the following error:
WINDRES: resource.rc:24: syntax error
After fixing e:\WINE-1.3.2\include\richedit.h as described in the previous post, the compilation does not give error messages and resource.o is generated.
http://bugs.winehq.org/show_bug.cgi?id=24369
--- Comment #2 from Carlo Bramini carlo.bramix@libero.it 2010-09-12 15:25:03 CDT --- I have also repeated the previous test with wrc:
wrc -Ie:\wine-1.3.2\include resource.rc
resource.rc:23:42: Error: syntax error
http://bugs.winehq.org/show_bug.cgi?id=24369
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.3.2
http://bugs.winehq.org/show_bug.cgi?id=24369
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #30717|application/octet-stream |text/plain mime type| |
http://bugs.winehq.org/show_bug.cgi?id=24369
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|UCS-4 trick not working |Unicode macros break |with resource files |compilation of resource | |files Severity|normal |minor
--- Comment #3 from Dmitry Timoshkov dmitry@codeweavers.com 2010-09-13 00:39:20 CDT --- Do not define UNICODE inside of .rc files, it's not needed.
http://bugs.winehq.org/show_bug.cgi?id=24369
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Windows 98 |Windows
http://bugs.winehq.org/show_bug.cgi?id=24369
--- Comment #4 from Carlo Bramini carlo.bramix@libero.it 2011-08-29 06:39:02 CDT --- Created an attachment (id=36149) --> (http://bugs.winehq.org/attachment.cgi?id=36149) Partial fix for this bug
These files are currently showing this defect:
include/commctrl.h include/commdlg.h include/dpaddr.h include/gameux.idl include/lmaccess.h include/ddk/mountmgr.h include/msacm.h include/mshtmhst.idl include/oledlg.h include/prsht.h include/richedit.h include/schannel.h include/sddl.h include/shlobj.h include/shobjidl.idl include/softpub.h include/uxtheme.h include/vsstyle.h include/vssym32.h include/wincrypt.h include/winspool.h include/winsvc.h include/wintrust.h
Attached patch has been made on latest trunk and it fixes the macros in richedit.h only.
http://bugs.winehq.org/show_bug.cgi?id=24369
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=24369
--- Comment #5 from Ken Sharp kennybobs@o2.co.uk 2013-07-31 19:06:36 CDT --- Is this still an issue in latest git?
http://bugs.winehq.org/show_bug.cgi?id=24369
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|austinenglish@gmail.com |
https://bugs.winehq.org/show_bug.cgi?id=24369
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |ABANDONED
--- Comment #6 from Austin English austinenglish@gmail.com --- (In reply to Ken Sharp from comment #5)
Is this still an issue in latest git?
Abandoned.
https://bugs.winehq.org/show_bug.cgi?id=24369
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Austin English austinenglish@gmail.com --- Closing.