Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 176321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:51:20+00:00 2026-05-11T13:51:20+00:00

There is a post by Raymond Chen, where he tells how bad IsBadXxxPtr function

  • 0

There is a post by Raymond Chen, where he tells how bad IsBadXxxPtr function is by eating guard page exception.

I don’t quite understand how it is applied to Delphi. Who and how should normally (i.e. without call to IsBadXxxPtr) process this exception? I do know that Delphi inserts a code, which (for example) access a memory for large static arrays – exactly for this reason: to expand stack.

But if guard page exception is raised: who will handle it in a Delphi application? Can’t I accidentally mess with it by using try/except in inappropriate way? Will Delphi’s debugger notify me about these exceptions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:51:21+00:00Added an answer on May 11, 2026 at 1:51 pm

    Windows structured exception handling (SEH) is has a two-phase structure. When an exception occurs, Windows first looks for a handler for the exception by following the registered exception handler chain (the head of which is stored in fs:[0] on x86, i.e. the first dword in the segment pointed to by the FS segment register – all that ugly 16-bit segment-offset logic didn’t go away in 32-bit, it just became less relevant).

    The search is done by calling a function with a particular flag, a pointer to which is stored in each exception frame on the stack. fs:[0] points to the topmost frame. Each frame points to the previous frame. Ultimately, the last frame on the list is one that has been provided by the OS (this handler will pop up a app-crash dialog if an unhandled exception reaches it).

    These functions normally check the type of the exception, and return a code to indicate what to do. One of the codes that can be returned is basically, ‘ignore this exception and continue’. If Windows sees this, it will reset the instruction pointer to the point of the exception and resume execution. Another code indicates that this exception frame should handle the given exception. A third code is ‘I’m not going to catch this exception, keep searching’. Windows keeps on calling these exception filter functions until it finds one that handles the exception one way or the other.

    If Windows finds one that handles the exception by catching it, then it will proceed to unwind the stack back to that handler, which consists of calling all the functions again, only passing in a different flag. It’s at this point that the functions execute the finally logic, up until the handler which executes the except logic.

    However, with the stack page guard exception, the process is different. None of the language’s exception handlers will elect to handle this exception, because otherwise the stack growth mechanism would break. Instead, the filter search filters all the way through to the base exception handler provided by the OS, which grows the stack allocation by committing the appropriate memory, and then returns the appropriate return code to indicate that the OS should continue where it left off, rather than unwind the stack.

    The tool and debugging infrastructure are designed to let these particular exceptions play out correctly, so you don’t need to worry about handling them.

    You can read more about SEH in Matt Pietrek’s excellent article in MSJ from over a decade ago.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to learn how to use the StrCmpLogicalW function. There is a post
Inspired by Raymond Chen's post , say you have a 4x4 two dimensional array,
At a reply of a blog post of Raymond Chen , A questioner pointed
I have a PHP function that allows users to pick which categories there post
There was a post this morning asking about how many people disable JavaScript. Then
There's another post on SO relating to .NET -- not us. Pure PHP. Trying
There's a post-.NET 3.5 SP1 update which comes in x86 and x64 flavours: The
I know there is this post , but I still want to know more
I'm trying to measure the popularity of a post but there's no current system
Before I start, I know there is this post and it doesn't answer my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.