1,183
社区成员
发帖
与我相关
我的任务
分享
procedure FunTest(c:char);
begin
showmessage(c);
end;
procedure TForm1.FunTestA(i:integer);
begin
showmessage(inttostr(i));
end;
procedure TForm1.FunTestC;
begin
showmessage('FunTestC');
end;
procedure FunTestD(pc:PChar);
begin
showmessage(pc);
end;
(1):
begin
asm
call FunTestC
end;
end;
(2):
var p:pointer;
begin
p:=@FunTestC;
asm
call p
end;
end;
(3):
begin
asm
mov eax,$41
call FunTest
end;
end;
(4):
begin
asm
mov eax,$41
call FunTestA
end;
end;
(5):
var p:pointer;
begin
p:=@FunTestA;
asm
mov eax,$41
call p
end;
end;
(6):
var p:pointer;
begin
p:=@FunTestD;
asm
mov eax,$41
call p
end;
end;
var
p:pointer;
pc:PChar;
begin
p:=@FunTestD;
pc:='Test'#0;
asm
push pc
mov eax,$41
call p
end;
end;
这个过程没错
var p:pointer;
pc:PChar;
begin
p:=@FunTestD;
pc:='Test'#0;
asm
push pc
mov eax,$41
call p
end;
end;//还是这句内存错误:Access violation at address 0040443F in module 'xxxx.exe'.Read of address 00000041.
var
p:pointer;
Str : PChar;
begin
Str := 'abc'#0;
p:=@FunTestD;
asm
push Str;
mov eax,$41
call p
end;
end;
var p:pointer;
begin
p:=@form1.FunTestA; //报错:Variable required
asm
mov eax,$41
call p
end;
end;
var p:pointer;
begin
p:=@TForm1.FunTestA;
asm
mov eax,$41
call p
end;
end; //显示的不是65,而是一个很大的数字
procedure FunTest(c:char);
begin
showmessage(c);
end;
procedure FunTestA(i:integer);
begin
showmessage(inttostr(i));
end;
procedure FunTestC;
begin
showmessage('FunTestC');
end;
procedure FunTestD(pc:PChar);
begin
showmessage(pc);
end;