summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-11-01 10:09:41 -0400
committerJason R. Coombs <jaraco@jaraco.com>2012-11-01 10:09:41 -0400
commit45aa88b530cff0ad09f5da83efd4697ba7986563 (patch)
treecd6900273e6221405252b19945d284497fa14d82
parente0d71b5efb47434ad5957632e8fba0e6fec6389f (diff)
Remove dependency on pywin32. Just use ctypes for simplicity.
-rw-r--r--paramiko/win_pageant.py27
1 files changed, 2 insertions, 25 deletions
diff --git a/paramiko/win_pageant.py b/paramiko/win_pageant.py
index b7a3fcf7..2c9ac997 100644
--- a/paramiko/win_pageant.py
+++ b/paramiko/win_pageant.py
@@ -29,15 +29,6 @@ import array
import platform
import ctypes.wintypes
-# if pywin32 is available, use it
-_has_win32all = False
-try:
- # win32gui is preferred over win32ui to avoid MFC dependencies
- import win32gui
- _has_win32all = True
-except ImportError:
- pass
-
_AGENT_COPYDATA_ID = 0x804e50ba
_AGENT_MAX_MSGLEN = 8192
# Note: The WM_COPYDATA value is pulled from win32con, as a workaround
@@ -46,16 +37,7 @@ win32con_WM_COPYDATA = 74
def _get_pageant_window_object():
- if _has_win32all:
- try:
- hwnd = win32gui.FindWindow('Pageant', 'Pageant')
- return hwnd
- except win32gui.error:
- pass
- else:
- # Return 0 if there is no Pageant window.
- return ctypes.windll.user32.FindWindowA('Pageant', 'Pageant')
- return None
+ return ctypes.windll.user32.FindWindowA('Pageant', 'Pageant')
def can_talk_to_agent():
@@ -102,12 +84,7 @@ def _query_pageant(msg):
# Create a string to use for the SendMessage function call
cds = COPYDATASTRUCT(_AGENT_COPYDATA_ID, char_buffer_size, char_buffer_address)
- if _has_win32all:
- # win32gui.SendMessage should also allow the same pattern as
- # ctypes, but let's keep it like this for now...
- response = win32gui.SendMessage(hwnd, win32con_WM_COPYDATA, ctypes.sizeof(cds), ctypes.addressof(cds))
- else:
- response = ctypes.windll.user32.SendMessageA(hwnd, win32con_WM_COPYDATA, ctypes.sizeof(cds), ctypes.byref(cds))
+ response = ctypes.windll.user32.SendMessageA(hwnd, win32con_WM_COPYDATA, ctypes.sizeof(cds), ctypes.byref(cds))
if response > 0:
datalen = pymap.read(4)