Setting ForwardMetric Values (Windows Embedded CE 6.0)
1/6/2010
When you are going to use one of the IP helper functions to set a parameter, first use the corresponding Get function to retrieve the data structure. Then change only the part you want to change, and pass the structure into the Set function. This example sets ForwardMetric1 to 0 for all of the entries in the forward table.
PMIB_IPFORWARDTABLE pbuffer = NULL;
DWORD result = 0,
dwStatus = 0;
ULONG size = 0;
BOOL bfound = FALSE,
bOrder = 0;
dwStatus = GetIpForwardTable(pbuffer, &size, bOrder);
if (dwStatus == ERROR_BUFFER_OVERFLOW) {
if (!(pbuffer = (PMIB_IPFORWARDTABLE) malloc(size))) {
exit(1);
}
dwStatus = GetIpForwardTable(pbuffer, &size, bOrder);
}
if (dwStatus != NO_ERROR) {
exit(1);
}
for (unsigned long int k = 0; k < pbuffer->dwNumEntries; k++) {
pbuffer->table[k].dwForwardMetric1 = 0;
dwStatus = SetIpForwardEntry(&(pbuffer->table[k]));
if (result != NO_ERROR)
exit(1);
}
Note
For further details, refer to the ipconfig or route code located in the public folder \WinCE\Public\Common\Oak\Drivers\Netsamp.