Microsoft-specific exception handling mechanisms: Difference between revisions

Content deleted Content added
URLs cleaned up
Citation bot (talk | contribs)
Added date. | Use this bot. Report bugs. | Suggested by Whoop whoop pull up | Category:Microsoft application programming interfaces | #UCB_Category 120/133
 
(2 intermediate revisions by 2 users not shown)
Line 18:
 
==== x86-64 ====
SEH on 64-bit Windows does not involve a runtime exception handler list; instead, it uses a [[Call stack#Unwinding|stack unwinding]] table (<code>UNWIND_INFO</code>) interpreted by the system when an exception occurs.<ref>{{cite web |title=Exceptional Behavior - x64 Structured Exception Handling |url=https://www.osronline.com/article.cfm%5earticle=469.htm |publisher=The NT Insider}}</ref><ref>{{cite web |title=x64 exception handling |url=https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64?view=vs-2019 |website=VC++ 2019 documentation | date=8 February 2022 |language=en-us}}</ref>
This means that the compiler does not have to generate extra code to manually perform stack unwinding and to call exception handlers appropriately. It merely has to emit information in the form of unwinding tables about the stack frame layout and specified exception handlers.
 
Line 36:
==External links==
* {{cite web |url=https://msdn.microsoft.com/en-us/library/ms680657.aspx |title=Structured Exception Handling |date=2009-11-12 |work=MSDN Library |author=Microsoft Corp. |access-date=2022-07-23 }}
* {{cite journal |author=Matt Pietrek |author-link=Matt Pietrek |date=Jan 1997 |title=A Crash Course on the Depths of Win32 Structured Exception Handling |journal=MSJ |volume=12 |issue=1 |url=https://www.microsoft.com/msj/0197/Exception/Exception.aspx|url-status=dead|archive-url=https://web.archive.org/web/20030810214010/https://www.microsoft.com/msj/0197/Exception/Exception.aspx|archive-date=2003-0708-10 }} Note that the examples given there do not work as-is on modern Windows systems (post XP SP2) due to the changes Microsoft made to address the security issues present in the early SEH design. The examples still work on later versions of Windows if compiled with <code>/link /safeseh:no</code>.
* {{cite web|url=https://www.tortall.net/projects/yasm/manual/html/objfmt-win32-safeseh.html|title=win32: Safe Structured Exception Handling|publisher=[[Yasm]] manual}}
* {{US patent|7,480,919|US patent 7,480,919 - Safe exceptions}}
Line 43:
* {{cite web|url=https://blogs.technet.com/b/srd/archive/2009/02/02/preventing-the-exploitation-of-seh-overwrites-with-sehop.aspx|title=Preventing the Exploitation of Structured Exception Handler (SEH) Overwrites with SEHOP|author=Matt Miller|publisher=Technet|date=2 Feb 2009}}
* {{cite web|title=Bypassing SEHOP|url=http://www.sysdream.com/sites/default/files/sehop_en.pdf|author=Stéfan Le Berre, Damien Cauquil|publisher=Sysdream|date=22 Dec 2009|url-status=dead|archive-url=https://web.archive.org/web/20120907022250/http://www.sysdream.com/sites/default/files/sehop_en.pdf|archive-date=2012-09-07}}
* {{cite web|url=https://www.optiv.com/blog/old-meets-new-microsoft-windows-safeseh-incompatibility/|title=Old Meets New: Microsoft Windows SafeSEH Incompatibility|author=Joshua J. Drake|date=10 Jan 2012|access-date=9 January 2017|archive-date=9 January 2017|archive-url=https://web.archive.org/web/20170109184752/https://www.optiv.com/blog/old-meets-new-microsoft-windows-safeseh-incompatibility|url-status=dead}} An article explaining why Windows 7 SP1 ignores SafeSEH for some older binaries, while Windows XP SP3 honors it.
 
[[Category:Control flow]]