PID -> Parent PID



  • Wie kann ich zu einer Prozess ID dessen Parent Prozess ID herausfinden,
    ich habe da ein kleines Demo Prg gefunden, den "PidViewer", leider ist dessen Funktion nicht gegeben und ich kann mich auch nicht ableiten, wie der spass funktionieren soll ...



  • #include <windows.h>
    #include <tlhelp32.h>
    #include <stdio.h>

    HANDLE hSnapShot = NULL;
    hSnapShot=CreateToolhelp32Snapshot (TH32CS_SNAPALL,NULL);

    PROCESSENTRY32 pEntry;
    pEntry.dwSize =sizeof(pEntry);

    //Buffer for Process Info
    char szProcessInfo[255];

    //Get first process
    Process32First (hSnapShot,&pEntry);

    //Iterate thru all processes
    while(1)
    {
    BOOL hRes=Process32Next (hSnapShot,&pEntry);

    if(hRes==FALSE)
    break;

    printf("ID %d ",pEntry.th32ProcessID );
    printf("ExeFile %s ",pEntry.szExeFile);
    printf("Threads %d ", pEntry.cntThreads );
    printf("ParentID %d ",pEntry.th32ParentProcessID);
    printf("Prio %d\n",pEntry.pcPriClassBase );

    so das mal als teil 1 🙂 (Microsofts hilfe war wieder soo dolle, das Überhaupt nix ging, ausser die Routine die Error Messages schreibt ... leider)


Anmelden zum Antworten