Issue refers to the situation when we run the program on Windows 10 v1803 from a mapped network resource shared on Windows XP or Linux (SMB1).
Since the release of Windows 10 v1803, some commands related to network sockets have stopped working. In general, the application has prohibited access to the Internet.
On some hb_ functions of the sockets written in C, the program crashes and on others it reports the error code 22 - EINVAL - an invalid argument.
I tried various options: "Run as Administrator", "Run in compatibility mode", I added a mapped network resource as a trusted Intranet. I turned off the Firewall on the host and client computers, unfortunately unsuccessfully.
Issue does not occur when you run the program from a local disk on Windows 10 v1803 or from a shared network resource on another Windows 10, Server 2008, etc.
Below is a short code that checks Internet connection using various methods.
The first two methods return no Internet connection, and the third crash.
Code: Select all
#include "hmg.ch"
FUNCTION Main()
Local isInet
Msgbox('Method 1')
isInet := InternetCheckConnection( "https://www.google.com" )
msginfo("Internet " + If ( isInet, "available", "NOT available!" ))
MsgBox('Method 2')
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa384346(v=vs.85).aspx
isInet := If(HMG_CallDLL("Wininet.dll", 0, "InternetCheckConnection", "https://www.google.com", 1 /*FLAG_ICC_FORCE_CONNECTION*/, 0) == 1, .T., .F.)
msginfo("Internet " + If ( isInet, "available", "NOT available!" ))
MsgBox('Method 3')
isInet := isInternet()
msginfo("Internet " + If ( isInet, "available", "NOT available!" ))
RETURN
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTION isInternet( nTimeOut )
Local aAddr:=hb_socketResolveINetAddr( "www.google.com" , 80 )
Local socket:=hb_socketOpen()
Local lIsNet
Default nTimeOut:=2000
MsgDebug(socket, aAddr, nTimeOut)
lIsNet:=!EMPTY( aAddr ) .AND. hb_socketConnect( socket , aAddr, nTimeOut )
hb_socketClose( socket )
RETURN lIsNet
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
#include <wininet.h>
#define FLAG_ICC_FORCE_CONNECTION 0x00000001
HB_FUNC( INTERNETCHECKCONNECTION )
{
const char * cUrl = hb_parc( 1 );
hb_retl( (HB_BOOL) InternetCheckConnection( cUrl, FLAG_ICC_FORCE_CONNECTION, 0 ) );
}
#pragma ENDDUMP