Hi all,

While running my application I sporadically get this exception:

First-chance exception at 0x7c81eb33 in UT2004.exe: Microsoft C++ exception: unsigned short @ 0x0012b27c.

This is a very curious description of an exception, and the disassembly doesn't give me any clues either:


7C81EB2D call dword ptr ds:[7C801504h]
7C81EB33 pop esi
7C81EB34 leave

esi = 0x00128C28 and esp = 0x00128B94. The call stack only shows me that it happens in kernel32.dll. But when I trace into that call, there's a sysenter instruction that fails somehow. When the error doesn't occur, the application runs just as expected so I don't have any other indications of anything going wrong.

So, I'm clueless where to start looking or how to analyze this better. Normally I at least know why the assembly instruction throws an exception.

Thanks for any ideas...
Posted on 2004-12-27 17:30:31 by C0D1F1ED
Try scrolling down from the current ESP until you find the address of an instruction in your program. That should help you pinpoint the problem.
Posted on 2004-12-27 19:13:52 by Sephiroth3
Sysenter "calls the kernel", and can't be traced with a ring3 debugger. I think even softice has trouble tracing this transition.

You might want to disassemble your kernel32.dll and see where this address is - and perhaps with the additional assistance of debug symbols from microsoft.

You're probably passing some invalid arguments somewhere, or forgetting some register preservation, or have corrupted or misaligned stack?
Posted on 2004-12-27 19:16:34 by f0dder
You're probably passing some invalid arguments somewhere, or forgetting some register preservation, or have corrupted or misaligned stack?

I wish it were that easy. :cry: The situation is quite complicated. I have a graphics library, which is used by a closed-source application. The error occurs without any of my functions on the stack. So whatever it is that causes the problem, it's very subtle.

Anyway, thanks for the ideas!
Posted on 2004-12-28 02:38:40 by C0D1F1ED
Are you saying the error is intermittent - occuring under exact/similar conditions where the error does not occur? If this is so, then I would suspect hardware and refine the debugging process to ensure consistency in the environment of the error. Some bad RAM gave me a similar problem, but this error should be accompanied by others.

Can you provide any greater details?
Posted on 2004-12-28 15:28:04 by bitRAKE
Hi bitRAKE,

The application is Unreal Tournament 2004, which I render with my own software Direct3D implementation swShader, as a d3d9.dll file.

I've been able to reporduce the error consistently by loading a certain map. I don't fully support the Direct3D interface yet, but I'd like to figure out why this error happens. Mostly I get a clear exception in these situations but now I don't have a clue at all since the call stack contains none of my functions.

SoftICE might provide some answers but I can't seem to configure it correctly to catch excpetions...

Thanks for any help!
Posted on 2004-12-29 02:58:02 by C0D1F1ED
"faults on" in softice - dunno if that works if UT catches exceptions itself (which I believe it does). Isn't there a way to get UT to bring up it's regular ugly exception-with-load-of-stack-trace errorbox?
Posted on 2004-12-29 06:40:03 by f0dder
"faults on" in softice - dunno if that works if UT catches exceptions itself (which I believe it does). Isn't there a way to get UT to bring up it's regular ugly exception-with-load-of-stack-trace errorbox?

I tried that, but it seems like my SoftICE installation is broken. It doesn't even catch the breakpoints in my own code. Maybe some other debugger is messing things up, I already uninstalled WinDBG though...
Posted on 2004-12-29 07:08:01 by C0D1F1ED
Sounds pretty funky - and you *can* call up the softice window? If you have a recent version, you might need... what was it again... "breakinsharedmodules on" or something similar. Also, older versions of softice don't play very well with XP...
Posted on 2004-12-29 07:12:21 by f0dder
Yes, I can access the SoftICE window with Crtl-D. I have version 4.2.7, it's a fresh install and I tried the SP2 patch but it still doesn't catch any exception or breakpoint. Very weird...
Posted on 2004-12-29 09:15:38 by C0D1F1ED
Hm, is that a DriverStudio release? That's the only softice versions that really work with XP, and I think you need 3.x before it works really well.
Posted on 2004-12-29 09:19:21 by f0dder
Hm, is that a DriverStudio release? That's the only softice versions that really work with XP, and I think you need 3.x before it works really well.

Indeed, it's DriverStudio 2.7, but it doesn't seem to work all that great with Windows XP SP2. :evil:
Posted on 2004-12-29 10:04:41 by C0D1F1ED
I think I solved the SoftICE problem. Now I can have a deeper look at the bug I hope...
Posted on 2004-12-29 10:32:45 by C0D1F1ED