• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Copyright (c) 2010 The Chromium Authors. All rights reserved.
2; Use of this source code is governed by a BSD-style license that can be
3; found in the LICENSE file.
4;
5; Tag the exception handler as an SEH handler in case the executable
6; is linked with /SAFESEH (which is the default).
7;
8; MASM 8.0 inserts an additional leading underscore in front of names
9; and this is an attempted fix until we understand why.
10; MASM 10.0 fixed this.
11IF @version LT 800 OR @version GE 1000
12_ExceptionBarrierHandler PROTO
13.SAFESEH _ExceptionBarrierHandler
14_ExceptionBarrierReportOnlyModuleHandler PROTO
15.SAFESEH _ExceptionBarrierReportOnlyModuleHandler
16_ExceptionBarrierCallCustomHandler PROTO
17.SAFESEH _ExceptionBarrierCallCustomHandler
18ELSE
19ExceptionBarrierHandler PROTO
20.SAFESEH ExceptionBarrierHandler
21ExceptionBarrierReportOnlyModuleHandler PROTO
22.SAFESEH ExceptionBarrierReportOnlyModuleHandler
23ExceptionBarrierCallCustomHandler PROTO
24.SAFESEH ExceptionBarrierCallCustomHandler
25ENDIF
26
27.586
28.MODEL FLAT, STDCALL
29ASSUME FS:NOTHING
30.CODE
31
32; extern "C" void WINAPI RegisterExceptionRecord(
33;                          EXCEPTION_REGISTRATION *registration,
34;                          ExceptionHandlerFunc func);
35RegisterExceptionRecord PROC registration:DWORD, func:DWORD
36OPTION PROLOGUE:None
37OPTION EPILOGUE:None
38  mov   edx, DWORD PTR [esp + 4]  ; edx is registration
39  mov   eax, DWORD PTR [esp + 8] ; eax is func
40  mov   DWORD PTR [edx + 4], eax
41  mov   eax, FS:[0]
42  mov   DWORD PTR [edx], eax
43  mov   FS:[0], edx
44  ret   8
45
46RegisterExceptionRecord ENDP
47
48; extern "C" void UnregisterExceptionRecord(
49;                           EXCEPTION_REGISTRATION *registration);
50UnregisterExceptionRecord PROC registration:DWORD
51OPTION PROLOGUE:None
52OPTION EPILOGUE:None
53
54  mov   edx, DWORD PTR [esp + 4]
55  mov   eax, [edx]
56  mov   FS:[0], eax
57  ret   4
58
59UnregisterExceptionRecord ENDP
60
61END
62