How to check if pepflashplayer.dll has started and catch Pid

Asked

Viewed 85 times

1

I’m picking up the modules that are being used by Chrome to know if pepflashplayer.dll (FLASH PLAYER) has been started

I’m using that code

void ListAllProcesses() {

    var hProcessSnap = WinAPI.CreateToolhelp32Snapshot(WinAPI.SnapshotFlags.TH32CS_SNAPPROCESS, IntPtr.Zero);
    var processEntry = new WinAPI.PROCESSENTRY32();

    processEntry.dwSize = (uint)Marshal.SizeOf(typeof(WinAPI.PROCESSENTRY32));

    if (WinAPI.Process32First(hProcessSnap, ref processEntry)) {
        do {

            ListProcessModules(processEntry.th32ProcessID, processEntry.szExeFile);

            processEntry = new WinAPI.PROCESSENTRY32();
            processEntry.dwSize = (uint)Marshal.SizeOf(typeof(WinAPI.PROCESSENTRY32));
        } while (WinAPI.Process32Next(hProcessSnap, ref processEntry));
    }

}

void ListProcessModules(uint dwPID, string szExeFile) {

    var hModuleSnap = WinAPI.CreateToolhelp32Snapshot(WinAPI.SnapshotFlags.TH32CS_SNAPALL | WinAPI.SnapshotFlags.TH32CS_SNAPMODULE, (IntPtr)dwPID);
    var moduleEntry = new WinAPI.MODULEENTRY32();

    moduleEntry.dwSize = (uint)Marshal.SizeOf(typeof(WinAPI.MODULEENTRY32));

    if (WinAPI.Module32First(hModuleSnap, ref moduleEntry)) {

        do {

            if (moduleEntry.szModule == "pepflashplayer.dll") {

                processID = dwPID;

                Debug.WriteLine(processID);

                label_ALERTMSG_PROCESSWAIT.Text = "ProcessID: " + dwPID + " - " + moduleEntry.szModule;
                label_ALERTMSG_PROCESSWAIT.ForeColor = Color.Lime;

                processTimer.Stop();

            }

            moduleEntry = new WinAPI.MODULEENTRY32();
            moduleEntry.dwSize = (uint)Marshal.SizeOf(typeof(WinAPI.MODULEENTRY32));

        } while (WinAPI.Module32Next(hModuleSnap, ref moduleEntry));

    }

}

The problem is that it only finds the module if builds in x64.

I tried to do it this way too

Process[] test = Process.GetProcessesByName("chrome");

foreach (var item in test) {

    foreach (var item2 in item.Modules) {

        Debug.WriteLine(item2);
        CB_TEST.Items.Add(item2.ToString());

    }

}

Modules only runs if x64.

Is there another way to do this? check if (pepflashplayer.dll) was started and get the Pid from it? that works also in x86

  • Take away a doubt, if you open a terminal and give the command "tasklist" it appears? If it appears I have a suggestion that is not beautiful, but will work.

  • Did not appear, just returned . exe

  • several Chrome.exe only I need to know in which Chrome process is running that dll

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.