move constant definitions around some

This commit is contained in:
Akash Mozumdar 2018-05-21 04:05:09 -04:00
parent 7aa4e51803
commit ef1884701f
4 changed files with 6 additions and 17 deletions

View File

@ -19,25 +19,13 @@
#include "ccutil/ccmacro.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"
#include "sakurakit/skdebug.h"
namespace
{ // unnamed
//enum { HOOK_TIMEOUT = -50000000 }; // in nanoseconds = 5 seconds
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 hookMutex; // jichi 9/28/2013: used to guard hook modification
} // unnamed namespace

View File

@ -78,8 +78,8 @@ void CreateNewPipe()
{
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);
hostPipe = CreateNamedPipeW(ITH_COMMAND_PIPE, PIPE_ACCESS_OUTBOUND, 0, 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, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, NULL);
TextReceivingThread = CreateThread(nullptr, 0, TextReceiver, hookPipe, 0, nullptr);
man->RegisterPipe(hookPipe, hostPipe, TextReceivingThread);
}
@ -89,7 +89,6 @@ DWORD WINAPI TextReceiver(LPVOID lpThreadParameter)
HANDLE hookPipe = (HANDLE)lpThreadParameter;
ConnectNamedPipe(hookPipe, nullptr);
enum { PIPE_BUFFER_SIZE = 0x1000 };
BYTE* buffer = new BYTE[PIPE_BUFFER_SIZE];
DWORD bytesRead, processId;

View File

@ -114,6 +114,8 @@ enum HookParamType : unsigned long {
// Fuse all threads, and prevent floating
enum { FIXED_SPLIT_VALUE = 0x10001 };
enum { PIPE_BUFFER_SIZE = 0x1000};
// jichi 12/18/2013:
// These dlls are used to guess the range for non-NO_CONTEXT hooks.
//

View File

@ -25,7 +25,7 @@ DWORD WINAPI PipeManager(LPVOID unused)
while (::running)
{
DWORD count;
BYTE* buffer = new BYTE[0x1000];
BYTE* buffer = new BYTE[PIPE_BUFFER_SIZE];
HANDLE hostPipe = ::hookPipe = INVALID_HANDLE_VALUE,
pipeAcquisitionMutex = CreateMutexW(nullptr, TRUE, ITH_GRANTPIPE_MUTEX);
@ -62,7 +62,7 @@ DWORD WINAPI PipeManager(LPVOID unused)
while (::running)
{
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;
}