Bruno Jesus <00cp...@gmail.com> writes: > + items = WSAEnumProtocolsW(NULL, NULL, &listsize); > + if (items == SOCKET_ERROR && WSAGetLastError() == WSAENOBUFS && > + (buffer = HeapAlloc(GetProcessHeap(), 0, listsize))) > + { > + items = WSAEnumProtocolsW(NULL, buffer, &listsize); > + for (i = 0; i < items; i++) > + { > + if (buffer[i].iAddressFamily == info.a->iAddressFamily && > + buffer[i].iSocketType == info.a->iSocketType && > + buffer[i].iProtocol == info.a->iProtocol) > + { > + if (unicode) > + memcpy(info.w, &buffer[i], sz); > + else > + { > + /* convert the structure from W to A */ > + memcpy(info.a, &buffer[i], > FIELD_OFFSET(WSAPROTOCOL_INFOA, szProtocol)); > + WideCharToMultiByte(CP_ACP, 0, buffer[i].szProtocol, -1, > + info.a->szProtocol, > WSAPROTOCOL_LEN+1, NULL, NULL); > + } > + break; > + } > + } > + }
There's no reason to enumerate the protocols since you already know the one you want. -- Alexandre Julliard julli...@winehq.org