mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-12-26 21:24:12 +08:00
fix
This commit is contained in:
parent
4b76f723f0
commit
9c12e7dcd2
@ -207,17 +207,16 @@ LunaHost::LunaHost(){
|
|||||||
g_hListBox_listtext = new listview(this,false,false);
|
g_hListBox_listtext = new listview(this,false,false);
|
||||||
g_hListBox_listtext->setheader({LIST_HOOK,LIST_TEXT});
|
g_hListBox_listtext->setheader({LIST_HOOK,LIST_TEXT});
|
||||||
g_hListBox_listtext->oncurrentchange=[&](int idx){
|
g_hListBox_listtext->oncurrentchange=[&](int idx){
|
||||||
uint64_t handle = g_hListBox_listtext->getdata(idx);
|
auto thread_p = g_hListBox_listtext->getdata(idx);
|
||||||
std::wstring get;
|
std::wstring get;
|
||||||
currentselect=handle;
|
currentselect=thread_p;
|
||||||
std::wstring copy=Host::GetThread(handle)->storage->c_str();
|
std::wstring copy=((TextThread*)thread_p)->storage->c_str();
|
||||||
strReplace(copy,L"\n",L"\r\n");
|
strReplace(copy,L"\n",L"\r\n");
|
||||||
showtext(copy,true);
|
showtext(copy,true);
|
||||||
};
|
};
|
||||||
g_hListBox_listtext->on_menu=[&]()->maybehavemenu{
|
g_hListBox_listtext->on_menu=[&]()->maybehavemenu{
|
||||||
auto handle = g_hListBox_listtext->getdata(g_hListBox_listtext->currentidx());
|
auto tt = (TextThread*)g_hListBox_listtext->getdata(g_hListBox_listtext->currentidx());
|
||||||
auto tt=Host::GetThread(handle);
|
|
||||||
if(!tt)return {};
|
|
||||||
Menu menu;
|
Menu menu;
|
||||||
menu.add(MenuCopyHookCode,[&,tt](){sendclipboarddata(tt->hp.hookcode,winId);});
|
menu.add(MenuCopyHookCode,[&,tt](){sendclipboarddata(tt->hp.hookcode,winId);});
|
||||||
menu.add_sep();
|
menu.add_sep();
|
||||||
@ -332,11 +331,6 @@ LunaHost::LunaHost(){
|
|||||||
}
|
}
|
||||||
void LunaHost::on_text_recv_checkissaved(TextThread& thread)
|
void LunaHost::on_text_recv_checkissaved(TextThread& thread)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(onceautoselectthread.find(thread.handle)!=onceautoselectthread.end())return;
|
|
||||||
|
|
||||||
onceautoselectthread.insert(thread.handle);
|
|
||||||
|
|
||||||
if(auto exe=getModuleFilename(thread.tp.processId))
|
if(auto exe=getModuleFilename(thread.tp.processId))
|
||||||
{
|
{
|
||||||
auto exea=WideStringToString(exe.value());
|
auto exea=WideStringToString(exe.value());
|
||||||
@ -350,7 +344,7 @@ void LunaHost::on_text_recv_checkissaved(TextThread& thread)
|
|||||||
for(int i=0;i<g_hListBox_listtext->count();i++)
|
for(int i=0;i<g_hListBox_listtext->count();i++)
|
||||||
{
|
{
|
||||||
auto handle=g_hListBox_listtext->getdata(i);
|
auto handle=g_hListBox_listtext->getdata(i);
|
||||||
if(handle==thread.handle)
|
if(handle==(LONG_PTR)&thread)
|
||||||
{
|
{
|
||||||
g_hListBox_listtext->setcurrent(i);
|
g_hListBox_listtext->setcurrent(i);
|
||||||
break;
|
break;
|
||||||
@ -396,12 +390,11 @@ void LunaHost::updatelisttext(const std::wstring&text,LONG_PTR data){
|
|||||||
}
|
}
|
||||||
bool LunaHost::on_text_recv(TextThread& thread, std::wstring& output){
|
bool LunaHost::on_text_recv(TextThread& thread, std::wstring& output){
|
||||||
if(hasstoped)return true;
|
if(hasstoped)return true;
|
||||||
on_text_recv_checkissaved(thread);
|
|
||||||
if(!plugins->dispatch(thread,output))return false;
|
if(!plugins->dispatch(thread,output))return false;
|
||||||
|
|
||||||
updatelisttext(output,thread.handle);
|
updatelisttext(output,(LONG_PTR)&thread);
|
||||||
|
|
||||||
if(currentselect==thread.handle){
|
if(currentselect==(LONG_PTR)&thread){
|
||||||
showtext(output,false);
|
showtext(output,false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -416,14 +409,17 @@ void LunaHost::on_thread_create(TextThread& thread){
|
|||||||
thread.tp.ctx2
|
thread.tp.ctx2
|
||||||
);
|
);
|
||||||
int index=g_hListBox_listtext->additem(buff,NULL);
|
int index=g_hListBox_listtext->additem(buff,NULL);
|
||||||
g_hListBox_listtext->setdata(index,thread.handle);
|
g_hListBox_listtext->setdata(index,(LONG_PTR)&thread);
|
||||||
|
on_text_recv_checkissaved(thread);
|
||||||
}
|
}
|
||||||
void LunaHost::on_thread_delete(TextThread& thread){
|
void LunaHost::on_thread_delete(TextThread& thread){
|
||||||
|
if(currentselect==(LONG_PTR)&thread)
|
||||||
|
currentselect=0;
|
||||||
int count = g_hListBox_listtext->count();
|
int count = g_hListBox_listtext->count();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
uint64_t handle = g_hListBox_listtext->getdata(i);
|
auto thread_p = g_hListBox_listtext->getdata(i);
|
||||||
|
|
||||||
if (handle== thread.handle) {
|
if (thread_p== (LONG_PTR)&thread) {
|
||||||
g_hListBox_listtext->deleteitem(i);
|
g_hListBox_listtext->deleteitem(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,6 @@ public:
|
|||||||
std::set<std::string>autoattachexes;
|
std::set<std::string>autoattachexes;
|
||||||
std::unordered_map<std::string,nlohmann::json>savedhookcontext;
|
std::unordered_map<std::string,nlohmann::json>savedhookcontext;
|
||||||
std::set<int>userdetachedpids;
|
std::set<int>userdetachedpids;
|
||||||
std::set<int64_t>onceautoselectthread;
|
|
||||||
void on_close();
|
void on_close();
|
||||||
LunaHost();
|
LunaHost();
|
||||||
friend class Settingwindow;
|
friend class Settingwindow;
|
||||||
|
@ -387,7 +387,7 @@ std::array<InfoForExtension, 20> Pluginmanager::GetSentenceInfo(TextThread& thre
|
|||||||
if (TextThread* thread = Host::GetThread(number)) thread->AddSentence(sentence);;
|
if (TextThread* thread = Host::GetThread(number)) thread->AddSentence(sentence);;
|
||||||
};
|
};
|
||||||
static DWORD SelectedProcessId;
|
static DWORD SelectedProcessId;
|
||||||
auto currthread=Host::GetThread(host->currentselect);
|
auto currthread=(TextThread*)host->currentselect;
|
||||||
SelectedProcessId=(currthread!=0)?currthread->tp.processId:0;
|
SelectedProcessId=(currthread!=0)?currthread->tp.processId:0;
|
||||||
DWORD (*GetSelectedProcessId)() = [] { return SelectedProcessId; };
|
DWORD (*GetSelectedProcessId)() = [] { return SelectedProcessId; };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user