OSRLogo
OSRLogoOSRLogoOSRLogo x Seminar Ad
OSRLogo
x

Everything Windows Driver Development

x
x
x
GoToHomePage xLoginx
 
 

    Sat, 21 Oct 2017     115112 members

   Login
   Join


 
 
Contents
  Online Dump Analyzer
OSR Dev Blog
The NT Insider
Downloads
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: 
__declspec(noinline) 
// 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 ;-).

Rating:
17-Jul-10, Samuel Bronson


Post Your Comments.
Print this article.
Email this article.

Writing WDF Drivers I: Core Concepts
LAB

Nashua (Amherst), NH
15-19 May 2017

Writing WDF Drivers II: Advanced Implementation Techniques
LAB

Nashua (Amherst), NH
23-26 May 2017

Kernel Debugging and Crash Analysis
LAB

Dulles (Sterling), VA
26-30 Jun 2017

Windows Internals and Software Driver Development
LAB

Nashua (Amherst), NH
24-28 Jul 2017

 
 
 
 
x
LetUsHelp
 

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