Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi DLl-Injection HWND der Hostapplikation herausfinden (https://www.delphipraxis.net/157766-dll-injection-hwnd-der-hostapplikation-herausfinden.html)

DeddyH 24. Jan 2011 15:07

AW: DLl-Injection HWND der Hostapplikation herausfinden
 
Bist Du denn auch sicher, dass es sich um die ProzessID handelt und nicht etwa um das Prozesshandle oder die ThreadID?

Assarbad 24. Jan 2011 15:10

AW: DLl-Injection HWND der Hostapplikation herausfinden
 
Zitat:

Zitat von DeddyH (Beitrag 1076912)
Bist Du denn auch sicher, dass es sich um die ProzessID handelt und nicht etwa um das Prozesshandle oder die ThreadID?

Aaaah :lol: ... oder vielleicht um ein Pseudo-Handle? Siehe MSDN-Library durchsuchenGetCurrentProcess.

Memnarch 24. Jan 2011 15:16

AW: DLl-Injection HWND der Hostapplikation herausfinden
 
Ne is kein Pseudo Handle^^
Nutze GetCurrentProcessID <-

Fragt mihc nicht was ich geändert habe. Es geht o.O.
Wollte die Resultate der enum funktion nur inne liste speichern, seitdem gehst, auch wenn ich da slogging wieder rausnehme :?::!:.

EDIT: oder auch nicht. Ich bekomme zwar nen (gültigen) handle, aber z.B. WM_CLOSE geht nicht o.O

MFG
Memnarch

Aphton 24. Jan 2011 16:39

AW: DLl-Injection HWND der Hostapplikation herausfinden
 
Probier Folgendes

Delphi-Quellcode:
function GetMainWindowHandle(): DWord;
var
  V: TPoint; // X = PID, Y = Result
  function GetRootWindow(hWnd: DWord): DWord;
  begin
    repeat        
      Result := hWnd;
      hWnd := GetParent( Result );
    until hWnd = 0;
  end;
  function WinEnumProc(hWnd: DWord; lParam: Integer): LongBool; stdcall;
  var
    PID: DWord;
  begin
    Result := True;
    GetWindowThreadProcessId( hWnd, PID );
    if PID = PPoint(lParam)^.X then
    begin
        PPoint(lParam)^.Y := GetRootWindow( hWnd );
        Result := False;
    end;
  end;
begin
  try
    V := Point( GetCurrentProcessId(), INVALID_HANDLE_VALUE );
    EnumWindows( @WinEnumProc, Integer(@V) );
    Result := V.Y;
  except
    Result := INVALID_HANDLE_VALUE;
  end;
end;
Sry für den verwirrenden Code, habs schnell dahingetippt.. Dürfte aber funktionieren!

Memnarch 24. Jan 2011 19:39

AW: DLl-Injection HWND der Hostapplikation herausfinden
 
Vielen dank, werde ich mir mal angucken :)


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:13 Uhr.
Seite 2 von 2     12   

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