diff --git a/vnr/sakurakit/skautorun.h b/vnr/sakurakit/skautorun.h deleted file mode 100644 index 2081492..0000000 --- a/vnr/sakurakit/skautorun.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SKAUTORUN_H -#define SKAUTORUN_H - -// skautorun.h -// 9/30/2012 jichi - -#include "sakurakit/skglobal.h" -#include - -SK_BEGIN_NAMESPACE - -class SkAutoRun -{ -public: - typedef std::function function_type; - SkAutoRun(const function_type &start, const function_type &exit) - : exit_(exit) { start(); } - ~SkAutoRun() { exit_(); } -private: - function_type exit_; -}; - -class SkAutoRunAtStartup -{ -public: - typedef SkAutoRun::function_type function_type; - explicit SkAutoRunAtStartup(const function_type &start) { start(); } -}; - -class SkAutoRunAtExit -{ -public: - typedef SkAutoRun::function_type function_type; - explicit SkAutoRunAtExit(const function_type &exit) : exit_(exit) {} - ~SkAutoRunAtExit() { exit_(); } -private: - function_type exit_; -}; - -SK_END_NAMESPACE - -#endif // SkAUTORUN_H diff --git a/vnr/sakurakit/skdebug.h b/vnr/sakurakit/skdebug.h deleted file mode 100644 index b1446a6..0000000 --- a/vnr/sakurakit/skdebug.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SKDEBUG_H -#define SKDEBUG_H - -// skdebug.h -// 10/16/2011 jichi -// Macros for debug. - -// Debug I/O -// - DPRINT: similar to fprintf, or KDPrint. Print to qDebug -// - DOUT: similar to std::cout. Print to qDebug -// - DERR: similar to std::cerr. Print to qWarning -#if defined(DEBUG) && !defined(SK_NO_DEBUG) - -# if defined(QT_CORE_LIB) && !defined(SK_NO_QT) -# include -# define DPRINT(...) qDebug(QString("%1:%2:").arg((DEBUG), (__FUNCTION__)).toLocal8Bit().constData(), __VA_ARGS__) -# define DOUT(_msg) qDebug() << QString("%1:%2:").arg((DEBUG), (__FUNCTION__)).toLocal8Bit().constData() << _msg -# define DERR(_msg) qWarning() << QString("%1:%2:").arg((DEBUG), (__FUNCTION__)).toLocal8Bit().constData() << _msg -# else -# include -# include -# define DPRINT(...) fprintf(stderr, DEBUG ":" __FUNCTION__ ": " __VA_ARGS__) -# define DWPRINT(...) fwprintf(stderr, DEBUG ":" __FUNCTION__ ": " __VA_ARGS__) -# define DOUT(_msg) std::cout << DEBUG << ":" << __FUNCTION__ << ": " << _msg << std::endl -# define DWOUT(_msg) std::wcout << DEBUG << ":" << __FUNCTION__ << ": " << _msg << std::endl -# define DERR(_msg) std::cerr << DEBUG << ":" << __FUNCTION__ << ": " << _msg << std::endl -# define DWERR(_msg) std::wcerr << DEBUG << ":" << __FUNCTION__ << ": " << _msg << std::endl -# endif // QT_CORE_LIB - -#else // DEBUG - -# define DPRINT(_dummy) (void)0 -# define DOUT(_dummy) (void)0 -# define DERR(_dummy) (void)0 - -//#ifdef _MSC_VER -//# pragma warning (disable:4390) // C4390: empty controlled statement found: is this the intent? -//#endif // _MSC_VER - -//#ifdef __GNUC__ -//# pragma GCC diagnostic ignored "-Wempty-body" // empty body in an if or else statement -//#endif // __GNUC__ - -#endif // DEBUG - -#endif // SKDEBUG_H diff --git a/vnr/sakurakit/skglobal.h b/vnr/sakurakit/skglobal.h deleted file mode 100644 index 233b089..0000000 --- a/vnr/sakurakit/skglobal.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef SKGLOBAL_H -#define SKGLOBAL_H - -// skglobal.h -// 9/15/2012 jichi -// Similar to QtGlobal from Qt. -// -// Conventions: -// - All classes in sakurakit will be wrapped with SK_BEGIN_NAMESPACE and SK_END_NAMESPACE -// - All classes from sakurakit begin with Sk, such as SkClassA. -// All functions from sakurakit begin with sk, such as skFuncA. - -// Redefine SK_BEGIN_NAMESPACE/SK_END_NAMESPACE if need custom namespace -#ifndef SK_BEGIN_NAMESPACE -# define SK_BEGIN_NAMESPACE namespace Sk { -#endif -#ifndef SK_END_NAMESPACE -# define SK_END_NAMESPACE } // namespace Sk -#endif - -#define SK_FORWARD_DECLARE_CLASS(_name) SK_BEGIN_NAMESPACE class _name; SK_END_NAMESPACE -#define SK_FORWARD_DECLARE_STRUCT(_name) SK_BEGIN_NAMESPACE struct _name; SK_END_NAMESPACE - -SK_BEGIN_NAMESPACE -namespace Sk {} -SK_END_NAMESPACE - -// In case Qt is not avaliable - -//inline void sk_noop(void) {} -// -//template -//inline void skUnused(T &x) { (void)x; } - -#define SK_UNUSED(_var) (void)(_var) -#define SK_NOP SK_UNUSED(0) - -// same as Q_DISABLE_COPY and boost::noncopyable -// Disable when BOOST_PYTHON is enabled -#ifdef BOOST_PYTHON -# define SK_DISABLE_COPY(_class) -#else -# define SK_DISABLE_COPY(_class) \ - _class(const _class &); \ - _class &operator=(const _class &); -#endif // BOOST_PYTHON - -// - Qt-like Pimp - - -// Similar to QT_DECLARE_PRIVATE -#define SK_DECLARE_PRIVATE(_class) \ - friend class _class; \ - typedef _class D; \ - D *const d_; - -// Similar to QT_DECLARE_PUBLIC -#define SK_DECLARE_PUBLIC(_class) \ - friend class _class; \ - typedef _class Q; \ - Q *const q_; - -// - Self and Base - - -#define SK_CLASS(_self) \ - typedef _self Self; \ - Self *self() const { return const_cast(this); } - -#define SK_EXTEND_CLASS(_self, _base) \ - SK_CLASS(_self) \ - typedef _base Base; - -#define SK_UNDEF_POS QPoint(-1, -1) -#define SK_UNDEF_POSF QPointF(-1, -1) - -// - QWidget Style Class for QSS - - -// Read-only property -#define SK_STYLE_CLASS(_class) \ - Q_PROPERTY(QString class READ styleClass) \ - public: \ - QString styleClass() const { return #_class; } \ - private: - -// Read-write property -#define SK_SYNTHESIZE_STYLE_CLASS \ - Q_PROPERTY(QString class READ styleClass WRITE setStyleClass) \ - QString styleClass_; \ - public: \ - QString styleClass() const { return styleClass_; } \ - public slots: \ - void seStyleClass(const QString &value) { styleClass_ = value; } \ - private: - -#endif // SKGLOBAL_H diff --git a/vnr/sakurakit/skhash.h b/vnr/sakurakit/skhash.h deleted file mode 100644 index 68ebec6..0000000 --- a/vnr/sakurakit/skhash.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef SKHASH_H -#define SKHASH_H - -// skhash.h -// 8/1/2011 - -#include "sakurakit/skglobal.h" -#include - -SK_BEGIN_NAMESPACE - -enum : quint64 { djb2_hash0 = 5381 }; - -/// djb2: h = h*33 + c -inline quint64 djb2(const quint8 *str, quint64 hash = djb2_hash0) -{ - quint8 c; - while ((c = *str++)) - hash = ((hash << 5) + hash) + c; // hash * 33 + c - return hash; -} - -/// s: signed char -inline quint64 djb2_s(const char *str, quint64 hash = djb2_hash0) -{ - char c; - while ((c = *str++)) - hash = ((hash << 5) + hash) + c; // hash * 33 + c - return hash; -} - -/// n: length -inline quint64 djb2_n(const quint8 *str, size_t len, quint64 hash = djb2_hash0) -{ - while (len--) - hash = ((hash << 5) + hash) + (*str++); // hash * 33 + c - return hash; -} - -/// sdbm: hash(i) = hash(i - 1) * 65599 + str[i]; -inline quint64 sdbm(const quint8 *str, quint64 hash = 0) -{ - quint8 c; - while ((c = *str++)) - hash = c + (hash << 6) + (hash << 16) - hash; - return hash; -} - -inline quint64 loselose(const quint8 *str, quint64 hash = 0) -{ - quint8 c; - while ((c = *str++)) - hash += c; - return hash; -} - -SK_END_NAMESPACE - -#endif // SKHASH_H diff --git a/vnr/texthook/host/CMakeLists.txt b/vnr/texthook/host/CMakeLists.txt index d0f5673..22375ea 100644 --- a/vnr/texthook/host/CMakeLists.txt +++ b/vnr/texthook/host/CMakeLists.txt @@ -19,11 +19,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}/sakurakit/skdebug.h ${PROJECT_SOURCE_DIR}/extensions/Extensions.cpp ${PROJECT_SOURCE_DIR}/extensions/Extensions.h ) diff --git a/vnr/texthook/host/hookman.cc b/vnr/texthook/host/hookman.cc index 83a1840..8fcc59a 100644 --- a/vnr/texthook/host/hookman.cc +++ b/vnr/texthook/host/hookman.cc @@ -20,7 +20,6 @@ #include "profile/misc.h" #define DEBUG "vnrhost/hookman.cc" -#include "sakurakit/skdebug.h" namespace { // unnamed //enum { MAX_ENTRY = 0x40 }; diff --git a/vnr/texthook/host/host.cc b/vnr/texthook/host/host.cc index b64d101..80cae9a 100644 --- a/vnr/texthook/host/host.cc +++ b/vnr/texthook/host/host.cc @@ -21,7 +21,6 @@ #include "extensions/Extensions.h" #define DEBUG "vnrhost/host.cc" -#include "sakurakit/skdebug.h" namespace { // unnamed diff --git a/vnr/texthook/host/pipe.cc b/vnr/texthook/host/pipe.cc index 9204dab..8420eac 100644 --- a/vnr/texthook/host/pipe.cc +++ b/vnr/texthook/host/pipe.cc @@ -15,7 +15,6 @@ //#include #define DEBUG "vnrhost/pipe.cc" -#include "sakurakit/skdebug.h" //DWORD WINAPI UpdateWindows(LPVOID lpThreadParameter); diff --git a/vnr/vnrhook/src/engine/pchooks.cc b/vnr/vnrhook/src/engine/pchooks.cc index 4c6442b..d3c8372 100644 --- a/vnr/vnrhook/src/engine/pchooks.cc +++ b/vnr/vnrhook/src/engine/pchooks.cc @@ -6,7 +6,6 @@ //#include #define DEBUG "vnrcli" -#define DPRINT(cstr) ConsoleOutput(DEBUG ":" __FUNCTION__ ":" cstr) // defined in vnrcli // 8/1/2014 jichi: Split is not used. // Although split is specified, USING_SPLIT is not assigned. @@ -41,7 +40,7 @@ // jichi 7/17/2014: Renamed from InitDefaultHook void PcHooks::hookGDIFunctions() { - DPRINT("enter"); + ConsoleOutput("enter"); // int TextHook::InitHook(LPVOID addr, DWORD data, DWORD data_ind, DWORD split_off, DWORD split_ind, WORD type, DWORD len_off) // // jichi 9/8/2013: Guessed meaning @@ -116,7 +115,7 @@ void PcHooks::hookGDIFunctions() NEW_HOOK(DrawTextW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3) NEW_HOOK(DrawTextExW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3) - DPRINT("leave"); + ConsoleOutput("leave"); } // jichi 6/18/2015: GDI+ functions @@ -124,11 +123,11 @@ void PcHooks::hookGDIPlusFunctions() { HMODULE hModule = ::GetModuleHandleA("gdiplus.dll"); if (!hModule) { - DPRINT("not loaded"); + ConsoleOutput("not loaded"); return; } - DPRINT("enter"); + ConsoleOutput("enter"); enum stack { s_retaddr = 0 , s_arg1 = 4 * 1 // 0x4 @@ -152,14 +151,14 @@ void PcHooks::hookGDIPlusFunctions() NEW_MODULE_HOOK(hModule, GdipDrawString, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3) // GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush); NEW_MODULE_HOOK(hModule, GdipMeasureString, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3) // GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled ) - DPRINT("leave"); + ConsoleOutput("leave"); } // jichi 10/2/2013 // Note: All functions does not have NO_CONTEXT attribute and will be filtered. void PcHooks::hookLstrFunctions() { - DPRINT("enter"); + ConsoleOutput("enter"); // int TextHook::InitHook(LPVOID addr, DWORD data, DWORD data_ind, DWORD split_off, DWORD split_ind, WORD type, DWORD len_off) enum stack { @@ -200,12 +199,12 @@ void PcHooks::hookLstrFunctions() // unsigned char *_mbsinc_l(const unsigned char *current, _locale_t locale); //_(L"_strinc", _strinc, 4, 0,4,0, USING_STRING, 0) // 12/13/2013 jichi //_(L"_wcsinc", _wcsinc, 4, 0,4,0, USING_UNICODE|USING_STRING, 0) - DPRINT("leave"); + ConsoleOutput("leave"); } void PcHooks::hookWcharFunctions() { - DPRINT("enter"); + ConsoleOutput("enter"); // 12/1/2013 jichi: // AlterEgo // http://tieba.baidu.com/p/2736475133 @@ -250,7 +249,7 @@ void PcHooks::hookWcharFunctions() // http://sakuradite.com/topic/159 NEW_HOOK(MultiByteToWideChar, s_arg3, 0,4,0, USING_STRING, 4) NEW_HOOK(WideCharToMultiByte, s_arg3, 0,4,0, USING_UNICODE|USING_STRING, 4) - DPRINT("leave"); + ConsoleOutput("leave"); } void PcHooks::hookCharNextFunctions() @@ -265,14 +264,14 @@ void PcHooks::hookCharNextFunctions() //, s_arg6 = 4 * 6 // 0x18 }; - DPRINT("enter"); + ConsoleOutput("enter"); NEW_HOOK(CharNextA, s_arg1, 0,0,0, USING_STRING|DATA_INDIRECT, 1) // LPTSTR WINAPI CharNext(_In_ LPCTSTR lpsz); NEW_HOOK(CharNextW, s_arg1, 0,0,0, USING_UNICODE|DATA_INDIRECT, 1) NEW_HOOK(CharPrevA, s_arg1, 0,0,0, USING_STRING|DATA_INDIRECT, 1) // LPTSTR WINAPI CharPrev(_In_ LPCTSTR lpszStart, _In_ LPCTSTR lpszCurrent); NEW_HOOK(CharPrevW, s_arg1, 0,0,0, USING_UNICODE|DATA_INDIRECT, 1) //NEW_HOOK(CharNextExA, s_arg2, 0,0,0, USING_STRING|DATA_INDIRECT, 1) // LPSTR WINAPI CharNextExA(_In_ WORD CodePage, _In_ LPCSTR lpCurrentChar, _In_ DWORD dwFlags); //NEW_HOOK(CharNextExW, s_arg2, 0,0,0, USING_UNICODE|DATA_INDIRECT, 1) - DPRINT("leave"); + ConsoleOutput("leave"); } // EOF