func _FTP_Open($sAgent, $lAccessType = 1, $lFlags = 0, $sProxyName = '', $sProxyBypass = '')
local $Ret = DllCall($WININET_DLL, 'hwnd', 'InternetOpen', 'str', $sAgent, 'dword', $lAccessType, 'str', $sProxyName, 'str', $sProxyBypass, 'dword', $lFlags)
if (@error) or ($Ret[0] = 0) then
return SetError(1, _WinAPI_GetLastError(), 0)
endif
return SetError(0, 0, $Ret[0])
endfunc; _FTP_Open
func _FTP_Close($hFtp)
local $Ret = DllCall($WININET_DLL, 'int', 'InternetCloseHandle', 'hwnd', $hFtp)
if (@error) or ($Ret[0] = 0) then
return SetError(1, _WinAPI_GetLastError(), 0)
endif
return SetError(0, 0, 1)
endfunc; _FTP_Close
func _FTP_Connect($hFtp, $sServerName, $sUsername, $sPassword, $lServerPort = 0, $lFlags = 0x08000000, $lContext = 0)
local $Ret = DllCall($WININET_DLL, 'hwnd', 'InternetConnect', 'hwnd', $hFtp, 'str', $sServerName, 'int', $lServerPort, 'str', $sUsername, 'str', $sPassword, 'dword', 1, 'dword', $lFlags, 'dword', $lContext)
if (@error) or ($Ret[0] = 0) then
return SetError(1, _WinAPI_GetLastError(), 0)
endif
return SetError(0, 0, $Ret[0])
endfunc; _FTP_Connect
func _FTP_DeleteFile($hSession, $sFileName)
local $Ret = DllCall($WININET_DLL, 'int', 'FtpDeleteFile', 'hwnd', $hSession, 'str', $sFileName)
if (@error) or ($Ret[0] = 0) then
return SetError(1, _WinAPI_GetLastError(), 0)
endif
return SetError(0, 0, 1)
endfunc; _FTP_DeleteFile
func _FTP_GetFile($hSession, $sRemoteFile, $sLocalFile, $fFailIfExists = 0, $lAttributes = 0, $lFlags = 0, $lContext = 0)
local $Ret = DllCall($WININET_DLL, 'int', 'FtpGetFile', 'hwnd', $hSession, 'str', $sRemoteFile, 'str', $sLocalFile, 'int', $fFailIfExists, 'dword', $lAttributes, 'dword', $lFlags, 'dword', $lContext)
if (@error) or ($Ret[0] = 0) then
return SetError(1, _WinAPI_GetLastError(), 0)
endif
return SetError(0, 0, 1)
endfunc; _FTP_GetFile