flat assembler
Message board for the users of flat assembler.

Index > Windows > Troubles with InternetConnect API

Author
Thread Post new topic Reply to topic
tester3000



Joined: 16 Feb 2007
Posts: 17
tester3000
Help me please in MASM such code work fine but in FASM I can't compile it Sad "Error: undefined symbol". How define INTERNET_SERVICE_FTP and FTP_TRANSFER_TYPE_BINARY ?

Code:
format PE GUI 4.0
entry start

include 'win32a.inc'

section '.data' data readable writeable

hInt dd 0
hCon dd 0

user_agent  db 'Microsoft Internet Explorer',0
server_name db 'ftp.narod.ru',0
user_name   db 'user',0
_pass       db 'password',0
local_file  db 'C:\file.txt',0
rem_file    db 'upfile.txt',0
_fail       db 'Could not connect to server',0

section '.code' code readable executable
   start:
         invoke InternetOpen,user_agent,0,0,0,0
         mov [hInt],eax
         invoke InternetConnect,eax,server_name,21,user_name,_pass,INTERNET_SERVICE_FTP,0,0
         test eax,eax
         jnz @f
         jmp _error

@@:
         mov [hCon],eax
         invoke FtpPutFile,[hCon],local_file,rem_file,FTP_TRANSFER_TYPE_BINARY,0
         invoke InternetCloseHandle,[hInt]
         invoke ExitProcess,0

_error:
        invoke MessageBox,0,_fail,0,MB_ICONERROR+MB_TOPMOST

section '.idata' import data readable

library kernel,'KERNEL32.DLL',\
        wininet,'WININET.DLL',\
        user32,'USER32.DLL'

import kernel,\
       ExitProcess,'ExitProcess'

import wininet,\
       InternetOpen,'InternetOpenA',\
       InternetConnect,'InternetConnectA',\
       FtpPutFile,'FtpPutFileA',\
       InternetCloseHandle,'InternetCloseHandle'

import user32,\
       MessageBox,'MessageBoxA'    
Post 03 Mar 2008, 10:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
tester3000 wrote:
How define INTERNET_SERVICE_FTP and FTP_TRANSFER_TYPE_BINARY ?
Put this near the top of your code.
Code:
INTERNET_SERVICE_FTP = 1
FTP_TRANSFER_TYPE_BINARY = 2    
You can find the values of the constants online, just google for them
Post 03 Mar 2008, 10:26
View user's profile Send private message Visit poster's website Reply with quote
tester3000



Joined: 16 Feb 2007
Posts: 17
tester3000
revolution thanks a lot
Post 03 Mar 2008, 10:39
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.