Skip to content

Instantly share code, notes, and snippets.

@ice799
Created August 11, 2011 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ice799/1138698 to your computer and use it in GitHub Desktop.
Save ice799/1138698 to your computer and use it in GitHub Desktop.
the future you were waiting for
// Make an initial call to GetIfTable to get the
// necessary size into dwSize
dwSize = sizeof (MIB_IFTABLE);
if (GetIfTable(pIfTable, &dwSize, FALSE) == ERROR_INSUFFICIENT_BUFFER) {
FREE(pIfTable);
pIfTable = (MIB_IFTABLE *) MALLOC(dwSize);
if (pIfTable == NULL) {
printf("Error allocating memory needed to call GetIfTable\n");
return 1;
}
}
// Make a second call to GetIfTable to get the actual
// data we want.
if ((dwRetVal = GetIfTable(pIfTable, &dwSize, FALSE)) == NO_ERROR) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment