2016-01-06 00:01:17 +09:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// vnrhook/defs.h
|
|
|
|
// 8/23/2013 jichi
|
|
|
|
|
2018-12-18 16:56:04 -05:00
|
|
|
#include "common.h"
|
2016-01-06 00:01:17 +09:00
|
|
|
|
|
|
|
// Pipes
|
|
|
|
|
2018-11-04 04:00:14 -05:00
|
|
|
constexpr auto HOOK_PIPE = L"\\\\.\\pipe\\TEXTRACTOR_HOOK";
|
|
|
|
constexpr auto HOST_PIPE = L"\\\\.\\pipe\\TEXTRACTOR_HOST";
|
2016-01-06 00:01:17 +09:00
|
|
|
|
|
|
|
// Sections
|
|
|
|
|
2018-11-04 04:00:14 -05:00
|
|
|
constexpr auto ITH_SECTION_ = L"VNR_SECTION_"; // _%d
|
2016-01-06 00:01:17 +09:00
|
|
|
|
2019-02-16 22:51:10 -05:00
|
|
|
// Mutexes
|
2016-01-06 00:01:17 +09:00
|
|
|
|
2018-11-04 04:00:14 -05:00
|
|
|
constexpr auto ITH_HOOKMAN_MUTEX_ = L"VNR_HOOKMAN_"; // ITH_HOOKMAN_%d
|
2019-02-16 22:51:10 -05:00
|
|
|
constexpr auto CONNECTING_MUTEX = L"TEXTRACTOR_CONNECTING_PIPES";
|
|
|
|
|
|
|
|
// Events
|
|
|
|
|
|
|
|
constexpr auto PIPE_AVAILABLE_EVENT = L"TEXTRACTOR_PIPE_AVAILABLE";
|
2018-11-04 04:00:14 -05:00
|
|
|
|
|
|
|
// Files
|
|
|
|
|
2018-12-18 16:56:04 -05:00
|
|
|
constexpr auto ITH_DLL = L"vnrhook"; // .dll but LoadLibrary automatically adds that
|
2018-11-04 04:00:14 -05:00
|
|
|
constexpr auto CONFIG_FILE = u8"Textractor.ini";
|
|
|
|
constexpr auto HOOK_SAVE_FILE = u8"SavedHooks.txt";
|
2019-01-15 04:32:00 -05:00
|
|
|
constexpr auto GAME_SAVE_FILE = u8"SavedGames.txt";
|
|
|
|
constexpr auto EXTEN_SAVE_FILE = u8"SavedExtensions.txt";
|
2019-01-23 16:11:14 -05:00
|
|
|
constexpr auto REPLACE_SAVE_FILE = u8"SavedReplacements.txt";
|
2019-02-17 18:52:09 -05:00
|
|
|
constexpr auto LUA_SAVE_FILE = u8"Textractor.lua";
|
2018-11-04 04:00:14 -05:00
|
|
|
|
2019-01-25 22:49:50 -05:00
|
|
|
// Misc
|
|
|
|
|
2019-02-12 19:54:15 -05:00
|
|
|
constexpr auto DEFAULT_EXTENSIONS = u8"Remove Repetition>Lua>Copy to Clipboard>Bing Translate>Extra Window>Extra Newlines";
|
2019-01-25 22:49:50 -05:00
|
|
|
|
2019-02-16 22:51:10 -05:00
|
|
|
inline SECURITY_ATTRIBUTES allAccess = std::invoke([] // allows non-admin processes to access kernel objects made by admin processes
|
|
|
|
{
|
|
|
|
static SECURITY_DESCRIPTOR sd = {};
|
|
|
|
InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
|
|
|
|
SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE);
|
|
|
|
return SECURITY_ATTRIBUTES{ sizeof(SECURITY_ATTRIBUTES), &sd, FALSE };
|
|
|
|
});
|
|
|
|
|
2018-12-18 16:56:04 -05:00
|
|
|
// Functions
|
|
|
|
|
2019-01-15 04:32:00 -05:00
|
|
|
template <typename... Args>
|
|
|
|
inline void FORMAT_MESSAGE(const char* format, Args... args)
|
2018-12-18 16:56:04 -05:00
|
|
|
{
|
2018-12-20 11:02:22 -05:00
|
|
|
char buffer[250] = {};
|
|
|
|
sprintf_s<250>(buffer, format, args...);
|
|
|
|
MessageBoxA(NULL, buffer, "Textractor Message", MB_OK);
|
2018-12-18 16:56:04 -05:00
|
|
|
}
|
|
|
|
|
2018-12-26 23:56:42 -05:00
|
|
|
#ifdef _DEBUG
|
2019-02-10 21:46:39 -05:00
|
|
|
#define TEST(...) inline auto TEST__RUNNER__DUMMY = (CloseHandle(CreateThread(nullptr, 0, [](auto) { __VA_ARGS__; return 0UL; }, NULL, 0, nullptr)), 0);
|
2018-12-26 23:56:42 -05:00
|
|
|
#else
|
|
|
|
#define TEST(...)
|
|
|
|
#endif
|
|
|
|
|
2016-01-06 00:01:17 +09:00
|
|
|
// EOF
|