forked from Public-Mirror/Textractor
starting commit
This commit is contained in:
parent
5985972c6f
commit
9914ab9985
33
vnr/CMakeLists.txt
Normal file
33
vnr/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release)
|
||||
|
||||
project(vnr)
|
||||
|
||||
set(WDK_HOME "C:\\WinDDK\\7600.16385.1" CACHE FILEPATH "path to the Windows DDK directory")
|
||||
|
||||
add_definitions(
|
||||
-DUNICODE
|
||||
-D_UNICODE
|
||||
)
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR})
|
||||
|
||||
set(common_src
|
||||
${PROJECT_SOURCE_DIR}/ith/common/const.h
|
||||
${PROJECT_SOURCE_DIR}/ith/common/defs.h
|
||||
${PROJECT_SOURCE_DIR}/ith/common/except.h
|
||||
${PROJECT_SOURCE_DIR}/ith/common/growl.h
|
||||
${PROJECT_SOURCE_DIR}/ith/common/memory.h
|
||||
${PROJECT_SOURCE_DIR}/ith/common/types.h
|
||||
)
|
||||
|
||||
set(import_src
|
||||
${PROJECT_SOURCE_DIR}/ith/import/mono/funcinfo.h
|
||||
${PROJECT_SOURCE_DIR}/ith/import/mono/types.h
|
||||
${PROJECT_SOURCE_DIR}/ith/import/ppsspp/funcinfo.h
|
||||
)
|
||||
|
||||
add_subdirectory(ith/hook)
|
||||
add_subdirectory(ith/host)
|
||||
add_subdirectory(ith/sys)
|
21
vnr/ccutil/ccmacro.h
Normal file
21
vnr/ccutil/ccmacro.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef CCMACRO_H
|
||||
#define CCMACRO_H
|
||||
|
||||
// ccmacro.h
|
||||
// 12/9/2011 jichi
|
||||
|
||||
#define CC_UNUSED(_var) (void)(_var)
|
||||
#define CC_NOP CC_UNUSED(0)
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define CC_LIKELY(expr) __builtin_expect(!!(expr), true)
|
||||
# define CC_UNLIKELY(expr) __builtin_expect(!!(expr), false)
|
||||
#else
|
||||
# define CC_LIKELY(x) (x)
|
||||
# define CC_UNLIKELY(x) (x)
|
||||
#endif
|
||||
|
||||
#define CC_MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define CC_MAX(x, y) ((x) < (y) ? (y) : (x))
|
||||
|
||||
#endif // CCMACRO_H
|
11
vnr/ccutil/ccutil.pri
Normal file
11
vnr/ccutil/ccutil.pri
Normal file
@ -0,0 +1,11 @@
|
||||
# ccutil.pri
|
||||
# 1/31/2012 jichi
|
||||
|
||||
DEFINES += WITH_LIB_CCUTIL
|
||||
|
||||
DEPENDPATH += $$PWD
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/ccmacro.h
|
||||
|
||||
# EOF
|
596
vnr/config.pri
Normal file
596
vnr/config.pri
Normal file
@ -0,0 +1,596 @@
|
||||
# config.pri
|
||||
# 9/3/2011 jichi
|
||||
|
||||
## Locations
|
||||
|
||||
ROOTDIR = $$PWD
|
||||
BUILDDIR = $$ROOTDIR/build
|
||||
|
||||
SRCDIR = $$ROOTDIR/cpp
|
||||
CONFDIR = $$SRCDIR/conf
|
||||
LIBDIR = $$SRCDIR/libs
|
||||
COMDIR = $$SRCDIR/coms
|
||||
PLUGINDIR = $$SRCDIR/plugins
|
||||
#SERVICEDIR = $$SRCDIR/services
|
||||
|
||||
DESTDIR = $$BUILDDIR
|
||||
#win32: DESTDIR_TARGET = $$BUILDDIR/release.win
|
||||
#unix: DESTDIR_TARGET = $$BUILDDIR/release.unix
|
||||
#mac: DESTDIR_TARGET = $$BUILDDIR/release.mac
|
||||
|
||||
LIBS += -L$$DESTDIR
|
||||
mac: LIBS += -F$$DESTDIR
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$SRCDIR \
|
||||
$$LIBDIR \
|
||||
$$COMDIR \
|
||||
$$PLUGINDIR \
|
||||
$$SERVICEDIR
|
||||
|
||||
## Qt Translation
|
||||
|
||||
CODECFORTR = UTF-8
|
||||
#CODECFORSRC = UTF-8 # there are sources in SJIS encoding
|
||||
|
||||
## Compiling options
|
||||
|
||||
# Windows
|
||||
win32: DEFINES += UNICODE # force using UNICODE interface by default
|
||||
|
||||
# Mac
|
||||
#CONFIG += x86 x86_64 ppc64
|
||||
mac: CONFIG -= ppc ppc64 # disable compiling fat architectures
|
||||
|
||||
# Enable C++11
|
||||
win32: QMAKE_CXXFLAGS += -Zc:auto
|
||||
unix: QMAKE_CXXFLAGS += -std=c++11
|
||||
mac {
|
||||
# Enable TR1 such as tuple
|
||||
# Clang is required to take place of llvm gcc, which uses /usr/lib/libstdc++.dylib
|
||||
QMAKE_CXXFLAGS += -stdlib=libc++
|
||||
QMAKE_LFLAGS += -stdlib=libc++
|
||||
}
|
||||
|
||||
# MSVC warnings
|
||||
win32 {
|
||||
# Disable checked iterator and compiler warning.
|
||||
# SCL: http://msdn.microsoft.com/en-us/library/aa985896.aspx
|
||||
# SCL Warning: http://msdn.microsoft.com/en-us/library/aa985974.aspx
|
||||
# Performance comparison: http://askldjd.wordpress.com/2009/09/13/stl-performance-comparison-vc71-vc90-and-stlport/
|
||||
DEFINES += _SECURE_SCL=0 _SCL_SECURE_NO_WARNINGS
|
||||
|
||||
# Disable CRT string function warnings
|
||||
DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
# Disable CRT posix warnings
|
||||
#DEFINES += _CRT_NONSTDC_NO_DEPRECATE
|
||||
|
||||
QMAKE_CXXFLAGS += -wd4819 # ignore the warning on Japanese characters
|
||||
}
|
||||
|
||||
## External Libraries
|
||||
|
||||
win32 {
|
||||
D3D_HOME = "$$PROGRAMFILES/Microsoft DirectX SDK"
|
||||
DETOURS_HOME = "$$PROGRAMFILES/Microsoft Research/Detours Express 3.0"
|
||||
#DEV_HOME = c:/dev
|
||||
DEV_HOME = z:/local/windows/developer
|
||||
BOOST_HOME = $$DEV_HOME/boost/build
|
||||
#ITH_HOME = $$DEV_HOME/ith
|
||||
MSIME_HOME = $$DEV_HOME/msime
|
||||
#PYTHON_HOME = $$ROOTDIR/../Python
|
||||
#PYTHON_HOME = C:/Python
|
||||
PYTHON_HOME = Z:/Local/Windows/Developer/Python
|
||||
PYSIDE_HOME = $$PYTHON_HOME/Lib/site-packages/PySide
|
||||
QT_HOME = c:/qt/4
|
||||
QT_SRC = c:/qt
|
||||
SAPI_HOME = "$$PROGRAMFILES/Microsoft Speech SDK 5.1"
|
||||
#WMSDK_HOME = c:/wmsdk/wmpsdk9
|
||||
WDK7_HOME = c:/winddk/7600.16385.1
|
||||
WDK8_HOME = "$$PROGRAMFILES/Windows Kits/8.1"
|
||||
UTF8_HOME = z:/users/jichi/opt/utf8
|
||||
}
|
||||
mac {
|
||||
MACPORTS_HOME = /opt/local
|
||||
BOOST_HOME = $$MACPORTS_HOME
|
||||
DEV_HOME = ${HOME}/opt
|
||||
#ITH_HOME = ${HOME}/opt/ith
|
||||
MSIME_HOME = $$DEV_HOME/msime
|
||||
PYSIDE_HOME = $$MACPORTS_HOME
|
||||
PYTHON_HOME = $$MACPORTS_HOME/Library/Frameworks/Python.framework/Versions/Current
|
||||
#QT_HOME = ${HOME}/opt/qt
|
||||
QT_HOME = $$MACPORTS_HOME
|
||||
QT_SRC = ${HOME}/src
|
||||
UTF8_HOME = $$DEV_HOME/utf8
|
||||
}
|
||||
|
||||
INCLUDEPATH += $$BOOST_HOME $$BOOST_HOME/include
|
||||
LIBS += -L$$BOOST_HOME/lib
|
||||
|
||||
# Disable automatically linking with boost silently
|
||||
# See: http://www.boost.org/doc/libs/1_56_0/boost/config/user.hpp
|
||||
DEFINES += BOOST_ALL_NO_LIB
|
||||
mac: BOOST_VARIANT = -mt
|
||||
|
||||
## Config
|
||||
|
||||
CONFIG(release) {
|
||||
message(CONFIG release)
|
||||
#DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
|
||||
}
|
||||
|
||||
CONFIG(noqt) {
|
||||
message(CONFIG noqt)
|
||||
CONFIG += noqtcore noqtgui
|
||||
CONFIG -= qt
|
||||
}
|
||||
CONFIG(noqtcore) {
|
||||
message(CONFIG noqtcore)
|
||||
QT -= core
|
||||
LIBS -= -lQtCore
|
||||
}
|
||||
CONFIG(noqtgui) {
|
||||
message(CONFIG noqtgui)
|
||||
QT -= gui
|
||||
LIBS -= -lQtGui
|
||||
mac: CONFIG -= app_bundle
|
||||
}
|
||||
|
||||
win32 {
|
||||
CONFIG(nocrt) { # No runtime CRT. Use -MT for static linking.
|
||||
message(CONFIG nocrt)
|
||||
QMAKE_CFLAGS -= -MD -MDd
|
||||
QMAKE_CFLAGS_DEBUG -= -MD -MDd
|
||||
QMAKE_CFLAGS_RELEASE -= -MD -MDd
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -MD -MDd
|
||||
QMAKE_CXXFLAGS -= -MD -MDd
|
||||
QMAKE_CXXFLAGS_DEBUG -= -MD -MDd
|
||||
QMAKE_CXXFLAGS_RELEASE -= -MD -MDd
|
||||
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -MD -MDd
|
||||
#QMAKE_LFLAGS += -NODEFAULTLIB:msvcrt.lib \
|
||||
# -NODEFAULTLIB:msvcrtd.lib
|
||||
}
|
||||
|
||||
# http://social.msdn.microsoft.com/Forums/vstudio/en-US/96c906d9-de1d-4ace-af37-71169617b6ff/destructors-and-seh
|
||||
CONFIG(eha) { # Catch all exceptions
|
||||
message(CONFIG eha)
|
||||
QMAKE_CXXFLAGS_STL_ON -= -EHsc
|
||||
QMAKE_CXXFLAGS_EXCEPTIONS_ON -= -EHsc
|
||||
QMAKE_CXXFLAGS_STL_ON += -EHa
|
||||
QMAKE_CXXFLAGS_EXCEPTIONS_ON += -EHa
|
||||
}
|
||||
|
||||
CONFIG(noeh) { # No Exception handler
|
||||
message(CONFIG noeh)
|
||||
#CONFIG -= rtti #-exceptions -stl
|
||||
QMAKE_CXXFLAGS += /GR-
|
||||
QMAKE_CXXFLAGS_RTTI_ON -= -GR
|
||||
|
||||
QMAKE_CXXFLAGS_STL_ON -= -EHsc
|
||||
QMAKE_CXXFLAGS_EXCEPTIONS_ON -= -EHsc
|
||||
|
||||
CONFIG(dll) {
|
||||
QMAKE_LFLAGS += /ENTRY:"DllMain"
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG(nosafeseh) { # No Exception handler
|
||||
message(CONFIG nosafeseh)
|
||||
|
||||
# Disable SafeSEH table
|
||||
# http://stackoverflow.com/questions/19722308/exception-handler-not-called-in-c/20344222
|
||||
# Alternative way: Register handler using MASM
|
||||
# http://stackoverflow.com/questions/12019689/custom-seh-handler-with-safeseh
|
||||
QMAKE_LFLAGS += -safeseh:no
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG(gdb) {
|
||||
message(CONFIG gdb)
|
||||
QMAKE_CXXFLAGS += -g -ggdb
|
||||
}
|
||||
|
||||
CONFIG(lldb) {
|
||||
message(CONFIG lldb)
|
||||
QMAKE_CXXFLAGS += -g #-glldb
|
||||
}
|
||||
|
||||
CONFIG(qmlplugin) {
|
||||
message(CONFIG qmlplugin)
|
||||
QT += core declarative
|
||||
win32: CONFIG += dll
|
||||
}
|
||||
|
||||
CONFIG(pysideplugin) {
|
||||
message(CONFIG pysideplugin)
|
||||
CONFIG += pyplugin shiboken
|
||||
QT += core
|
||||
|
||||
LIBS += -L$$PYSIDE_HOME -lpyside-python2.7
|
||||
INCLUDEPATH += \
|
||||
$$PYSIDE_HOME/include/PySide \
|
||||
$$PYSIDE_HOME/include/PySide-2.7 \
|
||||
$$PYSIDE_HOME/include \
|
||||
$$PYSIDE_HOME/include/PySide/QtCore \
|
||||
$$PYSIDE_HOME/include/PySide/QtGui \
|
||||
$$QT_HOME/include/QtGui # needed by pyside qtcore
|
||||
}
|
||||
|
||||
CONFIG(shiboken) {
|
||||
message(CONFIG shiboken)
|
||||
|
||||
LIBS += -L$$PYSIDE_HOME -lshiboken-python2.7
|
||||
INCLUDEPATH += \
|
||||
$$PYSIDE_HOME/include/shiboken \
|
||||
$$PYSIDE_HOME/include/shiboken-2.7
|
||||
|
||||
# Ignore warnings from Shiboken and PySide
|
||||
mac {
|
||||
QMAKE_CXXFLAGS_WARN_ON += \
|
||||
-Wno-header-guard \
|
||||
-Wno-mismatched-tags \
|
||||
-Wno-missing-field-initializers \
|
||||
-Wno-unused-parameter
|
||||
}
|
||||
win32 {
|
||||
# QMAKE_CXXFLAGS_WARN_ON does not work on windows
|
||||
#
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (disable:4099) // C4099: mix class and struct
|
||||
# pragma warning (disable:4100) // C4100: unreferenced parametter
|
||||
# pragma warning (disable:4244) // C4244: conversion lost of data
|
||||
# pragma warning (disable:4390) // C4390: empty controlled statement
|
||||
# pragma warning (disable:4522) // C4522: multiple assignment operators
|
||||
# pragma warning (disable:4800) // C4800: forcing value to bool
|
||||
#endif // _MSC_VER
|
||||
QMAKE_CXXFLAGS += -wd4099 -wd4100 -wd4244 -wd4390 -wd4522 -wd4800
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG(pyplugin) {
|
||||
message(CONFIG pyplugin)
|
||||
INCLUDEPATH += $$PYTHON_HOME/include/python2.7 $$PYTHON_HOME/include
|
||||
|
||||
unix: LIBS += -L$$PYTHON_HOME/lib -lpython2.7
|
||||
win32: LIBS += -L$$PYTHON_HOME/libs -lpython27
|
||||
|
||||
unix: QMAKE_EXTENSION_SHLIB = so
|
||||
win32: QMAKE_EXTENSION_SHLIB = pyd
|
||||
win32: CONFIG += dll
|
||||
}
|
||||
|
||||
CONFIG(qt) {
|
||||
message(CONFIG qt)
|
||||
INCLUDEPATH += $$QT_SRC $$QT_SRC/qt # always allow access to Qt source code
|
||||
|
||||
# Clang: Disable warning while processing Qt library headers
|
||||
# http://stackoverflow.com/questions/17846909/how-can-i-stop-warnings-about-unused-private-fields
|
||||
mac {
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-register # register storage class specifier is deprecated
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-private-field # private field 'type' is not used in qmime.h
|
||||
}
|
||||
}
|
||||
|
||||
# EOF
|
||||
|
||||
## Debug
|
||||
|
||||
#include($$ROOTDIR/lib/debug/debug.pri)
|
||||
|
||||
## Deploy
|
||||
|
||||
#DEFINES += VERSION=\\\"$$VERSION\\\"
|
||||
|
||||
## IDs
|
||||
|
||||
# Azure Market Key: https://datamarket.azure.com/account/datasets
|
||||
#DEFINES += CONFIG_AZURE_ID=\\\"tuSmXew4CSnnGaX0vZyYdNLCrlInvAUepCX6p5l5THc=\\\"
|
||||
|
||||
# Yahoo!JAPAN AppID: https://e.developer.yahoo.co.jp/dashboard/
|
||||
#DEFINES += CONFIG_YAHOO_ID=\\\"mRr.UCWxg65ZTZTR_Mz0OTtj3sJ7xa5K66ZOGp55cgJsIDDeaB6e1LDY1NpEZ_AfZA--\\\"
|
||||
|
||||
## Deploy
|
||||
# See: http://wiki.maemo.org/Packaging_a_Qt_application
|
||||
# See: http://www.developer.nokia.com/Community/Wiki/Creating_Debian_packages_for_Maemo_5_Qt_applications_and_showing_in_the_application_menu
|
||||
# See: https://wiki.kubuntu.org/PackagingGuide/QtApplication
|
||||
|
||||
#QMLDIR=$$DESTDIR/qml
|
||||
#LUADIR=$$DESTDIR/lua
|
||||
#DOCDIR=$$DESTDIR/doc
|
||||
#TABLEDIR=$$DESTDIR/table
|
||||
#IMAGEDIR=$$DESTDIR/images
|
||||
#JSFDIR=$$DESTDIR/jsf
|
||||
#AVATARDIR=$$DESTDIR/avatars
|
||||
|
||||
#unix:!mac {
|
||||
# isEmpty(PREFIX): PREFIX = /usr
|
||||
# BINDIR = $$PREFIX/bin
|
||||
# DATADIR = $$PREFIX/share
|
||||
#}
|
||||
#mac {
|
||||
# isEmpty(PREFIX): PREFIX = /opt/annot
|
||||
# BINDIR = $$PREFIX/bin
|
||||
# DATADIR = $$PREFIX/share
|
||||
#}
|
||||
#
|
||||
#!win32 {
|
||||
# DEFINES += \
|
||||
# BINDIR=\\\"$$BINDIR\\\" \
|
||||
# DATADIR=\\\"$$DATADIR\\\"
|
||||
#}
|
||||
#DEFINES += \
|
||||
# AVATARDIR=\\\"$$AVATARDIR\\\" \
|
||||
# DOCDIR=\\\"$$DOCDIR\\\" \
|
||||
# TABLEDIR=\\\"$$TABLEDIR\\\" \
|
||||
# IMAGEDIR=\\\"$$IMAGDIR\\\" \
|
||||
# LUADIR=\\\"$$LUADIR\\\" \
|
||||
# JSFDIR=\\\"$$JSFDIR\\\"
|
||||
|
||||
## External libraries
|
||||
|
||||
#win32 {
|
||||
# DEV_HOME = c:/dev
|
||||
# #DEV_HOME = B:/Developer
|
||||
# QT_HOME = c:/qt/qt4
|
||||
# QT_SRC = c:/qt
|
||||
# QT5_HOME = c:/qt/qt5
|
||||
# QT5_SRC = c:/qt
|
||||
# #VLC_HOME = "c:/Program Files/VideoLAN/VLC/sdk"
|
||||
# VLC_HOME = $$DEV_HOME/vlc
|
||||
# VLC_SRC = $$VLC_HOME/src
|
||||
# #WSF_HOME = $$DEV_HOME/wso2
|
||||
# #CDIO_HOME = $$DEV_HOME/cdio
|
||||
# #FFMPEG_HOME = $$DEV_HOME/ffmpeg
|
||||
# GPAC_HOME = $$DEV_HOME/gpac
|
||||
# MP4V2_HOME = $$DEV_HOME/mp4v2
|
||||
# LIVE_HOME = $$DEV_HOME/live
|
||||
# POPPLER_HOME = $$DEV_HOME/poppler
|
||||
# BOOST_HOME = $$DEV_HOME/boost
|
||||
# GSOAP_HOME = $$DEV_HOME/gsoap
|
||||
# GSOAP_SRC = $$DEV_HOME/gsoap/src
|
||||
# ZDEV_HOME = $$DEV_HOME/zlib
|
||||
# LUA_HOME = $$DEV_HOME/lua
|
||||
# FREETYPE_HOME = $$DEV_HOME/freetype
|
||||
# FONTCONFIG_HOME = $$DEV_HOME/fontconfig
|
||||
# MECAB_HOME = $$DEV_HOME/mecab
|
||||
# #LUA_VERSION = 52
|
||||
# #LUA_VERSION = 5.1
|
||||
# LUA_VERSION =
|
||||
#
|
||||
# ITH_HOME = $$DEV_HOME/ith
|
||||
#
|
||||
# WDK_HOME = c:/winddk/current
|
||||
#
|
||||
# INCLUDEPATH += $$DEV_HOME/inttypes/include
|
||||
#
|
||||
# INCLUDEPATH += $$ITH_HOME/include
|
||||
# LIBS += -L$$ITH_HOME/lib
|
||||
#
|
||||
# # wdk/inc/api/sal.h MUST be removed.
|
||||
# # See: http://stackoverflow.com/questions/1356653/multiple-compiling-errors-with-basic-c-application-on-vs2010-beta-1
|
||||
# # Select WinXP x86
|
||||
# INCLUDEPATH += $$WDK_HOME/inc
|
||||
# LIBS += -L$$WDK_HOME/lib/wxp/i386
|
||||
#}
|
||||
#
|
||||
#unix {
|
||||
# X11_HOME = /usr/X11
|
||||
# QT_HOME = /usr/share/qt4
|
||||
# QT_SRC =
|
||||
# VLC_HOME = /usr
|
||||
# VLC_SRC = ${HOME}/opt/src
|
||||
# #WSF_HOME = ${HOME}/opt/wso2/wsf
|
||||
# #CDIO_HOME = /usr
|
||||
# #FFMPEG_HOME = /usr
|
||||
# MECAB_HOME = /usr
|
||||
# GPAC_HOME = /usr
|
||||
# MP4V2_HOME = /usr
|
||||
# LIVE_HOME = /usr
|
||||
# POPPLER_HOME = ${HOME}/opt/poppler
|
||||
# BOOST_HOME = /usr
|
||||
# GSOAP_HOME = ${HOME}/opt/gsoap
|
||||
# GSOAP_SRC = ${HOME}/opt/src/gsoap
|
||||
# LUA_HOME = /usr
|
||||
# ZDEV_HOME = /usr
|
||||
# FREETYPE_HOME = $$X11_HOME
|
||||
# FONTCONFIG_HOME = $$X11_HOME
|
||||
# LUA_VERSION = 5.1
|
||||
#}
|
||||
#
|
||||
#mac {
|
||||
# SDK_HOME = /Developer/SDKs/MacOSX10.7.sdk
|
||||
# X11_HOME = $$SDK_HOME/usr/X11
|
||||
# MACPORTS_HOME = /opt/local
|
||||
# QT_HOME = ${HOME}/opt/qt
|
||||
# QT_SRC = ${HOME}/opt/src
|
||||
# QT5_HOME = ${HOME}/opt/qt5
|
||||
# QT5_SRC = ${HOME}/opt/src
|
||||
# #VLC_HOME = ${HOME}/opt/vlc
|
||||
# VLC_HOME = /Applications/VLC.app/Contents/MacOS
|
||||
# VLC_SRC = ${HOME}/opt/src
|
||||
# #WSF_HOME = ${HOME}/opt/wso2/wsf
|
||||
# #CDIO_HOME = ${HOME}/opt/libcdio
|
||||
# #FFMPEG_HOME = $$MACPORTS_HOME
|
||||
# GPAC_HOME = ${HOME}/opt/gpac
|
||||
# MP4V2_HOME = $$MACPORTS_HOME
|
||||
# MECAB_HOME = $$MACPORTS_HOME
|
||||
# LIVE_HOME = ${HOME}/opt/live
|
||||
# POPPLER_HOME = ${HOME}/opt/poppler
|
||||
# BOOST_HOME = $$MACPORTS_HOME
|
||||
# GSOAP_HOME = ${HOME}/opt/gsoap
|
||||
# GSOAP_SRC = ${HOME}/opt/src/gsoap
|
||||
# ZDEV_HOME = $$SDK_HOME/usr
|
||||
# FREETYPE_HOME = $$X11_HOME
|
||||
# FONTCONFIG_HOME = $$X11_HOME
|
||||
# #LUA_HOME = ${HOME}/opt/lua
|
||||
# LUA_HOME = $$MACPORTS_HOME
|
||||
# #LUA_VERSION = 52
|
||||
# LUA_VERSION =
|
||||
#}
|
||||
#
|
||||
#INCLUDEPATH += $$QT_SRC/qt/src
|
||||
##INCLUDEPATH += $$QT5_SRC/qt/src
|
||||
#
|
||||
#INCLUDEPATH += $$VLC_HOME/include
|
||||
#INCLUDEPATH += $$VLC_HOME/include/vlc/plugins
|
||||
##INCLUDEPATH += $$VLC_SRC/include
|
||||
#LIBS += -L$$VLC_HOME/lib
|
||||
##INCLUDEPATH += $$WSF_HOME/include
|
||||
##LIBS += -L$$WSF_HOME/lib
|
||||
##INCLUDEPATH += $$CDIO_HOME/include
|
||||
##LIBS += -L$$CDIO_HOME/lib
|
||||
##INCLUDEPATH += $$POPPLER_HOME/include/poppler/qt4
|
||||
##LIBS += -L$$POPPLER_HOME/lib
|
||||
#INCLUDEPATH += $$BOOST_HOME/include
|
||||
#LIBS += -L$$BOOST_HOME/lib
|
||||
#INCLUDEPATH += $$GSOAP_HOME/include
|
||||
##LIBS += -L$$GSOAP_HOME/lib
|
||||
#INCLUDEPATH += $$ZDEV_HOME/include
|
||||
#LIBS += -L$$ZDEV_HOME/lib
|
||||
#INCLUDEPATH += $$MECAB_HOME/include
|
||||
#LIBS += -L$$MECAB_HOME/lib
|
||||
#INCLUDEPATH += $$FREETYPE_HOME/include \
|
||||
# $$FREETYPE_HOME/include/freetype2
|
||||
#LIBS += -L$$FREETYPE_HOME/lib
|
||||
#INCLUDEPATH += $$FONTCONFIG_HOME/include
|
||||
#LIBS += -L$$FONTCONFIG_HOME/lib
|
||||
#INCLUDEPATH += $$LUA_HOME/include \
|
||||
# $$LUA_HOME/include/lua$$LUA_VERSION
|
||||
#LIBS += -L$$LUA_HOME/lib
|
||||
##INCLUDEPATH += $$FFMPEG_HOME/include
|
||||
##LIBS += -L$$FFMPEG_HOME/lib
|
||||
##INCLUDEPATH += $$GPAC_HOME/include
|
||||
##LIBS += -L$$GPAC_HOME/lib
|
||||
##INCLUDEPATH += $$MP4V2_HOME/include
|
||||
##LIBS += -L$$MP4V2_HOME/lib
|
||||
##INCLUDEPATH += \
|
||||
## $$LIVE_HOME/BasicUsageEnvironment/include \
|
||||
## $$LIVE_HOME/UsageEnvironment/include \
|
||||
## $$LIVE_HOME/groupsock/include \
|
||||
## $$LIVE_HOME/liveMedia/include
|
||||
# #$$LIVE_HOME/BasicUsageEnvironment $$LIVE_HOME/BasicUsageEnvironment/include \
|
||||
# #$$LIVE_HOME/UsageEnvironment $$LIVE_HOME/UsageEnvironment/include \
|
||||
# #$$LIVE_HOME/groupsock $$LIVE_HOME/groupsock/include \
|
||||
# #$$LIVE_HOME/liveMedia $$LIVE_HOME/liveMedia/include
|
||||
##LIBS += \
|
||||
## -L$$LIVE_HOME/BasicUsageEnvironment \
|
||||
## -L$$LIVE_HOME/UsageEnvironment \
|
||||
## -L$$LIVE_HOME/groupsock \
|
||||
## -L$$LIVE_HOME/liveMedia
|
||||
#
|
||||
#mac: INCLUDEPATH += $$SDK_HOME/usr/include
|
||||
|
||||
#
|
||||
# assistant.pro - Qt 4.7.3
|
||||
#
|
||||
#include(../../../shared/fontpanel/fontpanel.pri)
|
||||
#TEMPLATE = app
|
||||
#LANGUAGE = C++
|
||||
#TARGET = assistant
|
||||
#contains(QT_CONFIG, webkit):QT += webkit
|
||||
#CONFIG += qt \
|
||||
# warn_on \
|
||||
# help
|
||||
#QT += network
|
||||
#PROJECTNAME = Assistant
|
||||
#DESTDIR = ../../../../bin
|
||||
#target.path = $$[QT_INSTALL_BINS]
|
||||
#INSTALLS += target
|
||||
#DEPENDPATH += ../shared
|
||||
#
|
||||
## ## Work around a qmake issue when statically linking to
|
||||
## ## not-yet-installed plugins
|
||||
#QMAKE_LIBDIR += $$QT_BUILD_TREE/plugins/sqldrivers
|
||||
#HEADERS += aboutdialog.h \
|
||||
# bookmarkdialog.h \
|
||||
# bookmarkfiltermodel.h \
|
||||
# bookmarkitem.h \
|
||||
# bookmarkmanager.h \
|
||||
# bookmarkmanagerwidget.h \
|
||||
# bookmarkmodel.h \
|
||||
# centralwidget.h \
|
||||
# cmdlineparser.h \
|
||||
# contentwindow.h \
|
||||
# findwidget.h \
|
||||
# filternamedialog.h \
|
||||
# helpenginewrapper.h \
|
||||
# helpviewer.h \
|
||||
# indexwindow.h \
|
||||
# installdialog.h \
|
||||
# mainwindow.h \
|
||||
# preferencesdialog.h \
|
||||
# qtdocinstaller.h \
|
||||
# remotecontrol.h \
|
||||
# searchwidget.h \
|
||||
# topicchooser.h \
|
||||
# tracer.h \
|
||||
# xbelsupport.h \
|
||||
# ../shared/collectionconfiguration.h
|
||||
#contains(QT_CONFIG, webkit) {
|
||||
# HEADERS += helpviewer_qwv.h
|
||||
#} else {
|
||||
# HEADERS += helpviewer_qtb.h
|
||||
# }
|
||||
#win32:HEADERS += remotecontrol_win.h
|
||||
#
|
||||
#SOURCES += aboutdialog.cpp \
|
||||
# bookmarkdialog.cpp \
|
||||
# bookmarkfiltermodel.cpp \
|
||||
# bookmarkitem.cpp \
|
||||
# bookmarkmanager.cpp \
|
||||
# bookmarkmanagerwidget.cpp \
|
||||
# bookmarkmodel.cpp \
|
||||
# centralwidget.cpp \
|
||||
# cmdlineparser.cpp \
|
||||
# contentwindow.cpp \
|
||||
# findwidget.cpp \
|
||||
# filternamedialog.cpp \
|
||||
# helpenginewrapper.cpp \
|
||||
# helpviewer.cpp \
|
||||
# indexwindow.cpp \
|
||||
# installdialog.cpp \
|
||||
# main.cpp \
|
||||
# mainwindow.cpp \
|
||||
# preferencesdialog.cpp \
|
||||
# qtdocinstaller.cpp \
|
||||
# remotecontrol.cpp \
|
||||
# searchwidget.cpp \
|
||||
# topicchooser.cpp \
|
||||
# xbelsupport.cpp \
|
||||
# ../shared/collectionconfiguration.cpp
|
||||
# contains(QT_CONFIG, webkit) {
|
||||
# SOURCES += helpviewer_qwv.cpp
|
||||
#} else {
|
||||
# SOURCES += helpviewer_qtb.cpp
|
||||
#}
|
||||
#
|
||||
#FORMS += bookmarkdialog.ui \
|
||||
# bookmarkmanagerwidget.ui \
|
||||
# bookmarkwidget.ui \
|
||||
# filternamedialog.ui \
|
||||
# installdialog.ui \
|
||||
# preferencesdialog.ui \
|
||||
# topicchooser.ui
|
||||
#
|
||||
#RESOURCES += assistant.qrc \
|
||||
# assistant_images.qrc
|
||||
#
|
||||
#win32 {
|
||||
# !wince*:LIBS += -lshell32
|
||||
# RC_FILE = assistant.rc
|
||||
#}
|
||||
#
|
||||
#mac {
|
||||
# ICON = assistant.icns
|
||||
# TARGET = Assistant
|
||||
# QMAKE_INFO_PLIST = Info_mac.plist
|
||||
#}
|
||||
#
|
||||
#contains(CONFIG, static): {
|
||||
# SQLPLUGINS = $$unique(sql-plugins)
|
||||
# contains(SQLPLUGINS, sqlite): {
|
||||
# QTPLUGIN += qsqlite
|
||||
# DEFINES += USE_STATIC_SQLITE_PLUGIN
|
||||
# }
|
||||
#}
|
20
vnr/copy_vnr.cmd
Normal file
20
vnr/copy_vnr.cmd
Normal file
@ -0,0 +1,20 @@
|
||||
@echo off
|
||||
setlocal
|
||||
if [%1] == [] (
|
||||
echo usage: copy_vnr <path-to-Sakura-directory>
|
||||
goto :EOF
|
||||
)
|
||||
xcopy %1\config.pri . /S /Y /I
|
||||
xcopy %1\cpp\libs\ccutil ccutil /S /Y /I
|
||||
xcopy %1\cpp\libs\cpputil cpputil /S /Y /I
|
||||
xcopy %1\cpp\libs\disasm disasm /S /Y /I /EXCLUDE:exclude.txt
|
||||
xcopy %1\cpp\plugins\ith ith /S /Y /I
|
||||
xcopy %1\cpp\libs\memdbg memdbg /S /Y /I
|
||||
xcopy %1\cpp\libs\ntdll ntdll /S /Y /I
|
||||
xcopy %1\cpp\libs\ntinspect ntinspect /S /Y /I
|
||||
xcopy %1\cpp\libs\winmaker winmaker /S /Y /I
|
||||
xcopy %1\cpp\libs\winmutex winmutex /S /Y /I
|
||||
xcopy %1\cpp\libs\winversion winversion /S /Y /I
|
||||
xcopy %1\cpp\libs\winseh winseh /S /Y /I
|
||||
|
||||
endlocal
|
2
vnr/winmutex/winmutex
Normal file
2
vnr/winmutex/winmutex
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "winmutex/winmutex.h"
|
166
vnr/winmutex/winmutex.h
Normal file
166
vnr/winmutex/winmutex.h
Normal file
@ -0,0 +1,166 @@
|
||||
#pragma once
|
||||
// winmutex.h
|
||||
// 12/11/2011 jichi
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(disable:4800) // C4800: forcing value to bool
|
||||
#endif // _MSC_VER
|
||||
|
||||
// Mutex lock
|
||||
// The interface of this class is consistent with the mutex class
|
||||
|
||||
template <typename _Mutex>
|
||||
class win_mutex_lock
|
||||
{
|
||||
typedef win_mutex_lock<_Mutex> _Self;
|
||||
win_mutex_lock(const _Self&);
|
||||
_Self &operator=(const _Self&);
|
||||
|
||||
_Mutex &_M_mutex;
|
||||
bool _M_locked;
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
typedef typename _Mutex::native_handle_type native_handle_type;
|
||||
explicit win_mutex_lock(mutex_type &mutex)
|
||||
: _M_mutex(mutex), _M_locked(false) { lock(); }
|
||||
~win_mutex_lock() { if (_M_locked) _M_mutex.unlock(); }
|
||||
mutex_type &mutex() { return _M_mutex; }
|
||||
//bool isLock() const { return _M_locked; }
|
||||
native_handle_type native_handle() { return _M_mutex.native_handle(); }
|
||||
void unlock() { _M_mutex.unlock(); _M_locked = false; }
|
||||
void lock() { _M_mutex.lock(); _M_locked = true; }
|
||||
bool tryLock() { return _M_locked = _M_mutex.tryLock(); }
|
||||
};
|
||||
|
||||
// Mutex
|
||||
|
||||
template <typename _Mutex, size_t _Irql = 0>
|
||||
class win_mutex
|
||||
{
|
||||
typedef win_mutex<_Mutex> _Self;
|
||||
typedef _Mutex __native_type;
|
||||
enum { __minimal_irql = _Irql };
|
||||
__native_type _M_mutex;
|
||||
|
||||
win_mutex(const _Self&);
|
||||
_Self &operator=(const _Self&);
|
||||
private:
|
||||
win_mutex() {}
|
||||
typedef __native_type *native_handle_type;
|
||||
native_handle_type native_handle() { return &_M_mutex; }
|
||||
static size_t minimal_irql() { return __minimal_irql; }
|
||||
|
||||
void unlock() {}
|
||||
void lock() {}
|
||||
bool try_lock() {}
|
||||
};
|
||||
|
||||
template <>
|
||||
class IHFSERVICE win_mutex<CRITICAL_SECTION>
|
||||
{
|
||||
typedef win_mutex<CRITICAL_SECTION> _Self;
|
||||
typedef CRITICAL_SECTION __native_type;
|
||||
enum { __minimal_irql = 0 };
|
||||
win_mutex(const _Self&);
|
||||
_Self &operator=(const _Self&);
|
||||
|
||||
__native_type _M_mutex;
|
||||
public:
|
||||
typedef __native_type *native_handle_type;
|
||||
native_handle_type native_handle() { return &_M_mutex; }
|
||||
static size_t minimal_irql() { return __minimal_irql; }
|
||||
|
||||
win_mutex() { ::InitializeCriticalSection(&_M_mutex); }
|
||||
~win_mutex() { ::DeleteCriticalSection(&_M_mutex); }
|
||||
void lock() { ::EnterCriticalSection(&_M_mutex); }
|
||||
void unlock() { ::LeaveCriticalSection(&_M_mutex); }
|
||||
bool try_lock() { return ::TryEnterCriticalSection(&_M_mutex); }
|
||||
};
|
||||
|
||||
// Conditional variable
|
||||
|
||||
template <typename _Cond>
|
||||
class win_mutex_cond
|
||||
{
|
||||
typedef win_mutex_cond<_Cond> _Self;
|
||||
typedef _Cond __native_type;
|
||||
win_mutex_cond(const _Self&);
|
||||
_Self &operator=(const _Self&);
|
||||
|
||||
__native_type _M_cond;
|
||||
public:
|
||||
enum wait_status { no_timeout = 0, timeout };
|
||||
typedef __native_type *native_handle_type;
|
||||
|
||||
win_mutex_cond() {}
|
||||
native_handle_type native_handle() { return &_M_cond; }
|
||||
|
||||
void notify_one() {}
|
||||
void notify_all() {}
|
||||
|
||||
template <typename _Mutex>
|
||||
void wait(_Mutex &mutex) {}
|
||||
|
||||
template <typename _Mutex, typename _Pred>
|
||||
void wait(_Mutex &mutex, _Pred pred) {}
|
||||
|
||||
template <typename _Mutex>
|
||||
wait_status wait_for(_Mutex &mutex, int msecs) {}
|
||||
|
||||
template <typename _Mutex, typename _Pred>
|
||||
wait_status wait_for(_Mutex &mutex, int msecs, _Pred pred) {}
|
||||
};
|
||||
|
||||
// Note: Conditional variables are NOT availabe on Windows XP/2003
|
||||
// See: http://en.cppreference.com/w/cpp/thread/condition_variable
|
||||
// See: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686903%28v=vs.85%29.aspx
|
||||
template <>
|
||||
class win_mutex_cond<CONDITION_VARIABLE>
|
||||
{
|
||||
typedef win_mutex_cond<CONDITION_VARIABLE> _Self;
|
||||
typedef CONDITION_VARIABLE __native_type;
|
||||
win_mutex_cond(const _Self&);
|
||||
_Self &operator=(const _Self&);
|
||||
|
||||
__native_type _M_cond;
|
||||
public:
|
||||
enum wait_status { no_timeout = 0, timeout };
|
||||
typedef __native_type *native_handle_type;
|
||||
native_handle_type native_handle() { return &_M_cond; }
|
||||
|
||||
win_mutex_cond() { ::InitializeConditionVariable(&_M_cond); }
|
||||
|
||||
void notify_one() { ::WakeConditionVariable(&_M_cond); }
|
||||
void notify_all() { ::WakeAllConditionVariable(&_M_cond); }
|
||||
|
||||
template <typename _Mutex>
|
||||
void wait(_Mutex &mutex)
|
||||
{ ::SleepConditionVariableCS(&_M_cond, mutex.native_handle(), INFINITE); }
|
||||
|
||||
template <typename _Mutex, typename _Pred>
|
||||
void wait(_Mutex &mutex, _Pred pred)
|
||||
{ while (!pred()) wait(mutex); }
|
||||
|
||||
template <typename _Mutex>
|
||||
wait_status wait_for(_Mutex &mutex, int msecs)
|
||||
{ return ::SleepConditionVariableCS(&_M_cond, mutex.native_handle(), msecs) ? no_timeout : timeout; }
|
||||
|
||||
template <typename _Mutex, typename _Pred>
|
||||
wait_status wait_for(_Mutex &mutex, int msecs, _Pred pred)
|
||||
{
|
||||
auto start = ::GetTickCount();
|
||||
while (!pred()) {
|
||||
auto now = ::GetTickCount();
|
||||
msecs -= now - start;
|
||||
if (msecs <= 0)
|
||||
return timeout;
|
||||
start = now;
|
||||
wait_for(mutex, msecs);
|
||||
}
|
||||
return no_timeout;
|
||||
}
|
||||
};
|
||||
|
||||
// EOF
|
13
vnr/winmutex/winmutex.pri
Normal file
13
vnr/winmutex/winmutex.pri
Normal file
@ -0,0 +1,13 @@
|
||||
# winmutex.pri
|
||||
# 3/8/2013 jichi
|
||||
|
||||
DEFINES += WITH_LIB_WINMUTEX
|
||||
|
||||
DEPENDPATH += $$PWD
|
||||
#LIBS += -lkernel32 -luser32
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/winmutex \
|
||||
$$PWD/winmutex.h
|
||||
|
||||
# EOF
|
26
vnr/winseh/Makefile
Normal file
26
vnr/winseh/Makefile
Normal file
@ -0,0 +1,26 @@
|
||||
# Makefile
|
||||
# 12/13/2013 jichi
|
||||
# This file is for Windows only.
|
||||
# Compile SAFESEH table from the ASM file.
|
||||
# See: http://stackoverflow.com/questions/19722308/exception-handler-not-called-in-c
|
||||
# See: ::http://stackoverflow.com/questions/12019689/custom-seh-handler-with-safeseh
|
||||
# See: http://msdn.microsoft.com/en-us/library/16aexws6.aspx
|
||||
|
||||
BUILDDIR = ../../../build
|
||||
OBJ = $(BUILDDIR)/safeseh.obj
|
||||
|
||||
ML = ml
|
||||
CFLAGS =
|
||||
|
||||
.PHONY: all compile clean
|
||||
|
||||
all: compile
|
||||
|
||||
compile: $(OBJ)
|
||||
|
||||
$(OBJ): safeseh.asm
|
||||
$(ML) $(CFLAGS) -Fo $@ -c -safeseh $^
|
||||
|
||||
clean:
|
||||
|
||||
# EOF
|
21
vnr/winseh/safeseh.asm
Normal file
21
vnr/winseh/safeseh.asm
Normal file
@ -0,0 +1,21 @@
|
||||
; safeseh.asm
|
||||
; 12/13/2013 jichi
|
||||
; see: http://stackoverflow.com/questions/12019689/custom-seh-handler-with-safeseh
|
||||
; see: http://code.metager.de/source/xref/WebKit/Source/WebCore/platform/win/makesafeseh.asm
|
||||
; see: http://jpassing.com/2008/05/20/fun-with-low-level-seh/
|
||||
.386
|
||||
.model flat, stdcall
|
||||
option casemap :none
|
||||
|
||||
; The symbol name can be found out using: dumpbin /symbols winseh.obj
|
||||
extern _seh_handler:near ; defined in winseh.cc
|
||||
|
||||
_seh_asm_handler proto
|
||||
.safeseh _seh_asm_handler
|
||||
|
||||
.code
|
||||
_seh_asm_handler proc
|
||||
jmp _seh_handler
|
||||
_seh_asm_handler endp
|
||||
|
||||
end
|
52
vnr/winseh/winseh.cc
Normal file
52
vnr/winseh/winseh.cc
Normal file
@ -0,0 +1,52 @@
|
||||
// winseh.cc
|
||||
// 12/13/2013 jichi
|
||||
|
||||
#include "winseh/winseh.h"
|
||||
#include "ntdll/ntdll.h"
|
||||
//#include <cstdio>
|
||||
|
||||
// - Global variables -
|
||||
|
||||
seh_dword_t seh_esp[seh_capacity],
|
||||
seh_eip[seh_capacity],
|
||||
seh_eh[seh_capacity];
|
||||
seh_dword_t seh_count;
|
||||
|
||||
// - Exception handlers -
|
||||
|
||||
// VC 2013: http://msdn.microsoft.com/en-us/library/b6sf5kbd.aspx
|
||||
// typedef EXCEPTION_DISPOSITION (*PEXCEPTION_ROUTINE) (
|
||||
// _In_ PEXCEPTION_RECORD ExceptionRecord,
|
||||
// _In_ ULONG64 EstablisherFrame,
|
||||
// _Inout_ PCONTEXT ContextRecord,
|
||||
// _Inout_ PDISPATCHER_CONTEXT DispatcherContext
|
||||
// );
|
||||
//
|
||||
// winnt.h: http://www.codemachine.com/downloads/win81/ntdef.h
|
||||
// typedef
|
||||
// __drv_sameIRQL
|
||||
// __drv_functionClass(EXCEPTION_ROUTINE)
|
||||
// EXCEPTION_DISPOSITION
|
||||
// NTAPI
|
||||
// EXCEPTION_ROUTINE (
|
||||
// _Inout_ struct _EXCEPTION_RECORD *ExceptionRecord,
|
||||
// _In_ PVOID EstablisherFrame,
|
||||
// _In_ struct _CONTEXT *ContextRecord,
|
||||
// _In_ PVOID DispatcherContext
|
||||
// );
|
||||
extern "C" EXCEPTION_DISPOSITION _seh_handler( // extern C is needed to avoid name hashing in C++
|
||||
_In_ PEXCEPTION_RECORD ExceptionRecord,
|
||||
_In_ PVOID EstablisherFrame, // does not work if I use ULONG64
|
||||
_Inout_ PCONTEXT ContextRecord,
|
||||
_In_ PVOID DispatcherContext) // PDISPATCHER_CONTEXT is not declared in windows.h
|
||||
{
|
||||
//assert(::seh_count > 0);
|
||||
ContextRecord->Esp = ::seh_esp[::seh_count - 1];
|
||||
ContextRecord->Eip = ::seh_eip[::seh_count - 1];
|
||||
//printf("seh_handler:%i,%x,%x\n", ::seh_count, ContextRecord->Esp, ContextRecord->Eip);
|
||||
return ::seh_eh[::seh_count - 1] ?
|
||||
reinterpret_cast<PEXCEPTION_ROUTINE>(::seh_eh[::seh_count - 1])(ExceptionRecord, EstablisherFrame, ContextRecord, DispatcherContext) :
|
||||
ExceptionContinueExecution;
|
||||
}
|
||||
|
||||
// EOF
|
150
vnr/winseh/winseh.h
Normal file
150
vnr/winseh/winseh.h
Normal file
@ -0,0 +1,150 @@
|
||||
#pragma once
|
||||
|
||||
// winseh.h
|
||||
// 12/13/2013 jichi
|
||||
// See: http://code.metager.de/source/xref/WebKit/Source/WebCore/platform/win/makesafeseh.asm
|
||||
// See: http://jpassing.com/2008/05/20/fun-with-low-level-seh/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (disable:4733) // C4733: Inline asm assigning to 'FS:0' : handler not registered as safe handler
|
||||
#endif // _MSC_VER
|
||||
|
||||
#define SEH_RAISE (*(int*)0 = 0) // raise C000005, for debugging only
|
||||
|
||||
// Maximum number of nested SEH
|
||||
// Default nested function count is 100, see: http://stackoverflow.com/questions/8656089/solution-for-fatal-error-maximum-function-nesting-level-of-100-reached-abor
|
||||
#ifndef SEH_CAPACITY
|
||||
# define SEH_CAPACITY 100
|
||||
#endif // SEH_CAPACITY
|
||||
|
||||
enum { seh_capacity = SEH_CAPACITY };
|
||||
|
||||
typedef unsigned long seh_dword_t; // DWORD in <windows.h>
|
||||
|
||||
// 12/13/2013 jichi
|
||||
// The list implementation is not thread-safe
|
||||
extern seh_dword_t seh_esp[seh_capacity], // LPVOID, current stack
|
||||
seh_eip[seh_capacity], // LPVOID, current IP address
|
||||
seh_eh[seh_capacity]; // EXCEPTION_ROUTINE, current exception handler function address
|
||||
extern seh_dword_t seh_count; // current number of exception handlers
|
||||
extern seh_dword_t seh_handler; //extern PEXCEPTION_ROUTINE seh_handler;
|
||||
|
||||
/**
|
||||
* Push SEH handler
|
||||
* @param _label exception recover label which should be the same as seh_pop_
|
||||
* @param _eh EXCEPTION_ROUTINE or 0
|
||||
* @param _r1 scalar register name, such as eax
|
||||
* @param _r2 counter register name, such as ecx
|
||||
*
|
||||
* Note: __asm prefix is needed to allow inlining macro
|
||||
* I didn't pushad and popad which seems to be not needed
|
||||
*
|
||||
* For SEH, see:
|
||||
* http://www.codeproject.com/Articles/82701/Win32-Exceptions-OS-Level-Point-of-View
|
||||
* http://sploitfun.blogspot.com/2012/08/seh-exploit-part1.html
|
||||
* http://sploitfun.blogspot.com/2012/08/seh-exploit-part2.html
|
||||
*
|
||||
* fs:0x0 on Windows is the pointer to ExceptionList
|
||||
* http://stackoverflow.com/questions/4657661/what-lies-at-fs0x0-on-windows
|
||||
*
|
||||
* EPB and ESP
|
||||
* http://stackoverflow.com/questions/1395591/what-is-exactly-the-base-pointer-and-stack-pointer-to-what-do-they-point
|
||||
*/
|
||||
#define seh_push_(_label, _eh, _r1, _r2) \
|
||||
{ \
|
||||
__asm mov _r1, _eh /* move new handler address */ \
|
||||
__asm mov _r2, seh_count /* get current seh counter */ \
|
||||
__asm mov dword ptr seh_eh[_r2*4], _r1 /* set recover exception hander */ \
|
||||
__asm mov _r1, _label /* move jump label address */ \
|
||||
__asm mov dword ptr seh_eip[_r2*4], _r1 /* set recover eip as the jump label */ \
|
||||
__asm push seh_handler /* push new safe seh handler */ \
|
||||
__asm push fs:[0] /* push old fs:0 */ \
|
||||
__asm mov dword ptr seh_esp[_r2*4], esp /* safe current stack address */ \
|
||||
__asm mov fs:[0], esp /* change fs:0 to the current stack */ \
|
||||
__asm inc seh_count /* increase number of seh */ \
|
||||
}
|
||||
//TODO: get sizeof dword instead of hardcode 4
|
||||
|
||||
/**
|
||||
* Restore old SEH handler
|
||||
* @param _label exception recover label which should be the same as seh_push_
|
||||
*/
|
||||
#define seh_pop_(_label) \
|
||||
{ \
|
||||
__asm _label: /* the exception recover label */ \
|
||||
__asm pop dword ptr fs:[0] /* restore old fs:0 */ \
|
||||
__asm add esp, 4 /* pop seh_handler */ \
|
||||
__asm dec seh_count /* decrease number of seh */ \
|
||||
}
|
||||
|
||||
#define seh_pop() seh_pop_(seh_exit)
|
||||
#define seh_push() seh_push_(seh_exit, 0, eax, ecx) // use ecx as counter better than ebx
|
||||
|
||||
/**
|
||||
* @param _eh EXCEPTION_ROUTINE or 0
|
||||
*/
|
||||
#define seh_push_eh(_eh) seh_push_(seh_exit, _eh, eax, ecx)
|
||||
|
||||
/**
|
||||
* Wrap the code block with SEH handler
|
||||
* @param* any code block. The colon for the last expression is optional.
|
||||
*/
|
||||
#define seh_with(...) \
|
||||
{ \
|
||||
seh_push() \
|
||||
__VA_ARGS__ \
|
||||
; \
|
||||
seh_pop() \
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap the code block with SEH handler
|
||||
* @param _eh EXCEPTION_ROUTINE or 0
|
||||
* @param* any code block. The colon for the last expression is optional.
|
||||
*/
|
||||
#define seh_with_eh(_eh, ...) \
|
||||
{ \
|
||||
seh_push_eh(_eh) \
|
||||
__VA_ARGS__ \
|
||||
; \
|
||||
seh_pop() \
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
//#define seh_push_front() \
|
||||
// { \
|
||||
// __asm mov eax, seh_exit \
|
||||
// __asm mov seh_eip, eax \
|
||||
// __asm push seh_handler \
|
||||
// __asm push fs:[0] \
|
||||
// __asm mov seh_esp, esp \
|
||||
// __asm mov fs:[0], esp \
|
||||
// }
|
||||
//
|
||||
//#define seh_pop_front() \
|
||||
// { \
|
||||
// __asm seh_exit: \
|
||||
// __asm mov eax, [esp] \
|
||||
// __asm mov fs:[0], eax \
|
||||
// __asm add esp, 8 \
|
||||
// }
|
||||
//
|
||||
//#define seh_push_back() \
|
||||
// { \
|
||||
// __asm mov eax, seh_exit \
|
||||
// __asm mov ecx, seh_capacity - 1 \
|
||||
// __asm mov DWORD PTR seh_eip[ecx*4], eax \
|
||||
// __asm push seh_handler \
|
||||
// __asm push fs:[0] \
|
||||
// __asm mov DWORD PTR seh_esp[ecx*4], esp \
|
||||
// __asm mov fs:[0], esp \
|
||||
// }
|
||||
//
|
||||
//#define seh_pop_back() \
|
||||
// { \
|
||||
// __asm seh_exit: \
|
||||
// __asm mov eax, [esp] \
|
||||
// __asm mov fs:[0], eax \
|
||||
// __asm add esp, 8 \
|
||||
// }
|
10
vnr/winseh/winseh_safe.cc
Normal file
10
vnr/winseh/winseh_safe.cc
Normal file
@ -0,0 +1,10 @@
|
||||
// winseh_safe.cc
|
||||
// 12/13/2013 jichi
|
||||
// See: http://stackoverflow.com/questions/12019689/custom-seh-handler-with-safeseh
|
||||
|
||||
#include "winseh/winseh.h"
|
||||
|
||||
extern "C" int __stdcall _seh_asm_handler();
|
||||
seh_dword_t seh_handler = reinterpret_cast<seh_dword_t>(_seh_asm_handler);
|
||||
|
||||
// EOF
|
29
vnr/winseh/winseh_safe.pri
Normal file
29
vnr/winseh/winseh_safe.pri
Normal file
@ -0,0 +1,29 @@
|
||||
# winseh_safe.pri
|
||||
# 12/13/2013 jichi
|
||||
#
|
||||
# Need link with with SEH assembly
|
||||
# See: http://stackoverflow.com/questions/12019689/custom-seh-handler-with-safeseh
|
||||
# See: http://stackoverflow.com/questions/19722308/exception-handler-not-called-in-c
|
||||
win32 {
|
||||
#include(../../../config.pri)
|
||||
|
||||
# Disable buffer security check: http://msdn.microsoft.com/en-us/library/8dbf701c.aspx
|
||||
#QMAKE_CXXFLAGS += /GS-
|
||||
|
||||
LIBS += safeseh.obj # compiled from safeseh.asm using ml -safeseh
|
||||
|
||||
DEFINES += WITH_LIB_WINSEH
|
||||
|
||||
DEPENDPATH += $$PWD
|
||||
|
||||
HEADERS += $$PWD/winseh.h
|
||||
SOURCES += \
|
||||
$$PWD/winseh.cc \
|
||||
$$PWD/winseh_safe.cc
|
||||
|
||||
OTHER_FILES += \
|
||||
$$PWD/safeseh.asm \
|
||||
$$PWD/Makefile
|
||||
}
|
||||
|
||||
# EOF
|
11
vnr/winseh/winseh_unsafe.cc
Normal file
11
vnr/winseh/winseh_unsafe.cc
Normal file
@ -0,0 +1,11 @@
|
||||
// winseh_unsafe.cc
|
||||
// 12/13/2013 jichi
|
||||
// See: http://stackoverflow.com/questions/19722308/exception-handler-not-called-in-c
|
||||
|
||||
#include "winseh/winseh.h"
|
||||
#include <windows.h>
|
||||
|
||||
extern "C" EXCEPTION_DISPOSITION _seh_handler(PEXCEPTION_RECORD, PVOID, PCONTEXT, PVOID);
|
||||
seh_dword_t seh_handler = reinterpret_cast<seh_dword_t>(_seh_handler);
|
||||
|
||||
// EOF
|
Loading…
x
Reference in New Issue
Block a user