Subversion Repositories Kolibri OS

Rev

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

Rev 465 Rev 521
Line 1... Line 1...
1
$Revision: 465 $
1
$Revision: 521 $
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
;;                                                              ;;
Line 486... Line 486...
486
        and     dword [edi+4], 0
486
        and     dword [edi+4], 0
487
        pop     ebp edi
487
        pop     ebp edi
488
        xor     eax, eax
488
        xor     eax, eax
489
        ret
489
        ret
Line 490... Line -...
490
 
-
 
491
;----------------------------------------------------------------
-
 
492
;
-
 
493
;  fs_CdExecute - LFN variant for executing from CD
-
 
494
;
-
 
495
;  esi  points to hd filename (e.g. 'dir1/name')
-
 
496
;  ebp  points to full filename (e.g. '/hd0/1/dir1/name')
-
 
497
;  dword [ebx] = flags
-
 
498
;  dword [ebx+4] = cmdline
-
 
499
;
-
 
500
;  ret ebx,edx destroyed
-
 
501
;      eax > 0 - PID, < 0 - error
-
 
502
;
-
 
503
;--------------------------------------------------------------
-
 
504
fs_CdExecute:
-
 
505
        mov     edx, [ebx]
-
 
506
        mov     ebx, [ebx+4]
-
 
507
        test    ebx, ebx
-
 
508
        jz      @f
-
 
509
    ;    add     ebx, std_application_base_address
-
 
510
@@:
-
 
511
 
-
 
512
;----------------------------------------------------------------
-
 
513
;
-
 
514
; fs_CdExecute.flags - second entry
-
 
515
;
-
 
516
;  esi  points to floppy filename (kernel address)
-
 
517
;  ebp  points to full filename
-
 
518
;  edx  flags
-
 
519
;  ebx  cmdline (kernel address)
-
 
520
;
-
 
521
;  ret  eax > 0 - PID, < 0 - error
-
 
522
;
-
 
523
;--------------------------------------------------------------
-
 
524
 
-
 
525
.flags:
-
 
526
        cmp     byte [esi], 0
-
 
527
        jnz     @f
-
 
528
; cannot execute root!
-
 
529
        mov     eax, -ERROR_ACCESS_DENIED
-
 
530
        ret
-
 
531
@@:
-
 
532
        push    edi
-
 
533
        call    cd_find_lfn
-
 
534
        jnc     .found
-
 
535
        pop     edi
-
 
536
        mov     eax, -ERROR_FILE_NOT_FOUND
-
 
537
        cmp     [DevErrorCode], 0
-
 
538
        jz      @f
-
 
539
        mov     al, -11
-
 
540
@@:
-
 
541
        ret
-
 
542
.found:
-
 
543
        mov     edi,[cd_current_pointer_of_input]
-
 
544
        mov    eax,[edi+2]
-
 
545
        push    0
-
 
546
        push    eax
-
 
547
        push    dword [edi+10]          ; size
-
 
548
        push    .DoRead
-
 
549
        call    fs_execute
-
 
550
        add     esp, 16
-
 
551
        pop     edi
-
 
552
        ret
-
 
553
 
-
 
554
.DoRead:
-
 
555
; read next block
-
 
556
; in: eax->parameters, edi->buffer
-
 
557
; out: eax = error code
-
 
558
        pushad
-
 
559
        cmp     dword [eax], 0  ; file size
-
 
560
        jz      .eof
-
 
561
        cmp     [eax+8],dword 0
-
 
562
        jne     @f
-
 
563
        mov     ecx,[eax+4]
-
 
564
        inc     dword [eax+4]
-
 
565
        mov     [CDSectorAddress],ecx
-
 
566
        mov     [CDDataBuf_pointer],CDDataBuf  ;edi
-
 
567
        call    ReadCDWRetr
-
 
568
        cmp     [DevErrorCode], 0
-
 
569
        jnz     .err
-
 
570
@@:
-
 
571
        push    esi edi ecx
-
 
572
        mov     esi,512
-
 
573
        imul    esi,[eax+8]
-
 
574
        add     esi,CDDataBuf
-
 
575
        mov     ecx,512/4
-
 
576
        cld
-
 
577
        rep     movsd
-
 
578
        pop     ecx edi esi
-
 
579
 
-
 
580
        mov     eax, [esp+28]
-
 
581
        mov     ecx, [eax]
-
 
582
        sub     ecx, 512
-
 
583
        jae     @f
-
 
584
        lea     edi, [edi+ecx+512]
-
 
585
        neg     ecx
-
 
586
        push    eax
-
 
587
        xor     eax, eax
-
 
588
        rep     stosb
-
 
589
        pop     eax
-
 
590
@@:
-
 
591
        mov     [eax], ecx
-
 
592
        mov     edx, [eax+8]
-
 
593
        inc     edx
-
 
594
        cmp     edx, 4  ; 2048/512=4
-
 
595
        jb      @f
-
 
596
        xor     edx, edx
-
 
597
@@:
-
 
598
        mov     [eax+8], edx
-
 
599
        popad
-
 
600
        xor     eax, eax
-
 
601
        ret
-
 
602
.eof:
-
 
603
        popad
-
 
604
        mov     eax, 6
-
 
605
        ret
-
 
606
.err:
-
 
607
        popad
-
 
608
        mov     eax, 11
-
 
609
        ret
-
 
610
 
490
 
611
cd_find_lfn:
491
cd_find_lfn:
612
; in: esi->name
492
; in: esi+ebp -> name
613
; out: CF=1 - file not found
493
; out: CF=1 - file not found
614
;      else CF=0 and [cd_current_pointer_of_input] direntry
494
;      else CF=0 and [cd_current_pointer_of_input] direntry
615
        push eax esi
495
        push eax esi
616
; 16 ñåêòîð íà÷àëî íàáîðà äåñêðèïòîðîâ òîìîâ
496
; 16 ñåêòîð íà÷àëî íàáîðà äåñêðèïòîðîâ òîìîâ
Line 667... Line 547...
667
; èñêîìûé ýëåìåíò öåïî÷êè íàéäåí
547
; èñêîìûé ýëåìåíò öåïî÷êè íàéäåí
668
  .found:
548
  .found:
669
; êîíåö ïóòè ôàéëà
549
; êîíåö ïóòè ôàéëà
670
        cmp    byte [esi-1], 0
550
        cmp    byte [esi-1], 0
671
        jz    .done
551
        jz    .done
-
 
552
  .nested:
672
        mov    eax,[cd_current_pointer_of_input]
553
        mov    eax,[cd_current_pointer_of_input]
673
        push    dword [eax+2]
554
        push    dword [eax+2]
674
        pop     dword [CDSectorAddress]       ; íà÷àëî äèðåêòîðèè
555
        pop     dword [CDSectorAddress]       ; íà÷àëî äèðåêòîðèè
675
        mov    eax,[eax+2+8]  ; ðàçìåð äèðåêòîðèè
556
        mov    eax,[eax+2+8]  ; ðàçìåð äèðåêòîðèè
676
        jmp    .mainloop
557
        jmp    .mainloop
677
; óêàçàòåëü ôàéëà íàéäåí
558
; óêàçàòåëü ôàéëà íàéäåí
678
   .done:
559
   .done:
-
 
560
        test    ebp, ebp
-
 
561
        jz      @f
-
 
562
        mov     esi, ebp
-
 
563
        xor     ebp, ebp
-
 
564
        jmp     .nested
-
 
565
@@:
679
        pop  esi eax
566
        pop  esi eax
680
        clc
567
        clc
681
        ret
568
        ret
Line 682... Line 569...
682
 
569