Class CInterfaces::
GetInterfaces()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: GetFlagsNext page: GetMask    Show member index
Public Function Declared in:
Interfaces.h

'Declaration' icon -- Shortcut to top of page. Declaration

BOOL GetInterfaces();

'Description' icon -- Shortcut to top of page. Description

Retreive the list of all the interfaces

'Function Body' icon -- Shortcut to top of page. Function Body

if (!m_iMaxInterfaces)
{
    //structure not allocated
    ReportError("GetInterfaces","You constructed the class with 0 parameter!");

    //Exit
    return FALSE;
}

try
{
    //Allocate a socket
    SOCKET aSocket;
    aSocket=socket(AF_INET,SOCK_DGRAM,0);

    //Check it's valid
    if (aSocket==INVALID_SOCKET)
    {
        //Report it
        SetLastError("GetInterfaces");

        //Exit
        return FALSE;
    }

    //Get the interface list
    unsigned long ulBytes;
    if (WSAIoctl(aSocket,
                 SIO_GET_INTERFACE_LIST,
                 NULL,
                 NULL,
                 m_pInfo,
                 sizeof(INTERFACE_INFO)*m_iMaxInterfaces,
                 &ulBytes,
                 NULL,
                 NULL))
    {
        //Damn error
        SetLastError("GetInterfaces");

        //Close the socket
        closesocket(aSocket);

        //Exit
        return FALSE;
    }

    //Check how many structures we have
    m_iStructures=ulBytes/sizeof(INTERFACE_INFO);

    //Set our position to zero
    m_iPosition=0;

    //Close the socket
    closesocket(aSocket);

    //Done
    return TRUE;
}
ERROR_HANDLER_RETURN("GetInterfaces",FALSE)

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CSpoofBase  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.