Subversion Repositories Kolibri OS

Rev

Rev 465 | Rev 520 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 465 Rev 488
Line 1... Line 1...
1
$Revision: 465 $
1
$Revision: 488 $
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;                                                              ;;
3
;;                                                              ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line -... Line 8...
-
 
8
 
-
 
9
image_of_eax EQU esp+44 ;36
-
 
10
image_of_ebx EQU esp+32 ;24
8
 
11
 
9
; System function 70 - files with long names (LFN)
12
; System function 70 - files with long names (LFN)
Line 10... Line 13...
10
; diamond, 2006
13
; diamond, 2006
11
 
14
 
Line 77... Line 80...
77
        db      'cd3',0
80
        db      'cd3',0
78
;**********************************************
81
;**********************************************
79
        dd      0
82
        dd      0
80
endg
83
endg
Line -... Line 84...
-
 
84
 
-
 
85
end_of_file_system_lfn:
-
 
86
		pop edx
-
 
87
		stdcall kernel_free, edx
-
 
88
		ret
-
 
89
 
81
 
90
 
82
file_system_lfn:
91
file_system_lfn:
83
; in: eax->fileinfo block
92
; in: eax->fileinfo block
84
; operation codes:
93
; operation codes:
85
; 0 : read file
94
; 0 : read file
Line 91... Line 100...
91
; 6 : set file/directory attributes structure
100
; 6 : set file/directory attributes structure
92
; 7 : start application
101
; 7 : start application
93
; 8 : delete file
102
; 8 : delete file
94
; 9 : create directory
103
; 9 : create directory
Line -... Line 104...
-
 
104
 
-
 
105
		; çàìåíà àäðåñà âîçâðàòà
-
 
106
		push	eax
-
 
107
		stdcall kernel_alloc, 200
-
 
108
		mov		edx,eax
-
 
109
		pop		eax
-
 
110
		push	edx
-
 
111
		push	end_of_file_system_lfn
-
 
112
		mov		ebx,edx
-
 
113
				
-
 
114
		mov		ecx, [eax]
-
 
115
        mov		[ebx],ecx
-
 
116
 
-
 
117
		add		ebx,4
-
 
118
		mov		ecx, [eax+4]
-
 
119
        mov		[ebx],ecx
-
 
120
 
-
 
121
		add		ebx,4
-
 
122
		mov		ecx, [eax+8]
-
 
123
        mov		[ebx],ecx
-
 
124
 
-
 
125
		add		ebx,4
-
 
126
		mov		ecx, [eax+12]
-
 
127
        mov		[ebx],ecx
-
 
128
 
-
 
129
		add		ebx,4
-
 
130
		mov		ecx, [eax+16]
-
 
131
        mov		[ebx],ecx
-
 
132
 
-
 
133
		add		ebx,4
-
 
134
		push	edx	  ; !!!!!!!!!!!!!!!!!!!
-
 
135
		; eax - yíà÷àëî ñòàðîãî ïàêåòà
-
 
136
		; edx - íà÷àëî íîâîãî ïàêåòà
-
 
137
		; ebx - êóäà ëîæèòü ñòðîêó			
-
 
138
		add		eax,20
-
 
139
		mov		cl,	[eax]
-
 
140
		test	cl,cl
-
 
141
		jnz		@f
-
 
142
		mov		eax,[eax+1]
-
 
143
@@:
-
 
144
		stdcall full_file_name,eax,ebx
-
 
145
		pop		eax
-
 
146
		
-
 
147
		
-
 
148
		
-
 
149
		
-
 
150
 
95
 
151
 
96
   ;     add     eax, std_application_base_address
152
   ;     add     eax, std_application_base_address
97
; parse file name
153
; parse file name
98
        xchg    ebx, eax
154
        xchg    ebx, eax
99
        lea     esi, [ebx+20]
155
        lea     esi, [ebx+20]
Line 113... Line 169...
113
        test ebx, ebx
169
        test ebx, ebx
114
        jz .l1
170
        jz .l1
115
    ;    add ebx, new_app_base
171
    ;    add ebx, new_app_base
116
.l1:
172
.l1:
117
        call fs_execute  ; ebp, ebx, edx
173
        call fs_execute  ; ebp, ebx, edx
118
        mov [esp+36], eax
174
        mov [image_of_eax], eax
119
        ret
175
        ret
120
@@:
176
@@:
121
        cmp     al, '/'
177
        cmp     al, '/'
122
        jz      @f
178
        jz      @f
123
.notfound:
179
.notfound:
124
        mov     dword [esp+36], 5       ; file not found
180
        mov     dword [image_of_eax], 5       ; file not found
125
        ret
181
        ret
126
@@:
182
@@:
127
        cmp     byte [esi], 0
183
        cmp     byte [esi], 0
128
        jz      .rootdir
184
        jz      .rootdir
129
        mov     edi, rootdirs-8
185
        mov     edi, rootdirs-8
Line 221... Line 277...
221
        xor     eax, eax
277
        xor     eax, eax
222
        dec     ebp
278
        dec     ebp
223
        js      @f
279
        js      @f
224
        mov     al, ERROR_END_OF_FILE
280
        mov     al, ERROR_END_OF_FILE
225
@@:
281
@@:
226
        mov     [esp+36], eax
282
        mov     [image_of_eax], eax
227
        mov     [esp+24], ebx
283
        mov     [image_of_ebx], ebx
228
        ret
284
        ret
229
; directory /
285
; directory /
230
.rootdir:
286
.rootdir:
231
        cmp     dword [ebx], 1  ; read folder?
287
        cmp     dword [ebx], 1  ; read folder?
232
        jz      .readroot
288
        jz      .readroot
233
.access_denied:
289
.access_denied:
234
        mov     dword [esp+36], 10      ; access denied
290
        mov     dword [image_of_eax], 10      ; access denied
235
        ret
291
        ret
Line 236... Line 292...
236
 
292
 
237
.readroot:
293
.readroot:
238
; virtual root folder - special handler
294
; virtual root folder - special handler
Line 297... Line 353...
297
        xor     eax, eax
353
        xor     eax, eax
298
        dec     ebp
354
        dec     ebp
299
        js      @f
355
        js      @f
300
        mov     al, ERROR_END_OF_FILE
356
        mov     al, ERROR_END_OF_FILE
301
@@:
357
@@:
302
        mov     [esp+36], eax
358
        mov     [image_of_eax], eax
303
        mov     [esp+24], ebx
359
        mov     [image_of_ebx], ebx
304
        ret
360
        ret
Line 305... Line 361...
305
 
361
 
306
.found1:
362
.found1:
307
        pop     eax
363
        pop     eax
Line 336... Line 392...
336
; handlers for devices
392
; handlers for devices
337
; in: ecx = 0 => query virtual directory /xxx
393
; in: ecx = 0 => query virtual directory /xxx
338
; in: ecx = partition number
394
; in: ecx = partition number
339
;     esi -> relative (for device) name
395
;     esi -> relative (for device) name
340
;     ebx -> fileinfo
396
;     ebx -> fileinfo
341
; out: [esp+36]=image of eax, [esp+24]=image of ebx
397
; out: [image_of_eax]=image of eax, [image_of_ebx]=image of ebx
Line 342... Line 398...
342
 
398
 
343
fs_OnRamdisk:
399
fs_OnRamdisk:
344
        cmp     ecx, 1
400
        cmp     ecx, 1
345
        jnz     file_system_lfn.notfound
401
        jnz     file_system_lfn.notfound
Line 349... Line 405...
349
        mov     ecx, [ebx+12]
405
        mov     ecx, [ebx+12]
350
        mov     edx, [ebx+16]
406
        mov     edx, [ebx+16]
351
   ;     add     edx, std_application_base_address
407
   ;     add     edx, std_application_base_address
352
        add     ebx, 4
408
        add     ebx, 4
353
        call    dword [fs_RamdiskServices + eax*4]
409
        call    dword [fs_RamdiskServices + eax*4]
354
        mov     [esp+36], eax
410
        mov     [image_of_eax], eax
355
        mov     [esp+24], ebx
411
        mov     [image_of_ebx], ebx
356
        ret
412
        ret
357
.not_impl:
413
.not_impl:
358
        mov     dword [esp+36], 2       ; not implemented
414
        mov     dword [image_of_eax], 2       ; not implemented
359
        ret
415
        ret
Line 360... Line 416...
360
 
416
 
361
fs_NotImplemented:
417
fs_NotImplemented:
362
        mov     eax, 2
418
        mov     eax, 2
Line 387... Line 443...
387
        mov     edx, [ebx+16]
443
        mov     edx, [ebx+16]
388
   ;     add     edx, std_application_base_address
444
   ;     add     edx, std_application_base_address
389
        add     ebx, 4
445
        add     ebx, 4
390
        call    dword [fs_FloppyServices + eax*4]
446
        call    dword [fs_FloppyServices + eax*4]
391
        and     [flp_status], 0
447
        and     [flp_status], 0
392
        mov     [esp+36], eax
448
        mov     [image_of_eax], eax
393
        mov     [esp+24], ebx
449
        mov     [image_of_ebx], ebx
394
        ret
450
        ret
Line 395... Line 451...
395
 
451
 
396
fs_FloppyServices:
452
fs_FloppyServices:
397
        dd      fs_FloppyRead
453
        dd      fs_FloppyRead
Line 438... Line 494...
438
        cmp     cl, [DRIVE_DATA+1+eax]
494
        cmp     cl, [DRIVE_DATA+1+eax]
439
        jbe     @f
495
        jbe     @f
440
.nf:
496
.nf:
441
        call    free_hd_channel
497
        call    free_hd_channel
442
        and     [hd1_status], 0
498
        and     [hd1_status], 0
443
        mov     dword [esp+36], 5       ; not found
499
        mov     dword [image_of_eax], 5       ; not found
444
        ret
500
        ret
445
@@:
501
@@:
446
        mov     [fat32part], ecx
502
        mov     [fat32part], ecx
447
        push    ebx esi
503
        push    ebx esi
448
        call    choice_necessity_partition_1
504
        call    choice_necessity_partition_1
Line 455... Line 511...
455
        jae     .not_impl
511
        jae     .not_impl
456
        add     ebx, 4
512
        add     ebx, 4
457
        call    dword [fs_HdServices + eax*4]
513
        call    dword [fs_HdServices + eax*4]
458
        call    free_hd_channel
514
        call    free_hd_channel
459
        and     [hd1_status], 0
515
        and     [hd1_status], 0
460
        mov     [esp+36], eax
516
        mov     [image_of_eax], eax
461
        mov     [esp+24], ebx
517
        mov     [image_of_ebx], ebx
462
        ret
518
        ret
463
.not_impl:
519
.not_impl:
464
        call    free_hd_channel
520
        call    free_hd_channel
465
        and     [hd1_status], 0
521
        and     [hd1_status], 0
466
        mov     dword [esp+36], 2       ; not implemented
522
        mov     dword [image_of_eax], 2       ; not implemented
467
        ret
523
        ret
Line 468... Line 524...
468
 
524
 
469
fs_HdServices:
525
fs_HdServices:
470
        dd      fs_HdRead
526
        dd      fs_HdRead
Line 518... Line 574...
518
 
574
 
519
        jnz     @f
575
        jnz     @f
520
.nf:
576
.nf:
521
        call    free_cd_channel
577
        call    free_cd_channel
522
        and    [cd_status], 0
578
        and    [cd_status], 0
523
        mov     dword [esp+36], 5       ; not found
579
        mov     dword [image_of_eax], 5       ; not found
524
        ret
580
        ret
525
@@:
581
@@:
526
        mov     ecx, [ebx+12]
582
        mov     ecx, [ebx+12]
527
        mov     edx, [ebx+16]
583
        mov     edx, [ebx+16]
Line 531... Line 587...
531
        jae      .not_impl
587
        jae      .not_impl
532
        add     ebx, 4
588
        add     ebx, 4
533
        call    dword [fs_CdServices + eax*4]
589
        call    dword [fs_CdServices + eax*4]
534
        call    free_cd_channel
590
        call    free_cd_channel
535
        and     [cd_status], 0
591
        and     [cd_status], 0
536
        mov     [esp+36], eax
592
        mov     [image_of_eax], eax
537
        mov     [esp+24], ebx
593
        mov     [image_of_ebx], ebx
538
        ret
594
        ret
539
.not_impl:
595
.not_impl:
540
        call    free_cd_channel
596
        call    free_cd_channel
541
        and     [cd_status], 0
597
        and     [cd_status], 0
542
        mov     dword [esp+36], 2       ; not implemented
598
        mov     dword [image_of_eax], 2       ; not implemented
543
        ret
599
        ret
Line 544... Line 600...
544
 
600
 
545
fs_CdServices:
601
fs_CdServices:
546
        dd      fs_CdRead
602
        dd      fs_CdRead