Create the memory map with the security attributes for the current user (rather than the default) to avoid permissions failures when the client and the agent run in different UAC contexts. Fixes #98.

This commit is contained in:
Jason R. Coombs 2012-11-23 14:08:16 -05:00
parent 0698254b18
commit c0ef3fd493
1 changed files with 4 additions and 1 deletions

View File

@ -27,6 +27,7 @@ import array
import platform
import ctypes.wintypes
import jaraco.windows.security as security
import jaraco.windows.mmap as mmap
_AGENT_COPYDATA_ID = 0x804e50ba
@ -74,7 +75,9 @@ def _query_pageant(msg):
# create a name for the mmap
map_name = 'PageantRequest%08x' % threading.current_thread().ident
pymap = mmap.MemoryMap(map_name, _AGENT_MAX_MSGLEN)
pymap = mmap.MemoryMap(map_name, _AGENT_MAX_MSGLEN,
security.get_security_attributes_for_user(),
)
with pymap:
pymap.write(msg)
# Create an array buffer containing the mapped filename