Rev 4607 | Rev 7449 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4607 | Rev 5146 | ||
---|---|---|---|
1 | ; Search Additional Partition for KolibriOS applications |
1 | ; Search Additional Partition for KolibriOS applications |
2 | ; |
2 | ; |
3 | ; Copyright (c) 2013-2014, Marat Zakiyanov aka Mario79, aka Mario |
3 | ; Copyright (c) 2013-2014, Marat Zakiyanov aka Mario79, aka Mario |
4 | ; All rights reserved. |
4 | ; All rights reserved. |
5 | ; |
5 | ; |
6 | ; Redistribution and use in source and binary forms, with or without |
6 | ; Redistribution and use in source and binary forms, with or without |
7 | ; modification, are permitted provided that the following conditions are met: |
7 | ; modification, are permitted provided that the following conditions are met: |
8 | ; * Redistributions of source code must retain the above copyright |
8 | ; * Redistributions of source code must retain the above copyright |
9 | ; notice, this list of conditions and the following disclaimer. |
9 | ; notice, this list of conditions and the following disclaimer. |
10 | ; * Redistributions in binary form must reproduce the above copyright |
10 | ; * Redistributions in binary form must reproduce the above copyright |
11 | ; notice, this list of conditions and the following disclaimer in the |
11 | ; notice, this list of conditions and the following disclaimer in the |
12 | ; documentation and/or other materials provided with the distribution. |
12 | ; documentation and/or other materials provided with the distribution. |
13 | ; * Neither the name of the |
13 | ; * Neither the name of the |
14 | ; names of its contributors may be used to endorse or promote products |
14 | ; names of its contributors may be used to endorse or promote products |
15 | ; derived from this software without specific prior written permission. |
15 | ; derived from this software without specific prior written permission. |
16 | ; |
16 | ; |
17 | ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY |
17 | ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY |
18 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
20 | ; DISCLAIMED. IN NO EVENT SHALL |
20 | ; DISCLAIMED. IN NO EVENT SHALL |
21 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 | ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 | ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
26 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | ;***************************************************************************** |
27 | ;***************************************************************************** |
28 | use32 |
28 | use32 |
29 | org 0x0 |
29 | org 0x0 |
30 | 30 | ||
31 | db 'MENUET01' |
31 | db 'MENUET01' |
32 | dd 0x01 |
32 | dd 0x01 |
33 | dd START |
33 | dd START |
34 | dd IM_END |
34 | dd IM_END |
35 | dd I_END |
35 | dd I_END |
36 | dd stacktop |
36 | dd stacktop |
37 | dd 0x0 |
37 | dd 0x0 |
38 | dd 0x0 |
38 | dd 0x0 |
39 | ;--------------------------------------------------------------------- |
39 | ;--------------------------------------------------------------------- |
40 | fileinfo: |
40 | fileinfo: |
41 | .subfunction dd 5 |
41 | .subfunction dd 5 |
42 | .Offset dd 0 |
42 | .Offset dd 0 |
43 | .Offset_1 dd 0 |
43 | .Offset_1 dd 0 |
44 | .size dd 0 |
44 | .size dd 0 |
45 | .return dd folder_data |
45 | .return dd folder_data |
46 | db 0 |
46 | db 0 |
47 | .name: dd basic_file_path |
47 | .name: dd basic_file_path |
48 | ;--------------------------------------------------------------------- |
48 | ;--------------------------------------------------------------------- |
49 | read_folder: |
49 | read_folder: |
50 | .subfunction dd 1 |
50 | .subfunction dd 1 |
51 | .start dd 0 |
51 | .start dd 0 |
52 | .flags dd 0 |
52 | .flags dd 0 |
53 | .size dd 32 |
53 | .size dd 32 |
54 | .return dd folder_data |
54 | .return dd folder_data |
55 | db 0 |
55 | db 0 |
56 | .name: dd read_folder_name |
56 | .name: dd read_folder_name |
57 | ;--------------------------------------------------------------------- |
57 | ;--------------------------------------------------------------------- |
58 | read_folder_1: |
58 | read_folder_1: |
59 | .subfunction dd 1 |
59 | .subfunction dd 1 |
60 | .start dd 0 |
60 | .start dd 0 |
61 | .flags dd 0 |
61 | .flags dd 0 |
62 | .size dd 32 |
62 | .size dd 32 |
63 | .return dd folder_data_1 |
63 | .return dd folder_data_1 |
64 | db 0 |
64 | db 0 |
65 | .name: dd read_folder_1_name |
65 | .name: dd read_folder_1_name |
66 | ;--------------------------------------------------------------------- |
66 | ;--------------------------------------------------------------------- |
67 | start_dir: |
67 | start_dir: |
68 | db '/',0 |
68 | db '/',0 |
69 | ;------------------------------------------------------------------------------- |
69 | ;------------------------------------------------------------------------------- |
70 | basic_file_path: |
70 | basic_file_path: |
71 | db '/sys/settings/' |
71 | db '/sys/settings/' |
72 | basic_file_name: |
72 | basic_file_name: |
73 | db 'kolibri.lbl',0 |
73 | db 'kolibri.lbl',0 |
74 | additional_dir_name: |
74 | additional_dir_name: |
75 | db 'kolibrios',0 |
75 | db 'kolibrios',0 |
76 | real_additional_dir: |
76 | real_additional_dir: |
77 | db '/kolibrios',0 |
77 | db '/kolibrios',0 |
78 | ;------------------------------------------------------------------------------- |
78 | ;------------------------------------------------------------------------------- |
79 | include '../../macros.inc' |
79 | include '../../macros.inc' |
80 | 80 | ||
81 | define __DEBUG__ 1 |
81 | define __DEBUG__ 1 |
82 | define __DEBUG_LEVEL__ 2 ; 1 = verbose, 2 = main only |
82 | define __DEBUG_LEVEL__ 2 ; 1 = verbose, 2 = main only |
83 | include "../../debug-fdo.inc" |
83 | include "../../debug-fdo.inc" |
84 | ;------------------------------------------------------------------------------- |
84 | ;------------------------------------------------------------------------------- |
85 | START: |
85 | START: |
86 | mcall 5,500 |
86 | mcall 5,500 |
87 | mov ebx,start_dir |
87 | mov ebx,start_dir |
88 | mov ax,[ebx] |
88 | mov ax,[ebx] |
89 | mov ebx,read_folder_name |
89 | mov ebx,read_folder_name |
90 | mov [ebx],ax |
90 | mov [ebx],ax |
91 | mov ebx,read_folder_1_name |
91 | mov ebx,read_folder_1_name |
92 | mov [ebx],ax |
92 | mov [ebx],ax |
93 | call device_detect_f70 |
93 | call device_detect_f70 |
94 | ;-------------------------------------- |
94 | ;-------------------------------------- |
95 | call print_retrieved_devices_table |
95 | call print_retrieved_devices_table |
96 | DEBUGF 1, "Searchap: get basic file\n" |
96 | DEBUGF 1, "Searchap: get basic file\n" |
97 | ;-------------------------------------- |
97 | ;-------------------------------------- |
98 | call load_file ; download the master file |
98 | call load_file ; download the master file |
99 | xor eax,eax |
99 | xor eax,eax |
100 | cmp [fs_error],eax |
100 | cmp [fs_error],eax |
101 | jne exit |
101 | jne exit |
102 | mov eax,[fileinfo.size] |
102 | mov eax,[fileinfo.size] |
103 | mov [basic_file_size],eax |
103 | mov [basic_file_size],eax |
104 | 104 | ||
105 | call search_and_load_pointer_file_label |
105 | call search_and_load_pointer_file_label |
106 | ;--------------------------------------------------------------------- |
106 | ;--------------------------------------------------------------------- |
107 | exit: |
107 | exit: |
108 | ;-------------------------------------- |
108 | ;-------------------------------------- |
109 | DEBUGF 1, "Searchap: just exit\n" |
109 | DEBUGF 1, "Searchap: just exit\n" |
110 | ;-------------------------------------- |
110 | ;-------------------------------------- |
111 | mcall -1 |
111 | mcall -1 |
112 | ;--------------------------------------------------------------------- |
112 | ;--------------------------------------------------------------------- |
113 | device_detect_f70: |
113 | device_detect_f70: |
114 | ;-------------------------------------- |
114 | ;-------------------------------------- |
115 | DEBUGF 1, "Searchap: read_folder_name: %s\n",read_folder_name |
115 | DEBUGF 1, "Searchap: read_folder_name: %s\n",read_folder_name |
116 | ;-------------------------------------- |
116 | ;-------------------------------------- |
117 | mcall 70,read_folder |
117 | mcall 70,read_folder |
118 | test eax,eax |
118 | test eax,eax |
119 | jz @f |
119 | jz @f |
120 | cmp eax,6 |
120 | cmp eax,6 |
121 | je @f |
121 | je @f |
122 | ;-------------------------------------- |
122 | ;-------------------------------------- |
123 | DEBUGF 1, "Searchap: read_folder_error\n" |
123 | DEBUGF 1, "Searchap: read_folder_error\n" |
124 | ;-------------------------------------- |
124 | ;-------------------------------------- |
125 | jmp exit |
125 | jmp exit |
126 | @@: |
126 | @@: |
127 | ;-------------------------------------- |
127 | ;-------------------------------------- |
128 | call print_root_dir |
128 | call print_root_dir |
129 | ;-------------------------------------- |
129 | ;-------------------------------------- |
130 | mov [left_folder_block],ebx |
130 | mov [left_folder_block],ebx |
131 | xor eax,eax |
131 | xor eax,eax |
132 | mov [temp_counter_1],eax |
132 | mov [temp_counter_1],eax |
133 | mov [retrieved_devices_table_counter],eax |
133 | mov [retrieved_devices_table_counter],eax |
134 | .start_temp_counter_1: |
134 | .start_temp_counter_1: |
135 | imul esi,[temp_counter_1],304 |
135 | imul esi,[temp_counter_1],304 |
136 | add esi,[read_folder.return] |
136 | add esi,[read_folder.return] |
137 | add esi,32+40 |
137 | add esi,32+40 |
138 | call copy_folder_name_1 |
138 | call copy_folder_name_1 |
139 | ;-------------------------------------- |
139 | ;-------------------------------------- |
140 | DEBUGF 1, "Searchap: read_folder_1_name: %s\n",read_folder_1_name |
140 | DEBUGF 1, "Searchap: read_folder_1_name: %s\n",read_folder_1_name |
141 | ;-------------------------------------- |
141 | ;-------------------------------------- |
142 | mcall 70,read_folder_1 |
142 | mcall 70,read_folder_1 |
143 | test eax,eax |
143 | test eax,eax |
144 | jz @f |
144 | jz @f |
145 | cmp eax,6 |
145 | cmp eax,6 |
146 | je @f |
146 | je @f |
147 | ;-------------------------------------- |
147 | ;-------------------------------------- |
148 | DEBUGF 1, "Searchap: read_folder_error_1\n" |
148 | DEBUGF 1, "Searchap: read_folder_error_1\n" |
149 | ;-------------------------------------- |
149 | ;-------------------------------------- |
150 | jmp exit |
150 | jmp exit |
151 | @@: |
151 | @@: |
152 | mov eax,[read_folder_1.return] |
152 | mov eax,[read_folder_1.return] |
153 | cmp [eax+4],dword 0 |
153 | cmp [eax+4],dword 0 |
154 | je .continue |
154 | je .continue |
155 | mov [right_folder_block],ebx |
155 | mov [right_folder_block],ebx |
156 | xor ebp,ebp |
156 | xor ebp,ebp |
157 | .start_copy_device_patch: |
157 | .start_copy_device_patch: |
158 | imul edi,[retrieved_devices_table_counter],10 |
158 | imul edi,[retrieved_devices_table_counter],10 |
159 | add edi,retrieved_devices_table |
159 | add edi,retrieved_devices_table |
160 | mov [edi],byte '/' |
160 | mov [edi],byte '/' |
161 | inc edi |
161 | inc edi |
162 | imul esi,[temp_counter_1],304 |
162 | imul esi,[temp_counter_1],304 |
163 | add esi,[read_folder.return] |
163 | add esi,[read_folder.return] |
164 | add esi,32+40 |
164 | add esi,32+40 |
165 | call proc_copy_patch |
165 | call proc_copy_patch |
166 | imul esi,ebp,304 |
166 | imul esi,ebp,304 |
167 | add esi,[read_folder_1.return] |
167 | add esi,[read_folder_1.return] |
168 | add esi,32+40 |
168 | add esi,32+40 |
169 | mov [edi-1],byte '/' |
169 | mov [edi-1],byte '/' |
170 | call proc_copy_patch |
170 | call proc_copy_patch |
171 | inc [retrieved_devices_table_counter] |
171 | inc [retrieved_devices_table_counter] |
172 | inc ebp |
172 | inc ebp |
173 | cmp ebp,[right_folder_block] |
173 | cmp ebp,[right_folder_block] |
174 | jb .start_copy_device_patch |
174 | jb .start_copy_device_patch |
175 | .continue: |
175 | .continue: |
176 | inc [temp_counter_1] |
176 | inc [temp_counter_1] |
177 | mov eax,[temp_counter_1] |
177 | mov eax,[temp_counter_1] |
178 | cmp eax,[left_folder_block] |
178 | cmp eax,[left_folder_block] |
179 | jb .start_temp_counter_1 |
179 | jb .start_temp_counter_1 |
180 | mov esi,retrieved_devices_table+1 |
180 | mov esi,retrieved_devices_table+1 |
181 | call copy_folder_name |
181 | call copy_folder_name |
182 | mov esi,retrieved_devices_table+3 |
182 | mov esi,retrieved_devices_table+3 |
183 | xor ecx,ecx |
183 | xor ecx,ecx |
184 | @@: |
184 | @@: |
185 | add esi,8 |
185 | add esi,8 |
186 | cld |
186 | cld |
187 | lodsw |
187 | lodsw |
188 | inc ecx |
188 | inc ecx |
189 | cmp ecx,[retrieved_devices_table_counter] |
189 | cmp ecx,[retrieved_devices_table_counter] |
190 | ja @f |
190 | ja @f |
191 | cmp ax,'hd' |
191 | cmp ax,'hd' |
192 | jne @r |
192 | jne @r |
193 | sub esi,2 |
193 | sub esi,2 |
194 | call copy_folder_name_1 |
194 | call copy_folder_name_1 |
195 | ret |
195 | ret |
196 | @@: |
196 | @@: |
197 | mov esi,retrieved_devices_table+1 |
197 | mov esi,retrieved_devices_table+1 |
198 | call copy_folder_name_1 |
198 | call copy_folder_name_1 |
199 | ret |
199 | ret |
200 | ;--------------------------------------------------------------------- |
200 | ;--------------------------------------------------------------------- |
201 | load_file: |
201 | load_file: |
202 | mov [fileinfo.subfunction],dword 5 |
202 | mov [fileinfo.subfunction],dword 5 |
203 | xor eax,eax |
203 | xor eax,eax |
204 | mov [fileinfo.size],eax |
204 | mov [fileinfo.size],eax |
205 | mov [fs_error],eax |
205 | mov [fs_error],eax |
206 | ;-------------------------------------- |
206 | ;-------------------------------------- |
207 | DEBUGF 1, "Searchap: get file info\n" |
207 | DEBUGF 1, "Searchap: get file info\n" |
208 | ;-------------------------------------- |
208 | ;-------------------------------------- |
209 | mcall 68,1 |
209 | mcall 68,1 |
210 | mcall 70,fileinfo |
210 | mcall 70,fileinfo |
211 | mov [fs_error],eax |
211 | mov [fs_error],eax |
212 | test eax,eax |
212 | test eax,eax |
213 | jnz .file_error |
213 | jnz .file_error |
214 | ;-------------------------------------- |
214 | ;-------------------------------------- |
215 | DEBUGF 1, "Searchap: file info ok\n" |
215 | DEBUGF 1, "Searchap: file info ok\n" |
216 | ;-------------------------------------- |
216 | ;-------------------------------------- |
217 | xor eax,eax |
217 | xor eax,eax |
218 | mov [fileinfo.subfunction],eax ;dword 0 |
218 | mov [fileinfo.subfunction],eax ;dword 0 |
219 | mov eax,[fileinfo.return] |
219 | mov eax,[fileinfo.return] |
220 | mov ecx,[eax+32] |
220 | mov ecx,[eax+32] |
221 | ;-------------------------------------- |
221 | ;-------------------------------------- |
222 | DEBUGF 1, "Searchap: real file size: %d\n",ecx |
222 | DEBUGF 1, "Searchap: real file size: %d\n",ecx |
223 | ;-------------------------------------- |
223 | ;-------------------------------------- |
224 | test ecx,ecx |
224 | test ecx,ecx |
225 | jz .file_error |
225 | jz .file_error |
226 | mov eax,304*32+32 ; 9 Kb |
226 | mov eax,304*32+32 ; 9 Kb |
227 | cmp ecx,eax |
227 | cmp ecx,eax |
228 | jbe @f |
228 | jbe @f |
229 | mov ecx,eax |
229 | mov ecx,eax |
230 | ;----------------------------------- |
230 | ;----------------------------------- |
231 | @@: |
231 | @@: |
232 | mov [fileinfo.size],ecx |
232 | mov [fileinfo.size],ecx |
233 | ;-------------------------------------- |
233 | ;-------------------------------------- |
234 | DEBUGF 1, "Searchap: get file\n" |
234 | DEBUGF 1, "Searchap: get file\n" |
235 | ;-------------------------------------- |
235 | ;-------------------------------------- |
236 | mcall 68,1 |
236 | mcall 68,1 |
237 | mcall 70,fileinfo |
237 | mcall 70,fileinfo |
238 | mov [fs_error],eax |
238 | mov [fs_error],eax |
239 | test eax,eax |
239 | test eax,eax |
240 | jz @f |
240 | jz @f |
241 | ; cmp eax,6 |
241 | ; cmp eax,6 |
242 | ; jne .file_error |
242 | ; jne .file_error |
243 | ; xor eax,eax |
243 | ; xor eax,eax |
244 | ; mov [fs_error],eax |
244 | ; mov [fs_error],eax |
245 | ; jmp @f |
245 | ; jmp @f |
246 | ;----------------------------------- |
246 | ;----------------------------------- |
247 | .file_error: |
247 | .file_error: |
248 | ;-------------------------------------- |
248 | ;-------------------------------------- |
249 | DEBUGF 1, "Searchap: read file - error!\n" |
249 | DEBUGF 1, "Searchap: read file - error!\n" |
250 | ;-------------------------------------- |
250 | ;-------------------------------------- |
251 | ret |
251 | ret |
252 | ;----------------------------------- |
252 | ;----------------------------------- |
253 | @@: |
253 | @@: |
254 | ;-------------------------------------- |
254 | ;-------------------------------------- |
255 | DEBUGF 1, "Searchap: read file corrected size: %d\n",[fileinfo.size] |
255 | DEBUGF 1, "Searchap: read file corrected size: %d\n",[fileinfo.size] |
256 | ;-------------------------------------- |
256 | ;-------------------------------------- |
257 | ret |
257 | ret |
258 | ;--------------------------------------------------------------------- |
258 | ;--------------------------------------------------------------------- |
259 | search_and_load_pointer_file_label: |
259 | search_and_load_pointer_file_label: |
260 | mov [fileinfo.return],dword folder_data_1 |
260 | mov [fileinfo.return],dword folder_data_1 |
261 | mov ecx,[retrieved_devices_table_counter] |
261 | mov ecx,[retrieved_devices_table_counter] |
262 | dec ecx ; /rd/1/ no need to check |
262 | dec ecx ; /rd/1/ no need to check |
263 | mov [fileinfo.name],dword read_folder_name |
263 | mov [fileinfo.name],dword read_folder_name |
264 | mov esi,retrieved_devices_table |
264 | mov esi,retrieved_devices_table |
265 | ; sub esi,10 ; deleted because /rd/1/ no need to check |
265 | ; sub esi,10 ; deleted because /rd/1/ no need to check |
266 | .next_entry: |
266 | .next_entry: |
267 | ;-------------------------------------- |
267 | ;-------------------------------------- |
268 | DEBUGF 1, "\nSearchap: copy next entry\n" |
268 | DEBUGF 1, "\nSearchap: copy next entry\n" |
269 | ;-------------------------------------- |
269 | ;-------------------------------------- |
270 | add esi,10 |
270 | add esi,10 |
271 | push esi |
271 | push esi |
272 | add esi,1 |
272 | add esi,1 |
273 | call copy_folder_name |
273 | call copy_folder_name |
274 | mov esi,basic_file_name-1 |
274 | mov esi,basic_file_name-1 |
275 | dec edi |
275 | dec edi |
276 | call copy_folder_name.1 |
276 | call copy_folder_name.1 |
277 | pop esi |
277 | pop esi |
278 | ;-------------------------------------- |
278 | ;-------------------------------------- |
279 | DEBUGF 1, "Searchap: %s\n",dword[fileinfo.name] |
279 | DEBUGF 1, "Searchap: %s\n",dword[fileinfo.name] |
280 | ;-------------------------------------- |
280 | ;-------------------------------------- |
281 | ; mcall 5,10 |
281 | ; mcall 5,10 |
282 | push ecx |
282 | push ecx |
283 | call load_file |
283 | call load_file |
284 | pop ecx |
284 | pop ecx |
285 | 285 | ||
286 | xor eax,eax |
286 | xor eax,eax |
287 | cmp [fs_error],eax |
287 | cmp [fs_error],eax |
288 | jne @f |
288 | jne @f |
289 | mov eax,[fileinfo.size] |
289 | mov eax,[fileinfo.size] |
290 | cmp eax,[basic_file_size] |
290 | cmp eax,[basic_file_size] |
291 | jae .sucess |
291 | jae .sucess |
292 | @@: |
292 | @@: |
293 | dec ecx |
293 | dec ecx |
294 | jnz .next_entry |
294 | jnz .next_entry |
295 | ;-------------------------------------- |
295 | ;-------------------------------------- |
296 | DEBUGF 2, "Searchap: additional parttition is not found!\n" |
296 | DEBUGF 2, "Searchap: additional partition is not found!\n" |
297 | ;-------------------------------------- |
297 | ;-------------------------------------- |
298 | ret |
298 | ret |
299 | .sucess: |
299 | .sucess: |
300 | call compare_files_and_mount |
300 | call compare_files_and_mount |
301 | cmp [compare_flag],byte 0 |
301 | cmp [compare_flag],byte 0 |
302 | jne @b |
302 | jne @b |
303 | cmp [mount_dir],1 |
303 | cmp [mount_dir],1 |
304 | je @f |
304 | je @f |
305 | DEBUGF 2, "Searchap: sorry, but the additional partition is not found!\n" |
305 | DEBUGF 2, "Searchap: sorry, but the additional partition is not found!\n" |
306 | @@: |
306 | @@: |
307 | ret |
307 | ret |
308 | ;--------------------------------------------------------------------- |
308 | ;--------------------------------------------------------------------- |
309 | compare_files_and_mount: |
309 | compare_files_and_mount: |
310 | push ecx esi |
310 | push ecx esi |
311 | mov ecx,[basic_file_size] |
311 | mov ecx,[basic_file_size] |
312 | mov esi,folder_data |
312 | mov esi,folder_data |
313 | mov edi,folder_data_1 |
313 | mov edi,folder_data_1 |
314 | .next_char: |
314 | .next_char: |
315 | cld |
315 | cld |
316 | lodsb |
316 | lodsb |
317 | mov ah,[edi] |
317 | mov ah,[edi] |
318 | inc edi |
318 | inc edi |
319 | cmp al,ah |
319 | cmp al,ah |
320 | jne .not_match |
320 | jne .not_match |
321 | dec ecx |
321 | dec ecx |
322 | jnz .next_char |
322 | jnz .next_char |
323 | mov [compare_flag],byte 0 |
323 | mov [compare_flag],byte 0 |
324 | pop esi ecx |
324 | pop esi ecx |
325 | ;-------------------------------------- |
325 | ;-------------------------------------- |
326 | DEBUGF 2, "Searchap: compare files sucess!\n" |
326 | DEBUGF 2, "Searchap: compare files - success!\n" |
327 | DEBUGF 2, "Searchap: mount directory: %s\n",esi |
327 | DEBUGF 2, "Searchap: mount directory: %s\n",esi |
328 | mov [mount_dir],1 |
328 | mov [mount_dir],1 |
329 | ;-------------------------------------- |
329 | ;-------------------------------------- |
330 | ; prepare real directory path for mounting |
330 | ; prepare real directory path for mounting |
331 | inc esi |
331 | inc esi |
332 | mov edi,f30_3_work_area+64 |
332 | mov edi,f30_3_work_area+64 |
333 | call proc_copy_patch |
333 | call proc_copy_patch |
334 | dec edi |
334 | dec edi |
335 | mov esi,real_additional_dir |
335 | mov esi,real_additional_dir |
336 | call proc_copy_patch |
336 | call proc_copy_patch |
337 | ; prepare fake directory name |
337 | ; prepare fake directory name |
338 | mov esi,additional_dir_name |
338 | mov esi,additional_dir_name |
339 | mov edi,f30_3_work_area |
339 | mov edi,f30_3_work_area |
340 | call proc_copy_patch |
340 | call proc_copy_patch |
341 | ; here is call kernel function to mount the found partition |
341 | ; here is call kernel function to mount the found partition |
342 | ; as "/kolibrios" directory to root directory "/" |
342 | ; as "/kolibrios" directory to root directory "/" |
343 | mcall 30,3,f30_3_work_area |
343 | mcall 30,3,f30_3_work_area |
344 | ret |
344 | ret |
345 | ;-------------------------------------- |
345 | ;-------------------------------------- |
346 | .not_match: |
346 | .not_match: |
347 | mov [compare_flag],byte 1 |
347 | mov [compare_flag],byte 1 |
348 | pop esi ecx |
348 | pop esi ecx |
349 | ;-------------------------------------- |
349 | ;-------------------------------------- |
350 | DEBUGF 1, "Searchap: compare files is not match!\n" |
350 | DEBUGF 1, "Searchap: compared files doesn't match!\n" |
351 | ;-------------------------------------- |
351 | ;-------------------------------------- |
352 | ret |
352 | ret |
353 | ;--------------------------------------------------------------------- |
353 | ;--------------------------------------------------------------------- |
354 | copy_folder_name: |
354 | copy_folder_name: |
355 | mov edi,read_folder_name+1 |
355 | mov edi,read_folder_name+1 |
356 | .1: |
356 | .1: |
357 | proc_copy_patch: |
357 | proc_copy_patch: |
358 | cld |
358 | cld |
359 | @@: |
359 | @@: |
360 | lodsb |
360 | lodsb |
361 | stosb |
361 | stosb |
362 | test al,al |
362 | test al,al |
363 | jnz @r |
363 | jnz @r |
364 | ret |
364 | ret |
365 | ;--------------------------------------------------------------------- |
365 | ;--------------------------------------------------------------------- |
366 | copy_folder_name_1: |
366 | copy_folder_name_1: |
367 | mov edi,read_folder_1_name+1 |
367 | mov edi,read_folder_1_name+1 |
368 | jmp proc_copy_patch |
368 | jmp proc_copy_patch |
369 | ;--------------------------------------------------------------------- |
369 | ;--------------------------------------------------------------------- |
370 | print_retrieved_devices_table: |
370 | print_retrieved_devices_table: |
371 | mov ecx,[retrieved_devices_table_counter] |
371 | mov ecx,[retrieved_devices_table_counter] |
372 | mov edx,retrieved_devices_table |
372 | mov edx,retrieved_devices_table |
373 | DEBUGF 1, "Searchap: retrieved_devices_table:\n" |
373 | DEBUGF 1, "Searchap: retrieved_devices_table:\n" |
374 | DEBUGF 1, "Searchap: ----------\n" |
374 | DEBUGF 1, "Searchap: ----------\n" |
375 | @@: |
375 | @@: |
376 | DEBUGF 1, "Searchap: %s\n",edx |
376 | DEBUGF 1, "Searchap: %s\n",edx |
377 | add edx,10 |
377 | add edx,10 |
378 | dec ecx |
378 | dec ecx |
379 | jnz @b |
379 | jnz @b |
380 | DEBUGF 1, "\nSearchap: ----------\n" |
380 | DEBUGF 1, "\nSearchap: ----------\n" |
381 | ret |
381 | ret |
382 | ;--------------------------------------------------------------------- |
382 | ;--------------------------------------------------------------------- |
383 | print_root_dir: |
383 | print_root_dir: |
384 | DEBUGF 1, "Searchap: ----------\n" |
384 | DEBUGF 1, "Searchap: ----------\n" |
385 | DEBUGF 1, "Searchap: root dir:\n" |
385 | DEBUGF 1, "Searchap: root dir:\n" |
386 | DEBUGF 1, "Searchap: ----------\n" |
386 | DEBUGF 1, "Searchap: ----------\n" |
387 | pusha |
387 | pusha |
388 | mov ecx,ebx |
388 | mov ecx,ebx |
389 | mov edx,folder_data+32+40 |
389 | mov edx,folder_data+32+40 |
390 | @@: |
390 | @@: |
391 | DEBUGF 1, "Searchap: %s\n",edx |
391 | DEBUGF 1, "Searchap: %s\n",edx |
392 | add edx,304 |
392 | add edx,304 |
393 | dec ecx |
393 | dec ecx |
394 | jnz @b |
394 | jnz @b |
395 | popa |
395 | popa |
396 | DEBUGF 1, "\nSearchap: ----------\n" |
396 | DEBUGF 1, "\nSearchap: ----------\n" |
397 | ret |
397 | ret |
398 | ;------------------------------------------------------------------------------- |
398 | ;------------------------------------------------------------------------------- |
399 | include_debug_strings |
399 | include_debug_strings |
400 | ;------------------------------------------------------------------------------- |
400 | ;------------------------------------------------------------------------------- |
401 | IM_END: |
401 | IM_END: |
402 | ;------------------------------------------------------------------------------- |
402 | ;------------------------------------------------------------------------------- |
403 | align 4 |
403 | align 4 |
404 | left_folder_block rd 1 |
404 | left_folder_block rd 1 |
405 | right_folder_block rd 1 |
405 | right_folder_block rd 1 |
406 | temp_counter_1 rd 1 |
406 | temp_counter_1 rd 1 |
407 | retrieved_devices_table_counter rd 1 |
407 | retrieved_devices_table_counter rd 1 |
408 | basic_file_size rd 1 |
408 | basic_file_size rd 1 |
409 | fs_error rd 1 |
409 | fs_error rd 1 |
410 | compare_flag rb 1 |
410 | compare_flag rb 1 |
411 | mount_dir rb 1 |
411 | mount_dir rb 1 |
412 | ;------------------------------------------------------------------------------- |
412 | ;------------------------------------------------------------------------------- |
413 | align 4 |
413 | align 4 |
414 | f30_3_work_area: |
414 | f30_3_work_area: |
415 | rb 128 |
415 | rb 128 |
416 | ;------------------------------------------------------------------------------- |
416 | ;------------------------------------------------------------------------------- |
417 | align 4 |
417 | align 4 |
418 | retrieved_devices_table: |
418 | retrieved_devices_table: |
419 | rb 10*100 |
419 | rb 10*100 |
420 | ;------------------------------------------------------------------------------- |
420 | ;------------------------------------------------------------------------------- |
421 | align 4 |
421 | align 4 |
422 | read_folder_name: |
422 | read_folder_name: |
423 | rb 256 |
423 | rb 256 |
424 | ;------------------------------------------------------------------------------- |
424 | ;------------------------------------------------------------------------------- |
425 | align 4 |
425 | align 4 |
426 | read_folder_1_name: |
426 | read_folder_1_name: |
427 | rb 256 |
427 | rb 256 |
428 | ;------------------------------------------------------------------------------- |
428 | ;------------------------------------------------------------------------------- |
429 | align 4 |
429 | align 4 |
430 | folder_data: |
430 | folder_data: |
431 | rb 304*32+32 ; 9 Kb |
431 | rb 304*32+32 ; 9 Kb |
432 | ;------------------------------------------------------------------------------- |
432 | ;------------------------------------------------------------------------------- |
433 | align 4 |
433 | align 4 |
434 | folder_data_1: |
434 | folder_data_1: |
435 | rb 304*32+32 ; 9 Kb |
435 | rb 304*32+32 ; 9 Kb |
436 | ;------------------------------------------------------------------------------- |
436 | ;------------------------------------------------------------------------------- |
437 | align 4 |
437 | align 4 |
438 | rb 512 |
438 | rb 512 |
439 | stacktop: |
439 | stacktop: |
440 | ;------------------------------------------------------------------------------- |
440 | ;------------------------------------------------------------------------------- |
441 | I_END: |
441 | I_END: |
442 | ;------------------------------------------------------------------------------- |
442 | ;------------------------------------------------------------------------------- |