PDA

View Full Version : Crash before application code is executed



chronozphere
07-08-2007, 10:55 PM
OS: Windows vista ultimate
IDE: Turbo Delphi explorer
API: Direct3d 9
-----------------------------------------------------

Hi guys

I'm having trouble with this terrible bug. When i start running my program i get:

Runtime Error 216 at *blablabla*

and then:

The application failed to initialize properly (*adress*). Click OK to terminate the application.

and then:

---------------------------
Debugger Fault Notification
---------------------------
Project *project EXE path* faulted with message: 'system exception (code 0xc0000142) at 0x77918fc7'. Process Stopped. Use Step or Run to continue.
---------------------------
OK
---------------------------

This error occures before any code is executed. Even when i set a breakpoint at the very beginning of my DPR, the error will still occur, and the app will be terminated.

This is my log:


Thread Start: Thread ID: 2104. Process Project1.exe (3780)
Process Start: E:\Delphi\Nasha DX9\v0.12.2 (shader driven engine)\Project1.exe. Base Address: $00400000. Process Project1.exe (3780)
Module Load: Project1.exe. Has Debug Info. Base Address: $00400000. Process Project1.exe (3780)
Module Load: ntdll.dll. No Debug Info. Base Address: $77910000. Process Project1.exe (3780)
Module Load: KERNEL32.dll. No Debug Info. Base Address: $77480000. Process Project1.exe (3780)
Module Load: OLEAUT32.dll. No Debug Info. Base Address: $77240000. Process Project1.exe (3780)
Module Load: ole32.dll. No Debug Info. Base Address: $772D0000. Process Project1.exe (3780)
Module Load: msvcrt.dll. No Debug Info. Base Address: $77630000. Process Project1.exe (3780)
Module Load: GDI32.dll. No Debug Info. Base Address: $76410000. Process Project1.exe (3780)
Module Load: USER32.dll. No Debug Info. Base Address: $77870000. Process Project1.exe (3780)
Module Load: ADVAPI32.dll. No Debug Info. Base Address: $776E0000. Process Project1.exe (3780)
Module Load: RPCRT4.dll. No Debug Info. Base Address: $77560000. Process Project1.exe (3780)
Module Load: VERSION.dll. No Debug Info. Base Address: $75960000. Process Project1.exe (3780)
Module Load: COMCTL32.dll. No Debug Info. Base Address: $73F70000. Process Project1.exe (3780)
Module Load: Nasha3D.dll. Has Debug Info. Base Address: $002B0000. Process Project1.exe (3780)
Module Load: d3d9.dll. No Debug Info. Base Address: $704C0000. Process Project1.exe (3780)
Module Load: d3d8thk.dll. No Debug Info. Base Address: $75230000. Process Project1.exe (3780)
Module Load: dwmapi.dll. No Debug Info. Base Address: $73B70000. Process Project1.exe (3780)
Module Load: d3dx9d_33.dll. No Debug Info. Base Address: $69E40000. Process Project1.exe (3780)
Module Load: IMM32.dll. No Debug Info. Base Address: $77B30000. Process Project1.exe (3780)
Module Load: MSCTF.dll. No Debug Info. Base Address: $777A0000. Process Project1.exe (3780)
Module Load: LPK.dll. No Debug Info. Base Address: $763C0000. Process Project1.exe (3780)
Module Load: USP10.dll. No Debug Info. Base Address: $77AB0000. Process Project1.exe (3780)
Module Load: UxTheme.dll. No Debug Info. Base Address: $75280000. Process Project1.exe (3780)
Module Load: DXerr9ab.DLL. No Debug Info. Base Address: $10000000. Process Project1.exe (3780)
Module Unload: DXerr9ab.DLL. Process Project1.exe (3780)


I think it has something to do with both DXErr9ab.dll and ntdll.dll. In the drop-down menu in "local variabeles" i see an adress with ntdll.dll next to it. DXErr9ab.dll is suddenly unloaded, wich could be a response to an error.
I already tried rebooting and compiling it using Delphi 7 but i still get the same results.
Could this have something to do with exported functions/parameters in a unit wich do not match with the names/declaration in their source DLL's?

Can anyone give me some tips to debug this?

masonwheeler
09-08-2007, 04:40 AM
Not completely certain, but that sounds like a DirectX problem. Vista's set up to run DirectX 10, which is incompatible with DirectX 9. There's a special mode to run DirectX 9 stuff, but we all know how "compatibility modes" are, especially in Windows. This (along with many other issues) has led to a ton of stability and backwards-compatibility problems with Windows Vista. Microsoft's produced its biggest lemon since Windows ME, and a few people looking at the market are already saying that it's going to meet the same fate: nobody will buy it unless it comes pre-bundled on a new computer, and it'll get replaced very quickly.

If it's at all feasible, my recommendation would be to abandon Vista and go back to XP, which is a stable, established platform for developers. Did you begin developing this project under XP? And if so, did you have this problem before changing to Vista? If you didn't, then there's the cause of your glitch right there.

Mason

Momor
09-08-2007, 06:52 AM
I had this kind of error at the very end of one of my applications, and it happened to be an issue in one of the finalize of the units I was using.

I think you should check the initialize section of all the units you are using, the problem must be there.

chronozphere
09-08-2007, 09:16 AM
Thanx for your replies. :)

@mason wheeler: I don't think the problem has something to do with Vista vs DX9. I compiled and ran my engine dozens of times on this machine without weird errors. I think it's related to my code and propably DLL related.

@Momor: Thanx ;) i'll check that.

I made a stupid mistake. Some days ago i started using Turbo delphi instead of D7. It works great (except for the AV's i get from time to time). So i continued my project and saved my work in different folders V0.12.1.. V0.12.2 etc.
My engine is a DLL. So i develop a testing application and a DLL at the same time. Each time i saved my project into another directory i forgot to set the DLL's host application to the EXE in the new folder.
That way, i was running an obsolete EXE with a newer version of my engine.

No i have to take a few steps back, and search for the last correct version. I'll start coding from there and hopefully i can organize my files properly so i won't make that mistake again.
Maybe i'll bump into this bug again, but when that happens, i know that the last few changes to the source are causing it. Then i can debug it properly.

Until now: I think it has something to do with DLL export functions which have incorrect names/parameters in the APP's source. (i had that problem before).