flat assembler
Message board for the users of flat assembler.
Index
> Windows > FASM API help.. |
Author |
|
JohnFound 18 Dec 2004, 14:20
All functions from one library have to be imported with one "import" statement:
Code: format PE GUI include '%fasminc%\win32a.inc' invoke GetForegroundWindow invoke SetWindowText, eax, sse invoke MessageBox, 0, installed, installed, MB_OK invoke ExitProcess, 0 sse db 'Hello...',0 installed db 'Changed the Window Text...',0 data import library user32,'user32.dll',kernel32,'kernel32.dll' import user32, \ MessageBox, 'MessageBoxA', \ GetForegroundWindow,'GetForegroundWindow', \ SetWindowText, 'SetWindowTextA' import kernel32, \ ExitProcess,'ExitProcess' end data To avoid such kind of manual import table build, that will make you more troubles than education, you can simply import everything and leave FASM determine what you are using in the program and what not. This approach will not increase the size of your program, only the compilation speed will decrease very slighly, but you will be free to use any function without manually importing it. Code: format PE GUI include '%fasminc%\win32a.inc' invoke GetForegroundWindow invoke SetWindowText, eax, sse invoke MessageBox, 0, installed, installed, MB_OK invoke ExitProcess, 0 sse db 'Hello...',0 installed db 'Changed the Window Text...',0 data import library kernel32, 'kernel32', user32, 'user32' include "%fasminc%\APIA\Kernel32.inc" include "%fasminc%\APIA\User32.inc" end data |
|||
18 Dec 2004, 14:20 |
|
gumletis 18 Dec 2004, 14:59
Thanks. But there is a mistake in it, i allready can see. This should be replaced
library kernel32, 'kernel32', user32, 'user32' by this library kernel32, 'kernel32.dll', user32, 'user32.dll' .. And THANKS for so quick respons PS i like FASM becuase it have masm invoke, and nasm smallness... And its to other os. And for not make another topic, how do i make a program on the top of something? just tell me the API named, so i try figer out self how it work |
|||
18 Dec 2004, 14:59 |
|
JohnFound 18 Dec 2004, 15:18
gumletis wrote: But there is a mistake in it, i allready can see. This should be replaced Both are correct - you can compile and try. ".dll" is extesion by default, so when it miss, Windows searches for .dll with given name. Quote: And for not make another topic, how do i make a program on the top of something? What actually do you mean Regards |
|||
18 Dec 2004, 15:18 |
|
gumletis 18 Dec 2004, 15:22
okay, just my computer there is F*****, you know when you get a setting box or some like that, it are always on the top. What API are used for that?
|
|||
18 Dec 2004, 15:22 |
|
JohnFound 18 Dec 2004, 15:47
gumletis wrote: okay, just my computer there is F*****, you know when you get a setting box or some like that, it are always on the top. What API are used for that? If I understand you correctly, you need winndow that will stay at the top all the time. Well, you have to set WS_EX_TOPMOST extended style when you create window with CreateWindowEx API function. That is all. Regards. |
|||
18 Dec 2004, 15:47 |
|
gumletis 18 Dec 2004, 15:54
okay thanks, i see what i can do with that, and msdn. Thanks...
|
|||
18 Dec 2004, 15:54 |
|
gumletis 18 Dec 2004, 23:31
Hi i got a problem more, i need a program to copy its self to windir....
This is what i got so far Code: format PE GUI include '\include\win32a.inc' invoke GetSystemDirectory,me,1500 invoke MessageBox,0,mey,mey,MB_OK invoke ExitProcess,0 me db ? mey db me,'\hello_world.exe',0 data import library user32,'user32.dll',kernel32,'kernel32.dll' include '\include\apia\user32.inc' include '\include\apia\kernel32.inc' end data its just says mistake in mey db.... _________________ LOOOL |
|||
18 Dec 2004, 23:31 |
|
JohnFound 19 Dec 2004, 06:01
"me" is dword address. You can't use "db me" because "db" defines bytes, not dwords. What actually you want to do with this statement?
|
|||
19 Dec 2004, 06:01 |
|
gumletis 19 Dec 2004, 08:54
?? i wanna make a program there comes with the regedit, the first step is going to find system dir and so set '\heloo_world.exe' in it so it copy to that... PS are its a dd there come from GetSystemDirectory?
|
|||
19 Dec 2004, 08:54 |
|
gumletis 19 Dec 2004, 10:35
lol now i find what i need, lstrcat. But its given a wierd result when im using it. What shall i do?
Code: invoke GetModuleHandle invoke GetModuleFileName,eax,me,1500 invoke GetSystemDirectory,sysdir,20 invoke lstrcat,sysdir,hello invoke MessageBox,0,sysdir,sysdir,MB_OK _________________ LOOOL |
|||
19 Dec 2004, 10:35 |
|
vid 19 Dec 2004, 12:15
you could post whole code. Maybe you didn't reserve enough space in "sysdir" string for "hello_world"?
And another thing, you are not checking return values of APIs, this way your app is very unstable and if you are not willing to work at Micro$oft you shouldn't want that |
|||
19 Dec 2004, 12:15 |
|
gumletis 19 Dec 2004, 12:46
here it is
Code: format PE GUI include '\include\win32a.inc' invoke GetModuleHandle invoke GetModuleFileName,eax,me,1500 invoke GetSystemDirectory,sysdir,20 invoke lstrcat,sysdir,hello invoke CopyFile,sysdir,me invoke GetForegroundWindow invoke SetWindowText,eax,hello invoke ExitProcess,0 hello db '\hello.exe',0 me db ? sysdir db ? data import library user32,'user32.dll',kernel32,'kernel32.dll' include '\include\apia\user32.inc' include '\include\apia\kernel32.inc' end data I also need a Reg API, only know how to do that in C/C++ ps how to do that vid _________________ LOOOL |
|||
19 Dec 2004, 12:46 |
|
vid 19 Dec 2004, 12:50
"me" and "sysdir" should be strings, eg. more bytes. Try
Code: me rb 100 sysdir rb 100 |
|||
19 Dec 2004, 12:50 |
|
gumletis 19 Dec 2004, 13:20
IT WORKED...! thanks!
|
|||
19 Dec 2004, 13:20 |
|
vid 19 Dec 2004, 20:45
you are welcome. But make sure you understand the solution, otherwise it would be without effect.
|
|||
19 Dec 2004, 20:45 |
|
gumletis 20 Dec 2004, 10:55
Yes i do, rb = Reserve byte with 100 maximum char. PS how to do a Regedit compare and add a reg key, i have try to find one, but there is only in MASM, so i try change it. But doesn't work
|
|||
20 Dec 2004, 10:55 |
|
vid 20 Dec 2004, 12:16
i think there are APIs for that
|
|||
20 Dec 2004, 12:16 |
|
gumletis 20 Dec 2004, 14:39
I know. But just donno how to get it to work at FASM instead of MASM... Any Ideas?
_________________ LOOOL |
|||
20 Dec 2004, 14:39 |
|
vid 22 Dec 2004, 19:23
instead of "d* X DUP(Y)" (where * is b,w,dw ...)
use "times X d* Y" or if Y is ? use "r* X" |
|||
22 Dec 2004, 19:23 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.