def init(storage) :
import ctypes
import ctypes.wintypes as wintypes
class __PROCESS_INFORMATION(ctypes.Structure):
"""see:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms684873(v=vs.85).aspx
"""
_fields_ = [("hProcess", wintypes.HANDLE),
("hThread", wintypes.HANDLE),
("dwProcessId", wintypes.DWORD),
("dwThreadId", wintypes.DWORD),]
wintypes.PROCESS_INFORMATION = __PROCESS_INFORMATION
pid = wintypes.PROCESS_INFORMATION().dwProcessId
PROCESS_ALL_ACCESS = (0x000F0000|0x00100000|0xFFF)
handle = ctypes.windll.kernel32.OpenProcess(
PROCESS_ALL_ACCESS,
False,
pid
)
storage['process_pid'] = pid
storage['process_handle'] = handle
ModuleHandle = ctypes.windll.kernel32.GetModuleHandleA("kernel32.dll")
LoadLibraryA = ctypes.windll.kernel32.GetProcAddress(
wintypes.HANDLE(ModuleHandle),
"LoadLibraryA",
)
storage['LoadLibraryA'] = LoadLibraryA
return True
评论列表
文章目录