flat assembler
Message board for the users of flat assembler.
Index
> Windows > Good API reference Goto page 1, 2 Next |
Author |
|
okasvi 05 Apr 2007, 21:25
|
|||
05 Apr 2007, 21:25 |
|
mrblobles 05 Apr 2007, 21:26
but isn't that written for C++???
|
|||
05 Apr 2007, 21:26 |
|
mrblobles 05 Apr 2007, 21:30
I dont really understand how to use what it says there in ASM, like in the program i posted
|
|||
05 Apr 2007, 21:30 |
|
sleepsleep 05 Apr 2007, 23:07
the
Code: push MB_YESNO push _caption push _message push NULL call [MessageBox] is same as Code: invoke MessageBox,NULL,_message,_caption,MB_YESNO if you check on msdn or psdk for windows api reference, you would see it provide a C/C++ function prototype. Code: int MessageBox( HWND hWnd, // handle to owner window LPCTSTR lpText, // text in message box LPCTSTR lpCaption, // message box title UINT uType // message box style ); now, the beauty of asm (assembly language) is, you don't have to care about HWND, LPCTSTR, UINT, coz they are ALL DWORD = 32bits. (period) the int returned from the function is also a DWORD, which you could found in the EAX register after using the invoke winapiname or call [winapiname]. one of the confusion that generated for asm beginner is the concept of pointer and value. i personally felt that this concept is actually more clearer depicted in asm rather than C or C++. eg. when you do mytext db 'my string etc',0 now, when you Code:
mov eax,mytext
what happened is, you move the reference (or address) of this string into register eax. if you do, Code: mov eax,[mytext] what happend is, it would move the 4 bytes of mytext, which is "my s" = the ascii value into EAX register. to get more win api, i would recommend you download the free PSDK (help2 though), if you want old version, pm me, (i got those .chm version, but not so updated compare current psdk that probably provide windows vista api). |
|||
05 Apr 2007, 23:07 |
|
sleepsleep 05 Apr 2007, 23:12
btw, welcome to fasm board
i am your host lol nah try read the manual prepared by tomasz & teams and if you get stucked, then posting on board see if somebody free to help you |
|||
05 Apr 2007, 23:12 |
|
madmatt 06 Apr 2007, 06:31
You can also Try this: http://msdn2.microsoft.com/en-us/library/aa286531.aspx
And if you want to download the latest wndows (xp/vista) sdk (this is a HUGE file, so you will NEED high speed modem for this download!): http://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF&displaylang=en#QuickInfoContainer |
|||
06 Apr 2007, 06:31 |
|
mrblobles 06 Apr 2007, 19:32
thank you everyone, umm two quick questions, is that PSDK the huge file thingy, and im still a little confused, could someone please tell how to put this:
HWND CreateWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam ); into asm?? |
|||
06 Apr 2007, 19:32 |
|
sleepsleep 06 Apr 2007, 20:40
since we know, HWND, LPCTSTR, INT, HMENU, HINSTANCE & LPVOID, they are all just DWORD ... (see, fasm so sexy!!)
so to use API in windows, as mentioned in my previous thread, u could use Invoke apiname, param1, param2 or push param2 push param1 then call [apiname] so, to use this CreateWindow api, you could. lpClassName db 'myClassName',0 lpWindowName db 'mywindowname',0 dwStyle dd ? mov [dwStyle], WS_VISIBLE + WS_CAPTION + ETC.. Invoke CreateWindow, lpClassName, lpWindowName, [dwStyle], x, y, w, h, [hwndparent], [hmenu], [hinstance], 0 to know what we should fill for the parameters in order to have a success return value in EAX, we just need to check the PSDK or MSDN or old win32 helpfile. hope u see the sexiness of fasm |
|||
06 Apr 2007, 20:40 |
|
mrblobles 06 Apr 2007, 20:51
uh-huh I think I get it thnk you very very muchly
|
|||
06 Apr 2007, 20:51 |
|
sleepsleep 06 Apr 2007, 20:56
"uh-huh" doesn't sound so convincing
|
|||
06 Apr 2007, 20:56 |
|
mrblobles 06 Apr 2007, 21:14
so umm I made this but when I run it it says entry point not found, how come??
Code: format PE GUI 4.0 entry start include 'win32a.inc' section '.data' data readable writeable lpWindowName db 'mywindowname',0 lpClassName db 'myclassname',0 dwStyle dd ? hwndparent dd ? hmenu dd ? hinstance dd ? section '.code' code readable executable start: push 0 push [hinstance] push [hmenu] push [hwndparent] push 100 push 50 push 13 push 13 push [dwStyle] push lpWindowName push lpClassName call [CreateWindow] ret section '.idata' import data readable writeable library user,'USER32.dll' import user,\ CreateWindow,'CreateWindowA' |
|||
06 Apr 2007, 21:14 |
|
mrblobles 06 Apr 2007, 21:32
I did some googling and found this program, http://www.nirsoft.net/utils/dll_export_viewer.html
it tells you the functions of a dll, do you think it will be useful to me?? |
|||
06 Apr 2007, 21:32 |
|
sleepsleep 06 Apr 2007, 22:08
a dll viewer is always a nice thing to have, i personally use depencency viewer
http://www.dependencywalker.com/ it let you inspect some function name that (assume you got no documentation) so, grab the function name and google would usually lead us to some info. btw, to create your first window, you need to do lot of works, not just call CreateWindow and expect a window to pop up |
|||
06 Apr 2007, 22:08 |
|
sleepsleep 06 Apr 2007, 22:22
ok, just did a simple one for you,
Code: format PE GUI 4.0 entry start include '%fasminc%\win32a.inc' section '.data' data readable writeable hinst dd ? wtitle db 'blobles in fasm',0 wclsname db 'BLOBLES',0 wcls WNDCLASS wmsg MSG wh dd ? section '.code' code readable executable start: invoke GetModuleHandle,NULL mov [hinst],eax mov [wcls.hInstance],eax mov [wcls.style],CS_HREDRAW + CS_VREDRAW mov [wcls.lpfnWndProc],window_procedure mov [wcls.lpszClassName],wclsname mov [wcls.hbrBackground],COLOR_WINDOW + 1 invoke LoadIcon,NULL,IDI_APPLICATION push eax pop [wcls.hIcon] invoke RegisterClass,wcls invoke CreateWindowEx,0,wclsname,wtitle,WS_OVERLAPPEDWINDOW,\ CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,\ NULL,NULL,[hinst],NULL mov [wh],eax invoke ShowWindow,eax,SW_SHOW a1: invoke GetMessage,wmsg,NULL,0,0 or eax,eax je a2 invoke TranslateMessage,wmsg invoke DispatchMessage,wmsg jmp a1 a2: invoke ExitProcess,0 proc window_procedure uses ebx esi edi, hwnd, umsg, wparam, lparam cmp [umsg],WM_DESTROY je .wmdestroy .wmdefault: invoke DefWindowProc,[hwnd],[umsg],[wparam],[lparam] jmp .wmbye .wmdestroy: invoke PostQuitMessage,0 .wmbye: ret endp section '.idata' import data readable library kernel32, 'KERNEL32.DLL',\ user32, 'USER32.DLL' include '%fasminc%\api\Kernel32.inc' include '%fasminc%\api\User32.inc' tab at 8 |
|||
06 Apr 2007, 22:22 |
|
mrblobles 07 Apr 2007, 20:33
thank you very muchly
|
|||
07 Apr 2007, 20:33 |
|
mrblobles 08 Apr 2007, 20:00
hey this is my first 32bit program, what do you think http://www.freewebs.com/exactagecalculator/thirsty.zip
|
|||
08 Apr 2007, 20:00 |
|
sleepsleep 08 Apr 2007, 22:43
he he
i don't have tada.wav, so i fake one all those default .wav were gone while nlite"ing" |
|||
08 Apr 2007, 22:43 |
|
peter 09 Apr 2007, 01:06
Look at Iczelion's tutorials on Win32 Assembly:
http://win32assembly.online.fr/tutorials.html Unfortunately, he uses MASM syntax, but the tutorials are still very useful for a beginner. |
|||
09 Apr 2007, 01:06 |
|
okasvi 09 Apr 2007, 10:42
sleepsleep translated Iczelion's win32 asm tutorials to fasm already.
edit: http://board.flatassembler.net/topic.php?t=2158 |
|||
09 Apr 2007, 10:42 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.