Subversion Repositories Kolibri OS

Rev

Rev 1488 | Rev 4987 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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