Closed Spawnrad closed 1 year ago
Maybe you could add a strict
argument so it won't break existing projects based on fuzzy process name matching ?
def process_from_name(name, strict=False):
"""Open a process given its name.
:param name: The name of the process to be opened
:param strict: Perform an exact process name match (as opposed to default fuzzy search)
:type name: str
:type strict: bool
:return: The ProcessEntry32 structure of the given process.
:rtype: ctypes.c_void_p
"""
name = name.lower()
processes = list_processes()
for process in processes:
process_name = process.szExeFile.decode(locale.getpreferredencoding()).lower()
if strict and name == process_name:
return process
elif name in process_name:
return process
https://github.com/srounet/Pymem/issues/69#issue-972630632