Debugging XP SP2/SP3 native application symbol path issue - debugging

When I tried to validate, if WinDbg has been setup properly, I opened the executable C:\WINDOWS\NOTEPAD.exe and tried to check the loaded modules.
First of all, these are the environment variables set:
_NT_SYMBOL_PATH: c:\mysymbols;SRV*c:\symbols*https://msdl.microsoft.com/download/symbols
_NT_EXECUTABLE_IMAGE_PATH: SRV*c:\symbols
This is the WinDbg output:
CommandLine: C:\WINDOWS\NOTEPAD.EXE
Symbol search path is: SRV*C:\symbols*https://msdl.microsoft.com/download/symbols;c:\mysymbols
Executable search path is: SRV*c:\symbols
ModLoad: 01000000 01014000 notepad.exe
ModLoad: 7c910000 7c9c9000 ntdll.dll
ModLoad: 7c800000 7c908000 C:\WINDOWS\system32\kernel32.dll
ModLoad: 76350000 7639a000 C:\WINDOWS\system32\comdlg32.dll
ModLoad: 77da0000 77e4a000 C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77e50000 77ee3000 C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fc0000 77fd1000 C:\WINDOWS\system32\Secur32.dll
ModLoad: 773a0000 774a3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\COMCTL32.dll
ModLoad: 77be0000 77c38000 C:\WINDOWS\system32\msvcrt.dll
ModLoad: 77ef0000 77f39000 C:\WINDOWS\system32\GDI32.dll
ModLoad: 7e360000 7e3f1000 C:\WINDOWS\system32\USER32.dll
ModLoad: 77f40000 77fb6000 C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 7e670000 7ee91000 C:\WINDOWS\system32\SHELL32.dll
ModLoad: 72f70000 72f96000 C:\WINDOWS\system32\WINSPOOL.DRV
(ef8.f6c): Break instruction exception - code 80000003 (first chance)
eax=001a1eb4 ebx=7ffd5000 ecx=00000007 edx=00000080 esi=001a1f48 edi=001a1eb4
eip=7c91120e esp=0007fb20 ebp=0007fc94 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
*** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll -
ntdll!DbgBreakPoint:
7c91120e cc int 3
I switched on sym noisy mode, called .reload and got the continued output when I tried to list the loaded modules:
0:000> !sym noisy
noisy mode - symbol prompts on
0:000> .reload
Reloading current modules
..............
DBGHELP: c:\mysymbols\ntdll.pdb - mismatched pdb
DBGHELP: c:\mysymbols\symbols\dll\ntdll.pdb - file not found
DBGHELP: c:\mysymbols\dll\ntdll.pdb - file not found
SYMSRV: Die Serververbindung wurde zurückgesetzt.
SYMSRV: c:\symbols\ntdll.pdb\A618C674A4FC40F5B1781029C2C7F68E2\ntdll.pdb not found
SYMSRV: https://msdl.microsoft.com/download/symbols/ntdll.pdb/A618C674A4FC40F5B1781029C2C7F68E2/ntdll.pdb not found
DBGHELP: C:\WINDOWS\system32\ntdll.pdb - file not found
DBGHELP: ntdll.pdb - file not found
DBGHELP: Couldn't load mismatched pdb for C:\WINDOWS\system32\ntdll.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll -
DBGHELP: ntdll - export symbols
0:000> lm
start end module name
01000000 01014000 notepad (deferred)
72f70000 72f96000 WINSPOOL (deferred)
76350000 7639a000 comdlg32 (deferred)
773a0000 774a3000 COMCTL32 (deferred)
77be0000 77c38000 msvcrt (deferred)
77da0000 77e4a000 ADVAPI32 (deferred)
77e50000 77ee3000 RPCRT4 (deferred)
77ef0000 77f39000 GDI32 (deferred)
77f40000 77fb6000 SHLWAPI (deferred)
77fc0000 77fd1000 Secur32 (deferred)
7c800000 7c908000 kernel32 (deferred)
7c910000 7c9c9000 ntdll (export symbols) C:\WINDOWS\system32\ntdll.dll
7e360000 7e3f1000 USER32 (deferred)
7e670000 7ee91000 SHELL32 (deferred)
The line 7c910000 7c9c9000 ntdll (export symbols) C:\WINDOWS\system32\ntdll.dll shows, that the symbol files couldn't get loaded successfully.
I have downloaded and installed the symbols (like WindowsXP-KB835935-SP2-slp-Symbols) but still the PDB files don't seem to match with my ntdll.dll build. But why is that the case? Is there any chance I can get this to work?

As I couldn't stop pondering about the root of the problem, I reread the output above:
SYMSRV: c:\symbols\ntdll.pdb\A618C674A4FC40F5B1781029C2C7F68E2\ntdll.pdb not found
SYMSRV: https://msdl.microsoft.com/download/symbols/ntdll.pdb/A618C674A4FC40F5B1781029C2C7F68E2/ntdll.pdb not found
The debugger is looking for a symbol file having the GUID A618C674A4FC40F5B1781029C2C7F68E2, it even outputs an URI it is trying to load the pdb from. Thus, I tried to download the pdb manually, which worked, created the GUID directory manually, renamed the blob file to ntdll.pdb and placed it within the GUID-directory.
As a result, it did finally work, as the following output shows:
:000> .reload
Reloading current modules
............
DBGHELP: c:\mysymbols\ntdll.pdb - mismatched pdb
DBGHELP: c:\mysymbols\symbols\dll\ntdll.pdb - file not found
DBGHELP: c:\mysymbols\dll\ntdll.pdb - file not found
DBGHELP: ntdll - public symbols
c:\symbols\ntdll.pdb\A618C674A4FC40F5B1781029C2C7F68E2\ntdll.pdb
..
0:000> lm
start end module name
01000000 01014000 notepad (deferred)
72f70000 72f96000 WINSPOOL (deferred)
76350000 7639a000 comdlg32 (deferred)
773a0000 774a3000 COMCTL32 (deferred)
77be0000 77c38000 msvcrt (deferred)
77da0000 77e4a000 ADVAPI32 (deferred)
77e50000 77ee2000 RPCRT4 (deferred)
77ef0000 77f38000 GDI32 (deferred)
77f40000 77fb6000 SHLWAPI (deferred)
77fc0000 77fd1000 Secur32 (deferred)
7c800000 7c907000 kernel32 (deferred)
7c910000 7c9c9000 ntdll (pdb symbols) c:\symbols\ntdll.pdb\A618C674A4FC40F5B1781029C2C7F68E2\ntdll.pdb
7e360000 7e3f0000 USER32 (deferred)
7e670000 7ee90000 SHELL32 (deferred)
EDIT: I was finally able to get the automatic download from the symbol server working! I always thought about it in the beginning, but did not believe it could be the reason: With a newer version 6.12.0002.633 it does work as expected, while with the 6.6.07.5 it did not.

Related

why am I not getting ntdll correctly loaded in windbg , but it is downloaded windbg x86?

I was trying to set up my debugging environment, but it works perfectly on windbg x64 10.0.17763.132, but however when I tried to use !address , !heap it doesn't work because No symbols for ntdll. Cannot continue.. I also tried to reinstall c++ redistributable , and debugging tools, and nothing seems to work. I got Windows 10 SDK, version 1809 (10.0.17763.0) , and maybe MS symbols server is having an issue with it
ntdll log
0:000> lmvm ntdll
Browse full module list
start end module name
77370000 7750a000 ntdll (pdb symbols) c:\windbgsymbols\wntdll.pdb\D85FCE08D56038E2C69B69F29E11B5EE1\wntdll.pdb
Loaded symbol image file: C:\WINDOWS\SYSTEM32\ntdll.dll
Image path: ntdll.dll
Image name: ntdll.dll
Browse all global symbols functions data
Image was built with /Brepro flag.
Timestamp: A4208572 (This is a reproducible build file hash, not a timestamp)
CheckSum: 00198081
ImageSize: 0019A000
File version: 10.0.18362.387
Product version: 10.0.18362.387
File flags: 0 (Mask 3F)
File OS: 40004 NT Win32
File type: 2.0 Dll
File date: 00000000.00000000
Translations: 0409.04b0
Information from resource tables:
CompanyName: Microsoft Corporation
ProductName: Microsoft® Windows® Operating System
InternalName: ntdll.dll
OriginalFilename: ntdll.dll
ProductVersion: 10.0.18362.387
FileVersion: 10.0.18362.387 (WinBuild.160101.0800)
FileDescription: NT Layer DLL
LegalCopyright: © Microsoft Corporation. All rights reserved.
0:000> !heap
Invalid type information
0:000> !address
No symbols for ntdll. Cannot continue.
proof
This is how you see what is happening with symbol loading:
!sym noisy
.reload /f ntdll.dll

No symbol found in windbg

I am trying to debug kernel in remote debugging using vmware and windbg.I have connected to target machine .My driver name is comint32.I have started the service of my driver in target machine .I want to view the dbgprint of my driver.Whenever I try to use break point I got an error "couldn't resolve error at 'comint32!DriverEntry'".This is the current status windbg output:
kd> x*!
start end module name
80bd1000 80bd9000 kdcom (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\kdcom.pdb\F48BD9BC030C43D89689518F892586901\kdcom.pdb
82812000 82849000 hal (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\halmacpi.pdb\AE605D6C59454802AE1D485E0B089A571\halmacpi.pdb
82849000 82c5b000 nt (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\ntkrpamp.pdb\684DA42A30CC450F81C535B4D18944B12\ntkrpamp.pdb
82e09000 82e8e000 mcupdate_GenuineIntel (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\mcupdate_GenuineIntel.pdb\26689A9400E04CF6AD63DC2E608DAA9C1\mcupdate_GenuineIntel.pdb
82e8e000 82e9f000 PSHED (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\pshed.pdb\5ACEAFD8AD3A46FEAD083AFDF675DA391\pshed.pdb
82e9f000 82ea7000 BOOTVID (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\bootvid.pdb\10C3ABD4165D4ED3A9493BB094B44AEA1\bootvid.pdb
82ea7000 82ee9000 CLFS (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\clfs.pdb\04F22EAC7BD04A1BA81A6FB5D319649F1\clfs.pdb
82ee9000 82f94000 CI (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\ci.pdb\3358E6E48A5245F6AB97EA05356E020F1\ci.pdb
82f94000 82fdf000 volmgrx (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\volmgrx.pdb\433F00DD3CC34DE8BC3F9E4BDDACA5EE1\volmgrx.pdb
82fdf000 82fed000 PCIIDEX (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\pciidex.pdb\8B7BC6201128486CB5B03916EBD5FF8E1\pciidex.pdb
83800000 83807000 intelide (no symbols)
8380a000 8387cd00 dsfksvcs (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\dsfksvcs.pdb\EE67C173CB4C4B31BA3806038D42B3C01\dsfksvcs.pdb
8387d000 838b8500 DSFOleaut32 (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\DSFOleaut32.pdb\F02C6A23966243E1B10F05EB634A88331\DSFOleaut32.pdb
838b9000 8392a000 Wdf01000 (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\Wdf01000.pdb\A9E46808F4F748178D3071AA9EE76FB71\Wdf01000.pdb
8392a000 83938000 WDFLDR (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\wdfldr.pdb\95D9DB57778548E6B6774520468479891\wdfldr.pdb
83938000 83980000 ACPI (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\acpi.pdb\E7300A0CC3524834A4E1E55773C1901E1\acpi.pdb
83980000 83989000 WMILIB (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\wmilib.pdb\F52B38A4800849D48BFFD48715A446A51\wmilib.pdb
83989000 83991000 msisadrv (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\msisadrv.pdb\5D6926DA4AD1474BAE8CBDA5909F68201\msisadrv.pdb
83991000 839bb000 pci (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\pci.pdb\2E2A912260694615A7E97AFBA3FA934E1\pci.pdb
839bb000 839c6000 vdrvroot (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\vdrvroot.pdb\3C9D6939EF564015B8D0728611C88C221\vdrvroot.pdb
839c6000 839d7000 partmgr (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\partmgr.pdb\7CA861FF7879483ABA38CE28186F293E2\partmgr.pdb
839d7000 839df000 compbatt (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\compbatt.pdb\EE14F03B54BF49B4B62A0EF912A59C8F1\compbatt.pdb
839df000 839ea000 BATTC (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\battc.pdb\53C47BEA2F08470BB58DFD1566285EC71\battc.pdb
839ea000 839fa000 volmgr (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\volmgr.pdb\4AF04B598C494297B1C69F95823AA9F81\volmgr.pdb
83a24000 83a3a000 mountmgr (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\mountmgr.pdb\356DDF9839E040638E034EEA956C28F81\mountmgr.pdb
83a3a000 83a43000 atapi (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\atapi.pdb\EF544461A5D5482980C2CA01640A6D621\atapi.pdb
83a43000 83a66000 ataport (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\ataport.pdb\C9AF9FE9166548FD86EFAC017F6023011\ataport.pdb
83a66000 83a7e000 lsi_sas (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\lsi_sas.pdb\FCC2DAF36299423A9765B62D750A97461\lsi_sas.pdb
83a7e000 83ac6000 storport (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\storport.pdb\E19FF676062D46A69EB1BB6A916896172\storport.pdb
83ac6000 83acf000 amdxata (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\amdxata.pdb\5E66F230920844408A1EE389D50B6B4A1\amdxata.pdb
83acf000 83b03000 fltmgr (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\fltMgr.pdb\E6CA9E082E70438988788CB58DB340B01\fltMgr.pdb
83b03000 83b14000 fileinfo (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\fileinfo.pdb\EBD1E885413A4242AA515F1B06BB564F1\fileinfo.pdb
83b14000 83bcb000 ndis (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\ndis.pdb\4DAAA54E2C26455DB2471D696BC8E6A62\ndis.pdb
83bcb000 83bfc000 fwpkclnt (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\fwpkclnt.pdb\FDE8223F22C54AEA8061EE56EA16A0251\fwpkclnt.pdb
88c00000 88c0e000 pcw (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\pcw.pdb\D368300F340A423EBBA32FBDDDEC24B91\pcw.pdb
88c0e000 88c17000 Fs_Rec (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\fs_rec.pdb\3465ED05A901452FAD07E77351F094591\fs_rec.pdb
88c2b000 88d5a000 Ntfs (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\ntfs.pdb\04B176C327B240F7A576F3417A7B95032\ntfs.pdb
88d5a000 88d85000 msrpc (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\msrpc.pdb\B4C428CFD1024C43BD3E2B10D1A8F0711\msrpc.pdb
88d85000 88d98000 ksecdd (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\ksecdd.pdb\E84CBB7448354030A32188581CC8B37A1\ksecdd.pdb
88d98000 88df5000 cng (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\cng.pdb\3F94705B83A0481DA755FA6A70729BDE1\cng.pdb
88df5000 88dfb000 comint32 (no symbols)
88e25000 88e63000 NETIO (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\netio.pdb\7A33726ABE884384BFDFB951F05D13AC2\netio.pdb
88e63000 88e88000 ksecpkg (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\ksecpkg.pdb\3D42090DFF4E4D55985F577277A3B1E91\ksecpkg.pdb
88e88000 88fd2000 tcpip (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\tcpip.pdb\0FD6F17209C1481C9008CCDB468746392\tcpip.pdb
88fd2000 88fd7580 dsfroot (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\dsfroot.pdb\95EE5096213948909946E4333289A97F1\dsfroot.pdb
88fd8000 88fe0380 vmstorfl (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\vmstorfl.pdb\D7FD176CC0134139B2EE4BEAF352AEE41\vmstorfl.pdb
89032000 89071000 volsnap (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\volsnap.pdb\1F66E7165E8F4BD982A34A9DFA1BBFD31\volsnap.pdb
89071000 89079000 spldr (no symbols)
89079000 890a6000 rdyboost (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\rdyboost.pdb\53BB42ABE1404332962CA2AEA8301D331\rdyboost.pdb
890a6000 890b6000 mup (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\mup.pdb\E96F69551E2447289250F71FB5AB6E0C2\mup.pdb
890b6000 890be000 hwpolicy (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\hwpolicy.pdb\0F041CEBADCA48F4BC65F68463272F1D1\hwpolicy.pdb
890be000 890f0000 fvevol (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\fvevol.pdb\DC4549C710EE425F8956C7D82BFE83651\fvevol.pdb
890f0000 89101000 disk (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\disk.pdb\D2AD04F7F4BF45C8A8F0E2BF689326F11\disk.pdb
89101000 89126000 CLASSPNP (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\classpnp.pdb\64A86A6AD27D4730A78ECC25166E13562\classpnp.pdb
89126000 89136000 agp440 (pdb symbols) C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\agp440.pdb\BDB51BE7BF024CCF893C1E44B0C266C71\agp440.pdb
kd> .reload /f comint32
"comint32" was not found in the image list.
Debugger will attempt to load "comint32" at given base 00000000.
Please provide the full image name, including the extension (i.e. kernel32.dll)
for more reliable results.Base address and size overrides can be given as
.reload <image.ext>=<base>,<size>.
DBGENG: comint32 - Partial symbol image load missing image info
DBGHELP: No header for comint32. Searching for dbg file
DBGHELP: c:\chapter03ghost\src\objchk_win7_x86\i386\comint32.dbg - file not found
DBGHELP: .\comint32.dbg - file not found
DBGHELP: comint32 missing debug info. Searching for pdb anyway
DBGHELP: Can't use symbol server for comint32.pdb - no header information available
DBGHELP: C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\comint32.pdb\5E9D372C84174583B2DD476990BF10BA1\comint32.pdb already cached
DBGHELP: comint32_0 - private symbols & lines
C:\Program Files (x86)\Debugging Tools for Windows (x86)\sym\comint32.pdb\5E9D372C84174583B2DD476990BF10BA1\comint32.pdb - unmatched
Unable to add module at 00000000
the symbol path of windbg:
kd> .sympath
Symbol search path is: srv*;C:\Chapter03Ghost\bin
Expanded Symbol search path is: cache*;SRV*http://msdl.microsoft.com/download/symbols;c:\chapter03ghost\bin
Check to make sure that the driver is loaded. You can do this using lm or lmvm comint32 the first command will list all modules, the second one will give you detailed information on the comint32. If it isn't listed in the loaded modules, then most likely the driver hasn't been loaded yet. If it is loaded then that's a little odd for it to give this error, but I'm guessing it's not loaded.

builduing on windows 7 running on windows 2008: Unable to initialize application 0xc0000005. Using a reference to a Wrapper on C# library

I am building a C++/MFC (I know it's an old technology, but need to maintain it) under VS2010 and Windows 7 (x86). Running the application under Windows 2008 R2 (x64) is fine, the application start with success. But when I am trying to run the application under Windows 2008 (x86) or Windows Server 2003 it fails, I'm getting the same error on both systems : "The application failed to initialize properly (0xc0000005). Click Ok to close the Application".
It looks very stange to me since the app is built under a x86 system but runs only on built system (win7 x86) and on x64 system !
And secondly what does mean the exception code 0xc0000005? Any tips find what is missing in the x86 systems that make the application unstartable?
here is the log from WinDbg:
Microsoft (R) Windows Debugger Version 6.11.0001.404 X86
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: "C:\Documents and Settings\Administrator\Desktop\BINTest\C****.exe"
Symbol search path is: *** Invalid ***
****************************************************************************
* Symbol loading may be unreliable without a symbol search path. *
* Use .symfix to have the debugger choose a symbol path. *
* After setting your symbol path, use .reload to refresh symbol locations. *
****************************************************************************
Executable search path is:
ModLoad: 00400000 00581000 C*******.exe
ModLoad: 7c800000 7c8c2000 ntdll.dll
ModLoad: 77e40000 77f43000 C:\WINDOWS\system32\kernel32.dll
ModLoad: 77b90000 77b98000 C:\WINDOWS\system32\VERSION.dll
ModLoad: 77ba0000 77bfa000 C:\WINDOWS\system32\msvcrt.dll
ModLoad: 10000000 1001a000 C:\Documents and Settings\Administrator\Desktop\BINTest\S*****************.dll
ModLoad: 79000000 79046000 C:\WINDOWS\system32\mscoree.dll
ModLoad: 78aa0000 78b5d000 C:\Documents and Settings\Administrator\Desktop\BINTest\MSVCR100.dll
ModLoad: 78050000 780b9000 C:\Documents and Settings\Administrator\Desktop\BINTest\MSVCP100.dll
ModLoad: 003a0000 003c0000 C:\Documents and Settings\Administrator\Desktop\BINTest\R*********.dll
ModLoad: 003d0000 003d8000 C:\Documents and Settings\Administrator\Desktop\BINTest\Ch*****.dll
ModLoad: 78520000 785c3000 C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_D08D0375\MSVCR90.dll
ModLoad: 78b60000 78f8c000 C:\Documents and Settings\Administrator\Desktop\BINTest\mfc100.dll
ModLoad: 77380000 77412000 C:\WINDOWS\system32\USER32.dll
ModLoad: 77c00000 77c49000 C:\WINDOWS\system32\GDI32.dll
ModLoad: 77f50000 77fec000 C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77c50000 77cef000 C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77da0000 77df2000 C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 77530000 775c7000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.2778_x-ww_497C098C\COMCTL32.dll
ModLoad: 76280000 76285000 C:\WINDOWS\system32\MSIMG32.dll
ModLoad: 7c8d0000 7d0d4000 C:\WINDOWS\system32\SHELL32.dll
ModLoad: 77670000 777a4000 C:\WINDOWS\system32\ole32.dll
ModLoad: 77d00000 77d8c000 C:\WINDOWS\system32\OLEAUT32.dll
ModLoad: 71bb0000 71bb9000 C:\WINDOWS\system32\WSOCK32.dll
ModLoad: 71c00000 71c17000 C:\WINDOWS\system32\WS2_32.dll
ModLoad: 71bf0000 71bf8000 C:\WINDOWS\system32\WS2HELP.dll
ModLoad: 6d580000 6d628000 C:\WINDOWS\system32\dbghelp.dll
ModLoad: 76cf0000 76d0a000 C:\WINDOWS\system32\IPHLPAPI.DLL
ModLoad: 76b70000 76b7b000 C:\WINDOWS\system32\PSAPI.DLL
(87c.135c): Break instruction exception - code 80000003 (first chance)
eax=76c00000 ebx=7ffda000 ecx=00000003 edx=00000008 esi=7c88be14 edi=00151f38
eip=7c822577 esp=0012fb70 ebp=0012fcb4 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
*** WARNING: symbols timestamp is wrong 0x49901641 0x45d70ad8 for ntdll.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll -
ntdll!RtlMultiByteToUnicodeN+0x6002:
7c822577 cc int 3
0:000> g
(87c.135c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=77fc2324 ecx=fffffffc edx=00000000 esi=77fc2320 edi=00000004
eip=7c8396f0 esp=0012f030 ebp=0012f058 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010246
ntdll!strnicmp+0x22b:
7c8396f0 8b5014 mov edx,dword ptr [eax+14h] ds:0023:00000014=????????
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\ADVAPI32.dll -
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\mscoree.dll -
*Next step: Removing dependencies in my project.
My project has dependency on another c++ project (R**.dll) which is a wrapper to a C# library. When a remove this dependency my program suddenly works (at least it starts normally). How can I link with this DLL's (wrapper and c#)?
Is it releated to manifest?
any idea?
here is the manifest of the app
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Windows.C****"
type="win32"
/>
<description></description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
It seems that the root cause of your problem is a conflict between two versions of the C++ runtime libraries.
Your application is compiled with Visual Studio 2010, so it requires version 10 of the C++ runtime, but it depends on another C++ project that loads version 2 of the .NET CLR. That version of the CLR, in turn, requires version 9 of the C++ runtime. Since only one version of the runtime can be loaded by a given process, chaos ensues.
The easy way out is to either build your application with Visual Studio 2008, or modify the dependent project so it targets version 4 of the .NET CLR. That way, both modules will agree on the version of the C++ runtime to load.
The hard way is to split your application into two processes: one that loads the dependent project and one that contains the application proper, and use some form of IPC to communicate between them. That way, each process will be able to load its own version of the C++ runtime.

Why isn't !locks working for me?

I'm using windbg (the latest available from the MSDN download page).
I'm trying to debug a deadlock in my app, and !locks would be very useful. However, it's not working:
0:023> !locks NTSDEXTS: Unable to resolve ntdll!RTL_CRITICAL_SECTION_DEBUG type
NTSDEXTS: Please check your symbols
I don't know why it's upset. I've got symbols properly loaded:
0:023> .sympath
Symbol search path is: srv*
Expanded Symbol search path is: cache*c:\debuggers\sym;SRV*http://msdl.microsoft.com/download/symbols
And NTSD agrees:
0:023> lmv m ntdll
start end module name
777b0000 77930000 ntdll (pdb symbols) c:\debuggers\sym\wntdll.pdb\E9D10FA3EB884A23A5854E04FB7E2F0C2\wntdll.pdb
Loaded symbol image file: C:\Windows\SysWOW64\ntdll.dll
Image path: ntdll.dll
Image name: ntdll.dll
Timestamp: Mon Jul 13 18:11:23 2009 (4A5BDB3B)
CheckSum: 00148A78
ImageSize: 00180000
File version: 6.1.7600.16385
Product version: 6.1.7600.16385
File flags: 0 (Mask 3F)
File OS: 40004 NT Win32
File type: 2.0 Dll
File date: 00000000.00000000
Translations: 0409.04b0
CompanyName: Microsoft Corporation
ProductName: Microsoft® Windows® Operating System
InternalName: ntdll.dll
OriginalFilename: ntdll.dll
ProductVersion: 6.1.7600.16385
FileVersion: 6.1.7600.16385 (win7_rtm.090713-1255)
FileDescription: NT Layer DLL
LegalCopyright: © Microsoft Corporation. All rights reserved.
And the stack looks good:
0:036> k
ChildEBP RetAddr
1506fdd8 7784f546 ntdll!DbgBreakPoint
1506fe08 75bf3677 ntdll!DbgUiRemoteBreakin+0x3c
1506fe14 777e9d72 kernel32!BaseThreadInitThunk+0xe
1506fe54 777e9d45 ntdll!__RtlUserThreadStart+0x70
1506fe6c 00000000 ntdll!_RtlUserThreadStart+0x1b
Any help is appreciated.
Useful link.
The correct version that fixes this is 6.12.2.633. It's part of WDK 7.1 in the "debuggers" folder in the root of the DVD (.iso).
Alternatively, grab the WDK 7.1 web installer and install "just" Debugging Tools for Windows (though that seems to involve a hundred odd megabytes of extraneous material that does not correspond with any of the checkboxes in the installer).
dlanod comments:
I also found msdn-archives
which lets you download standalone versions of the new release.
And this link does in fact work. (Much better than the WDK installer)

WinDbg, with minidump from native 32-bit app crashing on 64-bit Windows, won't load symbols for system DLLs

I've got a minidump file from a crash in one of our apps. It's a 32-bit native app, and it was running on 64-bit Windows.
If I load the minidump file into WinDbg, WinDbg won't load the symbols for the system DLLs. I've got my symbol paths configured correctly:
_NT_SYMBOL_PATH=SRV*C:\WebSymbols*http://msdl.microsoft.com/download/symbols
...because WinDbg correctly loads symbols for minidumps created on 32-bit Windows. It just won't load symbols for DLLs in the SysWOW64 directory.
I've tried 32-bit WinDbg (from Debugging Tools 6.9) on 32-bit Windows 2003, and 64-bit WinDbg (also from Debugging Tools 6.9) on 64-bit Windows 2008. Both fail to load the symbols. This is from the 32-bit WinDbg:
0:014> !sym noisy
noisy mode - symbol prompts on
0:014> .reload
....................................................................................
Loading unloaded module list
..
SYMSRV: C:\WebSymbols\ntdll.dll\48E714D0170000\ntdll.dll not found
SYMSRV: http://msdl.microsoft.com/download/symbols/ntdll.dll/48E714D0170000/ntdll.dll not found
DBGENG: C:\Windows\SysWOW64\ntdll.dll - Couldn't map image from disk.
Unable to load image C:\Windows\SysWOW64\ntdll.dll, Win32 error 0n2
DBGENG: ntdll.dll - Partial symbol image load missing image info
DBGHELP: Module is not fully loaded into memory.
DBGHELP: Searching for symbols using debugger-provided data.
SYMSRV: C:\WebSymbols\wntdll.pdb\6686D0C5D0554E14953396093DA218A92\wntdll.pdb not found
SYMSRV: http://msdl.microsoft.com/download/symbols/wntdll.pdb/6686D0C5D0554E14953396093DA218A92/wntdll.pdb not found
DBGHELP: wntdll.pdb - file not found
*** WARNING: Unable to verify timestamp for ntdll.dll
*** ERROR: Module load completed but symbols could not be loaded for ntdll.dll
DBGHELP: ntdll - no symbols loaded
SYMSRV: C:\WebSymbols\kernel32.dll\48E7156Cf0000\kernel32.dll not found
SYMSRV: http://msdl.microsoft.com/download/symbols/kernel32.dll/48E7156Cf0000/kernel32.dll not found
DBGENG: C:\Windows\SysWOW64\kernel32.dll - Couldn't map image from disk.
Unable to load image C:\Windows\SysWOW64\kernel32.dll, Win32 error 0n2
DBGENG: kernel32.dll - Partial symbol image load missing image info
DBGHELP: Module is not fully loaded into memory.
DBGHELP: Searching for symbols using debugger-provided data.
SYMSRV: C:\WebSymbols\wkernel32.pdb\B0C3B36CC7EF4F3E9C168E186A5A6FEB2\wkernel32.pdb not found
SYMSRV: http://msdl.microsoft.com/download/symbols/wkernel32.pdb/B0C3B36CC7EF4F3E9C168E186A5A6FEB2/wkernel32.pdb not found
DBGHELP: wkernel32.pdb - file not found
*** WARNING: Unable to verify timestamp for kernel32.dll
*** ERROR: Module load completed but symbols could not be loaded for kernel32.dll
DBGHELP: kernel32 - no symbols loaded
SYMSRV: C:\WebSymbols\KERNELBASE.dll\48E7156D5a000\KERNELBASE.dll not found
SYMSRV: http://msdl.microsoft.com/download/symbols/KERNELBASE.dll/48E7156D5a000/KERNELBASE.dll not found
DBGENG: C:\Windows\SysWOW64\KERNELBASE.dll - Couldn't map image from disk.
DBGENG: KERNELBASE.dll - Partial symbol image load missing image info
DBGHELP: Module is not fully loaded into memory.
DBGHELP: Searching for symbols using debugger-provided data.
SYMSRV: C:\WebSymbols\wkernelbase.pdb\A8683F0C515F469B833E3FA562E0DB251\wkernelbase.pdb not found
SYMSRV: http://msdl.microsoft.com/download/symbols/wkernelbase.pdb/A8683F0C515F469B833E3FA562E0DB251/wkernelbase.pdb not found
DBGHELP: wkernelbase.pdb - file not found
*** WARNING: Unable to verify timestamp for KERNELBASE.dll
*** ERROR: Module load completed but symbols could not be loaded for KERNELBASE.dll
DBGHELP: KERNELBASE - no symbols loaded
Any ideas? Are the symbols just not available on Microsoft's symbol server?
Are you debugging on a 32-bit or 64-bit system, and with the 32 or 64-bit version of WinDBG? You typically have to debug on the same architecture package you took the dump from:
http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx
"The 32-bit version of Debugging Tools for Windows is the best choice, unless you are debugging an application on a 64-bit processor. In that case, you should use a 64-bit package."
Also, take a look at this article where he is debugging a 32-bit app running on a 64-bit platform:
http://blogs.msdn.com/alejacma/archive/2008/07/18/How-to-use-Windbg-to-debug-a-dump-of-a-32bit-.NET-app-running-on-a-x64-machine.aspx
Consider the workaround mentionned here where syswo64\ntdll.dll is copied to Syswow64\ntdll32.dll
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98781&wa=wsignin1.0
Works for me.

Resources