Skip to content

Commit

Permalink
fix named pipe connections sending memoryview data: must convert to b…
Browse files Browse the repository at this point in the history
…ytes before using WriteFile

git-svn-id: https://xpra.org/svn/Xpra/trunk@26231 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 3, 2020
1 parent 417c0b8 commit 233fa97
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/xpra/platform/win32/namedpipes/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import errno
from ctypes import addressof, byref, c_ulong, c_char_p, c_char, c_void_p, cast, string_at

from xpra.os_util import strtobytes
from xpra.os_util import strtobytes, memoryview_to_bytes
from xpra.net.bytestreams import Connection
from xpra.net.common import ConnectionClosedException
from xpra.platform.win32.common import (
Expand Down Expand Up @@ -123,10 +123,11 @@ def write(self, buf):
return self._write(self._pipe_write, buf)

def _pipe_write(self, buf):
size = len(buf)
bbuf = memoryview_to_bytes(buf)
size = len(bbuf)
log("pipe_write: %i bytes", size) #binascii.hexlify(buf))
written = c_ulong(0)
r = WriteFile(self.pipe_handle, c_char_p(buf), len(buf), byref(written), byref(self.write_overlapped))
r = WriteFile(self.pipe_handle, c_char_p(bbuf), size, byref(written), byref(self.write_overlapped))
log("WriteFile(..)=%s, len=%i", r, written.value)
if not r and self.pipe_handle:
e = GetLastError()
Expand Down

0 comments on commit 233fa97

Please sign in to comment.