OSRLogoOSRLogoOSRLogo x OSR Custom Development Services

Everything Windows Driver Development

GoToHomePage xLoginx

    Thu, 14 Mar 2019     118020 members


  Online Dump Analyzer
OSR Dev Blog
The NT Insider
The Basics
File Systems
ListServer / Forum
  Express Links
  · The NT Insider Digital Edition - May-June 2016 Now Available!
  · Windows 8.1 Update: VS Express Now Supported
  · HCK Client install on Windows N versions
  · There's a WDFSTRING?
  · When CAN You Call WdfIoQueueP...ously

Inlining into SEH Filters Can Result in Invalid Code on AMD64

It started out as a typical day for me at the office.  I came in, I got my double dose of French Roast coffee and settled down for a long day of, well...doing whatever is I get paid to do here.   Along the way I came across some documentation on Structured Exception Handling and found this interesting tidbit of information: Under the title "AMD64 Compiler Limitations" in the Windows Server 2003 DDK states the following:

"Inlining into SEH filters can result in invalid code if you use the GetExceptionCode or GetExceptionInfo fuctions."

The accompanying example illustrates the code that can cause problems: 

//Avoid using GetExceptionInfo() for this structure
__inline void funca(DWORD); 
__try { 
} except(funca(GetExceptionCode())) 
//Instead use the compiler switch /Ob0 to disable inlining or use: 
// On a class member function if there is a problem 

I doubt many people would ever do this, but it is an interesting tidbit to keep in mind. 

Oh well, time for another French Roast double!

Related Articles
Analyze This - Analyzing a Crash Dump
More on Kernel Debugging - KMODE_EXCEPTION_NOT_HANDLED
Life After Death? - Understanding Blue Screens
Wild Speculation -- Debugging Another Crash Dump
Finding File Contents in Memory
ExAllocatePoolWithQuota Raises Exceptions
Exceptional Behavior - x64 Structured Exception Handling
Getting Crash Dumps to Appear in Win7
Investigating a NULL Pointer Dereference

User Comments
Rate this article and give us feedback. Do you find anything missing? Share your opinion with the community!
Post Your Comment

"Compiler Bug"
Why didn't they just admit it is/was a bug in the compiler, rather than passing it off as a "limitation"? Oh well, I just hope they've managed to fix it sometime in the last 6 years ;-).

17-Jul-10, Samuel Bronson

Post Your Comments.
Print this article.
Email this article.
bottom nav links