diff --git a/src/connection_win.cpp b/src/connection_win.cpp index 00f457a..d0b895b 100644 --- a/src/connection_win.cpp +++ b/src/connection_win.cpp @@ -6,6 +6,7 @@ #define NOIME #include #include +#include int GetProcessId() { @@ -32,9 +33,10 @@ static BaseConnectionWin Connection; bool BaseConnection::Open(int pipe) { - wchar_t pipeName[]{L"\\\\?\\pipe\\discord-ipc-0"}; - const size_t pipeDigit = sizeof(pipeName) / sizeof(wchar_t) - 2; - pipeName[pipeDigit] = sprintf(L"%d", pipe); + std::wostringstream stream{}; + stream << L"\\\\?\\pipe\\discord-ipc-" << pipe; + std::wstring asString = stream.str(); + const WCHAR* pipeName = asString.c_str(); auto self = reinterpret_cast(this); for (;;) { self->pipe = ::CreateFileW(