![]() |
AW: Exportierte Funktion aus Exe mit GetProcAddress
Liste der Anhänge anzeigen (Anzahl: 1)
Hier mal ein kleiner Test
eigentlich müsste 2 mal eine messagebox kommen. Schau es Dir mal im Debugger an..... |
AW: Exportierte Funktion aus Exe mit GetProcAddress
Habs hinbekommen.
Auch wenn das in der Windows Unit auf den ersten Blick so aussieht:
Delphi-Quellcode:
GetProcAddress gibt es (original) nicht im WideString-Format:
// Winapi.Windows
function GetProcAddress(hModule: HMODULE; lpProcName: LPCSTR): FARPROC; stdcall; overload; function GetProcAddress(hModule: HMODULE; lpProcName: LPCWSTR): FARPROC; stdcall; overload;
Delphi-Quellcode:
Musste also meine eigene Definition von PChar auf PAnsiChar ändern und jetzt klappt es.
// Winapi.Windows
function GetProcAddress(hModule: HMODULE; lpProcName: LPCSTR): FARPROC; external kernel32 name 'GetProcAddress'; function GetProcAddress(hModule: HMODULE; lpProcName: LPCWSTR): FARPROC; begin if ULONG_PTR(lpProcName) shr 16 = 0 then // IS_INTRESOURCE Result := GetProcAddress(hModule, LPCSTR(lpProcName)) else Result := GetProcAddress(hModule, LPCSTR(TMarshal.AsAnsi(lpProcName))); end; |
AW: Exportierte Funktion aus Exe mit GetProcAddress
Du solltest darauf achten, dass eine .reloc Section für deine .exe generiert wird, sonst bekommst du Probleme, wenn Adresse 00400000 schon belegt ist.
|
AW: Exportierte Funktion aus Exe mit GetProcAddress
Wieso? Ich gehe doch nicht hartkodiert auf $400000.
GetModuleHandle(nil) sollte mir doch die Basisadresse der exe liefern egal wo sie liegt oder nicht? |
AW: Exportierte Funktion aus Exe mit GetProcAddress
Achso nevermind, du lädst die .exe ja gar nicht selbst. Passt schon :P
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:18 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