GetModuleHandle für fremden Prozess



  • Hi,

    ich habe einen fremden Prozess (ID. bzw. Name bekannt). Nun, wie kann ich ein handle auf ein bestimmtes Modul des Prozesses bekommen. Gibt es soetwas wie GetModuleHandle für fremde Prozesse???

    Danke,

    C.



  • Du kannst die laufenden Prozesse abfragen so bekommst du das Haendel

    http://www.c-plusplus.net/forum/viewtopic-var-p-is-284745.html



  • an was willst du den ran? fensterhandles?



  • Sorry, aber geht das auch ohne Injektion von einer DLL (in meinem Fall nicht möglich...)? Get das nicht alles aus einer Anwendung? Ich brauche ja nur das Handle...



  • Nee, Modul-Handle wie z.B. "D3DX9.DLL", "GDI32.DLL" wtc.



  • Das ist BCB5 Code kann sein das da eineige sachen bei sind die du etwas aendern musst .
    Und das Prozess killen must du dir wegdenken.
    (ich denke das hatten wir auch schon mal hier, aber die neue Suche ist mir zu bescheiden. - SORRY)

    String buff;
      int i;
      // Diese Funktion plaziert Die Prozess ID, Die parent Prozess ID, und den EXE-File
      // Namen fuer jeden Process in eine seperate Zeile.
    
      ProcessList->Items->Clear () ;
    
      // findet jeden Prozess und gibt ihn aus.
      HANDLE snapshot ;
      PROCESSENTRY32 processinfo ;
      processinfo.dwSize = sizeof (processinfo) ;
      snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0) ;
      if (snapshot == NULL)
        return ;
    
      bool status = Process32First (snapshot, &processinfo) ;
      while (status)
      {
        TListItem *li = ProcessList->Items->Add () ;
    
        li->Data = (void *) processinfo.th32ProcessID ;
    
        String buffer ;
        int length ;
        buffer.SetLength (512) ;
        length = sprintf (buffer.c_str (), "%d", (int)processinfo.th32ProcessID) ;
    
        // Im Moment wird die PID dezimal angezeigt.
        //length = sprintf (buffer.c_str (), "%X, processinfo.th32ProcessID) ;
        //zeigt die PID's in HEX an !!!
    
        buffer.SetLength (length) ;
        li->Caption = buffer;
    
        buffer.SetLength (512) ;
        length = sprintf (buffer.c_str (), "%d", (int)processinfo.th32ParentProcessID) ;
        // Im Moment wird die Parent PID dezimal angezeigt.
        //length = sprintf (buffer.c_str (), "%X", processinfo.th32ParentProcessID) ;
        // zeigt die Parent PID's in HEX an !!!
    
        buffer.SetLength (length) ;
        li->SubItems->Add (buffer) ;
    
        li->SubItems->Add (processinfo.szExeFile) ;
        //Application->MessageBox(processinfo.szExeFile,"AKTUELL:",0);
    
          if(kill)
           {
    
             for(i=0;i<=NAMENListe->Count-1;i++)
              {
    
                   if(!strcmp(processinfo.szExeFile,NAMENListe->Strings[i].c_str()))
                    {
    
                          if(ANZEIGEN_DER_ZU_LOASCHENDEN_FILES)
                           {
                              buff=NAMENListe->Strings[i];
                              buff += " wird geschlossen !" ;
                              Memo1->Lines->Add(buff);
                           }
    
                        //Application->MessageBox(buff.c_str() ,"WARNUNG",1);
                        //killen
                        DWORD pid = (DWORD) processinfo.th32ProcessID ;
                        HANDLE process = OpenProcess (PROCESS_ALL_ACCESS, false, pid) ;
                        TerminateProcess (process, -1) ;
                        CloseHandle (process) ;
                        //ende killen
    
                    }//if(!strcmp(processinfo.szExeFile,SUCH1))
    
              }//for(i=0;i<=NAMENList->Count-1;i++)
    
           }//if(kill)
    
        status = Process32Next (snapshot, &processinfo) ;
    
      }//while (status)
    
    return ;
    


  • ?

    Wie soll das klappen, bzw. was soll das bewirken? 😕

    Ich habe einen Prozess, und nun möchte ich ein Modul davon haben. Quasi GetModuleHandle(ProzessID, "MyDLL.dll")



  • EnumProcessModules ^^


Anmelden zum Antworten