flat assembler
Message board for the users of flat assembler.

Index > Windows > Problem File Pointer

Author
Thread Post new topic Reply to topic
janib4all



Joined: 26 Nov 2004
Posts: 5
Location: Asia
janib4all 05 Dec 2004, 18:07
hi! Its me again! with new problem.
i have some code for downloading web page or file from internet and it is working good.
except when i try to change internet file pointer, fasmw shows error,
here is my [not mine+except some] code try it and tell me , what im missing!


format PE GUI 4.0
entry start

include '%fasminc%/win32a.inc'

section '.data' data readable writeable

Agent db 'MiniWeb',0
URL db 'http://www.freewebs.com/janib4all',0
Header db 'Host: www.google.com',0

InternetHandle dd ?
FileHandle dd ?
BytesRead dd ?
FileSize dd ?
FileBuffer rb 09010h



section '.code' code readable executable

start:
invoke InternetOpen,Agent,0,0,0,0
test eax,eax
jz exit
mov [InternetHandle],eax

invoke InternetOpenUrl,eax,URL,0,0,0,0
test eax,eax
jz url_err
mov [FileHandle],eax
; invoke InternetSetFilePointer,[FileHandle],0,0,FILE_BEGIN,0 ; err
invoke InternetReadFile,eax,FileBuffer,09000h,BytesRead
; invoke InternetSetFilePointer,[FileHandle],0,0,FILE_END,0 ; err
; mov [FileSize],eax
test eax,eax
jz read_err
mov [BytesRead],eax
invoke MessageBox,0,FileBuffer,Agent,0
read_err:
invoke InternetCloseHandle,[FileHandle]
url_err:
invoke InternetCloseHandle,[InternetHandle]
exit:
invoke ExitProcess,0





section '.idata' import data readable writeable

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

import kernel32,\
ExitProcess,'ExitProcess'

import user32,\
MessageBox,'MessageBoxA'

import wininet,\
InternetOpen,'InternetOpenA',\
InternetReadFile,'InternetReadFile',\
InternetOpenUrl,'InternetOpenUrlA',\
InternetSetFilePointer','InternetSetFilePointer',\
InternetCloseHandle,'InternetCloseHandle'
Post 05 Dec 2004, 18:07
View user's profile Send private message Visit poster's website MSN Messenger 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.