Subversion Repositories Kolibri OS

Rev

Rev 1488 | Rev 5881 | 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.  
  117. local lp
  118. local lp1
  119. local file_name
  120.  
  121. library_fun_memory_alloc equ 0 ;­¥ ¨á¯®«ì§®¢ âì ¢ ¬ ªà®á å ¯à®¢¥àªã ­  ä㭪樨 'lib_init'
  122.  
  123. align 4
  124. arrea_xx dd 0
  125. file_name db '/rd/1/@notify',0
  126.  
  127. align 4
  128. run_notify_struct:
  129.         .Function dd 7
  130.         .Position dd 0
  131.         .Flags dd ?
  132.         .Count dd 0
  133.         .Buffer dd 0
  134.                 db 0
  135.         .FileName dd file_name
  136. ;---------------------------------------------------------------------
  137.  
  138. @library_name     equ    dword [esp+16]
  139. @cur_dir_path     equ    dword [esp+12]
  140. @library_path     equ    dword [esp+8]
  141. @point_dir_name   equ    dword [esp+4]
  142.  
  143. align 4
  144. @copy_path:
  145. ;        mov     ebx,@library_name
  146.         mov     esi,@cur_dir_path
  147.         mov     edi,@library_path
  148.  
  149.         xor     eax,eax
  150.         cld
  151. align 4
  152. .lp1:
  153.         lodsb
  154.         stosb
  155.         test    eax,eax
  156.         jnz     .lp1
  157.         mov     esi,edi
  158.  
  159.         std
  160. align 4
  161. .lp2:
  162.         lodsb
  163.         cmp     al,'/'
  164.         jnz     .lp2
  165.         mov     edi,esi
  166.  
  167.         add     edi,2
  168.         cld
  169. ;       mov     esi,@library_name
  170.  
  171.         mov     esi,@point_dir_name
  172.         test    esi,esi
  173.         jz      .str_lp4
  174.  
  175. align 4
  176. .lp3:
  177.         lodsb
  178.         stosb
  179.         test    eax,eax
  180.         jnz     .lp3
  181.  
  182.  
  183.         dec     edi
  184. .str_lp4:
  185.         mov     esi,@library_name
  186. align 4
  187. .lp4:
  188.         lodsb
  189.         stosb
  190.         test    eax,eax
  191.         jnz     .lp4
  192. ;---------------------------------------------------------------------
  193.         ret
  194. }
  195.  
  196.  
  197.  
  198. macro @use_library_mem mem_alloc,mem_free,mem_realloc,dll_load
  199. {
  200. @use_library
  201. library_fun_memory_alloc equ mem_alloc
  202. library_fun_memory_free equ mem_free
  203. library_fun_memory_realloc equ mem_realloc
  204. library_fun_dll_load equ dll_load
  205. }
  206.  
  207.  
  208. 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__
  209. {
  210. local end_steep
  211. local exit
  212. ;---------------------------------------------------------------------  
  213. ; loading Box_Lib library
  214.  
  215.         mcall   68,19,system_path__   ; load of sys directory
  216.         test    eax,eax
  217.         jnz     end_steep
  218.  
  219. if point_dir_name__ eq
  220.   copy_path   library_name__, cur_dir_path__, library_path__,0x0
  221. else
  222.   copy_path   library_name__, cur_dir_path__, library_path__,point_dir_name__    ;the macros making way /current pach a program/+ name system library
  223. end if
  224.        
  225.         mcall   68,19,library_path__ ; load of alternative
  226.         test    eax,eax
  227.         jnz     end_steep
  228.         show_error_window  err_message_found_lib__, head_f_l__    ;show error message /create window
  229.         jmp     exit
  230.  
  231.  
  232. align 4
  233. end_steep:
  234.  
  235.         import_boxlib myimport, err_message_import__, head_f_i__  ;import
  236. exit:
  237.         test    eax,eax
  238.         jz      @f
  239.  
  240.         notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
  241.         or      eax,-1
  242. @@:    
  243.  
  244. ;---------------------------------------------------------------------
  245. }
  246.  
  247.  
  248. 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__
  249. {
  250. local end_steep
  251. local exit
  252. ;---------------------------------------------------------------------  
  253. ; loading Box_Lib library
  254.  
  255. if point_dir_name__ eq
  256.   copy_path   library_name__, cur_dir_path__, library_path__,0x0
  257. else
  258.   copy_path   library_name__, cur_dir_path__, library_path__,point_dir_name__    ;the macros making way /current pach a program/+ name system library
  259. end if
  260.  
  261.         mcall   68,19,library_path__ ; load of alternative
  262.         test    eax,eax
  263.         jnz     end_steep
  264.        
  265.         mcall   68,19,system_path__ ; load of sys directory
  266.         test    eax,eax
  267.         jnz     end_steep
  268.  
  269.         show_error_window  err_message_found_lib__, head_f_l__    ;show error message /create window
  270.         jmp     exit
  271.  
  272. align 4
  273. end_steep:
  274.  
  275.         import_boxlib myimport, err_message_import__, head_f_i__  ;import
  276. exit:
  277.         test    eax,eax
  278.         jz      @f
  279.  
  280.         notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
  281.         or      eax,-1
  282. @@:    
  283.        
  284. ;---------------------------------------------------------------------
  285. }
  286. macro sys_load_libraries _start,_end
  287. {
  288. local exit_lp2
  289. local lp2
  290. local lp
  291. local end_steep
  292. local next
  293. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  294. library_name__            equ [ebp]
  295. cur_dir_path__            equ [ebp+4]
  296. library_path__            equ [ebp+8]
  297. system_path__             equ [ebp+12]
  298. err_message_found_lib__   equ [ebp+16]  
  299. head_f_l__                equ [ebp+20]
  300. my_import                 equ [ebp+24]
  301. err_message_import__      equ [ebp+28]
  302. head_f_i__                equ [ebp+32]
  303. point_dir_name__          equ [ebp+36]
  304. adr_load_lib              equ dword [ebp+40]
  305. status_lib                equ dword [ebp+44]
  306.  
  307.         mov     ebp,_start
  308.         mov     ecx,((_end-_start)/ll_struc_size)
  309.  
  310. align 4
  311. lp:     push    ecx
  312.         mcall   68,19,system_path__   ; load of sys directory
  313.         test    eax,eax
  314.         jnz     end_steep
  315.  
  316.         copy_path  library_name__, cur_dir_path__, library_path__,point_dir_name__     ;the macros making way /current pach a program/+ name system library
  317.        
  318.         mcall   68,19,library_path__ ; load of alternative
  319.         test    eax,eax
  320.         jnz     end_steep
  321.  
  322.         or      status_lib,0x1          ; status of code - enable error - not found library
  323.  
  324.         show_error_window  err_message_found_lib__, head_f_l__,    ;show error message /create window
  325.         jmp      next
  326.  
  327. align 4
  328. end_steep:
  329.         mov     adr_load_lib,eax        ;save adr lib in memory
  330.         import_boxlib my_import, err_message_import__, head_f_i__  ;import
  331.  
  332.         test    eax,eax
  333.         jz      next
  334.  
  335.         or      status_lib,0x2          ; status of code - enable error - import error
  336.  
  337. next:
  338.         pop     ecx
  339.         add     ebp,ll_struc_size
  340.         dec     ecx
  341.         jnz     lp
  342.  
  343. ;----------------------------------
  344.         mov     ebp,_start
  345.         mov     ecx,((_end-_start)/ll_struc_size)
  346.  
  347. align 4
  348. lp2:
  349.         mov     eax,status_lib
  350.         test    eax,eax
  351.         jz      @f
  352.  
  353.         notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
  354.         or      eax,-1
  355.         jmp     exit_lp2
  356.  
  357. @@:
  358.         add     ebp,ll_struc_size
  359.         dec     ecx
  360.         jnz     lp2
  361. exit_lp2:
  362. }
  363.  
  364. macro load_libraries _start,_end
  365. {
  366. local lp2
  367. local exit_lp2
  368. local lp
  369. local end_steep
  370. local next
  371. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  372. library_name__            equ [ebp]
  373. cur_dir_path__            equ [ebp+4]
  374. library_path__            equ [ebp+8]
  375. system_path__             equ [ebp+12]
  376. err_message_found_lib__   equ [ebp+16]  
  377. head_f_l__                equ [ebp+20]
  378. my_import                 equ [ebp+24]
  379. err_message_import__      equ [ebp+28]
  380. head_f_i__                equ [ebp+32]
  381. point_dir_name__          equ [ebp+36]
  382. adr_load_lib              equ dword [ebp+40]
  383. status_lib                equ dword [ebp+44]
  384.  
  385.         mov     ebp,_start
  386.         mov     ecx,((_end-_start)/ll_struc_size)
  387.  
  388. align 4
  389. lp:     push    ecx
  390.  
  391.         copy_path    library_name__, cur_dir_path__, library_path__,point_dir_name__   ;the macros making way /current pach a program/+ name system library
  392.  
  393.         mcall   68,19,library_path__  ; load of alternative
  394.         test    eax,eax
  395.         jnz     end_steep
  396.        
  397.         mcall   68,19,system_path__   ; load of sys directory
  398.         test    eax,eax
  399.         jnz     end_steep
  400.  
  401.         or      status_lib,0x1          ; status of code - enable error - not found library
  402.  
  403.         show_error_window  err_message_found_lib__, head_f_l__    ;show error message /create window
  404.         jmp      next
  405.  
  406. align 4
  407. end_steep:
  408.         mov     adr_load_lib,eax        ;save adr lib in memory
  409.  
  410.         import_boxlib my_import, err_message_import__, head_f_i__  ;import
  411.  
  412.         test    eax,eax
  413.         jz      next
  414.  
  415.         or      status_lib,0x2          ; status of code - enable error - import error
  416.  
  417. next:
  418.         pop     ecx
  419.         add     ebp,ll_struc_size
  420.         dec     ecx
  421.         jnz     lp
  422.  
  423. ;-----------------------------------------------
  424.         mov     ebp,_start
  425.         mov     ecx,((_end-_start)/ll_struc_size)
  426.  
  427. align 4
  428. lp2:
  429.         mov     eax,status_lib
  430.         test    eax,eax
  431.         jz      @f
  432.  
  433.         notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
  434.         or      eax,-1
  435.         jmp     exit_lp2
  436.  
  437. @@:
  438.         add     ebp,ll_struc_size
  439.         dec     ecx
  440.         jnz     lp2
  441. exit_lp2:
  442.  
  443. }
  444.  
  445.  
  446. macro copy_path lib_name,dir_path,lib_path,point_dir_name
  447. {
  448.         pushad  ;save all registers
  449.         push    dword lib_name
  450.         push    dword dir_path
  451.         push    dword lib_path
  452.         push    dword point_dir_name
  453.         call    @copy_path
  454.  
  455.         add     esp,16
  456.         popad   ;restore all registers
  457. }
  458.  
  459. ; £®â®¢¨¬ ⥪áâ ¤«ï ¯®ª §  ç¥à¥§ @notify:
  460. ; 1) ¢ë¤¥«ï¥¬ ¯ ¬ïâì ¢ [arrea_xx]
  461. ; 2) ª®¯¨à㥬 err_message ¨ head ¢ [arrea_xx]
  462. macro show_error_window  err_message, head
  463. {
  464. local lp0
  465. local lp1
  466.  
  467. pushad
  468.         mcall 68,11
  469.         mcall 68,12,4096
  470.         push eax
  471.         pop dword [arrea_xx]
  472.  
  473.         mov edi,eax
  474.         mov esi,dword head
  475.         cld
  476. align 4
  477. lp0:
  478.         movsb
  479.         cmp byte[esi],0
  480.         jne lp0
  481.         mov word[edi],'. '
  482.         add edi,2
  483.         mov esi,dword err_message
  484. align 4
  485. lp1:
  486.         movsb
  487.         cmp byte[esi],0
  488.         jne lp1
  489.         mov byte[edi],0
  490. popad
  491.         or eax,-1  ;ã¢ë
  492. }
  493.  
  494. ; ¢ª«îç ¥¬ ¯®ª § á®®¡é¥­¨ï ç¥à¥§ @notify:
  495. macro notify_window_run message
  496. {
  497. push eax ebx
  498.         mov eax,message ;¯ à ¬¥âàë ¤«ï ª®¬ ­¤­®© áâப¨
  499.         mov [run_notify_struct.Flags], eax
  500.         mov eax,70 ;run @notify
  501.         mov ebx,run_notify_struct
  502.         int 0x40
  503. pop ebx eax
  504. }
  505.  
  506.  
  507. ;¢å®¤­ë¥ ¯ à ¬¥âàë:
  508. ;eax -  ¤à¥á ¡¨¡«¨®â¥ª¨ ¢ ¯ ¬ïâ¨
  509. ;myimport - ¨¬¯®àâ¨àã¥¬ë¥ ä㭪樨
  510. macro import_boxlib myimport, err_message_import__, head_f_i__
  511. {
  512. local import_loop
  513. local import_find
  514. local lp
  515. local import_find_next
  516. local import_found
  517. local import_done
  518. local exit
  519. local e.exit
  520. local import_not_found
  521. ; initialize import
  522.        
  523.         mov     edx, eax
  524.         mov     esi,myimport
  525. import_loop:
  526.         lodsd   ;mov eax,dword[esi] ;add esi,4 ;¯®«ãç ¥¬ ¢ eax 㪠§ â¥«ì ­  ¨¬ï ¨¬¯®àâ¨à㥬®© ä㭪樨
  527.         test    eax, eax
  528.         jz      import_done ;¥á«¨ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 = 0 (¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥)
  529.         push    edx ;á®å࠭塞 ­ ç «® ¡¨¡«¨®â¥ç­ëå 㪠§ â¥«¥© ­  ä㭪樨
  530. import_find:
  531.         mov     ebx, [ds:edx]
  532.         test    ebx, ebx
  533.         jz      import_not_found ;¥á«¨ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 = 0 (¢ ¡¨¡«¨®â¥ª¥)
  534.         push    eax ;eax - 㪠§ â¥«ì ­  ¨¬ï íªá¯®àâ¨à㥬®© ä㭪樨 (¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥)
  535. lp:
  536.         mov     cl, [ds:eax]
  537.         cmp     cl, [ds:ebx] ;áà ¢­¨¢ ¥¬ ¨¬¥­  ä㭪権 ¢ ¡¨¡«¨®â¥ª¥ ¨ ¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥
  538.         jnz     import_find_next ;¥á«¨ ­ §¢ ­¨ï ­¥ ᮢ¯ «¨
  539.         test    cl, cl
  540.         jz      import_found ;¥á«¨ ­ §¢ ­¨ï ᮢ¯ «¨, ¨ 㦥 ª®­¥æ áâப¨ (cl=0)
  541.         inc     eax
  542.         inc     ebx
  543.         jmp     lp
  544. import_find_next:
  545.         pop     eax
  546.         add     edx, 8 ;8 = 4 ¡ ©â  㪠§ â¥«ì ­  ­ §¢ ­¨¥ ¨ 4 ¡ ©â  㪠§ â¥«ì ­  äã­ªæ¨î
  547.         jmp     import_find
  548. import_found:
  549.         pop     ebx ;¢®áâ ­ ¢«¨¢ ¥¬ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 (ª®â®àë© ¡ë« ¢ eax) ¨ ®á¢®¡®¦¤ ¥¬ á⥪
  550.         mov     eax, [ds:edx+4] ;eax = 㪠§ â¥«ì ­  äã­ªæ¨î (¢ ¡¨¡«¨®â¥ª¥)
  551.         mov     [esi-4], eax ;ª®¯¨à㥬 㪠§ â¥«ì (­  äã­ªæ¨î) ¢ ¯à®£à ¬¬ã, -4 áâ ¢¨¬ ¯®â®¬ã çâ® esi ¡ë«® ᤢ¨­ãâ® ª®¬ ­¤®© lodsd
  552.         pop     edx ;ãáâ ­ ¢«¨¢ ¥¬ edx ­  ­ ç «® ¡¨¡«¨®â¥ç­ëå ä㭪権
  553. ;--- ¯à®¢¥à塞 ᮢ¯ ¤ ¥â «¨ ¨¬ï íªá¯®àâ¨à®¢ ­­®© ä㭪樨 á 'lib_init'
  554. if library_fun_memory_alloc eq 0
  555. else
  556.                 cmp dword[ebx],'lib_'
  557.                 jne             import_loop
  558.                 cmp dword[ebx+4],'init'
  559.                 jne             import_loop
  560. ;--- ¥á«¨ ¨¬ï ä㭪樨 ᮢ¯ «® á 'lib_init' ¯®¯ ¤ ¥¬ á
  561.                 ;¯®¤ª«î祭¨¥ ä㭪権 ¤«ï à ¡®âë á ¯ ¬ïâìî
  562.                 ;push eax
  563.                 ;call dll.Init
  564.                 pushad
  565.                 mov esi,eax
  566.                 mov     eax,library_fun_memory_alloc
  567.                 mov     ebx,library_fun_memory_free
  568.                 mov     ecx,library_fun_memory_realloc
  569.                 mov     edx,library_fun_dll_load
  570.                 call dword esi
  571.                 popad
  572. end if
  573.         jmp     import_loop
  574. import_not_found:
  575.         add     esp,4
  576.         show_error_window  err_message_import__, head_f_i__    ;show error message /create window
  577.         jmp     e.exit
  578. import_done:
  579.         xor     eax,eax ;=0 ¢á¥ § £à㧨«®áì 㤠筮
  580. e.exit:
  581. ;---------------------------------------------------------------------
  582. }
  583. ll_struc_size = 48;($-library_name__)    ; constant   size of struct
  584. 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
  585. {        
  586. .library_name__           dd library_name__        ; ¨¬ï § £à㦠¥¬®© ¡¨¡«¨®â¥ª¨
  587. .cur_dir_path__           dd cur_dir_path__        ; 㪠§ â¥«ì ­  ¡ãä¥à ¢ ª®â®à®¬ ᮤ¥à¦¨âìáï ¯ãâì ®â ªã¤  ¡ë«  § ¯ã饭  ¯à®£à ¬¬ 
  588.                        
  589. .library_path__           dd library_path__        ; 㪠§ â¥«ì ­  ¡ãä¥à ¢ ª®â®à®¬ ¡ã¤¥â á®ä®à¨¬¨à®¢ ­ ¯ãâì ª ¡¨¡«¨®â¥ª¨, ¥á«¨ ­ã¦­® ¢ëç¨á«¨âì ¯ãâì ¤® «¨¡ë á ¬¥áâ  § ¯ã᪠ ¯à®£à ¬¬ë, ®¡ëç­® ­ã¦­®, ¢ á«ãç ïå, ¥á«¨ «¨¡  à á¯®«®¦¥­  ¢ ⮩ ¦¥ ¯ ¯ª¥
  590. .complete_path            dd system_path__         ; ¯ãâì ª®â®àë© ç¥âª® ᮤ¥à¦¨â ¯ãâì
  591.  
  592. .err_message_found_lib__  dd err_message_found_lib__
  593. .head_f_l__               dd head_f_l__
  594. .my_import                dd my_import
  595. .err_message_import__     dd err_message_import__
  596. .head_f_i__               dd head_f_i__
  597. if point_dir_name eq
  598. .point_dir_name__       dd 0x0
  599. else
  600. .point_dir_name__       dd point_dir_name          ; ¨¬ï ¢«®¦¥­­®© ¤¨à४â®à¨¨ ¢ ªâ®à®© åà ­ïâìáï ¯®¤£à㦠¥¬ë¥ ¬®¤ã«¨.
  601. end if
  602. .adr_load_lib           dd 0x0
  603. .status_lib             dd 0x0          ;status of load library
  604. ;
  605. }
  606.