Subversion Repositories Kolibri OS

Rev

Rev 3374 | Rev 6245 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;13.03.2013 - use @notify
  2. ;08.06.2010 - new macros @use_library_mem
  3. ;08.05.2009 - bugfix
  4. ;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory.
  5. ; The macros for load any library/libraries:
  6. ; Copyright (c) 2009, <Lrz>
  7. ; All rights reserved.
  8. ;
  9. ; Redistribution and use in source and binary forms, with or without
  10. ; modification, are permitted provided that the following conditions are met:
  11. ;       * Redistributions of source code must retain the above copyright
  12. ;       notice, this list of conditions and the following disclaimer.
  13. ;       * Redistributions in binary form must reproduce the above copyright
  14. ;       notice, this list of conditions and the following disclaimer in the
  15. ;       documentation and/or other materials provided with the distribution.
  16. ;       * Neither the name of the <organization> nor the
  17. ;       names of its contributors may be used to endorse or promote products
  18. ;       derived from this software without specific prior written permission.
  19. ;
  20. ; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
  21. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  22. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  24. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  25. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  26. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  27. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. ;*****************************************************************************
  31. ; This macros based on source code:
  32. ; <Lrz> - Alexey Teplov / €«¥ªá¥© ’¥¯«®¢
  33. ; Mario79, Mario - Marat Zakiyanov / Œ à â ‡ ª¨ï­®¢
  34. ; Diamondz - Evgeny Grechnikov / …¢£¥­¨© ƒà¥ç­¨ª®¢
  35. ;------------------------
  36. ; DESCRIPTION
  37. ; Macro load_library
  38. ; Logick of work.
  39. ; A first time we must to check system path, where I belive find a system library. System path is "/sys/lib/".
  40. ; If I cannot found my library, i must to check second way. Second way is current dirrectory.
  41. ; If we cannot load library, we must show the error message:
  42. ; "I'm sorry,the programm cannot found system library box_lib.obj."
  43. ; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
  44. ;
  45. ;
  46. ;---------------------------------------------------------------------
  47. ; Macro sys_load_library
  48. ; A first time we must to check own path in current dirrectory the program, where I belive find a system library.
  49. ; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/".
  50. ; If we cannot load library, we must show the error message:
  51. ; "I'm sorry,the programm cannot found system library box_lib.obj."
  52. ; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
  53. ;
  54. ;---------------------------------------------------------------------
  55. ; How can I use it?
  56. ;---------------------------------------------------------------------
  57. ;-Example using single load library
  58. ;-universal load library/librarys
  59. ;load_library  library_name__, cur_dir_path__, library_path__, system_path__, \
  60. ;err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__
  61. ;-if return code =-1 then exit, else normally work
  62. ;        cmp     eax,-1
  63. ;        jz      exit
  64. ;- Well, if you get
  65. ;
  66. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  67. ;DATA ¤ ­­ë¥
  68. ;‚ᥣ¤  ᮡ«î¤ âì ¯®á«¥¤®¢ â¥«ì­®áâì ¢ ¨¬¥­¨.
  69. ;system_path__      db '/sys/lib/'
  70. ;library_name__     db 'box_lib.obj',0
  71. ; …᫨ ¥áâì ¦¥« ­¨¥ ࠧꥤ¨­¨âì, â® ­ã¦­® ¨á¯®«ì§®¢ âì á«¥¤ãîé¨î ª®­áâàãªæ¨î
  72. ;system_path__      db '/sys/lib/box_lib.obj',0
  73. ;... «î¡ ï ¯®á«¥¤®¢ â¥«ì­®áâì ¤àã£¨å ª®¬ ­¤ ¨ ®¯à¥¤¥«¥­¨©.
  74. ;library_name__     db 'box_lib.obj',0
  75. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  76.  
  77. ;err_message_found_lib__   db 'Sorry I cannot found library box_lib.obj',0
  78. ;head_f_i__:
  79. ;head_f_l__        db 'System error',0
  80. ;err_message_import__      db 'Error on load import library box_lib.obj',0
  81.  
  82. ;myimport:  
  83. ;
  84. ;edit_box_draw   dd      aEdit_box_draw
  85. ;edit_box_key    dd      aEdit_box_key
  86. ;edit_box_mouse  dd      aEdit_box_mouse
  87. ;version_ed      dd      aVersion_ed
  88. ;
  89. ;check_box_draw  dd      aCheck_box_draw
  90. ;check_box_mouse dd      aCheck_box_mouse
  91. ;version_ch      dd      aVersion_ch
  92. ;
  93. ;option_box_draw  dd      aOption_box_draw
  94. ;option_box_mouse dd      aOption_box_mouse
  95. ;version_op       dd      aVersion_op
  96.  
  97. ;                dd      0
  98. ;                dd      0
  99. ;
  100. ;aEdit_box_draw  db 'edit_box',0
  101. ;aEdit_box_key   db 'edit_box_key',0
  102. ;aEdit_box_mouse db 'edit_box_mouse',0
  103. ;aVersion_ed     db 'version_ed',0
  104.  
  105. ;aCheck_box_draw  db 'check_box_draw',0
  106. ;aCheck_box_mouse db 'check_box_mouse',0
  107. ;aVersion_ch      db 'version_ch',0
  108.  
  109. ;aOption_box_draw  db 'option_box_draw',0
  110. ;aOption_box_mouse db 'option_box_mouse',0
  111. ;aVersion_op       db 'version_op',0
  112.  
  113. ;---------------------------------------------------------------------
  114. macro @use_library
  115. {
  116. local lp1
  117. local lp2
  118. local lp3
  119. local lp4
  120. local file_name
  121.  
  122. library_fun_memory_alloc equ 0 ;­¥ ¨á¯®«ì§®¢ âì ¢ ¬ ªà®á å ¯à®¢¥àªã ­  ä㭪樨 'lib_init'
  123.  
  124. align 4
  125. arrea_xx dd 0
  126. file_name db '/rd/1/@notify',0
  127.  
  128. align 4
  129. run_notify_struct:
  130.         .Function dd 7
  131.         .Position dd 0
  132.         .Flags dd ?
  133.         .Count dd 0
  134.         .Buffer dd 0
  135.                 db 0
  136.         .FileName dd file_name
  137. ;---------------------------------------------------------------------
  138.  
  139. @library_name     equ    dword [esp+16]
  140. @cur_dir_path     equ    dword [esp+12]
  141. @library_path     equ    dword [esp+8]
  142. @point_dir_name   equ    dword [esp+4]
  143.  
  144. align 4
  145. @copy_path:
  146. ;        mov     ebx,@library_name
  147.         mov     esi,@cur_dir_path
  148.         mov     edi,@library_path
  149.  
  150.         xor     eax,eax
  151.         cld
  152. align 4
  153. .lp1:
  154.         lodsb
  155.         stosb
  156.         test    eax,eax
  157.         jnz     .lp1
  158.         mov     esi,edi
  159.  
  160.         std
  161. align 4
  162. .lp2:
  163.         lodsb
  164.         cmp     al,'/'
  165.         jnz     .lp2
  166.         mov     edi,esi
  167.  
  168.         add     edi,2
  169.         cld
  170. ;       mov     esi,@library_name
  171.  
  172.         mov     esi,@point_dir_name
  173.         test    esi,esi
  174.         jz      .str_lp4
  175.  
  176. align 4
  177. .lp3:
  178.         lodsb
  179.         stosb
  180.         test    eax,eax
  181.         jnz     .lp3
  182.  
  183.  
  184.         dec     edi
  185. .str_lp4:
  186.         mov     esi,@library_name
  187. align 4
  188. .lp4:
  189.         lodsb
  190.         stosb
  191.         test    eax,eax
  192.         jnz     .lp4
  193. ;---------------------------------------------------------------------
  194.         ret
  195. }
  196.  
  197.  
  198.  
  199. macro @use_library_mem mem_alloc,mem_free,mem_realloc,dll_load
  200. {
  201. @use_library
  202. library_fun_memory_alloc equ mem_alloc
  203. library_fun_memory_free equ mem_free
  204. library_fun_memory_realloc equ mem_realloc
  205. library_fun_dll_load equ dll_load
  206. }
  207.  
  208.  
  209. 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__
  210. {
  211. local end_steep
  212. local exit
  213. ;---------------------------------------------------------------------  
  214. ; loading Box_Lib library
  215.  
  216.         mcall   68,19,system_path__   ; load of sys directory
  217.         test    eax,eax
  218.         jnz     end_steep
  219.  
  220. if point_dir_name__ eq
  221.   copy_path   library_name__, cur_dir_path__, library_path__,0x0
  222. else
  223.   copy_path   library_name__, cur_dir_path__, library_path__,point_dir_name__    ;the macros making way /current pach a program/+ name system library
  224. end if
  225.        
  226.         mcall   68,19,library_path__ ; load of alternative
  227.         test    eax,eax
  228.         jnz     end_steep
  229.         show_error_window  err_message_found_lib__, head_f_l__    ;show error message /create window
  230.         jmp     exit
  231.  
  232.  
  233. align 4
  234. end_steep:
  235.  
  236.         import_boxlib myimport, err_message_import__, head_f_i__  ;import
  237. exit:
  238.         test    eax,eax
  239.         jz      @f
  240.  
  241.         notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
  242.         or      eax,-1
  243. @@:    
  244.  
  245. ;---------------------------------------------------------------------
  246. }
  247.  
  248.  
  249. 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__
  250. {
  251. local end_steep
  252. local exit
  253. ;---------------------------------------------------------------------  
  254. ; loading Box_Lib library
  255.  
  256. if point_dir_name__ eq
  257.   copy_path   library_name__, cur_dir_path__, library_path__,0x0
  258. else
  259.   copy_path   library_name__, cur_dir_path__, library_path__,point_dir_name__    ;the macros making way /current pach a program/+ name system library
  260. end if
  261.  
  262.         mcall   68,19,library_path__ ; load of alternative
  263.         test    eax,eax
  264.         jnz     end_steep
  265.        
  266.         mcall   68,19,system_path__ ; load of sys directory
  267.         test    eax,eax
  268.         jnz     end_steep
  269.  
  270.         show_error_window  err_message_found_lib__, head_f_l__    ;show error message /create window
  271.         jmp     exit
  272.  
  273. align 4
  274. end_steep:
  275.  
  276.         import_boxlib myimport, err_message_import__, head_f_i__  ;import
  277. exit:
  278.         test    eax,eax
  279.         jz      @f
  280.  
  281.         notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
  282.         or      eax,-1
  283. @@:    
  284.        
  285. ;---------------------------------------------------------------------
  286. }
  287. macro sys_load_libraries _start,_end
  288. {
  289. local exit_lp2
  290. local lp2
  291. local lp
  292. local end_steep
  293. local next
  294. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  295. library_name__            equ [ebp]
  296. cur_dir_path__            equ [ebp+4]
  297. library_path__            equ [ebp+8]
  298. system_path__             equ [ebp+12]
  299. err_message_found_lib__   equ [ebp+16]  
  300. head_f_l__                equ [ebp+20]
  301. my_import                 equ [ebp+24]
  302. err_message_import__      equ [ebp+28]
  303. head_f_i__                equ [ebp+32]
  304. point_dir_name__          equ [ebp+36]
  305. adr_load_lib              equ dword [ebp+40]
  306. status_lib                equ dword [ebp+44]
  307.  
  308.         mov     ebp,_start
  309.         mov     ecx,((_end-_start)/ll_struc_size)
  310.  
  311. align 4
  312. lp:     push    ecx
  313.         mcall   68,19,system_path__   ; load of sys directory
  314.         test    eax,eax
  315.         jnz     end_steep
  316.  
  317.         copy_path  library_name__, cur_dir_path__, library_path__,point_dir_name__     ;the macros making way /current pach a program/+ name system library
  318.        
  319.         mcall   68,19,library_path__ ; load of alternative
  320.         test    eax,eax
  321.         jnz     end_steep
  322.  
  323.         or      status_lib,0x1          ; status of code - enable error - not found library
  324.  
  325.         show_error_window  err_message_found_lib__, head_f_l__,    ;show error message /create window
  326.         jmp      next
  327.  
  328. align 4
  329. end_steep:
  330.         mov     adr_load_lib,eax        ;save adr lib in memory
  331.         import_boxlib my_import, err_message_import__, head_f_i__  ;import
  332.  
  333.         test    eax,eax
  334.         jz      next
  335.  
  336.         or      status_lib,0x2          ; status of code - enable error - import error
  337.  
  338. next:
  339.         pop     ecx
  340.         add     ebp,ll_struc_size
  341.         dec     ecx
  342.         jnz     lp
  343.  
  344. ;----------------------------------
  345.         mov     ebp,_start
  346.         mov     ecx,((_end-_start)/ll_struc_size)
  347.  
  348. align 4
  349. lp2:
  350.         mov     eax,status_lib
  351.         test    eax,eax
  352.         jz      @f
  353.  
  354.         notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
  355.         or      eax,-1
  356.         jmp     exit_lp2
  357.  
  358. @@:
  359.         add     ebp,ll_struc_size
  360.         dec     ecx
  361.         jnz     lp2
  362. exit_lp2:
  363. }
  364.  
  365. macro load_libraries _start,_end
  366. {
  367. local lp2
  368. local exit_lp2
  369. local lp
  370. local end_steep
  371. local next
  372. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  373. library_name__            equ [ebp]
  374. cur_dir_path__            equ [ebp+4]
  375. library_path__            equ [ebp+8]
  376. system_path__             equ [ebp+12]
  377. err_message_found_lib__   equ [ebp+16]  
  378. head_f_l__                equ [ebp+20]
  379. my_import                 equ [ebp+24]
  380. err_message_import__      equ [ebp+28]
  381. head_f_i__                equ [ebp+32]
  382. point_dir_name__          equ [ebp+36]
  383. adr_load_lib              equ dword [ebp+40]
  384. status_lib                equ dword [ebp+44]
  385.  
  386.         mov     ebp,_start
  387.         mov     ecx,((_end-_start)/ll_struc_size)
  388.  
  389. align 4
  390. lp:     push    ecx
  391.  
  392.         copy_path    library_name__, cur_dir_path__, library_path__,point_dir_name__   ;the macros making way /current pach a program/+ name system library
  393.  
  394.         mcall   68,19,library_path__  ; load of alternative
  395.         test    eax,eax
  396.         jnz     end_steep
  397.        
  398.         mcall   68,19,system_path__   ; load of sys directory
  399.         test    eax,eax
  400.         jnz     end_steep
  401.  
  402.         or      status_lib,0x1          ; status of code - enable error - not found library
  403.  
  404.         show_error_window  err_message_found_lib__, head_f_l__    ;show error message /create window
  405.         jmp      next
  406.  
  407. align 4
  408. end_steep:
  409.         mov     adr_load_lib,eax        ;save adr lib in memory
  410.  
  411.         import_boxlib my_import, err_message_import__, head_f_i__  ;import
  412.  
  413.         test    eax,eax
  414.         jz      next
  415.  
  416.         or      status_lib,0x2          ; status of code - enable error - import error
  417.  
  418. next:
  419.         pop     ecx
  420.         add     ebp,ll_struc_size
  421.         dec     ecx
  422.         jnz     lp
  423.  
  424. ;-----------------------------------------------
  425.         mov     ebp,_start
  426.         mov     ecx,((_end-_start)/ll_struc_size)
  427.  
  428. align 4
  429. lp2:
  430.         mov     eax,status_lib
  431.         test    eax,eax
  432.         jz      @f
  433.  
  434.         notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
  435.         or      eax,-1
  436.         jmp     exit_lp2
  437.  
  438. @@:
  439.         add     ebp,ll_struc_size
  440.         dec     ecx
  441.         jnz     lp2
  442. exit_lp2:
  443.  
  444. }
  445.  
  446.  
  447. macro copy_path lib_name,dir_path,lib_path,point_dir_name
  448. {
  449.         pushad  ;save all registers
  450.         push    dword lib_name
  451.         push    dword dir_path
  452.         push    dword lib_path
  453.         push    dword point_dir_name
  454.         call    @copy_path
  455.  
  456.         add     esp,16
  457.         popad   ;restore all registers
  458. }
  459.  
  460. ; £®â®¢¨¬ ⥪áâ ¤«ï ¯®ª §  ç¥à¥§ @notify:
  461. ; 1) ¢ë¤¥«ï¥¬ ¯ ¬ïâì ¢ [arrea_xx]
  462. ; 2) ª®¯¨à㥬 err_message ¨ head ¢ [arrea_xx]
  463. macro show_error_window  err_message, head
  464. {
  465. local lp0
  466. local lp1
  467.  
  468. pushad
  469.         mcall 68,11
  470.         mcall 68,12,4096
  471.         push eax
  472.         pop dword [arrea_xx]
  473.  
  474.         mov edi,eax
  475.         mov esi,dword head
  476.         cld
  477. align 4
  478. lp0:
  479.         movsb
  480.         cmp byte[esi],0
  481.         jne lp0
  482.         mov word[edi],'. '
  483.         add edi,2
  484.         mov esi,dword err_message
  485. align 4
  486. lp1:
  487.         movsb
  488.         cmp byte[esi],0
  489.         jne lp1
  490.         mov byte[edi],0
  491. popad
  492.         or eax,-1  ;ã¢ë
  493. }
  494.  
  495. ; ¢ª«îç ¥¬ ¯®ª § á®®¡é¥­¨ï ç¥à¥§ @notify:
  496. macro notify_window_run message
  497. {
  498. push eax ebx
  499.         mov eax,message ;¯ à ¬¥âàë ¤«ï ª®¬ ­¤­®© áâப¨
  500.         mov [run_notify_struct.Flags], eax
  501.         mov eax,70 ;run @notify
  502.         mov ebx,run_notify_struct
  503.         int 0x40
  504. pop ebx eax
  505. }
  506.  
  507.  
  508. ;¢å®¤­ë¥ ¯ à ¬¥âàë:
  509. ;eax -  ¤à¥á ¡¨¡«¨®â¥ª¨ ¢ ¯ ¬ïâ¨
  510. ;myimport - ¨¬¯®àâ¨àã¥¬ë¥ ä㭪樨
  511. macro import_boxlib myimport, err_message_import__, head_f_i__
  512. {
  513. local import_loop
  514. local import_find
  515. local lp
  516. local import_find_next
  517. local import_found
  518. local import_done
  519. local exit
  520. local e.exit
  521. local import_not_found
  522. ; initialize import
  523.        
  524.         mov     edx, eax
  525.         mov     esi,myimport
  526. import_loop:
  527.         lodsd   ;mov eax,dword[esi] ;add esi,4 ;¯®«ãç ¥¬ ¢ eax 㪠§ â¥«ì ­  ¨¬ï ¨¬¯®àâ¨à㥬®© ä㭪樨
  528.         test    eax, eax
  529.         jz      import_done ;¥á«¨ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 = 0 (¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥)
  530.         push    edx ;á®å࠭塞 ­ ç «® ¡¨¡«¨®â¥ç­ëå 㪠§ â¥«¥© ­  ä㭪樨
  531. import_find:
  532.         mov     ebx, [ds:edx]
  533.         test    ebx, ebx
  534.         jz      import_not_found ;¥á«¨ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 = 0 (¢ ¡¨¡«¨®â¥ª¥)
  535.         push    eax ;eax - 㪠§ â¥«ì ­  ¨¬ï íªá¯®àâ¨à㥬®© ä㭪樨 (¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥)
  536. lp:
  537.         mov     cl, [ds:eax]
  538.         cmp     cl, [ds:ebx] ;áà ¢­¨¢ ¥¬ ¨¬¥­  ä㭪権 ¢ ¡¨¡«¨®â¥ª¥ ¨ ¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥
  539.         jnz     import_find_next ;¥á«¨ ­ §¢ ­¨ï ­¥ ᮢ¯ «¨
  540.         test    cl, cl
  541.         jz      import_found ;¥á«¨ ­ §¢ ­¨ï ᮢ¯ «¨, ¨ 㦥 ª®­¥æ áâப¨ (cl=0)
  542.         inc     eax
  543.         inc     ebx
  544.         jmp     lp
  545. import_find_next:
  546.         pop     eax
  547.         add     edx, 8 ;8 = 4 ¡ ©â  㪠§ â¥«ì ­  ­ §¢ ­¨¥ ¨ 4 ¡ ©â  㪠§ â¥«ì ­  äã­ªæ¨î
  548.         jmp     import_find
  549. import_found:
  550.         pop     ebx ;¢®áâ ­ ¢«¨¢ ¥¬ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 (ª®â®àë© ¡ë« ¢ eax) ¨ ®á¢®¡®¦¤ ¥¬ á⥪
  551.         mov     eax, [ds:edx+4] ;eax = 㪠§ â¥«ì ­  äã­ªæ¨î (¢ ¡¨¡«¨®â¥ª¥)
  552.         mov     [esi-4], eax ;ª®¯¨à㥬 㪠§ â¥«ì (­  äã­ªæ¨î) ¢ ¯à®£à ¬¬ã, -4 áâ ¢¨¬ ¯®â®¬ã çâ® esi ¡ë«® ᤢ¨­ãâ® ª®¬ ­¤®© lodsd
  553.         pop     edx ;ãáâ ­ ¢«¨¢ ¥¬ edx ­  ­ ç «® ¡¨¡«¨®â¥ç­ëå ä㭪権
  554. ;--- ¯à®¢¥à塞 ᮢ¯ ¤ ¥â «¨ ¨¬ï íªá¯®àâ¨à®¢ ­­®© ä㭪樨 á 'lib_init'
  555. if library_fun_memory_alloc eq 0
  556. else
  557.                 cmp dword[ebx],'lib_'
  558.                 jne             import_loop
  559.                 cmp dword[ebx+4],'init'
  560.                 jne             import_loop
  561. ;--- ¥á«¨ ¨¬ï ä㭪樨 ᮢ¯ «® á 'lib_init' ¯®¯ ¤ ¥¬ á
  562.                 ;¯®¤ª«î祭¨¥ ä㭪権 ¤«ï à ¡®âë á ¯ ¬ïâìî
  563.                 ;push eax
  564.                 ;call dll.Init
  565.                 pushad
  566.                 mov esi,eax
  567.                 mov     eax,library_fun_memory_alloc
  568.                 mov     ebx,library_fun_memory_free
  569.                 mov     ecx,library_fun_memory_realloc
  570.                 mov     edx,library_fun_dll_load
  571.                 call dword esi
  572.                 popad
  573. end if
  574.         jmp     import_loop
  575. import_not_found:
  576.         add     esp,4
  577.         show_error_window  err_message_import__, head_f_i__    ;show error message /create window
  578.         jmp     e.exit
  579. import_done:
  580.         xor     eax,eax ;=0 ¢á¥ § £à㧨«®áì 㤠筮
  581. e.exit:
  582. ;---------------------------------------------------------------------
  583. }
  584. ll_struc_size = 48;($-library_name__)    ; constant   size of struct
  585. 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
  586. {        
  587. .library_name__           dd library_name__        ; ¨¬ï § £à㦠¥¬®© ¡¨¡«¨®â¥ª¨
  588. .cur_dir_path__           dd cur_dir_path__        ; 㪠§ â¥«ì ­  ¡ãä¥à ¢ ª®â®à®¬ ᮤ¥à¦¨âìáï ¯ãâì ®â ªã¤  ¡ë«  § ¯ã饭  ¯à®£à ¬¬ 
  589.                        
  590. .library_path__           dd library_path__        ; 㪠§ â¥«ì ­  ¡ãä¥à ¢ ª®â®à®¬ ¡ã¤¥â á®ä®à¨¬¨à®¢ ­ ¯ãâì ª ¡¨¡«¨®â¥ª¨, ¥á«¨ ­ã¦­® ¢ëç¨á«¨âì ¯ãâì ¤® «¨¡ë á ¬¥áâ  § ¯ã᪠ ¯à®£à ¬¬ë, ®¡ëç­® ­ã¦­®, ¢ á«ãç ïå, ¥á«¨ «¨¡  à á¯®«®¦¥­  ¢ ⮩ ¦¥ ¯ ¯ª¥
  591. .complete_path            dd system_path__         ; ¯ãâì ª®â®àë© ç¥âª® ᮤ¥à¦¨â ¯ãâì
  592.  
  593. .err_message_found_lib__  dd err_message_found_lib__
  594. .head_f_l__               dd head_f_l__
  595. .my_import                dd my_import
  596. .err_message_import__     dd err_message_import__
  597. .head_f_i__               dd head_f_i__
  598. if point_dir_name eq
  599. .point_dir_name__       dd 0x0
  600. else
  601. .point_dir_name__       dd point_dir_name          ; ¨¬ï ¢«®¦¥­­®© ¤¨à४â®à¨¨ ¢ ªâ®à®© åà ­ïâìáï ¯®¤£à㦠¥¬ë¥ ¬®¤ã«¨.
  602. end if
  603. .adr_load_lib           dd 0x0
  604. .status_lib             dd 0x0          ;status of load library
  605. ;
  606. }
  607.