Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Mouse Event problem in Quickwin

andrew_4619
Honored Contributor III
2,987 Views

I have a problem with a Quickwin application. It is an application I have worked on and regularly updated for many years that has suddenly become unstable. I have mouse events registered against a couple of child windows. When I make a mouse click on the window the programs crashes with a stack dump.

Under debug the program generates an exceptions like below:

First-chance exception at 0x7769fb81 in fil70.exe: 0xC0000008: An invalid handle was specified.

The stack at this point is as below.

ntdll.dll!7769fb81()        

[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]

ntdll.dll!7769fb81()        

KernelBase.dll!74dd0fa2()

fil70.exe!_for__release_lun()  + 0x1bc bytes 

fil70.exe!_GETUNITQQ()  + 0x4e bytes         

fil70.exe!_DeReferenceGetUnitPointer()  + 0x13 bytes          

fil70.exe!__QWGChangeMouseStatus()  + 0x12c bytes         

fil70.exe!__QWGraphWndProc@16()  + 0x338 bytes

 If I ignore the exception (I will get three or four more that are the same) execution control drops into the correct call back function that was  registered against the mouse event and also return correct parameters for the event (unit, button event ,keystate,  position).

I am currently using Intel(R) Visual Fortran Composer XE 2011 Update 9 with Integration for Microsoft Visual Studio* 2010, 12.1.3526.2010. I was planning to buy the update to the  latest level but I don’t expect that to fix anything.

I am running on W7 Professional x64 SP1  by the way.

Any ideas what I can do to resolve this? I

           

0 Kudos
29 Replies
Bernard
Valued Contributor I
2,167 Views

Hi!

Is this call stack from windbg or VS debugger?

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

iliyapolak wrote:
Is this call stack from windbg or VS debugger?

From the stack window is VS2010 shell so I guess that is the VS debugger I invokes debug from within VS

0 Kudos
Bernard
Valued Contributor I
2,167 Views

Can you run your app under windbg.Set please windbg as a default post-mortem debugger and enable debugger break-in on various exception.By looking at provided call stack I can see that an error occurres deep within ntdll.dll.Can you try to resolve this address " ntdll.dll!7769fb81 "

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

OK I don't know windbg I have been reading up on it, it seems to have some better tools when in the sort of mess I am in now! I will install it and see what else I can find.

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

OK on a steep learning curve here, I have intalled windbg and configured for my application. I can run through my code seeming with no issues. I get an exception after a mouse event as I do is VS debugger. The windbg ouput doalog at this time as is follows:

windbg
....
....
ModLoad: 72100000 7213c000 C:\Windows\SysWOW64\mswsock.dll
ModLoad: 720f0000 720f5000 C:\Windows\SysWOW64\wshtcpip.dll
ModLoad: 6d530000 6d536000 C:\Windows\SysWOW64\wship6.dll
ModLoad: 6d540000 6d584000 C:\Windows\SysWOW64\DNSAPI.dll
ModLoad: 6d500000 6d527000 C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
ModLoad: 6d600000 6d606000 C:\Windows\SysWOW64\rasadhlp.dll
ModLoad: 6d4c0000 6d4f8000 C:\Windows\SysWOW64\fwpuclnt.dll
ModLoad: 73000000 7300d000 C:\Windows\SysWOW64\dhcpcsvc6.DLL
ModLoad: 72fe0000 72ff2000 C:\Windows\SysWOW64\dhcpcsvc.DLL
ModLoad: 715f0000 715f2000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\SKCHUI.DLL
ModLoad: 00000000`715f0000 00000000`715f2000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\PENUSA.DLL
ModLoad: 00000000`70fb0000 00000000`70fb2000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\PENUSA.DLL
ModLoad: 00000000`5c830000 00000000`5c8c4000 C:\Windows\SysWOW64\MsftEdit.dll
(2570.95c): Invalid handle - code c0000008 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Windows\SYSTEM32\wow64cpu.dll -
ntdll!KiRaiseUserExceptionDispatcher+0x3a:
00000000`774f12f7 8b8424c0000000 mov eax,dword ptr [rsp+0C0h] ss:00000000`001eebd0=080000c0

I am really not sure what I need to do next to glean further information for moving forward. Some tips or hints would be vry helpful.

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

Perhaps i should of added that if I continue I get as the next output:

=======================================
VERIFIER STOP 0000000000000300: pid 0x2570: Invalid handle exception for current stack trace.

00000000C0000008 : Exception code.
00000000001EE8F0 : Exception record. Use .exr to display it.
00000000001EE400 : Context record. Use .cxr to display it.
0000000000000000 : Not used.


=======================================
This verifier stop is continuable.
After debugging it use `go' to continue.

=======================================

(2570.95c): Break instruction exception - code 80000003 (first chance)
verifier!VerifierStopMessage+0x98b:
00000000`001fae03 cc int 3

if I use the .xcr command I get:

.exr 00000000001EE8F0
ExceptionAddress: 00000000774f12f7 (ntdll!KiRaiseUserExceptionDispatcher+0x000000000000003a)
ExceptionCode: c0000008 (Invalid handle)
ExceptionFlags: 00000000
NumberParameters: 0
Thread tried to close a handle that was invalid or illegal to close

How can I get/know the handle and will this help? Sorry to be spamming I really need to move forward on this.

0 Kudos
Bernard
Valued Contributor I
2,167 Views

>>>I am really not sure what I need to do next to glean further information for moving forward. Some tips or hints would be vry helpful.>>>

I will help you:)

1. Did you install a proper symbols for your windbg installation, it is crutial feature and needs to be installed and configurated properly in order to map addresses to the functions names.You can download symbols from the symbol server.

2.Did you set windbg as a postmortem debugger?

3.At the beginning do not use Application Verifier use only windbg.

4.Can you post the call stack produced by windbg(You posted only an instruction which loads the exception code)

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

1. ok I think I have the symbol server set OK it seems to have put a lot of stuff in my local symbol store folder correspiondimg to system dlls

2. I set windbg as a postmortem debugger with ....\windbg -I (as admin) which siad it worked...

3 OK

4. I have attached a screen grab, I can't see how to grab it as a cut/past

I have also just run my application on anoher machine (also Win 7 X64) and I have no problem!  It looks then like some interaraction with other stuff running on my development machine. I have tried closing all applications and non-esential processes but have not found  the culprit.

:-(

0 Kudos
Bernard
Valued Contributor I
2,167 Views

Thanks for posting the picture.

You are still in the verifier context.Your exception is 0x8000000c(break instruction exception) and the last function  points to 0xcc buffer.By looking at the call stack it seems that WoW64 is throwing an exception.By your earlier description the problem was related to invalid handle so I suppose that inside WoW64 the invalid handle was discovered and this triggered exception chain handler beign fire off.Use please this command !analyze -v and post the content of the analysis.Did you run your app under debugger? Because the default behaviour of the debugger is not to save the context.I advice you to run ADplus tool which is located in the winddbg folder.This tool can produce faulting process memory dump.

0 Kudos
Bernard
Valued Contributor I
2,167 Views

Hi app4619

Do you have any update related to your app?Did you run while your program is under debugger this command !analyze -v ?

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

OK thanks iliyapolak , I went to the pub for some beer and jazz band, it helped!

I am not sure about this verifier context or how to set any other context by the way. I opened windng and ran my program. I found the adplus tool an started redaing the help document but I havn't tried using it yet I need to read some more....

I ran the !analyse -v and the log is attached  as a txt file.

Thanks 

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

My last post seems to be hung awaiting approval? The analyse info is below....

CommandLine: C:\Users\Andrew\Documents\xfil\xfil_devt_intel\Debug\xfil70.exe
Symbol search path is: C:\Users\Andrew\Documents\xfil\xfil_devt_intel\Debug;c:\symstore
Executable search path is:
ModLoad: 00000000`01250000 00000000`02990000 xfil70.exe
ModLoad: 00000000`778a0000 00000000`77a49000 ntdll.dll
ModLoad: 00000000`77a80000 00000000`77c00000 ntdll32.dll
ModLoad: 00000000`00080000 00000000`000ee000 C:\Windows\system32\verifier.dll
Page heap: pid 0x1C80: page heap enabled with flags 0x3.
AVRF: xfil70.exe: pid 0x1C80: flags 0x80643027: application verifier enabled
ModLoad: 00000000`75100000 00000000`7513f000 C:\Windows\SYSTEM32\wow64.dll
ModLoad: 00000000`750a0000 00000000`750fc000 C:\Windows\SYSTEM32\wow64win.dll
ModLoad: 00000000`75090000 00000000`75098000 C:\Windows\SYSTEM32\wow64cpu.dll
(1c80.1a0c): Break instruction exception - code 80000003 (first chance)
ntdll!LdrpDoDebuggerBreak+0x30:
00000000`7794cb60 cc int 3
0:000> g
ModLoad: 00000000`77620000 00000000`7773f000 WOW64_IMAGE_SECTION
ModLoad: 00000000`762d0000 00000000`763e0000 WOW64_IMAGE_SECTION
ModLoad: 00000000`77620000 00000000`7773f000 NOT_AN_IMAGE
ModLoad: 00000000`771c0000 00000000`772ba000 NOT_AN_IMAGE
ModLoad: 00000000`70fb0000 00000000`71010000 C:\Windows\syswow64\verifier.dll
Page heap: pid 0x1C80: page heap enabled with flags 0x3.
AVRF: xfil70.exe: pid 0x1C80: flags 0x80643027: application verifier enabled
ModLoad: 00000000`71230000 00000000`71259000 C:\Windows\SysWOW64\vrfcore.dll
ModLoad: 00000000`71010000 00000000`71061000 C:\Windows\SysWOW64\vfbasics.dll
ModLoad: 00000000`762d0000 00000000`763e0000 C:\Windows\syswow64\kernel32.dll
ModLoad: 00000000`75b10000 00000000`75b57000 C:\Windows\syswow64\KERNELBASE.dll
ModLoad: 00000000`752e0000 00000000`753f1000 C:\Windows\syswow64\urlmon.dll
ModLoad: 00000000`764c0000 00000000`7656c000 C:\Windows\syswow64\msvcrt.dll
ModLoad: 00000000`76170000 00000000`762cc000 C:\Windows\syswow64\ole32.dll
ModLoad: 00000000`75d10000 00000000`75da0000 C:\Windows\syswow64\GDI32.dll
ModLoad: 00000000`75440000 00000000`75540000 C:\Windows\syswow64\USER32.dll
ModLoad: 00000000`75e10000 00000000`75eb0000 C:\Windows\syswow64\ADVAPI32.dll
ModLoad: 00000000`75eb0000 00000000`75ec9000 C:\Windows\SysWOW64\sechost.dll
ModLoad: 00000000`75ed0000 00000000`75fc0000 C:\Windows\syswow64\RPCRT4.dll
ModLoad: 00000000`75160000 00000000`751c0000 C:\Windows\syswow64\SspiCli.dll
ModLoad: 00000000`75150000 00000000`7515c000 C:\Windows\syswow64\CRYPTBASE.dll
ModLoad: 00000000`77a50000 00000000`77a5a000 C:\Windows\syswow64\LPK.dll
ModLoad: 00000000`75880000 00000000`7591d000 C:\Windows\syswow64\USP10.dll
ModLoad: 00000000`75550000 00000000`755df000 C:\Windows\syswow64\OLEAUT32.dll
ModLoad: 00000000`75da0000 00000000`75df7000 C:\Windows\syswow64\SHLWAPI.dll
ModLoad: 00000000`75920000 00000000`75ad8000 C:\Windows\syswow64\iertutil.dll
ModLoad: 00000000`75bf0000 00000000`75d0b000 C:\Windows\syswow64\WININET.dll
ModLoad: 00000000`75e00000 00000000`75e03000 C:\Windows\syswow64\Normaliz.dll
ModLoad: 00000000`76440000 00000000`764bb000 C:\Windows\syswow64\COMDLG32.dll
ModLoad: 00000000`6df40000 00000000`6dfc4000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149af\COMCTL32.dll
ModLoad: 00000000`76570000 00000000`771ba000 C:\Windows\syswow64\SHELL32.dll
ModLoad: 00000000`755f0000 00000000`7561a000 C:\Windows\syswow64\imagehlp.dll
ModLoad: 00000000`10000000 00000000`10011000 C:\Windows\SysWOW64\DESKEY32.dll
ModLoad: 00000000`74db0000 00000000`74db9000 C:\Windows\SysWOW64\VERSION.dll
(1c80.1a0c): WOW64 breakpoint - code 4000001f (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
ntdll32!LdrpDoDebuggerBreak+0x2c:
77b20fab cc int 3
0:000:x86> g
ModLoad: 763e0000 76440000 C:\Windows\SysWOW64\IMM32.DLL
ModLoad: 75fc0000 7608c000 C:\Windows\syswow64\MSCTF.dll
Breakpoint 1 hit
xfil70!INITIALSETTINGS+0x6:
01361e06 c7042460ca7f02 mov dword ptr [esp],offset xfil70!RVER (027fca60) ss:002b:0038fcb8=00000000
0:000:x86> g
ModLoad: 71530000 715b0000 C:\Windows\SysWOW64\uxtheme.dll
ModLoad: 75b60000 75be3000 C:\Windows\syswow64\CLBCatQ.DLL
ModLoad: 09f50000 09fcb000 C:\Windows\SysWOW64\comdlg32.dll
ModLoad: 00000000`6ece0000 00000000`6ecf3000 C:\Windows\SysWOW64\dwmapi.dll
ModLoad: 00000000`6d940000 00000000`6dade000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll
ModLoad: 00000000`0c600000 00000000`0d24a000 C:\Windows\SysWOW64\shell32.dll
ModLoad: 00000000`0cf30000 00000000`0d08c000 C:\Windows\SysWOW64\ole32.dll
ModLoad: 00000000`0d030000 00000000`0d18c000 C:\Windows\SysWOW64\ole32.dll
ModLoad: 00000000`74af0000 00000000`74af7000 C:\Windows\SysWOW64\msiltcfg.dll
ModLoad: 00000000`73500000 00000000`73740000 C:\Windows\SysWOW64\msi.dll
ModLoad: 00000000`6ec30000 00000000`6ec33000 C:\Windows\SysWOW64\SFC.DLL
ModLoad: 00000000`6de20000 00000000`6de2d000 C:\Windows\SysWOW64\sfc_os.DLL
ModLoad: 00000000`74390000 00000000`74392000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\SKCHUI.DLL
ModLoad: 00000000`743a0000 00000000`743a2000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\PENUSA.DLL
ModLoad: 00000000`74390000 00000000`74392000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\PENUSA.DLL
ModLoad: 00000000`70f50000 00000000`70fa8000 C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll
ModLoad: 00000000`6f880000 00000000`6f9ef000 C:\Windows\SysWOW64\explorerframe.dll
ModLoad: 00000000`71390000 00000000`713bf000 C:\Windows\SysWOW64\DUser.dll
ModLoad: 00000000`6f7c0000 00000000`6f872000 C:\Windows\SysWOW64\DUI70.dll
ModLoad: 00000000`68360000 00000000`6845b000 C:\Windows\SysWOW64\WindowsCodecs.dll
ModLoad: 00000000`6eb90000 00000000`6ebdc000 C:\Windows\SysWOW64\apphelp.dll
ModLoad: 00000000`70f10000 00000000`70f41000 EhStorAPI.DLL
ModLoad: 00000000`70ed0000 00000000`70f01000 C:\Windows\SysWOW64\EhStorShell.dll
ModLoad: 00000000`756a0000 00000000`7583d000 C:\Windows\syswow64\SETUPAPI.dll
ModLoad: 00000000`75410000 00000000`75437000 C:\Windows\syswow64\CFGMGR32.dll
ModLoad: 00000000`75680000 00000000`75692000 C:\Windows\syswow64\DEVOBJ.dll
ModLoad: 00000000`6b010000 00000000`6b105000 C:\Windows\SysWOW64\PROPSYS.dll
ModLoad: 00000000`730d0000 00000000`73140000 ntshrui.dll
ModLoad: 00000000`730d0000 00000000`73140000 C:\Windows\SysWOW64\ntshrui.dll
ModLoad: 00000000`6c780000 00000000`6c799000 C:\Windows\SysWOW64\srvcli.dll
ModLoad: 00000000`730c0000 00000000`730cb000 C:\Windows\SysWOW64\cscapi.dll
ModLoad: 00000000`730b0000 00000000`730ba000 C:\Windows\SysWOW64\slc.dll
ModLoad: 00000000`6e470000 00000000`6e49f000 C:\Windows\SysWOW64\xmllite.dll
ModLoad: 00000000`70110000 00000000`701a4000 C:\Windows\SysWOW64\MsftEdit.dll
ModLoad: 00000000`0f940000 00000000`0fa0c000 C:\Windows\SysWOW64\msctf.dll
ModLoad: 00000000`0f940000 00000000`0fa0c000 C:\Windows\SysWOW64\msctf.dll
ModLoad: 00000000`6e590000 00000000`6e5bb000 C:\Windows\SysWOW64\msls31.dll
ModLoad: 00000000`74ce0000 00000000`74d01000 C:\Windows\SysWOW64\ntmarta.dll
ModLoad: 00000000`76120000 00000000`76165000 C:\Windows\syswow64\WLDAP32.dll
ModLoad: 00000000`74d80000 00000000`74d8b000 C:\Windows\SysWOW64\profapi.dll
ModLoad: 00000000`6e470000 00000000`6e49f000 C:\Windows\SysWOW64\xmllite.dll
ModLoad: 00000000`74d50000 00000000`74d66000 C:\Windows\SysWOW64\CRYPTSP.dll
ModLoad: 00000000`74d10000 00000000`74d4b000 C:\Windows\SysWOW64\rsaenh.dll
ModLoad: 00000000`6ec00000 00000000`6ec0e000 C:\Windows\SysWOW64\RpcRtRemote.dll
ModLoad: 00000000`70e70000 00000000`70ecc000 C:\Windows\SysWOW64\StructuredQuery.dll
ModLoad: 00000000`6de10000 00000000`6de18000 C:\Windows\SysWOW64\Secur32.dll
ModLoad: 00000000`6aea0000 00000000`6aeee000 C:\Windows\SysWOW64\actxprxy.dll
ModLoad: 00000000`68320000 00000000`68353000 C:\Program Files (x86)\Internet Explorer\ieproxy.dll
ModLoad: 00000000`74390000 00000000`743a6000 C:\Windows\SysWOW64\thumbcache.dll
ModLoad: 00000000`75540000 00000000`75545000 C:\Windows\syswow64\PSAPI.DLL
ModLoad: 00000000`6f3f0000 00000000`6f490000 C:\Windows\SysWOW64\SearchFolder.dll
ModLoad: 00000000`6dff0000 00000000`6e01e000 C:\Windows\SysWOW64\SHDOCVW.dll
ModLoad: 00000000`71a70000 00000000`723bd000 C:\Windows\SysWOW64\ieframe.DLL
ModLoad: 00000000`749b0000 00000000`749ec000 C:\Windows\SysWOW64\OLEACC.dll
ModLoad: 00000000`73140000 00000000`73149000 C:\Windows\SysWOW64\LINKINFO.dll
ModLoad: 00000000`66a10000 00000000`66ba8000 NetworkExplorer.dll
ModLoad: 00000000`66a10000 00000000`66ba8000 NetworkExplorer.dll
ModLoad: 00000000`6dc60000 00000000`6dc92000 C:\Windows\SysWOW64\WINMM.dll
ModLoad: 00000000`66a10000 00000000`66ba8000 C:\Windows\SysWOW64\NetworkExplorer.dll
ModLoad: 00000000`742f0000 00000000`74302000 C:\Windows\SysWOW64\MPR.dll
ModLoad: 00000000`71220000 00000000`71228000 C:\Windows\SysWOW64\drprov.dll
ModLoad: 00000000`749f0000 00000000`74a19000 C:\Windows\SysWOW64\WINSTA.dll
ModLoad: 00000000`70f30000 00000000`70f44000 C:\Windows\SysWOW64\ntlanman.dll
ModLoad: 00000000`70f10000 00000000`70f27000 C:\Windows\SysWOW64\davclnt.dll
ModLoad: 00000000`71470000 00000000`71478000 C:\Windows\SysWOW64\DAVHLPR.dll
ModLoad: 00000000`70e60000 00000000`70e6d000 C:\Windows\SysWOW64\NetworkItemFactory.dll
ModLoad: 00000000`70e50000 00000000`70e5b000 C:\Windows\SysWOW64\dtsh.dll
ModLoad: 00000000`714b0000 00000000`71526000 C:\Windows\SysWOW64\FirewallAPI.dll
ModLoad: 00000000`6bfb0000 00000000`6bfbf000 C:\Windows\SysWOW64\wkscli.dll
ModLoad: 00000000`6c7a0000 00000000`6c7a9000 C:\Windows\SysWOW64\netutils.dll
ModLoad: 00000000`165a0000 00000000`16616000 C:\Windows\SysWOW64\FirewallAPI.dll
ModLoad: 00000000`70c10000 00000000`70e48000 WPDSHEXT.dll
ModLoad: 00000000`667d0000 00000000`66a08000 C:\Windows\SysWOW64\wpdshext.dll
ModLoad: 00000000`74f00000 00000000`75090000 C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17825_none_72d273598668a06b\gdiplus.dll
ModLoad: 00000000`70dc0000 00000000`70e49000 C:\Windows\SysWOW64\PortableDeviceApi.dll
ModLoad: 00000000`75ae0000 00000000`75b0d000 C:\Windows\syswow64\WINTRUST.dll
ModLoad: 00000000`751c0000 00000000`752de000 C:\Windows\syswow64\CRYPT32.dll
ModLoad: 00000000`755e0000 00000000`755ec000 C:\Windows\syswow64\MSASN1.dll
ModLoad: 00000000`70d80000 00000000`70dbf000 SHMEDIA.dll
ModLoad: 00000000`6f200000 00000000`6f208000 C:\Windows\SysWOW64\npmproxy.dll
ModLoad: 00000000`70d90000 00000000`70dbb000 C:\Windows\SysWOW64\FunDisc.dll
ModLoad: 00000000`71200000 00000000`71214000 C:\Windows\SysWOW64\ATL.DLL
ModLoad: 00000000`70d50000 00000000`70d8f000 C:\Windows\SysWOW64\audiodev.dll
ModLoad: 00000000`65f30000 00000000`66197000 C:\Windows\SysWOW64\WMVCore.DLL
ModLoad: 00000000`70d10000 00000000`70d4d000 C:\Windows\SysWOW64\WMASF.DLL
ModLoad: 00000000`70bb0000 00000000`70d07000 C:\Windows\SysWOW64\msxml6.dll
ModLoad: 00000000`70b80000 00000000`70ba2000 C:\Windows\SysWOW64\EhStorAPI.dll
ModLoad: 00000000`70b70000 00000000`70b7a000 C:\Windows\SysWOW64\fdproxy.dll
ModLoad: 00000000`70b50000 00000000`70b67000 C:\Windows\SysWOW64\fdwcn.dll
ModLoad: 00000000`6f270000 00000000`6f289000 C:\Windows\SysWOW64\wcnapi.dll
ModLoad: 00000000`70b40000 00000000`70b49000 C:\Windows\SysWOW64\fdWNet.dll
ModLoad: 00000000`73ae0000 00000000`73afc000 C:\Windows\SysWOW64\IPHLPAPI.DLL
ModLoad: 00000000`75400000 00000000`75406000 C:\Windows\syswow64\NSI.dll
ModLoad: 00000000`74290000 00000000`74297000 C:\Windows\SysWOW64\WINNSI.DLL
ModLoad: 00000000`75840000 00000000`75875000 C:\Windows\syswow64\WS2_32.dll
ModLoad: 00000000`6ebf0000 00000000`6ebfd000 C:\Windows\SysWOW64\dfscli.dll
ModLoad: 00000000`6ebe0000 00000000`6ebed000 C:\Windows\SysWOW64\browcli.dll
Breakpoint 0 hit
xfil70!xfil+0x63:
0135970d e884a9fdff call xfil70!SET_CHILD (01334096)
0:002:x86> g
ModLoad: 6e040000 6e042000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\SKCHUI.DLL
ModLoad: 00000000`6e040000 00000000`6e042000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\PENUSA.DLL
ModLoad: 00000000`6e030000 00000000`6e032000 C:\Program Files (x86)\Common Files\Microsoft Shared\INK\PENUSA.DLL
Breakpoint 3 hit
xfil70!NEWFIB+0x4:
0135caf4 c70520d47f020f000000 mov dword ptr [xfil70!IFTYP (027fd420)],0Fh ds:002b:027fd420=00000000
0:000:x86> g
ModLoad: 00000000`70110000 00000000`701a4000 C:\Windows\SysWOW64\MsftEdit.dll
Breakpoint 2 hit
xfil70!MOUSE_REG+0x6:
012982d8 c70540d47f0209000000 mov dword ptr [xfil70!MEVENT (027fd440)],9 ds:002b:027fd440=00000000
0:000:x86> g
ModLoad: 742b0000 742ec000 C:\Windows\SysWOW64\mswsock.dll
ModLoad: 742a0000 742a5000 C:\Windows\SysWOW64\wshtcpip.dll
ModLoad: 6d8a0000 6d8a6000 C:\Windows\SysWOW64\wship6.dll
ModLoad: 6d8f0000 6d934000 C:\Windows\SysWOW64\DNSAPI.dll
ModLoad: 6d270000 6d297000 C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
ModLoad: 6d8b0000 6d8b6000 C:\Windows\SysWOW64\rasadhlp.dll
ModLoad: 6d230000 6d268000 C:\Windows\SysWOW64\fwpuclnt.dll
ModLoad: 6b410000 6b41d000 C:\Windows\SysWOW64\dhcpcsvc6.DLL
ModLoad: 731e0000 731f2000 C:\Windows\SysWOW64\dhcpcsvc.DLL
Breakpoint 2 hit
xfil70!MOUSE_REG+0x6:
012982d8 c70540d47f0209000000 mov dword ptr [xfil70!MEVENT (027fd440)],9 ds:002b:027fd440=09000000
0:000:x86> p
xfil70!MOUSE_REG+0x10:
012982e2 a1e0cd7f02 mov eax,dword ptr [xfil70!xfilDATA_mp_ISTAGE (027fcde0)] ds:002b:027fcde0=02000000
0:000:x86> g
(1c80.1a0c): Invalid handle - code c0000008 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
ntdll!KiRaiseUserExceptionDispatcher+0x3a:
00000000`778f12f7 8b8424c0000000 mov eax,dword ptr [rsp+0C0h] ss:00000000`0024e950=080000c0
0:000> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************

APPLICATION_VERIFIER_HANDLES_INVALID_HANDLE (300)
Invalid handle exception for current stack trace.
This stop is generated if the function on the top of the stack passed an
invalid handle to system routines. Usually a simple kb command will reveal
what is the value of the handle passed (must be one of the parameters -
usually the first one). If the value is null then this is clearly wrong.
If the value looks ok you need to use !htrace debugger extension to get a
history of operations pertaining to this handle value. In most cases it
must be that the handle value is used after being closed.
Arguments:
Arg1: ffffffffc0000008, Exception code.
Arg2: 0000000000000000, Exception record. Use .exr to display it.
Arg3: 0000000000000000, Context record. Use .cxr to display it.
Arg4: 0000000000000000, Not used.
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Windows\SysWOW64\ieframe.DLL -
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Windows\syswow64\ole32.dll -
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Windows\SYSTEM32\wow64win.dll -

FAULTING_IP:
ntdll!KiRaiseUserExceptionDispatcher+3a
00000000`778f12f7 8b8424c0000000 mov eax,dword ptr [rsp+0C0h]

EXCEPTION_RECORD: ffffffffffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 00000000778f12f7 (ntdll!KiRaiseUserExceptionDispatcher+0x000000000000003a)
ExceptionCode: c0000008 (Invalid handle)
ExceptionFlags: 00000000
NumberParameters: 0
Thread tried to close a handle that was invalid or illegal to close

FAULTING_THREAD: 0000000000001a0c

PROCESS_NAME: xfil70.exe

BAD_HANDLE: 0000000000000000 (!htrace 0000000000000000)

ERROR_CODE: (NTSTATUS) 0xc0000008 - An invalid HANDLE was specified.

EXCEPTION_CODE: (NTSTATUS) 0xc0000008 - An invalid HANDLE was specified.

NTGLOBALFLAG: 2000100

APPLICATION_VERIFIER_FLAGS: 80643027

APP: xfil70.exe

BUGCHECK_STR: APPLICATION_FAULT_STATUS_INVALID_HANDLE_AFTER_CALL

PRIMARY_PROBLEM_CLASS: STATUS_INVALID_HANDLE_AFTER_CALL

DEFAULT_BUCKET_ID: STATUS_INVALID_HANDLE_AFTER_CALL

LAST_CONTROL_TRANSFER: from 0000000075092dbf to 00000000778f12f7

STACK_TEXT:
00000000`0024e890 00000000`75092dbf : 00000000`754578d7 00000000`75100023 00000000`00000246 00000000`0038fdc8 : ntdll!KiRaiseUserExceptionDispatcher+0x3a
00000000`0024e960 00000000`7510d07e : 00000000`0024fd20 00000000`75091920 00000000`00000000 00000000`0024ea90 : wow64cpu!Thunk0Arg+0x5
00000000`0024ea20 00000000`7510c549 : 00000000`00000000 00000000`00000000 00000000`75104ac8 00000000`7ffe0030 : wow64!RunCpuSimulation+0xa
00000000`0024ea70 00000000`778e4956 : 00000000`042a3f00 00000000`00000000 00000000`779d2670 00000000`779a5978 : wow64!Wow64LdrpInitialize+0x429
00000000`0024efc0 00000000`778e1a17 : 00000000`00000000 00000000`778e4061 00000000`0024f570 00000000`00000000 : ntdll!LdrpInitializeProcess+0x17e4
00000000`0024f4b0 00000000`778cc32e : 00000000`0024f570 00000000`00000000 00000000`7efdf000 00000000`00000000 : ntdll! ?? ::FNODOBFM::`string'+0x29220
00000000`0024f520 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!LdrInitializeThunk+0xe


FOLLOWUP_IP:
wow64cpu!Thunk0Arg+5
00000000`75092dbf 4989a42480140000 mov qword ptr [r12+1480h],rsp

SYMBOL_STACK_INDEX: 1

SYMBOL_NAME: wow64cpu!Thunk0Arg+5

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: wow64cpu

IMAGE_NAME: wow64cpu.dll

DEBUG_FLR_IMAGE_TIMESTAMP: 50b8488e

STACK_COMMAND: ~0s ; kb

FAILURE_BUCKET_ID: STATUS_INVALID_HANDLE_AFTER_CALL_c0000008_wow64cpu.dll!Thunk0Arg

BUCKET_ID: X64_APPLICATION_FAULT_STATUS_INVALID_HANDLE_AFTER_CALL_wow64cpu!Thunk0Arg+5

WATSON_STAGEONE_URL: http://watson.microsoft.com/StageOne/xfil70_exe/7_46_0_0/510e4f8e/ntdll_dll/6_1_7601_17725/4ec4aa8e/c0000008/000512f7.htm?Retriage=1

Followup: MachineOwner
---------

0 Kudos
Bernard
Valued Contributor I
2,167 Views

Hi

Your culprit is this function call 00000000`0024e960 00000000`7510d07e : 00000000`0024fd20 00000000`75091920 00000000`00000000 00000000`0024ea90 : wow64cpu!Thunk0Arg+0x5

Sadly  handle is null so it cannot be tracked with the help of !htrace and !handle commands. Top of the stack is passed to faulting routine here: 00000000`75092dbf 4989a42480140000 mov qword ptr [r12+1480h],rsp

This is the return address of the wow64cpu!Thunk0Arg caller.Can you dissasemble the caller function and look for some values which could be passed as a handle?Now I see that the error is deep inside Wow64 system library.I would also asdvise you to disasemble remaininig two Wow64 calls. 

0 Kudos
Bernard
Valued Contributor I
2,167 Views

I would also try to disassemble this function "KiRaiseUserExceptionDispatcher".Try to run your app on 32-bit Windows.Another option is to dump raw stack data with this command dds [stack start address]  [stack end address] and look for calls to function which return the handle, moreover there is some possibility that handle was corrupted and accidently overwritten with zeroes.

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

Thanks I will dig a bit deeper, I am starting to get some small understanding of this stuff.

I am not sure running on 32-bit Windows will help, I can run OK on another machine with the same x64 windows! I think I have a specific issue on this particular machine (that I didn't have previously). I tried some old versions of my code that worked fine and now they do not!

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

OK rather than running my application in windbg I used windbg as a postmortem debugger as suggested earlier. The exception occurs as before but a get quite a different report from !analyze -v. This is shown below.

If I look at the stack we go through several routines to get to 'DeReferenceGetUnitPointer' all of which have 0011064a as parameters. I had previously grabbed the handle of all my windows and had a watch on them I know this is the windows handle of the window I made a left mouse click input.

The next routine in the stack is GETUNITQQ which should get the the quickwin unit assosiated with the windows handle. This routine takes the windows handle as a paramter but 0011064a is absent leading me to think the error ocurs in DeReferenceGetUnitPointer. Can anyone shed an light on this and how I can investigate further to get to a fix?

.....

ModLoad: 6db90000 6db9d000 C:\Windows\system32\dfscli.dll

ModLoad: 6db80000 6db8d000 C:\Windows\system32\browcli.dll
(225c.204): Invalid handle - code c0000008 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000001 ebx=003dfb48 ecx=00000000 edx=00000000 esi=003dfa84 edi=003dfaa0
eip=77a9fb81 esp=003df86c ebp=003df87c iopl=0 nv up ei pl zr na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246
ntdll!ZwReleaseMutant+0x15:
77a9fb81 83c404 add esp,4
0:000> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************


FAULTING_IP:
+0
778f12f7 8b8424c0000000 mov eax,dword ptr [esp+0C0h]

EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 778f12f7
ExceptionCode: c0000008 (Invalid handle)
ExceptionFlags: 00000000
NumberParameters: 0
Thread tried to close a handle that was invalid or illegal to close

FAULTING_THREAD: 00000204

PROCESS_NAME: cadfil70.exe

OVERLAPPED_MODULE: Address regions for 'thumbcache' and 'SKCHUI.DLL' overlap

ERROR_CODE: (NTSTATUS) 0xc0000008 - An invalid HANDLE was specified.

EXCEPTION_CODE: (NTSTATUS) 0xc0000008 - An invalid HANDLE was specified.

NTGLOBALFLAG: 2000100

APPLICATION_VERIFIER_FLAGS: 80643027

APP: cadfil70.exe

BUGCHECK_STR: APPLICATION_FAULT_STATUS_INVALID_HANDLE_AFTER_CALL

PRIMARY_PROBLEM_CLASS: STATUS_INVALID_HANDLE_AFTER_CALL

DEFAULT_BUCKET_ID: STATUS_INVALID_HANDLE_AFTER_CALL

LAST_CONTROL_TRANSFER: from 75b20fa2 to 77a9fb81

STACK_TEXT:
003df86c 75b20fa2 00000000 00000000 003df8b4 ntdll!ZwReleaseMutant+0x15
003df87c 013ed94c 00000000 087e1e90 00000002 KERNELBASE!ReleaseMutex+0x10
003df8b4 013e244e fffffffd 0dcbcdb8 00000000 cadfil70!for__release_lun+0x1bc
003df8d8 0142be13 003df8ec 003df90c 0142bb8c cadfil70!GETUNITQQ+0x4e
003df8e4 0142bb8c 00000402 00000402 0011064a cadfil70!DeReferenceGetUnitPointer+0x13
003df90c 0144bc38 0011064a 00000001 00000001 cadfil70!_QWGChangeMouseStatus+0x12c
003df960 754562fa 0011064a 00000201 00000001 cadfil70!_QWGraphWndProc+0x338
003df98c 75456d3a 0144b900 0011064a 00000201 USER32!InternalCallWinProc+0x23
003dfa04 754577c4 00000000 0144b900 0011064a USER32!UserCallWinProcCheckWow+0x109
003dfa64 75457bca 0144b900 00000001 003dfaf8 USER32!DispatchMessageWorker+0x3bc
003dfa74 01438bbe 003dfa84 003dfb48 0011064a USER32!DispatchMessageA+0xf
003dfaf8 0146a7da 003dfb20 01474e4b 003dfb20 cadfil70!WinMain+0x17e
003dfbd8 762e33aa 7efde000 003dfc24 77ab9ef2 cadfil70!__tmainCRTStartup+0x11a
003dfbe4 77ab9ef2 7efde000 7315571f 00000000 kernel32!BaseThreadInitThunk+0xe
003dfc24 77ab9ec5 0146a82d 7efde000 00000000 ntdll!__RtlUserThreadStart+0x70
003dfc3c 00000000 0146a82d 7efde000 00000000 ntdll!_RtlUserThreadStart+0x1b


FOLLOWUP_IP:
cadfil70!for__release_lun+1bc
013ed94c e9e5010000 jmp cadfil70!for__release_lun+0x3a6 (013edb36)

SYMBOL_STACK_INDEX: 2

SYMBOL_NAME: cadfil70!for__release_lun+1bc

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: cadfil70

IMAGE_NAME: cadfil70.exe

DEBUG_FLR_IMAGE_TIMESTAMP: 510e4f8e

STACK_COMMAND: ~0s ; kb

FAILURE_BUCKET_ID: STATUS_INVALID_HANDLE_AFTER_CALL_c0000008_cadfil70.exe!for__release_lun

BUCKET_ID: APPLICATION_FAULT_STATUS_INVALID_HANDLE_AFTER_CALL_cadfil70!for__release_lun+1bc

WATSON_STAGEONE_URL: http://watson.microsoft.com/StageOne/cadfil70_exe/7_46_0_0/510e4f8e/unknown/0_0_0_0/bbbbbbb4/c0000008/778f12f7.htm?Retriage=1

Followup: MachineOwner
---------

0 Kudos
Bernard
Valued Contributor I
2,167 Views

This stack and handle related error is from different program.What i have been able to understand is that ntdll!ZwReleaseMutant is cleaning the stack.From the call stack itself it is not iminent that there was a test for invalid handle that means no exception was thrown from within the procedures.I see that you have been able to indentify the handle so please run this command on the hnadle !handle and this command !htrace and report the result.For better clarity I will recommend to obtain raw stack data with the command dds [start address] [end address] so we can track the handle more efficiently.Stack size you can obtain from the !teb command.

0 Kudos
Bernard
Valued Contributor I
2,167 Views

 Is this stack and handle related error is from different program.What i have been able to understand is that ntdll!ZwReleaseMutant is cleaning the stack.From the call stack itself it is not iminent that there was a test for invalid handle that means no exception was thrown from within the procedures.I see that you have been able to indentify the handle so please run this command on the hnadle !handle and this command !htrace and report the result.For better clarity I will recommend to obtain raw stack data with the command dds [start address] [end address] so we can track the handle more efficiently.Stack size you can obtain from the !teb command.

0 Kudos
andrew_4619
Honored Contributor III
2,167 Views

It is the same program, and the user sequence prior to the problem is axactley the same (the earlier dump had xfil not cadfil but this was only a text edit replace in the log). The stack trace back is quite different today which made be think....

I have just discovered that when I run the program today it does into debug at the first mouse event (exception) but if I then detach the debugger the programs runs OK without crashing for hanging. The invalid handle exception is handled. It is what I noted before when I ignored the errors under debug the controlled returned back into my call back routine with valid and correct mouse event date (which is still the case), outside the debugger it prevously hung/crashed.

This is the reason why the stack looks different we are not going down the windows error routine chain.

This problem will come back I think so I need to understand using windbg better. 

!handle handle_id - how do I know what the handle id is? I only know the value of the windows handle as I inquired it using GETHWNDQQ in my app. What to I need to trace with !htrace? 

I think I need to do a lot more reading so I know what I am doing!

0 Kudos
IanH
Honored Contributor II
2,033 Views

Is it possible that you are responding to an "expected" exception?  A first chance exception is not necessarily in itself an error - that just means that the operating system informed the debugger that an exception occurred.  An exception handler may have been installed in the chain that can respond to that exception and let the program continue on its way (perhaps the handler converts the exception to an error code or perhaps it tries a different operation).  Typically "real" errors result when the exception isn't handled at all (or a handler handles the exception by telling you that something is broken and then terminating your program).  Based on what you describe in your initial post this looks like what is happening - you might be trying to debug something that is working as designed.

Windbg strikes me as a bit of overkill for this, given information to date.

0 Kudos
Reply