From ef36cb927458d120707419ea4b004eb2d06e1904 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Fri, 13 Jul 2018 11:47:16 -0400 Subject: [PATCH] really final fixes for beta release --- CMakeLists.txt | 10 ++++-- gui/ITHVNR.rc | 22 +++---------- gui/ProcessWindow.cpp | 4 +-- gui/ProfileManager.cpp | 67 +++----------------------------------- gui/ProfileManager.h | 1 - gui/icon1.ico | Bin 1078 -> 766 bytes gui/language.cpp | 2 +- gui/main.cpp | 52 +++-------------------------- gui/resource.h | 9 ----- gui/version.h.in | 2 +- gui/window.cpp | 52 ++++++++++++----------------- vnr/ntdll/ntdll.h | 4 +++ vnr/texthook/host/host.cc | 4 +-- vnr/texthook/host/host.h | 4 +-- 14 files changed, 54 insertions(+), 179 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 466681a..ce8d623 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,11 +14,15 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release") set(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ON) +execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE FULLDATE) +# set(DATE "07/13/2018") +string(SUBSTRING ${FULLDATE} 0 10 BUILD_DATE) +set(BUILD_DATE ${BUILD_DATE}) set(CPACK_GENERATOR "ZIP") -set(CPACK_PACKAGE_VERSION_MAJOR 3) -set(CPACK_PACKAGE_VERSION_MINOR 5640) -set(CPACK_PACKAGE_VERSION_PATCH 1) +set(CPACK_PACKAGE_VERSION_MAJOR 1) +set(CPACK_PACKAGE_VERSION_MINOR 0) +set(CPACK_PACKAGE_VERSION_PATCH 0) set(CPACK_SOURCE_GENERATOR "ZIP") set(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\\\.svn/;/\\\\.bzr/;/\\\\.hg/;/\\\\.git/;\\\\.swp$;\\\\.#;/#" ".*\\\\.user$" "\\\\.gitignore$" "\\\\.gitmodules$" "\\\\.git$") include(CPack) diff --git a/gui/ITHVNR.rc b/gui/ITHVNR.rc index 7cc7e84..66c7081 100644 --- a/gui/ITHVNR.rc +++ b/gui/ITHVNR.rc @@ -1,10 +1,9 @@ -// Generated by ResEdit 1.6.5 +// Generated by ResEdit 1.6.6 // Copyright (C) 2006-2015 // http://www.resedit.net #include #include -#include #include "resource.h" @@ -32,27 +31,16 @@ FONT 8, "MS Shell Dlg", 400, 0, 1 LANGUAGE LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN -IDD_DIALOG4 DIALOGEX 150, 100, 123, 185 +IDD_DIALOG4 DIALOGEX 150, 100, 123, 71 STYLE DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU CAPTION "Option" FONT 8, "MS Shell Dlg", 400, 0, 1 { - DEFPUSHBUTTON "OK", IDOK, 8, 164, 50, 14, 0, WS_EX_LEFT - PUSHBUTTON "Cancel", IDCANCEL, 65, 164, 50, 14, 0, WS_EX_LEFT + LTEXT "More options coming soon?", 0, 18, 25, 88, 9, SS_LEFT, WS_EX_LEFT + DEFPUSHBUTTON "OK", IDOK, 5, 52, 50, 14, 0, WS_EX_LEFT + PUSHBUTTON "Cancel", IDCANCEL, 63, 52, 50, 14, 0, WS_EX_LEFT EDITTEXT IDC_EDIT1, 60, 7, 55, 14, ES_AUTOHSCROLL, WS_EX_LEFT LTEXT "Split time", IDC_STATIC, 7, 7, 47, 13, SS_LEFT | SS_CENTERIMAGE, WS_EX_LEFT - EDITTEXT IDC_EDIT2, 60, 25, 55, 14, ES_AUTOHSCROLL, WS_EX_LEFT - LTEXT "Process delay", IDC_STATIC, 7, 26, 47, 13, SS_LEFT | SS_CENTERIMAGE, WS_EX_LEFT - EDITTEXT IDC_EDIT3, 60, 45, 55, 14, ES_AUTOHSCROLL, WS_EX_LEFT - LTEXT "Inject delay", IDC_STATIC, 7, 45, 47, 13, SS_LEFT | SS_CENTERIMAGE, WS_EX_LEFT - EDITTEXT IDC_EDIT4, 60, 65, 55, 14, ES_AUTOHSCROLL, WS_EX_LEFT - LTEXT "Insert delay", IDC_STATIC, 7, 65, 47, 13, SS_LEFT | SS_CENTERIMAGE, WS_EX_LEFT - AUTOCHECKBOX "Auto attach", IDC_CHECK1, 7, 87, 54, 10, 0, WS_EX_LEFT - AUTOCHECKBOX "Auto insert", IDC_CHECK2, 62, 87, 50, 10, 0, WS_EX_LEFT - AUTOCHECKBOX "Auto copy to clipboard", IDC_CHECK3, 7, 103, 88, 10, 0, WS_EX_LEFT - AUTOCHECKBOX "Auto suppress repetition", IDC_CHECK4, 7, 119, 95, 10, 0, WS_EX_LEFT - AUTOCHECKBOX "Reset character filter", IDC_CHECK6, 7, 149, 81, 8, 0, WS_EX_LEFT - AUTOCHECKBOX "Enable global filter", IDC_CHECK5, 7, 134, 75, 10, 0, WS_EX_LEFT } diff --git a/gui/ProcessWindow.cpp b/gui/ProcessWindow.cpp index bfa046b..84c3f3e 100644 --- a/gui/ProcessWindow.cpp +++ b/gui/ProcessWindow.cpp @@ -84,8 +84,8 @@ void ProcessWindow::AttachProcess() void ProcessWindow::DetachProcess() { DWORD pid = GetSelectedPID(); - if (DetachProcessById(pid) == 0) - RefreshThreadWithPID(pid, false); + DetachProcessById(pid); + RefreshThreadWithPID(pid, false); } void ProcessWindow::CreateProfileForSelectedProcess() diff --git a/gui/ProfileManager.cpp b/gui/ProfileManager.cpp index ccefbef..6714714 100644 --- a/gui/ProfileManager.cpp +++ b/gui/ProfileManager.cpp @@ -8,15 +8,9 @@ #include "profile/misc.h" extern HookManager* man; // main.cpp -extern LONG auto_inject, auto_insert, inject_delay; // main.cpp -extern LONG insert_delay, process_time; // main.cpp -bool MonitorFlag; ProfileManager* pfman; -DWORD WINAPI MonitorThread(LPVOID lpThreadParameter); - -ProfileManager::ProfileManager() : -hMonitorThread(IthCreateThread(MonitorThread, 0)) +ProfileManager::ProfileManager() { LoadProfiles(); } @@ -24,7 +18,6 @@ hMonitorThread(IthCreateThread(MonitorThread, 0)) ProfileManager::~ProfileManager() { SaveProfiles(); - WaitForSingleObject(hMonitorThread.get(), 0); } Profile* ProfileManager::GetProfile(DWORD pid) @@ -91,7 +84,7 @@ void ProfileManager::WriteProfileXml(const std::wstring& path, Profile& pf, pugi void ProfileManager::LoadProfiles() { pugi::xml_document doc; - UniqueHandle hFile(IthCreateFile(L"ITH_Profile.xml", GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING)); + UniqueHandle hFile(IthCreateFile(L"NextHooker_Profile.xml", GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING)); if (hFile.get() == INVALID_HANDLE_VALUE) return; DWORD size = GetFileSize(hFile.get(), NULL); @@ -100,7 +93,7 @@ void ProfileManager::LoadProfiles() auto result = doc.load_buffer(buffer.get(), size); if (!result) return; - auto root = doc.root().child(L"ITH_Profile"); + auto root = doc.root().child(L"NextHookerProfile"); if (!root) return; for (auto game = root.begin(); game != root.end(); ++game) @@ -110,13 +103,13 @@ void ProfileManager::LoadProfiles() void ProfileManager::SaveProfiles() { pugi::xml_document doc; - auto root = doc.append_child(L"ITH_Profile"); + auto root = doc.append_child(L"NextHookerProfile"); for (auto it = profile_tree.begin(); it != profile_tree.end(); ++it) { auto& path = it->first; auto& profile = it->second; WriteProfileXml(path, *profile, root); } - UniqueHandle hFile(IthCreateFile(L"ITH_Profile.xml", GENERIC_WRITE, 0, CREATE_ALWAYS)); + UniqueHandle hFile(IthCreateFile(L"NextHooker_Profile.xml", GENERIC_WRITE, 0, CREATE_ALWAYS)); if (hFile.get() != INVALID_HANDLE_VALUE) { FileWriter fw(hFile.get()); @@ -150,56 +143,6 @@ DWORD ProfileManager::CountProfiles() return profile_tree.size(); } -DWORD WINAPI InjectThread(LPVOID lpThreadParameter) -{ - DWORD pid = (DWORD)lpThreadParameter; - Sleep(inject_delay); - if (man == NULL) - return 0; - DWORD status = InjectProcessById(pid); - if (!auto_insert) - return status; - if (status == -1) - return status; - Sleep(insert_delay); - const Profile* pf = pfman->GetProfile(pid); - if (pf) - { - SendParam sp; - sp.type = 0; - for (auto hp = pf->Hooks().begin(); hp != pf->Hooks().end(); ++hp) - { - std::string name = toMultiByteString((*hp)->Name()); - InsertHook(pid, const_cast(&(*hp)->HP()), name); - } - } - return status; -} - -DWORD WINAPI MonitorThread(LPVOID lpThreadParameter) -{ - while (MonitorFlag) - { - DWORD aProcesses[1024], cbNeeded, cProcesses; - if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded)) - break; - cProcesses = cbNeeded / sizeof(DWORD); - for (size_t i = 0; i < cProcesses; ++i) - { - Sleep(process_time); - if (!auto_inject || man == NULL || man->GetProcessRecord(aProcesses[i])) - continue; - std::wstring process_path = GetProcessPath(aProcesses[i]); - if (!process_path.empty() && pfman->HasProfile(process_path)) - { - UniqueHandle hThread(IthCreateThread(InjectThread, aProcesses[i])); - WaitForSingleObject(hThread.get(), 0); - } - } - } - return 0; -} - DWORD SaveProcessProfile(DWORD pid) { std::wstring path = GetProcessPath(pid); diff --git a/gui/ProfileManager.h b/gui/ProfileManager.h index 64ed6d0..0f0966a 100644 --- a/gui/ProfileManager.h +++ b/gui/ProfileManager.h @@ -31,5 +31,4 @@ private: // locate profile with executable path profile_map profile_tree; CriticalSection cs; - UniqueHandle hMonitorThread; }; diff --git a/gui/icon1.ico b/gui/icon1.ico index 9f0d2d44114209fadf865bf85b01ab2128479691..ea460c2d7468591126132eab499086a262429298 100644 GIT binary patch literal 766 zcmbV|F-`+95Ji7bDvN?DRV22cproXTl-w+P18URYmN~`VfJ0C~PZLX4CV$qpSQ|mX z*w5qVvDRw?E4E>{0kFpB6|mv#o($wbR$QNhwHmhD$T0%!7{{DAa!N)_)5L<#9jZ1X zY_?=W37>OG!0+yYZS`<6Csdce-G#O;y`!l=OY0IkN8|3*d+`k9|B>EVSbX0}=b?46 z`+x7}Ra+0ObLX;dFVi?*Z0Wp9>-iz;c~-VCXSg4p*K57lKa=V{RiZwos1JoZ<~6x4 lY?*f{o`IMQ&QBzgFY-=4$QyYgFXWc&cjtfFmKnwulM|?Q#N+1UUhs%@%Ch^(j(u5DG*|NnyqO@r00B z2_Yd6<2-x*%-Eh7D6l|PRR9jKEPxYwb*=hk0bDb-WK1G8DOe}gE&n0JJsZhe7qB%cd}o8r}AD;ZpRD$Ob5N73|)5G zQM+$+*qC~^uXmeWn@!IPR=ZG|{jRe*SnUE#-gQ>9SCi+RbIo$2<=5tUX>q2de6FP& z$Wg9=!)P{Vb!WAvKlkrzEuZpfxQ$=29( setting; @@ -48,21 +45,13 @@ void SaveSettings() setting[L"window_top"] = wndpl.rcNormalPosition.top; setting[L"window_bottom"] = wndpl.rcNormalPosition.bottom; setting[L"split_time"] = split_time; - setting[L"process_time"] = process_time; - setting[L"inject_delay"] = inject_delay; - setting[L"insert_delay"] = insert_delay; - setting[L"auto_inject"] = auto_inject; - setting[L"auto_insert"] = auto_insert; - setting[L"auto_copy"] = clipboard_flag; - setting[L"auto_suppress"] = cyclic_remove; - setting[L"global_filter"] = global_filter; - UniqueHandle hFile(IthCreateFile(L"ITH.xml", GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS)); + UniqueHandle hFile(IthCreateFile(L"NextHooker.xml", GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS)); if (hFile.get() != INVALID_HANDLE_VALUE) { FileWriter fw(hFile.get()); pugi::xml_document doc; - auto root = doc.root().append_child(L"ITH_Setting"); + auto root = doc.root().append_child(L"NextHookerSetting"); for (auto it = setting.begin(); it != setting.end(); ++it) root.append_attribute(it->first.c_str()).set_value(it->second); doc.save(fw); @@ -72,14 +61,6 @@ void SaveSettings() void DefaultSettings() { setting[L"split_time"] = 200; - setting[L"process_time"] = 50; - setting[L"inject_delay"] = 3000; - setting[L"insert_delay"] = 500; - setting[L"auto_inject"] = 1; - setting[L"auto_insert"] = 1; - setting[L"auto_copy"] = 0; - setting[L"auto_suppress"] = 0; - setting[L"global_filter"] = 0; setting[L"window_left"] = 100; setting[L"window_right"] = 800; setting[L"window_top"] = 100; @@ -89,28 +70,11 @@ void DefaultSettings() void InitializeSettings() { split_time = setting[L"split_time"]; - process_time = setting[L"process_time"]; - inject_delay = setting[L"inject_delay"]; - insert_delay = setting[L"insert_delay"]; - auto_inject = setting[L"auto_inject"]; - auto_insert = setting[L"auto_insert"]; - clipboard_flag = setting[L"auto_copy"]; - cyclic_remove = setting[L"auto_suppress"]; - global_filter = setting[L"global_filter"]; window.left = setting[L"window_left"]; window.right = setting[L"window_right"]; window.top = setting[L"window_top"]; window.bottom = setting[L"window_bottom"]; - if (auto_inject > 1) - auto_inject = 1; - if (auto_insert > 1) - auto_insert = 1; - if (clipboard_flag > 1) - clipboard_flag = 1; - if (cyclic_remove > 1) - cyclic_remove = 1; - if (window.right < window.left || window.right - window.left < 600) window.right = window.left + 600; if (window.bottom < window.top || window.bottom - window.top < 200) @@ -119,7 +83,7 @@ void InitializeSettings() void LoadSettings() { - UniqueHandle hFile(IthCreateFile(L"ITH.xml", GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING)); + UniqueHandle hFile(IthCreateFile(L"NextHooker.xml", GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING)); if (hFile.get() != INVALID_HANDLE_VALUE) { DWORD size = GetFileSize(hFile.get(), NULL); @@ -129,7 +93,7 @@ void LoadSettings() auto result = doc.load_buffer_inplace(buffer.get(), size); if (!result) return; - auto root = doc.root().child(L"ITH_Setting"); + auto root = doc.root().child(L"NextHookerSetting"); for (auto attr = root.attributes_begin(); attr != root.attributes_end(); ++attr) { auto it = setting.find(attr->name()); @@ -184,20 +148,17 @@ LONG WINAPI UnhandledExcept(_EXCEPTION_POINTERS *ExceptionInfo) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { InitCommonControls(); - CreateMutex(NULL, TRUE, L"ITH_MAIN_RUNNING"); if (OpenHost()) { SetUnhandledExceptionFilter(UnhandledExcept); GetHostHookManager(&man); GetHostSettings(&setman); setman->splittingInterval = 200; - MonitorFlag = true; pfman = new ProfileManager(); DefaultSettings(); LoadSettings(); InitializeSettings(); setman->splittingInterval = split_time; - setman->clipboardFlag = clipboard_flag > 0; hIns = hInstance; MyRegisterClass(hIns); InitInstance(hIns, FALSE, &window); @@ -207,10 +168,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine TranslateMessage(&msg); DispatchMessage(&msg); } - //delete mb_filter; - //delete uni_filter; delete pfman; - MonitorFlag = false; man = NULL; } else diff --git a/gui/resource.h b/gui/resource.h index 73edb41..ccc2c3f 100644 --- a/gui/resource.h +++ b/gui/resource.h @@ -5,19 +5,10 @@ #define IDD_DIALOG2 102 #define IDD_DIALOG4 104 #define IDI_ICON1 110 -#define IDC_CHECK1 1000 -#define IDC_CHECK2 1001 -#define IDC_CHECK3 1002 -#define IDC_CHECK4 1003 -#define IDC_CHECK5 1004 #define IDC_EDIT1 1011 -#define IDC_EDIT2 1012 -#define IDC_EDIT3 1013 -#define IDC_EDIT4 1014 #define IDC_BUTTON1 1020 #define IDC_BUTTON2 1021 #define IDC_BUTTON3 1022 #define IDC_BUTTON5 1024 #define IDC_LIST1 1028 #define IDC_BUTTON6 40000 -#define IDC_CHECK6 40001 diff --git a/gui/version.h.in b/gui/version.h.in index 051edda..fe68a00 100644 --- a/gui/version.h.in +++ b/gui/version.h.in @@ -1,2 +1,2 @@ -const wchar_t* build_date=L"27.01.2013"; +const wchar_t* build_date=L"@BUILD_DATE@"; const WCHAR program_version[] = L"@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@"; diff --git a/gui/window.cpp b/gui/window.cpp index f0dc9a6..8db3c94 100644 --- a/gui/window.cpp +++ b/gui/window.cpp @@ -36,7 +36,7 @@ extern HINSTANCE hIns; // main.cpp HWND hMainWnd, hwndCombo, hwndProcessComboBox, hwndEdit, hwndCmd; HWND hwndProcess; -HWND hwndOption, hwndTop, hwndClear, hwndSave, hwndRemoveLink, hwndRemoveHook; +HWND hwndOption, hwndTop, hwndClear, hwndSave, hwndExtensions, hwndRemoveHook; HWND hProcDlg, hOptionDlg; HBRUSH hWhiteBrush; DWORD background; @@ -94,14 +94,6 @@ BOOL CALLBACK OptionDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: { SetWindowText(GetDlgItem(hDlg, IDC_EDIT1), std::to_wstring((long long)split_time).c_str()); - SetWindowText(GetDlgItem(hDlg, IDC_EDIT2), std::to_wstring((long long)process_time).c_str()); - SetWindowText(GetDlgItem(hDlg, IDC_EDIT3), std::to_wstring((long long)inject_delay).c_str()); - SetWindowText(GetDlgItem(hDlg, IDC_EDIT4), std::to_wstring((long long)insert_delay).c_str()); - CheckDlgButton(hDlg, IDC_CHECK1, auto_inject); - CheckDlgButton(hDlg, IDC_CHECK2, auto_insert); - CheckDlgButton(hDlg, IDC_CHECK3, clipboard_flag); - CheckDlgButton(hDlg, IDC_CHECK4, cyclic_remove); - CheckDlgButton(hDlg, IDC_CHECK5, global_filter); } return TRUE; case WM_COMMAND: @@ -116,23 +108,7 @@ BOOL CALLBACK OptionDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) GetWindowText(GetDlgItem(hDlg, IDC_EDIT1), str, 0x80); DWORD st = std::stoul(str); split_time = st > 100 ? st : 100; - GetWindowText(GetDlgItem(hDlg, IDC_EDIT2), str, 0x80); - DWORD pt = std::stoul(str); - process_time = pt > 50 ? pt : 50; - GetWindowText(GetDlgItem(hDlg, IDC_EDIT3), str, 0x80); - DWORD jd = std::stoul(str); - inject_delay = jd > 1000 ? jd : 1000; - GetWindowText(GetDlgItem(hDlg, IDC_EDIT4), str, 0x80); - DWORD sd = std::stoul(str); - insert_delay = sd > 200 ? sd : 200; - auto_inject = IsDlgButtonChecked(hDlg, IDC_CHECK1); - auto_insert = IsDlgButtonChecked(hDlg, IDC_CHECK2); - clipboard_flag = IsDlgButtonChecked(hDlg, IDC_CHECK3); - cyclic_remove = IsDlgButtonChecked(hDlg, IDC_CHECK4); - global_filter = IsDlgButtonChecked(hDlg, IDC_CHECK5); - setman->clipboardFlag = clipboard_flag; setman->splittingInterval = split_time; - if (auto_inject == 0) auto_insert = 0; } case IDCANCEL: EndDialog(hDlg, 0); @@ -281,7 +257,7 @@ void CreateButtons(HWND hWnd) 0, 0, 0, 0, hWnd, 0, hIns, NULL); hwndSave = CreateWindow(L"Button", L"Save", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, 0, hIns, NULL); - hwndRemoveLink = CreateWindow(L"Button", L"Unlink", WS_CHILD | WS_VISIBLE, + hwndExtensions = CreateWindow(L"Button", L"Extensions", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, 0, hIns, NULL); hwndRemoveHook = CreateWindow(L"Button", L"Unhook", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, 0, hIns, NULL); @@ -351,6 +327,10 @@ void ClickButton(HWND hWnd, HWND h) } pfman->SaveProfiles(); } + else if (h == hwndExtensions) + { + man->AddConsoleOutput(L"GUI for managing your extensions coming soon. Please do it manually for now."); + } else if (h == hwndRemoveHook) { WCHAR str[32]; @@ -364,7 +344,7 @@ void ClickButton(HWND hWnd, HWND h) entry = entry.substr(i + 1); DWORD addr = std::stoul(entry, NULL, 16); if (threadNumber != 0) - Host_RemoveHook(pid, addr); + RemoveHook(pid, addr); } } } @@ -547,7 +527,7 @@ DWORD ThreadRemove(TextThread* thread) return 0; } -DWORD RegisterProcessList(DWORD pid) +DWORD RegisterProcess(DWORD pid) { auto path = GetProcessPath(pid); if (!path.empty()) @@ -558,6 +538,14 @@ DWORD RegisterProcessList(DWORD pid) if (ComboBox_GetCount(hwndProcessComboBox) == 1) ComboBox_SetCurSel(hwndProcessComboBox, 0); } + Profile* pf = pfman->GetProfile(pid); + if (pf) + { + for (auto i = pf->Hooks().begin(); i != pf->Hooks().end(); ++i) + { + InsertHook(pid, &i->get()->HP(), toMultiByteString(i->get()->Name())); + } + } return 0; } @@ -610,16 +598,16 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) TextThread* console = man->FindSingle(0); console->RegisterOutputCallBack(ThreadOutput, NULL); AddToCombo(*console, false); - man->RegisterProcessAttachCallback(RegisterProcessList); + man->RegisterProcessAttachCallback(RegisterProcess); man->RegisterProcessDetachCallback(RemoveProcessList); //man->RegisterProcessNewHookCallback(RefreshProfileOnNewHook); Artikash 5/30/2018 TODO: Finish implementing this. man->RegisterAddRemoveLinkCallback(AddRemoveLink); StartHost(); { - static const WCHAR program_name[] = L"Interactive Text Hooker"; + static const WCHAR program_name[] = L"NextHooker beta v"; //static const WCHAR program_version[] = L"3.0"; static WCHAR version_info[256]; - std::swprintf(version_info, L"%s %s (%s)", program_name, program_version, build_date); + std::swprintf(version_info, L"%s%s (%s)", program_name, program_version, build_date); man->AddConsoleOutput(version_info); man->AddConsoleOutput(InitMessage); } @@ -688,7 +676,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) MoveWindow(hwndOption, l * 1, 0, l, h, TRUE); MoveWindow(hwndTop, l * 2, 0, l, h, TRUE); MoveWindow(hwndClear, l * 3, 0, l, h, TRUE); - MoveWindow(hwndRemoveLink, l * 4, 0, l, h, TRUE); + MoveWindow(hwndExtensions, l * 4, 0, l, h, TRUE); MoveWindow(hwndRemoveHook, l * 5, 0, l, h, TRUE); MoveWindow(hwndSave, l * 6, 0, width - 6 * l, h, TRUE); l *= 2; diff --git a/vnr/ntdll/ntdll.h b/vnr/ntdll/ntdll.h index 499f160..e6b2aeb 100644 --- a/vnr/ntdll/ntdll.h +++ b/vnr/ntdll/ntdll.h @@ -4,6 +4,10 @@ // ntdll.h 10/14/2011 +/* Artikash 7/13/2018: WHERE THE FUCK DID THIS FILE COME FROM? +Redefines a bunch of stuff in the standard windows headers (especially winnt.h) but has additional information that isn't documented anywhere else I can find. +It's like someone stole this file from Microsoft's internal database of windows source code?? */ + #include #ifdef _MSC_VER diff --git a/vnr/texthook/host/host.cc b/vnr/texthook/host/host.cc index 04349ae..02e8efd 100644 --- a/vnr/texthook/host/host.cc +++ b/vnr/texthook/host/host.cc @@ -219,7 +219,7 @@ IHFSERVICE void IHFAPI GetHostSettings(Settings **p) } } -IHFSERVICE DWORD IHFAPI InsertHook(DWORD pid, HookParam *hp, std::string name) +IHFSERVICE DWORD IHFAPI InsertHook(DWORD pid, const HookParam *hp, std::string name) { HANDLE commandPipe = man->GetCommandPipe(pid); if (commandPipe == nullptr) @@ -234,7 +234,7 @@ IHFSERVICE DWORD IHFAPI InsertHook(DWORD pid, HookParam *hp, std::string name) return 0; } -IHFSERVICE DWORD IHFAPI Host_RemoveHook(DWORD pid, DWORD addr) +IHFSERVICE DWORD IHFAPI RemoveHook(DWORD pid, DWORD addr) { HANDLE commandPipe = man->GetCommandPipe(pid); if (commandPipe == nullptr) diff --git a/vnr/texthook/host/host.h b/vnr/texthook/host/host.h index ea27c05..3570d17 100644 --- a/vnr/texthook/host/host.h +++ b/vnr/texthook/host/host.h @@ -24,9 +24,9 @@ IHFSERVICE DWORD IHFAPI Host_GetPIDByName(LPCWSTR pwcTarget); IHFSERVICE bool IHFAPI InjectProcessById(DWORD pid, DWORD timeout = 5000); IHFSERVICE bool IHFAPI DetachProcessById(DWORD pid); IHFSERVICE bool IHFAPI Host_HijackProcess(DWORD pid); -IHFSERVICE DWORD IHFAPI InsertHook(DWORD pid, HookParam *hp, std::string name = ""); +IHFSERVICE DWORD IHFAPI InsertHook(DWORD pid, const HookParam *hp, std::string name = ""); IHFSERVICE DWORD IHFAPI Host_ModifyHook(DWORD pid, HookParam *hp); -IHFSERVICE DWORD IHFAPI Host_RemoveHook(DWORD pid, DWORD addr); +IHFSERVICE DWORD IHFAPI RemoveHook(DWORD pid, DWORD addr); IHFSERVICE DWORD IHFAPI Host_AddLink(DWORD from, DWORD to); IHFSERVICE DWORD IHFAPI Host_UnLink(DWORD from); IHFSERVICE DWORD IHFAPI Host_UnLinkAll(DWORD from);