win32: SetDIBitsToDevice

Jan Bottorff janb at pmatrix.com
Wed Jun 28 03:58:08 UTC 2000


Can you tell me exactly what version of "Windows" this is on. There are
like a few flavors of Win95, a few of Win98, a few of WinNT, and then
Win2000. Or is this reproducible across many flavors.

A couple options for debugging, run the system with a "debug" version of
Windows, which may spit out messages to an appropriate debugging console.
All the above Windows flavors have matching debug variants. Another option
would be to run  Squeak under an API verifier (like from NuMega I believe).
This will basically carefully check every parameter to every call to the OS.

One possibility is the bits are sometimes allocated at the very end of a
valid address space chunk, and the stupid display driver walks a few bytes
past the end. My memory is the definition of the allocated space for a DIB
is a bit fuzzy, as it would  like pixels not to cross 64KB boundaries. A
workaround for a buggy driver may be to allocate a few extra bytes at the
end of every bitmap.

I believe some display/printer drivers are also unwilling to do certain
color conversions when displaying a bitmap. This case would not work 1000
times and then fail.

It's also possible the device context handle is somehow getting corrupted.
You could put some harmless call to use the device context (dc) just before
the call to SetDIBitsToDevice, and check the return code.

- Jan

At 06:55 PM 6/27/00 -0700, you wrote:
>
>	Thanks for the references... I haven't figured this one out yet,
>though.
>
>> What does GetLastError(VOID) report as extended error information?
>
>	It answers ERROR_INVALID_PARAMETER (87). This is in
>sqWin32Window.c:ioShowDisplay(), by the way:
>
>***
>
>	SetDIBitsToDevice(
>		dc,
>		0,			/* dst_x */
>		0,			/* dst_y */
>		width,			/* dst_w */
>		height,			/* dst_h */
>		0,			/* src_x */
>		0,			/* src_y */
>		0,			/* start scan line in DIB */
>		height,			/* num scan lines in DIB */
>		(void*) dispBitsIndex,  /* bits */
>		bmi,
>		DIB_RGB_COLORS);
>
>***
>
>	I'm not sure how to go about verifying the validity of the parameters,
>in particular "dc", "dispBitsInfo", and "bmi". Width and height seem to
>be okay (my monitor dimensions). Does anyone know what to look for and
>how to look for it?
>
>	I usually get about ten minutes of Squeak use before it goes belly-up.
>I don't seem to be low on any system resource, at least according to
>win32's "resource meter" and "system monitor". No other application is
>having trouble.
>
>
>	thanks,
>
>-C
>
>--
>Craig Latta
>composer and computer scientist
>craig.latta at netjam.org
>www.netjam.org
>crl at watson.ibm.com
>Smalltalkers do: [:it | All with: Class, (And love: it)]





More information about the Squeak-dev mailing list