clean up some definitions
This commit is contained in:
parent
c877d9cd31
commit
aa2d71a078
@ -99,8 +99,8 @@ namespace
|
|||||||
InitializeSecurityDescriptor(&pipeSD, SECURITY_DESCRIPTOR_REVISION);
|
InitializeSecurityDescriptor(&pipeSD, SECURITY_DESCRIPTOR_REVISION);
|
||||||
SetSecurityDescriptorDacl(&pipeSD, TRUE, NULL, FALSE); // Allow non-admin processes to connect to pipe created by admin host
|
SetSecurityDescriptorDacl(&pipeSD, TRUE, NULL, FALSE); // Allow non-admin processes to connect to pipe created by admin host
|
||||||
SECURITY_ATTRIBUTES pipeSA = { sizeof(SECURITY_ATTRIBUTES), &pipeSD, FALSE };
|
SECURITY_ATTRIBUTES pipeSA = { sizeof(SECURITY_ATTRIBUTES), &pipeSD, FALSE };
|
||||||
HANDLE hookPipe = CreateNamedPipeW(ITH_TEXT_PIPE, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, &pipeSA);
|
HANDLE hookPipe = CreateNamedPipeW(HOOK_PIPE, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, 0, PIPE_BUFFER_SIZE, MAXDWORD, &pipeSA);
|
||||||
HANDLE hostPipe = CreateNamedPipeW(ITH_COMMAND_PIPE, PIPE_ACCESS_OUTBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, &pipeSA);
|
HANDLE hostPipe = CreateNamedPipeW(HOST_PIPE, PIPE_ACCESS_OUTBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, 0, MAXDWORD, &pipeSA);
|
||||||
ConnectNamedPipe(hookPipe, nullptr);
|
ConnectNamedPipe(hookPipe, nullptr);
|
||||||
|
|
||||||
BYTE buffer[PIPE_BUFFER_SIZE + 1] = {};
|
BYTE buffer[PIPE_BUFFER_SIZE + 1] = {};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
#include "defs.h"
|
||||||
#include "extensions.h"
|
#include "extensions.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@ -26,7 +27,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (auto file : QDir().entryList())
|
for (auto file : QDir().entryList())
|
||||||
if (file.endsWith(".dll") && file != "vnrhook.dll") Extension::Load(file.left(file.lastIndexOf(".dll")));
|
if (file.endsWith(".dll") && file != ITH_DLL) Extension::Load(file.left(file.lastIndexOf(".dll")));
|
||||||
}
|
}
|
||||||
ReloadExtensions();
|
ReloadExtensions();
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
// Pipes
|
// Pipes
|
||||||
|
|
||||||
#define ITH_TEXT_PIPE L"\\\\.\\pipe\\VNR_TEXT"
|
#define HOOK_PIPE L"\\\\.\\pipe\\TEXTRACTOR_HOOK"
|
||||||
#define ITH_COMMAND_PIPE L"\\\\.\\pipe\\VNR_COMMAND"
|
#define HOST_PIPE L"\\\\.\\pipe\\TEXTRACTOR_HOST"
|
||||||
|
|
||||||
// Sections
|
// Sections
|
||||||
|
|
||||||
|
@ -52,8 +52,6 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD fdwReason, LPVOID)
|
|||||||
for (TextHook *man = ::hookman; man < ::hookman + MAX_HOOK; man++) if (man->hp.insertion_address) man->ClearHook();
|
for (TextHook *man = ::hookman; man < ::hookman + MAX_HOOK; man++) if (man->hp.insertion_address) man->ClearHook();
|
||||||
//if (ith_has_section)
|
//if (ith_has_section)
|
||||||
UnmapViewOfFile(::hookman);
|
UnmapViewOfFile(::hookman);
|
||||||
|
|
||||||
CloseHandle(::hookPipe);
|
|
||||||
CloseHandle(hSection);
|
CloseHandle(hSection);
|
||||||
//} ITH_EXCEPT {}
|
//} ITH_EXCEPT {}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ void CreatePipe()
|
|||||||
{
|
{
|
||||||
CreateThread(nullptr, 0, [](LPVOID)
|
CreateThread(nullptr, 0, [](LPVOID)
|
||||||
{
|
{
|
||||||
enum { STANDARD_WAIT = 50 };
|
|
||||||
while (::running)
|
while (::running)
|
||||||
{
|
{
|
||||||
DWORD count = 0;
|
DWORD count = 0;
|
||||||
@ -34,15 +33,16 @@ void CreatePipe()
|
|||||||
{
|
{
|
||||||
if (::hookPipe == INVALID_HANDLE_VALUE)
|
if (::hookPipe == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
::hookPipe = CreateFileW(ITH_TEXT_PIPE, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
::hookPipe = CreateFileW(HOOK_PIPE, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
}
|
}
|
||||||
if (::hookPipe != INVALID_HANDLE_VALUE && hostPipe == INVALID_HANDLE_VALUE)
|
if (::hookPipe != INVALID_HANDLE_VALUE && hostPipe == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
hostPipe = CreateFileW(ITH_COMMAND_PIPE, GENERIC_READ | FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
hostPipe = CreateFileW(HOST_PIPE, GENERIC_READ | FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
DWORD mode = PIPE_READMODE_MESSAGE;
|
DWORD mode = PIPE_READMODE_MESSAGE;
|
||||||
SetNamedPipeHandleState(hostPipe, &mode, NULL, NULL);
|
SetNamedPipeHandleState(hostPipe, &mode, NULL, NULL);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
Sleep(STANDARD_WAIT);
|
Sleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
*(DWORD*)buffer = GetCurrentProcessId();
|
*(DWORD*)buffer = GetCurrentProcessId();
|
||||||
@ -78,6 +78,7 @@ void CreatePipe()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(hostPipe);
|
CloseHandle(hostPipe);
|
||||||
|
CloseHandle(::hookPipe);
|
||||||
}
|
}
|
||||||
FreeLibraryAndExitThread(GetModuleHandleW(ITH_DLL), 0);
|
FreeLibraryAndExitThread(GetModuleHandleW(ITH_DLL), 0);
|
||||||
return (DWORD)0;
|
return (DWORD)0;
|
||||||
|
Loading…
Reference in New Issue
Block a user