Text formatting string problem
Duane Clark
dclark at akamail.com
Sun May 6 15:02:33 CDT 2001
Duane Clark wrote:
>
> Howdy,
>
> Running a FPGA design tool (Actel's Designer), I find that it works
> pretty good, but that certain printed status strings are being formatted
> incorrectly. It does not seem to affect the operation of the
> application, except for the status reports.
>
Responding to myself... I further tracked this down to the routine
FormatMessageA:
trace:resource:FormatMessageA
(0xb00,0x400000,16973880,0x400,0x40585e48,512,(nil))
trace:resource:load_messageA instance = 00400000, id = 01030038, buffer
= (nil), length = 100
trace:resource:RES_FindResource2 (00400000, 0000000b, 00000001, 0400, W,
PE)
trace:resource:RES_LoadResource (00400000, 0047ba80, PE)
trace:resource:LockResource (00622b88)
trace:resource:load_messageA - strlen=36
trace:resource:load_messageA instance = 00400000, id = 01030038, buffer
= 0x403eb9a4, length = 37
trace:resource:RES_FindResource2 (00400000, 0000000b, 00000001, 0400, W,
PE)
trace:resource:RES_LoadResource (00400000, 0047ba80, PE)
trace:resource:LockResource (00622b88)
trace:resource:load_messageA - strlen=36
trace:string:lstrcpynA (0x403eb9a4, "Opened an existing design %s.\r\n",
36)
trace:resource:load_messageA 'Opened an existing design %s.
' copied !
trace:resource:FormatMessageA Found a percent. Args = 0
trace:resource:FormatMessageA Default case
trace:resource:FormatMessageA -- "Opened an existing design s. "
trace:resource:FormatMessageA -- returning 29
Looking in dlls/kernel/format_msg.c, I found that this is stripping off
the percent:
if (*f=='%') {
int insertnr;
char *fmtstr,*x,*lastf;
DWORD *argliststart;
TRACE("Found a percent. Args = %x\n", args);
fmtstr = NULL;
lastf = f;
f++;
if (!*f) {
ADD_TO_T('%');
continue;
}
switch (*f) {
...
default:
TRACE("Default case\n");
ADD_TO_T(*f++);
break;
}
I added in a
ADD_TO_T('%');
just before the switch, and now all the messages are displayed
correctly. But, typically, I really don't know enough to know whether
this is the right fix, or will break something else. But I ran a half
dozen different applications, and have not seen any ill effects yet.
Duane
More information about the wine-users
mailing list