WININET.DLL FtpCommand Issues (1 Viewer)

omnialive

Registered User.
Local time
Yesterday, 21:57
Joined
Sep 17, 2010
Messages
23
SOLVED: WININET.DLL FtpCommand Issues

All,

I have a working class and set of functions that I use to send and receive files to an FTP server with no problem. Currently, I am trying to add the functionality to issue a "SITE" command to the FTP server so I can change the umask of the files that I put so that they have the appropriate read and write perms.

So far, my code is failing. I believe it might be in my lack of understanding of VB in general and using the WinInet.DLL API specifically. Here is my public declaration of the FtpCommand function to access the API:

Code:
Public Declare Function FtpCommand Lib "Wininet.DLL" Alias "FtpCommandA" _
(ByVal hFtpSession As Long, ByVal fExpectedReponse As Boolean, _
ByVal dwFlags As Long, ByVal lpszCommand As String, _
ByVal dwContext As Long, ByVal phFtpCommand As Long) As Boolean

Here is the definition of the FtpCommand WinInet.DLL function from Microsoft MSDN:

Code:
BOOL FtpCommand(
  __in   HINTERNET hConnect,
  __in   BOOL fExpectResponse,
  __in   DWORD dwFlags,
  __in   LPCTSTR lpszCommand,
  __in   DWORD_PTR dwContext,
  __out  HINTERNET *phFtpCommand
);

Here is the line of code that calls the FtpCommand function to try and issue the umask command:

Code:
blRet = FtpCommand(m_hConn, False, lFlags, "SITE umask 000" & vbLf, 0, m_hConnIn)

My variable, blRet, is false when the command returns. When I look to see what Err.LastDllError, it is "0". I know that the variables "m_hConn" and "lFlags" are fine. I am not sure of the "m_hConnIn" variable as it is just a Long variable type that doesn't hold anything as I am putting False for the fExpectResponse value (this is based from an example I saw).

As far as the "vbLf" is concerned, I've tried it with/without it, with a vbNull there instead...all to the same result.

I would really hate to scrap my WinInet.DLL implementation as it is working perfectly for sending and receiving files via FTP, but if that turns out to be what I have to do to make it work, so be it!

Your thoughts and experience are very welcome on this subject!
 
Last edited:

omnialive

Registered User.
Local time
Yesterday, 21:57
Joined
Sep 17, 2010
Messages
23
The problem was that the "umask" SITE command was not supported by my FTP daemon. I did read and found out that the "chmod" SITE command could be enabled and once I did that, everything worked fine with using the "SITE chmod" to change the file perms. My FTPD is vsFTPD which works well enough for my purposes.
 

Users who are viewing this thread

Top Bottom