Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value to pass for INTERNET_FLAG_PASSIVE

Status
Not open for further replies.

culleoka

Programmer
May 16, 2002
85
0
0
US
The following is partial code I downloaded from
DECLARE INTEGER InternetOpen IN wininet;
STRING sAgent, INTEGER lAccessType, STRING sProxyName,;
STRING sProxyBypass, STRING lFlags

DECLARE INTEGER InternetConnect IN wininet.DLL;
INTEGER hInternetSession,;
STRING lcHost,;
INTEGER nServerPort,;
STRING lcUser,;
STRING lcPassword,;
INTEGER lService,;
INTEGER lFlags,;
INTEGER lContext

sProxyName = CHR(0) &&... no proxy
sProxyBypass = CHR(0) &&... nothing to bypass
lFlags = 0 &&... no flags used

hOpen = InternetOpen (sAgent, 1,;
sProxyName, sProxyBypass, lFlags)

hftpSession = InternetConnect (hOpen, lcHost,;
0, lcUser, lcPwd, 1, 0, 0) &&... 1 = ftp protocol

I have run the code, and it connects to our FTP server fine.
But then I get the error 'Unable to download selected file.'

My question is:

1. What value should be passed to the InterConnect() function to set the INTERNET_FLAG_PASSIVE Flag?
FTP downloads on this particular server must be in Passive mode, not Active. All Microsoft lists for a value in it's API Flags constants is 0x08000000 for the constant value. Isn't this a hex value? I think this is the value I need as Integer.

Thanks in advance for any help, and thanks to Dave Summers for the code to get me to a starting point.

Pat McGreevy
 
Thanks again to Dave Summers for a utility on his site which has the formula to convert hex to integer. The value to be passed to InternetConnect for Passive mode is 134217728. Worked like a charm! So the command should be:

hftpSession = InternetConnect (hOpen, lcHost, 0, lcUser, lcPwd, 1,134217728, 0).

Hope this helps anyone with the same security problem I had.

Pat McGreevy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top