Exception handling: Added a magic __EXCEPT_PAGE_FAULT macro to make it
[wine] / dlls / ntdll / exception.c
1 /*
2  * NT exception handling routines
3  *
4  * Copyright 1999 Turchanov Sergey
5  * Copyright 1999 Alexandre Julliard
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23 #include "wine/port.h"
24
25 #include <assert.h>
26 #include <signal.h>
27 #include <stdarg.h>
28
29 #include "ntstatus.h"
30 #define WIN32_NO_STATUS
31 #include "windef.h"
32 #include "winternl.h"
33 #include "wine/exception.h"
34 #include "wine/server.h"
35 #include "wine/list.h"
36 #include "wine/debug.h"
37 #include "excpt.h"
38 #include "ntdll_misc.h"
39
40 WINE_DEFAULT_DEBUG_CHANNEL(seh);
41
42 /* Exception record for handling exceptions happening inside exception handlers */
43 typedef struct
44 {
45     EXCEPTION_REGISTRATION_RECORD frame;
46     EXCEPTION_REGISTRATION_RECORD *prevFrame;
47 } EXC_NESTED_FRAME;
48
49 typedef struct
50 {
51     struct list                 entry;
52     PVECTORED_EXCEPTION_HANDLER func;
53 } VECTORED_HANDLER;
54
55 static struct list vectored_handlers = LIST_INIT(vectored_handlers);
56
57 static RTL_CRITICAL_SECTION vectored_handlers_section;
58 static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
59 {
60     0, 0, &vectored_handlers_section,
61     { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
62       0, 0, { (DWORD_PTR)(__FILE__ ": vectored_handlers_section") }
63 };
64 static RTL_CRITICAL_SECTION vectored_handlers_section = { &critsect_debug, -1, 0, 0, 0, 0 };
65
66 #ifdef __i386__
67 # define GET_IP(context) ((LPVOID)(context)->Eip)
68 #elif defined(__sparc__)
69 # define GET_IP(context) ((LPVOID)(context)->pc)
70 #elif defined(__powerpc__)
71 # define GET_IP(context) ((LPVOID)(context)->Iar)
72 #elif defined(__ALPHA__)
73 # define GET_IP(context) ((LPVOID)(context)->Fir)
74 #elif defined(__x86_64__)
75 # define GET_IP(context) ((LPVOID)(context)->Rip)
76 #else
77 # error You must define GET_IP for this CPU
78 #endif
79
80
81 /*******************************************************************
82  *         EXC_RaiseHandler
83  *
84  * Handler for exceptions happening inside a handler.
85  */
86 static DWORD EXC_RaiseHandler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
87                                CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
88 {
89     if (rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
90         return ExceptionContinueSearch;
91     /* We shouldn't get here so we store faulty frame in dispatcher */
92     *dispatcher = ((EXC_NESTED_FRAME*)frame)->prevFrame;
93     return ExceptionNestedException;
94 }
95
96
97 /*******************************************************************
98  *         EXC_UnwindHandler
99  *
100  * Handler for exceptions happening inside an unwind handler.
101  */
102 static DWORD EXC_UnwindHandler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
103                                 CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
104 {
105     if (!(rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)))
106         return ExceptionContinueSearch;
107     /* We shouldn't get here so we store faulty frame in dispatcher */
108     *dispatcher = ((EXC_NESTED_FRAME*)frame)->prevFrame;
109     return ExceptionCollidedUnwind;
110 }
111
112
113 /*******************************************************************
114  *         EXC_CallHandler
115  *
116  * Call an exception handler, setting up an exception frame to catch exceptions
117  * happening during the handler execution.
118  *
119  * For i386 this function is implemented in assembler in signal_i386.c.
120  */
121 #ifndef __i386__
122 static DWORD EXC_CallHandler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECORD *frame,
123                               CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher,
124                               PEXCEPTION_HANDLER handler, PEXCEPTION_HANDLER nested_handler)
125 {
126     EXC_NESTED_FRAME newframe;
127     DWORD ret;
128
129     newframe.frame.Handler = nested_handler;
130     newframe.prevFrame     = frame;
131     __wine_push_frame( &newframe.frame );
132     TRACE( "calling handler at %p code=%lx flags=%lx\n",
133            handler, record->ExceptionCode, record->ExceptionFlags );
134     ret = handler( record, frame, context, dispatcher );
135     TRACE( "handler returned %lx\n", ret );
136     __wine_pop_frame( &newframe.frame );
137     return ret;
138 }
139 #else
140 /* in signal_i386.c */
141 extern DWORD EXC_CallHandler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECORD *frame,
142                               CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher,
143                               PEXCEPTION_HANDLER handler, PEXCEPTION_HANDLER nested_handler);
144 #endif
145
146 /**********************************************************************
147  *           wait_suspend
148  *
149  * Wait until the thread is no longer suspended.
150  */
151 void wait_suspend( CONTEXT *context )
152 {
153     LARGE_INTEGER timeout;
154
155     /* store the context we got at suspend time */
156     SERVER_START_REQ( set_thread_context )
157     {
158         req->handle  = GetCurrentThread();
159         req->flags   = CONTEXT_FULL;
160         req->suspend = 1;
161         wine_server_add_data( req, context, sizeof(*context) );
162         wine_server_call( req );
163     }
164     SERVER_END_REQ;
165
166     /* wait with 0 timeout, will only return once the thread is no longer suspended */
167     timeout.QuadPart = 0;
168     NTDLL_wait_for_multiple_objects( 0, NULL, 0, &timeout, 0 );
169
170     /* retrieve the new context */
171     SERVER_START_REQ( get_thread_context )
172     {
173         req->handle  = GetCurrentThread();
174         req->flags   = CONTEXT_FULL;
175         req->suspend = 1;
176         wine_server_set_reply( req, context, sizeof(*context) );
177         wine_server_call( req );
178     }
179     SERVER_END_REQ;
180 }
181
182
183 /**********************************************************************
184  *           send_debug_event
185  *
186  * Send an EXCEPTION_DEBUG_EVENT event to the debugger.
187  */
188 static int send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *context )
189 {
190     int ret;
191     HANDLE handle = 0;
192
193     if (!NtCurrentTeb()->Peb->BeingDebugged) return 0;  /* no debugger present */
194
195     SERVER_START_REQ( queue_exception_event )
196     {
197         req->first   = first_chance;
198         wine_server_add_data( req, context, sizeof(*context) );
199         wine_server_add_data( req, rec, sizeof(*rec) );
200         if (!wine_server_call( req )) handle = reply->handle;
201     }
202     SERVER_END_REQ;
203     if (!handle) return 0;
204
205     NTDLL_wait_for_multiple_objects( 1, &handle, 0, NULL, 0 );
206
207     SERVER_START_REQ( get_exception_status )
208     {
209         req->handle = handle;
210         wine_server_set_reply( req, context, sizeof(*context) );
211         ret = wine_server_call( req );
212     }
213     SERVER_END_REQ;
214     return ret;
215 }
216
217
218 /**********************************************************************
219  *           call_vectored_handlers
220  *
221  * Call the vectored handlers chain.
222  */
223 static LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
224 {
225     struct list *ptr;
226     LONG ret = EXCEPTION_CONTINUE_SEARCH;
227     EXCEPTION_POINTERS except_ptrs;
228
229     except_ptrs.ExceptionRecord = rec;
230     except_ptrs.ContextRecord = context;
231
232     RtlEnterCriticalSection( &vectored_handlers_section );
233     LIST_FOR_EACH( ptr, &vectored_handlers )
234     {
235         VECTORED_HANDLER *handler = LIST_ENTRY( ptr, VECTORED_HANDLER, entry );
236         ret = handler->func( &except_ptrs );
237         if (ret == EXCEPTION_CONTINUE_EXECUTION) break;
238     }
239     RtlLeaveCriticalSection( &vectored_handlers_section );
240     return ret;
241 }
242
243
244 /*******************************************************************
245  *         EXC_DefaultHandling
246  *
247  * Default handling for exceptions. Called when we didn't find a suitable handler.
248  */
249 static void EXC_DefaultHandling( EXCEPTION_RECORD *rec, CONTEXT *context )
250 {
251     if (send_debug_event( rec, FALSE, context ) == DBG_CONTINUE) return;  /* continue execution */
252
253     if (rec->ExceptionFlags & EH_STACK_INVALID)
254         ERR("Exception frame is not in stack limits => unable to dispatch exception.\n");
255     else if (rec->ExceptionCode == STATUS_NONCONTINUABLE_EXCEPTION)
256         ERR("Process attempted to continue execution after noncontinuable exception.\n");
257     else
258         ERR("Unhandled exception code %lx flags %lx addr %p\n",
259             rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
260     NtTerminateProcess( NtCurrentProcess(), 1 );
261 }
262
263
264 /***********************************************************************
265  *              RtlRaiseException (NTDLL.@)
266  */
267 void WINAPI __regs_RtlRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
268 {
269     EXCEPTION_REGISTRATION_RECORD *frame, *dispatch, *nested_frame;
270     EXCEPTION_RECORD newrec;
271     DWORD res, c;
272
273     TRACE( "code=%lx flags=%lx addr=%p\n", rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
274     for (c=0; c<rec->NumberParameters; c++) TRACE(" info[%ld]=%08lx\n", c, rec->ExceptionInformation[c]);
275     if (rec->ExceptionCode == EXCEPTION_WINE_STUB)
276     {
277         if (HIWORD(rec->ExceptionInformation[1]))
278             MESSAGE( "wine: Call from %p to unimplemented function %s.%s, aborting\n",
279                    rec->ExceptionAddress,
280                    (char*)rec->ExceptionInformation[0], (char*)rec->ExceptionInformation[1] );
281         else
282             MESSAGE( "wine: Call from %p to unimplemented function %s.%ld, aborting\n",
283                    rec->ExceptionAddress,
284                    (char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] );
285     }
286 #ifdef __i386__
287     else
288     {
289         TRACE(" eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
290               context->Eax, context->Ebx, context->Ecx,
291               context->Edx, context->Esi, context->Edi );
292         TRACE(" ebp=%08lx esp=%08lx cs=%04lx ds=%04lx es=%04lx fs=%04lx gs=%04lx flags=%08lx\n",
293               context->Ebp, context->Esp, context->SegCs, context->SegDs,
294               context->SegEs, context->SegFs, context->SegGs, context->EFlags );
295     }
296 #endif
297
298     if (send_debug_event( rec, TRUE, context ) == DBG_CONTINUE) return;  /* continue execution */
299
300     if (call_vectored_handlers( rec, context ) == EXCEPTION_CONTINUE_EXECUTION) return;
301
302     frame = NtCurrentTeb()->Tib.ExceptionList;
303     nested_frame = NULL;
304     while (frame != (EXCEPTION_REGISTRATION_RECORD*)~0UL)
305     {
306         /* Check frame address */
307         if (((void*)frame < NtCurrentTeb()->Tib.StackLimit) ||
308             ((void*)(frame+1) > NtCurrentTeb()->Tib.StackBase) ||
309             (ULONG_PTR)frame & 3)
310         {
311             rec->ExceptionFlags |= EH_STACK_INVALID;
312             break;
313         }
314
315         /* Call handler */
316         res = EXC_CallHandler( rec, frame, context, &dispatch, frame->Handler, EXC_RaiseHandler );
317         if (frame == nested_frame)
318         {
319             /* no longer nested */
320             nested_frame = NULL;
321             rec->ExceptionFlags &= ~EH_NESTED_CALL;
322         }
323
324         switch(res)
325         {
326         case ExceptionContinueExecution:
327             if (!(rec->ExceptionFlags & EH_NONCONTINUABLE)) return;
328             newrec.ExceptionCode    = STATUS_NONCONTINUABLE_EXCEPTION;
329             newrec.ExceptionFlags   = EH_NONCONTINUABLE;
330             newrec.ExceptionRecord  = rec;
331             newrec.NumberParameters = 0;
332             RtlRaiseException( &newrec );  /* never returns */
333             break;
334         case ExceptionContinueSearch:
335             break;
336         case ExceptionNestedException:
337             if (nested_frame < dispatch) nested_frame = dispatch;
338             rec->ExceptionFlags |= EH_NESTED_CALL;
339             break;
340         default:
341             newrec.ExceptionCode    = STATUS_INVALID_DISPOSITION;
342             newrec.ExceptionFlags   = EH_NONCONTINUABLE;
343             newrec.ExceptionRecord  = rec;
344             newrec.NumberParameters = 0;
345             RtlRaiseException( &newrec );  /* never returns */
346             break;
347         }
348         frame = frame->Prev;
349     }
350     EXC_DefaultHandling( rec, context );
351 }
352
353 /**********************************************************************/
354
355 #ifdef DEFINE_REGS_ENTRYPOINT
356 DEFINE_REGS_ENTRYPOINT( RtlRaiseException, 4, 4 );
357 #else
358 void WINAPI RtlRaiseException( EXCEPTION_RECORD *rec )
359 {
360     CONTEXT context;
361     memset( &context, 0, sizeof(context) );
362     __regs_RtlRaiseException( rec, &context );
363 }
364 #endif
365
366
367 /*******************************************************************
368  *              RtlUnwind (NTDLL.@)
369  */
370 void WINAPI __regs_RtlUnwind( EXCEPTION_REGISTRATION_RECORD* pEndFrame, PVOID unusedEip,
371                               PEXCEPTION_RECORD pRecord, PVOID returnEax, CONTEXT *context )
372 {
373     EXCEPTION_RECORD record, newrec;
374     EXCEPTION_REGISTRATION_RECORD *frame, *dispatch;
375
376 #ifdef __i386__
377     context->Eax = (DWORD)returnEax;
378 #endif
379
380     /* build an exception record, if we do not have one */
381     if (!pRecord)
382     {
383         record.ExceptionCode    = STATUS_UNWIND;
384         record.ExceptionFlags   = 0;
385         record.ExceptionRecord  = NULL;
386         record.ExceptionAddress = GET_IP(context);
387         record.NumberParameters = 0;
388         pRecord = &record;
389     }
390
391     pRecord->ExceptionFlags |= EH_UNWINDING | (pEndFrame ? 0 : EH_EXIT_UNWIND);
392
393     TRACE( "code=%lx flags=%lx\n", pRecord->ExceptionCode, pRecord->ExceptionFlags );
394
395     /* get chain of exception frames */
396     frame = NtCurrentTeb()->Tib.ExceptionList;
397     while ((frame != (EXCEPTION_REGISTRATION_RECORD*)~0UL) && (frame != pEndFrame))
398     {
399         /* Check frame address */
400         if (pEndFrame && (frame > pEndFrame))
401         {
402             newrec.ExceptionCode    = STATUS_INVALID_UNWIND_TARGET;
403             newrec.ExceptionFlags   = EH_NONCONTINUABLE;
404             newrec.ExceptionRecord  = pRecord;
405             newrec.NumberParameters = 0;
406             RtlRaiseException( &newrec );  /* never returns */
407         }
408         if (((void*)frame < NtCurrentTeb()->Tib.StackLimit) ||
409             ((void*)(frame+1) > NtCurrentTeb()->Tib.StackBase) ||
410             (UINT_PTR)frame & 3)
411         {
412             newrec.ExceptionCode    = STATUS_BAD_STACK;
413             newrec.ExceptionFlags   = EH_NONCONTINUABLE;
414             newrec.ExceptionRecord  = pRecord;
415             newrec.NumberParameters = 0;
416             RtlRaiseException( &newrec );  /* never returns */
417         }
418
419         /* Call handler */
420         switch(EXC_CallHandler( pRecord, frame, context, &dispatch,
421                                 frame->Handler, EXC_UnwindHandler ))
422         {
423         case ExceptionContinueSearch:
424             break;
425         case ExceptionCollidedUnwind:
426             frame = dispatch;
427             break;
428         default:
429             newrec.ExceptionCode    = STATUS_INVALID_DISPOSITION;
430             newrec.ExceptionFlags   = EH_NONCONTINUABLE;
431             newrec.ExceptionRecord  = pRecord;
432             newrec.NumberParameters = 0;
433             RtlRaiseException( &newrec );  /* never returns */
434             break;
435         }
436         frame = __wine_pop_frame( frame );
437     }
438 }
439
440 /**********************************************************************/
441
442 #ifdef DEFINE_REGS_ENTRYPOINT
443 DEFINE_REGS_ENTRYPOINT( RtlUnwind, 16, 16 );
444 #else
445 void WINAPI RtlUnwind( PVOID pEndFrame, PVOID unusedEip,
446                        PEXCEPTION_RECORD pRecord, PVOID returnEax )
447 {
448     CONTEXT context;
449     memset( &context, 0, sizeof(context) );
450     __regs_RtlUnwind( pEndFrame, unusedEip, pRecord, returnEax, &context );
451 }
452 #endif
453
454
455 /*******************************************************************
456  *              NtRaiseException (NTDLL.@)
457  */
458 void WINAPI __regs_NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *ctx,
459                                   BOOL first, CONTEXT *context )
460 {
461     __regs_RtlRaiseException( rec, ctx );
462     *context = *ctx;
463 }
464
465 #ifdef DEFINE_REGS_ENTRYPOINT
466 DEFINE_REGS_ENTRYPOINT( NtRaiseException, 12, 12 );
467 #else
468 void WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *ctx, BOOL first )
469 {
470     CONTEXT context;
471     memset( &context, 0, sizeof(context) );
472     __regs_NtRaiseException( rec, ctx, first, &context );
473 }
474 #endif
475
476
477 /***********************************************************************
478  *            RtlRaiseStatus  (NTDLL.@)
479  *
480  * Raise an exception with ExceptionCode = status
481  */
482 void WINAPI RtlRaiseStatus( NTSTATUS status )
483 {
484     EXCEPTION_RECORD ExceptionRec;
485
486     ExceptionRec.ExceptionCode    = status;
487     ExceptionRec.ExceptionFlags   = EH_NONCONTINUABLE;
488     ExceptionRec.ExceptionRecord  = NULL;
489     ExceptionRec.NumberParameters = 0;
490     RtlRaiseException( &ExceptionRec );
491 }
492
493
494 /*******************************************************************
495  *         RtlAddVectoredExceptionHandler   (NTDLL.@)
496  */
497 PVOID WINAPI RtlAddVectoredExceptionHandler( ULONG first, PVECTORED_EXCEPTION_HANDLER func )
498 {
499     VECTORED_HANDLER *handler = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*handler) );
500     if (handler)
501     {
502         handler->func = func;
503         RtlEnterCriticalSection( &vectored_handlers_section );
504         if (first) list_add_head( &vectored_handlers, &handler->entry );
505         else list_add_tail( &vectored_handlers, &handler->entry );
506         RtlLeaveCriticalSection( &vectored_handlers_section );
507     }
508     return handler;
509 }
510
511
512 /*******************************************************************
513  *         RtlRemoveVectoredExceptionHandler   (NTDLL.@)
514  */
515 ULONG WINAPI RtlRemoveVectoredExceptionHandler( PVOID handler )
516 {
517     struct list *ptr;
518     ULONG ret = FALSE;
519
520     RtlEnterCriticalSection( &vectored_handlers_section );
521     LIST_FOR_EACH( ptr, &vectored_handlers )
522     {
523         VECTORED_HANDLER *curr_handler = LIST_ENTRY( ptr, VECTORED_HANDLER, entry );
524         if (curr_handler == handler)
525         {
526             list_remove( ptr );
527             ret = TRUE;
528             break;
529         }
530     }
531     RtlLeaveCriticalSection( &vectored_handlers_section );
532     if (ret) RtlFreeHeap( GetProcessHeap(), 0, handler );
533     return ret;
534 }
535
536
537 /*************************************************************
538  *            __wine_exception_handler (NTDLL.@)
539  *
540  * Exception handler for exception blocks declared in Wine code.
541  */
542 DWORD __wine_exception_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECORD *frame,
543                                 CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **pdispatcher )
544 {
545     __WINE_FRAME *wine_frame = (__WINE_FRAME *)frame;
546
547     if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))
548         return ExceptionContinueSearch;
549
550     if (wine_frame->u.filter == (void *)1)  /* special hack for page faults */
551     {
552         if (record->ExceptionCode != EXCEPTION_ACCESS_VIOLATION)
553             return ExceptionContinueSearch;
554     }
555     else if (wine_frame->u.filter)
556     {
557         EXCEPTION_POINTERS ptrs;
558         ptrs.ExceptionRecord = record;
559         ptrs.ContextRecord = context;
560         switch(wine_frame->u.filter( &ptrs ))
561         {
562         case EXCEPTION_CONTINUE_SEARCH:
563             return ExceptionContinueSearch;
564         case EXCEPTION_CONTINUE_EXECUTION:
565             return ExceptionContinueExecution;
566         case EXCEPTION_EXECUTE_HANDLER:
567             break;
568         default:
569             MESSAGE( "Invalid return value from exception filter\n" );
570             assert( FALSE );
571         }
572     }
573     /* hack to make GetExceptionCode() work in handler */
574     wine_frame->ExceptionCode   = record->ExceptionCode;
575     wine_frame->ExceptionRecord = wine_frame;
576
577     RtlUnwind( frame, 0, record, 0 );
578     __wine_pop_frame( frame );
579     siglongjmp( wine_frame->jmp, 1 );
580 }
581
582
583 /*************************************************************
584  *            __wine_finally_handler (NTDLL.@)
585  *
586  * Exception handler for try/finally blocks declared in Wine code.
587  */
588 DWORD __wine_finally_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECORD *frame,
589                               CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **pdispatcher )
590 {
591     if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
592     {
593         __WINE_FRAME *wine_frame = (__WINE_FRAME *)frame;
594         wine_frame->u.finally_func( FALSE );
595     }
596     return ExceptionContinueSearch;
597 }
598
599
600 /*************************************************************
601  *            __wine_spec_unimplemented_stub
602  *
603  * ntdll-specific implementation to avoid depending on kernel functions.
604  * Can be removed once ntdll.spec no longer contains stubs.
605  */
606 void __wine_spec_unimplemented_stub( const char *module, const char *function )
607 {
608     EXCEPTION_RECORD record;
609
610     record.ExceptionCode    = EXCEPTION_WINE_STUB;
611     record.ExceptionFlags   = EH_NONCONTINUABLE;
612     record.ExceptionRecord  = NULL;
613     record.ExceptionAddress = __wine_spec_unimplemented_stub;
614     record.NumberParameters = 2;
615     record.ExceptionInformation[0] = (ULONG_PTR)module;
616     record.ExceptionInformation[1] = (ULONG_PTR)function;
617     RtlRaiseException( &record );
618 }