Ueber diesen Umwege wuerde es gehen:
Delphi-Quellcode:
program Project1;
{$APPTYPE CONSOLE}
uses
windows;
procedure foo(i1,i2,i3 : Integer);
cdecl;
var
dwReturnAddress,dwParamCount : DWord;
begin
asm
push dword ptr [ebp + 4]
pop [dwReturnAddress]
end;
dwParamCount := pByte(dwReturnAddress + 2)^
div 4;
writeln(dwParamCount);
end;
begin
foo(1,2,3);
readln;
end.