O'Reilly logo

Windows® via C/C++, Fifth Edition by Christophe Nasarre, Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required