unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TVirtualAllocEx =
function(hProcess: THandle; lpAddress: Pointer;
dwSize, flAllocationType: DWORD; flProtect: DWORD): Pointer;
stdcall;
TForm3 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
VirtualAllocEx2: TVirtualAllocEx;
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
var
DllHandle: THandle;
begin
DllHandle := LoadLibrary('
kernel32.dll');
if DllHandle<>0
then
try
VirtualAllocEx2 := GetProcAddress(DllHandle, '
VirtualAllocEx');
if Assigned(VirtualAllocEx2)
then
begin
Showmessage('
Hallo');
// benutzen
end
finally
FreeLibrary(DllHandle);
end;
end;
end.