Crash in BeginPaint running Sams Photofact index, a free VB app

Dan Kegel dank at kegel.com
Mon Apr 28 22:35:52 CDT 2003


That did it.  And yes, the workaround was needed in EndPaint, too;
I tried Mike's patch first, and added the EndPaint workaround myself
before I noticed Dmitry's patch.

The app isn't very functional, but at least it doesn't crash.
I encourage anyone who is working on Visual Basic compatibility
to give http://www.servicesoftware.com/sams/SAMSINDEX.exe a spin.
(And look at all the pretty fixme's :-)

Thanks,
Dan

Dmitry Timoshkov wrote:
> "Dan Kegel" <dank at kegel.com> wrote:
> 
> 
>>Backtrace:
>>=>0 0x409e5873 (BeginPaint+0x9f(hwnd=0x10029, lps=0x0) [painting.c:200] in user32.dll.so) (ebp=40892bc4)
> 
> 
> Attached patch should help a bit.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Protect BeginPaint and EndPaint from lps being NULL.
> 
> --- cvs/hq/wine/dlls/user/painting.c	Thu Jan 09 03:41:30 2003
> +++ painting.c	Mon Apr 28 10:15:46 2003
> @@ -159,6 +159,8 @@
>      HWND full_handle;
>      WND *wndPtr;
>  
> +    if (!lps) return 0;
> +
>      if (!(full_handle = WIN_IsCurrentThread( hwnd )))
>      {
>          if (IsWindow(hwnd))
> @@ -239,6 +241,8 @@
>   */
>  BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
>  {
> +    if (!lps) return FALSE;
> +
>      ReleaseDC( hwnd, lps->hdc );
>      ShowCaret( hwnd );
>      return TRUE;


-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045




More information about the wine-devel mailing list