Here?s a piece that will get you automagically the last beta version of FASM:
And here?s the zip file:
;
; Modifyed from a snippet by Ates
;
format PE GUI 4.0
include 'include\kernel.inc'
include 'include\user.inc'
include 'include\macro\stdcall.inc'
include 'include\macro\import.inc'
invoke MessageBox,0,msg1,cap1,MB_ICONQUESTION+MB_YESNO
cmp eax,IDYES
jne exit
call GetInetFile
cmp eax, TRUE
jne Err
Ok: invoke MessageBox,0,msgOk,msgCap,MB_OK
jmp exit
;FASM will optimize this ;)
Err: invoke MessageBox,0,msgErr,msgCap,MB_OK
exit: invoke ExitProcess,0
GetInetFile:
invoke GetModuleHandle,0
invoke GetModuleFileName,eax,fileName,127
invoke InternetOpen,fileName,0,0,0,0
mov [hSession],eax
cmp eax,INVALID_HANDLE_VALUE
je .exit
invoke InternetOpenUrl,[hSession],fileUrl,0,0,0,0
mov [hUrl],eax
cmp eax,INVALID_HANDLE_VALUE
je .exit
invoke CreateFile,fileSave,GENERIC_READ+GENERIC_WRITE,FILE_SHARE_READ,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
mov [fHand],eax
cmp eax,INVALID_HANDLE_VALUE
je .exit
invoke SetFilePointer,[fHand],0,0,FILE_BEGIN
.download:
invoke InternetReadFile,[hUrl],buffer,1024,buflong
or [buflong],0
jz .close
invoke WriteFile,[fHand],buffer,[buflong],bwrite,0
jmp .download
.close:
invoke CloseHandle,[fHand]
invoke InternetCloseHandle,[hUrl]
invoke InternetCloseHandle,[hSession]
mov eax,TRUE
ret
.exit:
mov eax,FALSE
ret
msg1 db 'Do you want to download FASM 1.40 beta ?',0
cap1 db 'AN IMPORTANT QUESTION',0
fileUrl db 'http://fasm.metro-nt.pl/fasm140b.zip',0
fileSave db 'fasm140b.zip',0
msgOk db 'Download Success!',0
msgErr db 'Download Failed!',0
msgCap db 'Result:',0
fileName: times 127 db ?
buffer: times 1024 db ?
fHand dd ?
bwrite dd ?
buflong dd ?
hSession dd ?
hUrl dd ?
data import
library kernel,'KERNEL32.DLL',\
user,'USER32.DLL',\
wininet,'wininet.dll'
kernel:
import ExitProcess,'ExitProcess',\
GetModuleHandle,'GetModuleHandleA',\
GetModuleFileName,'GetModuleFileNameA',\
CreateFile,'CreateFileA',\
SetFilePointer,'SetFilePointer',\
WriteFile,'WriteFile',\
CloseHandle,'CloseHandle'
user:
import MessageBox,'MessageBoxA'
wininet:
import InternetOpen,'InternetOpenA',\
InternetOpenUrl,'InternetOpenUrlA',\
InternetReadFile,'InternetReadFile',\
InternetCloseHandle,'InternetCloseHandle'
end data
data fixups
end data
And here?s the zip file:
Thank you, zjlcc, much better now.
(I?m improving my sloppiness yet ;)
(I?m improving my sloppiness yet ;)
zjlcc: You have cut the file manually, haven't you? It doesn't work on Win2000 because of that.
Sorry about that, I think the first one posted doesn?t work either?n WIn2000... I just don?t know what I touched last night, before saving.
Sorry(I?m debugging it though with OllyDbg, from your site, looks great the debugger)
Sorry(I?m debugging it though with OllyDbg, from your site, looks great the debugger)
No, the first one works fine. The second one also works fine when you reassemble it, but it has 1536 bytes then.
yes,internet2.exe ` size is 1536 byte,
my os is 98 not 2000
:) sorry
my os is 98 not 2000
:) sorry
Okay, thanx Privalov, I wish I had more time to keep asking you, but my girl-friend...
It?s been a great pleasure to talk with a Posted on 2002-07-26 13:15:01 by slop
It?s been a great pleasure to talk with a Posted on 2002-07-26 13:15:01 by slop
What happens when the version changes?
Well, sometimes it works in 9x and it doesn?t in NT.
The ideal is that works in both of them, that?s what Win32 API means.
(Sometimes it doesn?t work in any, but that?s, er... well, don?t look at me, it?s called sloppiness ;)
The ideal is that works in both of them, that?s what Win32 API means.
(Sometimes it doesn?t work in any, but that?s, er... well, don?t look at me, it?s called sloppiness ;)
This would be a great addition to the program. It would need to be a little more dynamic. Like it checks for a file online that has the latest realease info and then fills that into the message box and downloadable. Maybe it even self checks and tells you if you need to update.
Great program!
Great program!
No way!
Imagine: maybe the guy does?n't feel like updating, maybe he loves version 1.31 (which I still use sometimes ;)... you never have to think for the guy.
In fact, I love FASM because of the liberty it gives you... this was just a funny thing, so that people could tell me what I was doing wrong, or so (as you can see I?m a newbie), but JUST THAT.
Anyway, your idea reminds me of somebody... do you know Bill? (that?s his method ;))
Imagine: maybe the guy does?n't feel like updating, maybe he loves version 1.31 (which I still use sometimes ;)... you never have to think for the guy.
In fact, I love FASM because of the liberty it gives you... this was just a funny thing, so that people could tell me what I was doing wrong, or so (as you can see I?m a newbie), but JUST THAT.
Anyway, your idea reminds me of somebody... do you know Bill? (that?s his method ;))
Actually, Bill's method is good, and I even plan to write a library for an AutoUpdate system...
The guy who wants to preserve his version won't bother himself to have an update-reminder tool running on his system all the time (nor to check periodically).
And even if he doesn't want to update, but obviously still run the tool all he has to do to not update is answering "No" to the MessageBox question "A new version of FASM (x.xxx) is available. Do you want to update ?"
I am wrong ? :)
The guy who wants to preserve his version won't bother himself to have an update-reminder tool running on his system all the time (nor to check periodically).
And even if he doesn't want to update, but obviously still run the tool all he has to do to not update is answering "No" to the MessageBox question "A new version of FASM (x.xxx) is available. Do you want to update ?"
I am wrong ? :)
Okey, I see your point :)
But it?s Tomasz that has to answer to this question ;)
CsnWltr:
Readiosys , avec mes salutations les plus coordielles,
But it?s Tomasz that has to answer to this question ;)
CsnWltr:
Great program!
I agree with you, the program is great, then I only translated it. The original idea from Ates. He?s the great guy :)
Readiosys , avec mes salutations les plus coordielles,
It's been a couple of months, and I still don?t know what's the bug with this code.
Nobody has reported it yet, so I'm giving a beer to the first that finds it.
I know it's something like a NULL missing or an address instead of a pointer, but I prefer to give the beer.
Because this has several advantages:
1)I get a new friend,
2) I drink another :)
3) I don?t know, I feel lazy.
Nobody has reported it yet, so I'm giving a beer to the first that finds it.
I know it's something like a NULL missing or an address instead of a pointer, but I prefer to give the beer.
Because this has several advantages:
1)I get a new friend,
2) I drink another :)
3) I don?t know, I feel lazy.