On Fri, Dec 14, 2012 at 6:35 PM, Michael van der Kolff <mvanderko...@gmail.com> wrote: > For background, I'm trying to port paramiko to IronPython. With the > IronPyCrypto, we seem to have everything working apart from Pageant support. > > The question is, why does this not work? This is a simplified version of > what Paramiko does - but the point is, run it on CPython and we have > different behaviour. > > Cheers, > > Michael > > import ctypes, ctypes.wintypes, array, mmap > > _WM_COPYDATA = 74 > _PAGEANT_MAGIC = 0x804e50ba > _MAX_MSG_LEN = 8192 > > class COPYDATASTRUCT(ctypes.Structure): > _fields_ = [ > ('num_data', ctypes.c_uint32), > ('data_size', ctypes.wintypes.DWORD), > ('data_loc', ctypes.c_void_p), > ] > > hWnd = ctypes.windll.user32.FindWindowA(b'Pageant', b'Pageant') #This works > on IronPython > > tagname = "PageantRequest5" > pymap = mmap.mmap(-1,_MAX_MSG_LEN,tagname=tagname, access=mmap.ACCESS_WRITE) > pymap[0:5] = '\0\0\0\x01\x0b' #A request of length one asking for keys from > pageant > > cbuf = array.array('c', bytes(tagname + '\0')) > _addr, _size = cbuf.buffer_info() > cds = COPYDATASTRUCT(_PAGEANT_MAGIC, _size, _addr) > response = ctypes.windll.user32.SendMessageA(hWnd, _WM_COPYDATA, > ctypes.sizeof(cds), ctypes.byref(cds)) > print response #On CPython 2.7, 1; on Ironpython, 0. > #On CPython, at this stage we can read out the response just by manipulating > the mmap object.
Hard to say. It could be a bug in ctypes (it's not perfect), but debugging that could be tricky. I looped Dino in to see if he knows more. - Jeff _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org http://mail.python.org/mailman/listinfo/ironpython-users