Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: Executing a FTP-command through WinInet/Win32?

0 views
Skip to first unread message

M. S. Mortensen

unread,
Jun 13, 1999, 3:00:00 AM6/13/99
to
On the subject of using FTP from within a Windows-program,

-I am using MFC to communicate with a FTP-server. I can do the exact same
thing by addressing WinInet directly.

The FTP-server, which I address, has special capabilities; I need to execute
a FTP-command, which –as seen from the regular FTP-command-line
client-program- is a command like ”quote xxx”. This puts the server in a
special state, which I need for uploading and downloading files correctly.

Now, how do I do this? I actually found documentation for a call within
WinInet with a description like this:

INTERNETAPI BOOL WINAPI FtpCommand(HINTERNET hFtpConnect,
BOOL fExpectResponse,
DWORD dwFlags,
LPCTSTR lpszCommand,
DWORD dwContext);

As part of the description, it actually says:

LpszCommand
A string holding an FTP command. For example, "PWD \r\n".

Great! –I can just put my ”quote ...” command in there!?
No, the downside is – the documentation says Windows CE 2.0+. Argh! I need
*exactly* this, but for Windows 9x/NT.

I looked into my VC++ 6.0 into Wininet.h – it does not have the FtpCommand
call. However, I have an older Wininet.h residing on one of my disks (I
guess it is a leftover from my VC++ 5.0 installation...!?), and this *does*
contain the FtpCommand call, it seems... Hmm?

Can anyone help me on this? Is there a call like FtpCommand, which I can
used to execute the command in a simple way? Or am I forced to grab the
TCP/IP socket directly and construct the byte sequence for executing the
command? In the later case, have you got any idea on how to do this?

Help greatly appreciated!

Morten Sabroe Mortensen, Denmark.
Yels...@get2net.dk
Yels...@hotmail.com

Roy Kiesler [TeamSybase]

unread,
Jun 13, 1999, 3:00:00 AM6/13/99
to
FtpCommand is supported under Win32 -- you have to have IE5 installed to get
the latest WinInet DLL (version 5.00.xxxx)

--
Roy Kiesler [TeamSybase]

M. S. Mortensen <Yels...@get2net.dk> wrote in message
news:5WA83.374$ya5...@news.get2net.dk...


> On the subject of using FTP from within a Windows-program,
>
> -I am using MFC to communicate with a FTP-server. I can do the exact same
> thing by addressing WinInet directly.
>
> The FTP-server, which I address, has special capabilities; I need to
execute

> a FTP-command, which -as seen from the regular FTP-command-line


> client-program- is a command like "quote xxx". This puts the server in a
> special state, which I need for uploading and downloading files correctly.
>
> Now, how do I do this? I actually found documentation for a call within
> WinInet with a description like this:
>
> INTERNETAPI BOOL WINAPI FtpCommand(HINTERNET hFtpConnect,
> BOOL fExpectResponse,
> DWORD dwFlags,
> LPCTSTR lpszCommand,
> DWORD dwContext);
>
> As part of the description, it actually says:
>
> LpszCommand
> A string holding an FTP command. For example, "PWD \r\n".
>

> Great! -I can just put my "quote ..." command in there!?
> No, the downside is - the documentation says Windows CE 2.0+. Argh! I need


> *exactly* this, but for Windows 9x/NT.
>

> I looked into my VC++ 6.0 into Wininet.h - it does not have the FtpCommand

martin...@my-deja.com

unread,
Jun 15, 1999, 3:00:00 AM6/15/99
to
I am trying the same thing using FTP to do some things via Visual Basic
to a IBM-mainframe. Ihave found the exact layout at a webpage from
microsoft namely:
http://msdn.microsoft.com/workshop/networking/wininet/reference/function
s/FtpCommand.asp

Using this layout I could use the PWD command as you found in your
documentation, but alas when I tried the "quote site pquan=100" (to set
the primary allocation quantity on the mainframe) I got a command
unknown. When using this command directly on a mainframe to mainframe
FTP-session, this works just fine. Maybe someone else can shine a light
on this.

I hope any of this helps.

Kind regards,
Martin van der Vorst

In article <5WA83.374$ya5...@news.get2net.dk>,


"M. S. Mortensen" <Yels...@get2net.dk> wrote:
> On the subject of using FTP from within a Windows-program,
>
> -I am using MFC to communicate with a FTP-server. I can do the exact
same
> thing by addressing WinInet directly.
>
> The FTP-server, which I address, has special capabilities; I need to
execute

> a FTP-command, which –as seen from the regular FTP-command-line


> client-program- is a command like ”quote xxx”. This puts the server
in a
> special state, which I need for uploading and downloading files
correctly.
>
> Now, how do I do this? I actually found documentation for a call
within
> WinInet with a description like this:
>
> INTERNETAPI BOOL WINAPI FtpCommand(HINTERNET hFtpConnect,
> BOOL fExpectResponse,
> DWORD dwFlags,
> LPCTSTR lpszCommand,
> DWORD dwContext);
>
> As part of the description, it actually says:
>
> LpszCommand
> A string holding an FTP command. For example, "PWD \r\n".
>

> Great! –I can just put my ”quote ...” command in there!?
> No, the downside is – the documentation says Windows CE 2.0+. Argh! I


need
> *exactly* this, but for Windows 9x/NT.
>

> I looked into my VC++ 6.0 into Wininet.h – it does not have the


FtpCommand
> call. However, I have an older Wininet.h residing on one of my disks
(I
> guess it is a leftover from my VC++ 5.0 installation...!?), and this
*does*
> contain the FtpCommand call, it seems... Hmm?
>
> Can anyone help me on this? Is there a call like FtpCommand, which I
can
> used to execute the command in a simple way? Or am I forced to grab
the
> TCP/IP socket directly and construct the byte sequence for executing
the
> command? In the later case, have you got any idea on how to do this?
>
> Help greatly appreciated!
>
> Morten Sabroe Mortensen, Denmark.
> Yels...@get2net.dk
> Yels...@hotmail.com
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

M. S. Mortensen

unread,
Jun 27, 1999, 3:00:00 AM6/27/99
to

Actually, I have now made the thing work; I can now execute my "quote xxx"
command!

It is a bit tricky, though. Without a updated wininet.h and wininet.lib, I
hack'et the call by GetProcAddress'ing and type-casting to the
function-pointer to match the description. I had a number of problems, but
at last, when I inspected the result of GetLastResponseInfo, it came up with
a variant of "'QUOTE xxx' command unknown"-text. I did NOT write the command
in uppercase - *someone* does some interpretation on this! This lead me to
try "quote quote xxx" by manual FTP. The server responded with the same
text - Aha! So with just the "xxx" as the command, the FTP-server received
the "quote xxx".

I have not tried with e.g. "pwd" as command - but I am kind of believing,
that it is not possible to use such a non-quote command, as the CE version
of the FtpCommand shows as an example... Hmmm?

Anyway, I got it to work!


Now for a new question:
My code is to run within an organisation, where it is absolutely out of the
question to upgrade to IE5. Among other things, it is politics.
==> Can I update the Wininet.dll manually??? <==

Looking at Wininet.dll, it may depend of up to seven other dll's (seven on a
NT4 system; on a Win95 system, there are two dll's less). From guessing, I
would expect that at least shlwapi.dll also has to be updated.

Can anyone tell, if it is possible to manually update the wininet.dll
*including* all dependencies - both on NT4 and Win95 systems?? I hope -but
would no be surprised if not- that I can update dll's without updating other
parts of the system...!

Does anyone have insight into this???

Regards,
Morten S. Mortensen.


<martin...@my-deja.com> wrote in message
news:7k5lfc$mg8$1...@nnrp1.deja.com...


> I am trying the same thing using FTP to do some things via Visual Basic
> to a IBM-mainframe. Ihave found the exact layout at a webpage from
> microsoft namely:
> http://msdn.microsoft.com/workshop/networking/wininet/reference/function
> s/FtpCommand.asp
>
> Using this layout I could use the PWD command as you found in your
> documentation, but alas when I tried the "quote site pquan=100" (to set
> the primary allocation quantity on the mainframe) I got a command
> unknown. When using this command directly on a mainframe to mainframe
> FTP-session, this works just fine. Maybe someone else can shine a light
> on this.
>
> I hope any of this helps.
>
> Kind regards,
> Martin van der Vorst
>
> In article <5WA83.374$ya5...@news.get2net.dk>,
> "M. S. Mortensen" <Yels...@get2net.dk> wrote:
> > On the subject of using FTP from within a Windows-program,
> >
> > -I am using MFC to communicate with a FTP-server. I can do the exact
> same
> > thing by addressing WinInet directly.
> >
> > The FTP-server, which I address, has special capabilities; I need to
> execute

> > a FTP-command, which -as seen from the regular FTP-command-line


> > client-program- is a command like "quote xxx". This puts the server
> in a
> > special state, which I need for uploading and downloading files
> correctly.
> >
> > Now, how do I do this? I actually found documentation for a call
> within
> > WinInet with a description like this:
> >
> > INTERNETAPI BOOL WINAPI FtpCommand(HINTERNET hFtpConnect,
> > BOOL fExpectResponse,
> > DWORD dwFlags,
> > LPCTSTR lpszCommand,
> > DWORD dwContext);
> >
> > As part of the description, it actually says:
> >
> > LpszCommand
> > A string holding an FTP command. For example, "PWD \r\n".
> >

> > Great! -I can just put my "quote ..." command in there!?
> > No, the downside is - the documentation says Windows CE 2.0+. Argh! I


> need
> > *exactly* this, but for Windows 9x/NT.
> >

> > I looked into my VC++ 6.0 into Wininet.h - it does not have the

0 new messages