ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

LPPROTOENT WSAAPI getprotobyname ( IN CONST CHAR FAR name)

Definition at line 274 of file getproto.c.

{
    PWSPROCESS Process;
    PWSTHREAD Thread;
    INT ErrorCode;
    PPROTOENT Protoent;
    PVOID GetProtoBuffer; 
    HANDLE DbHandle;
    DPRINT("getprotobyname: %s\n", name);

    /* Enter prolog */
    if ((ErrorCode = WsApiProlog(&Process, &Thread)) != ERROR_SUCCESS)
    {
        /* Leave now */
        SetLastError(ErrorCode);
        return NULL;
    }

    /* Get our buffer */
    GetProtoBuffer = WsThreadGetProtoBuffer(Thread);
    if (!GetProtoBuffer)
    {
        /* Fail */
        SetLastError(WSANO_DATA);
        return NULL;
    }

    /* Open the network database */
    DbHandle = GetProtoOpenNetworkDatabase("protocol");
    if (DbHandle == INVALID_HANDLE_VALUE)
    {
        /* Couldn't open the DB; fail */
        SetLastError(WSANO_DATA);
        return NULL;
    }

    /* Start the scan loop */
    while (TRUE)
    {
        /* Get a protoent entry */
        Protoent = GetProtoGetNextEnt(DbHandle, GetProtoBuffer);

        /* Break if we didn't get any new one */
        if (!Protoent) break;

        /* Break if we have a match */
        if (!_stricmp(Protoent->p_name, name)) break;
    }

    /* Close the network database */
    CloseHandle(DbHandle);

    /* Set error if we don't have a protoent */
    if (!Protoent) SetLastError(WSANO_DATA);

    /* Return it */
    return Protoent;
}

Generated on Sat May 26 2012 05:20:11 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.