У меня ХР2 build 2600 socket 2.2 В структуре WSADATA есть поле char FAR* lpVendorInfo по мсдн оно нужно для обратной совместимости с Socket 1.1 После инициализации WSAStartup это поле инициализируется у меня не NULL!!! , a бад указателем(на недоступную память). Это так и должно быть? или это только в моём билде?
wsd Можно быстро проверить Код (Text): #define STRICT #define _WIN32_WINNT 0x0500 #include <winsock2.h> #include <windows.h> #include <stdio.h> struct wsainit { WSADATA wsa; explicit wsainit(WORD version) { WSAStartup(version, &wsa); __try { printf((wsa.lpVendorInfo != NULL ? "%p - %02X\n" : "%p"), wsa.lpVendorInfo, *(BYTE*)wsa.lpVendorInfo); } __except (1) { printf("except\n"); } } ~wsainit() { WSACleanup(); } }; int main() { wsainit _10(MAKEWORD(1, 0)); wsainit _11(MAKEWORD(1, 1)); wsainit _20(MAKEWORD(2, 0)); wsainit _22(MAKEWORD(2, 2)); } /* [EOF] */ WinXP SP2 Eng + hotfixes
wsd А что тебя интересует? Что оно не работает для 1.1? Или то, что не инициализируется нулём в 2.0+? По второму всё просто: Код (Text): Sockeye.c: // BUGBUG ignored for 2.0+ ShowStr (" ", pWSAData->lpVendorInfo); Startup.cpp: // The following line is commented-out due to annoying and totally // nasty alignment problems in WINSOCK[2].H. The exact location of // the lpVendorInfo field of the WSAData structure is dependent on // the structure alignment used when compiling the source. Since we // cannot change the structure alignment of existing apps, the best // way to handle this mess is to just not set this value. This turns // out to not be too bad a solution, as neither the WinNT nor the Win95 // WinSock implementations set this value, and nobody appears to pay // any attention to it anyway. // // lpWSAData->lpVendorInfo = NULL; И только в wow32 оно инициализируется нулём. censored Для чистоты эксперимента надо было бы чуть по-другому написать: Код (Text): printf("%p - ", wsa.lpVendorInfo); if(wsa.lpVendorInfo) printf("%02X\n", *(BYTE*)wsa.lpVendorInfo);
IceStudent супер только M$ надо это в мсдн было запихнуть, а то опять люди подумали что их сильно подглючило...