WM_PAINT out-of-range rcPaint with Debug target only

Blocat WM_PAINT out-of-range rcPaint with Debug target only

  • 25 aprilie 2012 06:55
     
     

    For a particular floating window only, my app when built with VC++ 2010 Express with debug runtime [Multi-threaded Debug (/MTd)] *or* when run under the debugger regardless of Runtime Library choice, soon after startup begins receiving WM_PAINT messages for this window that have wildly-out of range coordinates.  The rectangle is of about the right size but offset to some large negative coordinates (-1150 or so, both x and y).  The rectangle is not within the client coordinates of the window receiving the WM_PAINT.

    This application has a long strange history, having been through Borland C++ and ported out of it, and more recently having been compiled under Metroworks CodeWarrior (mac hosted) for maybe a decade with no problems.  In order to get the app running under 64-bit versions of Windows (not as a 64-bit app), it was necessary to move to Visual C++.  The app behaves normally when run outside the IDE (as far as we can tell so far).  But I am unable to debug another problem with this window due to its ceasing to operate under the debugger.

    I made this transition to VC++ only very recently.  Since there is one other odd symptom I will mention it just in case it seems at all relevant.  This app crashes early in execution when run under the debugger after each build, until I "Start Without Debugging" once.  After that it runs fine under the debugger.  The crash occurs with no stack frame information available, so I have no ideas about where it might occur.   Of course I could investigate that more but have not, amidst other issues in this porting effort that are still settling out.

    I would think offhand that paint messages would provide rectangles located in the client area and can't imagine off-hand why.  Most InvalidateRect calls specify a NULL rectangle since the entire windows contents are changing.  So it is not clear where the strangely-offset paint rectangles would originate, and I'd appreciate any suggestions about where to look.

    Thanks for any thoughts.

Toate mesajele

  • 25 aprilie 2012 07:21
     
     
    Since my original post I looked into the crash that occurs until I "Start Without Debugging" once.  The crash occurs in a call to PrintDlg.  It is probably expect that I use PrintDlgEx instead, but I recall I was unable to get it working.  I don't remember why at the moment, except that the transition was more involved than I had time/budget to look into.  In any case PrintDlg works after "Start Without Debugging", FWIW.
  • 26 aprilie 2012 08:15
    Moderator
     
     

    Hi Kurt,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thanks for your understanding.

    Best Regards,


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us

  • 1 mai 2012 04:25
     
     

    Thanks.

    From the looks of it the PrintDlg crash may be an unrelated issue.  Let me know if you think I should start a separate thread for it.

  • 1 mai 2012 08:48
     
     

    Hi Kurt,

    This doesn't look like an easy question. I searched in Microsoft database, but unlucky to to find any similar issue reported before.

    I think you might enable AppVerifier on your program to assist identify the errors.

    http://technet.microsoft.com/en-us/library/bb457063.aspx

    http://www.microsoft.com/en-us/download/details.aspx?id=20028

    The PrintDlg crash issue should be fixed first.

    Thanks,

    -Fred


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


  • 1 mai 2012 09:14
     
     

    >The app behaves normally when run outside the IDE (as far as we can tell so far).  But I am unable to debug another problem with this window due to its ceasing to operate under the debugger.

    ...

    This app crashes early in execution when run under the debugger after each build, until I "Start Without Debugging" once.  After that it runs fine under the debugger.  The crash occurs with no stack frame information available, so I have no ideas about where it might occur.   

    1. If you have crash dump generated, then show it here for others to analyze. Express does not have option Debug->Save Dump As. Do you have a crash dump?
    2. What messages (if any) do you get in Output window when running with Start Debugging?

    For VC++ Express Edition users there is an option for automatic dump generation -  Auto Memory Dump on Crash of an Application


  • 29 mai 2012 00:04
     
      Are cod

    [long delay because I was off on another project]

    I've got AppVerifier installed, and will report back about that later when I figure it out.

    Ok, so I'm working on the PrintDlg crash first.  I decided to isolate the PrintDlg call and move it to the beginning of main.  I had a call with more sophisticated setting up of the PRINTDLG structure, but I figured moving in the direction of purely zeroed-out PRINTDLG would reduce some "conceivable" sources of crash, and it turned out not to make any difference at all, so I can present it here in its simplest form, which crashes just as well.  The following is the code now appearing at the beginning of WinMain.  The code crashes immediately upon stepping *over* or *in to* PrintDlg.

    	static PRINTDLG pd;
    	memset (&pd, 0, sizeof (pd));
    	pd.lStructSize	= sizeof (pd);
    	BOOL ok = PrintDlg (&pd);
    

    Since I have simplified things this much and the problem still occurs, and I figure it should *not*.

    The OS (development & target): Windows 7 64-bit, and the app itself is 32-bit.

    I have not yet looked into configuring for crash dumps as per Sergey's response, but FWIW (probably not too much) here is the call stack after the crash.

        KernelBase.dll!75c5b727()     
         [Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]    
         KernelBase.dll!75c5b727()     
         rpcrt4.dll!76d4570a()     
         rpcrt4.dll!76d3735b()     
         rpcrt4.dll!76d4374b()     
         rpcrt4.dll!76d45819()     
         rpcrt4.dll!76dd011d()     
         rpcrt4.dll!76d37431()     
         rpcrt4.dll!76d38011()     
         KernelBase.dll!75c611dc()     
         rpcrt4.dll!76d63ebf()     
         rpcrt4.dll!76d40e20()     
         ntdll.dll!7766f8c1()     
         KernelBase.dll!75c60816()     
         kernel32.dll!758c7801()     
         kernel32.dll!758c38fe()     
         kernel32.dll!758dd060()     
         kernel32.dll!758dd060()     
         comdlg32.dll!771d30e2()     
         comdlg32.dll!771d30ef()     
         comdlg32.dll!771d2a20()     
         KernelBase.dll!75c64a93()     
         winspool.drv!73e95a56()     
         ntdll.dll!7766fada()     
         KernelBase.dll!75c5e4d9()     

    Thanks.

  • 29 mai 2012 10:03
     
     
    I think you might enable AppVerifier on your program to assist identify the errors.

    I enabled almost all possible options in AppVerifier and apparently it finds no problems in excecution up to the point of the crash.

    The log file shows in the AppVerifier list, but the "View" button does nothing, perhaps because both the Error and Warning columns show "0".  I don't know if there is anything besides errors or warnings that would show up.  I guess this is too obscure to be documented, but I am assuming no problem.  Also nothing appears in the debugger log except basics like:

    AVRF: SP.exe: pid 0xE04: flags 0x80643267: application verifier enabled
    AVRF: Created logging directory C:\Users\Kurt\AppVerifierLogs
    ...

    LuaPriv: Attaching to process...
    -- LuaPriv initialized--

    So I will look into some other possibilities and report back.

  • 29 mai 2012 10:19
     
     

    This app crashes early in execution when run under the debugger after each build, until I "Start Without Debugging" once.  After that it runs fine under the debugger.  The crash occurs with no stack frame information available, so I have no ideas about where it might occur.   

    1. If you have crash dump generated, then show it here for others to analyze. Express does not have option Debug->Save Dump As. Do you have a crash dump?
    2. What messages (if any) do you get in Output window when running with Start Debugging?

    For VC++ Express Edition users there is an option for automatic dump generation -  Auto Memory Dump on Crash of an Application

    Is the intention of posting the crash dump to allow others who have debug information for the kernel to be able to analyze it?  It *appears* to be more than a little involved to do this, so I just wanted to make sure it is worthwhile.

    The complete Output window content from the last run (with AppVerifier enabled) is as follows.

    'SP.exe': Loaded '\\psf\Home\Coch\SP\SP\Windows-Build-Output\SP.exe', Symbols loaded.
    'SP.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
    Page heap: pid 0xE04: page heap enabled with flags 0x3.
    AVRF: SP.exe: pid 0xE04: flags 0x80643267: application verifier enabled
    Page heap: pid 0xE04: page heap enabled with flags 0x3.
    AVRF: SP.exe: pid 0xE04: flags 0x80643267: application verifier enabled
    AVRF: Created logging directory C:\Users\Kurt\AppVerifierLogs
    'SP.exe': Loaded 'C:\Windows\SysWOW64\verifier.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\vrfcore.dll', Symbols loaded.
    'SP.exe': Loaded 'C:\Windows\SysWOW64\vfbasics.dll', Symbols loaded.
    'SP.exe': Loaded 'C:\Windows\SysWOW64\vfLuaPriv.dll', Symbols loaded.
    'SP.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\vfcompat.dll', Symbols loaded.
    'SP.exe': Loaded 'C:\Windows\SysWOW64\msvcp60.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\vfprint.dll', Symbols loaded.
    'SP.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
    LuaPriv: Attaching to process...
    -- LuaPriv initialized--
    'SP.exe': Loaded 'C:\Windows\SysWOW64\comdlg32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149af\comctl32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded '\\psf\Home\Coch\SP\SP\Windows-Build-Output\libpng12.dll', Binary was not built with debug information.
    'SP.exe': Loaded '\\psf\Home\Coch\SP\SP\Windows-Build-Output\zlib1.dll', Binary was not built with debug information.
    'SP.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\userenv.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\winspool.drv', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\mpr.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Cannot find or open the PDB file
    'SP.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Cannot find or open the PDB file
    First-chance exception at 0x768ab727 in SP.exe: 0x000006BA: The RPC server is unavailable.

    Thanks.