WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

12003 ERROR_INTERNET_EXTENDED_ERROR

 Keywords: 12003 Error iFtpPut Keep Alive

Question:

I'm switching from a 2003 FTP server to a 2012 R2 ftp server, using Winbatch 2014A and wwint44i.dll. The iFTPPut code seems to work sometimes perfectly, and other times, not at all. The iGetLastError is showing in my log as error 12003, and sometimes Error 0. Yet other times, submitting the exact same files and code works perfectly with no changes.

I was originally thinking it might have something to do with Explorer on the Server locking the file since I was in the same folder when uploading watching it. But upon backing out of the folder and explorer, it got a little further on a couple of files, but then started failing again.I also checked the FTP user file permissions on the server folder, and it has Full Control.

Any ideas?

Answer:

We have had various reports with WinInet returning 12003 for various WinInet Functions. It appears there may have been some changes to the systems WinInet.dll. Currently the Wininet.dll on Windows 8 and on Windows 7 systems with IE11 installed seem to cause this behavior in previously successful scripts. This issue has been reported to Microsoft ( by many users) and is actively being investigated. I recommend keeping your eye on this bug report: https://connect.microsoft.com/IE/feedback/details/808279/ftpopenfile-and-internetwritefile-broken-changed-in-ie11

See also:
https://www.google.com/#q=ftpputfile+Microsoft+12003+IE11
http://stackoverflow.com/questions/19683291/wininet-from-ie-11-randomly-returns-error-12003-for-most-ftp-functions
http://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=898

Possible Workarounds:


Question:

I am using the Wininet internet extender. I am getting a 12003 return from iftpput. Here is the code:
==============================================================

:ftpsend
lit = "Opening ftp session..."
BoxDrawText(wbid,"25,350,1000,1000",lit,1,0)
TopHandle=iBegin(0,"","")
ConHandle=iHostConnect(TopHandle,pdx,@FTPPASSIVE,UserId,Pswd)
if ConHandle==0
  Message("FTP Open Error",strcat("Error starting ftp session ",hSession,@crlf,"Contact Support Central"))
  exit
else
  lit = "Connected"
  BoxDrawText(wbid,"500,350,1000,1000",lit,1,0)
endif

iftpdirmake(conhandle,"/usr/pdx/pcfiles/%pcnum%")
iFtpDirChange(conhandle,"/usr/pdx/pcfiles/%pcnum%")

DirChange("C:\zipfiles")

lit = "Sending DOCS files..."
BoxDrawText(wbid,"25,450,1000,1000",lit,1,0)
if FileExist("rxdocs.zip")
  rs = iftpPut(conhandle,"c:\zipfiles\rxdocs.zip","/usr/pdx/pcfiles/%pcnum%/rxdocs.zip",0,@binary)
  err=iGetLastError()
  errmsg = igetresponse()
  if rs != "" 
    lit = strcat("Error copying DOCS - ",err," ",errmsg)
    BoxDrawText(wbid,"500,450,1000,1000",lit,1,0)
  else
    lit = "Complete"
    BoxDrawText(wbid,"500,450,1000,1000",lit,1,0)
  endif
else
  lit = "No DOCS files to send..."
  BoxDrawText(wbid,"500,450,1000,1000",lit,1,0)
endif
  
===================================================================

Here is the trace output that corresponds with the code:

===================================================================

lit = "Opening ftp session..."
(36903) VALUE=> "Opening ftp session..."

BoxDrawText(wbid,"25,350,1000,1000",lit,1,0)
(38265) VALUE=> 1

TopHandle=iBegin(0,"","")
(40408) VALUE=> 13369348

ConHandle=iHostConnect(TopHandle,pdx,@FTPPASSIVE,UserId,Pswd)
(57242) VALUE=> 13369352

if ConHandle==0
(66645) ELSE DO==>TRUE

lit = "Connected"
(66645) VALUE=> "Connected"

BoxDrawText(wbid,"500,350,1000,1000",lit,1,0)
(67366) VALUE=> 1

endif
(67987) END OPERATOR

iftpdirmake(conhandle,"/usr/pdx/pcfiles/3")
(68618) VALUE=> 0

iFtpDirChange(conhandle,"/usr/pdx/pcfiles/3")
(69189) VALUE=> 1

DirChange("C:\zipfiles")
(71563) VALUE=> 1

lit = "Sending DOCS files..."
(72644) VALUE=> "Sending DOCS files..."

BoxDrawText(wbid,"25,450,1000,1000",lit,1,0)
(90850) VALUE=> 1

if FileExist("rxdocs.zip")
(91591) IF DO==>TRUE

rs = iftpPut(conhandle,"c:\zipfiles\rxdocs.zip","/usr/pdx/pcfiles/3/rxdocs.zip",0,@binary)
(99433) VALUE=> 0

err=iGetLastError()
(104089) VALUE=> 12003

errmsg = igetresponse()
(105702) VALUE=> "0: 250 CWD command successful.
200 Type set to I.
"

if rs != ""
(161552) IF DO==>TRUE

lit = strcat("Error copying DOCS - ",err," ",errmsg)
(162003) VALUE=> "Error copying DOCS - 12003 0: 250 CWD command successful.
200 Type set to I.
"

BoxDrawText(wbid,"500,450,1000,1000",lit,1,0)
(162453) VALUE=> 1

else
(196873) END OPERATOR

else
(199216) END OPERATOR

lit = "Sending WinFax files..."
(199216) VALUE=> "Sending WinFax files..."

BoxDrawText(wbid,"25,550,1000,1000",lit,1,0)
(200648) VALUE=> 1

if FileExist("rxwfx.zip")
(201810) ELSE DO==>TRUE

lit = "No WinFax files to send..."
(201810) VALUE=> "No WinFax files to send..."

BoxDrawText(wbid,"500,550,1000,1000",lit,1,0)
(202280) VALUE=> 1

endif
(203162) END OPERATOR

lit = "Closing ftp session..."
(203682) VALUE=> "Closing ftp session..."

BoxDrawText(wbid,"25,650,1000,1000",lit,1,0)
(204143) VALUE=> 1

iClose(conhandle)
(205425) VALUE=> 1

iClose(tophandle)
(205996) VALUE=> 1

lit = "Closed"
(207568) VALUE=> "Closed"

BoxDrawText(wbid,"500,650,1000,1000",lit,1,0)
(209651) VALUE=> 1

return
(211664) RETURN VALUE=> 0

==============================================================

What the heck is going on? The responses don't seem to relate to the iftpPut. It's almost like the response is one or two commands behind the command being executed. HELP!!!!!!!!

Answer:

You may want to look at the MS article :

Article ID: Q168492


SYMPTOMS
Connection to a non-Microsoft FTP server with WinInet FTP APIs may fail with error 12003.

CAUSE
When connecting to a non-Microsoft FTP server with WinInet APIs, some WinInet FTP APIs may fail with error 12003 (ERROR_INTERNET_EXTENDED_ERROR). The InternetGetLastResponseInfo API may not retrieve any Internet specific information. This error may occur when the FTP server sends an unexpected status code to the WinInet client. Please note that this may not indicate an error, but rather the server's success message or confirmation (such as confirmation of getting a file, sending a directory listing, and so forth). In some cases the WinInet FTP APIs may not parse such messages correctly and erroneously report an error. This may happen when the WinInet FTP APIs are used to connect to certain VAX/VMS FTP servers.

RESOLUTION
The above behavior may be avoided by not using the INTERNET_FLAG_PASSIVE flag in the InternetConnect or InternetOpenUrl API. When this flag is not used WinInet uses active semantics for the FTP connection, which avoids the return of the status code, which causes the parsing problem.

MORE:

Question:

We just finished upgrading a system from NT to Win2k server. I have a script that uses iftpput that worked fine under NT, but with win2k it is now returning a 12003 error. I referenced to ms knowledgebase article q168492. The article implied that if I change from ftppassive to ftp during the host connect, my problem would go away. Tried changing to ftp and still have the same error.

Any ideas?

Thanks in advance.

Answer:

12003 ERROR_INTERNET_EXTENDED_ERROR
An extended error was returned from the server. This is typically a string or buffer containing a verbose error message.
Call iGetResponse just after the iFtpPut to retrieve the error text. Then display the iGetReponse info. If not obvious, then let us know what it says, and post a section of your script, or better yet write a short test script that demonstrates the problem so we can also run it here.

User Reply:

After your note, I dug a little deeper and discovered that the ftp had broken because the destination machine was no longer mapping to the same directory. My issue was caused by an iFtpPut to a nonexistant directory. Thanks for your help. Hopefully just knowing a 12003 can be caused by nonexistant directories will help the next programmer.
Article ID:   W14800
File Created: 2017:07:28:13:58:44
Last Updated: 2014:06:20:12:49:54