I have a strange problem with ftp download.
Here is my code, I removed error messages UI for clarity.
Code:
BOOL bSuccess, bFileOK = FALSE;
int lastErr = 0;
char tmpStr[256];
HINTERNET hIntSession = NULL, hFtpSession = NULL, hFind = NULL;
WIN32_FIND_DATA findData;
hIntSession = InternetOpen ("Mozilla/4.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0/*INTERNET_FLAG_ASYNC*/);
if (hIntSession) {
hFtpSession = InternetConnect (hIntSession,
ftpServerName,
INTERNET_DEFAULT_FTP_PORT,
ftpUserName, ftpPassword,
INTERNET_SERVICE_FTP, 0, 0);
if (hFtpSession) {
bSuccess = FtpSetCurrentDirectory (hFtpSession, remoteDirStr);
if (bSuccess) {
hFind = FtpFindFirstFile (hFtpSession, "*", &findData, 0, 0);
if (hFind) {
Well, here it fails. InternetOpen() returns a valid session, InternetConnect() is ok, FtpSetCurrentDirectory() returns success, but FtpFindFirstFile() fails.
If I connect with some ftp client software I can see files. It even doesn't work if I try to connect to my second computer and try to see something.
Can anyone see a problem in my code? Application where I try to insert this functionality is not Unicode, it's an old project I need to support, so maybe that is somehow relevant.