Estas pequeñas funciones sirven para subir y bajar archivos de texto por ftp, se usa la conexión directa y las funciones de la wininet ftpputfile y ftpgetfile para subir y bajar archivos...
para subir archivos:
UploadTextFile Proc Server:DWORD, User:DWORD, Pass:DWORD, LocalFileName:DWORD, RemoteFileName:DWORD
Local hInternet:DWORD
Local hFtp:DWORD
invoke InternetOpen, NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0
mov hInternet, eax
invoke InternetConnect, hInternet, Server, 21, User, Pass,\
INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0
mov hFtp, eax
invoke FtpPutFile, hFtp, LocalFileName, RemoteFileName, FTP_TRANSFER_TYPE_ASCII, 0
.if eax
print "File Successfully Uploaded !", 0Dh, 0Ah
.else
print "Error Uploading File, Use InternetGetLastResponseInfo For More Information", 0Dh, 0Ah
.endif
invoke InternetCloseHandle, hInternet
invoke InternetCloseHandle, hFtp
xor eax, eax
ret
UploadTextFile EndP
para bajar archivos:
DownloadTextFile Proc Server:DWORD, User:DWORD, Pass:DWORD, LocalFileName:DWORD, RemoteFileName:DWORD
Local hInternet:DWORD
Local hFtp:DWORD
invoke InternetOpen, NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0
mov hInternet, eax
invoke InternetConnect, hInternet, Server, INTERNET_DEFAULT_FTP_PORT, User, Pass,\
INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0
mov hFtp, eax
invoke FtpGetFile, hFtp, RemoteFileName, LocalFileName, TRUE, FILE_ATTRIBUTE_NORMAL,\
FTP_TRANSFER_TYPE_ASCII, 0
.if eax
print "File Downloaded Successfully !", 0Dh, 0Ah
.else
print "Error Downloading File, Use InternetGetLastResponseInfo For More Information", 0Dh, 0Ah
.endif
invoke InternetCloseHandle, hInternet
invoke InternetCloseHandle, hFtp
xor eax, eax
ret
DownloadTextFile EndP
En MASM hecho por pisznett
bytes ;)