The MASM Forum

General => The Workshop => Topic started by: jj2007 on February 25, 2015, 03:39:25 AM

Title: Windows solves our bugs automatically
Post by: jj2007 on February 25, 2015, 03:39:25 AM
It has happened to me several times, and I still have got used to it: Windows miraculously solves bugs in my proggies. You don't believe me? Make the test:

- open \Masm32\examples\exampl01\comctls\comctls.asm
- go to line 300
- insert
        xor ecx, ecx
        div ecx
- build and run.

And voilĂ , it builds and runs without any problems, isn't that cute? Note this is Win7-64 - on unsafe previous versions such as Win XP, the div ecx used to throw really, really bad exceptions. Kudos to Richmond, you are really making progress :t

Title: Re: Windows solves our bugs automatically
Post by: ragdog on February 25, 2015, 04:55:06 AM
Hi

Yes div by zero a bug and in your debugger have you a Exception "division by zero"
But why should Ml not build ?

Greets,
Title: Re: Windows solves our bugs automatically
Post by: jj2007 on February 25, 2015, 05:34:41 AM
Quote from: jj2007 on February 25, 2015, 03:39:25 AM- build and run.
Title: Re: Windows solves our bugs automatically
Post by: ragdog on February 25, 2015, 06:01:34 AM
Yes but i have add it under WM_Init on a Dialog app and this programm crash if this code div by zero reached
Title: Re: Windows solves our bugs automatically
Post by: sinsi on February 25, 2015, 06:23:35 AM
Fails silently on Win8Pro x64

Faulting application name: comctls.exe, version: 0.0.0.0, time stamp: 0x54ecced5
Faulting module name: comctls.exe, version: 0.0.0.0, time stamp: 0x54ecced5
Exception code: 0xc0000094
Fault offset: 0x000015dd
Faulting process ID: 0xa10
Faulting application start time: 0x01d05066e14ca7d9
Faulting application path: C:\masm32\examples\exampl01\comctls\comctls.exe
Faulting module path: C:\masm32\examples\exampl01\comctls\comctls.exe

Title: Re: Windows solves our bugs automatically
Post by: adeyblue on February 25, 2015, 06:28:57 AM
Exceptions that are thrown from an application that runs in a 64-bit version of Windows are ignored (http://support.microsoft.com/kb/976038)

The stuff the hotfix from that article enables is included in 7 SP1 by default, and given what Sinsi says, probably above too.
Title: Re: Windows solves our bugs automatically
Post by: dedndave on February 25, 2015, 06:34:09 AM
that exception is a good thing
i want to know if my code attempts divide by 0 so i can fix it
Title: Re: Windows solves our bugs automatically
Post by: jj2007 on February 25, 2015, 06:45:17 AM
Quote from: dedndave on February 25, 2015, 06:34:09 AM
that exception is a good thing
i want to know if my code attempts divide by 0 so i can fix it

Exactly. On my system, updated a hundred times since the KB linked by adeyblue was published in 2009, it "succeeds", only that I see 5 five toolbar icons instead of the 8 that should be there. This is a FAT WINDOWS BUG, and I am surprised it has not been solved automatically a long time ago.

@sinsi: What do you mean with "fails silently"? No window, or a window with 5 toolbar icons, like on my system?
Title: Re: Windows solves our bugs automatically
Post by: sinsi on February 25, 2015, 08:26:15 AM
No window, shows in task manager for a few seconds then disappears. No indication of an error either, I looked in event viewer to check, that was the only sign of a problem.

I imagine a lot of programmers would be tearing their hair out trying to follow this 'bug'.
Title: Re: Windows solves our bugs automatically
Post by: rrr314159 on February 25, 2015, 10:29:09 AM
FWIW

On my Win8 system, also on my Win 8.1 system, integer div-by-zero crashes. Apparently I don't have that hotfix (or, hot-break).