EXCEPTION_CONTINUE_SEARCH

The examples have been pretty tame so far. Let’s shake things up a bit by adding a function call:

TCHAR g_szBuffer[100];

void FunclinRoosevelt2() {
   TCHAR *pchBuffer = NULL;

   __try {
      FuncAtude2(pchBuffer);
   }
   __except (OilFilter2(&pchBuffer)) {
      MessageBox(...);
   }
}

void FuncAtude2(TCHAR *sz) {
   *sz = TEXT('\0');
}

LONG OilFilter2 (TCHAR **ppchBuffer) {
   if (*ppchBuffer == NULL) {
      *ppchBuffer = g_szBuffer;
      return(EXCEPTION_CONTINUE_EXECUTION);
   }
   return(EXCEPTION_EXECUTE_HANDLER);
}

When FunclinRoosevelt2 executes, it calls FuncAtude2, passing it NULL. When FuncAtude2 executes, an exception is raised. Just as before, the system evaluates the exception filter associated with the most recently executing try block. In this example, ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.