Hi people :)

I wanna do something like a server authentication..

So my app will check a config file with FtpOpenFile , and if the config says "1", the program executes as normal, if not, it will not do anything.

My question is how should i use FtpOpenFile?

I dont know what should i put in the first parameter, which says:

"hConnect

Handle to an FTP session."

i dont know how to get that handle  :sad:

could somebody assist me?

thanks in advance  ;)
Posted on 2010-04-14 21:06:07 by TrendyMMX
You DO realize that this is in no way a safe method of user authentication for thousands of reasons?

Not to mention that requiring an internet connection reminds me of those games that crash/exit to desktop if you lose the connection for a second.

As for your question: Please read about Enabling Internet Functionality.
Posted on 2010-04-15 00:00:00 by ti_mo_n
Hi

I think its very esay to change to InternetReadFile  8)
I have  for a long time coding a tool to read a config.ini from server via
1.InternetOpen
2.InternetOpenUrl
3.InternetReadFile
4.InternetCloseHandle

And i have check if in the config .ini on server a new version string ,If true download this programm



SendFileOnFTP proc
        invoke InternetOpen, addr AppName, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, NULL
        test eax, eax
        jz label_1                            ; Jumps to end of procedure if 'InternetOpen' failed
        mov hInternet, eax
                                                ; We try to open the FTP
        Invoke InternetConnect, hInternet, addr site_name, 21, addr user_name, addr password, INTERNET_SERVICE_FTP, NULL, NULL
        test eax, eax
        jz label_2                      ; Jumps if 'InternetConnect' failed
        mov hFTP, eax                                 

        invoke FtpOpenFile, hFTP, addr file_name, GENERIC_WRITE, INTERNET_FLAG_TRANSFER_BINARY, NULL
        test eax, eax               
        jz label_3                    ; Jumps if 'FtpOpenFile' failed
                                     
        mov hFile, eax               
        invoke InternetWriteFile, hFile, addr buffer_to_write, 30, addr nr_of_bytes_written
        invoke InternetCloseHandle, hFile
        label_3:
                invoke InternetCloseHandle, hFTP
        label_2:
                invoke InternetCloseHandle, hInternet
        label_1:
    ret
SendFileOnFTP endp


I hope it helps?
Posted on 2010-05-30 05:44:12 by ragdog