mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-24 01:14:12 +08:00
move constant definitions around some
This commit is contained in:
parent
7aa4e51803
commit
ef1884701f
@ -19,25 +19,13 @@
|
|||||||
#include "ccutil/ccmacro.h"
|
#include "ccutil/ccmacro.h"
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
|
||||||
//#define ITH_WINE
|
|
||||||
//#define ITH_USE_UX_DLLS IthIsWine()
|
|
||||||
//#define ITH_USE_XP_DLLS (IthIsWindowsXp() && !IthIsWine())
|
|
||||||
|
|
||||||
#define DEBUG "vnrhost/host.cc"
|
#define DEBUG "vnrhost/host.cc"
|
||||||
#include "sakurakit/skdebug.h"
|
#include "sakurakit/skdebug.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{ // unnamed
|
{ // unnamed
|
||||||
|
|
||||||
//enum { HOOK_TIMEOUT = -50000000 }; // in nanoseconds = 5 seconds
|
|
||||||
|
|
||||||
CRITICAL_SECTION hostCs;
|
CRITICAL_SECTION hostCs;
|
||||||
//WCHAR exist[] = ITH_PIPEEXISTS_EVENT;
|
|
||||||
//WCHAR mutex[] = L"ITH_RUNNING";
|
|
||||||
//WCHAR EngineName[] = ITH_ENGINE_DLL;
|
|
||||||
//WCHAR EngineNameXp[] = ITH_ENGINE_XP_DLL;
|
|
||||||
//WCHAR DllName[] = ITH_CLIENT_DLL;
|
|
||||||
//WCHAR DllNameXp[] = ITH_CLIENT_XP_DLL;
|
|
||||||
HANDLE preventDuplicationMutex; // jichi 9/28/2013: used to guard pipe
|
HANDLE preventDuplicationMutex; // jichi 9/28/2013: used to guard pipe
|
||||||
HANDLE hookMutex; // jichi 9/28/2013: used to guard hook modification
|
HANDLE hookMutex; // jichi 9/28/2013: used to guard hook modification
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
@ -78,8 +78,8 @@ void CreateNewPipe()
|
|||||||
{
|
{
|
||||||
HANDLE hookPipe, hostPipe, TextReceivingThread;
|
HANDLE hookPipe, hostPipe, TextReceivingThread;
|
||||||
|
|
||||||
hookPipe = CreateNamedPipeW(ITH_TEXT_PIPE, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, 0x1000, 0x1000, MAXDWORD, NULL);
|
hookPipe = CreateNamedPipeW(ITH_TEXT_PIPE, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, NULL);
|
||||||
hostPipe = CreateNamedPipeW(ITH_COMMAND_PIPE, PIPE_ACCESS_OUTBOUND, 0, PIPE_UNLIMITED_INSTANCES, 0x1000, 0x1000, MAXDWORD, NULL);
|
hostPipe = CreateNamedPipeW(ITH_COMMAND_PIPE, PIPE_ACCESS_OUTBOUND, 0, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, NULL);
|
||||||
TextReceivingThread = CreateThread(nullptr, 0, TextReceiver, hookPipe, 0, nullptr);
|
TextReceivingThread = CreateThread(nullptr, 0, TextReceiver, hookPipe, 0, nullptr);
|
||||||
man->RegisterPipe(hookPipe, hostPipe, TextReceivingThread);
|
man->RegisterPipe(hookPipe, hostPipe, TextReceivingThread);
|
||||||
}
|
}
|
||||||
@ -89,7 +89,6 @@ DWORD WINAPI TextReceiver(LPVOID lpThreadParameter)
|
|||||||
HANDLE hookPipe = (HANDLE)lpThreadParameter;
|
HANDLE hookPipe = (HANDLE)lpThreadParameter;
|
||||||
ConnectNamedPipe(hookPipe, nullptr);
|
ConnectNamedPipe(hookPipe, nullptr);
|
||||||
|
|
||||||
enum { PIPE_BUFFER_SIZE = 0x1000 };
|
|
||||||
BYTE* buffer = new BYTE[PIPE_BUFFER_SIZE];
|
BYTE* buffer = new BYTE[PIPE_BUFFER_SIZE];
|
||||||
DWORD bytesRead, processId;
|
DWORD bytesRead, processId;
|
||||||
|
|
||||||
|
@ -114,6 +114,8 @@ enum HookParamType : unsigned long {
|
|||||||
// Fuse all threads, and prevent floating
|
// Fuse all threads, and prevent floating
|
||||||
enum { FIXED_SPLIT_VALUE = 0x10001 };
|
enum { FIXED_SPLIT_VALUE = 0x10001 };
|
||||||
|
|
||||||
|
enum { PIPE_BUFFER_SIZE = 0x1000};
|
||||||
|
|
||||||
// jichi 12/18/2013:
|
// jichi 12/18/2013:
|
||||||
// These dlls are used to guess the range for non-NO_CONTEXT hooks.
|
// These dlls are used to guess the range for non-NO_CONTEXT hooks.
|
||||||
//
|
//
|
||||||
|
@ -25,7 +25,7 @@ DWORD WINAPI PipeManager(LPVOID unused)
|
|||||||
while (::running)
|
while (::running)
|
||||||
{
|
{
|
||||||
DWORD count;
|
DWORD count;
|
||||||
BYTE* buffer = new BYTE[0x1000];
|
BYTE* buffer = new BYTE[PIPE_BUFFER_SIZE];
|
||||||
HANDLE hostPipe = ::hookPipe = INVALID_HANDLE_VALUE,
|
HANDLE hostPipe = ::hookPipe = INVALID_HANDLE_VALUE,
|
||||||
pipeAcquisitionMutex = CreateMutexW(nullptr, TRUE, ITH_GRANTPIPE_MUTEX);
|
pipeAcquisitionMutex = CreateMutexW(nullptr, TRUE, ITH_GRANTPIPE_MUTEX);
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ DWORD WINAPI PipeManager(LPVOID unused)
|
|||||||
while (::running)
|
while (::running)
|
||||||
{
|
{
|
||||||
Sleep(STANDARD_WAIT);
|
Sleep(STANDARD_WAIT);
|
||||||
if (!ReadFile(hostPipe, buffer, 0x800, &count, nullptr))
|
if (!ReadFile(hostPipe, buffer, PIPE_BUFFER_SIZE / 2, &count, nullptr)) // Artikash 5/21/2018: why / 2? wchar_t?
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user