INNER CODE UNIT · Python

_get_process_map

Qwejay/Qflow · main.py:265

    def _get_process_map():
        pid_map = {}
        hSnap = ctypes.windll.kernel32.CreateToolhelp32Snapshot(WindowEngine.TH32CS_SNAPPROCESS, 0)
        if hSnap == -1: return pid_map
        try:
            pe32 = WindowEngine.PROCESSENTRY32()
            pe32.dwSize = ctypes.sizeof(WindowEngine.PROCESSENTRY32)
            if ctypes.windll.kernel32.Process32First(hSnap, ctypes.byref(pe32)):
                while True:
                    try: exe_name = pe32.szExeFile.decode('gbk', 'ignore')
                    except: exe_name = pe32.szExeFile.decode('utf-8', 'ignore')
                    pid_map[pe32.th32ProcessID] = exe_name
                    if not ctypes.windll.kernel32.Process32Next(hSnap, ctypes.byref(pe32)): break
        finally:
            ctypes.windll.kernel32.CloseHandle(hSnap)
        return pid_map

    @staticmethod

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…