git-svn-id: svn://kolibrios.org@1204 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2009-10-12 08:25:30 +00:00
parent 04c674ce1a
commit 8aad28db2a

View File

@ -116,7 +116,6 @@ local __sc
local lp local lp
local lp1 local lp1
local correction local correction
;local end_tr
local exit_ local exit_
;/equ ;/equ
err_message1 equ dword [esp+8] err_message1 equ dword [esp+8]
@ -265,18 +264,21 @@ rb 0x50
end_tr: end_tr:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@library_name equ dword [esp+12]
@cur_dir_path equ dword [esp+8] @library_name equ dword [esp+16]
@library_path equ dword [esp+4] @cur_dir_path equ dword [esp+12]
@library_path equ dword [esp+8]
@point_dir_name equ dword [esp+4]
align 4 align 4
@copy_path: @copy_path:
mov ebx,@library_name ; mov ebx,@library_name
mov esi,@cur_dir_path mov esi,@cur_dir_path
mov edi,@library_path mov edi,@library_path
xor eax,eax xor eax,eax
cld cld
align 4
.lp1: .lp1:
lodsb lodsb
stosb stosb
@ -285,28 +287,45 @@ align 4
mov esi,edi mov esi,edi
std std
align 4
.lp2: .lp2:
lodsb lodsb
cmp al,'/' cmp al,'/'
jnz .lp2 jnz .lp2
mov edi,esi mov edi,esi
mov esi,ebx
add edi,2 add edi,2
cld cld
; mov esi,@library_name
mov esi,@point_dir_name
test esi,esi
jz .str_lp4
align 4
.lp3: .lp3:
lodsb lodsb
stosb stosb
test eax,eax test eax,eax
jnz .lp3 jnz .lp3
dec edi
.str_lp4:
mov esi,@library_name
align 4
.lp4:
lodsb
stosb
test eax,eax
jnz .lp4
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
ret ret
} }
macro sys_load_library library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__ macro sys_load_library library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__,point_dir_name__
{ {
local end_steep local end_steep
local exit local exit
@ -317,7 +336,11 @@ local exit
test eax,eax test eax,eax
jnz end_steep jnz end_steep
copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library if point_dir_name__ eq
copy_path library_name__, cur_dir_path__, library_path__,0x0
else
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__ ;the macros making way /current pach a program/+ name system library
end if
mcall 68,19,library_path__ ; load of alternative mcall 68,19,library_path__ ; load of alternative
test eax,eax test eax,eax
@ -342,14 +365,18 @@ exit:
} }
macro load_library library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__ macro load_library library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__,point_dir_name__
{ {
local end_steep local end_steep
local exit local exit
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; loading Box_Lib library ; loading Box_Lib library
copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library if point_dir_name__ eq
copy_path library_name__, cur_dir_path__, library_path__,0x0
else
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__ ;the macros making way /current pach a program/+ name system library
end if
mcall 68,19,library_path__ ; load of alternative mcall 68,19,library_path__ ; load of alternative
test eax,eax test eax,eax
@ -390,11 +417,12 @@ library_path__ equ [ebp+8]
system_path__ equ [ebp+12] system_path__ equ [ebp+12]
err_message_found_lib__ equ [ebp+16] err_message_found_lib__ equ [ebp+16]
head_f_l__ equ [ebp+20] head_f_l__ equ [ebp+20]
my_import equ [ebp+24] my_import equ [ebp+24]
err_message_import__ equ [ebp+28] err_message_import__ equ [ebp+28]
head_f_i__ equ [ebp+32] head_f_i__ equ [ebp+32]
adr_load_lib equ dword [ebp+36] point_dir_name__ equ [ebp+36]
status_lib equ dword [ebp+40] adr_load_lib equ dword [ebp+40]
status_lib equ dword [ebp+44]
mov ebp,_start mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size) mov ecx,((_end-_start)/ll_struc_size)
@ -405,7 +433,7 @@ lp: push ecx
test eax,eax test eax,eax
jnz end_steep jnz end_steep
copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__ ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path__ ; load of alternative mcall 68,19,library_path__ ; load of alternative
test eax,eax test eax,eax
@ -413,7 +441,7 @@ lp: push ecx
or status_lib,0x1 ; status of code - enable error - not found library or status_lib,0x1 ; status of code - enable error - not found library
show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window show_error_window err_message_found_lib__, head_f_l__, ;show error message /create window
jmp next jmp next
align 4 align 4
@ -467,11 +495,12 @@ library_path__ equ [ebp+8]
system_path__ equ [ebp+12] system_path__ equ [ebp+12]
err_message_found_lib__ equ [ebp+16] err_message_found_lib__ equ [ebp+16]
head_f_l__ equ [ebp+20] head_f_l__ equ [ebp+20]
my_import equ [ebp+24] my_import equ [ebp+24]
err_message_import__ equ [ebp+28] err_message_import__ equ [ebp+28]
head_f_i__ equ [ebp+32] head_f_i__ equ [ebp+32]
adr_load_lib equ dword [ebp+36] point_dir_name__ equ [ebp+36]
status_lib equ dword [ebp+40] adr_load_lib equ dword [ebp+40]
status_lib equ dword [ebp+44]
mov ebp,_start mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size) mov ecx,((_end-_start)/ll_struc_size)
@ -479,7 +508,7 @@ status_lib equ dword [ebp+40]
align 4 align 4
lp: push ecx lp: push ecx
copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__ ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path__ ; load of alternative mcall 68,19,library_path__ ; load of alternative
test eax,eax test eax,eax
@ -534,16 +563,16 @@ exit_lp2:
} }
macro copy_path lib_name,dir_path,lib_path macro copy_path lib_name,dir_path,lib_path,point_dir_name
{ {
pushad ;save all registers pushad ;save all registers
push dword lib_name push dword lib_name
push dword dir_path push dword dir_path
push dword lib_path push dword lib_path
push dword point_dir_name
call @copy_path call @copy_path
add esp,12 add esp,16
popad ;restore all registers popad ;restore all registers
} }
@ -613,21 +642,25 @@ import_done:
e.exit: e.exit:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
} }
ll_struc_size = 44;($-library_name__) ; constant size of struct ll_struc_size = 48;($-library_name__) ; constant size of struct
struc l_libs library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, my_import, err_message_import__, head_f_i__; struct for loading libraries struc l_libs library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, my_import, err_message_import__, head_f_i__,point_dir_name; struct for loading libraries
{ {
.library_name__ dd library_name__ ; èìÿ çàãðóæàåìîé áèáëèîòåêè .library_name__ dd library_name__ ; èìÿ çàãðóæàåìîé áèáëèîòåêè
.cur_dir_path__ dd cur_dir_path__ ; óêàçàòåëü íà áóôåð â êîòîðîì ñîäåðæèòüñÿ ïóòü îò êóäà áûëà çàïóùåíà ïðîãðàììà .cur_dir_path__ dd cur_dir_path__ ; óêàçàòåëü íà áóôåð â êîòîðîì ñîäåðæèòüñÿ ïóòü îò êóäà áûëà çàïóùåíà ïðîãðàììà
.library_path__ dd library_path__ ; óêàçàòåëü íà áóôåð â êîòîðîì áóäåò ñîôîðèìèðîâàí ïóòü ê áèáëèîòåêè, åñëè íóæíî âû÷èñëèòü ïóòü äî ëèáû ñ ìåñòà çàïóñêà ïðîãðàììû, îáû÷íî íóæíî, â ñëó÷àÿõ, åñëè ëèáà ðàñïîëîæåíà â òîé æå ïàïêå .library_path__ dd library_path__ ; óêàçàòåëü íà áóôåð â êîòîðîì áóäåò ñîôîðèìèðîâàí ïóòü ê áèáëèîòåêè, åñëè íóæíî âû÷èñëèòü ïóòü äî ëèáû ñ ìåñòà çàïóñêà ïðîãðàììû, îáû÷íî íóæíî, â ñëó÷àÿõ, åñëè ëèáà ðàñïîëîæåíà â òîé æå ïàïêå
.complete_path dd system_path__ ; ïóòü êîòîðûé ÷åòêî ñîäåðæèò ïóòü .complete_path dd system_path__ ; ïóòü êîòîðûé ÷åòêî ñîäåðæèò ïóòü
.err_message_found_lib__ dd err_message_found_lib__ .err_message_found_lib__ dd err_message_found_lib__
.head_f_l__ dd head_f_l__ .head_f_l__ dd head_f_l__
.my_import dd my_import .my_import dd my_import
.err_message_import__ dd err_message_import__ .err_message_import__ dd err_message_import__
.head_f_i__ dd head_f_i__ .head_f_i__ dd head_f_i__
if point_dir_name eq
.point_dir_name__ dd 0x0
else
.point_dir_name__ dd point_dir_name ; èìÿ âëîæåííîé äèððåêòîðèè â êòîðîé õðàíÿòüñÿ ïîäãðóæàåìûå ìîäóëè.
end if
.adr_load_lib dd 0x0 .adr_load_lib dd 0x0
.status_lib dd 0x0 ;status of load library .status_lib dd 0x0 ;status of load library
; ;