Text formatting string problem

Duane Clark dclark at akamail.com
Sun May 6 15:50:32 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.
>
> 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
> ...

It looks like the routine ignores the FORMAT_MESSAGE_IGNORE_INSERTS
flag. Sticking an if before the while loop that does the formatting
seems to fix things:

		if (dwFlags & FORMAT_MESSAGE_IGNORE_INSERTS) {
			while (*f && !eos) {
				ch = *f++;
				ADD_TO_T(ch);
			}
		}
		else {
                       /* the rest of this is unchanged */
			while (*f && !eos) {
				if (*f=='%') {
                                ...
		}

I tested this against a half dozen apps, and have not found it to break
anything yet.

Duane




More information about the wine-devel mailing list