Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Delphi 2009 und dllinjection? (https://www.delphipraxis.net/130942-delphi-2009-und-dllinjection.html)

eglar85 16. Mär 2009 13:25


Delphi 2009 und dllinjection?
 
Hallo,

ich habe erst vor kurzem D2009 installiert und ebenfalls ein altes Projekt wieder aufgegriffen
jedoch musste ich feststellen das es under D2009(32bit) nicht funktioniert. Das Projekt wird zwar fehlerfrei erzeugt, die DLL wird jedoch nicht ausgeführt.(unter D7 läuft alles einwandfrei) Ich bin mir fast sicher das es etwas mit der neuen PAnsiChar und PWildChar konventionen zu tun hat finde jedoch den Fehler nicht. Ich hab fast alles probiert und bin am verzweifeln. (Noch finde ich mich mit D2009 nicht allzugut zurecht)

Vllt hat sich ja jmd on euch einmal damit befasst.

Delphi-Quellcode:
  h_prozess:= openprocess(PROCESS_ALL_ACCESS, false, targetproc);
  p_ofdll := VirtualAllocEx(h_prozess, 0, length(mydll), MEM_COMMIT,PAGE_EXECUTE_READWRITE);
  writeprocessmemory(hProzess, p_ofdll, pchar(mydll), length(mydll), bw);
  try
    if createremotethread(h_prozess, nil, 0,
                          getprocaddress(getmodulehandle('kernel32.dll'),PAnsiChar('LoadLibraryA')),
                          p_ofdll, 0,h_remotet)  then
     //memo1.lines.add('success');
     waitforsingleobject(h_remotet, INFINITE);
  finally
   closehandle(h_prozess);
  end;
              ...

sirius 16. Mär 2009 13:30

Re: Delphi 2009 und dllinjection?
 
in write processmemory schreibst du "myDLL" als PChar rein. Aber du benutzt nachher die Funktion LoadLibraryA. Evtl. PAnisChar dort nehmen, oder LoadLiabraryW.

eglar85 16. Mär 2009 14:51

Re: Delphi 2009 und dllinjection?
 
Mydll ist ein string. Ich bin zZ nicht zuhause und kann das leider nicht testen aber das ist sehr vielversprechend ^^ Danke!
p.s. sollte es eigentlich

Delphi-Quellcode:
    if createremotethread(h_prozess, nil, 0,
                          getprocaddress(getmodulehandle('kernel32.dll'),PAnsiChar('LoadLibraryA')),
                          p_ofdll, 0,h_remotet) <> 0  then
heißen, k.a. wie sich so ein fehler einschleichen konnte.... naja schon mal vielen dank im Voraus. :D


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:26 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz