Message board for the users of flat assembler.
> Windows > Unrolling FASM code
I am trying to unroll FASM code:
; invoke GetModuleHandle, NULL
Although it compiled ok it would not run,
SimpleWindow2.EXE - Application Error
(X) The instruction at "0x00403060" referenced
memory at "0xcaa97c70". The memory could not
-> 00403060 sub dword ptr [ebp-355D8380h]
Looking for GetModuleHandle all I could find was,
; KERNEL32 API calls (ASCII)
; KERNEL32 API calls parameters' count
GetModuleHandle% = 1
in the fasm files.
email: jgkjcasey at yahoo.com.au
|25 Sep 2005, 02:27||
GetModuleHandle is an OFFSET to a variable containing the address to GetModuleHandle
you should enclose it in square brackets:
push 0 call [GetModuleHandle]
|25 Sep 2005, 02:47||
Of course that works.
Thank you comrade.
It is unclear why the import is needed when it doesn't
seem to be needed in RosAsm source or MASM source. I
know it has something to do with the PE part from the
section '.idata' import data readable writeable
import KERNEL32, \
The TD source code from RosAsm that I actually used
to unroll the invoke statement, uses GetModuleHandleA.
The 'A' I understand to mean plain asc rather than
Why doesn't call [GetModuleHandleA] work?
Undefined symbol error.
Do I lack an include and/or import directive for
the file with the required definition?
I notice that Java, which I am also learning, uses
the import directive.
|25 Sep 2005, 04:29||
Because you defined GetModuleHandle as symbol name, not GetModuleHandleA. Thats why the second one is an undefined symbol
If you include win32ax.inc, you can make life easier as all important WinAPI functions get imported automaticaly.
|25 Sep 2005, 07:04||
I included win32ax.inc and it still declares GetModuleHandleA
as an undefined symbol.
How do I define it?
All I can find in the KERNEL32.inc is the same thing written in
the section '.idata'
|25 Sep 2005, 08:52||
label GetModuleHandleA at GetModuleHandle
|25 Sep 2005, 10:00||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.