Re: Try Finally...

From: L D Blake (not_at_any.adr)
Date: 10/29/04


Date: Fri, 29 Oct 2004 00:39:57 -0400

On 29 Oct 2004 03:12:32 GMT, vbdis@aol.com (VBDis) wrote:

>Im Artikel <4180d6d8$0$14941$e4fe514c@news.xs4all.nl>, "Maarten Wiltink"
><maarten@kittensandcats.net> schreibt:
>
>>To prevent this misunderstanding, I have been careful to never say
>>"Delphi SEH". But DoDi does, and by it he means _Delphi_ OO exception
>>handling. And he is allowed to; Microsoft do not have a copyright on
>>calling exception handling "structured". To the best of my knowledge,
>>the term is a strictly defined adjective in relation to exception
>>handling, and Delphi's exception handling fulfills that definition.
>
>I still have no formal definition for SEH - is it the Try... syntax, or is it
>more?

The "formal" definition of Structured Exception Handling lies with the
operating system. No matter how the exception comes up, be it from the os
(i/o, memory, div0...) or from an application (range, type, user...) the OS is
what administers SEH. The overall mechanism is cooperative... the language or
application level creates Guard Frames in the application stack that do
nothing until an exception comes up. When it does happen th OS (not the
language) searches the list of Guard Frames and attempts to locate the handler
for that exception... but ultimately true exceptions are handled by Windows.

So your definition is: SEH := 'A Windows resident method of dealing with
unexpected errors.'

>I prefer SEH as a handy TLA <g> instead of only EH, but often I feel a need for
>separating Windows SEH from Delphi SEH.

There actually is no "Delphi SEH", there is a Delphi error handling mechanism
that uses SEH... but it is not, in and of itself, Structured Exception
Handling. That is Windows.

>Some requirements for SEH in Windows applications are dicated by the Windows
>conventions (data structures and their linkage, usage of the FS register...),
>and the Windows way of reporting exceptions raised e.g. in a DLL to the
>application, as well as how exceptions in a Delphi DLL affect an application
>written in another language. Even if Delphi is free to implement it's own way
>of /handling/ exceptions, as long as these are caught inside Delphi code, the
>implementation must be Windows conforming when modules of other languages are
>involved. Playing in a common sandbox requires to respect some rules and, as we
>all know, Windows rulez ;-)

While it's not true in all cases... this is one case where Windows wins.
Delphi's exception objects are dead fish without the underlying Windows
implementation.

Perhaps the biggest misunderstanding in all this is the tendency to conflate
what Delphi does with what Windows does. Delphi can indeed create exception
objects that do not go through windows SEH at all. However these are not true
exceptions, they're merely a means of using exception objects to advantage. A
true exception will always originate inside Windows and it will always be the
result of an operating system error.

Hence my beef with the way this is done. I have no problem with people using
whatever facility the language gives them... but I do believe it is a mistake
to view something as fundamental to the OS as SEH from a top down
perspective... one needs to see it from the OSs perspective to truly
understand it.

-----
Laura



Relevant Pages

  • Re: [announcement] SYSAPI and SYSSVC for Windows
    ... What do you need Windows NT for in this application? ... You can use SEH (Structured Exception Handling) to prevent a process from ... > Ada did solve this, ... If you implement your own message queues on Windows, use an Event object ...
    (comp.lang.ada)
  • Re: Blue screen crashes
    ... A kernel mode program generated an exception which the error handler ... What is your Windows XP CD as it is described on the face of the CD? ... What Warning and Error Reports appear in Event Viewer since it's ... If you have had a malware infestation one holds the door open to let ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Sharepoint 2007 - Installation Error - Failed to register SP s
    ... Windows 2000 Server. ... It is a bug with Beta 2 where the database server is running Windows 2000. ... Server I have the following exception: ... RunBehavior runBehavior, String resetOptionsString) ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Implementing Exception Handling in a VM
    ... Given that the implementing language has SEH, can ... I leverage this fact to add exception support in my Pascal-like ... handling system in your VM. ...
    (comp.compilers)
  • Re: windows error codes
    ... Driver Development Tools: Windows DDK ... This indicates that a kernel-mode program generated an exception which the error handler did not catch. ... For a complete list of exception codes, see the ntstatus.h file located in the inc directory of the Windows DDK. ... This article describes how to troubleshoot a "STOP 0x0000001E KMODE_EXCEPTION_NOT_HANDLED" error message. ...
    (microsoft.public.windowsxp.general)