Code:#include <stdio.h> #include <conio.h> #include <wchar.h> #include "packet32.h" #include "ntddndis.h" #define UNICODE // Helps Im told // Prototypes void DisplayPackets(LPPACKET lpPacket); char AdapterList[10][1024]; int main() { LPADAPTER lpAdapter = 0; LPPACKET lpPacket; int i = 0,n = 0;int Open; ULONG AdapterLength = 4096; DWORD dwErrorCode; WCHAR AdapterName[8192]; WCHAR *temp,*temp1; char buffer[512000]; struct bpf_stat stat; printf("Adapters installed On Your System Are As Follows:\n"); printf("\n-----------------------------------------------\n"); if(PacketGetAdapterNames(AdapterName,&AdapterLength)==FALSE) { printf("Unable to retrieve the list of the adapters!\n"); return -1; } temp=AdapterName; // Char Pointers temp1=AdapterName; // Char Pointers while ((*temp!='\0')||(*(temp-1)!='\0')) { if (*temp=='\0') { memcpy(AdapterList[i],temp1,(temp-temp1)*2); temp1=temp+1; i++; } temp++; } // End Of Politecnico di Torino Code //------------------------------------------- //Outputting Strings for (n=0; n < i;n++) { wprintf(L"\n%d- %s\n",n+1,AdapterList[n]); // wprintf translates any number of numeric values and prints // the results along with other characters, // uses a wide-character-format string } printf("\n");
Code tags added by Kermi3