1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include "stdafx.h"
#include "global.h"
/* Connexion au serveur FTP */
boolean ConnexionFTP( char *Serveur, char *Login, char *MotDePasse, DWORD Port )
{
PConnexionInternet = InternetOpen(L"J-FTP", INTERNET_OPEN_TYPE_DIRECT,/* NULL, NULL*/0,0, 0 );
if ( PConnexionInternet == NULL ) <-- OK ICI, ne rentre pas
{
return FALSE;
ExitProcess(1);
}
PConnexionFTP = InternetConnect( PConnexionInternet, (LPCWSTR)Serveur, (INTERNET_PORT)Port, (LPCWSTR)Login, (LPCWSTR)MotDePasse, INTERNET_SERVICE_FTP, 0, 0 );
if ( PConnexionFTP == NULL ) <-- Rentre dedans, donc problème
{
InternetCloseHandle( PConnexionInternet );
return FALSE;
ExitProcess(1);
}
return TRUE;
}
boolean changeRepertoire(char* newrep)
{
return FtpSetCurrentDirectory(PConnexionFTP,L"ankamagam");
}
/* Detruit les pointeurs de connection */
void Deconnexion()
{
InternetCloseHandle( PConnexionInternet );
InternetCloseHandle( PConnexionFTP );
}
/* DownLoad Fichier */
boolean DownLoadFile( char *FichierSurFTP, char *FichierACreer )
{
return FtpGetFile( PConnexionFTP, (LPCWSTR)FichierSurFTP, (LPCWSTR)FichierACreer, FALSE, 0, FTP_TRANSFER_TYPE_BINARY, 0 );
}
/* Upload Fichier */
void UpLoadFile( char *FichierLocal, char *FichierFTP )
{
FtpPutFile( PConnexionFTP, (LPCWSTR)FichierLocal, (LPCWSTR)FichierFTP, FTP_TRANSFER_TYPE_BINARY, 0 );
} |
Partager