Fixes #4, thanks again to @jaraco
This commit is contained in:
parent
3b20efcc14
commit
b59430efef
8
CHANGES
8
CHANGES
|
@ -2,9 +2,11 @@ Temporary, post-Paramiko changelog while we get our sh!t together.
|
||||||
|
|
||||||
## ssh 1.7.13 (2012-MM-DD)
|
## ssh 1.7.13 (2012-MM-DD)
|
||||||
|
|
||||||
* Moved a `fcntl` import closer to where it's used to help avoid `ImportError`
|
* #5: Moved a `fcntl` import closer to where it's used to help avoid
|
||||||
problems on Windows platforms. Thanks to Jason Coombs for the catch +
|
`ImportError` problems on Windows platforms. Thanks to Jason Coombs for the
|
||||||
suggested fix.
|
catch + suggested fix.
|
||||||
|
* #4: Updated implementation of WinPageant integration to work on 64-bit
|
||||||
|
Windows. Thanks again to Jason Coombs for the patch.
|
||||||
|
|
||||||
## ssh 1.7.12 (2012-02-10)
|
## ssh 1.7.12 (2012-02-10)
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ import struct
|
||||||
import tempfile
|
import tempfile
|
||||||
import mmap
|
import mmap
|
||||||
import array
|
import array
|
||||||
|
import platform
|
||||||
|
import ctypes.wintypes
|
||||||
|
|
||||||
# if you're on windows, you should have one of these, i guess?
|
# if you're on windows, you should have one of these, i guess?
|
||||||
# ctypes is part of standard library since Python 2.5
|
# ctypes is part of standard library since Python 2.5
|
||||||
|
@ -73,6 +75,17 @@ def can_talk_to_agent():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
ULONG_PTR = ctypes.c_uint64 if platform.architecture()[0] == '64bit' else ctypes.c_uint32
|
||||||
|
class COPYDATASTRUCT(ctypes.Structure):
|
||||||
|
"""
|
||||||
|
ctypes implementation of
|
||||||
|
http://msdn.microsoft.com/en-us/library/windows/desktop/ms649010%28v=vs.85%29.aspx
|
||||||
|
"""
|
||||||
|
_fields_ = [
|
||||||
|
('num_data', ULONG_PTR),
|
||||||
|
('data_size', ctypes.wintypes.DWORD),
|
||||||
|
('data_loc', ctypes.c_void_p),
|
||||||
|
]
|
||||||
|
|
||||||
def _query_pageant(msg):
|
def _query_pageant(msg):
|
||||||
hwnd = _get_pageant_window_object()
|
hwnd = _get_pageant_window_object()
|
||||||
|
@ -95,16 +108,14 @@ def _query_pageant(msg):
|
||||||
char_buffer = array.array("c", map_filename + '\0')
|
char_buffer = array.array("c", map_filename + '\0')
|
||||||
char_buffer_address, char_buffer_size = char_buffer.buffer_info()
|
char_buffer_address, char_buffer_size = char_buffer.buffer_info()
|
||||||
# Create a string to use for the SendMessage function call
|
# Create a string to use for the SendMessage function call
|
||||||
cds = struct.pack("LLP", _AGENT_COPYDATA_ID, char_buffer_size, char_buffer_address)
|
cds = COPYDATASTRUCT(_AGENT_COPYDATA_ID, char_buffer_size, char_buffer_address)
|
||||||
|
|
||||||
if _has_win32all:
|
if _has_win32all:
|
||||||
# win32gui.SendMessage should also allow the same pattern as
|
# win32gui.SendMessage should also allow the same pattern as
|
||||||
# ctypes, but let's keep it like this for now...
|
# ctypes, but let's keep it like this for now...
|
||||||
response = win32gui.SendMessage(hwnd, win32con_WM_COPYDATA, len(cds), cds)
|
response = win32gui.SendMessage(hwnd, win32con_WM_COPYDATA, ctypes.sizeof(cds), ctypes.addressof(cds))
|
||||||
elif _has_ctypes:
|
elif _has_ctypes:
|
||||||
_buf = array.array('B', cds)
|
response = ctypes.windll.user32.SendMessageA(hwnd, win32con_WM_COPYDATA, ctypes.sizeof(cds), ctypes.byref(cds))
|
||||||
_addr, _size = _buf.buffer_info()
|
|
||||||
response = ctypes.windll.user32.SendMessageA(hwnd, win32con_WM_COPYDATA, _size, _addr)
|
|
||||||
else:
|
else:
|
||||||
response = 0
|
response = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue