FtpOpenFile and InternetWriteFile broken/changed in IE11

Not reproducible Issue #1141401

Details

Created
Dec 1, 2014
Privacy
This issue is public.
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

URL:

Repro Steps:

filesize = fileinfo.st_size;

hConnection = (HINTERNET)InternetConnect(hISession,
    strFtpSite,  // Server
    portFTP,
    strFtpUser,     // Username
    strFtpPassword,     // Password
    INTERNET_SERVICE_FTP,
    INTERNET_FLAG_PASSIVE,
    0);    // No Context
if (hConnection == NULL)
{
    i = GetLastError();
    goto TestUploaderSendFileFull_Error;
}

.
.
.

dwBytesTotalWritten = 0;


hFTP = FtpOpenFile(hConnection, strFilenameP, GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY | INTERNET_FLAG_RELOAD, 0); 
if (hFTP == NULL)
{
    i = GetLastError();

    bytesInOut = 512;
    InternetGetLastResponseInfo(&inetErrCode, &strDebugMsg[0], &bytesInOut);
    MessageBox(hDlg, "Couldn't open internet file for writing", strFilenameP, MB_OK);
    ret = FALSE;
    goto TestUploaderSendFileFull_Error;
}
if ((f = fopen(strFilenameP, "rb")) == NULL)
{
    ret = FALSE;
    goto TestUploaderSendFileFull_Error;
}


while (*fCancelP == FALSE && !feof(f))
{
    dwBytesRead = fread(pData, 1, INTERNET_GULP_SIZE, f);
    if (dwBytesRead == 0)
        break;
    dwBytesWritten = 0;

    if (InternetWriteFile(hFTP, pData, dwBytesRead, &dwBytesWritten) == FALSE)
    {
        MessageBox(hDlg, "InternetWriteFile failed.", "Transfer interrupted", MB_OK);
        ret = FALSE;
        break;
    }
    else if (dwBytesRead != dwBytesWritten)
    {
        MessageBox(hDlg, "InternetWriteFile: incomplete write", "Warning", MB_OK);
    }

    dwBytesTotalWritten += dwBytesWritten;
    cSentCount += dwBytesRead;
}

if (dwBytesTotalWritten != filesize)
    ;
ret = TRUE;

goto TestUploaderSendFileFull_Exit;

TestUploaderSendFileFull_Error:
ret = FALSE;

TestUploaderSendFileFull_Exit :
if (f)
fclose(f);
if (hFTP)
if (!InternetCloseHandle(hFTP))
MessageBox(hDlg, "InternetCloseHandle(hFTP)", "UploaderSendFileAll", MB_OK);
if (hConnection)
if (!InternetCloseHandle(hConnection))
MessageBox(hDlg, "InternetCloseHandle(hConnection)", "UploaderSendFileAll", MB_OK);

Expected Results:

Problem #1: The file written to the server should contain the bytes successfully written by InternetWriteFile().

Problem #2: FtpOpenFile() should allow subsequent calls on the same session handle.

Actual Results:

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Tony S.”

      Changed Assigned To from “Tony S.” to “Venkat K.”

      Changed Assigned To to “Matthew C.”

      Changed Assigned To from “Matthew C.” to “Ziyan Z.”

      Changed Assigned To from “Ziyan Z.” to “IE F.”

      Changed Status to “Not reproducible”

    • Thanks Microsoft for breaking our application, again!!!

      April 21, 2016 - again Microsoft API fails after updates.

      Error using FTPOpenFile(…) - “425 can’t open data conenction”

      Windows 10, full updates including Explorer 11.

      We are now disabling the “Windows feature” for Explorer 11, and will check if this fixes the problema…

      … well, NO! that did not fix it, we get the same extended error 12003, then the message 425 can’t open data connection.

      Doing business with Microsoft is one large pain!!

      Microsoft support, are you on to this?

    • It’s Jan 2017. Will it be fixed by Windows 2020? Or is it FUBAR?
      *** Original thread Opened 11/11/2013 1:33:04 PM ***
      From

    You need to sign in to your Microsoft account to add a comment.

    Sign in