Sign in to follow this  
Followers 0
martin

InternetGetLastResponseInfo when GetLastError returns ERROR_INTERNET_EXTENDED_ERROR

4 posts in this topic

If an FTP function fails, say FTPCommand, then I see what the last error is, and if it is ERROR_INTERNET_EXTENDED_ERROR (=12003) then I should be able to get the information on the error using

something like this

$LenErrMsg = stringlen($ErrMsg)

$res = DllCall('wininet','int','InternetGetLastResponseInfo','int_ptr',$Errnum,'str',$ErrMsg,'int_ptr',$LenErrMsg)

which doesn't work. It returns no error and doesn't change the $Errnum or $ErrMsg variables.

Does anyone know how to use InternetGetLastResponseInfo?

The info on InternetGetLastResponseInfo is here

http://msdn2.microsoft.com/en-us/library/aa384172.aspx


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites



The wininet.dll is not loaded into AutoIt at all times. You must open this DLL yourself and keep it open for the duration of your usage session. Otherwise, each function will load the DLL, do something if it can and then unload it again. This DLL keeps internal state data. When the DLL is unloaded, this data is lost.

Share this post


Link to post
Share on other sites

The wininet.dll is not loaded into AutoIt at all times. You must open this DLL yourself and keep it open for the duration of your usage session. Otherwise, each function will load the DLL, do something if it can and then unload it again. This DLL keeps internal state data. When the DLL is unloaded, this data is lost.

Yes, thanks Valik. I should have mentioned that I have already done this in my script like this

Func onautoitstart()

$hDll = DllOpen("Wininet.dll") ;have to do this for the ftp routines to work

if $hDll = -1 then

msgbox(0,'Error','Could not open WIninet.dll')

exit

EndIf

EndFunc

Func onAutoitExit()

if $connected then _FTPClose($Open)

if $hDll <> 0 then DllClose($hDll)

EndFunc

Since the script is a special FTP client this seemed like e reasonable approach to me.

All the other FTP functions I use work OK. I can copy filesand directories from the server, I can move files and directories on the server, but if I try to delete a directory I will get an error if the directory is not empty. By checking the error I intend to recursively empty the contents of the directory if needed and then delete it. The problem is I can't get the information on the error using InternetGetLastResponseInfo. So I imagine I am doing the wrong thing with the call to wininet.dll. Am I correct in using 'str' for a pointer to a string?

DllCall('wininet','int','InternetGetLastResponseInfo','int_ptr',$Errnum,'str',$ErrMsg,'int_ptr',$LenErrMsg)


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Bumped to try again


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0