LunaHook-mirror/include/const.h

125 lines
3.0 KiB
C
Raw Normal View History

2024-02-07 20:59:24 +08:00
#pragma once
// texthook/const.h
// 8/23/2013 jichi
// Branch: ITH/common.h, rev 128
2024-07-21 21:07:05 +08:00
enum
{
STRING = 12,
MESSAGE_SIZE = 500,
PIPE_BUFFER_SIZE = 50000,
SHIFT_JIS = 932,
MAX_MODULE_SIZE = 120,
PATTERN_SIZE = 30,
HOOK_NAME_SIZE = 60,
FIXED_SPLIT_VALUE = 0x10001,
HOOKCODE_LEN = 500
};
enum WildcardByte
{
XX = 0x11
};
2024-02-07 20:59:24 +08:00
2024-07-21 21:07:05 +08:00
enum HostCommandType
{
2024-02-07 20:59:24 +08:00
HOST_COMMAND_NEW_HOOK,
2024-07-21 21:07:05 +08:00
HOST_COMMAND_REMOVE_HOOK,
HOST_COMMAND_FIND_HOOK,
HOST_COMMAND_MODIFY_HOOK,
HOST_COMMAND_HIJACK_PROCESS,
HOST_COMMAND_DETACH
2024-02-07 20:59:24 +08:00
};
2024-07-21 21:07:05 +08:00
enum HostNotificationType
{
HOST_NOTIFICATION_TEXT,
HOST_NOTIFICATION_NEWHOOK,
HOST_NOTIFICATION_FOUND_HOOK,
2024-02-07 20:59:24 +08:00
HOST_NOTIFICATION_RMVHOOK,
HOST_NOTIFICATION_INSERTING_HOOK,
HOST_SETTEXTTHREADTYPE
};
2024-07-21 21:07:05 +08:00
#define NEXT_MASK(x) \
DUMMY1_##x, \
x = (1U << (DUMMY1_##x)), \
DUMMY2_##x = DUMMY1_##x
#define DECLARE_VALUE(x, v) \
DUMMY1_##x, \
x = v, \
DUMMY2_##x = DUMMY1_##x - 1
2024-02-07 20:59:24 +08:00
2024-02-08 21:48:24 +08:00
enum HookParamType : uint64_t
2024-02-07 20:59:24 +08:00
{
2024-07-21 21:07:05 +08:00
// 默认为CODEC_ANSI_LE&USING_CHAR
// 若使用了text_fun|hook_before会改为默认USING_STRING这时若其实是USING_CHAR需标明USING_STRING
DECLARE_VALUE(CODEC_ANSI_LE, 0),
2024-05-10 13:24:25 +08:00
NEXT_MASK(CODEC_ANSI_BE),
2024-07-21 21:07:05 +08:00
NEXT_MASK(CODEC_UTF8),
NEXT_MASK(CODEC_UTF16),
2024-05-10 13:24:25 +08:00
NEXT_MASK(CODEC_UTF32),
2024-02-07 20:59:24 +08:00
2024-07-21 21:07:05 +08:00
NEXT_MASK(USING_CHAR), // text_fun!=nullptr && (CODE_ANSI_BE||CODE_UTF16)
NEXT_MASK(USING_STRING),
2024-05-10 13:24:25 +08:00
NEXT_MASK(SPECIAL_JIT_STRING),
2024-07-21 21:07:05 +08:00
NEXT_MASK(FULL_STRING),
2024-05-10 13:24:25 +08:00
2024-07-21 21:07:05 +08:00
NEXT_MASK(DATA_INDIRECT),
NEXT_MASK(USING_SPLIT), // use ctx2 or not
NEXT_MASK(SPLIT_INDIRECT),
NEXT_MASK(FIXING_SPLIT),
NEXT_MASK(NO_CONTEXT),
2024-07-21 21:07:05 +08:00
NEXT_MASK(MODULE_OFFSET), // address is relative to module
NEXT_MASK(FUNCTION_OFFSET), // address is relative to function
2024-05-10 13:24:25 +08:00
2024-07-21 21:07:05 +08:00
NEXT_MASK(KNOWN_UNSTABLE),
NEXT_MASK(EMBED_ABLE),
NEXT_MASK(EMBED_DYNA_SJIS),
NEXT_MASK(EMBED_BEFORE_SIMPLE),
NEXT_MASK(EMBED_AFTER_NEW),
NEXT_MASK(EMBED_AFTER_OVERWRITE),
2024-05-10 13:24:25 +08:00
NEXT_MASK(EMBED_CODEC_UTF16),
2024-07-21 21:07:05 +08:00
DECLARE_VALUE(NORMAL_INLINEHOOK, 0),
2024-05-10 13:24:25 +08:00
NEXT_MASK(BREAK_POINT),
2024-07-21 21:07:05 +08:00
NEXT_MASK(DIRECT_READ), // /R read code instead of classic /H hook code
2024-05-10 14:00:53 +08:00
NEXT_MASK(HOOK_RETURN),
2024-07-21 21:07:05 +08:00
NEXT_MASK(HOOK_EMPTY),
2024-02-07 20:59:24 +08:00
};
enum HookFontType : unsigned
{
2024-07-21 21:07:05 +08:00
DECLARE_VALUE(NOT_HOOK_FONT, 0),
2024-05-10 13:24:25 +08:00
NEXT_MASK(F_CreateFontA),
NEXT_MASK(F_CreateFontW),
NEXT_MASK(F_CreateFontIndirectA),
NEXT_MASK(F_CreateFontIndirectW),
NEXT_MASK(F_GetGlyphOutlineA),
NEXT_MASK(F_GetGlyphOutlineW),
NEXT_MASK(F_GetTextExtentPoint32A),
NEXT_MASK(F_GetTextExtentPoint32W),
NEXT_MASK(F_GetTextExtentExPointA),
NEXT_MASK(F_GetTextExtentExPointW),
2024-07-21 21:07:05 +08:00
// F_GetCharABCWidthsA=0x
// F_GetCharABCWidthsW=0x
2024-05-10 13:24:25 +08:00
NEXT_MASK(F_TextOutA),
NEXT_MASK(F_TextOutW),
NEXT_MASK(F_ExtTextOutA),
NEXT_MASK(F_ExtTextOutW),
NEXT_MASK(F_DrawTextA),
NEXT_MASK(F_DrawTextW),
NEXT_MASK(F_DrawTextExA),
NEXT_MASK(F_DrawTextExW),
NEXT_MASK(F_CharNextA),
2024-07-21 21:07:05 +08:00
// F_CharNextW=0x
// F_CharNextExA=0x
// F_CharNextExW=0x
2024-05-10 13:24:25 +08:00
NEXT_MASK(F_CharPrevA),
2024-07-21 21:07:05 +08:00
// F_CharPrevW=0x
2024-05-10 13:24:25 +08:00
NEXT_MASK(F_MultiByteToWideChar),
NEXT_MASK(F_WideCharToMultiByte),
2024-02-07 20:59:24 +08:00
};