Rev 83 | Rev 88 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 83 | Rev 86 | ||
---|---|---|---|
Line 832... | Line 832... | ||
832 | and ecx, 0xF |
832 | and ecx, 0xF |
833 | mov ah, cl ; month |
833 | mov ah, cl ; month |
834 | pop edx ecx |
834 | pop edx ecx |
835 | ret |
835 | ret |
Line -... | Line 836... | ||
- | 836 | ||
- | 837 | bdfe_to_fat_time: |
|
- | 838 | push edx |
|
- | 839 | mov edx, eax |
|
- | 840 | shr eax, 16 |
|
- | 841 | and dh, 0x3F |
|
- | 842 | shl eax, 6 |
|
- | 843 | or al, dh |
|
- | 844 | shr dl, 1 |
|
- | 845 | and dl, 0x1F |
|
- | 846 | shl eax, 5 |
|
- | 847 | or al, dl |
|
- | 848 | pop edx |
|
- | 849 | ret |
|
- | 850 | ||
- | 851 | bdfe_to_fat_date: |
|
- | 852 | push edx |
|
- | 853 | mov edx, eax |
|
- | 854 | shr eax, 16 |
|
- | 855 | sub ax, 1980 |
|
- | 856 | and dh, 0xF |
|
- | 857 | shl eax, 4 |
|
- | 858 | or al, dh |
|
- | 859 | and dl, 0x1F |
|
- | 860 | shl eax, 5 |
|
- | 861 | or al, dl |
|
- | 862 | pop edx |
|
- | 863 | ret |
|
836 | 864 | ||
837 | fat_entry_to_bdfe: |
865 | fat_entry_to_bdfe: |
838 | ; convert FAT entry at edi to BDFE (block of data of folder entry) at esi, advance esi |
866 | ; convert FAT entry at edi to BDFE (block of data of folder entry) at esi, advance esi |
839 | ; destroys eax |
- | |
840 | movzx eax, byte [edi+11] |
- | |
841 | mov [esi], eax ; attributes |
867 | ; destroys eax |
842 | mov eax, [ebp-4] |
868 | mov eax, [ebp-4] |
- | 869 | mov [esi+4], eax ; ASCII/UNICODE name |
|
- | 870 | fat_entry_to_bdfe2: |
|
- | 871 | movzx eax, byte [edi+11] |
|
843 | mov [esi+4], eax ; ASCII/UNICODE name |
872 | mov [esi], eax ; attributes |
844 | movzx eax, word [edi+14] |
873 | movzx eax, word [edi+14] |
845 | call fat_time_to_bdfe |
874 | call fat_time_to_bdfe |
846 | mov [esi+8], eax ; creation time |
875 | mov [esi+8], eax ; creation time |
847 | movzx eax, word [edi+16] |
876 | movzx eax, word [edi+16] |
Line 859... | Line 888... | ||
859 | mov [esi+28], eax ; last write date |
888 | mov [esi+28], eax ; last write date |
860 | mov eax, [edi+28] |
889 | mov eax, [edi+28] |
861 | mov [esi+32], eax ; file size (low dword) |
890 | mov [esi+32], eax ; file size (low dword) |
862 | xor eax, eax |
891 | xor eax, eax |
863 | mov [esi+36], eax ; file size (high dword) |
892 | mov [esi+36], eax ; file size (high dword) |
- | 893 | test ebp, ebp |
|
- | 894 | jz .ret |
|
864 | push ecx edi |
895 | push ecx edi |
865 | lea edi, [esi+40] |
896 | lea edi, [esi+40] |
866 | mov esi, ebp |
897 | mov esi, ebp |
867 | test byte [esi-4], 1 |
898 | test byte [esi-4], 1 |
868 | jz .ansi |
899 | jz .ansi |
Line 870... | Line 901... | ||
870 | rep movsd |
901 | rep movsd |
871 | mov [edi-2], ax |
902 | mov [edi-2], ax |
872 | @@: |
903 | @@: |
873 | mov esi, edi |
904 | mov esi, edi |
874 | pop edi ecx |
905 | pop edi ecx |
- | 906 | .ret: |
|
875 | ret |
907 | ret |
876 | .ansi: |
908 | .ansi: |
877 | mov ecx, 264/4 |
909 | mov ecx, 264/4 |
878 | rep movsd |
910 | rep movsd |
879 | mov [edi-1], al |
911 | mov [edi-1], al |
880 | jmp @b |
912 | jmp @b |
Line -... | Line 913... | ||
- | 913 | ||
- | 914 | bdfe_to_fat_entry: |
|
- | 915 | ; convert BDFE at edx to FAT entry at edi |
|
- | 916 | ; destroys eax |
|
- | 917 | ; attributes byte |
|
- | 918 | test byte [edi+11], 8 ; volume label? |
|
- | 919 | jnz @f |
|
- | 920 | mov al, [edx] |
|
- | 921 | and al, 0x27 |
|
- | 922 | and byte [edi+11], 0x10 |
|
- | 923 | or byte [edi+11], al |
|
- | 924 | @@: |
|
- | 925 | mov eax, [edx+8] |
|
- | 926 | call bdfe_to_fat_time |
|
- | 927 | mov [edi+14], ax ; creation time |
|
- | 928 | mov eax, [edx+12] |
|
- | 929 | call bdfe_to_fat_date |
|
- | 930 | mov [edi+16], ax ; creation date |
|
- | 931 | mov eax, [edx+20] |
|
- | 932 | call bdfe_to_fat_date |
|
- | 933 | mov [edi+18], ax ; last access date |
|
- | 934 | mov eax, [edx+24] |
|
- | 935 | call bdfe_to_fat_time |
|
- | 936 | mov [edi+22], ax ; last write time |
|
- | 937 | mov eax, [edx+28] |
|
- | 938 | call bdfe_to_fat_date |
|
- | 939 | mov [edi+24], ax ; last write date |
|
- | 940 | ret |
|
- | 941 | ||
- | 942 | ramdisk_root_first: |
|
- | 943 | mov edi, 0x100000+512*19 |
|
- | 944 | clc |
|
- | 945 | ret |
|
- | 946 | ramdisk_root_next: |
|
- | 947 | add edi, 0x20 |
|
- | 948 | cmp edi, 0x100000+512*33 |
|
- | 949 | cmc |
|
- | 950 | ret |
|
881 | 951 | ||
882 | rd_find_lfn: |
952 | rd_find_lfn: |
883 | ; in: esi->name |
953 | ; in: esi->name |
884 | ; out: CF=1 - file not found |
954 | ; out: CF=1 - file not found |
885 | ; else CF=0 and edi->direntry |
955 | ; else CF=0 and edi->direntry |
886 | push esi ebp edi |
- | |
887 | sub esp, 262*2 ; allocate space for LFN |
- | |
888 | mov ebp, esp ; ebp points to buffer |
- | |
889 | push 0 ; for fat_get_name: read ASCII name |
- | |
890 | mov edi, 0x100000+512*19 ; to root dir |
- | |
891 | .l1: |
956 | push esi edi |
892 | call fat_get_name |
957 | push ramdisk_root_first |
893 | jc .l2 |
958 | push ramdisk_root_next |
894 | call fat_compare_name |
959 | call fat_find_lfn |
895 | jz .found |
- | |
896 | .l2: |
- | |
897 | add edi, 0x20 |
- | |
898 | cmp edi, 0x100000+512*33 |
- | |
899 | jb .l1 |
- | |
900 | .notfound: |
- | |
901 | add esp, 262*2+4 |
- | |
902 | pop edi ebp esi |
- | |
903 | stc |
- | |
904 | ret |
- | |
905 | .found: |
- | |
906 | ; found |
- | |
907 | ; if this is LFN entry, advance to true entry |
- | |
908 | cmp byte [edi+11], 0xF |
- | |
909 | jnz @f |
- | |
910 | add edi, 0x20 |
- | |
911 | @@: |
- | |
912 | ; folders are not supported |
960 | jc .notfound |
913 | cmp byte [esi], 0 |
961 | cmp byte [esi], 0 |
914 | jnz .notfound |
962 | jnz .notfound |
- | 963 | add esp, 12 |
|
- | 964 | pop esi |
|
- | 965 | ret ; CF=0 |
|
- | 966 | .notfound: |
|
915 | add esp, 262*2+4+4 ; CF=0 |
967 | add esp, 8 |
- | 968 | pop edi esi |
|
916 | pop ebp esi |
969 | stc |
Line 917... | Line 970... | ||
917 | ret |
970 | ret |
918 | 971 | ||
919 | ;---------------------------------------------------------------- |
972 | ;---------------------------------------------------------------- |
Line 1592... | Line 1645... | ||
1592 | call .read_symbol |
1645 | call .read_symbol |
1593 | stosw |
1646 | stosw |
1594 | loop .read_symbols |
1647 | loop .read_symbols |
1595 | ret |
1648 | ret |
Line -... | Line 1649... | ||
- | 1649 | ||
- | 1650 | fs_RamdiskGetFileInfo: |
|
- | 1651 | cmp byte [esi], 0 |
|
- | 1652 | jnz @f |
|
- | 1653 | mov eax, 2 ; unsupported |
|
- | 1654 | ret |
|
- | 1655 | @@: |
|
- | 1656 | push edi |
|
- | 1657 | call rd_find_lfn |
|
- | 1658 | fs_GetFileInfo_finish: |
|
- | 1659 | jnc @f |
|
- | 1660 | pop edi |
|
- | 1661 | mov eax, ERROR_FILE_NOT_FOUND |
|
- | 1662 | ret |
|
- | 1663 | @@: |
|
- | 1664 | push esi ebp |
|
- | 1665 | xor ebp, ebp |
|
- | 1666 | mov esi, edx |
|
- | 1667 | and dword [esi+4], 0 |
|
- | 1668 | call fat_entry_to_bdfe2 |
|
- | 1669 | pop ebp esi |
|
- | 1670 | pop edi |
|
- | 1671 | xor eax, eax |
|
- | 1672 | ret |
|
- | 1673 | ||
- | 1674 | fs_RamdiskSetFileInfo: |
|
- | 1675 | cmp byte [esi], 0 |
|
- | 1676 | jnz @f |
|
- | 1677 | mov eax, 2 ; unsupported |
|
- | 1678 | ret |
|
- | 1679 | @@: |
|
- | 1680 | push edi |
|
- | 1681 | call rd_find_lfn |
|
- | 1682 | jnc @f |
|
- | 1683 | pop edi |
|
- | 1684 | mov eax, ERROR_FILE_NOT_FOUND |
|
- | 1685 | ret |
|
- | 1686 | @@: |
|
- | 1687 | call bdfe_to_fat_entry |
|
- | 1688 | pop edi |
|
- | 1689 | xor eax, eax |
|
- | 1690 | ret |
|
1596 | 1691 |