I have made the following function in Delphi 7. UDP_TABLE_OWNER_PID = 5;
{For UDP}
UDP_TABLE_OWNER_PID = 5;
type
UDP_TABLE_CLASS = Integer;
PMibUdpRowOwnerPid = ^TMibUdpRowOwnerPid;
TMibUdpRowOwnerPid = record//packed record
dwState : DWORD;
dwLocalAddr : DWORD;
//dwLocalPort : DWORD;
dwRemoteAddr: DWORD;
// dwRemotePort: DWORD;
dwOwningPid : DWORD;
end;
PMIB_UDPTABLE_OWNER_PID = ^MIB_UDPTABLE_OWNER_PID;
MIB_UDPTABLE_OWNER_PID =record// packed record
dwNumEntries: DWord;
table: array [0..ANY_SIZE - 1] OF TMibUdpRowOwnerPid;
end;
procedure TFmainViewTCP.ShowCurrentUDPConnections(StatusType:String);
var
Error : DWORD;
TableSize : DWORD;
i : integer;
IpAddress : in_addr;
RemoteIp : string;
LocalIp : string;
ver:Integer;
ProcName:string;
FExtendedUdpTable : PMIB_UDPTABLE_OWNER_PID;
lItem:TListItem; {for displaying the output}
countRow:Integer;
begin
i:=0;
TableSize := 0;
countRow:=0;
Error := GetExtendedUdpTable(nil, @TableSize, False,AF_INET,UDP_TABLE_OWNER_PID, 0);
if Error <> ERROR_INSUFFICIENT_BUFFER then
begin
if Error=ERROR_INVALID_PARAMETER then
begin
ShowMessage(IntToStr(Error));//Error code is 87, shown here
end;
Exit;
end;
The code gives error, i cannot figure out why. Help will be appreciated.
Thanks in advance