This commit is contained in:
Akash Mozumdar 2018-08-25 16:02:16 -04:00
parent 2be762b708
commit 3f35c5c230
3 changed files with 190 additions and 188 deletions

View File

@ -27,10 +27,10 @@ std::wstring TextThread::GetStore()
return storage;
}
bool TextThread::Flush()
void TextThread::Flush()
{
LOCK ttLock(ttMutex);
if (timestamp - GetTickCount() < 250 || buffer.size() == 0) return true; // TODO: let user change delay before sentence is flushed
if (timestamp - GetTickCount() < 250 || buffer.size() == 0) return; // TODO: let user change delay before sentence is flushed
std::wstring sentence;
if (status & USING_UNICODE)
{
@ -44,7 +44,6 @@ bool TextThread::Flush()
}
AddSentence(sentence);
buffer.clear();
return true;
}
void TextThread::AddSentence(std::wstring sentence)

View File

@ -24,7 +24,7 @@ public:
void AddSentence(std::wstring sentence);
private:
bool Flush();
void Flush();
std::vector<char> buffer;
std::wstring storage;

View File

@ -30,6 +30,8 @@ std::unordered_map<std::wstring, DWORD> GetAllProcesses()
return ret;
}
namespace
{
DWORD Hash(QString module)
{
module = module.toLower();
@ -145,14 +147,6 @@ std::optional<HookParam> ParseHCode(QString HCode)
return hp;
}
std::optional<HookParam> ParseCode(QString code)
{
code = code.toUpper();
if (code.startsWith("/H")) return ParseHCode(code.remove(0, 2));
else if (code.startsWith("/R")) return ParseRCode(code.remove(0, 2));
else return {};
}
QString GenerateHCode(HookParam hp, DWORD processId)
{
QString code = "/H";
@ -231,6 +225,15 @@ QString GenerateRCode(HookParam hp)
code += QString::number(hp.address, 16);
return code.toUpper();
}
}
std::optional<HookParam> ParseCode(QString code)
{
code = code.toUpper();
if (code.startsWith("/H")) return ParseHCode(code.remove(0, 2));
else if (code.startsWith("/R")) return ParseRCode(code.remove(0, 2));
else return {};
}
QString GenerateCode(HookParam hp, DWORD processId)
{