flat assembler
Message board for the users of flat assembler.

Index > Windows > Need advice on Library Load

Author
Thread Post new topic Reply to topic
Tomazas



Joined: 26 Nov 2006
Posts: 1
Tomazas 26 Nov 2006, 23:38
Hello!
I am newbie to assemler and I need advice on loading huge library list. I have around 11 libraries which contains each from 3 to 70 functions which should be done each like this:
Code:
lea     eax, aKernel32_dll ; "kernel32.dll"
push    eax
call    ds:LoadLibraryA
push    eax
lea     eax, aKernelFunc ; "HeapAlloc"
mov     eax, [ebp-8] ; Library Name
push    eax
call    ds:GetProcAddress

mov     [ebp-204h],  eax ; Stored local variable, each time different
mov     ecx, [ebp-208h] ; DWORD address to store to
mov     [ecx], eax ; DWORD=Address of function for later use  jmp     ds:dword_16752890
    

The idea is that Library loaded and the should store a long list of function to different dword_16752F00, next one to dword_16752F04 and etc. Library names are stored in format
0<byte-lenght>0<Funtion name 1 DLL1>0<lenght 2>0<function Name2>0.... <last function name>00000<lenght DLL2 function 1>0<function name 1 DLL2>0<lenght 2 DLL2>0<.......
and etc.
So when end of a list for same DLL library, zero lenght would be return and that should mean time to load a new library and the assign to DWORD each time with 4 bytes difference. When library loaded a one DWORD skipped.
Libraries are not difficult to hardcode but not functions, there is too many.
So probably the idea would be:

Code:
push eax; library1
Loadlibrary
push eax ; library address
push eax; dword start of list functions names=16752FF5
push eax; dword start of variables to store=:16752890
Call LoadAllFunction 
add eax, 8; dword start of list functions names=16752FF5+8
add eax, 4; dword start of variables to store=:16752890
mov eax, offset Library2
;Now repeat this code again 11 times
;DLL names are sored similar as function names just more simple way:
;Library1.DLL000000Library2.DLL000000
;L____16 bytes_____|______16 bytes___|
    

Result should look like this:
Code:
16752890 dword_16752890;  Address of function 1, DLL1
16752894 dword_16752894;  Address of function 2, DLL1
...
16752994 dword_16752994;  Address of function 56 (last), DLL1
16752998 =0
1675299B dword_1675299B;  Address of function 1, DLL2
...
    

and so on.


Main question: how would code look like for LoadAllFunction?
Thanks for any help
Post 26 Nov 2006, 23:38
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.