Home | Info | Community | Development | myReactOS | Contact Us
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; }