本文整理汇总了Python中win32con.PROCESS_ALL_ACCESS属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.PROCESS_ALL_ACCESS属性的具体用法?Python win32con.PROCESS_ALL_ACCESS怎么用?Python win32con.PROCESS_ALL_ACCESS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32con
的用法示例。
在下文中一共展示了win32con.PROCESS_ALL_ACCESS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import PROCESS_ALL_ACCESS [as 别名]
def __init__(self, pid):
handle = self.handle = ctypes.windll.kernel32.OpenProcess(
READ_ACCESS, # win32con.PROCESS_ALL_ACCESS,
False,
pid)
# Close the handle on GC so we do not leak handles.
self._closer = weakref.ref(self, lambda x: CloseHandle(handle))
示例2: _readListViewItems
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import PROCESS_ALL_ACCESS [as 别名]
def _readListViewItems(hwnd, column_index=0):
# Allocate virtual memory inside target process
pid = ctypes.create_string_buffer(4)
p_pid = ctypes.addressof(pid)
GetWindowThreadProcessId(hwnd, p_pid) # process owning the given hwnd
hProcHnd = OpenProcess(win32con.PROCESS_ALL_ACCESS, False, struct.unpack("i", pid)[0])
pLVI = VirtualAllocEx(hProcHnd, 0, 4096, win32con.MEM_RESERVE | win32con.MEM_COMMIT, win32con.PAGE_READWRITE)
pBuffer = VirtualAllocEx(hProcHnd, 0, 4096, win32con.MEM_RESERVE | win32con.MEM_COMMIT, win32con.PAGE_READWRITE)
# Prepare an LVITEM record and write it to target process memory
lvitem_str = struct.pack('iiiiiiiii', *[0, 0, column_index, 0, 0, pBuffer, 4096, 0, 0])
lvitem_buffer = ctypes.create_string_buffer(lvitem_str)
copied = ctypes.create_string_buffer(4)
p_copied = ctypes.addressof(copied)
WriteProcessMemory(hProcHnd, pLVI, ctypes.addressof(lvitem_buffer), ctypes.sizeof(lvitem_buffer), p_copied)
# iterate items in the SysListView32 control
num_items = win32gui.SendMessage(hwnd, commctrl.LVM_GETITEMCOUNT)
item_texts = []
for item_index in range(num_items):
win32gui.SendMessage(hwnd, commctrl.LVM_GETITEMTEXT, item_index, pLVI)
target_buff = ctypes.create_string_buffer(4096)
ReadProcessMemory(hProcHnd, pBuffer, ctypes.addressof(target_buff), 4096, p_copied)
item_texts.append(target_buff.value)
VirtualFreeEx(hProcHnd, pBuffer, 0, win32con.MEM_RELEASE)
VirtualFreeEx(hProcHnd, pLVI, 0, win32con.MEM_RELEASE)
win32api.CloseHandle(hProcHnd)
return item_texts
示例3: GetProcessNameFromHwnd
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import PROCESS_ALL_ACCESS [as 别名]
def GetProcessNameFromHwnd(self, hwnd):
'''Acquire the process name from the window handle for use in the log filename.
'''
threadpid, procpid = win32process.GetWindowThreadProcessId(hwnd)
# PROCESS_QUERY_INFORMATION (0x0400) or PROCESS_VM_READ (0x0010) or PROCESS_ALL_ACCESS (0x1F0FFF)
mypyproc = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, False, procpid)
procname = win32process.GetModuleFileNameEx(mypyproc, 0)
return procname
示例4: beNice
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import PROCESS_ALL_ACCESS [as 别名]
def beNice(very_nice=False):
if very_nice:
value = BELOW_NORMAL_PRIORITY_CLASS
else:
value = IDLE_PRIORITY_CLASS
pid = GetCurrentProcessId()
handle = OpenProcess(PROCESS_ALL_ACCESS, True, pid)
SetPriorityClass(handle, value)
示例5: run
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import PROCESS_ALL_ACCESS [as 别名]
def run(self):
try:
self.handle = ctypes.windll.kernel32.OpenThread( # @UndefinedVariable
win32con.PROCESS_ALL_ACCESS, False, int(QThread.currentThreadId()))
except Exception as e:
print('get thread handle failed', e)
print('thread id', int(QThread.currentThreadId()))
for i in range(1, 101):
print('value', i)
self.valueChanged.emit(i)
QThread.sleep(1)