forked from Public-Mirror/Textractor
remove silly macros
This commit is contained in:
parent
162b2cb79f
commit
47dccbf218
@ -1,26 +0,0 @@
|
||||
#ifndef CCMACRO_H
|
||||
#define CCMACRO_H
|
||||
|
||||
// ccmacro.h
|
||||
// 12/9/2011 jichi
|
||||
|
||||
#include <string>
|
||||
|
||||
#define CONCAT_STR_NUM(_str, _num) (std::wstring(_str) + std::to_wstring(_num)).c_str()
|
||||
#define CONCAT_STR_STR(_str1, _str2) (std::wstring(_str1) + std::wstring(_str2)).c_str()
|
||||
|
||||
#define CC_UNUSED(_var) (void)(_var)
|
||||
#define CC_NOP CC_UNUSED(0)
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define CC_LIKELY(expr) __builtin_expect(!!(expr), true)
|
||||
# define CC_UNLIKELY(expr) __builtin_expect(!!(expr), false)
|
||||
#else
|
||||
# define CC_LIKELY(x) (x)
|
||||
# define CC_UNLIKELY(x) (x)
|
||||
#endif
|
||||
|
||||
#define CC_MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define CC_MAX(x, y) ((x) < (y) ? (y) : (x))
|
||||
|
||||
#endif // CCMACRO_H
|
@ -7,7 +7,6 @@
|
||||
#include <cstddef> // for size_t
|
||||
#include <cstring>
|
||||
//#include <algorithm> // for std::min
|
||||
#include "ccutil/ccmacro.h"
|
||||
|
||||
// strlen
|
||||
|
||||
@ -60,7 +59,7 @@ inline const wchar_t *cpp_wcsnchr(const wchar_t *s, wchar_t c, size_t n) { retur
|
||||
#define cpp_basic_strnstr_(s, slen, r, rlen, ncmp) \
|
||||
{ \
|
||||
while (*s && slen >= rlen) { \
|
||||
if (ncmp(s, r, CC_MIN(slen, rlen)) == 0) \
|
||||
if (ncmp(s, r, slen < rlen ? slen : rlen) == 0) \
|
||||
return s; \
|
||||
s++, slen--; \
|
||||
} \
|
||||
|
@ -1,35 +0,0 @@
|
||||
#ifndef CPPLOCALE_H
|
||||
#define CPPLOCALE_H
|
||||
|
||||
// cpplocale.h
|
||||
// 9/26/2014 jichi
|
||||
|
||||
#include <locale>
|
||||
|
||||
#ifdef WITHOUT_CXX_CODECVT
|
||||
// http://www.boost.org/doc/libs/1_48_0/libs/serialization/doc/codecvt.html
|
||||
# define BOOST_UTF8_BEGIN_NAMESPACE
|
||||
# define BOOST_UTF8_END_NAMESPACE
|
||||
# define BOOST_UTF8_DECL
|
||||
# include <boost/detail/utf8_codecvt_facet.hpp>
|
||||
# include <boost/detail/utf8_codecvt_facet.ipp> // WARNING: This implementation should only be included ONCE
|
||||
# define CPPLOCALE_NEW_FACET_UTF8(charT) (new utf8_codecvt_facet) // charT is ignored and assumed to be wchar_t
|
||||
//# include <boost/detail/serialization/utf8_codecvt_facet.hpp>
|
||||
//# define CPPLOCALE_NEW_FACET_UTF8(charT) (new utf8_codecvt_facet<charT>)
|
||||
#else
|
||||
# include <codecvt>
|
||||
# define CPPLOCALE_NEW_FACET_UTF8(charT) (new std::codecvt_utf8<charT, 0x10ffff, std::consume_header>)
|
||||
#endif // WITHOUT_CXX_CODECVT
|
||||
|
||||
//#include <boost/locale.hpp>
|
||||
|
||||
// See: http://stackoverflow.com/questions/20195262/how-to-read-an-utf-8-encoded-file-containing-chinese-characters-and-output-them
|
||||
// The same as boost::locale::generator().generate("UTF-8"), which require linking
|
||||
// See: http://en.cppreference.com/w/cpp/locale/codecvt_utf8
|
||||
// - 0x10ffff is the default maximum value.
|
||||
// - std::consume_header will skip the leading encoding byte from the input.
|
||||
template <class charT>
|
||||
inline std::locale cpp_utf8_locale(std::locale init = std::locale()) //::empty())
|
||||
{ return std::locale(init, CPPLOCALE_NEW_FACET_UTF8(charT)); }
|
||||
|
||||
#endif // CPPLOCALE_H
|
@ -1,110 +0,0 @@
|
||||
#ifndef CPPMARSHAL_H
|
||||
#define CPPMARSHAL_H
|
||||
|
||||
// cppmarshal.h
|
||||
// 10/12/2014 jichi
|
||||
//
|
||||
// Functions are by default big-endian, the same as memory layout.
|
||||
#include "cpputil/cppcstring.h"
|
||||
#include "cpputil/cpptype.h"
|
||||
#include <cstring>
|
||||
|
||||
/* Read */
|
||||
|
||||
// Read number
|
||||
|
||||
template <typename valT, typename byteT>
|
||||
inline const byteT *cpp_marshal_getval(const byteT *p, valT *v)
|
||||
{ *v = *reinterpret_cast<const valT *>(p); return p + sizeof(valT); }
|
||||
|
||||
// Read pointer
|
||||
|
||||
template <typename ptrT, typename byteT> \
|
||||
inline const byteT *cpp_marshal_getptr(const byteT *p, ptrT v)
|
||||
{ return cpp_marshal_getval<unsigned long>(p, reinterpret_cast<unsigned long *>(v)); }
|
||||
|
||||
// Read string
|
||||
|
||||
template <typename charT, typename byteT>
|
||||
inline const byteT *cpp_marshal_getstr(const byteT *p, charT *s)
|
||||
{
|
||||
size_t n = cpp_basic_strlen(p);
|
||||
::memcpy(s, p, n + 1); // including '\0'
|
||||
return p + n + 1;
|
||||
}
|
||||
|
||||
template <typename charT, typename byteT>
|
||||
inline const byteT *cpp_marshal_getnstr(const byteT *p, charT *s, size_t n)
|
||||
{
|
||||
if (n = cpp_basic_strnlen(p, n))
|
||||
::memcpy(s, p, n); // including '\0'
|
||||
s[n] = 0;
|
||||
return p + n + 1;
|
||||
}
|
||||
|
||||
/* Write */
|
||||
|
||||
// Write number
|
||||
|
||||
template <typename valT, typename byteT>
|
||||
inline byteT *cpp_marshal_putval(byteT *p, valT v)
|
||||
{ *reinterpret_cast<valT *>(p) = v; return p + sizeof(valT); }
|
||||
|
||||
// Write pointer
|
||||
|
||||
template <typename ptrT, typename byteT> \
|
||||
inline byteT *cpp_marshal_putptr(byteT *p, ptrT v)
|
||||
{ return cpp_marshal_putval<unsigned long>(p, reinterpret_cast<unsigned long>(v)); }
|
||||
|
||||
// Write string
|
||||
|
||||
template <typename charT, typename byteT>
|
||||
inline byteT *cpp_marshal_putstr(byteT *p, charT *s)
|
||||
{
|
||||
size_t n = cpp_basic_strlen(s);
|
||||
::memcpy(p, s, n + 1); // including '\0'
|
||||
return p + n + 1;
|
||||
}
|
||||
|
||||
template <typename charT, typename byteT>
|
||||
inline byteT *cpp_marshal_putstr(byteT *p, charT *s, size_t n)
|
||||
{
|
||||
if (n = cpp_basic_strnlen(s, n))
|
||||
::memcpy(p, s, n); // including '\0'
|
||||
s[n] = 0;
|
||||
return p + n + 1;
|
||||
}
|
||||
|
||||
/* Expansion */
|
||||
|
||||
#define CPP_DECLARE_MARSHAL_GETVAL(type) \
|
||||
template <typename byteT> \
|
||||
inline const byteT *cpp_marshal_get##type(const byteT *p, cpp_##type *v) { return cpp_marshal_getval(p, v); }
|
||||
|
||||
#define CPP_DECLARE_MARSHAL_PUTVAL(type) \
|
||||
template <typename byteT> \
|
||||
inline byteT *cpp_marshal_put##type(byteT *p, cpp_##type v) { return cpp_marshal_putval(p, v); }
|
||||
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(float)
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(double)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(float)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(double)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(int)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(int8)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(int32)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(int64)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(uint)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(uint8)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(uint32)
|
||||
CPP_DECLARE_MARSHAL_GETVAL(uint64)
|
||||
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(int)
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(int8)
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(int32)
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(int64)
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(uint)
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(uint8)
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(uint32)
|
||||
CPP_DECLARE_MARSHAL_PUTVAL(uint64)
|
||||
|
||||
#endif // CPPMARSHAL_H
|
@ -1,25 +0,0 @@
|
||||
#ifndef CPPMATH_H
|
||||
#define CPPMATH_H
|
||||
|
||||
// cppmacro.h
|
||||
// 10/12/2014 jichi
|
||||
#include <cmath>
|
||||
|
||||
// The same as qMin
|
||||
template <typename T>
|
||||
inline const T &cpp_min(const T &a, const T &b) { return (a < b) ? a : b; }
|
||||
|
||||
// The same as qMax
|
||||
template <typename T>
|
||||
inline const T &cpp_max(const T &a, const T &b) { return (a < b) ? b : a; }
|
||||
|
||||
// The same as qBound
|
||||
template <typename T>
|
||||
inline const T &cpp_bound(const T &min, const T &val, const T &max)
|
||||
{ return cpp_max(min, cpp_min(max, val)); }
|
||||
|
||||
// The same as qFuzzyCompare
|
||||
inline bool cpp_fuzzy_compare(float p1, float p2)
|
||||
{ return (abs(p1 - p2) <= 0.00001f * cpp_min(abs(p1), abs(p2))); }
|
||||
|
||||
#endif // CPPMATH_H
|
@ -1,54 +0,0 @@
|
||||
#ifndef CPPPATH_H
|
||||
#define CPPPATH_H
|
||||
|
||||
// cpppath.h
|
||||
// 5/7/2014 jichi
|
||||
|
||||
#include <cstddef> // for size_t
|
||||
|
||||
enum : char { cpp_pathsep_unix = '/' , cpp_pathsep_win = '\\' };
|
||||
|
||||
// basename
|
||||
|
||||
template <class charT>
|
||||
inline const charT *cpp_basic_basename(const charT *s)
|
||||
{
|
||||
const charT *p = s;
|
||||
//if (s) // not checked
|
||||
for (; *s; s++)
|
||||
if (*s == cpp_pathsep_unix || *s == cpp_pathsep_win)
|
||||
p = s + 1;
|
||||
return p;
|
||||
}
|
||||
|
||||
//if (const char *r = ::strrchr(s, pathsep))
|
||||
// return r + 1; // skip the path seperator
|
||||
//else
|
||||
// return s;
|
||||
inline const char *cpp_basename(const char *s) { return cpp_basic_basename<char>(s); }
|
||||
|
||||
//if (const wchar_t *r = ::wcsrchr(s, pathsep))
|
||||
// return r + 1; // skip the path seperator
|
||||
//else
|
||||
// return s;
|
||||
inline const wchar_t *cpp_wbasename(const wchar_t *s) { return cpp_basic_basename<wchar_t>(s); }
|
||||
|
||||
// dirmame
|
||||
|
||||
/// Return the length so that s[len] == pathsep
|
||||
template <class charT>
|
||||
inline size_t cpp_basic_dirlen(const charT *s)
|
||||
{
|
||||
const charT *p = s,
|
||||
*t = s;
|
||||
//if (s) // not checked
|
||||
for (; *s; s++)
|
||||
if (*s == cpp_pathsep_unix || *s == cpp_pathsep_win)
|
||||
p = s + 1;
|
||||
return p - t;
|
||||
}
|
||||
|
||||
inline size_t cpp_wdirlen(const char *s) { return cpp_basic_dirlen<char>(s); }
|
||||
inline size_t cpp_wdirlen(const wchar_t *s) { return cpp_basic_dirlen<wchar_t>(s); }
|
||||
|
||||
#endif // CPPPATH_H
|
@ -1,18 +0,0 @@
|
||||
#ifndef CPPSTRING_H
|
||||
#define CPPSTRING_H
|
||||
|
||||
// cppstring.h
|
||||
// 10/12/2014 jichi
|
||||
|
||||
/#include <string>
|
||||
|
||||
// Initializers
|
||||
|
||||
template <typename charT>
|
||||
inline std::basic_string<charT> cpp_basic_string_of(const std::string &s)
|
||||
{ return std::basic_string<charT>(s.begin(), s.end()); }
|
||||
|
||||
inline std::wstring cpp_wstring_of(const std::string &s)
|
||||
{ return std::wstring(s.begin(), s.end()); }
|
||||
|
||||
#endif // CPPSTRING_H
|
@ -1,42 +0,0 @@
|
||||
#ifndef CPPTYPE_H
|
||||
#define CPPTYPE_H
|
||||
|
||||
// cpptype.h
|
||||
// 10/12/2014 jichi
|
||||
#include <cstdint>
|
||||
|
||||
// Platform-dependent
|
||||
|
||||
typedef char cpp_char;
|
||||
typedef unsigned char cpp_uchar;
|
||||
|
||||
typedef short cpp_short;
|
||||
typedef unsigned short cpp_ushort;
|
||||
|
||||
typedef int cpp_int;
|
||||
typedef unsigned int cpp_uint;
|
||||
|
||||
typedef long cpp_long;
|
||||
typedef unsigned long cpp_ulong;
|
||||
|
||||
typedef long long cpp_llong;
|
||||
typedef unsigned long long cpp_ullong;
|
||||
|
||||
typedef float cpp_float;
|
||||
typedef double cpp_double;
|
||||
|
||||
// Platform-independent
|
||||
|
||||
typedef int8_t cpp_int8;
|
||||
typedef uint8_t cpp_uint8;
|
||||
|
||||
typedef cpp_int8 cpp_byte;
|
||||
typedef cpp_uint8 cpp_ubyte;
|
||||
|
||||
typedef int32_t cpp_int32;
|
||||
typedef uint32_t cpp_uint32;
|
||||
|
||||
typedef int64_t cpp_int64;
|
||||
typedef uint64_t cpp_uint64;
|
||||
|
||||
#endif // CPPTYPE_H
|
@ -1,23 +0,0 @@
|
||||
#ifndef CPPUNICODE_H
|
||||
#define CPPUNICODE_H
|
||||
|
||||
#include <string>
|
||||
typedef std::basic_string<char16_t, std::char_traits<char16_t>, std::allocator<char16_t> > cpp_u16string;
|
||||
typedef std::basic_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t> > cpp_u32string;
|
||||
|
||||
// <fstream>
|
||||
#if defined(_FSTREAM_) || defined(_LIBCPP_FSTREAM) || defined(_GLIBCXX_FSTREAM)
|
||||
typedef std::basic_ifstream<char16_t, std::char_traits<char16_t> > cpp_u16ifstream;
|
||||
typedef std::basic_ifstream<char32_t, std::char_traits<char32_t> > cpp_u32ifstream;
|
||||
|
||||
typedef std::basic_ofstream<char16_t, std::char_traits<char16_t> > cpp_u16ofstream;
|
||||
typedef std::basic_ofstream<char32_t, std::char_traits<char32_t> > cpp_u32ofstream;
|
||||
|
||||
typedef std::basic_fstream<char16_t, std::char_traits<char16_t> > cpp_u16fstream;
|
||||
typedef std::basic_fstream<char32_t, std::char_traits<char32_t> > cpp_u32fstream;
|
||||
#endif // <fstream>
|
||||
|
||||
inline char16_t cpp_u32low(char32_t c) { return c; }
|
||||
inline char16_t cpp_u32high(char32_t c) { return c >> 16; }
|
||||
|
||||
#endif // CPPUNICODE_H
|
@ -16,8 +16,8 @@
|
||||
#include "vnrhook/include/defs.h"
|
||||
#include "vnrhook/include/types.h"
|
||||
#include "ithsys/ithsys.h"
|
||||
#include "ccutil/ccmacro.h"
|
||||
#include <commctrl.h>
|
||||
#include <string>
|
||||
#include "extensions/Extensions.h"
|
||||
|
||||
#define DEBUG "vnrhost/host.cc"
|
||||
@ -145,7 +145,7 @@ IHFSERVICE bool IHFAPI InjectProcessById(DWORD processId, DWORD timeout)
|
||||
success = false;
|
||||
}
|
||||
|
||||
CloseHandle(CreateMutexW(nullptr, FALSE, CONCAT_STR_NUM(ITH_HOOKMAN_MUTEX_, processId)));
|
||||
CloseHandle(CreateMutexW(nullptr, FALSE, (ITH_HOOKMAN_MUTEX_ + std::to_wstring(processId)).c_str()));
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
man->AddConsoleOutput(L"already locked");
|
||||
|
@ -43,14 +43,6 @@ set(vnrhook_src
|
||||
src/util/growl.h
|
||||
src/util/util.cc
|
||||
src/util/util.h
|
||||
${PROJECT_SOURCE_DIR}/ccutil/ccmacro.h
|
||||
${PROJECT_SOURCE_DIR}/cpputil/cpplocale.h
|
||||
${PROJECT_SOURCE_DIR}/cpputil/cppmarshal.h
|
||||
${PROJECT_SOURCE_DIR}/cpputil/cppmath.h
|
||||
${PROJECT_SOURCE_DIR}/cpputil/cpppath.h
|
||||
${PROJECT_SOURCE_DIR}/cpputil/cppstring.h
|
||||
${PROJECT_SOURCE_DIR}/cpputil/cpptype.h
|
||||
${PROJECT_SOURCE_DIR}/cpputil/cppunicode.h
|
||||
${PROJECT_SOURCE_DIR}/disasm/disasm.cc
|
||||
${PROJECT_SOURCE_DIR}/memdbg/memdbg.h
|
||||
${PROJECT_SOURCE_DIR}/memdbg/memsearch.cc
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "ntinspect/ntinspect.h"
|
||||
#include "disasm/disasm.h"
|
||||
#include "cpputil/cppcstring.h"
|
||||
#include "ccutil/ccmacro.h"
|
||||
#include "mono/monoobject.h"
|
||||
//#include <boost/foreach.hpp>
|
||||
#include <cstdio>
|
||||
@ -4345,7 +4344,7 @@ rUGP hook:
|
||||
********************************************************************************************/
|
||||
void SpecialHookRUGP1(DWORD esp_base, HookParam *hp, BYTE, DWORD *data, DWORD *split, DWORD *len)
|
||||
{
|
||||
CC_UNUSED(split);
|
||||
//CC_UNUSED(split);
|
||||
DWORD *stack = (DWORD *)esp_base;
|
||||
DWORD i, val;
|
||||
for (i = 0; i < 4; i++) {
|
||||
@ -6735,7 +6734,7 @@ bool InsertMalieHook2() // jichi 8/20/2013: Change return type to boolean
|
||||
*/
|
||||
void SpecialHookMalie2(DWORD esp_base, HookParam *, BYTE, DWORD *data, DWORD *split, DWORD *len)
|
||||
{
|
||||
CC_UNUSED(data);
|
||||
//CC_UNUSED(data);
|
||||
//*len = GetHookDataLength(*hp, esp_base, (DWORD)data);
|
||||
*len = 2;
|
||||
|
||||
@ -6909,7 +6908,7 @@ LPCWSTR _Malie3GetEOL(LPCWSTR p)
|
||||
|
||||
void SpecialHookMalie3(DWORD esp_base, HookParam *, BYTE, DWORD *data, DWORD *split, DWORD *len)
|
||||
{
|
||||
CC_UNUSED(split);
|
||||
//CC_UNUSED(split);
|
||||
DWORD ecx = regof(ecx, esp_base), // *(DWORD *)(esp_base + pusha_ecx_off - 4),
|
||||
edx = regof(edx, esp_base); // *(DWORD *)(esp_base + pusha_edx_off - 4);
|
||||
//*data = ecx + edx*2; // [ecx+edx*2];
|
||||
@ -7171,7 +7170,7 @@ bool InsertEMEHook()
|
||||
}
|
||||
static void SpecialRunrunEngine(DWORD esp_base, HookParam *, BYTE, DWORD *data, DWORD *split, DWORD *len)
|
||||
{
|
||||
CC_UNUSED(split);
|
||||
//CC_UNUSED(split);
|
||||
DWORD eax = regof(eax, esp_base), // *(DWORD *)(esp_base - 0x8),
|
||||
edx = regof(edx, esp_base); // *(DWORD *)(esp_base - 0x10);
|
||||
DWORD addr = eax + edx; // eax + edx
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "src/main.h"
|
||||
#include "src/except.h"
|
||||
#include "ithsys/ithsys.h"
|
||||
#include "ccutil/ccmacro.h"
|
||||
|
||||
//#define ConsoleOutput(...) (void)0 // jichi 8/18/2013: I don't need ConsoleOutput
|
||||
|
||||
@ -886,9 +885,9 @@ bool DetermineEngineType()
|
||||
//
|
||||
|
||||
HANDLE hijackThread;
|
||||
void hijackThreadProc(LPVOID lpThreadParameter)
|
||||
void hijackThreadProc(LPVOID unused)
|
||||
{
|
||||
CC_UNUSED(lpThreadParameter);
|
||||
//CC_UNUSED(lpThreadParameter);
|
||||
|
||||
//static bool done = false;
|
||||
//if (done)
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "include/const.h"
|
||||
#include "include/defs.h"
|
||||
#include "ithsys/ithsys.h"
|
||||
#include "ccutil/ccmacro.h"
|
||||
#include "util/util.h"
|
||||
#include <cstdio> // for swprintf
|
||||
//#include "ntinspect/ntinspect.h"
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "include/defs.h"
|
||||
#include "src/util/growl.h"
|
||||
#include "ithsys/ithsys.h"
|
||||
#include "ccutil/ccmacro.h"
|
||||
#include <cstdio> // for swprintf
|
||||
|
||||
HANDLE hookPipe;
|
||||
|
Loading…
x
Reference in New Issue
Block a user