1 ;-----------------------------------------------------------------------------
2 ; load one or more DLL file in COFF format and try to import functions by our list
3 ; if first function in import list begins with 'lib_', call it as DLL initialization
4 ; return eax = 1 as fail, if anyone of .obj file not found in /sys/lib
5 ; return 0 if all fine, but 0 not garantees in succesfull import - see dll.Link comment
6 ; dirties all registers! eax, ebx, ecx, edx, esi, edi
7 proc dll.Load, import_table:dword
8 mov esi, [import_table]
15 mov edi, s_libdir.fname
21 mcall 68, 19, s_libdir
24 stdcall dll.Link, eax, edx
27 cmp dword[eax], 'lib_'
30 stdcall dll.Init, [eax + 4]
44 ;-----------------------------------------------------------------------------
45 ; scans dll export table for a functions we want to import
46 ; break scan on first unresolved import
48 proc dll.Link, exp:dword, imp:dword
57 stdcall dll.GetProcAddress, [exp], eax
68 ;-----------------------------------------------------------------------------
69 ; calls lib_init with predefined parameters
71 proc dll.Init, dllentry:dword
81 ;-----------------------------------------------------------------------------
82 ; scans export table for a sz_name function
83 ; returns in eax function address or 0 if not found
84 proc dll.GetProcAddress, exp:dword, sz_name:dword
92 stdcall strcmp, [edx], [sz_name]
106 ;-----------------------------------------------------------------------------
108 ; returns eax = 0 if equal, -1 otherwise
109 proc strcmp, str1:dword, str2:dword
127 ;-----------------------------------------------------------------------------
133 ;-----------------------------------------------------------------------------
141 ;-----------------------------------------------------------------------------
142 proc mem.ReAlloc, mptr, size
150 ;-----------------------------------------------------------------------------
158 ;-----------------------------------------------------------------------------