In the bug found at http://bugs.winehq.org/show_bug.cgi?id=2096 , I have described an issue that I am having with Quicken Deluxe 2000 when running under Wine. The symptom is that Quicken was crashing HARD when trying to print a partial page of checks on a laser printer. Now, I just get fixme's stating that CreateCompatibleBitmap is getting bad parameters.
(In lieu of reading the following, you could probably just read the last few posts in bugzilla for this bug...)
Long story short, with the help of some others (thanks guys!), it seems that CreateCompatibleBitmap is being called directly from Quicken, and that Quicken seems to be passing an address instead of a value for the height parameter.
Now, I would normally just mark the bug as INVALID, and let it go. But, while looking into things, I read the MSDN page describing the function of CreateCompatibleBitmap, and it appears to me that there may be "issues" with Wine's implementation of CreateCompatibleBitmap. To quote my post attached to the bug:
"I would have changed this bug entry's resolution to INVALID, except that (a) I wouldn't mind a more knowledgeable (of Wine, Win API, and C) person to verify my findings, and, more importantly, (b) it seems to me that Windows would be handling this scenario differently than Wine (or Intuit/Quicken would have some customer relations problems due to frequent crashes) - should Wine do something different when the parameters are out of whack? The only thing I can see on MSDN under CreateCompatibleBitmap is "Windows 95/98/Me: The created bitmap cannot exceed 16MB in size."
"Which I guess brings up another point... dlls/gdi/bitmap.c's CreateCompatibleBitmap shows the aforementioned fixme message if the width or height exceeds 0x10000, and no bitmap is returned. This seems wrong to me on three counts: (1) MSDN states that if either width or height is zero, a 1x1 monochrome bitmap is returned (in my case the height was 0, but the width was "huge", so a 1x1 bitmap should be returned); (2) a 0x11000 by 0x2 bitmap is within the (more restrictive Win95) 16 MB limit and should be valid; and (3) Win NT/2000/XP do not seem to have any restriction on a bitmap's size (except physical and paged memory constraints), so at least in theory, any values for width and height are "valid".
So, this begs the question, should Wine's CreateCompatibleBitmap be modified for any (or all?) of the reasons above?
Thoughts? Comments?
Carl
On Fri, 29 Apr 2005 10:46:31 -0400, you wrote:
This seems wrong to me on three counts: (1) MSDN states that if either width or height is zero, a 1x1 monochrome bitmap is returned
Indeed, what happens if you try this obvious patch:
========================================>8======================================= --- wine/dlls/gdi/bitmap.c 2005-04-14 10:50:50.000000000 +0200 +++ mywine/dlls/gdi/bitmap.c 2005-04-29 20:04:37.000000000 +0200 @@ -134,7 +134,7 @@ HBITMAP WINAPI CreateCompatibleBitmap( H
TRACE("(%p,%d,%d) = \n", hdc, width, height);
- if ((width >= 0x10000) || (height >= 0x10000)) + if ((height && width >= 0x10000) || (width && height >= 0x10000)) { FIXME("got bad width %d or height %d, please look for reason\n", width, height); ========================================>8=======================================
Rein.
Thanks for the input, Rein. Allowing either a width or height of zero to fall through should result in a 1x1 monochrome bitmap (I haven't tested it, but did read through the code and it looks like that would be returned).
However, the other points that I made call into question the need for the check at all. XP has no size limit to a bitmap, at least that's mentioned on MSDN.
Is the intention of this condition one of a "sanity check"? If so, should it be modified or even removed? Has this code been around long enough so that the check isn't needed? (I.e., was it included for stability/wine bug checking purposes?) Or, maybe changing it to check that BOTH are >= 0x10000, or maybe their product is >= 0x100000000 [can we get that precision on all wine platforms?] would be reasonable? Or, do we go with the 16Mb Win95 limit?
Thoughts?
Carl
On Friday, April 29, 2005 02:13 pm, Rein Klazes wrote:
On Fri, 29 Apr 2005 10:46:31 -0400, you wrote:
This seems wrong to me on three counts: (1) MSDN states that if either width or height is zero, a 1x1 monochrome bitmap is returned
Indeed, what happens if you try this obvious patch:
========================================>8================================= ====== --- wine/dlls/gdi/bitmap.c 2005-04-14 10:50:50.000000000 +0200 +++ mywine/dlls/gdi/bitmap.c 2005-04-29 20:04:37.000000000 +0200 @@ -134,7 +134,7 @@ HBITMAP WINAPI CreateCompatibleBitmap( H
TRACE("(%p,%d,%d) = \n", hdc, width, height);
- if ((width >= 0x10000) || (height >= 0x10000))
- if ((height && width >= 0x10000) || (width && height >= 0x10000)) { FIXME("got bad width %d or height %d, please look for reason\n", width, height);
========================================>8=================================
Rein.
"Carl Sopchak" carl.sopchak@cegis123.com wrote:
"Which I guess brings up another point... dlls/gdi/bitmap.c's CreateCompatibleBitmap shows the aforementioned fixme message if the width or height exceeds 0x10000, and no bitmap is returned. This seems wrong to me on three counts: (1) MSDN states that if either width or height is zero, a 1x1 monochrome bitmap is returned (in my case the height was 0, but the width was "huge", so a 1x1 bitmap should be returned); (2) a 0x11000 by 0x2 bitmap is within the (more restrictive Win95) 16 MB limit and should be valid; and (3) Win NT/2000/XP do not seem to have any restriction on a bitmap's size (except physical and paged memory constraints), so at least in theory, any values for width and height are "valid".
So, this begs the question, should Wine's CreateCompatibleBitmap be modified for any (or all?) of the reasons above?
A test case showing how Windows behaves in such a case would be the very first step towards a proper fix.