INFO: Limitations of WinInet FTP Functions

Exención de responsabilidades de contenido KB retirado

Este artículo se refiere a productos para los que Microsoft ya no ofrece soporte técnico. Por tanto, el presente artículo se ofrece "tal cual" y no será actualizado.


There are some limitations to the WinInet FTP functions that developers should be aware of. Before deciding to rely on WinInet for an application's FTP functionality, a developer should verify that the APIs function as desired with all required FTP servers. This article will discuss the limitations of the WinInet FTP functions.

First, WinInet does not directly implement all of the functionality available through the FTP protocol. Most of the common activities such as uploading, downloading, renaming and deleting files, as well as enumerating directories is available through direct API calls. However there are a number of other FTP commands that are not implemented directly, such as ACCOUNT, QUOTE, APPEND, BLOCK and ALLOCATE. Beginning with Internet Explorer version 5.0 there is a new WinInet API available, FtpCommand, which allows you to functionally implement your own QUOTE command and send a specific command to the server. Previous versions of WinInet had no ability to send specific commands to the FTP server.

In addition, WinInet may have problems with some FTP servers. The FTP protocol is designed with the presumption that the output is viewed and viewed by a user, who can interpret the reply code and text. WinInet FTP attempts to parse and interpret the reply; if a server returns a nonstandard reply to the WinInet client, WinInet may not be able to function properly.

In addition, some servers may require a sequence of commands which is incompatible with WinInet. For instance some servers require an account command be entered immediately upon logging on. Although you could enter an ACCOUNT command using the FtpCommand function after you have already logged on, the FTP logon sequence implemented by WinInet is not flexible enough to enter an ACCOUNT command if required immediately by the server.

There are Microsoft Foundation Classes (MFC) that wrap the base WinInet functions. If any of the above problems are encountered in a non-MFC application, it is extremely likely that the problem will be inherited by the MFC WinInet classes; these classes don't provide a workaround to a problem inherent in the base API function. Conversely, if a problem is experienced using the MFC WinInet classes, in some instances it may be useful to try the base API calls for a possible workaround.

More Information

The following is a couple of instances where problems are known to occur. This list is not exhaustive, and developers may encounter additional limitations not listed here.

VMS FTP servers: WinInet FTP functions may not work with some FTP servers running on the VMS operating system. In particular, the FTP functions may fail with an error, or the data structure that returns file information may be blank or contain invalid data.

For additional information, please see the following article in the Microsoft Knowledge Base:
168492 PRB: FTP WinInet APIs Report Error 12003
This problem occurs when text returned by the FTP server is in a format that WinInet cannot parse correctly. You can work around this problem by using the FtpCommand function and sending a LIST command to the server. You could then either display the listing results in your application directly or parse the returned data yourself.

Firewalls: WinInet FTP APIs are designed to work with FTP Gateway, API functionality may be severely affected when CERN type proxy is used (FtpPutFile, FtpGetFile, etc. may not work correctly). Limited FTP functionality may be achieved over a CERN proxy with the
InternetOpenUrl function. Additional issues may also arise if proxy requires user name and password different then user name and password required by the destination FTP server.

For additional information on using FTP through a CERN proxy, please see the following articles in the Microsoft Knowledge Base:
166961 HOWTO: FTP with CERN-Based Proxy Using WinInet API
216214 SAMPLE: FTP with CERN-Based Password Protected Proxy

Id. de artículo: 172712 - Última revisión: 11/30/2012 - Revisión: 1