OSRLogoOSRLogoOSRLogo x Seminar Ad

Everything Windows Driver Development

GoToHomePage xLoginx

    Tue, 14 Aug 2018     117707 members


  Online Dump Analyzer
OSR Dev Blog
The NT Insider
ListServer / Forum
Driver Jobs
  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.

Kernel Debugging & Crash Analysis

Manchester, NH
30 July - 3 Aug 2018

Developing Filter Manager Minifilters

Manchester, NH
20-24 August 2018

Writing WDF Drivers I: Core Concepts

Santa Clara/San Jose, CA
10-14 Sept 2018

Writing WDF Drivers II: Advanced Implementation Techniques

Manchester, NH
16-19 October 2018


Need to develop a Windows file system solution?

We've got a kit for that.

Need Windows internals or kernel driver expertise?

Bring us your most challenging project - we can help!

System hangs/crashes?

We've got a special diagnostic team that's standing by.

Visit the OSR Corporate Web site for more information about how OSR can help!

bottom nav links