Re: Unrolling FASM source code
- From: Betov <betov@xxxxxxx>
- Date: 26 Sep 2005 09:38:29 GMT
"JGCASEY" <jgkjcasey@xxxxxxxxxxxx> écrivait news:1127726167.587326.6010
@g49g2000cwa.googlegroups.com:
>> Yes. Some Assemblers encode it as a "call to a Jump mem".
>> Some others (RosAsm) encode it directly as a "call mem".
>>
>> In both cases "mem" is a place holder, in the ".import"
>> Section of the PE, where the OS writes the Address of
>> the wanted DLL Function, at launch time.
>
>
> So with RosAsm the, call 'KERNELL32.GetModuleHandleA',
> means the value of the address to call is in a struct
> at address KERNELL32 with a displacement GetModuleHandleA?
>
> So it becomes call [KERNELL32 + GetModuleHandleA] ?
No. For all PEs, it works that way:
At launch time, the OS reads the .Import Section, and it
fills a dedicated Table with Pointers to the Functions
referenced in the .Import.
So, the real Address of the 'DLL.Function' is there, in
the uploaded PE. With Assemblers working with a Linker,
the most usual way is to let the Linker do this job. In
this case, as the Assembler cannot know of the address
at which the Linker will implement the various things.
So, the Assembler doe it that way:
call FunctionsJumpTable_Function_Agaga
; ...
FunctionsJumpTable_Function_Agaga:
jmp DWORD[Function_Agaga]
.... and lets the Linker do all of the ajustements job.
With Assemblers able to do it all without any Linker, like
RosAsm, the "Double shot" is useless. So, the call is, simply:
call 'DLL.Function_Agaga',
that is encoded directly as a:
call DWORD[Function_Agaga]
.... where the [Function_Agaga] Address is the one written by
the OS, at launch time.
Since the oncoming of RosAsm, most Assemblers try to do it
this shortest and simpler way.
Betov.
< http://rosasm.org >
.
- Follow-Ups:
- Re: Unrolling FASM source code
- From: f0dder
- Re: Unrolling FASM source code
- References:
- Re: Unrolling FASM source code
- From: wolfgang kern
- Re: Unrolling FASM source code
- From: Betov
- Re: Unrolling FASM source code
- From: JGCASEY
- Re: Unrolling FASM source code
- From: Betov
- Re: Unrolling FASM source code
- From: JGCASEY
- Re: Unrolling FASM source code
- Prev by Date: Re: Unrolling FASM source code
- Next by Date: Re: Unrolling FASM source code
- Previous by thread: Re: Unrolling FASM source code
- Next by thread: Re: Unrolling FASM source code
- Index(es):
Relevant Pages
|