flat assembler
Message board for the users of flat assembler.

Index > Main > Converting this proc from IDA to FASM?

Author
Thread Post new topic Reply to topic
EagleEye



Joined: 02 Feb 2012
Posts: 3
EagleEye 02 Feb 2012, 04:05
I want to convert the following snippet from IDA ASM to FASM ASM. I can do this with most of the procs I ran into so far, because they took no arguments, but this one takes a thingy (pointer I guess? C# has sort of spoiled me), a uint, another uint, and a long. Would I simply make this "proc Windows_Procedure hWnd Msg wParam lParam"? If I do, do I remove their initializations down there?

Code:
; int __stdcall    Windows_Procedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
long Windows_Procedure(void *, unsigned     int, unsigned int, long) proc near
                                      ; DATA XREF: Create_Main_Window(void *,int,int,int)+11o

hWnd                = dword ptr  4
Msg           = dword ptr  8
wParam                = dword ptr  0Ch
lParam              = dword ptr  10h    


Also, in "abs_ proc near", does the near mean anything important? If so, does it have an equivalent in FASM? Do I have to say that a proc returns nothing or an int or a long in FASM, like IDA does? IDA is honestly not a very good ASM teacher, being designed mainly for people who need information, not valid code, but you know. Very Happy

P.S. I apologize for not reading over the manual very carefully; I have to use the lame excuse of college, I'm afraid.
Post 02 Feb 2012, 04:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20333
Location: In your JS exploiting you and your system
revolution 02 Feb 2012, 04:14
For 32-bit code under Windows all procs are near.
Code:
include 'win32a.inc'
;...
proc Windows_Procedure uses ebx esi edi, hWnd, Msg, wParam, lParam
  mov eax,[hWnd]
  ;...
  ret
endp    
Post 02 Feb 2012, 04:14
View user's profile Send private message Visit poster's website Reply with quote
EagleEye



Joined: 02 Feb 2012
Posts: 3
EagleEye 02 Feb 2012, 13:08
Thanks. Just wondering, where does the "mov eax,[hWnd]" come from?
Post 02 Feb 2012, 13:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20333
Location: In your JS exploiting you and your system
revolution 02 Feb 2012, 13:29
EagleEye wrote:
Just wondering, where does the "mov eax,[hWnd]" come from?
It is just an example of how to access the function parameters.
Post 02 Feb 2012, 13:29
View user's profile Send private message Visit poster's website Reply with quote
EagleEye



Joined: 02 Feb 2012
Posts: 3
EagleEye 02 Feb 2012, 21:06
Oh, I see. I though it was copying eax to hWnd. That makes sense now. Thank you. Smile
Post 02 Feb 2012, 21:06
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.