mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
small fixes
This commit is contained in:
parent
dca006b28c
commit
f409ee78ce
@ -72,7 +72,9 @@ 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 };
|
||||||
AutoHandle<Util::NamedPipeHandleCloser>
|
|
||||||
|
struct NamedPipeHandleCloser { void operator()(void* h) { DisconnectNamedPipe(h); CloseHandle(h); } };
|
||||||
|
AutoHandle<NamedPipeHandleCloser>
|
||||||
hookPipe = CreateNamedPipeW(HOOK_PIPE, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, 0, PIPE_BUFFER_SIZE, MAXDWORD, &pipeSA),
|
hookPipe = CreateNamedPipeW(HOOK_PIPE, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, 0, PIPE_BUFFER_SIZE, MAXDWORD, &pipeSA),
|
||||||
hostPipe = CreateNamedPipeW(HOST_PIPE, PIPE_ACCESS_OUTBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, 0, MAXDWORD, &pipeSA);
|
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);
|
||||||
@ -117,7 +119,7 @@ namespace
|
|||||||
{
|
{
|
||||||
std::thread([]
|
std::thread([]
|
||||||
{
|
{
|
||||||
for (std::wstring last; true; Sleep(50))
|
for (std::wstring last; true; Sleep(500))
|
||||||
if (auto text = Util::GetClipboardText())
|
if (auto text = Util::GetClipboardText())
|
||||||
if (last != text.value())
|
if (last != text.value())
|
||||||
Host::GetThread(CLIPBOARD)->AddSentence(last = text.value());
|
Host::GetThread(CLIPBOARD)->AddSentence(last = text.value());
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
namespace Util
|
namespace Util
|
||||||
{
|
{
|
||||||
struct NamedPipeHandleCloser { void operator()(void* h) { DisconnectNamedPipe(h); CloseHandle(h); } };
|
|
||||||
std::optional<std::wstring> GetModuleFileName(DWORD processId, HMODULE module = NULL);
|
std::optional<std::wstring> GetModuleFileName(DWORD processId, HMODULE module = NULL);
|
||||||
std::optional<std::wstring> GetModuleFileName(HMODULE module = NULL);
|
std::optional<std::wstring> GetModuleFileName(HMODULE module = NULL);
|
||||||
std::optional<std::wstring> GetClipboardText();
|
std::optional<std::wstring> GetClipboardText();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user