SCAR Code:
program DLLFunctionViewer;
{$Define GetFunctions}
{$Define GetTypes}
{$IfDef GetFunctions}
function GetFunctionCount: Integer; external 'GetFunctionCount@WizzyPlugin.dll stdcall';
function GetFunctionInfo(x: Integer; var ProcAddr: LongInt; var ProcDef: string): Integer; external 'GetFunctionInfo@WizzyPlugin.dll stdcall';
{$EndIf}
{$IfDef GetTypes}
function GetTypeCount: Integer; external 'GetTypeCount@WizzyPlugin.dll stdcall';
function GetTypeInfo(x: Integer; var sType, sTypeDef: string): Integer; external 'GetTypeInfo@WizzyPlugin.dll stdcall';
{$EndIf}
var
Count, Counter, i: Integer;
ProcAddr: LongInt;
ProcDef, Temp: string;
sType, sTypeDef: String;
begin
{$IfDef GetFunctions}
Count := GetFunctionCount;
SetLength(Temp, 255);
WriteLn('Functions (Count: ' + IntToStr(Count) + ')');
for Counter := 0 to Count - 1 do
begin
for i := 1 to 255 do
Temp[i] := #0;
GetFunctionInfo(Counter, ProcAddr, Temp); // Problem: Variables never contain any values...
ProcDef := '';
for i := 1 to 255 do
if (Temp[i] = #0) then
begin
ProcDef := Copy(Temp, 1, i - 1);
Break;
end;
WriteLn('-> ' + ProcDef);
end;
{$EndIf}
{$IfDef GetTypes}
Count := GetTypeCount;
WriteLn('Types (Count: ' + IntToStr(Count) + ')');
for Counter := 0 to Count - 1 do
begin
GetTypeInfo(Counter, sType, sTypeDef);
WriteLn('-> ' + sType + ': ' + sTypeDef);
end;
{$EndIf}
end.
I replaced Pointer with LongInt and PChar with a string (with preset length).