mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
remove unused code from textthread and related files
This commit is contained in:
parent
bb0133bc58
commit
c80f36efff
107
gui/window.cpp
107
gui/window.cpp
@ -128,10 +128,6 @@ BOOL CALLBACK OptionDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
GetWindowText(GetDlgItem(hDlg, IDC_EDIT4), str, 0x80);
|
GetWindowText(GetDlgItem(hDlg, IDC_EDIT4), str, 0x80);
|
||||||
DWORD sd = std::stoul(str);
|
DWORD sd = std::stoul(str);
|
||||||
insert_delay = sd > 200 ? sd : 200;
|
insert_delay = sd > 200 ? sd : 200;
|
||||||
if (IsDlgButtonChecked(hDlg, IDC_CHECK6))
|
|
||||||
{
|
|
||||||
man->ResetRepeatStatus();
|
|
||||||
}
|
|
||||||
auto_inject = IsDlgButtonChecked(hDlg, IDC_CHECK1);
|
auto_inject = IsDlgButtonChecked(hDlg, IDC_CHECK1);
|
||||||
auto_insert = IsDlgButtonChecked(hDlg, IDC_CHECK2);
|
auto_insert = IsDlgButtonChecked(hDlg, IDC_CHECK2);
|
||||||
clipboard_flag = IsDlgButtonChecked(hDlg, IDC_CHECK3);
|
clipboard_flag = IsDlgButtonChecked(hDlg, IDC_CHECK3);
|
||||||
@ -376,56 +372,57 @@ void ClickButton(HWND hWnd, HWND h)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD ThreadFilter(TextThread* thread, BYTE* out, DWORD len, DWORD new_line, PVOID data, bool space)
|
// Artikash 6/10/2018: Removed because unused. Left commented to make cleaning up gui code easier later.
|
||||||
{
|
//DWORD ThreadFilter(TextThread* thread, BYTE* out, DWORD len, DWORD new_line, PVOID data, bool space)
|
||||||
DWORD status = thread->Status();
|
//{
|
||||||
if (global_filter && !new_line && thread->Number() != 0)
|
// DWORD status = thread->Status();
|
||||||
{
|
// if (global_filter && !new_line && thread->Number() != 0)
|
||||||
if (status & USING_UNICODE)
|
// {
|
||||||
{
|
// if (status & USING_UNICODE)
|
||||||
DWORD i, j;
|
// {
|
||||||
len /= 2;
|
// DWORD i, j;
|
||||||
LPWSTR str = (LPWSTR)out;
|
// len /= 2;
|
||||||
for (i = 0, j = 0; i < len; i++)
|
// LPWSTR str = (LPWSTR)out;
|
||||||
{
|
// for (i = 0, j = 0; i < len; i++)
|
||||||
WCHAR c = str[i];
|
// {
|
||||||
if (!uni_filter->Find(c))
|
// WCHAR c = str[i];
|
||||||
str[j++] = c;
|
// if (!uni_filter->Find(c))
|
||||||
}
|
// str[j++] = c;
|
||||||
memset(str + j, 0, (len - j) * 2);
|
// }
|
||||||
len = j * 2;
|
// memset(str + j, 0, (len - j) * 2);
|
||||||
}
|
// len = j * 2;
|
||||||
else
|
// }
|
||||||
{
|
// else
|
||||||
DWORD i, j;
|
// {
|
||||||
for (i = 0, j = 0; i < len; i++)
|
// DWORD i, j;
|
||||||
{
|
// for (i = 0, j = 0; i < len; i++)
|
||||||
WORD c = out[i];
|
// {
|
||||||
if (!IsDBCSLeadByte(c & 0xFF))
|
// WORD c = out[i];
|
||||||
{
|
// if (!IsDBCSLeadByte(c & 0xFF))
|
||||||
if (!mb_filter->Find(c))
|
// {
|
||||||
out[j++] = c & 0xFF;
|
// if (!mb_filter->Find(c))
|
||||||
}
|
// out[j++] = c & 0xFF;
|
||||||
else if (i + 1 < len)
|
// }
|
||||||
{
|
// else if (i + 1 < len)
|
||||||
|
// {
|
||||||
c = out[i + 1];
|
//
|
||||||
c <<= 8;
|
// c = out[i + 1];
|
||||||
c |= out[i];
|
// c <<= 8;
|
||||||
if (!mb_filter->Find(c))
|
// c |= out[i];
|
||||||
{
|
// if (!mb_filter->Find(c))
|
||||||
out[j++] = c & 0xFF;
|
// {
|
||||||
out[j++] = c >> 8;
|
// out[j++] = c & 0xFF;
|
||||||
}
|
// out[j++] = c >> 8;
|
||||||
i++;
|
// }
|
||||||
}
|
// i++;
|
||||||
}
|
// }
|
||||||
memset(out + j, 0, len - j);
|
// }
|
||||||
len = j;
|
// memset(out + j, 0, len - j);
|
||||||
}
|
// len = j;
|
||||||
}
|
// }
|
||||||
return len;
|
// }
|
||||||
}
|
// return len;
|
||||||
|
//}
|
||||||
|
|
||||||
DWORD ThreadOutput(TextThread* thread, BYTE* out, DWORD len, DWORD new_line, PVOID data, bool space)
|
DWORD ThreadOutput(TextThread* thread, BYTE* out, DWORD len, DWORD new_line, PVOID data, bool space)
|
||||||
{
|
{
|
||||||
@ -594,7 +591,7 @@ bool IsUnicodeHook(const ProcessRecord& pr, DWORD hook);
|
|||||||
DWORD ThreadCreate(TextThread* thread)
|
DWORD ThreadCreate(TextThread* thread)
|
||||||
{
|
{
|
||||||
thread->RegisterOutputCallBack(ThreadOutput, 0);
|
thread->RegisterOutputCallBack(ThreadOutput, 0);
|
||||||
thread->RegisterFilterCallBack(ThreadFilter, 0);
|
//thread->RegisterFilterCallBack(ThreadFilter, 0);
|
||||||
AddToCombo(*thread, false);
|
AddToCombo(*thread, false);
|
||||||
const auto& tp = thread->GetThreadParameter();
|
const auto& tp = thread->GetThreadParameter();
|
||||||
auto pr = man->GetProcessRecord(tp->pid);
|
auto pr = man->GetProcessRecord(tp->pid);
|
||||||
|
@ -340,32 +340,6 @@ void HookManager::ClearCurrent()
|
|||||||
//LeaveCriticalSection(&hmcs);
|
//LeaveCriticalSection(&hmcs);
|
||||||
//ConsoleOutput("vnrhost:ClearCurrent: unlock");
|
//ConsoleOutput("vnrhost:ClearCurrent: unlock");
|
||||||
}
|
}
|
||||||
void HookManager::ResetRepeatStatus()
|
|
||||||
{
|
|
||||||
HM_LOCK;
|
|
||||||
//ConsoleOutput("vnrhost:ResetRepeatStatus: lock");
|
|
||||||
//EnterCriticalSection(&hmcs);
|
|
||||||
for (auto i : threadTable)
|
|
||||||
{
|
|
||||||
i.second->ResetRepeatStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
//LeaveCriticalSection(&hmcs);
|
|
||||||
//ConsoleOutput("vnrhost:ResetRepeatStatus: unlock");
|
|
||||||
}
|
|
||||||
//void HookManager::LockHookman(){ EnterCriticalSection(&hmcs); }
|
|
||||||
//void HookManager::UnlockHookman(){ LeaveCriticalSection(&hmcs); }
|
|
||||||
|
|
||||||
/*void HookManager::SetProcessEngineType(DWORD pid, DWORD type)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i=0;i<MAX_REGISTER;i++)
|
|
||||||
if (record[i].pid_register==pid) break;
|
|
||||||
if (i<MAX_REGISTER)
|
|
||||||
{
|
|
||||||
record[i].engine_register|=type;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
ProcessRecord *HookManager::GetProcessRecord(DWORD pid)
|
ProcessRecord *HookManager::GetProcessRecord(DWORD pid)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,6 @@ public:
|
|||||||
ProcessRecord *GetProcessRecord(DWORD pid);
|
ProcessRecord *GetProcessRecord(DWORD pid);
|
||||||
//void LockHookman();
|
//void LockHookman();
|
||||||
//void UnlockHookman();
|
//void UnlockHookman();
|
||||||
void ResetRepeatStatus();
|
|
||||||
void ClearCurrent();
|
void ClearCurrent();
|
||||||
void SelectCurrent(DWORD num);
|
void SelectCurrent(DWORD num);
|
||||||
void SetCurrent(TextThread *it);
|
void SetCurrent(TextThread *it);
|
||||||
|
@ -220,24 +220,6 @@ void TextThread::RemoveSingleRepeatAuto(const BYTE *con, int &len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextThread::ResetRepeatStatus()
|
|
||||||
{
|
|
||||||
last=0;
|
|
||||||
repeat_single=0;
|
|
||||||
repeat_single_current=0;
|
|
||||||
repeat_single_count=0;
|
|
||||||
repeat_detect_count=0;
|
|
||||||
RepeatCountNode *t = head->next,
|
|
||||||
*tt;
|
|
||||||
while (t) {
|
|
||||||
tt = t;
|
|
||||||
t = tt->next;
|
|
||||||
delete tt;
|
|
||||||
}
|
|
||||||
//head=new RepeatCountNode;
|
|
||||||
head->count = head->repeat = 0;
|
|
||||||
status &= ~REPEAT_NUMBER_DECIDED;
|
|
||||||
}
|
|
||||||
void TextThread::AddLineBreak()
|
void TextThread::AddLineBreak()
|
||||||
{
|
{
|
||||||
if (sentence_length == 0) return;
|
if (sentence_length == 0) return;
|
||||||
|
@ -50,7 +50,6 @@ public:
|
|||||||
void Reset();
|
void Reset();
|
||||||
void AddText(const BYTE *con,int len, bool new_line, bool space); // jichi 10/27/2013: add const; remove console; add space
|
void AddText(const BYTE *con,int len, bool new_line, bool space); // jichi 10/27/2013: add const; remove console; add space
|
||||||
void RemoveSingleRepeatAuto(const BYTE *con, int &len); // jichi 10/27/2013: add const
|
void RemoveSingleRepeatAuto(const BYTE *con, int &len); // jichi 10/27/2013: add const
|
||||||
void ResetRepeatStatus();
|
|
||||||
void AddLineBreak();
|
void AddLineBreak();
|
||||||
void DispatchLastSentence();
|
void DispatchLastSentence();
|
||||||
|
|
||||||
@ -72,16 +71,6 @@ public:
|
|||||||
return (ThreadOutputFilterCallback)_InterlockedExchange((long*)&output,(long)cb);
|
return (ThreadOutputFilterCallback)_InterlockedExchange((long*)&output,(long)cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadOutputFilterCallback RegisterFilterCallBack(ThreadOutputFilterCallback cb, PVOID data)
|
|
||||||
{
|
|
||||||
app_data = data;
|
|
||||||
return (ThreadOutputFilterCallback)_InterlockedExchange((long*)&filter,(long)cb);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetRepeatFlag() { status |= CYCLIC_REPEAT; }
|
|
||||||
void ClearNewLineFlag() { status &= ~BUFF_NEWLINE; }
|
|
||||||
void ClearRepeatFlag() { status &= ~CYCLIC_REPEAT; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThreadParameter tp;
|
ThreadParameter tp;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user