Subversion Repositories Kolibri OS

Rev

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

Rev 133 Rev 171
Line 1112... Line 1112...
1112
        push    esi
1112
        push    esi
1113
        push    edi
1113
        push    edi
1114
        popa
1114
        popa
1115
        ret
1115
        ret
Line -... Line 1116...
-
 
1116
 
-
 
1117
uglobal
-
 
1118
; this is for delete support
-
 
1119
fd_prev_sector          dd      ?
-
 
1120
fd_prev_prev_sector     dd      ?
-
 
1121
endg
1116
 
1122
 
1117
flp_root_next:
1123
flp_root_next:
1118
        cmp     edi, 0xD200-0x20
1124
        cmp     edi, 0xD200-0x20
1119
        jae     @f
1125
        jae     @f
1120
        add     edi, 0x20
1126
        add     edi, 0x20
1121
        ret     ; CF=0
1127
        ret     ; CF=0
1122
@@:
1128
@@:
1123
; read next sector
1129
; read next sector
1124
        inc     dword [eax]
1130
        inc     dword [eax]
1125
        cmp     dword [eax], 14
1131
        cmp     dword [eax], 14
-
 
1132
        jae     flp_root_first.readerr
-
 
1133
        push    [fd_prev_sector]
-
 
1134
        pop     [fd_prev_prev_sector]
-
 
1135
        push    eax
-
 
1136
        mov     eax, [eax]
-
 
1137
        add     eax, 19-1
-
 
1138
        mov     [fd_prev_sector], eax
1126
        jae     flp_root_first.readerr
1139
        pop     eax
1127
flp_root_first:
1140
flp_root_first:
1128
        mov     eax, [eax]
1141
        mov     eax, [eax]
1129
        pusha
1142
        pusha
1130
        add     eax, 19
1143
        add     eax, 19
Line 1160... Line 1173...
1160
        add     edi, 0x20
1173
        add     edi, 0x20
1161
        ret     ; CF=0
1174
        ret     ; CF=0
1162
flp_notroot_next_sector:
1175
flp_notroot_next_sector:
1163
        push    ecx
1176
        push    ecx
1164
        mov     ecx, [eax]
1177
        mov     ecx, [eax]
-
 
1178
        push    [fd_prev_sector]
-
 
1179
        pop     [fd_prev_prev_sector]
-
 
1180
        add     ecx, 31
-
 
1181
        mov     [fd_prev_sector], ecx
1165
        mov     ecx, [ecx*2+0x282000]
1182
        mov     ecx, [(ecx-31)*2+0x282000]
1166
        and     ecx, 0xFFF
1183
        and     ecx, 0xFFF
1167
        cmp     ecx, 2849
1184
        cmp     ecx, 2849
1168
        jae     flp_notroot_first.err2
1185
        jae     flp_notroot_first.err2
1169
        mov     [eax], ecx
1186
        mov     [eax], ecx
1170
        pop     ecx
1187
        pop     ecx
Line 2571... Line 2588...
2571
.err:
2588
.err:
2572
        popad
2589
        popad
2573
        mov     eax, 11
2590
        mov     eax, 11
2574
        ret
2591
        ret
Line -... Line 2592...
-
 
2592
 
-
 
2593
;----------------------------------------------------------------
-
 
2594
;
-
 
2595
;  fs_FloppyDelete - delete file or empty folder from floppy
-
 
2596
;
-
 
2597
;  esi  points to filename
-
 
2598
;
-
 
2599
;  ret  eax = 0 ok or other = errormsg
-
 
2600
;
-
 
2601
;--------------------------------------------------------------
-
 
2602
fs_FloppyDelete:
-
 
2603
        call    read_flp_fat
-
 
2604
        cmp     [FDC_Status], 0
-
 
2605
        jz      @f
-
 
2606
        push    11
-
 
2607
        jmp     .pop_ret
-
 
2608
@@:
-
 
2609
        cmp     byte [esi], 0
-
 
2610
        jnz     @f
-
 
2611
; cannot delete root!
-
 
2612
.access_denied:
-
 
2613
        push    ERROR_ACCESS_DENIED
-
 
2614
.pop_ret:
-
 
2615
        pop     eax
-
 
2616
        ret
-
 
2617
@@:
-
 
2618
        and     [fd_prev_sector], 0
-
 
2619
        and     [fd_prev_prev_sector], 0
-
 
2620
        push    edi
-
 
2621
        call    fd_find_lfn
-
 
2622
        jnc     .found
-
 
2623
        pop     edi
-
 
2624
        push    ERROR_FILE_NOT_FOUND
-
 
2625
        jmp     .pop_ret
-
 
2626
.found:
-
 
2627
        cmp     dword [edi], '.   '
-
 
2628
        jz      .access_denied2
-
 
2629
        cmp     dword [edi], '..  '
-
 
2630
        jz      .access_denied2
-
 
2631
        test    byte [edi+11], 10h
-
 
2632
        jz      .dodel
-
 
2633
; we can delete only empty folders!
-
 
2634
        push    eax
-
 
2635
        movzx   eax, word [edi+26]
-
 
2636
        push    ebx
-
 
2637
        pusha
-
 
2638
        add     eax, 31
-
 
2639
        call    read_chs_sector
-
 
2640
        popa
-
 
2641
        mov     ebx, FDD_DATA + 2*0x20
-
 
2642
.checkempty:
-
 
2643
        cmp     byte [ebx], 0
-
 
2644
        jz      .empty
-
 
2645
        cmp     byte [ebx], 0xE5
-
 
2646
        jnz     .notempty
-
 
2647
        add     ebx, 0x20
-
 
2648
        cmp     ebx, FDD_DATA + 0x200
-
 
2649
        jb      .checkempty
-
 
2650
        movzx   eax, word [FLOPPY_FAT + eax*2]
-
 
2651
        pusha
-
 
2652
        add     eax, 31
-
 
2653
        call    read_chs_sector
-
 
2654
        popa
-
 
2655
        mov     ebx, FDD_DATA
-
 
2656
        jmp     .checkempty
-
 
2657
.notempty:
-
 
2658
        pop     ebx
-
 
2659
        pop     eax
-
 
2660
.access_denied2:
-
 
2661
        pop     edi
-
 
2662
        jmp     .access_denied
-
 
2663
.empty:
-
 
2664
        pop     ebx
-
 
2665
        pop     eax
-
 
2666
        pusha
-
 
2667
        call    read_chs_sector
-
 
2668
        popa
-
 
2669
.dodel:
-
 
2670
        push    eax
-
 
2671
        movzx   eax, word [edi+26]
-
 
2672
        xchg    eax, [esp]
-
 
2673
; delete folder entry
-
 
2674
        mov     byte [edi], 0xE5
-
 
2675
; delete LFN (if present)
-
 
2676
.lfndel:
-
 
2677
        cmp     edi, FDD_DATA
-
 
2678
        ja      @f
-
 
2679
        cmp     [fd_prev_sector], 0
-
 
2680
        jz      .lfndone
-
 
2681
        push    [fd_prev_sector]
-
 
2682
        push    [fd_prev_prev_sector]
-
 
2683
        pop     [fd_prev_sector]
-
 
2684
        and     [fd_prev_prev_sector], 0
-
 
2685
        pusha
-
 
2686
        call    save_chs_sector
-
 
2687
        popa
-
 
2688
        pop     eax
-
 
2689
        pusha
-
 
2690
        call    read_chs_sector
-
 
2691
        popa
-
 
2692
        mov     edi, FDD_DATA+0x200
-
 
2693
@@:
-
 
2694
        sub     edi, 0x20
-
 
2695
        cmp     byte [edi], 0xE5
-
 
2696
        jz      .lfndone
-
 
2697
        cmp     byte [edi+11], 0xF
-
 
2698
        jnz     .lfndone
-
 
2699
        mov     byte [edi], 0xE5
-
 
2700
        jmp     .lfndel
-
 
2701
.lfndone:
-
 
2702
        pusha
-
 
2703
        call    save_chs_sector
-
 
2704
        popa
-
 
2705
; delete FAT chain
-
 
2706
        pop     eax
-
 
2707
        test    eax, eax
-
 
2708
        jz      .done
-
 
2709
@@:
-
 
2710
        lea     eax, [FLOPPY_FAT + eax*2]
-
 
2711
        push    dword [eax]
-
 
2712
        and     word [eax], 0
-
 
2713
        pop     eax
-
 
2714
        and     eax, 0xFFF
-
 
2715
        jnz     @b
-
 
2716
.done:
-
 
2717
        call    save_flp_fat
-
 
2718
        pop     edi
-
 
2719
        xor     eax, eax
-
 
2720
        ret
2575
 
2721