summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2013-04-16 10:10:57 +0200
committerDavid Tardon <dtardon@redhat.com>2013-04-16 18:25:18 +0000
commitbe421269f95446307d1168e17e1fe9ee7d9a0a66 (patch)
tree491fa90929828589d390e994b3e9f841672d22ea /include
parentbaffab9a4ffca9a4940a3310937d6e858e66cc1f (diff)
move headers from solenv/inc/ to include/
Change-Id: Ieb6cba645b3535f7d683d2aefa5599d04d9994f3 Reviewed-on: https://gerrit.libreoffice.org/3403 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/postmac.h41
-rw-r--r--include/postwin.h252
-rw-r--r--include/premac.h50
-rw-r--r--include/prewin.h77
-rw-r--r--include/shlinfo.rc72
-rw-r--r--include/version.hrc51
-rw-r--r--include/wntgcci/jni_md.h42
-rw-r--r--include/wntgcci/sehandler.hxx128
8 files changed, 713 insertions, 0 deletions
diff --git a/include/postmac.h b/include/postmac.h
new file mode 100644
index 000000000000..f157e678262a
--- /dev/null
+++ b/include/postmac.h
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#undef Button
+#undef Byte
+#undef Control
+#undef Cursor
+#undef DirInfo
+#undef FontInfo
+#undef LSize
+#undef Line
+#undef MemoryBlock
+#undef ModalDialog
+#undef Palette
+#undef Pattern
+#undef Point
+#undef Polygon
+#undef Ptr
+#undef Region
+#undef SetCursor
+#undef Size
+#undef StringPtr
+#undef TimeValue
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/postwin.h b/include/postwin.h
new file mode 100644
index 000000000000..1ec09435b5cb
--- /dev/null
+++ b/include/postwin.h
@@ -0,0 +1,252 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/* nicht geschuetz, muss als gegenstueck zu prewin.h includet werden */
+
+#ifdef WNT
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#undef Region
+#undef PolyPolygon
+#undef Polygon
+#undef Rectangle
+#undef DELETE
+
+#undef Folder
+#undef GradientStyle_RECT
+
+/* Hilfe-Ids umbenennen */
+#define WIN_HELP_INDEX 0x0003
+#define WIN_HELP_HELPONHELP 0x0004
+#undef HELP_INDEX
+#undef HELP_HELPONHELP
+
+#define WIN_MOUSE_MOVED 0x0001
+#undef MOUSE_MOVED
+
+#define WIN_WB_LEFT 0
+#define WIN_WB_RIGHT 1
+#undef WB_LEFT
+#undef WB_RIGHT
+
+#ifdef GetObject
+#undef GetObject
+#ifdef UNICODE
+#define WIN_GetObject GetObjectW
+#else
+#define WIN_GetObject GetObjectA
+#endif
+#else
+#define WIN_GetObject GetObject
+#endif
+
+#ifdef SetPrinter
+#undef SetPrinter
+#ifdef UNICODE
+#define WIN_SetPrinter SetPrinterW
+#else
+#define WIN_SetPrinter SetPrinterA
+#endif
+#else
+#define WIN_SetPrinter SetPrinter
+#endif
+
+#ifdef GetPrinter
+#undef GetPrinter
+#ifdef UNICODE
+#define WIN_GetPrinter GetPrinterW
+#else
+#define WIN_GetPrinter GetPrinterA
+#endif
+#else
+#define WIN_GetPrinter GetPrinter
+#endif
+
+#ifdef DrawText
+#undef DrawText
+#ifdef UNICODE
+#define WIN_DrawText DrawTextW
+#else
+#define WIN_DrawText DrawTextA
+#endif
+#else
+#define WIN_DrawText DrawText
+#endif
+
+#ifdef mciSetCommand
+#undef mciSetCommand
+#ifdef UNICODE
+#define WIN_mciSetCommand mciSetCommandW
+#else
+#define WIN_mciSetCommand mciSetCommandA
+#endif
+#else
+#define mciSetCommand mciSetCommand
+#endif
+
+#ifdef SetPort
+#undef SetPort
+#ifdef UNICODE
+#define WIN_SetPort SetPortW
+#else
+#define WIN_SetPort SetPortA
+#endif
+#else
+#define WIN_SetPort SetPort
+#endif
+
+#ifdef CopyFile
+#undef CopyFile
+#ifdef UNICODE
+#define WIN_CopyFile CopyFileW
+#else
+#define WIN_CopyFile CopyFileA
+#endif
+#else
+#define WIN_CopyFile CopyFile
+#endif
+
+
+#ifdef GetUserName
+#undef GetUserName
+#ifdef UNICODE
+#define WIN_GetUserName GetUserNameW
+#else
+#define WIN_GetUserName GetUserNameA
+#endif
+#else
+#define WIN_GetUserName GetUserName
+#endif
+
+#ifdef GetClassName
+#undef GetClassName
+#ifdef UNICODE
+#define WIN_GetClassName GetClassNameW
+#else
+#define WIN_GetClassName GetClassNameA
+#endif
+#else
+#define WIN_GetClassName GetClassName
+#endif
+
+#ifdef GetCharWidth
+#undef GetCharWidth
+#ifdef UNICODE
+#define WIN_GetCharWidth GetCharWidthW
+#else
+#define WIN_GetCharWidth GetCharWidthA
+#endif
+#else
+#define WIN_GetCharWidth GetCharWidth
+#endif
+
+#ifdef GetMetaFile
+#undef GetMetaFile
+#ifdef UNICODE
+#define WIN_GetMetaFile GetMetaFileW
+#else
+#define WIN_GetMetaFile GetMetaFileA
+#endif
+#else
+#define WIN_GetMetaFile GetMetaFile
+#endif
+
+#ifdef GetNumberFormat
+#undef GetNumberFormat
+#ifdef UNICODE
+#define WIN_GetNumberFormat GetNumberFormatW
+#else
+#define WIN_GetNumberFormat GetNumberFormatA
+#endif
+#else
+#define WIN_GetNumberFormat GetNumberFormat
+#endif
+
+#ifdef GetGlyphOutline
+#undef GetGlyphOutline
+#ifdef UNICODE
+#define WIN_GetGlyphOutline GetGlyphOutlineW
+#else
+#define WIN_GetGlyphOutline GetGlyphOutlineA
+#endif
+#else
+#define WIN_GetGlyphOutline GetGlyphOutline
+#endif
+
+#ifdef GetKerningPairs
+#undef GetKerningPairs
+#ifdef UNICODE
+#define WIN_GetKerningPairs GetKerningPairsW
+#else
+#define WIN_GetKerningPairs GetKerningPairsA
+#endif
+#else
+#define WIN_GetKerningPairs GetKerningPairs
+#endif
+
+#ifdef FindWindow
+#undef FindWindow
+#ifdef UNICODE
+#define WIN_FindWindow FindWindowW
+#else
+#define WIN_FindWindow FindWindowA
+#endif
+#else
+#define WIN_FindWindow FindWindow
+#endif
+
+// keine Yield-Definition
+#undef Yield
+
+/* new StretchBlt() Modes (simpler names) */
+#ifndef STRETCH_ANDSCANS
+#define STRETCH_ANDSCANS 1
+#endif
+#ifndef STRETCH_ORSCANS
+#define STRETCH_ORSCANS 2
+#endif
+#ifndef STRETCH_DELETESCANS
+#define STRETCH_DELETESCANS 3
+#endif
+
+#ifdef WNT
+extern "C"
+{
+BOOL WINAPI WIN_Rectangle( HDC hDC, int X1, int Y1, int X2, int Y2 );
+BOOL WINAPI WIN_Polygon( HDC hDC, CONST POINT * ppt, int ncnt );
+BOOL WINAPI WIN_PolyPolygon( HDC hDC, CONST POINT * ppt, LPINT npcnt, int ncnt );
+}
+#endif
+
+// svwin.h nicht mehr includen
+#define _SVWIN_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/premac.h b/include/premac.h
new file mode 100644
index 000000000000..f6e37475795f
--- /dev/null
+++ b/include/premac.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define Button MacOSButton
+#define Byte MacOSByte
+#define Control MacOSControl
+#define Cursor MacOSCursor
+#define DirInfo MacOSDirInfo
+#define FontInfo MacOSFontInfo
+#define LSize MacOSLSize
+#define Line MacOSLine
+#define MemoryBlock MacOSMemoryBlock
+#define ModalDialog MacOSModalDialog
+#define Palette MacOSPalette
+#define Pattern MacOSPattern
+#define Point MacOSPoint
+#define Polygon MacOSPolygon
+#define Ptr MacOSPtr
+#define Region MacOSRegion
+#define SetCursor MacOSSetCursor
+#define Size MacOSSize
+#define StringPtr MacOSStringPtr
+#define TimeValue MacOSTimeValue
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/prewin.h b/include/prewin.h
new file mode 100644
index 000000000000..837dfa093872
--- /dev/null
+++ b/include/prewin.h
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/* nicht geschuetzt, darf nur einmal includet werden */
+
+#if defined WNT
+
+#define Rectangle BLA_Rectangle
+#define Polygon BLA_Polygon
+#define PolyPolygon BLA_PolyPolygon
+#define Region WIN_Region
+#define Folder WIN_Folder
+#define GradientStyle_RECT WIN_GradientStyle_RECT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined STRICT
+#define STRICT
+#endif
+#ifdef _MSC_VER
+#pragma warning(push, 1)
+#pragma warning (disable: 4005)
+#endif
+#include <windows.h>
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+#include <shellapi.h>
+#include <commdlg.h>
+#include <dlgs.h>
+#ifdef USE_TOOLHELP
+#include <tlhelp32.h>
+#endif
+#ifdef USE_IMAGEHLP
+#include <imagehlp.h>
+#endif
+#ifdef INCLUDE_MMSYSTEM
+#include <mmsystem.h>
+#endif
+#ifdef _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <commctrl.h>
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/shlinfo.rc b/include/shlinfo.rc
new file mode 100644
index 000000000000..2176bbf9937d
--- /dev/null
+++ b/include/shlinfo.rc
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <windows.h>
+#include "version.hrc"
+
+// -----------------------------------------------------------------------
+// version information
+// -----------------------------------------------------------------------
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION VERSION, SUBVERSION, MICROVERSION, VERVARIANT
+ PRODUCTVERSION VERSION, SUBVERSION, MICROVERSION, VERVARIANT
+ FILEFLAGSMASK 0x3F
+ FILEFLAGS
+#if defined(DEBUG)
+ VS_FF_DEBUG |
+#endif
+#ifdef VER_PREL
+ VS_FF_PRERELEASE |
+#endif
+ 0
+ FILEOS VOS_NT_WINDOWS32
+ FILETYPE VFT_APP
+ {
+ BLOCK "StringFileInfo"
+ {
+ BLOCK "040904E4"
+ {
+ // International StringTable
+ VALUE "CompanyName", PPS(RES_APP_VENDOR) "\0"
+ VALUE "ProductName", "LibreOffice\0"
+ VALUE "ProductVersion", PPS(VER_LEVEL) "\0"
+ VALUE "FileVersion", PPS(VER_LEVEL) "\0"
+ VALUE "OriginalFilename", PPS(ORG_NAME) "\0"
+ VALUE "InternalName", PPS(INTERNAL_NAME) "\0"
+ VALUE "LegalCopyright", S_CRIGHT " LibreOffice contributors and/or their affiliates. All rights reserved.\0"
+ ADDITIONAL_VERINFO1
+ ADDITIONAL_VERINFO2
+ ADDITIONAL_VERINFO3
+ }
+ }
+
+ BLOCK "VarFileInfo"
+ {
+ VALUE "Translation", 0x0409, 1252
+ }
+ }
diff --git a/include/version.hrc b/include/version.hrc
new file mode 100644
index 000000000000..305dc47afdc0
--- /dev/null
+++ b/include/version.hrc
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ *************************************************************************/
+
+#include <config_version.h>
+
+#define VERSION LIBO_VERSION_MAJOR
+#define SUBVERSION LIBO_VERSION_MINOR
+#define MICROVERSION LIBO_VERSION_MICRO
+#define VER_YEARRANGE 2000-LIBO_THIS_YEAR
+
+#include <winver.h>
+
+#ifndef PPSX
+#define PPSX(s) #s
+#endif
+#ifndef PPS
+#define PPS(s) PPSX(s)
+#endif
+
+#define VER_LEVEL VERSION.SUBVERSION.MICROVERSION.VERVARIANT
+
+#define VERC(a) Copyright \251 a by
+
+#define S_CRIGHT PPS(VERC(VER_YEARRANGE))
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/wntgcci/jni_md.h b/include/wntgcci/jni_md.h
new file mode 100644
index 000000000000..b7aab253b350
--- /dev/null
+++ b/include/wntgcci/jni_md.h
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ */
+
+/* Fake jni_md.h for use when cross-compiling to Windows */
+
+#ifndef JNI_MD_H_INCLUDED
+#define JNI_MD_H_INCLUDED
+
+#define JNIEXPORT __declspec (dllexport)
+#define JNIIMPORT __declspec (dllimport)
+#define JNICALL __stdcall
+
+typedef long jint;
+typedef __int64 jlong;
+typedef char jbyte;
+
+#endif /* JNI_MD_H_INCLUDED */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/wntgcci/sehandler.hxx b/include/wntgcci/sehandler.hxx
new file mode 100644
index 000000000000..2fabe486a452
--- /dev/null
+++ b/include/wntgcci/sehandler.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+// Provenance of this code unclear. From crosswin32-dtrans-mingw.diff,
+// but from where it got there, I don't know.
+
+
+#ifndef _SEHANDLER_HXX
+#define _SEHANDLER_HXX
+
+#ifndef __MINGW32__
+#error This file should be included only in a MinGW compilation
+#endif
+
+#include <windows.h>
+#include <setjmp.h>
+
+#ifndef EH_UNWINDING
+// See _EH_UNWINDING in MSVS9/VC/crt/src/except.inc
+#define EH_UNWINDING 2
+#endif
+
+namespace {
+class __SEHandler
+{
+public:
+ __SEHandler() {}
+ ~__SEHandler() {}
+ typedef int (*PF)(void *, LPEXCEPTION_POINTERS);
+ typedef void (*PH)(void *, LPEXCEPTION_POINTERS);
+ typedef void (*PN)(void *);
+ void Set(jmp_buf jb, void *pdata=NULL, PF pfilter=NULL, PH phandlerbody=NULL, PN pfinal=NULL)
+ {
+ __builtin_memcpy(m_jmpbuf, jb, sizeof(jmp_buf));
+ m_pData=pdata;
+ switch (reinterpret_cast<int>(pfilter))
+ {
+ default:
+ m_filter=pfilter;
+ break;
+ case EXCEPTION_CONTINUE_EXECUTION:
+ m_filter=DefaultFilterContinueExecution;
+ break;
+ case EXCEPTION_EXECUTE_HANDLER:
+ m_filter=DefaultFilterExecuteHandler;
+ break;
+ case EXCEPTION_CONTINUE_SEARCH:
+ m_filter=DefaultFilterContinueSearch;
+ break;
+ }
+ if (phandlerbody)
+ m_handlerbody=phandlerbody;
+ else
+ m_handlerbody=DefaultHandler;
+ if (pfinal)
+ m_final=pfinal;
+ else
+ m_final=DefaultFinal;
+ m_ER.pHandlerClass = this;
+ m_ER.hp = handler;
+ asm("movl %%fs:0, %%eax\n\t"
+ "movl %%eax, %0": : "m" (m_ER.prev): "%eax" );
+ asm("movl %0, %%eax\n\t"
+ "movl %%eax, %%fs:0": : "r" (&m_ER): "%eax" );
+ }
+ void Reset()
+ {
+ m_final(m_pData);
+ asm("movl %0, %%eax \n\t"
+ "movl %%eax, %%fs:0"
+ : : "m" (m_ER.prev): "%eax");
+ }
+private:
+ __SEHandler(const __SEHandler&);
+ __SEHandler& operator=(const __SEHandler&);
+ struct _ER {
+ _ER* prev;
+ PEXCEPTION_HANDLER hp;
+ __SEHandler *pHandlerClass;
+ };
+ static EXCEPTION_DISPOSITION handler(struct _EXCEPTION_RECORD *pExceptionRecord,
+ void * EstablisherFrame,
+ struct _CONTEXT *ContextRecord,
+ void * /*DispatcherContext*/)
+ {
+ __SEHandler* pThis = reinterpret_cast< _ER * >(EstablisherFrame)->pHandlerClass;
+ if (pExceptionRecord->ExceptionFlags & EH_UNWINDING)
+ {
+ pThis->m_final(pThis->m_pData);
+ return ExceptionContinueSearch;
+ }
+ EXCEPTION_POINTERS ep={pExceptionRecord, ContextRecord};
+ switch (pThis->m_filter(pThis->m_pData, &ep))
+ {
+ case EXCEPTION_EXECUTE_HANDLER:
+ RtlUnwind(EstablisherFrame, &&__set_label, pExceptionRecord, 0);
+ __set_label:
+ pThis->m_handlerbody(pThis->m_pData, &ep);
+ ContextRecord->Ebp = pThis->m_jmpbuf[0];
+ ContextRecord->Eip = pThis->m_jmpbuf[1];
+ ContextRecord->Esp = pThis->m_jmpbuf[2];
+ return ExceptionContinueExecution;
+ case EXCEPTION_CONTINUE_SEARCH:
+ return ExceptionContinueSearch;
+ case EXCEPTION_CONTINUE_EXECUTION:
+ return ExceptionContinueExecution;
+ }
+ return ExceptionContinueExecution;
+ }
+ static int DefaultFilterContinueSearch(void *, LPEXCEPTION_POINTERS) { return EXCEPTION_CONTINUE_SEARCH; }
+ static int DefaultFilterContinueExecution(void *, LPEXCEPTION_POINTERS) { return EXCEPTION_CONTINUE_EXECUTION; }
+ static int DefaultFilterExecuteHandler(void *, LPEXCEPTION_POINTERS) { return EXCEPTION_EXECUTE_HANDLER; }
+ static void DefaultHandler(void *, LPEXCEPTION_POINTERS) {}
+ static void DefaultFinal(void *) {}
+ typedef int (*handler_p)(struct _EXCEPTION_RECORD *ExceptionRecord,
+ void * EstablisherFrame,
+ struct _CONTEXT *ContextRecord,
+ void * DispatcherContext);
+ _ER m_ER;
+ void *m_pData;
+ PN m_final;
+ PH m_handlerbody;
+ PF m_filter;
+ jmp_buf m_jmpbuf;
+};
+
+} // namespace {
+
+#endif // _SEHANDLER_HXX