×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Value to pass for INTERNET_FLAG_PASSIVE

Value to pass for INTERNET_FLAG_PASSIVE

Value to pass for INTERNET_FLAG_PASSIVE

(OP)
The following is partial code I downloaded from www.davesummers.net/foxprolinks.htm.

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

RE: Value to pass for INTERNET_FLAG_PASSIVE

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close