wininet: Create a TCP connection if FLAG_ICC_FORCE_CONNECTION is specified.
This commit is contained in:
parent
a3331c6f22
commit
ba45902daf
|
@ -2739,6 +2739,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
|
||||||
CHAR *command = NULL;
|
CHAR *command = NULL;
|
||||||
WCHAR hostW[1024];
|
WCHAR hostW[1024];
|
||||||
DWORD len;
|
DWORD len;
|
||||||
|
INTERNET_PORT port;
|
||||||
int status = -1;
|
int status = -1;
|
||||||
|
|
||||||
FIXME("\n");
|
FIXME("\n");
|
||||||
|
@ -2770,26 +2771,46 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
|
||||||
goto End;
|
goto End;
|
||||||
|
|
||||||
TRACE("host name : %s\n",debugstr_w(components.lpszHostName));
|
TRACE("host name : %s\n",debugstr_w(components.lpszHostName));
|
||||||
|
port = components.nPort;
|
||||||
|
TRACE("port: %d\n", port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (dwFlags & FLAG_ICC_FORCE_CONNECTION)
|
||||||
* Build our ping command
|
{
|
||||||
*/
|
struct sockaddr_in sin;
|
||||||
len = WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, NULL, 0, NULL, NULL);
|
int fd;
|
||||||
command = HeapAlloc( GetProcessHeap(), 0, strlen(ping)+len+strlen(redirect) );
|
|
||||||
strcpy(command,ping);
|
|
||||||
WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, command+strlen(ping), len, NULL, NULL);
|
|
||||||
strcat(command,redirect);
|
|
||||||
|
|
||||||
TRACE("Ping command is : %s\n",command);
|
if (!GetAddress(hostW, port, &sin))
|
||||||
|
goto End;
|
||||||
|
fd = socket(sin.sin_family, SOCK_STREAM, 0);
|
||||||
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) == 0)
|
||||||
|
rc = TRUE;
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Build our ping command
|
||||||
|
*/
|
||||||
|
len = WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, NULL, 0, NULL, NULL);
|
||||||
|
command = HeapAlloc( GetProcessHeap(), 0, strlen(ping)+len+strlen(redirect) );
|
||||||
|
strcpy(command,ping);
|
||||||
|
WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, command+strlen(ping), len, NULL, NULL);
|
||||||
|
strcat(command,redirect);
|
||||||
|
|
||||||
status = system(command);
|
TRACE("Ping command is : %s\n",command);
|
||||||
|
|
||||||
TRACE("Ping returned a code of %i\n",status);
|
status = system(command);
|
||||||
|
|
||||||
/* Ping return code of 0 indicates success */
|
TRACE("Ping returned a code of %i\n",status);
|
||||||
if (status == 0)
|
|
||||||
rc = TRUE;
|
/* Ping return code of 0 indicates success */
|
||||||
|
if (status == 0)
|
||||||
|
rc = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
End:
|
End:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue