cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
luckyluke
Level 2

GetTcpTable InstallScript

Hello Everybody,

i tried to get the iphlpapi.getTcpTable Function to work, but it didn't work.
I dont know how to get the table. Maybe somebody can help?
Here's my code:



// Included header files ----------------------------------------------------
#include "ifx.h"
#define HEAP_ZERO_MEMORY 0x00000008

prototype number Iphlpapi.GetTcpTable(POINTER, POINTER, BOOL);
prototype Kernel32.HeapAlloc(NUMBER, NUMBER, NUMBER);
prototype Kernel32.GetProcessHeap();


typedef MIB_TCPROW
begin
int dwState;
int dwLocalAddr;
int dwLocalPort;
int dwRemotAddr;
int dwRemotePort;
end;

typedef MIB_TCPTABLE
begin
INT dwNumEntries;
MIB_TCPROW POINTER table();
end;



//TestFunction
function OnFirstUIBefore()
number iCount, error, pdwSize, entries, test;
string str, str1;
MIB_TCPTABLE POINTER pTcpTable;
MIB_TCPROW POINTER pTcpRow;

begin

error = 0;
error = GetTcpTable(pTcpTable, &pdwSize, TRUE);

pTcpTable = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pdwSize);


error = 0;
error = GetTcpTable(pTcpTable, &pdwSize, TRUE);

if (error == 0) then
entries = pTcpTable->dwNumEntries;
NumToStr(str, entries);
MessageBox("dwNumEntries: " + str, INFORMATION);
for iCount = 0 to (pTcpTable->dwNumEntries -1)
pTcpRow = pTcpTable->table(iCount);
test= pTcpRow->dwState;

//&TcpRow = TcpTable->table(iCount);
//test = TcpRow.dwState;
//test = TcpRow->dwState;
NumToStr(str, test);
MessageBox("State: " + str, INFORMATION);
endfor;
else
MessageBox("kein Fehler!", INFORMATION);
endif;

abort;

end;
Labels (1)
0 Kudos
(1) Reply
luckyluke
Level 2

... knows...?
0 Kudos