Program doesn't enter __except block
<p>I'm trying to realize handling Windows exceptions with the help
of <code>__try/__except</code> block.</p>

<p>Problem is that the program never enters <code>__except</code> block - only exits incorrectly.</p>

<p>Workspace:
OS: Windows 7 x64; Framework: Embarcadero XE5 C++ Builder;
Application template type: console 64-bit application (for 32-bit works normally!)</p>

<p>Code:</p>

<pre><code>void foo()
{
   __try
   {
     int *p = 0;
     fprintf(stderr, "before action");
     *p = 1;
   }
   __except(EXCEPTION_EXECUTE_HANDLER)
   {
    printf("in __except block\n");
    throw("");
   }
}

int _tmain(int argc, _TCHAR* argv[])
{
 try
 {
   foo();
 }
 catch(...)
 {
   printf("in catch block\n");
 }

 printf("end of main\n");
 return 0;
}
</code></pre>

<p>Output:</p>

<pre><code>before action
</code></pre>

<p>then incorrect exit</p>

<p>In the second variant I added exception handler this way:</p>

<pre><code>LONG WINAPI MyUnhandledExceptionFilter(PEXCEPTION_POINTERS p)
{
  printf("in excepiton filter\n");
  return EXCEPTION_EXECUTE_HANDLER;
}

int _tmain(int argc, _TCHAR* argv[])
{
  AddVectoredExceptionHandler(1, MyVectorExceptionFilter);
  // the same text
  // ...
}
</code></pre>

<p>After this I got this output:</p>

<p>Output:</p>

<pre><code>before action
in excepiton filter
</code></pre>

<p>then incorrect exit</p>

<p>Why does not the program enters __<code>except</code> block?
Is there a way to continue working correctly after entering exception handler?</p>