Subversion Repositories Kolibri OS

Rev

Rev 5998 | Rev 6792 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5998 Rev 6502
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;;  Distributed under terms of the GNU General Public License.  ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 5998 $
8
$Revision: 6502 $
9
 
9
 
Line 899... Line 899...
899
        ret
899
        ret
Line 900... Line 900...
900
 
900
 
901
align 4
901
align 4
902
proc load_library stdcall, file_name:dword
902
proc load_library stdcall, file_name:dword
903
           locals
903
    locals
904
             fullname  rb 260
904
        fullname    dd  ?
905
             fileinfo  rb 40
905
        fileinfo    rb  40
906
             coff      dd ?
906
        coff        dd  ?
907
             img_base  dd ?
907
        img_base    dd  ?
Line 908... Line 908...
908
           endl
908
    endl
-
 
909
 
-
 
910
; resolve file name
909
 
911
        stdcall kernel_alloc, maxPathLength
910
; resolve file name
-
 
911
        mov     ebx, [file_name]
-
 
912
        lea     edi, [fullname+1]
912
        mov     [fullname], eax
913
        mov     byte [edi-1], '/'
913
        mov     ebx, [file_name]
914
        stdcall get_full_file_name, edi, 259
914
        stdcall get_full_file_name, eax, maxPathLength
915
        test    al, al
-
 
916
        jz      .fail
915
        test    eax, eax
917
 
916
        jz      .fail
918
; scan for required DLL in list of already loaded for this process,
917
; scan for required DLL in list of already loaded for this process,
919
; ignore timestamp
-
 
920
        cli
918
; ignore timestamp
921
 
919
        cli
922
        mov     esi, [current_process]
920
        mov     esi, [current_process]
923
        lea     edi, [fullname]
921
        mov     edi, [fullname]
924
        mov     ebx, [esi+PROC.dlls_list_ptr]
922
        mov     ebx, [esi+PROC.dlls_list_ptr]
925
        test    ebx, ebx
923
        test    ebx, ebx
926
        jz      .not_in_process
924
        jz      .not_in_process
Line 940... Line 938...
940
        inc     [ecx+DLLDESCR.refcount]
938
        inc     [ecx+DLLDESCR.refcount]
941
        mov     eax, [ecx+DLLDESCR.exports]
939
        mov     eax, [ecx+DLLDESCR.exports]
942
        sub     eax, [ecx+DLLDESCR.defaultbase]
940
        sub     eax, [ecx+DLLDESCR.defaultbase]
943
        add     eax, [esi+HDLL.base]
941
        add     eax, [esi+HDLL.base]
944
        sti
942
        sti
-
 
943
        push    eax
-
 
944
        stdcall kernel_free, [fullname]
-
 
945
        pop     eax
945
        ret
946
        ret
-
 
947
 
946
.next_in_process:
948
.next_in_process:
947
        mov     esi, [esi+HDLL.fd]
949
        mov     esi, [esi+HDLL.fd]
948
        jmp     .scan_in_process
950
        jmp     .scan_in_process
949
.not_in_process:
-
 
Line -... Line 951...
-
 
951
 
950
 
952
.not_in_process:
951
; scan in full list, compare timestamp
953
; scan in full list, compare timestamp
952
        sti
954
        sti
953
        lea     eax, [fileinfo]
955
        lea     eax, [fileinfo]
954
        stdcall get_fileinfo, edi, eax
956
        stdcall get_fileinfo, edi, eax
Line 1180... Line 1182...
1180
        mov     eax, [dll_list.bk]
1182
        mov     eax, [dll_list.bk]
1181
        mov     [dll_list.bk], esi
1183
        mov     [dll_list.bk], esi
1182
        mov     [esi+DLLDESCR.bk], eax
1184
        mov     [esi+DLLDESCR.bk], eax
1183
        mov     [eax+DLLDESCR.fd], esi
1185
        mov     [eax+DLLDESCR.fd], esi
1184
.dll_already_loaded:
1186
.dll_already_loaded:
-
 
1187
        stdcall kernel_free, [fullname]
1185
        inc     [esi+DLLDESCR.refcount]
1188
        inc     [esi+DLLDESCR.refcount]
1186
        push    esi
1189
        push    esi
1187
        call    init_heap
1190
        call    init_heap
1188
        pop     esi
1191
        pop     esi
1189
 
-
 
1190
        mov     edi, [esi+DLLDESCR.size]
1192
        mov     edi, [esi+DLLDESCR.size]
1191
        stdcall user_alloc_at, [esi+DLLDESCR.defaultbase], edi
1193
        stdcall user_alloc_at, [esi+DLLDESCR.defaultbase], edi
1192
        test    eax, eax
1194
        test    eax, eax
1193
        jnz     @f
1195
        jnz     @f
1194
        stdcall user_alloc, edi
1196
        stdcall user_alloc, edi
Line 1253... Line 1255...
1253
        mov     eax, [esi+DLLDESCR.exports]
1255
        mov     eax, [esi+DLLDESCR.exports]
1254
        sub     eax, [esi+DLLDESCR.defaultbase]
1256
        sub     eax, [esi+DLLDESCR.defaultbase]
1255
        add     eax, [img_base]
1257
        add     eax, [img_base]
1256
        sti
1258
        sti
1257
        ret
1259
        ret
-
 
1260
 
1258
.fail_and_free_data:
1261
.fail_and_free_data:
1259
        stdcall kernel_free, [esi+DLLDESCR.data]
1262
        stdcall kernel_free, [esi+DLLDESCR.data]
1260
.fail_and_free_dll:
1263
.fail_and_free_dll:
1261
        mov     eax, esi
1264
        mov     eax, esi
1262
        call    free
1265
        call    free
1263
.fail_and_free_coff:
1266
.fail_and_free_coff:
1264
        stdcall kernel_free, [coff]
1267
        stdcall kernel_free, [coff]
1265
.fail:
1268
.fail:
-
 
1269
        stdcall kernel_free, [fullname]
1266
        xor     eax, eax
1270
        xor     eax, eax
1267
        ret
1271
        ret
-
 
1272
 
1268
.fail_and_free_user:
1273
.fail_and_free_user:
1269
        stdcall user_free, [img_base]
1274
        stdcall user_free, [img_base]
1270
.fail_and_dereference:
1275
.fail_and_dereference:
1271
        mov     eax, 1  ; delete 1 reference
1276
        mov     eax, 1  ; delete 1 reference
1272
        call    dereference_dll
1277
        call    dereference_dll