I haven't done it myself, but you should be able to do something like (sorry, it's in C, but you ought to be able to see what's happening)
[tt]
DWORD cb = 0;
PROTOCOL_INFO *pPI;
BOOL pfLanas[100];
int nLanas = sizeof(pfLanas)/sizeof(BOOL);
int iRC;
// Determine output buffer size
iRC = EnumProtocols(NULL, NULL, &cb);
if (!cb)
return; // No adapters in system, or error
// Allocate a buffer
pPI = (PROTOCOL_INFO*) calloc(1, cb);
// Enumerate all protocols.
iRes = EnumProtocols( NULL, pPI, &cb );
// EnumProtocols() lists each lana number twice, once for
// SOCK_DGRAM and once for SOCK_SEQPACKET. Set a flag in
// pfLanas so unique lanas can be identified.
memset(pfLanas, 0, sizeof(pfLanas));
while (iRC > 0) {
// Scan protocols looking for AF_INET (TCP, IP).
if (pPI[--iRC].iAddressFamily == AF_INET)
// found one
pfLanas[abs(pPI[iRC].iProtocol)] = TRUE;
}
}
free(pPI);
[/tt]
Hope this helps.