Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetIpNetTable
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00823885
Message ID:
00823914
Views:
25
>The IP of a local net would like to generate an archive text with all. As for example the out a of the command "net view" with the IP's. I am trying to use function "getipnettable", but not I am obtaining to see the result. It has some tip? It forgives English me.
>
>[],
>
>gilciel@yahoo.com

First, you need to corectly declare the DLL
DECLARE INTEGER GetIpNetTable IN IPHlpAPI.DLL;
  STRING @lpIPNetTable, INTEGER @pdwSize,;
  SHORT bOrder
Next, call it so that you can get the correct buffer size
liSize = 0
lcNetTable = SPACE(1)
llorder = 0
* Should return 122 - ERROR_INSUFFICIENT_BUFFER
? GetIpNetTable(@lcNetTable, @liSize, llorder)
lcNetTable = SPACE(liSize)
Next you need to understand the structure being passed
typedef struct _MIB_IPNETTABLE {  DWORD dwNumEntries;
  MIB_IPNETROW table[ANY_SIZE];
} MIB_IPNETTABLE, *PMIB_IPNETTABLE;
The above means there's a 4 byte integer indicating the number of entries.

The MIB_IPNETROW is also a structure, which has the following format.
typedef struct _MIB_IPNETROW {  DWORD dwIndex; 
DWORD dwPhysAddrLen;  BYTE bPhysAddr[MAXLEN_PHYSADDR];
 DWORD dwAddr;  DWORD dwType;
} MIB_IPNETROW, *PMIB_IPNETROW;
The first 4 byte integer is index of the adapter. The next 4 bytes are the length of the byte array that follows. Immediately following those bytes is the actual IP address, followed by the type.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform