Skip to content
Snippets Groups Projects
Commit 4ec300e11e5f authored by Jeff Forcier's avatar Jeff Forcier
Browse files

Merge branch '1.11' into 1.12

Conflicts:
	NEWS
Branches
No related tags found
No related merge requests found
......@@ -12,6 +12,27 @@
Releases
========
v1.12.2 (21st Jan 2014)
-----------------------
* #193 (and its attentant PRs #230 & #253): Fix SSH agent problems present on
Windows. Thanks to David Hobbs for initial report and to Aarni Koskela & Olle
Lundberg for the patches.
v1.11.4 (21st Jan 2014)
-----------------------
* #193 (and its attentant PRs #230 & #253): Fix SSH agent problems present on
Windows. Thanks to David Hobbs for initial report and to Aarni Koskela & Olle
Lundberg for the patches.
v1.10.6 (21st Jan 2014)
-----------------------
* #193 (and its attentant PRs #230 & #253): Fix SSH agent problems present on
Windows. Thanks to David Hobbs for initial report and to Aarni Koskela & Olle
Lundberg for the patches.
v1.12.1 (8th Jan 2014)
----------------------
......
......@@ -10,6 +10,11 @@
import ctypes.wintypes
import __builtin__
try:
USHORT = ctypes.wintypes.USHORT
except AttributeError:
USHORT = ctypes.c_ushort
######################
# jaraco.windows.error
......@@ -81,9 +86,6 @@
raise WindowsError()
#####################
# jaraco.windows.mmap
CreateFileMapping = ctypes.windll.kernel32.CreateFileMappingW
CreateFileMapping.argtypes = [
ctypes.wintypes.HANDLE,
......@@ -130,11 +132,14 @@
self.pos = pos
def write(self, msg):
ctypes.windll.msvcrt.memcpy(self.view + self.pos, msg, len(msg))
self.pos += len(msg)
n = len(msg)
if self.pos + n >= self.length: # A little safety.
raise ValueError("Refusing to write %d bytes" % n)
ctypes.windll.kernel32.RtlMoveMemory(self.view + self.pos, msg, n)
self.pos += n
def read(self, n):
"""
Read n bytes from mapped view.
"""
out = ctypes.create_string_buffer(n)
......@@ -135,10 +140,10 @@
def read(self, n):
"""
Read n bytes from mapped view.
"""
out = ctypes.create_string_buffer(n)
ctypes.windll.msvcrt.memcpy(out, self.view + self.pos, n)
ctypes.windll.kernel32.RtlMoveMemory(out, self.view + self.pos, n)
self.pos += n
return out.raw
......@@ -173,7 +178,7 @@
PACL Dacl;
} SECURITY_DESCRIPTOR;
"""
SECURITY_DESCRIPTOR_CONTROL = ctypes.wintypes.USHORT
SECURITY_DESCRIPTOR_CONTROL = USHORT
REVISION = 1
_fields_ = [
......
......@@ -23,4 +23,7 @@
from __future__ import with_statement
import array
import ctypes.wintypes
import platform
import struct
......@@ -26,8 +29,9 @@
import struct
import threading
import array
import platform
import ctypes.wintypes
try:
import _thread as thread # Python 3.x
except ImportError:
import thread # Python 2.5-2.7
from . import _winapi
......@@ -31,6 +35,7 @@
from . import _winapi
_AGENT_COPYDATA_ID = 0x804e50ba
_AGENT_MAX_MSGLEN = 8192
# Note: The WM_COPYDATA value is pulled from win32con, as a workaround
......@@ -51,4 +56,5 @@
"""
return bool(_get_pageant_window_object())
ULONG_PTR = ctypes.c_uint64 if platform.architecture()[0] == '64bit' else ctypes.c_uint32
......@@ -54,4 +60,6 @@
ULONG_PTR = ctypes.c_uint64 if platform.architecture()[0] == '64bit' else ctypes.c_uint32
class COPYDATASTRUCT(ctypes.Structure):
"""
ctypes implementation of
......@@ -63,6 +71,7 @@
('data_loc', ctypes.c_void_p),
]
def _query_pageant(msg):
"""
Communication with the Pageant process is done through a shared
......@@ -74,7 +83,7 @@
return None
# create a name for the mmap
map_name = 'PageantRequest%08x' % threading.current_thread().ident
map_name = 'PageantRequest%08x' % thread.get_ident()
pymap = _winapi.MemoryMap(map_name, _AGENT_MAX_MSGLEN,
_winapi.get_security_attributes_for_user(),
......@@ -98,6 +107,7 @@
return datalen + pymap.read(retlen)
return None
class PageantConnection(object):
"""
Mock "connection" to an agent which roughly approximates the behavior of
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment