Fix windows connection
This commit is contained in:
parent
d90a8efd47
commit
6796d2ffa9
@ -6,6 +6,7 @@
|
|||||||
#define NOIME
|
#define NOIME
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
int GetProcessId()
|
int GetProcessId()
|
||||||
{
|
{
|
||||||
@ -32,9 +33,10 @@ static BaseConnectionWin Connection;
|
|||||||
|
|
||||||
bool BaseConnection::Open(int pipe)
|
bool BaseConnection::Open(int pipe)
|
||||||
{
|
{
|
||||||
wchar_t pipeName[]{L"\\\\?\\pipe\\discord-ipc-0"};
|
std::wostringstream stream{};
|
||||||
const size_t pipeDigit = sizeof(pipeName) / sizeof(wchar_t) - 2;
|
stream << L"\\\\?\\pipe\\discord-ipc-" << pipe;
|
||||||
pipeName[pipeDigit] = sprintf(L"%d", pipe);
|
std::wstring asString = stream.str();
|
||||||
|
const WCHAR* pipeName = asString.c_str();
|
||||||
auto self = reinterpret_cast<BaseConnectionWin*>(this);
|
auto self = reinterpret_cast<BaseConnectionWin*>(this);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
self->pipe = ::CreateFileW(
|
self->pipe = ::CreateFileW(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user