Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1815 | yogev_ezra | 1 | ;08.05.2009 - bugfix |
2 | ;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory. |
||
3 | ; The macros for load any library/libraries: |
||
4 | ; Copyright (c) 2009, |
||
5 | ; All rights reserved. |
||
6 | ; |
||
7 | ; Redistribution and use in source and binary forms, with or without |
||
8 | ; modification, are permitted provided that the following conditions are met: |
||
9 | ; * Redistributions of source code must retain the above copyright |
||
10 | ; notice, this list of conditions and the following disclaimer. |
||
11 | ; * Redistributions in binary form must reproduce the above copyright |
||
12 | ; notice, this list of conditions and the following disclaimer in the |
||
13 | ; documentation and/or other materials provided with the distribution. |
||
14 | ; * Neither the name of the |
||
15 | ; names of its contributors may be used to endorse or promote products |
||
16 | ; derived from this software without specific prior written permission. |
||
17 | ; |
||
18 | ; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka |
||
19 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
20 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
21 | ; DISCLAIMED. IN NO EVENT SHALL |
||
22 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
23 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
24 | ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
25 | ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
26 | ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
27 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
28 | ;***************************************************************************** |
||
29 | ; This macros based on source code: |
||
30 | ; |
||
31 | ; Mario79, Mario - Marat Zakiyanov / Марат Закиянов |
||
32 | ; Diamondz - Evgeny Grechnikov / Евгений Гречников |
||
33 | ;------------------------ |
||
34 | ; DESCRIPTION |
||
35 | ; Macro load_library |
||
36 | ; Logick of work. |
||
37 | ; A first time we must to check system path, where I belive find a system library. System path is "/sys/lib/". |
||
38 | ; If I cannot found my library, i must to check second way. Second way is current dirrectory. |
||
39 | ; If we cannot load library, we must show the error message: |
||
40 | ; "I'm sorry,the programm cannot found system library box_lib.obj." |
||
41 | ; "The find was make on 2 ways: /sys/lib/ and current dirrectory." |
||
42 | ; |
||
43 | ; |
||
44 | ;--------------------------------------------------------------------- |
||
45 | ; Macro sys_load_library |
||
46 | ; A first time we must to check own path in current dirrectory the program, where I belive find a system library. |
||
47 | ; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/". |
||
48 | ; If we cannot load library, we must show the error message: |
||
49 | ; "I'm sorry,the programm cannot found system library box_lib.obj." |
||
50 | ; "The find was make on 2 ways: /sys/lib/ and current dirrectory." |
||
51 | ; |
||
52 | ;--------------------------------------------------------------------- |
||
53 | ; How can I use it? |
||
54 | ;--------------------------------------------------------------------- |
||
55 | ;-Example using single load library |
||
56 | ;-universal load library/librarys |
||
57 | ;load_library library_name__, cur_dir_path__, library_path__, system_path__, \ |
||
58 | ;err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__ |
||
59 | ;-if return code =-1 then exit, else normally work |
||
60 | ; cmp eax,-1 |
||
61 | ; jz exit |
||
62 | ;- Well, if you get |
||
63 | ; |
||
64 | ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
||
65 | ;DATA данные |
||
66 | ;Всегда соблюдать последовательность в имени. |
||
67 | ;system_path__ db '/sys/lib/' |
||
68 | ;library_name__ db 'box_lib.obj',0 |
||
69 | ; Если есть желание разъединить, то нужно использовать следующию конструкцию |
||
70 | ;system_path__ db '/sys/lib/box_lib.obj',0 |
||
71 | ;... любая последовательность других команд и определений. |
||
72 | ;library_name__ db 'box_lib.obj',0 |
||
73 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
74 | |||
75 | ;err_message_found_lib__ db 'Sorry I cannot found library box_lib.obj',0 |
||
76 | ;head_f_i__: |
||
77 | ;head_f_l__ db 'System error',0 |
||
78 | ;err_message_import__ db 'Error on load import library box_lib.obj',0 |
||
79 | |||
80 | ;myimport: |
||
81 | ; |
||
82 | ;edit_box_draw dd aEdit_box_draw |
||
83 | ;edit_box_key dd aEdit_box_key |
||
84 | ;edit_box_mouse dd aEdit_box_mouse |
||
85 | ;version_ed dd aVersion_ed |
||
86 | ; |
||
87 | ;check_box_draw dd aCheck_box_draw |
||
88 | ;check_box_mouse dd aCheck_box_mouse |
||
89 | ;version_ch dd aVersion_ch |
||
90 | ; |
||
91 | ;option_box_draw dd aOption_box_draw |
||
92 | ;option_box_mouse dd aOption_box_mouse |
||
93 | ;version_op dd aVersion_op |
||
94 | |||
95 | ; dd 0 |
||
96 | ; dd 0 |
||
97 | ; |
||
98 | ;aEdit_box_draw db 'edit_box',0 |
||
99 | ;aEdit_box_key db 'edit_box_key',0 |
||
100 | ;aEdit_box_mouse db 'edit_box_mouse',0 |
||
101 | ;aVersion_ed db 'version_ed',0 |
||
102 | |||
103 | ;aCheck_box_draw db 'check_box_draw',0 |
||
104 | ;aCheck_box_mouse db 'check_box_mouse',0 |
||
105 | ;aVersion_ch db 'version_ch',0 |
||
106 | |||
107 | ;aOption_box_draw db 'option_box_draw',0 |
||
108 | ;aOption_box_mouse db 'option_box_mouse',0 |
||
109 | ;aVersion_op db 'version_op',0 |
||
110 | |||
111 | ;--------------------------------------------------------------------- |
||
112 | macro @use_library |
||
113 | { |
||
114 | |||
115 | local __sc |
||
116 | local lp |
||
117 | local lp1 |
||
118 | local correction |
||
119 | ;local end_tr |
||
120 | local exit_ |
||
121 | ;/equ |
||
122 | err_message1 equ dword [esp+8] |
||
123 | head1 equ dword [esp+4] |
||
124 | |||
125 | |||
126 | __sc.frame equ dword [__sc+0] |
||
127 | __sc.grab equ dword [__sc+4] |
||
128 | __sc.grab_button equ dword [__sc+8] |
||
129 | __sc.grab_button_text equ dword [__sc+12] |
||
130 | __sc.grab_text equ dword [__sc+16] |
||
131 | __sc.work equ dword [__sc+20] |
||
132 | __sc.work_button equ dword [__sc+24] |
||
133 | __sc.work_button_text equ dword [__sc+28] |
||
134 | __sc.work_text equ dword [__sc+32] |
||
135 | __sc.work_graph equ dword [__sc+36] |
||
136 | |||
137 | ;;;;;;;;;;;CALC WIDTH & HIGHT WINDOW & CENTER MONITOR POSITION;;;;;;;;;; |
||
138 | show_err_: |
||
139 | ;check memory |
||
140 | push dword [arrea_xx] |
||
141 | pop eax |
||
142 | test eax,eax |
||
143 | jnz @f |
||
144 | |||
145 | mcall 68,11 |
||
146 | mcall 68,12,4096 |
||
147 | push eax |
||
148 | pop dword [arrea_xx] |
||
149 | |||
150 | push head1 |
||
151 | pop dword[eax] |
||
152 | |||
153 | push 0x0 |
||
154 | pop dword[eax+4] |
||
155 | |||
156 | @@: |
||
157 | mov eax,48 ;get system color |
||
158 | mov ebx,3 |
||
159 | mov ecx,__sc |
||
160 | mov edx,sizeof.system_colors |
||
161 | mcall |
||
162 | ;----------------------------------- |
||
163 | xor eax,eax |
||
164 | mov esi,err_message1 |
||
165 | mov ecx,30 |
||
166 | align 4 |
||
167 | lp: add ecx,7 |
||
168 | lodsb |
||
169 | test eax,eax |
||
170 | jnz lp |
||
171 | |||
172 | push dword [arrea_xx] |
||
173 | pop ebp |
||
174 | |||
175 | align 4 |
||
176 | @@: add ebp,4 |
||
177 | mov eax,dword [ebp] |
||
178 | |||
179 | test eax,eax |
||
180 | jnz @b |
||
181 | |||
182 | push err_message1 |
||
183 | pop dword[ebp] |
||
184 | |||
185 | mov dword [ebp+4],eax |
||
186 | |||
187 | mcall 48,5 ;get system window |
||
188 | cmp word[on_x],cx |
||
189 | jae @f; не нужно обновлять |
||
190 | |||
191 | sub eax,ecx |
||
192 | shl eax,15 |
||
193 | mov ax,cx |
||
194 | mov dword [on_x],eax |
||
195 | |||
196 | @@: |
||
197 | add word [on_y],12 |
||
198 | sub bx,word [on_y] |
||
199 | shl ebx,15 |
||
200 | mov bx,word [on_y] |
||
201 | mov dword [on_y],ebx |
||
202 | |||
203 | ret |
||
204 | |||
205 | |||
206 | ;;;;;;;;;;;DRAW WINDOW;;;;;;;;;;;;;; |
||
207 | align 4 |
||
208 | start__: |
||
209 | mcall 40,0x5 ;set mask on events rewraw window and get id button. |
||
210 | .red_win: |
||
211 | ;draw_window: |
||
212 | mcall 12,1 |
||
213 | |||
214 | xor eax,eax |
||
215 | mov ebp,dword [arrea_xx] ; set point |
||
216 | mov ebx,dword [on_x] |
||
217 | mov ecx,dword [on_y] |
||
218 | mov edx,__sc.work |
||
219 | or edx,0x33000000 |
||
220 | mov esi,__sc.grab_text |
||
221 | xor edi,edi |
||
222 | mov edi,dword [ebp] ;head1 |
||
223 | mcall |
||
224 | |||
225 | mov ebx,(10*65536+25-12) |
||
226 | add ebp,4 ;inc index |
||
227 | |||
228 | @@: |
||
229 | mov eax,4 |
||
230 | add bx,12 |
||
231 | mov ecx,__sc.grab_text |
||
232 | or ecx,0x90000000 |
||
233 | mov edx,dword [ebp] ;err_message1 |
||
234 | mcall |
||
235 | |||
236 | add ebp,4 ;inc index |
||
237 | |||
238 | mov eax,dword [ebp] |
||
239 | test eax,eax |
||
240 | jnz @b |
||
241 | |||
242 | mcall 12,2 |
||
243 | align 4 |
||
244 | |||
245 | .still: ;main loop |
||
246 | mcall 10 ;wait event |
||
247 | dec eax |
||
248 | jz .red_win |
||
249 | sub eax,2 |
||
250 | jnz .still ;go to main loop |
||
251 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
252 | .button: |
||
253 | mcall 17 ;get id button |
||
254 | test ah,ah ;if in ah 0, then go to still |
||
255 | jz .still |
||
256 | mcall -1 |
||
257 | ret |
||
258 | |||
259 | align 4 |
||
260 | __sc system_colors |
||
261 | on_x dd 0x0 |
||
262 | on_y dd 0x0000004E |
||
263 | arrea_xx dd 0x0 |
||
264 | rb 0x50 |
||
265 | end_tr: |
||
266 | |||
267 | ;--------------------------------------------------------------------- |
||
268 | @library_name equ dword [esp+12] |
||
269 | @cur_dir_path equ dword [esp+8] |
||
270 | @library_path equ dword [esp+4] |
||
271 | |||
272 | align 4 |
||
273 | @copy_path: |
||
274 | mov ebx,@library_name |
||
275 | mov esi,@cur_dir_path |
||
276 | mov edi,@library_path |
||
277 | |||
278 | xor eax,eax |
||
279 | cld |
||
280 | .lp1: |
||
281 | lodsb |
||
282 | stosb |
||
283 | test eax,eax |
||
284 | jnz .lp1 |
||
285 | mov esi,edi |
||
286 | |||
287 | std |
||
288 | .lp2: |
||
289 | lodsb |
||
290 | cmp al,'/' |
||
291 | jnz .lp2 |
||
292 | mov edi,esi |
||
293 | mov esi,ebx |
||
294 | add edi,2 |
||
295 | |||
296 | |||
297 | cld |
||
298 | .lp3: |
||
299 | lodsb |
||
300 | stosb |
||
301 | test eax,eax |
||
302 | jnz .lp3 |
||
303 | ;--------------------------------------------------------------------- |
||
304 | ret |
||
305 | } |
||
306 | |||
307 | |||
308 | |||
309 | 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__ |
||
310 | { |
||
311 | local end_steep |
||
312 | local exit |
||
313 | ;--------------------------------------------------------------------- |
||
314 | ; loading Box_Lib library |
||
315 | |||
316 | mcall 68,19,system_path__ ; load of sys directory |
||
317 | test eax,eax |
||
318 | jnz end_steep |
||
319 | |||
320 | copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library |
||
321 | |||
322 | mcall 68,19,library_path__ ; load of alternative |
||
323 | test eax,eax |
||
324 | jnz end_steep |
||
325 | show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window |
||
326 | jmp exit |
||
327 | |||
328 | |||
329 | align 4 |
||
330 | end_steep: |
||
331 | |||
332 | import_boxlib myimport, err_message_import__, head_f_i__ ;import |
||
333 | exit: |
||
334 | test eax,eax |
||
335 | jz @f |
||
336 | |||
337 | mcall 51,1,start__,end_tr ; создаем новый поток по шаблону |
||
338 | or eax,-1 |
||
339 | @@: |
||
340 | |||
341 | ;--------------------------------------------------------------------- |
||
342 | } |
||
343 | |||
344 | |||
345 | 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__ |
||
346 | { |
||
347 | local end_steep |
||
348 | local exit |
||
349 | ;--------------------------------------------------------------------- |
||
350 | ; loading Box_Lib library |
||
351 | |||
352 | copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library |
||
353 | |||
354 | mcall 68,19,library_path__ ; load of alternative |
||
355 | test eax,eax |
||
356 | jnz end_steep |
||
357 | |||
358 | mcall 68,19,system_path__ ; load of sys directory |
||
359 | test eax,eax |
||
360 | jnz end_steep |
||
361 | |||
362 | show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window |
||
363 | jmp exit |
||
364 | |||
365 | align 4 |
||
366 | end_steep: |
||
367 | |||
368 | import_boxlib myimport, err_message_import__, head_f_i__ ;import |
||
369 | exit: |
||
370 | test eax,eax |
||
371 | jz @f |
||
372 | |||
373 | mcall 51,1,start__,end_tr ; создаем новый поток по шаблону |
||
374 | or eax,-1 |
||
375 | @@: |
||
376 | |||
377 | ;--------------------------------------------------------------------- |
||
378 | } |
||
379 | macro sys_load_libraries _start,_end |
||
380 | { |
||
381 | local exit_lp2 |
||
382 | local lp2 |
||
383 | local lp |
||
384 | local end_steep |
||
385 | local next |
||
386 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
387 | library_name__ equ [ebp] |
||
388 | cur_dir_path__ equ [ebp+4] |
||
389 | library_path__ equ [ebp+8] |
||
390 | system_path__ equ [ebp+12] |
||
391 | err_message_found_lib__ equ [ebp+16] |
||
392 | head_f_l__ equ [ebp+20] |
||
393 | my_import equ [ebp+24] |
||
394 | err_message_import__ equ [ebp+28] |
||
395 | head_f_i__ equ [ebp+32] |
||
396 | adr_load_lib equ dword [ebp+36] |
||
397 | status_lib equ dword [ebp+40] |
||
398 | |||
399 | mov ebp,_start |
||
400 | mov ecx,((_end-_start)/ll_struc_size) |
||
401 | |||
402 | align 4 |
||
403 | lp: push ecx |
||
404 | mcall 68,19,system_path__ ; load of sys directory |
||
405 | test eax,eax |
||
406 | jnz end_steep |
||
407 | |||
408 | copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library |
||
409 | |||
410 | mcall 68,19,library_path__ ; load of alternative |
||
411 | test eax,eax |
||
412 | jnz end_steep |
||
413 | |||
414 | or status_lib,0x1 ; status of code - enable error - not found library |
||
415 | |||
416 | show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window |
||
417 | jmp next |
||
418 | |||
419 | align 4 |
||
420 | end_steep: |
||
421 | mov adr_load_lib,eax ;save adr lib in memory |
||
422 | import_boxlib my_import, err_message_import__, head_f_i__ ;import |
||
423 | |||
424 | test eax,eax |
||
425 | jz next |
||
426 | |||
427 | or status_lib,0x2 ; status of code - enable error - import error |
||
428 | |||
429 | next: |
||
430 | pop ecx |
||
431 | add ebp,ll_struc_size |
||
432 | dec ecx |
||
433 | jnz lp |
||
434 | |||
435 | ;---------------------------------- |
||
436 | mov ebp,_start |
||
437 | mov ecx,((_end-_start)/ll_struc_size) |
||
438 | |||
439 | align 4 |
||
440 | lp2: |
||
441 | mov eax,status_lib |
||
442 | test eax,eax |
||
443 | jz @f |
||
444 | |||
445 | mcall 51,1,start__,end_tr ; создаем новый поток по шаблону |
||
446 | or eax,-1 |
||
447 | jmp exit_lp2 |
||
448 | |||
449 | @@: |
||
450 | add ebp,ll_struc_size |
||
451 | dec ecx |
||
452 | jnz lp2 |
||
453 | exit_lp2: |
||
454 | } |
||
455 | |||
456 | macro load_libraries _start,_end |
||
457 | { |
||
458 | local lp2 |
||
459 | local exit_lp2 |
||
460 | local lp |
||
461 | local end_steep |
||
462 | local next |
||
463 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
464 | library_name__ equ [ebp] |
||
465 | cur_dir_path__ equ [ebp+4] |
||
466 | library_path__ equ [ebp+8] |
||
467 | system_path__ equ [ebp+12] |
||
468 | err_message_found_lib__ equ [ebp+16] |
||
469 | head_f_l__ equ [ebp+20] |
||
470 | my_import equ [ebp+24] |
||
471 | err_message_import__ equ [ebp+28] |
||
472 | head_f_i__ equ [ebp+32] |
||
473 | adr_load_lib equ dword [ebp+36] |
||
474 | status_lib equ dword [ebp+40] |
||
475 | |||
476 | mov ebp,_start |
||
477 | mov ecx,((_end-_start)/ll_struc_size) |
||
478 | |||
479 | align 4 |
||
480 | lp: push ecx |
||
481 | |||
482 | copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library |
||
483 | |||
484 | mcall 68,19,library_path__ ; load of alternative |
||
485 | test eax,eax |
||
486 | jnz end_steep |
||
487 | |||
488 | mcall 68,19,system_path__ ; load of sys directory |
||
489 | test eax,eax |
||
490 | jnz end_steep |
||
491 | |||
492 | or status_lib,0x1 ; status of code - enable error - not found library |
||
493 | |||
494 | show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window |
||
495 | jmp next |
||
496 | |||
497 | align 4 |
||
498 | end_steep: |
||
499 | mov adr_load_lib,eax ;save adr lib in memory |
||
500 | |||
501 | import_boxlib my_import, err_message_import__, head_f_i__ ;import |
||
502 | |||
503 | test eax,eax |
||
504 | jz next |
||
505 | |||
506 | or status_lib,0x2 ; status of code - enable error - import error |
||
507 | |||
508 | next: |
||
509 | pop ecx |
||
510 | add ebp,ll_struc_size |
||
511 | dec ecx |
||
512 | jnz lp |
||
513 | |||
514 | ;----------------------------------------------- |
||
515 | mov ebp,_start |
||
516 | mov ecx,((_end-_start)/ll_struc_size) |
||
517 | |||
518 | align 4 |
||
519 | lp2: |
||
520 | mov eax,status_lib |
||
521 | test eax,eax |
||
522 | jz @f |
||
523 | |||
524 | mcall 51,1,start__,end_tr ; создаем новый поток по шаблону |
||
525 | or eax,-1 |
||
526 | jmp exit_lp2 |
||
527 | |||
528 | @@: |
||
529 | add ebp,ll_struc_size |
||
530 | dec ecx |
||
531 | jnz lp2 |
||
532 | exit_lp2: |
||
533 | |||
534 | } |
||
535 | |||
536 | |||
537 | macro copy_path lib_name,dir_path,lib_path |
||
538 | { |
||
539 | pushad ;save all registers |
||
540 | push dword lib_name |
||
541 | push dword dir_path |
||
542 | push dword lib_path |
||
543 | |||
544 | call @copy_path |
||
545 | |||
546 | add esp,12 |
||
547 | popad ;restore all registers |
||
548 | } |
||
549 | |||
550 | macro show_error_window err_message, head |
||
551 | { pushad ;save all registers |
||
552 | push dword err_message |
||
553 | push dword head |
||
554 | |||
555 | call show_err_ |
||
556 | |||
557 | add esp,8 |
||
558 | popad ;restore all registers |
||
559 | or eax,-1 ;увы |
||
560 | } |
||
561 | |||
562 | |||
563 | macro import_boxlib myimport, err_message_import__, head_f_i__ |
||
564 | { |
||
565 | local import_loop |
||
566 | local import_find |
||
567 | local lp |
||
568 | local import_find_next |
||
569 | local import_found |
||
570 | local import_done |
||
571 | local exit |
||
572 | local e.exit |
||
573 | local import_not_found |
||
574 | ; initialize import |
||
575 | |||
576 | mov edx, eax |
||
577 | mov esi,myimport |
||
578 | import_loop: |
||
579 | lodsd |
||
580 | test eax, eax |
||
581 | jz import_done |
||
582 | push edx |
||
583 | import_find: |
||
584 | mov ebx, [ds:edx] |
||
585 | test ebx, ebx |
||
586 | jz import_not_found |
||
587 | push eax |
||
588 | lp: |
||
589 | mov cl, [ds:eax] |
||
590 | cmp cl, [ds:ebx] |
||
591 | jnz import_find_next |
||
592 | test cl, cl |
||
593 | jz import_found |
||
594 | inc eax |
||
595 | inc ebx |
||
596 | jmp lp |
||
597 | import_find_next: |
||
598 | pop eax |
||
599 | add edx, 8 |
||
600 | jmp import_find |
||
601 | import_found: |
||
602 | pop eax |
||
603 | mov eax, [ds:edx+4] |
||
604 | mov [esi-4], eax |
||
605 | pop edx |
||
606 | jmp import_loop |
||
607 | import_not_found: |
||
608 | add esp,4 |
||
609 | show_error_window err_message_import__, head_f_i__ ;show error message /create window |
||
610 | jmp e.exit |
||
611 | import_done: |
||
612 | xor eax,eax |
||
613 | e.exit: |
||
614 | ;--------------------------------------------------------------------- |
||
615 | } |
||
616 | ll_struc_size = 44;($-library_name__) ; constant size of struct |
||
617 | 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 |
||
618 | { |
||
619 | .library_name__ dd library_name__ ; имя загружаемой библиотеки |
||
620 | .cur_dir_path__ dd cur_dir_path__ ; указатель на буфер в котором содержиться путь от куда была запущена программа |
||
621 | |||
622 | .library_path__ dd library_path__ ; указатель на буфер в котором будет софоримирован путь к библиотеки, если нужно вычислить путь до либы с места запуска программы, обычно нужно, в случаях, если либа расположена в той же папке |
||
623 | .complete_path dd system_path__ ; путь который четко содержит путь |
||
624 | |||
625 | .err_message_found_lib__ dd err_message_found_lib__ |
||
626 | .head_f_l__ dd head_f_l__ |
||
627 | .my_import dd my_import |
||
628 | .err_message_import__ dd err_message_import__ |
||
629 | .head_f_i__ dd head_f_i__ |
||
630 | |||
631 | .adr_load_lib dd 0x0 |
||
632 | .status_lib dd 0x0 ;status of load library |
||
633 | ; |
||
634 | } |