Hey I did not notice, its you!!! cuz I read your Italian presentation
nearly every hour or call to the functions. Hey thanks again, saved lots
of hair. I was about to reinvent the cycly when i came accross your lib.
great. thanks again.( will try to convert the thanks to .....)
The problem was not there. the problem in GetNetInfoEx. i mimic the
calls and found the same wrong result.
The following are the result of dry run:
Lets look for "SISNIC"
First call for the key SYSTEM\\CurrentControlSet\\Services\\class\\net
IIndex=0 != "SISNIC"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0000]
....
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0000\NDIS]
"MajorNdisVersion"=hex:04
"MinorNdisVersion"=hex:00
"LogDriverName"="*PNP0510"
IIndex=1 != "SISNIC"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0001]
....
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0001\NDIS]
"MajorNdisVersion"=hex:03
"MinorNdisVersion"=hex:0a
"LogDriverName"="NIC1394"
IIndex=2 != "SISNIC"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0002]
....
IIndex=2 != "SISNIC"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0002\NDIS]
"LogDriverName"="PPPMAC"
"MajorNdisVersion"=hex:03
"MinorNdisVersion"=hex:0a
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0003]
....
IIndex=3 != "SISNIC"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0003\NDIS]
"LogDriverName"="pptp"
"MajorNdisVersion"="03"
"MinorNdisVersion"="0A"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\\0004\NDIS]
"LogDriverName"="SISNIC"
"MajorNdisVersion"=hex:03
"MinorNdisVersion"=hex:0a
IIndex=4 Heyyyyyy this one so the index is 4
now let look at [HKEY_LOCAL_MACHINE\Enum\Network\MSTCP]
[HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0000]
"Class"="NetTrans"
"Driver"="NetTrans\\0001"
"MasterCopy"="Enum\\Network\\MSTCP\\0000"
"DeviceDesc"="TCP/IP"
"CompatibleIDs"="MSTCP"
"Mfg"="Microsoft"
"ClassGUID"="{4d36e975-e325-11ce-bfc1-08002be10318}"
"ConfigFlags"=hex:10,00,00,00
"Capabilities"=hex:14,00,00,00
[HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0000\Bindings]
"VREDIR\\0000"=""
[HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001]
"Class"="NetTrans"
"Driver"="NetTrans\\0002"
"MasterCopy"="Enum\\Network\\MSTCP\\0001"
"DeviceDesc"="TCP/IP"
"CompatibleIDs"="MSTCP"
"Mfg"="Microsoft"
"ClassGUID"="{4d36e975-e325-11ce-bfc1-08002be10318}"
"ConfigFlags"=hex:10,00,00,00
"Capabilities"=hex:14,00,00,00
[HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001\Bindings]
"VREDIR\\0001"=""
[HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0002]
"Class"="NetTrans"
"ClassGUID"="{4d36e975-e325-11ce-bfc1-08002be10318}"
"Driver"="NetTrans\\0004"
"MasterCopy"="Enum\\Network\\MSTCP\\0002"
"DeviceDesc"="TCP/IP"
"CompatibleIDs"="MSTCP"
"Mfg"="Microsoft"
"ConfigFlags"=hex:10,00,00,00
"Capabilities"=hex:14,00,00,00
[HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0002\Bindings]
"VREDIR\\0002"=""
oops IINDEX 4 not up there so GetNetInfoEx returns FALSE
so i made the changes for now for my ongoing project ( hey wanna know
for waat?)
this is the change I made for now in my WINME+autoupdate feature ( dont
know what Microsoft updates automatically , did not check the
logs)enabled box.
//begining of w30a3->jhn
WORD wVersionRequested;
WSADATA wsaData;
struct hostent* h;
char szBuff[80];
LPIN_ADDR p;
if(gethostname(szBuff, 79))
{ wVersionRequested = MAKEWORD( 1, 1);
if(WSAStartup( wVersionRequested, &wsaData )!=0) return FALSE;
}
h=gethostbyname(szBuff);
p=(LPIN_ADDR)h->h_addr_list[0];
strncpy(String,inet_ntoa(*p),16);//ipv4 only
StringPos = 0;
BufLen = sizeof String;
for(naddrs = 0;naddrs < *NEntries;naddrs++){
TmpAddr = (struct sockaddr_in *) &(buffer[naddrs].IPAddress);
if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!=
-1){
TmpAddr->sin_family = AF_INET;
TmpBroad = (struct sockaddr_in *) &(buffer[naddrs].Broadcast);
TmpBroad->sin_family = AF_INET;
// Don't know where to find the broadcast adrr under Win9x,
default to
255.255.255.255
TmpBroad->sin_addr.S_un.S_addr = 0x00ffffff & p->S_un.S_addr;
TmpBroad->sin_addr.S_un.S_addr |=0xff000000;
while(*(String + StringPos) != '\0' && *(String + StringPos)
!=
',')StringPos++;
StringPos++;
if(*(String + StringPos) == 0 || StringPos >= BufLen)
break;
}
else break;
}
BufLen = sizeof String;
// Open the key with the addresses
// scan the key to obtain the masks
strcpy(String,"255.255.255.0");
StringPos = 0;
for(nmasks = 0;nmasks <* NEntries;nmasks++){
TmpAddr = (struct sockaddr_in *) &(buffer[nmasks].SubnetMask);
if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!=
-1){
TmpAddr->sin_family = AF_INET;
while(*(String + StringPos) != '\0' && *(String + StringPos)
!=
',')StringPos++;
StringPos++;
if(*(String + StringPos) == 0 || StringPos >= BufLen)
break;
}
else break;
}
*NEntries = 1;
return TRUE;
//end of w30a3->jhn
// Reach the class\net registry key
status=RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\class\\net",0,KEY_READ,&InterfaceKey);
if (status != ERROR_SUCCESS) return FALSE;
..............
Now ok. its not solution of course. its just enables running properly in
win me, for me.
I was talking about the SNMP and INETMIB1.DLL. its in the windows core sdk.
Aftab Jahan Subedar
Software Engineer/Overseas Business Development Manager
Suvastu Software Ltd.
Suvastu Tower
69/1 Pathapath Green Road
Dhaka 1205
Bangladesh
sms:++447765341890
Loris Degioanni wrote:
> Hi,
>
>
>
>>hi all,
>>
>>cuz the add_or_find_if could not open does not mean failure.
>>
>>izzit better this way in the follwoing function ?
>>
>>
>>
>>static int
>>pcap_add_if_win32(pcap_if_t **devlist, char *name, const char *desc,
>> char *errbuf)
>>{
>>pcap_if_t *curdev;
>>npf_if_addr if_addrs[16];
>>LONG if_addr_size;
>>int res = 0;
>>struct sockaddr_in *addr, *netmask;
>>
>>if_addr_size = 16;
>>
>>/*
>>* Add an entry for this interfacwe, with no addresses.
>>*/
>>/*
>>if (add_or_find_if(&curdev, devlist, (char *)name, 0, (char *)desc,
>> errbuf) == -1) {
>>
>>wcap30a3 -> jhn
>>*/
>>curdev=NULL;
>>if (add_or_find_if(&curdev, devlist, (char *)name, 0, (char *)desc,
>> errbuf) == -1 ) {
>>/*
>>* Failure.
>>*/
>>/*
>>return (-1);
>>wcap30a3 -> jhn
>>*/
>>if(curdev==NULL)
>> return (0); //did not add but error!! see add_or_find_if
>>else
>>return (-1);
>>}
>>
>
> Yes, you are rigth, but consider that all the interfaces received by
> pcap_add_if_win32() can be opened. The reason is that the list of adapters
> is obtained in pcap_findalldevs() by means of the PacketGetAdapterNames()
> packet.dll function. This function returns only the adapters that it's
> actually able to open.
> Therefore, the check that you propose should not be necessary, because the
> call to pcap_open_live() inside add_or_find_if() will always succeed.
>
> However, does this patch solve your problem?
>
>
>>Izzit asso something wrong with PacketGetNetInfoEx/should use mib?
>>manually checked the registry , it does not map, or enum does not
>>contain desired index. ( removed the NICs and reinstalled-> Nada)
>>
>
> What do you mean by 'mib'?
>
> Loris
>
>
>>Aftab Jahan Subedar
>>Software Engineer/Overseas Business Development Manager
>>Suvastu Software
>>Suvastu Tower
>>69/1 Pathapath Green Road
>>Dhaka 1205
>>Bangladesh
>>
>>
>>
>>
>>==================================================================
>> This is the WinPcap users list. It is archived at
>> http://www.mail-archive.com/[email protected]/
>>
>> To unsubscribe use
>> mailto: [EMAIL PROTECTED]?body=unsubscribe
>>==================================================================
>>
>>
>
>
>
> ==================================================================
> This is the WinPcap users list. It is archived at
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe use
> mailto: [EMAIL PROTECTED]?body=unsubscribe
> ==================================================================
>
>
>
==================================================================
This is the WinPcap users list. It is archived at
http://www.mail-archive.com/[email protected]/
To unsubscribe use
mailto: [EMAIL PROTECTED]?body=unsubscribe
==================================================================