VirtualBox

Changeset 12394 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Sep 11, 2008 7:29:28 AM (16 years ago)
Author:
vboxsync
Message:

VBoxService: Fix for current interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxService/VBoxVMInfoNet.cpp

    r12393 r12394  
    1717int vboxVMInfoNet(VBOXINFORMATIONCONTEXT* a_pCtx)
    1818{
    19     DWORD dwCurIface = 0;
    20 
    2119    SOCKET sd = WSASocket(AF_INET, SOCK_DGRAM, 0, 0, 0, 0);
    2220    if (sd == SOCKET_ERROR)
     
    3937    char szTemp [_MAX_PATH+1] = {0};
    4038    int nNumInterfaces = nBytesReturned / sizeof(INTERFACE_INFO);
     39    int iCurIface = 0;
    4140
    4241    RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/Count");
    4342    vboxVMInfoWritePropInt(a_pCtx, szPropPath, (nNumInterfaces > 1 ? nNumInterfaces-1 : 0));
    44 
    45     dwCurIface = 0;
    4643
    4744    for (int i = 0; i < nNumInterfaces; ++i)
     
    5249        sockaddr_in *pAddress;
    5350        pAddress = (sockaddr_in *) & (InterfaceList[i].iiAddress);
    54         RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/%d/V4/IP", i);
     51        RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/%d/V4/IP", iCurIface);
    5552        vboxVMInfoWriteProp(a_pCtx, szPropPath, inet_ntoa(pAddress->sin_addr));
    5653
    5754        pAddress = (sockaddr_in *) & (InterfaceList[i].iiBroadcastAddress);
    58         RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/%d/V4/Broadcast", i);
     55        RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/%d/V4/Broadcast", iCurIface);
    5956        vboxVMInfoWriteProp(a_pCtx, szPropPath, inet_ntoa(pAddress->sin_addr));
    6057
    6158        pAddress = (sockaddr_in *) & (InterfaceList[i].iiNetmask);
    62         RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/%d/V4/Netmask", i);
     59        RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/%d/V4/Netmask", iCurIface);
    6360        vboxVMInfoWriteProp(a_pCtx, szPropPath, inet_ntoa(pAddress->sin_addr));
    6461
     
    6966            RTStrPrintf(szTemp, sizeof(szTemp), "Down");
    7067
    71         RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/%d/Status", i);
     68        RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestInfo/Net/%d/Status", iCurIface);
    7269        vboxVMInfoWriteProp(a_pCtx, szPropPath, szTemp);
     70
     71        iCurIface++;
    7372    }
    7473
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette