From 4a332ccfbd5d1b6cf0fa21eab957cfeeddd6b802 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 22 Apr 2018 03:06:19 -0400 Subject: [PATCH 1/7] add VS folder to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e8951bb..2c690ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -gui/command.cpp \ No newline at end of file +gui/command.cpp +.vs/ \ No newline at end of file From 011fec97cf9a3e3551381967072c8247347d8a9a Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 22 Apr 2018 03:07:04 -0400 Subject: [PATCH 2/7] remove clearly unneeded files (qmake and unused stuff) --- vnr/ccutil/ccutil.pri | 11 - vnr/config.pri | 596 ------------------------------- vnr/cpputil/cpputil.pri | 18 - vnr/disasm/disasm.pri | 13 - vnr/disasm/disasm.pro | 16 - vnr/hashutil/hashutil.pri | 11 - vnr/ithsys/ithsys.pri | 13 - vnr/ithsys/ithsys.pro | 52 --- vnr/memdbg/memdbg.pri | 17 - vnr/mono/mono.pri | 12 - vnr/ntdll/ntdll.pri | 10 - vnr/ntinspect/ntinspect.pri | 16 - vnr/sakurakit/sakurakit.pri | 62 ---- vnr/texthook/host/host.pri | 23 -- vnr/texthook/texthook.pri | 20 -- vnr/texthook/texthook.pro | 61 ---- vnr/texthook/texthook_static.pri | 73 ---- vnr/vnrhook/TRASH/dllconfig.pri | 35 -- vnr/vnrhook/TRASH/hookxp.pro | 61 ---- vnr/vnrhook/TRASH/memory.h | 46 --- vnr/vnrhook/TRASH/string.h | 36 -- vnr/vnrhook/TRASH/xp.txt | 11 - vnr/vnrhook/vnrhook.pri | 12 - vnr/vnrhook/vnrhook.pro | 80 ----- vnr/windbg/windbg.pri | 26 -- vnr/winkey/winkey.pri | 15 - vnr/winmaker/winmaker.pri | 15 - vnr/winmutex/winmutex | 2 - vnr/winmutex/winmutex.pri | 13 - vnr/winseh/winseh_safe.pri | 29 -- vnr/winseh/winseh_unsafe.pri | 18 - vnr/wintimer/wintimer.pri | 20 -- vnr/wintimer/wintimer.pro | 22 -- vnr/winversion/winversion.pri | 14 - 34 files changed, 1479 deletions(-) delete mode 100644 vnr/ccutil/ccutil.pri delete mode 100644 vnr/config.pri delete mode 100644 vnr/cpputil/cpputil.pri delete mode 100644 vnr/disasm/disasm.pri delete mode 100644 vnr/disasm/disasm.pro delete mode 100644 vnr/hashutil/hashutil.pri delete mode 100644 vnr/ithsys/ithsys.pri delete mode 100644 vnr/ithsys/ithsys.pro delete mode 100644 vnr/memdbg/memdbg.pri delete mode 100644 vnr/mono/mono.pri delete mode 100644 vnr/ntdll/ntdll.pri delete mode 100644 vnr/ntinspect/ntinspect.pri delete mode 100644 vnr/sakurakit/sakurakit.pri delete mode 100644 vnr/texthook/host/host.pri delete mode 100644 vnr/texthook/texthook.pri delete mode 100644 vnr/texthook/texthook.pro delete mode 100644 vnr/texthook/texthook_static.pri delete mode 100644 vnr/vnrhook/TRASH/dllconfig.pri delete mode 100644 vnr/vnrhook/TRASH/hookxp.pro delete mode 100644 vnr/vnrhook/TRASH/memory.h delete mode 100644 vnr/vnrhook/TRASH/string.h delete mode 100644 vnr/vnrhook/TRASH/xp.txt delete mode 100644 vnr/vnrhook/vnrhook.pri delete mode 100644 vnr/vnrhook/vnrhook.pro delete mode 100644 vnr/windbg/windbg.pri delete mode 100644 vnr/winkey/winkey.pri delete mode 100644 vnr/winmaker/winmaker.pri delete mode 100644 vnr/winmutex/winmutex delete mode 100644 vnr/winmutex/winmutex.pri delete mode 100644 vnr/winseh/winseh_safe.pri delete mode 100644 vnr/winseh/winseh_unsafe.pri delete mode 100644 vnr/wintimer/wintimer.pri delete mode 100644 vnr/wintimer/wintimer.pro delete mode 100644 vnr/winversion/winversion.pri diff --git a/vnr/ccutil/ccutil.pri b/vnr/ccutil/ccutil.pri deleted file mode 100644 index b981050..0000000 --- a/vnr/ccutil/ccutil.pri +++ /dev/null @@ -1,11 +0,0 @@ -# ccutil.pri -# 1/31/2012 jichi - -DEFINES += WITH_LIB_CCUTIL - -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/ccmacro.h - -# EOF diff --git a/vnr/config.pri b/vnr/config.pri deleted file mode 100644 index 7e7c2a7..0000000 --- a/vnr/config.pri +++ /dev/null @@ -1,596 +0,0 @@ -# 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 = "C:/Program Files/Microsoft DirectX SDK" - DETOURS_HOME = "C:/Program Files/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 = $$DEV_HOME/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 safe 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 -# } -#} diff --git a/vnr/cpputil/cpputil.pri b/vnr/cpputil/cpputil.pri deleted file mode 100644 index 4a354a6..0000000 --- a/vnr/cpputil/cpputil.pri +++ /dev/null @@ -1,18 +0,0 @@ -# cpputil.pri -# 9/26/2012 jichi - -DEFINES += WITH_LIB_CPPUTIL - -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/cppcstring.h \ - $$PWD/cpplocale.h \ - $$PWD/cppmarshal.h \ - $$PWD/cpppath.h \ - $$PWD/cppregex.h \ - $$PWD/cppstring.h \ - $$PWD/cpptype.h \ - $$PWD/cppunicode.h - -# EOF diff --git a/vnr/disasm/disasm.pri b/vnr/disasm/disasm.pri deleted file mode 100644 index 6f83e8f..0000000 --- a/vnr/disasm/disasm.pri +++ /dev/null @@ -1,13 +0,0 @@ -# disasm.pri -# 1/31/2012 jichi -win32 { - -DEFINES += WITH_LIB_DISASM -LIBS += -ldisasm -DEPENDPATH += $$PWD -HEADERS += $$PWD/disasm.h -#SOURCES += $$PWD/disasm.cc - -} - -# EOF diff --git a/vnr/disasm/disasm.pro b/vnr/disasm/disasm.pro deleted file mode 100644 index 00833ae..0000000 --- a/vnr/disasm/disasm.pro +++ /dev/null @@ -1,16 +0,0 @@ -# sys.pro -# 8/21/2013 jichi -# Build ITH_engine.dll - -CONFIG += noqt noeh staticlib -include(../../../config.pri) - -## Sources - -TEMPLATE = lib -TARGET = disasm - -HEADERS += disasm.h -SOURCES += disasm.cc - -# EOF diff --git a/vnr/hashutil/hashutil.pri b/vnr/hashutil/hashutil.pri deleted file mode 100644 index 7ffca52..0000000 --- a/vnr/hashutil/hashutil.pri +++ /dev/null @@ -1,11 +0,0 @@ -# hashutil.pri -# 6/28/2011 jichi - -DEFINES += WITH_LIB_HASHUTIL -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/hashstr.h \ - $$PWD/hashutil.h - -# EOF diff --git a/vnr/ithsys/ithsys.pri b/vnr/ithsys/ithsys.pri deleted file mode 100644 index 7653038..0000000 --- a/vnr/ithsys/ithsys.pri +++ /dev/null @@ -1,13 +0,0 @@ -# ithsys.pri -# 8/21/2013 jichi - -DEFINES += WITH_LIB_ITHSYS -LIBS += -lithsys -DEPENDPATH += $$PWD -HEADERS += $$PWD/ithsys.h -#SOURCES += $$PWD/ithsys.cc - -#include($$LIBDIR/winddk/winddk.pri) -#LIBS += -L$$WDK/lib/wxp/i386 - -# EOF diff --git a/vnr/ithsys/ithsys.pro b/vnr/ithsys/ithsys.pro deleted file mode 100644 index 954d181..0000000 --- a/vnr/ithsys/ithsys.pro +++ /dev/null @@ -1,52 +0,0 @@ -# ithsys.pro -# 8/21/2013 jichi -# Build ithsys.lib - -#CONFIG += noqt noeh staticlib -CONFIG += noqt staticlib - -include(../../../config.pri) -include($$LIBDIR/ntdll/ntdll.pri) - -#LIBS += -L$$WDK7_HOME/lib/wxp/i386 -lntdll - -#include($$LIBDIR/winddk/winddk.pri) -#LIBS += -L$$WDK/lib/wxp/i386 - -# jichi 9/22/2013: When ITH is on wine, certain NT functions are replaced -#DEFINES += ITH_WINE - -# jichi 7/12/2015: Always enable SEH -DEFINES += ITH_HAS_SEH - -# jichi 11/24/2013: Disable manual heap -DEFINES -= ITH_HAS_HEAP - -## Libraries - -#INCLUDEPATH += $$ITH_HOME/include -#INCLUDEPATH += $$WDK7_HOME/inc/ddk - -#LIBS += -lgdi32 -luser32 -lkernel32 -#LIBS += -L$$WDK7_HOME/lib/wxp/i386 -lntdll -#LIBS += $$WDK7_HOME/lib/crt/i386/msvcrt.lib # Override msvcrt10 - -#DEFINES += ITH_HAS_CXX - -#LIBS += -lith_sys -lntdll -#LIBS += -lith_tls -lntdll -#LIBS += -lntoskrnl - -DEFINES += _CRT_NON_CONFORMING_SWPRINTFS - -## Sources - -TEMPLATE = lib -TARGET = ithsys - -HEADERS += ithsys.h -SOURCES += ithsys.cc - -OTHER_FILES += ithsys.pri - -# EOF diff --git a/vnr/memdbg/memdbg.pri b/vnr/memdbg/memdbg.pri deleted file mode 100644 index 3c4b0db..0000000 --- a/vnr/memdbg/memdbg.pri +++ /dev/null @@ -1,17 +0,0 @@ -# ntinspect.pri -# 4/20/2014 jichi -win32 { - -DEFINES += WITH_LIB_MEMDBG - -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/memdbg.h \ - $$PWD/memsearch.h - -SOURCES += \ - $$PWD/memsearch.cc -} - -# EOF diff --git a/vnr/mono/mono.pri b/vnr/mono/mono.pri deleted file mode 100644 index 69ae806..0000000 --- a/vnr/mono/mono.pri +++ /dev/null @@ -1,12 +0,0 @@ -# mono.pri -# 9/26/2012 jichi - -DEFINES += WITH_LIB_MONO - -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/monoobject.h \ - $$PWD/monotype.h - -# EOF diff --git a/vnr/ntdll/ntdll.pri b/vnr/ntdll/ntdll.pri deleted file mode 100644 index 721ac2d..0000000 --- a/vnr/ntdll/ntdll.pri +++ /dev/null @@ -1,10 +0,0 @@ -# ntdll.pri -# 4/9/2012 jichi - -DEFINES += WITH_LIB_NTDLL - -DEPENDPATH += $$PWD - -HEADERS += $$PWD/ntdll.h - -# EOF diff --git a/vnr/ntinspect/ntinspect.pri b/vnr/ntinspect/ntinspect.pri deleted file mode 100644 index e061db8..0000000 --- a/vnr/ntinspect/ntinspect.pri +++ /dev/null @@ -1,16 +0,0 @@ -# ntinspect.pri -# 4/20/2014 jichi -win32 { - -DEFINES += WITH_LIB_NTINSPECT - -DEPENDPATH += $$PWD - -HEADERS += $$PWD/ntinspect.h -SOURCES += $$PWD/ntinspect.cc - -LIBS += -L$$WDK7_HOME/lib/wxp/i386 -lntdll - -} - -# EOF diff --git a/vnr/sakurakit/sakurakit.pri b/vnr/sakurakit/sakurakit.pri deleted file mode 100644 index 71fe17b..0000000 --- a/vnr/sakurakit/sakurakit.pri +++ /dev/null @@ -1,62 +0,0 @@ -# sakurakit.pri -# 6/28/2011 jichi -# -# config: -# - sakurakit_qml -# - sakurakit_gui -# - sakurakit_widgets - -DEFINES += WITH_LIB_SAKURAKIT -DEPENDPATH += $$PWD - -#QT += core -HEADERS += \ - $$PWD/skautorun.h \ - $$PWD/skdebug.h \ - $$PWD/skglobal.h \ - $$PWD/skhash.h - -#CONFIG(sakurakit_gui) { -# DEFINES += SK_ENABLE_GUI -# QT += gui -# HEADERS += \ -# $$PWD/skuiutil.h -# -# CONFIG(sakurakit_qml) { -# DEFINES += SK_ENABLE_QML -# QT += qml quick -# HEADERS += \ -# $$PWD/skdraggablequickview.h -# SOURCES += \ -# $$PWD/skdraggablequickview.cc -# } -# -# CONFIG(sakurakit_widgets) { -# DEFINES += SK_ENABLE_WIDGETS -# QT += widgets -# HEADERS += \ -# $$PWD/skdraggabledialog.h \ -# $$PWD/skdraggablemainwindow.h \ -# $$PWD/skdraggablewidget.h \ -# $$PWD/skpushbutton.h \ -# $$PWD/sksystemtrayicon.h \ -# $$PWD/sktoolbutton.h \ -# $$PWD/skwindowcontainer.h -# SOURCES += \ -# $$PWD/skdraggablewidget.cc \ -# $$PWD/skpushbutton.cc \ -# $$PWD/sktoolbutton.cc \ -# $$PWD/skwindowcontainer.cc \ -# $$PWD/skdraggabledialog.cc \ -# $$PWD/skdraggablemainwindow.cc -# -# CONFIG(sakurakit_qml) { -# HEADERS += \ -# $$PWD/skquickwidget.h -# SOURCES += \ -# $$PWD/skquickwidget.cc -# } -# } -#} - -# EOF diff --git a/vnr/texthook/host/host.pri b/vnr/texthook/host/host.pri deleted file mode 100644 index 73ffeb0..0000000 --- a/vnr/texthook/host/host.pri +++ /dev/null @@ -1,23 +0,0 @@ -# host.pri -# 8/9/2011 jichi - -DEFINES += WITH_LIB_VNRHOST - -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/avl_p.h \ - $$PWD/hookman.h \ - $$PWD/settings.h \ - $$PWD/host.h \ - $$PWD/host_p.h \ - $$PWD/textthread.h \ - $$PWD/textthread_p.h - -SOURCES += \ - $$PWD/hookman.cc \ - $$PWD/host.cc \ - $$PWD/pipe.cc \ - $$PWD/textthread.cc - -# EOF diff --git a/vnr/texthook/texthook.pri b/vnr/texthook/texthook.pri deleted file mode 100644 index 064aed9..0000000 --- a/vnr/texthook/texthook.pri +++ /dev/null @@ -1,20 +0,0 @@ -# texthook.pri -# 10/13/2011 jichi - -DEFINES += WITH_LIB_TEXTHOOK - -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -QT += core -LIBS += -ltexthook - -HEADERS += \ - $$PWD/texthook_config.h - -# texthook.h should not be in HEADERS, or it will be processed by moc -OTHER_FILES += \ - $$PWD/texthook.h \ - $$PWD/texthook.pro - -# EOF diff --git a/vnr/texthook/texthook.pro b/vnr/texthook/texthook.pro deleted file mode 100644 index bc7f05c..0000000 --- a/vnr/texthook/texthook.pro +++ /dev/null @@ -1,61 +0,0 @@ -# texthook.pro -# 10/13/2011 jichi -# Build ith texthook dll. - -CONFIG += noqtgui dll #eha # eha will catch all exceptions, but does not work on Windows XP -include(../../../config.pri) -include(host/host.pri) -include($$LIBDIR/winmutex/winmutex.pri) -include($$LIBDIR/wintimer/wintimer.pri) -include($$LIBDIR/windbg/windbg.pri) -#include($$LIBDIR/winmaker/winmaker.pri) - -# TODO: Get rid of dependence on ITHSYS and NT APIs -include($$PLUGINDIR/vnrhook/vnrhook.pri) -include($$PLUGINDIR/ithsys/ithsys.pri) -LIBS += -L$$WDK7_HOME/lib/wxp/i386 -lntdll - -DEFINES += ITH_HAS_CRT # Use native CRT - -# TODO: Get rid of dependence on msvc's swprintf -DEFINES += _CRT_NON_CONFORMING_SWPRINTFS - -## Libraries - -QT += core -QT -= gui - -## Sources - -TEMPLATE = lib -TARGET = texthook - -#CONFIG += staticlib -DEFINES += TEXTHOOK_BUILD_LIB - -HEADERS += \ - growl.h \ - ihf_p.h \ - ith_p.h \ - texthook_config.h \ - texthook.h \ - texthook_p.h \ - textthread_p.h \ - winapi_p.h - -SOURCES += \ - ihf_p.cc \ - ith_p.cc \ - texthook.cc \ - textthread_p.cc \ - winapi_p.cc - -#!wince*: LIBS += -lshell32 -#RC_FILE += texthook.rc - -OTHER_FILES += \ - texthook.pri \ - texthook_static.pri \ - texthook.rc - -# EOF diff --git a/vnr/texthook/texthook_static.pri b/vnr/texthook/texthook_static.pri deleted file mode 100644 index 9a95504..0000000 --- a/vnr/texthook/texthook_static.pri +++ /dev/null @@ -1,73 +0,0 @@ -# texthook_static.pri -# 10/13/2011 jichi - -include(../../../config.pri) -include($$LIBDIR/wintimer/wintimer.pri) - -## Libraries - -#DEFINES += _ITH_DEBUG_MEMORY - -QT += core - -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -#WDK_HOME = c:/winddk -#LIBS += -L$$WDK_HOME/lib -# override folder must come before winddk/inc/api -#INCLUDEPATH += $$PWD/override/wdk/vc10 -#INCLUDEPATH += $$WDK_HOME/include/api -#INCLUDEPATH += $$WDK_HOME/include/crt -#INCLUDEPATH += $$WDK_HOME/include/ddk - -#ITH_HOME = c:/dev/ith -#INCLUDEPATH += $$ITH_HOME/include -#LIBS += -L$$ITH_HOME/lib -#LIBS += -lITH_DLL #-lITH_SYS - -#INCLUDEPATH += $$ITH_HOME/include -#LIBS += -L$$ITH_HOME/lib -lihf - -# Tell IHF not to override new operators, see: ith/mem.h -DEFINES += DEFAULT_MM - -#LIBS += -lmsvcrtd -#LIBS += -lmsvcrt -#QMAKE_LFLAGS += /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib -DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NON_CONFORMING_SWPRINTFS - -## Sources - -#TEMPLATE = lib -#TARGET = texthook -#CONFIG += dll -#CONFIG += staticlib -#DEFINES += TEXTHOOK_BUILD_LIB -DEFINES += TEXTHOOK_STATIC_LIB - -HEADERS += \ - $$PWD/ihf_p.h \ - $$PWD/ith_p.h \ - $$PWD/texthook_config.h \ - $$PWD/texthook.h \ - $$PWD/texthook_p.h \ - $$PWD/textthread_p.h \ - $$PWD/winapi_p.h - -SOURCES += \ - $$PWD/ihf_p.cc \ - $$PWD/ith_p.cc \ - $$PWD/texthook.cc \ - $$PWD/textthread_p.cc \ - $$PWD/winapi_p.cc - -#!wince*: LIBS += -lshell32 -#RC_FILE += texthook.rc - -OTHER_FILES += \ - $$PWD/texthook.pri \ - $$PWD/texthook.pro \ - $$PWD/texthook.rc - -# EOF diff --git a/vnr/vnrhook/TRASH/dllconfig.pri b/vnr/vnrhook/TRASH/dllconfig.pri deleted file mode 100644 index 601be70..0000000 --- a/vnr/vnrhook/TRASH/dllconfig.pri +++ /dev/null @@ -1,35 +0,0 @@ -# dllconfig.pri -# 8/9/2013 jichi -# For linking ITH injectable dlls. -# The dll is self-contained and Windows-independent. - -CONFIG += dll noqt #noeh nosafeseh -CONFIG -= embed_manifest_dll # dynamically load dlls -win32 { - CONFIG(eh): DEFINES += ITH_HAS_SEH # Do have exception handler in msvcrt.dll on Windows Vista and later - CONFIG(noeh): DEFINES -= ITH_HAS_SEH # Do not have exception handler in msvcrt.dll on Windows XP and before -} -include(../../../config.pri) -#win32 { -# CONFIG(noeh): include($$LIBDIR/winseh/winseh_safe.pri) -#} - -# jichi 11/24/2013: Disable manual heap -DEFINES -= ITH_HAS_HEAP - -# jichi 11/13/2011: disable swprinf warning -DEFINES += _CRT_NON_CONFORMING_SWPRINTFS - -## Libraries - -#LIBS += -lkernel32 -luser32 -lgdi32 -LIBS += -L$$WDK7_HOME/lib/wxp/i386 -lntdll -LIBS += $$WDK7_HOME/lib/crt/i386/msvcrt.lib # Override msvcrt10 -#LIBS += -L$$WDK7_HOME/lib/crt/i386 -lmsvcrt -#QMAKE_LFLAGS += $$WDK7_HOME/lib/crt/i386/msvcrt.lib # This will leave runtime flags in the dll - -#LIBS += -L$$WDK8_HOME/lib/winv6.3/um/x86 -lntdll - -HEADERS += $$PWD/dllconfig.h - -# EOF diff --git a/vnr/vnrhook/TRASH/hookxp.pro b/vnr/vnrhook/TRASH/hookxp.pro deleted file mode 100644 index 40896f5..0000000 --- a/vnr/vnrhook/TRASH/hookxp.pro +++ /dev/null @@ -1,61 +0,0 @@ -# hookxp.pro -# 8/9/2013 jichi -# Build vnrhookxp.dll for Windows XP - -CONFIG += noeh # msvcrt on Windows XP does not has exception handler -include(../dllconfig.pri) -include(../sys/sys.pri) -include($$LIBDIR/disasm/disasm.pri) -include($$LIBDIR/memdbg/memdbg.pri) -include($$LIBDIR/ntinspect/ntinspect.pri) -include($$LIBDIR/winkey/winkey.pri) -include($$LIBDIR/winseh/winseh_safe.pri) -include($$LIBDIR/winversion/winversion.pri) - -VPATH += ../hook -INCLUDEPATH += ../hook - -# 9/27/2013: disable ITH this game engine, only for debugging purpose -#DEFINES += ITH_DISABLE_ENGINE - -# jichi 9/22/2013: When ITH is on wine, mutex is needed to protect NtWriteFile -#DEFINES += ITH_WINE -#DEFINES += ITH_SYNC_PIPE - -DEFINES += MEMDBG_NO_STL NTINSPECT_NO_STL - -## Libraries - -LIBS += -lkernel32 -luser32 -lgdi32 #-lgdiplus - -## Sources - -TEMPLATE = lib -TARGET = vnrhookxp - -#CONFIG += staticlib - -HEADERS += \ - config.h \ - cli.h \ - hook.h \ - engine/engine.h \ - engine/hookdefs.h \ - engine/match.h \ - engine/pchooks.h \ - engine/util.h \ - tree/avl.h - -SOURCES += \ - main.cc \ - rpc/pipe.cc \ - hijack/texthook.cc \ - engine/engine.cc \ - engine/match.cc \ - engine/pchooks.cc \ - engine/util.cc - -#RC_FILE += vnrhook.rc -#OTHER_FILES += vnrhook.rc - -# EOF diff --git a/vnr/vnrhook/TRASH/memory.h b/vnr/vnrhook/TRASH/memory.h deleted file mode 100644 index bedea9b..0000000 --- a/vnr/vnrhook/TRASH/memory.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -// ith/common/memory.h -// 8/23/2013 jichi -// Branch: ITH/mem.h, revision 66 - -#ifndef ITH_HAS_HEAP -# define ITH_MEMSET_HEAP(...) ::memset(__VA_ARGS__) -#else -# define ITH_MEMSET_HEAP(...) (void)0 - -// Defined in kernel32.lilb -extern "C" { -// PVOID RtlAllocateHeap( _In_ PVOID HeapHandle, _In_opt_ ULONG Flags, _In_ SIZE_T Size); -__declspec(dllimport) void * __stdcall RtlAllocateHeap(void *HeapHandle, unsigned long Flags, unsigned long Size); - -// BOOLEAN RtlFreeHeap( _In_ PVOID HeapHandle, _In_opt_ ULONG Flags, _In_ PVOID HeapBase); -__declspec(dllimport) int __stdcall RtlFreeHeap(void *HeapHandle, unsigned long Flags, void *HeapBase); -} // extern "C" - -//NTSYSAPI -//BOOL -//NTAPI -//RtlFreeHeap( -// _In_ HANDLE hHeap, -// _In_ DWORD dwFlags, -// _In_ LPVOID lpMem -//); - -extern void *hHeap; // defined in ith/sys.cc - -inline void * __cdecl operator new(size_t lSize) -{ - // http://msdn.microsoft.com/en-us/library/windows/desktop/aa366597%28v=vs.85%29.aspx - // HEAP_ZERO_MEMORY flag is critical. All new objects are assumed with zero initialized. - enum { HEAP_ZERO_MEMORY = 0x00000008 }; - return RtlAllocateHeap(::hHeap, HEAP_ZERO_MEMORY, lSize); -} - -inline void __cdecl operator delete(void *pBlock) -{ RtlFreeHeap(::hHeap, 0, pBlock); } - -inline void __cdecl operator delete[](void *pBlock) -{ RtlFreeHeap(::hHeap, 0, pBlock); } - -#endif // ITH_HAS_HEAP diff --git a/vnr/vnrhook/TRASH/string.h b/vnr/vnrhook/TRASH/string.h deleted file mode 100644 index a77196c..0000000 --- a/vnr/vnrhook/TRASH/string.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -// ith/common/string.h -// 8/9/2013 jichi -// Branch: ITH/string.h, rev 66 - -#ifdef ITH_HAS_CRT // ITH is linked with msvcrt dlls -# include -# include - -#else -# define _INC_SWPRINTF_INL_ -# define CRT_IMPORT __declspec(dllimport) - -#include // for wchar_t -extern "C" { -CRT_IMPORT int swprintf(wchar_t *src, const wchar_t *fmt, ...); -CRT_IMPORT int sprintf(char *src, const char *fmt, ...); -CRT_IMPORT int swscanf(const wchar_t *src, const wchar_t *fmt, ...); -CRT_IMPORT int sscanf(const char *src, const char *fmt, ...); -CRT_IMPORT int wprintf(const wchar_t *fmt, ...); -CRT_IMPORT int printf(const char *fmt, ...); -CRT_IMPORT int _wputs(const wchar_t *src); -CRT_IMPORT int puts(const char *src); -CRT_IMPORT int _stricmp(const char *x, const char *y); -CRT_IMPORT int _wcsicmp(const wchar_t *x, const wchar_t *y); -//CRT_IMPORT size_t strlen(const char *); -//CRT_IMPORT size_t wcslen(const wchar_t *); -//CRT_IMPORT char *strcpy(char *,const char *); -//CRT_IMPORT wchar_t *wcscpy(wchar_t *,const wchar_t *); -CRT_IMPORT void *memmove(void *dst, const void *src, size_t sz); -CRT_IMPORT const char *strchr(const char *src, int val); -CRT_IMPORT int strncmp(const char *x, const char *y, size_t sz); -} // extern "C" - -#endif // ITH_HAS_CRT diff --git a/vnr/vnrhook/TRASH/xp.txt b/vnr/vnrhook/TRASH/xp.txt deleted file mode 100644 index 150c61f..0000000 --- a/vnr/vnrhook/TRASH/xp.txt +++ /dev/null @@ -1,11 +0,0 @@ -12/16/2013 - -Differences between xp.dll and non-xp.dll for vnrhook. - -non-xp: - CONFIG += eh - -xp: - CONFIG += noeh - CONFIG -= embed_manifest_dll # Pure dynamic determined. The manifest would break Windows XP support - include($$LIBDIR/winseh/winseh_safe.pri) diff --git a/vnr/vnrhook/vnrhook.pri b/vnr/vnrhook/vnrhook.pri deleted file mode 100644 index 12b189a..0000000 --- a/vnr/vnrhook/vnrhook.pri +++ /dev/null @@ -1,12 +0,0 @@ -# vnrhook.pri -# 8/21/2013 jichi - -DEFINES += WITH_LIB_VNRHOOK -DEPENDPATH += $$PWD/include - -HEADERS += \ - $$PWD/include/const.h \ - $$PWD/include/defs.h \ - $$PWD/include/types.h - -# EOF diff --git a/vnr/vnrhook/vnrhook.pro b/vnr/vnrhook/vnrhook.pro deleted file mode 100644 index da60a3d..0000000 --- a/vnr/vnrhook/vnrhook.pro +++ /dev/null @@ -1,80 +0,0 @@ -# hook.pro -# 8/9/2013 jichi -# Build vnrhook.dll for Windows 7+ - -# Exception handler to catch all exceptions -CONFIG += dll noqt eh eha # noeh nosafeseh - -#CONFIG += noeh # msvcrt on Windows XP does not has exception handler -include(../../../config.pri) -include($$PLUGINDIR/ithsys/ithsys.pri) -include($$LIBDIR/disasm/disasm.pri) -include($$LIBDIR/memdbg/memdbg.pri) -include($$LIBDIR/ntdll/ntdll.pri) -include($$LIBDIR/ntinspect/ntinspect.pri) -include($$LIBDIR/winkey/winkey.pri) -#include($$LIBDIR/winseh/winseh_safe.pri) -include($$LIBDIR/winversion/winversion.pri) - -# 9/27/2013: disable ITH this game engine, only for debugging purpose -#DEFINES += ITH_DISABLE_ENGINE - -# jichi 9/22/2013: When ITH is on wine, mutex is needed to protect NtWriteFile -#DEFINES += ITH_WINE -#DEFINES += ITH_SYNC_PIPE - -DEFINES += ITH_HAS_CRT ITH_HAS_SEH -DEFINES += MEMDBG_NO_STL NTINSPECT_NO_STL # disabled as not used - -# jichi 11/24/2013: Disable manual heap -DEFINES -= ITH_HAS_HEAP - -# jichi 11/13/2011: disable swprinf warning -DEFINES += _CRT_NON_CONFORMING_SWPRINTFS - -## Libraries - -#LIBS += -L$$WDK7_HOME/lib/wxp/i386 -lntdll -#LIBS += $$WDK7_HOME/lib/crt/i386/msvcrt.lib # Override msvcrt10 - -LIBS += -lkernel32 -luser32 -lgdi32 #-lgdiplus - -## Sources - -TEMPLATE = lib -TARGET = vnrhook - -#CONFIG += staticlib - -HEADERS += \ - include/const.h \ - include/defs.h \ - include/types.h \ - src/except.h \ - src/main.h \ - src/util/growl.h \ - src/util/util.h \ - src/tree/avl.h \ - src/hijack/texthook.h \ - src/engine/engine.h \ - src/engine/hookdefs.h \ - src/engine/match.h \ - src/engine/pchooks.h \ - src/engine/mono/funcinfo.h \ - src/engine/ppsspp/funcinfo.h - -SOURCES += \ - src/main.cc \ - src/pipe.cc \ - src/util/util.cc \ - src/hijack/texthook.cc \ - src/engine/engine.cc \ - src/engine/match.cc \ - src/engine/pchooks.cc - -#RC_FILE += vnrhook.rc -#OTHER_FILES += vnrhook.rc - -OTHER_FILES += vnrhook.pri - -# EOF diff --git a/vnr/windbg/windbg.pri b/vnr/windbg/windbg.pri deleted file mode 100644 index 2673d6b..0000000 --- a/vnr/windbg/windbg.pri +++ /dev/null @@ -1,26 +0,0 @@ -# windbg.pri -# 4/21/2014 jichi -win32 { - -DEFINES += WITH_LIB_WINDBG - -LIBS += -lkernel32 -luser32 - -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/hijack.h \ - $$PWD/inject.h \ - $$PWD/util.h \ - $$PWD/unload.h \ - $$PWD/windbg_p.h \ - $$PWD/windbg.h - -SOURCES += \ - $$PWD/hijack.cc \ - $$PWD/inject.cc \ - $$PWD/util.cc \ - $$PWD/unload.cc -} - -# EOF diff --git a/vnr/winkey/winkey.pri b/vnr/winkey/winkey.pri deleted file mode 100644 index cd7f534..0000000 --- a/vnr/winkey/winkey.pri +++ /dev/null @@ -1,15 +0,0 @@ -# winkey.pri -# 7/20/2011 jichi -win32 { - -DEFINES += WITH_LIB_WINKEY - -LIBS += -luser32 - -DEPENDPATH += $$PWD - -HEADERS += $$PWD/winkey.h -#SOURCES += $$PWD/winkey.cc -} - -# EOF diff --git a/vnr/winmaker/winmaker.pri b/vnr/winmaker/winmaker.pri deleted file mode 100644 index 8757391..0000000 --- a/vnr/winmaker/winmaker.pri +++ /dev/null @@ -1,15 +0,0 @@ -# wintimer.pri -# 7/20/2011 jichi -win32 { - -DEFINES += WITH_LIB_WINMAKER - -#LIBS += -lkernel32 -luser32 - -DEPENDPATH += $$PWD - -HEADERS += $$PWD/winmaker.h -SOURCES += $$PWD/winmaker.cc -} - -# EOF diff --git a/vnr/winmutex/winmutex b/vnr/winmutex/winmutex deleted file mode 100644 index 4f3da77..0000000 --- a/vnr/winmutex/winmutex +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -#include "winmutex/winmutex.h" diff --git a/vnr/winmutex/winmutex.pri b/vnr/winmutex/winmutex.pri deleted file mode 100644 index 8dbbb64..0000000 --- a/vnr/winmutex/winmutex.pri +++ /dev/null @@ -1,13 +0,0 @@ -# winmutex.pri -# 3/8/2013 jichi - -DEFINES += WITH_LIB_WINMUTEX - -DEPENDPATH += $$PWD -#LIBS += -lkernel32 -luser32 - -HEADERS += \ - $$PWD/winmutex \ - $$PWD/winmutex.h - -# EOF diff --git a/vnr/winseh/winseh_safe.pri b/vnr/winseh/winseh_safe.pri deleted file mode 100644 index 82cf311..0000000 --- a/vnr/winseh/winseh_safe.pri +++ /dev/null @@ -1,29 +0,0 @@ -# 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 diff --git a/vnr/winseh/winseh_unsafe.pri b/vnr/winseh/winseh_unsafe.pri deleted file mode 100644 index 4b2a567..0000000 --- a/vnr/winseh/winseh_unsafe.pri +++ /dev/null @@ -1,18 +0,0 @@ -# winseh_unsafe.pri -# 12/13/2013 jichi -# -# Need compile with /SAFESEH:NO -# See: http://stackoverflow.com/questions/19722308/exception-handler-not-called-in-c -#CONFIG += nosafeseh -win32 { -DEFINES += WITH_LIB_WINSEH - -DEPENDPATH += $$PWD - -HEADERS += $$PWD/winseh.h -SOURCES += \ - $$PWD/winseh.cc \ - $$PWD/winseh_unsafe.cc -} - -# EOF diff --git a/vnr/wintimer/wintimer.pri b/vnr/wintimer/wintimer.pri deleted file mode 100644 index e1296d3..0000000 --- a/vnr/wintimer/wintimer.pri +++ /dev/null @@ -1,20 +0,0 @@ -# wintimer.pri -# 7/20/2011 jichi -win32 { - -DEFINES += WITH_LIB_WINTIMER - -LIBS += -lkernel32 -luser32 -lwintimer - -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/wintimer.h \ - $$PWD/wintimerbase.h - -#SOURCES += \ -# $$PWD/wintimer.cc \ -# $$PWD/wintimerbase.cc -} - -# EOF diff --git a/vnr/wintimer/wintimer.pro b/vnr/wintimer/wintimer.pro deleted file mode 100644 index 69f2ff4..0000000 --- a/vnr/wintimer/wintimer.pro +++ /dev/null @@ -1,22 +0,0 @@ -# sys.pro -# 8/21/2013 jichi -# Build ITH_engine.dll - -#CONFIG += noqt noeh staticlib -CONFIG += staticlib -include(../../../config.pri) - -## Sources - -TEMPLATE = lib -TARGET = wintimer - -HEADERS += \ - wintimer.h \ - wintimerbase.h - -SOURCES += \ - wintimer.cc \ - wintimerbase.cc - -# EOF diff --git a/vnr/winversion/winversion.pri b/vnr/winversion/winversion.pri deleted file mode 100644 index 96b4a6b..0000000 --- a/vnr/winversion/winversion.pri +++ /dev/null @@ -1,14 +0,0 @@ -# winversion.pri -# 9/5/2014 jichi -win32 { -DEFINES += WITH_LIB_WINVERSION - -LIBS += -lversion - -DEPENDPATH += $$PWD - -HEADERS += $$PWD/winversion.h -SOURCES += $$PWD/winversion.cc -} - -# EOF From 9ced0a39aaccdcd5f7fd2143d0c0f6ba9627e38f Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 22 Apr 2018 14:52:03 -0400 Subject: [PATCH 3/7] remove more unneeded/legacy support files --- vnr/winmaker/winmaker.cc | 46 ----------- vnr/winmaker/winmaker.h | 23 ------ vnr/winseh/Makefile | 26 ------ vnr/winseh/safeseh.asm | 21 ----- vnr/winseh/winseh.cc | 52 ------------ vnr/winseh/winseh.h | 154 ------------------------------------ vnr/winseh/winseh_safe.cc | 10 --- vnr/winseh/winseh_unsafe.cc | 11 --- 8 files changed, 343 deletions(-) delete mode 100644 vnr/winmaker/winmaker.cc delete mode 100644 vnr/winmaker/winmaker.h delete mode 100644 vnr/winseh/Makefile delete mode 100644 vnr/winseh/safeseh.asm delete mode 100644 vnr/winseh/winseh.cc delete mode 100644 vnr/winseh/winseh.h delete mode 100644 vnr/winseh/winseh_safe.cc delete mode 100644 vnr/winseh/winseh_unsafe.cc diff --git a/vnr/winmaker/winmaker.cc b/vnr/winmaker/winmaker.cc deleted file mode 100644 index d9bbef8..0000000 --- a/vnr/winmaker/winmaker.cc +++ /dev/null @@ -1,46 +0,0 @@ -// winmaker.cc -// 2/1/2013 jichi - -#include "winmaker/winmaker.h" -#include -//#include - -#ifdef _MSC_VER -# pragma warning (disable:4800) // C4800: forcing value to bool -#endif // _MSC_VER - -// See: http://www.codeguru.com/cpp/w-p/dll/tips/article.php/c3635/Tip-Detecting-a-HMODULEHINSTANCE-Handle-Within-the-Module-Youre-Running-In.htm -extern "C" IMAGE_DOS_HEADER __ImageBase; -namespace { // unnamed - inline HMODULE _get_module() { return reinterpret_cast(&__ImageBase); } -} // unnamed - -bool wm_register_hidden_class(LPCWSTR className) -{ - WNDCLASSEX wx = {}; - wx.cbSize = sizeof(wx); - wx.lpfnWndProc = ::DefWindowProc; - wx.hInstance = ::GetModuleHandle(nullptr); - wx.lpszClassName = className; - return ::RegisterClassEx(&wx); -} - -wm_window_t wm_create_hidden_window(LPCWSTR windowName, LPCWSTR className, wm_module_t dllHandle) -{ - //return ::CreateWindowExA(0, className, windowName, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, dllHandle, nullptr); - HINSTANCE module = reinterpret_cast(dllHandle); - if (!module) - module = _get_module(); - return ::CreateWindowEx(0, className, windowName, 0, 0, 0, 0, 0, 0, NULL, module, NULL); -} - -bool wm_destroy_window(wm_window_t hwnd) -{ return ::DestroyWindow(reinterpret_cast(hwnd)); } - - -// EOF -// -//void wm_init() { ::InitCommonControls(); } -//void wm_destroy() {} -//bool wm_destroy_window() { return ::DestroyWindow(hwnd); } - diff --git a/vnr/winmaker/winmaker.h b/vnr/winmaker/winmaker.h deleted file mode 100644 index 9980869..0000000 --- a/vnr/winmaker/winmaker.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -// winmaker.h -// 2/1/2013 jichi - -#include -typedef void *wm_window_t; // HWMD -typedef void *wm_module_t; // HMODULE - -bool wm_register_hidden_class(LPCWSTR className = L"hidden_class"); - -wm_window_t wm_create_hidden_window( - LPCWSTR windowName = L"hidden_window", - LPCWSTR className = L"Button", // bust be one of the common control widgets - wm_module_t dllHandle = nullptr); - -bool wm_destroy_window(wm_window_t hwnd); - -// EOF - -//#ifdef QT_CORE_LIB -//#include -//WId wm_create_hidden_window(const char *className = "Button", const char *windowName = "hidden_window"); diff --git a/vnr/winseh/Makefile b/vnr/winseh/Makefile deleted file mode 100644 index 1c876ae..0000000 --- a/vnr/winseh/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# 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 diff --git a/vnr/winseh/safeseh.asm b/vnr/winseh/safeseh.asm deleted file mode 100644 index d672999..0000000 --- a/vnr/winseh/safeseh.asm +++ /dev/null @@ -1,21 +0,0 @@ -; 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 diff --git a/vnr/winseh/winseh.cc b/vnr/winseh/winseh.cc deleted file mode 100644 index 275589f..0000000 --- a/vnr/winseh/winseh.cc +++ /dev/null @@ -1,52 +0,0 @@ -// winseh.cc -// 12/13/2013 jichi - -#include "winseh/winseh.h" -#include "ntdll/ntdll.h" -//#include - -// - Define 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, // do not work if I use ULONG64 - _Inout_ PCONTEXT ContextRecord, - _In_ PVOID DispatcherContext) // PDISPATCHER_CONTEXT is not declared in windows.h, use PVOID instead -{ - //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(::seh_eh[::seh_count - 1])(ExceptionRecord, EstablisherFrame, ContextRecord, DispatcherContext) : - ExceptionContinueExecution; -} - -// EOF diff --git a/vnr/winseh/winseh.h b/vnr/winseh/winseh.h deleted file mode 100644 index 72997f3..0000000 --- a/vnr/winseh/winseh.h +++ /dev/null @@ -1,154 +0,0 @@ -#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 - -// 12/13/2013 jichi -// The list implementation is not thread-safe -extern seh_dword_t - seh_count // current number of exception handlers - , seh_handler // extern PEXCEPTION_ROUTINE seh_handler; - , 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 -; - -/** - * 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 - * - * TODO: get sizeof dword instead of hardcode 4 - */ -#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 */ \ - } - -/** - * 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_exit as the shared exit label -#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__ \ - ; /* allow __VA_ARGS__ to be an expression */ \ - 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__ \ - ; /* allow __VA_ARGS__ to be an expression */ \ - 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 \ -// } diff --git a/vnr/winseh/winseh_safe.cc b/vnr/winseh/winseh_safe.cc deleted file mode 100644 index 69c6d14..0000000 --- a/vnr/winseh/winseh_safe.cc +++ /dev/null @@ -1,10 +0,0 @@ -// 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_asm_handler); - -// EOF diff --git a/vnr/winseh/winseh_unsafe.cc b/vnr/winseh/winseh_unsafe.cc deleted file mode 100644 index 303a41a..0000000 --- a/vnr/winseh/winseh_unsafe.cc +++ /dev/null @@ -1,11 +0,0 @@ -// winseh_unsafe.cc -// 12/13/2013 jichi -// See: http://stackoverflow.com/questions/19722308/exception-handler-not-called-in-c - -#include "winseh/winseh.h" -#include - -extern "C" EXCEPTION_DISPOSITION _seh_handler(PEXCEPTION_RECORD, PVOID, PCONTEXT, PVOID); -seh_dword_t seh_handler = reinterpret_cast(_seh_handler); - -// EOF From 90e67f1fc81f41f71d6fc7f4b645a366b23ba6ec Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 25 Apr 2018 01:45:45 -0400 Subject: [PATCH 4/7] organize code/delete unneeded code --- gui/TextBuffer.cpp | 12 +++++++++++- gui/window.cpp | 11 ----------- vnr/ithsys/ithsys.h | 2 -- vnr/texthook/host/CMakeLists.txt | 2 -- vnr/texthook/host/host.cc | 15 ++------------- vnr/vnrhook/CMakeLists.txt | 11 ----------- vnr/vnrhook/src/except.h | 15 +-------------- 7 files changed, 14 insertions(+), 54 deletions(-) diff --git a/gui/TextBuffer.cpp b/gui/TextBuffer.cpp index ad3025c..46694e6 100644 --- a/gui/TextBuffer.cpp +++ b/gui/TextBuffer.cpp @@ -1,6 +1,16 @@ #include "TextBuffer.h" -DWORD WINAPI FlushThread(LPVOID lParam); // window.cpp + +DWORD WINAPI FlushThread(LPVOID lParam) +{ + TextBuffer* t = (TextBuffer*)lParam; + while (t->Running()) + { + t->Flush(); + Sleep(10); + } + return 0; +} TextBuffer::TextBuffer(HWND edit) : hThread(IthCreateThread(FlushThread, (DWORD)this)), hEdit(edit), diff --git a/gui/window.cpp b/gui/window.cpp index 0f3a862..a0feeef 100644 --- a/gui/window.cpp +++ b/gui/window.cpp @@ -853,14 +853,3 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } return 0; } - -DWORD WINAPI FlushThread(LPVOID lParam) -{ - TextBuffer* t = (TextBuffer*)lParam; - while (t->Running()) - { - t->Flush(); - Sleep(10); - } - return 0; -} diff --git a/vnr/ithsys/ithsys.h b/vnr/ithsys/ithsys.h index 87c67f3..eb00cf8 100644 --- a/vnr/ithsys/ithsys.h +++ b/vnr/ithsys/ithsys.h @@ -119,8 +119,6 @@ class IthMutexLocker void IthCoolDown(); BOOL IthIsWine(); -BOOL IthIsWindowsXp(); -//BOOL IthIsWindows8OrGreater(); // not public /** Get current dll path. * @param buf diff --git a/vnr/texthook/host/CMakeLists.txt b/vnr/texthook/host/CMakeLists.txt index add5052..7bac1f4 100644 --- a/vnr/texthook/host/CMakeLists.txt +++ b/vnr/texthook/host/CMakeLists.txt @@ -19,8 +19,6 @@ set(vnrhost_src host.cc pipe.cc textthread.cc - ${PROJECT_SOURCE_DIR}/winmaker/winmaker.h - ${PROJECT_SOURCE_DIR}/winmaker/winmaker.cc ${PROJECT_SOURCE_DIR}/winmutex/winmutex.h # ${PROJECT_SOURCE_DIR}/wintimer/wintimer.h # ${PROJECT_SOURCE_DIR}/wintimer/wintimer.cc diff --git a/vnr/texthook/host/host.cc b/vnr/texthook/host/host.cc index 9340f3a..83ac890 100644 --- a/vnr/texthook/host/host.cc +++ b/vnr/texthook/host/host.cc @@ -17,7 +17,6 @@ #include "vnrhook/include/types.h" #include "ithsys/ithsys.h" #include "windbg/inject.h" -#include "winmaker/winmaker.h" #include "ccutil/ccmacro.h" #include @@ -63,20 +62,10 @@ void GetDebugPriv() TOKEN_PRIVILEGES Privileges = {1,{0x14,0,SE_PRIVILEGE_ENABLED}}; - NtOpenProcessToken(NtCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken); + OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken); status = NtAdjustPrivilegesToken(hToken, 0, &Privileges, sizeof(Privileges), 0, &dwRet); - //if (STATUS_SUCCESS == status) - //{ - // admin = 1; - //} - //else - //{ - // WCHAR buffer[0x10]; - // swprintf(buffer, L"%.8X",status); - // MessageBox(0, NotAdmin, buffer, 0); - //} - NtClose(hToken); + CloseHandle(hToken); } bool sendCommand(HANDLE hCmd, HostCommandType cmd) diff --git a/vnr/vnrhook/CMakeLists.txt b/vnr/vnrhook/CMakeLists.txt index b1c1986..6f0b7d7 100644 --- a/vnr/vnrhook/CMakeLists.txt +++ b/vnr/vnrhook/CMakeLists.txt @@ -62,10 +62,6 @@ set(vnrhook_src ${PROJECT_SOURCE_DIR}/winkey/winkey.h ${PROJECT_SOURCE_DIR}/winversion/winversion.cc ${PROJECT_SOURCE_DIR}/winversion/winversion.h - ${PROJECT_SOURCE_DIR}/winseh/winseh.h - ${PROJECT_SOURCE_DIR}/winseh/winseh.cc - ${PROJECT_SOURCE_DIR}/winseh/winseh_safe.cc - ${PROJECT_SOURCE_DIR}/winseh/safeseh.asm ${PROJECT_SOURCE_DIR}/mono/monoobject.h ${PROJECT_SOURCE_DIR}/mono/monotype.h ) @@ -74,13 +70,6 @@ add_library(vnrhook SHARED ${vnrhook_src}) enable_language(ASM_MASM) -set_source_files_properties( - ${PROJECT_SOURCE_DIR}/winseh/safeseh.asm - PROPERTIES - # CMAKE_ASM_MASM_FLAGS /safeseh # CMake bug 14711: http://www.cmake.org/Bug/view.php?id=14711 - COMPILE_FLAGS /safeseh -) - set_target_properties(vnrhook PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MANIFEST:NO" ) diff --git a/vnr/vnrhook/src/except.h b/vnr/vnrhook/src/except.h index a8540bb..c37d744 100644 --- a/vnr/vnrhook/src/except.h +++ b/vnr/vnrhook/src/except.h @@ -5,21 +5,8 @@ #define ITH_RAISE (*(int*)0 = 0) // raise C000005, for debugging only -#ifdef ITH_HAS_SEH - # define ITH_TRY __try # define ITH_EXCEPT __except(EXCEPTION_EXECUTE_HANDLER) -# define ITH_WITH_SEH(...) \ - ITH_TRY { __VA_ARGS__; } ITH_EXCEPT {} - -#else // for old msvcrt.dll on Windows XP that does not have exception handler - -// Currently, only with_seh is implemented. Try and catch are not. -# define ITH_TRY if (true) -# define ITH_EXCEPT else -# include "winseh/winseh.h" -# define ITH_WITH_SEH(...) seh_with(__VA_ARGS__) - -#endif // ITH_HAS_SEH +# define ITH_WITH_SEH(...) ITH_TRY { __VA_ARGS__; } ITH_EXCEPT {} // EOF From 7ee7d7cd24fe2f24bf1cd1279b31fba12b8f5ec8 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 25 Apr 2018 03:51:32 -0400 Subject: [PATCH 5/7] clean up ithsys --- vnr/ithsys/ithsys.cc | 427 +---------------------------- vnr/ithsys/ithsys.h | 4 +- vnr/texthook/host/pipe.cc | 2 +- vnr/vnrhook/src/engine/match.cc | 2 +- vnr/vnrhook/src/hijack/texthook.cc | 2 - vnr/vnrhook/src/main.cc | 6 +- vnr/vnrhook/src/pipe.cc | 1 - vnr/vnrhook/src/util/util.cc | 2 +- 8 files changed, 16 insertions(+), 430 deletions(-) diff --git a/vnr/ithsys/ithsys.cc b/vnr/ithsys/ithsys.cc index 128f51f..724a00f 100644 --- a/vnr/ithsys/ithsys.cc +++ b/vnr/ithsys/ithsys.cc @@ -9,16 +9,11 @@ #include "ithsys/ithsys.h" //#include "vnrhook/src/util/growl.h" -//#define ITH_SYS_SECTION L"ITH_SysSection" -#define ITH_THREADMAN_SECTION L"VNR_SYS_THREAD" - // jichi 9/28/2013: Weither use NtThread or RemoteThread // RemoteThread works on both Windows 7 or Wine, while NtThread does not work on wine #define ITH_ENABLE_THREADMAN (!IthIsWindows8OrGreater() && !IthIsWine()) //#define ITH_ENABLE_THREADMAN true -//#define ITH_ENABLE_WINAPI // jichi: prefer Win32 API to NTDLL API - // Helpers // jichi 2/3/2015: About GetVersion @@ -27,22 +22,6 @@ // Windows 8: 6.2, 0x23f00206 // Windows 10: 6.2, 0x23f00206 (build 9926): -BOOL IthIsWindowsXp() -{ - static BOOL ret = -1; // cached - if (ret < 0) { - // http://msdn.microsoft.com/en-us/library/windows/desktop/ms724439%28v=vs.85%29.aspx - DWORD v = ::GetVersion(); - BYTE major = LOBYTE(LOWORD(v)); - //DWORD minor = (DWORD)(HIBYTE(LOWORD(v))); - - // Windows XP = 5.1 - //ret = major < 6 ? 1 : 0; - ret = major < 6; - } - return ret; -} - // https://msdn.microsoft.com/en-us/library/windows/desktop/dn424972%28v=vs.85%29.aspx // The same as IsWindows8OrGreater, which I don't know if the function is available to lower Windows. static BOOL IthIsWindows8OrGreater() // this function is not exported @@ -78,50 +57,12 @@ BOOL IthIsWine() return ret; } -// jichi 9/28/2013: prevent parallelization in wine -void IthCoolDown() -{ - // http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/Thread/NtDelayExecution.html - //const LONGLONG timeout = -10000; // in 100ns, i.e. 1ms - //NtDelayExecution(FALSE, (PLARGE_INTEGER)&timeout); - //NtFlushInstructionCache(NtCurrentProcess(), (LPVOID)hp.addr, hp.recover_len); - // Flush the instruction cache line, and prevent wine from rending things in parallel - if (IthIsWine()) - IthSleep(1); // sleep for 1 ms - //__asm - //{ - // //mov eax,0x2710 // = 10000 - // mov ecx,time - // mul ecx - // neg eax - // adc edx,0 - // neg edx - // push edx - // push eax - // push esp - // push 0 - // call dword ptr [NtDelayExecution] - // add esp,8 - //} -} - -// jichi 9/23/2013: wine deficenciy on mapping sections -// Whe set to false, do not map sections. -//static bool ith_has_section = true; - -//#ifdef ITH_WINE -//# include "winddk/winddk.h" -//#endif // ITH_WINE - -//#define SEC_BASED 0x200000 // jichi 8/24/2013: emoved - // jichi 10/6/2013 // See: http://stackoverflow.com/questions/557081/how-do-i-get-the-hmodule-for-the-currently-executing-code // See: http://www.codeproject.com/Articles/16598/Get-Your-DLL-s-Path-Name EXTERN_C IMAGE_DOS_HEADER __ImageBase; -#define CURRENT_MODULE_HANDLE ((HINSTANCE)&__ImageBase) size_t IthGetCurrentModulePath(wchar_t *buf, size_t len) -{ return ::GetModuleFileNameW(CURRENT_MODULE_HANDLE, buf, len); } +{ return ::GetModuleFileName((HINSTANCE)&__ImageBase, buf, len); } // - Global variables - @@ -182,19 +123,6 @@ inline DWORD GetShareMemory() inline LARGE_INTEGER *GetTimeBias() { __asm mov eax,0x7ffe0020 } - -//Get full path of current process. -//inline LPWSTR GetModulePath() -//{ -// __asm -// { -// mov eax,fs:[0x30] -// mov eax,[eax+0xC] -// mov eax,[eax+0xC] -// mov eax,[eax+0x28] -// } -//} - // - Singleton classes - BYTE normal_routine[0x14] = { @@ -606,11 +534,6 @@ DWORD IthGetMemoryRange(LPCVOID mem, DWORD *base, DWORD *size) // jichi 9/25/2013 // See: http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.nls/doc/nlsgdrf/multi-byte_widechar_subr.htm // SJIS->Unicode. 'mb' must be null-terminated. 'wc' should have enough space ( 2*strlen(mb) is safe). -//#ifdef ITH_WINE -//int MB_WC(char *mb, wchar_t *wc) -//{ return mbstowcs(wc, mb, 0x100); } -// -//#else int MB_WC(char *mb, wchar_t *wc) { __asm @@ -645,38 +568,9 @@ int MB_WC(char *mb, wchar_t *wc) } } -// Count characters of 'mb' string. 'mb_length' is max length. -// jichi 9/25/2013: This function is not used -//int MB_WC_count(char *mb, int mb_length) -//{ -// __asm -// { -// xor eax,eax -// xor edx,edx -// mov esi,mb -// mov edi,mb_length -// lea ebx,LeadByteTable -//_mbc_count: -// mov dl,byte ptr [esi] -// test dl,dl -// jz _mbc_finish -// movzx ecx, byte ptr [ebx+edx] -// add esi,ecx -// inc eax -// sub edi,ecx -// ja _mbc_count -//_mbc_finish: -// } -//} - // jichi 9/25/2013 // See: http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.nls/doc/nlsgdrf/multi-byte_widechar_subr.htm // Unicode->SJIS. Analogous to MB_WC. -//#ifdef ITH_WINE -//int WC_MB(wchar_t *wc, char *mb) -//{ return wcstombs(mb, wc, 0x100); } -// -//#else int WC_MB(wchar_t *wc, char *mb) { __asm @@ -895,7 +789,7 @@ BOOL IthInitSystemService() return FALSE; } if (ITH_ENABLE_THREADMAN) { - RtlInitUnicodeString(&us, ITH_THREADMAN_SECTION); + RtlInitUnicodeString(&us, L"VNR_SYS_THREAD"); if (!NT_SUCCESS(NtCreateSection(&thread_man_section, SECTION_ALL_ACCESS, &oa, &sec_size, PAGE_EXECUTE_READWRITE, SEC_COMMIT, 0))) return FALSE; @@ -1185,52 +1079,16 @@ void IthResetEvent(HANDLE hEvent) { NtClearEvent(hEvent); } //If 'exist' is not null, it will be written 1 if mutex exist. HANDLE IthCreateMutex(LPCWSTR name, BOOL InitialOwner, DWORD *exist) { -#ifdef ITH_ENABLE_WINAPI - HANDLE ret = ::CreateMutexW(nullptr, InitialOwner, name); + HANDLE ret = ::CreateMutex(nullptr, InitialOwner, name); if (exist) *exist = ret == INVALID_HANDLE_VALUE || ::GetLastError() == ERROR_ALREADY_EXISTS; return ret; -#else -#define eval NtCreateMutant(&hMutex, MUTEX_ALL_ACCESS, poa, InitialOwner) - UNICODE_STRING us; - HANDLE hMutex; - NTSTATUS status; - OBJECT_ATTRIBUTES *poa = nullptr; - // jichi 9/25/2013: What the fxxx?! poa in the orignal source code of ITH - // is pointed to freed object on the stack?! This will crash wine! - if (name) { - //GROWL(name); - RtlInitUnicodeString(&us, name); - OBJECT_ATTRIBUTES oa = {sizeof(oa), root_obj, &us, OBJ_OPENIF, 0, 0}; - poa = &oa; - status = eval; - //GROWL_DWORD(status); - } else - status = eval; - if (NT_SUCCESS(status)) { - if (exist) - *exist = status == STATUS_OBJECT_NAME_EXISTS; - return hMutex; - } else - return INVALID_HANDLE_VALUE; -#undef eval -#endif // ITH_ENABLE_WINAPI + } HANDLE IthOpenMutex(LPCWSTR name) { -#ifdef ITH_ENABLE_WINAPI - return ::OpenMutexW(MUTEX_ALL_ACCESS, FALSE, name); -#else - UNICODE_STRING us; - RtlInitUnicodeString(&us, name); - OBJECT_ATTRIBUTES oa = {sizeof(oa), root_obj, &us, 0, 0, 0}; - HANDLE hMutex; - if (NT_SUCCESS(NtOpenMutant(&hMutex, MUTEX_ALL_ACCESS, &oa))) - return hMutex; - else - return INVALID_HANDLE_VALUE; -#endif // ITH_ENABLE_WINAPI + return ::OpenMutex(MUTEX_ALL_ACCESS, FALSE, name); } BOOL IthReleaseMutex(HANDLE hMutex) @@ -1238,157 +1096,15 @@ BOOL IthReleaseMutex(HANDLE hMutex) //Create new thread. 'hProc' must have following right. //PROCESS_CREATE_THREAD, PROCESS_VM_OPERATION, PROCESS_VM_READ, PROCESS_VM_WRITE. -HANDLE IthCreateThread(LPCVOID start_addr, DWORD param, HANDLE hProc) +HANDLE IthCreateRemoteThread(LPCVOID start_addr, DWORD param, HANDLE hProc) { HANDLE hThread; - // jichi 9/27/2013: NtCreateThread is not implemented in Wine 1.7 - if (thread_man_) { // Windows XP - // jichi 9/29/2013: Reserved && commit stack size - // See: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366803%28v=vs.85%29.aspx - // See: http://msdn.microsoft.com/en-us/library/ms810627.aspx - enum { DEFAULT_STACK_LIMIT = 0x400000 }; - enum { DEFAULT_STACK_COMMIT = 0x10000 }; - enum { PAGE_SIZE = 0x1000 }; - CLIENT_ID id; - LPVOID protect; - USER_STACK stack = {}; - CONTEXT ctx = {CONTEXT_FULL}; - DWORD size = DEFAULT_STACK_LIMIT, - commit = DEFAULT_STACK_COMMIT; - if (!NT_SUCCESS(NtAllocateVirtualMemory(hProc, &stack.ExpandableStackBottom, 0, &size, MEM_RESERVE, PAGE_READWRITE))) - return INVALID_HANDLE_VALUE; - - stack.ExpandableStackBase = (char *)stack.ExpandableStackBottom + size; - stack.ExpandableStackLimit = (char *)stack.ExpandableStackBase - commit; - size = PAGE_SIZE; - commit += size; - protect = (char *)stack.ExpandableStackBase - commit; - NtAllocateVirtualMemory(hProc, &protect, 0, &commit, MEM_COMMIT, PAGE_READWRITE); - DWORD oldAccess; // jichi 9/29/2013: unused - NtProtectVirtualMemory(hProc, &protect, &size, PAGE_READWRITE|PAGE_GUARD, &oldAccess); - ctx.SegGs = 0; - ctx.SegFs = 0x38; - ctx.SegEs = 0x20; - ctx.SegDs = 0x20; - ctx.SegSs = 0x20; - ctx.SegCs = 0x18; - ctx.EFlags = 0x3000; - ctx.Eip = (DWORD)thread_man_->GetProcAddr(hProc); - ctx.Eax = (DWORD)start_addr; - ctx.Ecx = ctx.Eip + 0x40; - ctx.Edx = 0xffffffff; - ctx.Esp = (DWORD)stack.ExpandableStackBase - 0x10; - ctx.Ebp = param; - - // NTSYSAPI - // NTSTATUS - // NTAPI - // NtCreateThread( - // _Out_ PHANDLE ThreadHandle, - // _In_ ACCESS_MASK DesiredAccess, - // _In_ POBJECT_ATTRIBUTES ObjectAttributes, - // _In_ HANDLE ProcessHandle, - // _Out_ PCLIENT_ID ClientId, - // _In_ PCONTEXT ThreadContext, - // _In_ PUSER_STACK UserStack, - // _In_ BOOLEAN CreateSuspended - // ); - if (NT_SUCCESS(NtCreateThread( - &hThread, // _Out_ PHANDLE ThreadHandle, - THREAD_ALL_ACCESS, // _In_ ACCESS_MASK DesiredAccess, - nullptr, // _In_ POBJECT_ATTRIBUTES ObjectAttributes, - hProc, // _In_ HANDLE ProcessHandle, - &id, // _Out_ PCLIENT_ID ClientId, - &ctx, // _In_ PCONTEXT ThreadContext, - &stack, // _In_ PUSER_STACK UserStack, - TRUE // _In_ BOOLEAN CreateSuspended - ))) { - // On x64 Windows, NtCreateThread in ntdll calls NtCreateThread in ntoskrnl via WOW64, - // which maps 32-bit system call to the correspond 64-bit version. - // This layer doesn't correctly copy whole CONTEXT structure, so we must set it manually - // after the thread is created. - // On x86 Windows, this step is not necessary. - NtSetContextThread(hThread, &ctx); - NtResumeThread(hThread, 0); - } else - hThread = INVALID_HANDLE_VALUE; - - } else { - // jichi 9/27/2013: CreateRemoteThread works on both Wine and Windows 7 - // Use CreateRemoteThread instead - // FIXME 10/5/2031: Though sometimes works, CreateRemoteThread randomly crashes on wine. - // See: - // - http://www.unknowncheats.me/forum/c-and-c/64775-createremotethread-dll-injection.html - // - http://source.winehq.org/WineAPI/CreateRemoteThread.html - // - http://msdn.microsoft.com/en-us/library/windows/desktop/ms682437%28v=vs.85%29.aspx - // HANDLE WINAPI CreateRemoteThread( - // _In_ HANDLE hProcess, - // _In_ LPSECURITY_ATTRIBUTES lpThreadAttributes, - // _In_ SIZE_T dwStackSize, - // _In_ LPTHREAD_START_ROUTINE lpStartAddress, - // _In_ LPVOID lpParameter, - // _In_ DWORD dwCreationFlags, - // _Out_ LPDWORD lpThreadId - // ); - //ITH_TRY { if (hProc == INVALID_HANDLE_VALUE) hProc = GetCurrentProcess(); - //DWORD dwThreadId; - hThread = CreateRemoteThread( - hProc, // _In_ HANDLE hProcess, - nullptr, // _In_ LPSECURITY_ATTRIBUTES lpThreadAttributes, - 0, // _In_ SIZE_T dwStackSize, - (LPTHREAD_START_ROUTINE)start_addr, // _In_ LPTHREAD_START_ROUTINE lpStartAddress, - (LPVOID)param, // _In_ LPVOID lpParameter, - 0, //STACK_SIZE_PARAM_IS_A_RESERVATION // _In_ DWORD dwCreationFlags, - nullptr // _Out_ LPDWORD lpThreadId - ); + hThread = CreateRemoteThread(hProc, nullptr, 0, (LPTHREAD_START_ROUTINE)start_addr, (LPVOID)param, 0, nullptr); if (!hThread) // jichi: this function returns nullptr instead of -1 hThread = INVALID_HANDLE_VALUE; - //} ITH_EXCEPT { - // ITH_WARN(L"exception"); - // hThread = INVALID_HANDLE_VALUE; - //} - } - /* - else { - // jichi 9/29/2013: Also work on Wine and Windows 7 - // See: http://waleedassar.blogspot.com/2012/06/createremotethread-vs.html - CLIENT_ID id; - //DWORD size = DEFAULT_STACK_LIMIT, - // commit = DEFAULT_STACK_COMMIT; - DWORD reserve = 0, - commit = 0; - // http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/Executable%20Images/RtlCreateUserThread.html - // NTSYSAPI - // NTSTATUS - // NTAPI - // RtlCreateUserThread( - // IN HANDLE ProcessHandle, - // IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, - // IN BOOLEAN CreateSuspended, - // IN ULONG StackZeroBits, - // IN OUT PULONG StackReserved, - // IN OUT PULONG StackCommit, - // IN PVOID StartAddress, - // IN PVOID StartParameter OPTIONAL, - // OUT PHANDLE ThreadHandle, - // OUT PCLIENT_ID ClientID); - if (!NT_SUCCESS(RtlCreateUserThread( - hProc, // HANDLE hProcess, - nullptr, // IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, - FALSE, // IN BOOLEAN CreateSuspended, - 0, // IN ULONG StackZeroBits, - &reserve, // IN OUT PULONG StackReserved, - &commit, // IN OUT PULONG StackCommit, - (LPVOID)start_addr, // IN PVOID StartAddress, - (LPVOID)param,// IN PVOID StartParameter OPTIONAL, - &hThread, // OUT PHANDLE ThreadHandle, - &id // OUT PCLIENT_ID ClientID - ))) - hThread = INVALID_HANDLE_VALUE; - } - */ + return hThread; } @@ -1432,129 +1148,4 @@ DWORD GetExportAddress(DWORD hModule,DWORD hash) return 0; } -} // extern "C" - -// EOF - -/*__declspec(naked) void normal_asm() -{ - __asm - { - push ecx - push edx - mov fs:[0],esp - push ebp - call eax -_terminate: - push eax - push -2 - call dword ptr [NtTerminateThread] - } -}*/ - -/* -__declspec(naked) void RegToStrAsm() -{ - __asm - { - mov edx, 8 -_cvt_loop: - mov eax, ecx - and eax, 0xF - cmp eax, 0xA - jb _below_ten - add al,7 -_below_ten: - add al,0x30 - stosw - ror ecx,4 - dec edx - jne _cvt_loop - retn - } -} -__declspec(naked) void except_asm() -{ - __asm - { - mov eax,[esp + 4] - xor esi,esi - mov ebp,[eax] - mov ecx,[esp + 0xC] - mov ebx,[ecx + 0xB8] - sub esp,0x240 - lea edi,[esp + 0x40] - mov eax,esp - push esi - push 0x1C - push eax - push esi - push ebx - push -1 - call dword ptr [NtQueryVirtualMemory] - test eax,eax - jne _terminate - mov eax,esp - push eax - push 0x200 - push edi - push 2 - push ebx - push -1 - call dword ptr [NtQueryVirtualMemory] - test eax,eax - jne _terminate - pop esi - xadd edi,esi - std - mov al,0x5C - repen scasw - mov word ptr [edi + 2], 0x3A - mov ecx,ebx - sub ecx,[esp] - call RegToStrAsm - inc edi - inc edi - xchg esi,edi - mov ecx,ebp - call RegToStrAsm - inc edi - inc edi - xor eax,eax - mov [edi + 0x10], eax - push 0 - push edi - push esi - push 0 - call dword ptr [MessageBoxW] - or eax, -1 - jmp _terminate - } -} - -//Prompt for file name. -HANDLE IthPromptCreateFile(DWORD option, DWORD share, DWORD disposition) -{ - OPENFILENAME ofn = {sizeof(ofn)}; // common dialog box structure - WCHAR szFile[MAX_PATH]; // buffer for file name - wcscpy(current_dir,L"ITH_export.txt"); - wcscpy(szFile,file_path); - - //szFile[0]=0; - ofn.lpstrFile = szFile + 4; - ofn.nMaxFile = MAX_PATH; - ofn.lpstrFilter = L"Text\0*.txt"; - BOOL result; - if (disposition==FILE_OPEN) - result=GetOpenFileName(&ofn); - else - result=GetSaveFileName(&ofn); - if (result) - { - LPWSTR s=szFile+wcslen(szFile) - 4; - if (_wcsicmp(s,L".txt")!=0) wcscpy(s + 4,L".txt"); - return IthCreateFileFullPath(szFile,option,share,disposition); - } - else return INVALID_HANDLE_VALUE; -} -*/ +} // extern "C" \ No newline at end of file diff --git a/vnr/ithsys/ithsys.h b/vnr/ithsys/ithsys.h index eb00cf8..0628d20 100644 --- a/vnr/ithsys/ithsys.h +++ b/vnr/ithsys/ithsys.h @@ -51,7 +51,7 @@ HANDLE IthCreateMutex(LPCWSTR name, BOOL InitialOwner, DWORD *exist=0); HANDLE IthOpenMutex(LPCWSTR name); BOOL IthReleaseMutex(HANDLE hMutex); //DWORD IthWaitForSingleObject(HANDLE hObject, DWORD dwTime); -HANDLE IthCreateThread(LPCVOID start_addr, DWORD param, HANDLE hProc=(HANDLE)-1); +HANDLE IthCreateRemoteThread(LPCVOID start_addr, DWORD param, HANDLE hProc=(HANDLE)-1); DWORD GetExportAddress(DWORD hModule,DWORD hash); void IthSleep(int time); // jichi 9/28/2013: in ms void IthSystemTimeToLocalTime(LARGE_INTEGER *ptime); @@ -116,8 +116,6 @@ class IthMutexLocker void unlock() { if (m != INVALID_HANDLE_VALUE) { IthReleaseMutex(m); m = INVALID_HANDLE_VALUE; } } }; -void IthCoolDown(); - BOOL IthIsWine(); /** Get current dll path. diff --git a/vnr/texthook/host/pipe.cc b/vnr/texthook/host/pipe.cc index eaa1a30..78d1c28 100644 --- a/vnr/texthook/host/pipe.cc +++ b/vnr/texthook/host/pipe.cc @@ -128,7 +128,7 @@ void CreateNewPipe() return; } - hThread = IthCreateThread(RecvThread, (DWORD)hTextPipe); + hThread = IthCreateRemoteThread(RecvThread, (DWORD)hTextPipe); man->RegisterPipe(hTextPipe, hCmdPipe, hThread); } diff --git a/vnr/vnrhook/src/engine/match.cc b/vnr/vnrhook/src/engine/match.cc index 619cf3f..3ada28d 100644 --- a/vnr/vnrhook/src/engine/match.cc +++ b/vnr/vnrhook/src/engine/match.cc @@ -915,7 +915,7 @@ void Engine::hijack() { if (!hijackThread) { ConsoleOutput("vnreng: hijack process"); - hijackThread = IthCreateThread(hijackThreadProc, 0); + hijackThread = IthCreateRemoteThread(hijackThreadProc, 0); } } diff --git a/vnr/vnrhook/src/hijack/texthook.cc b/vnr/vnrhook/src/hijack/texthook.cc index 27f4f20..cb69909 100644 --- a/vnr/vnrhook/src/hijack/texthook.cc +++ b/vnr/vnrhook/src/hijack/texthook.cc @@ -486,8 +486,6 @@ DWORD TextHook::UnsafeSend(DWORD dwDataBase, DWORD dwRetn) *((DWORD *)pbData + 2) = dwSplit; if (dwCount) { IO_STATUS_BLOCK ios = {}; - - IthCoolDown(); // jichi 9/28/2013: cool down to prevent parallelization in wine //CliLockPipe(); if (STATUS_PENDING == NtWriteFile(::hPipe, 0, 0, 0, &ios, pbData, dwCount + HEADER_SIZE, 0, 0)) { NtWaitForSingleObject(::hPipe, 0, 0); diff --git a/vnr/vnrhook/src/main.cc b/vnr/vnrhook/src/main.cc index ffd51b1..4841879 100644 --- a/vnr/vnrhook/src/main.cc +++ b/vnr/vnrhook/src/main.cc @@ -231,8 +231,8 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD fdwReason, LPVOID lpReserved) AddAllModules(); InitFilterTable(); - hSendThread = IthCreateThread(WaitForPipe, 0); - hCmdThread = IthCreateThread(CommandPipe, 0); + hSendThread = IthCreateRemoteThread(WaitForPipe, 0); + hCmdThread = IthCreateRemoteThread(CommandPipe, 0); } break; case DLL_PROCESS_DETACH: { @@ -263,7 +263,7 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD fdwReason, LPVOID lpReserved) for (TextHook *man = ::hookman; man->RemoveHook(); man++); //LARGE_INTEGER lint = {-10000, -1}; while (::enter_count) - IthSleep(1); // jichi 9/28/2013: sleep for 1 ms + Sleep(1); // jichi 9/28/2013: sleep for 1 ms //NtDelayExecution(0, &lint); for (TextHook *man = ::hookman; man < ::hookman + MAX_HOOK; man++) man->ClearHook(); diff --git a/vnr/vnrhook/src/pipe.cc b/vnr/vnrhook/src/pipe.cc index 59a2a59..c1bb2de 100644 --- a/vnr/vnrhook/src/pipe.cc +++ b/vnr/vnrhook/src/pipe.cc @@ -145,7 +145,6 @@ DWORD WINAPI WaitForPipe(LPVOID lpThreadParameter) // Dynamically detect ITH mai if (hookman[i].RemoveHook()) count++; if (!::running) { - IthCoolDown(); // jichi 9/28/2013: Use cooldown instead of lock pipe to prevent from hanging on exit //CliLockPipe(); //NtWriteFile(::hPipe, 0, 0, 0, &ios, man, 4, 0, 0); NtWriteFile(::hPipe, 0, 0, 0, &ios, hookman, 4, 0, 0); diff --git a/vnr/vnrhook/src/util/util.cc b/vnr/vnrhook/src/util/util.cc index def0a24..d401abc 100644 --- a/vnr/vnrhook/src/util/util.cc +++ b/vnr/vnrhook/src/util/util.cc @@ -308,7 +308,7 @@ bool Util::unloadCurrentModule() { auto fun = ::FreeLibrary; //auto fun = ::LdrUnloadDll; - if (HANDLE h = ::IthCreateThread(fun, (DWORD)&__ImageBase)) { + if (HANDLE h = ::IthCreateRemoteThread(fun, (DWORD)&__ImageBase)) { //const LONGLONG timeout = -50000000; // in nanoseconds = 5 seconds //NtWaitForSingleObject(h, 0, (PLARGE_INTEGER)&timeout); NtClose(h); From 2ecb2a662fe8cf45dcdce2d362ffd6c4dfcc3af9 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 25 Apr 2018 04:00:54 -0400 Subject: [PATCH 6/7] remove more unneeded files --- todos.txt | 1 + vnr/texthook/host/CMakeLists.txt | 4 -- vnr/texthook/host/textthread.cc | 1 - vnr/texthook/ihf_p.cc | 1 - vnr/texthook/textthread_p.cc | 1 - vnr/wintimer/wintimer.cc | 49 ----------------- vnr/wintimer/wintimer.h | 93 -------------------------------- vnr/wintimer/wintimerbase.cc | 73 ------------------------- vnr/wintimer/wintimerbase.h | 68 ----------------------- 9 files changed, 1 insertion(+), 290 deletions(-) create mode 100644 todos.txt delete mode 100644 vnr/wintimer/wintimer.cc delete mode 100644 vnr/wintimer/wintimer.h delete mode 100644 vnr/wintimer/wintimerbase.cc delete mode 100644 vnr/wintimer/wintimerbase.h diff --git a/todos.txt b/todos.txt new file mode 100644 index 0000000..590010d --- /dev/null +++ b/todos.txt @@ -0,0 +1 @@ +Test with english encoding. \ No newline at end of file diff --git a/vnr/texthook/host/CMakeLists.txt b/vnr/texthook/host/CMakeLists.txt index 7bac1f4..b4e7da5 100644 --- a/vnr/texthook/host/CMakeLists.txt +++ b/vnr/texthook/host/CMakeLists.txt @@ -20,10 +20,6 @@ set(vnrhost_src pipe.cc textthread.cc ${PROJECT_SOURCE_DIR}/winmutex/winmutex.h -# ${PROJECT_SOURCE_DIR}/wintimer/wintimer.h -# ${PROJECT_SOURCE_DIR}/wintimer/wintimer.cc -# ${PROJECT_SOURCE_DIR}/wintimer/wintimerbase.cc -# ${PROJECT_SOURCE_DIR}/wintimer/wintimerbase.h ${PROJECT_SOURCE_DIR}/windbg/windbg.h ${PROJECT_SOURCE_DIR}/windbg/windbg_p.h ${PROJECT_SOURCE_DIR}/windbg/inject.h diff --git a/vnr/texthook/host/textthread.cc b/vnr/texthook/host/textthread.cc index 6f200c2..1dd5111 100644 --- a/vnr/texthook/host/textthread.cc +++ b/vnr/texthook/host/textthread.cc @@ -9,7 +9,6 @@ #include "settings.h" #include "textthread.h" -//#include "wintimer/wintimer.h" #include "vnrhook/include/const.h" #include "ithsys/ithsys.h" #include diff --git a/vnr/texthook/ihf_p.cc b/vnr/texthook/ihf_p.cc index b456c4f..4f00ee1 100644 --- a/vnr/texthook/ihf_p.cc +++ b/vnr/texthook/ihf_p.cc @@ -7,7 +7,6 @@ #include "host/host.h" #include "vnrhook/include/types.h" #include "ithsys/ithsys.h" -#include "wintimer/wintimer.h" #include #ifdef WITH_LIB_WINMAKER diff --git a/vnr/texthook/textthread_p.cc b/vnr/texthook/textthread_p.cc index 9c9454f..f4da23e 100644 --- a/vnr/texthook/textthread_p.cc +++ b/vnr/texthook/textthread_p.cc @@ -4,7 +4,6 @@ #include "texthook/textthread_p.h" #include "texthook/texthook_p.h" #include "winmutex/winmutex.h" -#include "wintimer/wintimer.h" #include "host/textthread.h" #include diff --git a/vnr/wintimer/wintimer.cc b/vnr/wintimer/wintimer.cc deleted file mode 100644 index b8c22e0..0000000 --- a/vnr/wintimer/wintimer.cc +++ /dev/null @@ -1,49 +0,0 @@ -// wintimer.cc -// 6/6/2012 jichi - -#include "wintimer/wintimer.h" - -//#define DEBUG "wintimer.cc" -#include "sakurakit/skdebug.h" -#include -WINTIMER_BEGIN_NAMESPACE - -void WinTimer::singleShot(int msecs, const function_type &f, WId parent) -{ - Self *t = new Self(parent); - t->setInterval(msecs); - t->setSingleShot(true); - t->setFunction([=] { // Copy function f instead of pass by reference. - f(); - delete t; - }); - t->start(); -} - -WINTIMER_END_NAMESPACE - -// EOF - -/* -// - Single shot - - -namespace { // unnamed - -class apply_delete -{ - typedef WinTimer::function_type function_type; - function_type f_; - WinTimer *t_; -public: - apply_delete(const function_type &f, WinTimer *t) - : f_(f), t_(t) { Q_ASSERT(t); } - - void operator()() - { - f_(); - delete t_; - } -}; - -} // unnamed namespace -*/ diff --git a/vnr/wintimer/wintimer.h b/vnr/wintimer/wintimer.h deleted file mode 100644 index 8605854..0000000 --- a/vnr/wintimer/wintimer.h +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once - -// wintimer.h -// 6/6/2012 jichi -// -// A light-weighted native windows timer as a replacement of QTimer from Qt. -// Implementation is based on Windows Messaging. A visible parent hwnd is required. -// -// This timer is critical where QTimer or event loop are not available, or need to -// warp to different event loop. Some usage cases follow: -// - Used by texthook as a replacement of QTimer in non-QThread -// - Used by qapplicationloader to implement pseudo event loop -// - Used by winhook to synchronize with window event loop across threads - -#include "wintimer/wintimerbase.h" -#include - -/** - * @brief A light-weighted native windows timer as a replacement of QTimer. - * - * Needed when in a thread where event loop is not accessible. - * Implemented using extensive inlining over pimp, so that the entire class - * could be put on the stack without heap. - * - * Each timer requires an valid visible window's handle to synchronize with. - * Either specify the window handle with the parent window or a global window. - */ -class WinTimer : protected WinTimerBase -{ - SK_EXTEND_CLASS(WinTimer, WinTimerBase) - SK_DISABLE_COPY(WinTimer) - - // - Construction - -public: - //typedef std::function function_type; - using Base::function_type; ///< std::function - - /// Default parent window of all timers. - static WId globalWindow() { return Base::globalWindow; } - static void setGlobalWindow(WId winId) { Base::globalWindow = winId; } - - //static WId createHiddenWindow(); - -public: - /// Construct a timer with the parent window handle. - explicit WinTimer(WId parentWindow = 0) { setParentWindow(parentWindow); } - - static void singleShot(int msecs, const function_type &f, WId parent = 0); - - // - Properties - -public: - using Base::isActive; - using Base::isSingleShot; - - void setSingleShot(bool t) { Base::singleShot = t; } - - //bool isEmpty() const { return Base::function.empty(); } - - WId parentWindow() const { return Base::parentWindow; } - void setParentWindow(WId winId) { Base::parentWindow = winId ? winId : Base::globalWindow; } - - int interval() const { return Base::interval; } - void setInterval(int msecs) { Base::interval = msecs; } - - /// Timeout callback when trigger. - void setFunction(const function_type &f) { Base::function = f; } - - /// @overload Set callback to a class method - template - void setMethod(Class *obj, Member mfunc) - { setFunction(boost::bind(mfunc, obj)); } - - /// @overload Set callback to a const class method - template - void setMethod(const Class *obj, Member mfunc) - { setFunction(boost::bind(mfunc, obj)); } - - // - Actions - -public: - /// Start TimerProc - using Base::start; - - /// Stop TimerProc - using Base::stop; - - /// Reset interval and start TimerProc - void start(int interval) { setInterval(interval); start(); } - - /// Invoke the callback. This function is the callback of the underlying TimerProc - using Base::trigger; -}; - -WINTIMER_END_NAMESPACE diff --git a/vnr/wintimer/wintimerbase.cc b/vnr/wintimer/wintimerbase.cc deleted file mode 100644 index ac4fd95..0000000 --- a/vnr/wintimer/wintimerbase.cc +++ /dev/null @@ -1,73 +0,0 @@ -// wintimerbase.cc -// 6/6/2012 jichi - -#include "wintimer/wintimerbase.h" -#ifdef QT_CORE_LIB -# include -#else -# include -#endif // QT_CORE_LIB -#include "ccutil/ccmacro.h" - -//#define DEBUG "wintimerbase.cc" -#include "sakurakit/skdebug.h" - -static VOID CALLBACK WinTimerProc( - HWND hwnd, // ウィンドウのハンドル - UINT uMsg, // WM_TIMER メッセージ - UINT_PTR idEvent, // Timer ID - DWORD dwTime // 現在のシステム時刻 -) -{ - Q_UNUSED(hwnd) - Q_UNUSED(dwTime) - Q_UNUSED(uMsg) - Q_ASSERT(idEvent); - if (CC_UNLIKELY(!idEvent)) - return; - DOUT("enter"); - WinTimerBase *t = reinterpret_cast(idEvent); - - if (t->isSingleShot() && t->isActive()) - t->stop(); - t->trigger(); - DOUT("leave"); -} - -WINTIMER_BEGIN_NAMESPACE - -// - Construction - - -WId WinTimerBase::globalWindow; - -//WId WinTimer::createHiddenWindow() -//{ -// DOUT("enter: warning: hidden window used"); -// QWidget *w = new QWidget; -// w->resize(QSize()); -// w->show(); -// DOUT("leave"); -// return w->winId(); -//} - -// - Timer - - -void WinTimerBase::start() -{ - DOUT("enter: active =" << active << ", interval =" << interval); - active = true; - ::SetTimer(parentWindow, reinterpret_cast(this), interval, WinTimerProc); - DOUT("leave"); -} - -void WinTimerBase::stop() -{ - DOUT("enter: active =" << active); - active = false; - ::KillTimer(parentWindow, reinterpret_cast(this)); - DOUT("leave"); -} - -WINTIMER_END_NAMESPACE - -// EOF diff --git a/vnr/wintimer/wintimerbase.h b/vnr/wintimer/wintimerbase.h deleted file mode 100644 index b1999f7..0000000 --- a/vnr/wintimer/wintimerbase.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -// wintimerbase.h -// 6/6/2012 jichi -// -// Internal header for wintimer base class. - -#include "sakurakit/skglobal.h" -#include - -#ifdef QT_CORE_LIB -# include -#else -# include -#endif // QT_CORE_LIB - -#ifndef WINTIMER_BEGIN_NAMESPACE -# define WINTIMER_BEGIN_NAMESPACE -#endif -#ifndef WINTIMER_END_NAMESPACE -# define WINTIMER_END_NAMESPACE -#endif - -WINTIMER_BEGIN_NAMESPACE - -/// Internal base class for WinTimer -class WinTimerBase -{ - SK_CLASS(WinTimerBase) - SK_DISABLE_COPY(WinTimerBase) - - // - Types - -public: - typedef std::function function_type; -#ifndef QT_CORE_LIB - typedef HWND WId; -#endif // QT_CORE_LIB - - // - Methods - -public: - /// Construct a timer with the parent window handle. - WinTimerBase() - : parentWindow(0), // use 0 instead of nullptr to be consistent with Qt5 - interval(0), singleShot(false), active(false) {} - - bool isSingleShot() const { return singleShot; } - bool isActive() const { return active; } - - /// Start TimerProc - void start(); - /// Stop TimerProc - void stop(); - /// Invoke the callback. This function is the callback of the underlying TimerProc - void trigger() { function(); } - - // - Fields - -protected: - static WId globalWindow; - - WId parentWindow; - int interval; - bool singleShot; - bool active; - function_type function; - -}; - -WINTIMER_END_NAMESPACE From deeb0b2d5552dd59495b6ee412d6a80e6addf569 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 25 Apr 2018 04:11:34 -0400 Subject: [PATCH 7/7] remove unneeded abstraction --- vnr/copy_vnr.cmd | 1 - vnr/vnrhook/CMakeLists.txt | 2 -- vnr/vnrhook/src/engine/engine.cc | 19 ++++++++++++++++--- vnr/winversion/winversion.cc | 30 ------------------------------ vnr/winversion/winversion.h | 16 ---------------- 5 files changed, 16 insertions(+), 52 deletions(-) delete mode 100644 vnr/winversion/winversion.cc delete mode 100644 vnr/winversion/winversion.h diff --git a/vnr/copy_vnr.cmd b/vnr/copy_vnr.cmd index bacb760..e66063b 100644 --- a/vnr/copy_vnr.cmd +++ b/vnr/copy_vnr.cmd @@ -18,7 +18,6 @@ xcopy %1\cpp\libs\ntinspect ntinspect /S /Y /I xcopy %1\cpp\libs\winkey winkey /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 xcopy %1\cpp\libs\wintimer wintimer /S /Y /I xcopy %1\cpp\libs\windbg windbg /S /Y /I diff --git a/vnr/vnrhook/CMakeLists.txt b/vnr/vnrhook/CMakeLists.txt index 6f0b7d7..21b673c 100644 --- a/vnr/vnrhook/CMakeLists.txt +++ b/vnr/vnrhook/CMakeLists.txt @@ -60,8 +60,6 @@ set(vnrhook_src ${PROJECT_SOURCE_DIR}/ntinspect/ntinspect.cc ${PROJECT_SOURCE_DIR}/ntinspect/ntinspect.h ${PROJECT_SOURCE_DIR}/winkey/winkey.h - ${PROJECT_SOURCE_DIR}/winversion/winversion.cc - ${PROJECT_SOURCE_DIR}/winversion/winversion.h ${PROJECT_SOURCE_DIR}/mono/monoobject.h ${PROJECT_SOURCE_DIR}/mono/monotype.h ) diff --git a/vnr/vnrhook/src/engine/engine.cc b/vnr/vnrhook/src/engine/engine.cc index 43aeef7..2be78ac 100644 --- a/vnr/vnrhook/src/engine/engine.cc +++ b/vnr/vnrhook/src/engine/engine.cc @@ -19,7 +19,6 @@ #include "memdbg/memsearch.h" #include "ntinspect/ntinspect.h" #include "disasm/disasm.h" -#include "winversion/winversion.h" #include "hashutil/hashstr.h" #include "cpputil/cppcstring.h" #include "ccutil/ccmacro.h" @@ -16633,8 +16632,22 @@ bool InsertPPSSPPHooks() ConsoleOutput("vnreng: PPSSPP: enter"); - if (!WinVersion::queryFileVersion(process_path_, PPSSPP_VERSION)) - ConsoleOutput("vnreng: failed to get PPSSPP version"); + // http://stackoverflow.com/questions/940707/how-do-i-programatically-get-the-version-of-a-dll-or-exe-file + // get the version info for the file requested + if (DWORD dwSize = ::GetFileVersionInfoSizeW(process_path_, nullptr)) { + UINT len = 0; + BYTE *buf = new BYTE[dwSize]; + VS_FIXEDFILEINFO *info = nullptr; + if (::GetFileVersionInfoW(process_path_, 0, dwSize, buf) + && ::VerQueryValueW(buf, L"\\", (LPVOID*)&info, &len) + && info) { + PPSSPP_VERSION[0] = HIWORD(info->dwFileVersionMS), + PPSSPP_VERSION[1] = LOWORD(info->dwFileVersionMS), + PPSSPP_VERSION[2] = HIWORD(info->dwFileVersionLS), + PPSSPP_VERSION[3] = LOWORD(info->dwFileVersionLS); + } + delete[] buf; + } InsertPPSSPPHLEHooks(); diff --git a/vnr/winversion/winversion.cc b/vnr/winversion/winversion.cc deleted file mode 100644 index 4a1a3ad..0000000 --- a/vnr/winversion/winversion.cc +++ /dev/null @@ -1,30 +0,0 @@ -// winversion.cc -// 9/5/2014 jichi - -#include "winversion/winversion.h" -#include - -// http://stackoverflow.com/questions/940707/how-do-i-programatically-get-the-version-of-a-dll-or-exe-file -bool WinVersion::queryFileVersion(const wchar_t *path, int ver[]) -{ - bool ok = false; - // get the version info for the file requested - if (DWORD dwSize = ::GetFileVersionInfoSizeW(path, nullptr)) { - UINT len = 0; - BYTE *buf = new BYTE[dwSize]; - VS_FIXEDFILEINFO *info = nullptr; - ok = ::GetFileVersionInfoW(path, 0, dwSize, buf) - && ::VerQueryValueW(buf, L"\\", (LPVOID*)&info, &len) - && info; - if (ok) { - ver[0] = HIWORD(info->dwFileVersionMS), - ver[1] = LOWORD(info->dwFileVersionMS), - ver[2] = HIWORD(info->dwFileVersionLS), - ver[3] = LOWORD(info->dwFileVersionLS); - } - delete[] buf; - } - return ok; -} - -// EOF diff --git a/vnr/winversion/winversion.h b/vnr/winversion/winversion.h deleted file mode 100644 index 4bff0d0..0000000 --- a/vnr/winversion/winversion.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -// winversion.h -// 9/5/2014 jichi - -#ifdef _MSC_VER -# include // for wchar_t -#endif // _MSC_VER - -namespace WinVersion { - -bool queryFileVersion(const wchar_t *path, int ver[4]); - -} // namespace WinVersion - -// EOF