LunaHook-mirror/LunaHost/GUI/LunaHost.h

130 lines
3.7 KiB
C
Raw Normal View History

2024-02-07 20:59:24 +08:00
#include"window.h"
#include"controls.h"
#include"textthread.h"
2024-02-08 16:18:33 +08:00
#include"pluginmanager.h"
2024-02-09 09:25:26 +08:00
#include"confighelper.h"
class LunaHost;
class Pluginwindow:public mainwindow{
listbox* listplugins;
Pluginmanager* pluginmanager;
public:
Pluginwindow(mainwindow*,Pluginmanager*);
void on_size(int w,int h);
2024-03-29 15:07:43 +08:00
void pluginrankmove(int);
2024-02-09 09:25:26 +08:00
};
class Settingwindow:public mainwindow{
checkbox* ckbfilterrepeat;
spinbox* g_timeout;
spinbox* g_codepage;
2024-02-09 09:25:26 +08:00
checkbox* g_check_clipboard;
2024-02-20 23:24:33 +08:00
checkbox* readonlycheck;
2024-03-27 14:23:36 +08:00
checkbox* autoattach;
2024-03-27 16:36:14 +08:00
checkbox* autoattach_so;
checkbox* copyselect;
2024-03-27 14:23:36 +08:00
spinbox* spinmaxbuffsize;
2024-03-28 00:31:53 +08:00
spinbox* spinmaxhistsize;
2024-03-28 11:01:44 +08:00
gridlayout* mainlayout;
2024-02-09 09:25:26 +08:00
public:
Settingwindow(LunaHost*);
};
2024-03-27 16:36:14 +08:00
class processlistwindow:public mainwindow{
2024-03-28 11:01:44 +08:00
gridlayout* mainlayout;
lineedit* g_hEdit;
2024-03-27 16:36:14 +08:00
button* g_hButton;
listview* g_hListBox;
button* g_refreshbutton;
std::unordered_map<std::wstring,std::vector<int>> g_exe_pid;
void PopulateProcessList(listview*,std::unordered_map<std::wstring,std::vector<int>>&);
public:
processlistwindow(mainwindow* parent=0);
void on_show();
};
2024-03-28 19:24:07 +08:00
class HooksearchText:public mainwindow{
gridlayout* layout;
lineedit* edittext;
button* checkok;
spinbox* codepage;
public:
HooksearchText(mainwindow*);
void call(std::set<DWORD>pids);
};
class Hooksearchsetting:public mainwindow{
gridlayout* layout;
spinbox* spinduration;
spinbox* spinoffset;
spinbox* spincap;
spinbox* spincodepage;
lineedit* editpattern;
lineedit* editmodule;
lineedit* editmaxaddr;
lineedit* editminaddr;
spinbox* spinpadding;
lineedit* editregex;
button* start;
public:
Hooksearchsetting(mainwindow*);
void call(std::set<DWORD>pids,std::wstring);
};
class Hooksearchwindow:public mainwindow{
checkbox* cjkcheck;
button* hs_default,*hs_text,*hs_user;
gridlayout* layout;
Hooksearchsetting* hooksearchsetting=0;
HooksearchText* hooksearchText=0;
public:
Hooksearchwindow(LunaHost* parent);
};
2024-02-07 20:59:24 +08:00
class LunaHost:public mainwindow{
2024-02-09 09:25:26 +08:00
Pluginwindow* pluginwindow=0;
2024-02-07 20:59:24 +08:00
std::map<int64_t,std::vector<std::wstring>>savetext;
2024-03-28 19:24:07 +08:00
std::set<DWORD>attachedprocess;
2024-02-07 20:59:24 +08:00
std::mutex settextmutex;
2024-03-28 11:01:44 +08:00
lineedit* g_hEdit_userhook;
gridlayout* mainlayout;
2024-02-07 20:59:24 +08:00
button* g_hButton_insert;
2024-02-09 09:25:26 +08:00
button* btnplugin;
2024-04-18 16:19:52 +08:00
//listbox* g_hListBox_listtext;
listview*g_hListBox_listtext;
2024-03-28 11:01:44 +08:00
multilineedit* g_showtexts;
2024-02-07 20:59:24 +08:00
button* g_selectprocessbutton;
2024-03-27 16:36:14 +08:00
button* btndetachall;
2024-03-28 19:24:07 +08:00
button* btnsearchhooks;
2024-02-09 09:25:26 +08:00
button* btnshowsettionwindow;
2024-03-27 16:36:14 +08:00
//button* btnsavehook;
2024-02-07 20:59:24 +08:00
processlistwindow *_processlistwindow=0;
2024-02-09 09:25:26 +08:00
Settingwindow *settingwindow=0;
Pluginmanager* plugins;
2024-03-28 19:24:07 +08:00
Hooksearchwindow * hooksearchwindow=0;
2024-02-08 16:18:33 +08:00
bool on_text_recv(TextThread& thread, std::wstring& sentence);
2024-03-27 16:36:14 +08:00
void on_text_recv_checkissaved(TextThread& thread);
2024-02-08 16:18:33 +08:00
void on_thread_create(TextThread& thread);
void on_thread_delete(TextThread& thread);
2024-03-27 16:36:14 +08:00
void on_proc_connect(DWORD pid);
2024-04-18 16:19:52 +08:00
void on_proc_disconnect(DWORD pid);
void showtext(const std::wstring&text,bool clear);
void updatelisttext(const std::wstring&text,LONG_PTR data);
2024-02-07 20:59:24 +08:00
public:
2024-02-09 09:25:26 +08:00
confighelper* configs;
2024-02-08 19:12:20 +08:00
int64_t currentselect=0;
2024-03-27 16:36:14 +08:00
bool check_toclipboard;
bool check_toclipboard_selection;
2024-03-27 16:36:14 +08:00
bool autoattach;
bool autoattach_savedonly;
std::set<std::string>autoattachexes;
std::unordered_map<std::string,nlohmann::json>savedhookcontext;
std::set<int>userdetachedpids;
std::set<int64_t>onceautoselectthread;
2024-02-07 20:59:24 +08:00
void on_close();
LunaHost();
2024-02-20 23:24:33 +08:00
friend class Settingwindow;
2024-03-28 19:24:07 +08:00
friend class Hooksearchwindow;
2024-03-27 14:23:36 +08:00
private:
void loadsettings();
void savesettings();
2024-03-27 16:36:14 +08:00
void doautoattach();
2024-02-09 09:25:26 +08:00
};