1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 20:12:48 -05:00

The WinSock library is now loaded at run-time, which means we can

attempt to load WS2 and then fall back to WS1 if that fails. This
should allow us to use WS2-specific functionality to find out the
local system's list of IP addresses, thus fixing winnet-if2lo, while
degrading gracefully back to the previous behaviour if that
functionality is unavailable. (I haven't yet actually done this; I've
just laid the groundwork.)
This checkin _may_ cause instability; it seemed fine to me on
initial testing, but it's a bit of an upheaval and I wouldn't like
to make bets on it just yet.

[originally from svn r3502]
This commit is contained in:
Simon Tatham
2003-10-12 13:46:12 +00:00
parent 8e2fd15bd5
commit e30aed9a6f
21 changed files with 230 additions and 230 deletions

View File

@ -2,15 +2,6 @@
* winsftp.c: the Windows-specific parts of PSFTP and PSCP.
*/
#include <windows.h>
#ifndef AUTO_WINSOCK
#ifdef WINSOCK_TWO
#include <winsock2.h>
#else
#include <winsock.h>
#endif
#endif
#include "putty.h"
#include "psftp.h"
@ -480,25 +471,6 @@ char *do_select(SOCKET skt, int startup)
}
extern int select_result(WPARAM, LPARAM);
/*
* Initialize the WinSock driver.
*/
static void init_winsock(void)
{
WORD winsock_ver;
WSADATA wsadata;
winsock_ver = MAKEWORD(1, 1);
if (WSAStartup(winsock_ver, &wsadata)) {
fprintf(stderr, "Unable to initialise WinSock");
cleanup_exit(1);
}
if (LOBYTE(wsadata.wVersion) != 1 || HIBYTE(wsadata.wVersion) != 1) {
fprintf(stderr, "WinSock version is incompatible with 1.1");
cleanup_exit(1);
}
}
/*
* Wait for some network data and process it.
*/
@ -511,7 +483,7 @@ int ssh_sftp_loop_iteration(void)
FD_ZERO(&readfds);
FD_SET(sftp_ssh_socket, &readfds);
if (select(1, &readfds, NULL, NULL, NULL) < 0)
if (p_select(1, &readfds, NULL, NULL, NULL) < 0)
return -1; /* doom */
select_result((WPARAM) sftp_ssh_socket, (LPARAM) FD_READ);
@ -525,9 +497,7 @@ int main(int argc, char *argv[])
{
int ret;
init_winsock();
ret = psftp_main(argc, argv);
WSACleanup();
return ret;
}