Subversion Repositories Kolibri OS

Rev

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

Rev 589 Rev 631
Line 1006... Line 1006...
1006
        jz      .found
1006
        jz      .found
1007
        cmp     eax, 5
1007
        cmp     eax, 5
1008
        jnz     .ret0
1008
        jnz     .ret0
1009
; file does not exist
1009
; file does not exist
1010
        test    [ecx+_FILE.mode], O_CREATE
1010
        test    [ecx+_FILE.mode], O_CREATE
1011
        jz      .ret0z
1011
        jz      .ret0
1012
.truncate:
1012
.truncate:
1013
        lea     ebx, [ecx+_FILE.fileinfo]
1013
        lea     ebx, [ecx+_FILE.fileinfo]
1014
        mov     byte [ebx], 2
1014
        mov     byte [ebx], 2
1015
        push    70
1015
        push    70
1016
        pop     eax
1016
        pop     eax
Line 1037... Line 1037...
1037
        mov     dword [ecx+_FILE.fioffset+4], eax
1037
        mov     dword [ecx+_FILE.fioffset+4], eax
1038
        mov     [esp+28], ecx
1038
        mov     [esp+28], ecx
1039
        popad
1039
        popad
1040
        ret     8
1040
        ret     8
Line -... Line 1041...
-
 
1041
 
-
 
1042
; HANDLE __stdcall open2(int plugin_id, HANDLE plugin_instance, const char* name, int mode);
-
 
1043
; Opens file on plugin panel
-
 
1044
open2:
-
 
1045
        cmp     dword [esp+4], 0
-
 
1046
        jnz     .plugin
-
 
1047
        pop     eax
-
 
1048
        add     esp, 8
-
 
1049
        push    eax
-
 
1050
        jmp     open
-
 
1051
.plugin:
-
 
1052
        pushad
-
 
1053
        mov     ecx, _FILE.size
-
 
1054
        call    xpgalloc
-
 
1055
        test    eax, eax
-
 
1056
        jz      .ret0z
-
 
1057
        mov     [esp+28], eax
-
 
1058
        mov     ecx, eax
-
 
1059
        mov     esi, [esp+44]
-
 
1060
        lea     edi, [eax+_FILE.finame]
-
 
1061
        lea     edx, [eax+_FILE.finame+1024]
-
 
1062
@@:
-
 
1063
        lodsb
-
 
1064
        stosb
-
 
1065
        test    al, al
-
 
1066
        jz      @f
-
 
1067
        cmp     edi, edx
-
 
1068
        jb      @b
-
 
1069
.ret0:
-
 
1070
        call    pgfree
-
 
1071
.ret0z:
-
 
1072
        popad
-
 
1073
        xor     eax, eax
-
 
1074
        ret     8
-
 
1075
@@:
-
 
1076
        mov     edx, [esp+36]
-
 
1077
        mov     [ecx+_FILE.hPlugin], edx
-
 
1078
        mov     ebx, [esp+40]
-
 
1079
        mov     eax, [esp+48]
-
 
1080
        mov     [ecx+_FILE.mode], eax
-
 
1081
        push    ebx ecx
-
 
1082
        push    eax
-
 
1083
        lea     eax, [ecx+_FILE.finame]
-
 
1084
        push    eax
-
 
1085
        push    ebx
-
 
1086
        call    [edx+PluginInfo.open]
-
 
1087
        pop     ecx ebx
-
 
1088
        test    eax, eax
-
 
1089
        jz      .ret0
-
 
1090
        mov     [ecx+_FILE.hFile], eax
-
 
1091
        mov     edx, [esp+36]
-
 
1092
        push    ecx
-
 
1093
        lea     edi, [ecx+_FILE.fileinfo]
-
 
1094
        push    edi
-
 
1095
        xor     eax, eax
-
 
1096
        push    ecx
-
 
1097
        push    10
-
 
1098
        pop     ecx
-
 
1099
        rep     stosd
-
 
1100
        pop     ecx
-
 
1101
        lea     eax, [ecx+_FILE.finame]
-
 
1102
        push    eax
-
 
1103
        push    ebx
-
 
1104
        call    [edx+PluginInfo.getattr]
-
 
1105
        pop     ecx
-
 
1106
        xor     eax, eax
-
 
1107
        mov     dword [ecx+_FILE.pos], eax
-
 
1108
        mov     dword [ecx+_FILE.pos+4], eax
-
 
1109
        mov     dword [ecx+_FILE.bufpos], eax
-
 
1110
        mov     dword [ecx+_FILE.bufpos+4], eax
-
 
1111
        mov     [ecx+_FILE.bufsize], eax
-
 
1112
        mov     dword [ecx+_FILE.fioffset], eax
-
 
1113
        mov     dword [ecx+_FILE.fioffset+4], eax
-
 
1114
        mov     [esp+28], ecx
-
 
1115
        popad
-
 
1116
        ret     16
1041
 
1117
 
1042
; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
1118
; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
1043
read:
1119
read:
1044
        xor     eax, eax
1120
        xor     eax, eax
1045
        pushad
1121
        pushad
Line 1070... Line 1146...
1070
        pop     ecx
1146
        pop     ecx
1071
        mov     [esp+40], edi
1147
        mov     [esp+40], edi
1072
        add     [esp+28], ebx
1148
        add     [esp+28], ebx
1073
        add     dword [ecx+_FILE.pos], ebx
1149
        add     dword [ecx+_FILE.pos], ebx
1074
        adc     dword [ecx+_FILE.pos+4], 0
1150
        adc     dword [ecx+_FILE.pos+4], 0
-
 
1151
        test    dword [ecx+_FILE.pos], 2047
-
 
1152
        jnz     @f
-
 
1153
        and     [ecx+_FILE.bufsize], 0
-
 
1154
@@:
1075
        sub     [esp+44], ebx
1155
        sub     [esp+44], ebx
1076
        jz      .ret
1156
        jz      .ret
1077
.nobuf0:
1157
.nobuf0:
1078
        test    dword [ecx+_FILE.pos], 2047
1158
        test    dword [ecx+_FILE.pos], 2047
1079
        jz      .aligned
1159
        jz      .aligned
Line 1246... Line 1326...
1246
        push    0
1326
        push    0
1247
        push    dword [esp+16]
1327
        push    dword [esp+16]
1248
        call    seek
1328
        call    seek
1249
        ret     12
1329
        ret     12
Line -... Line 1330...
-
 
1330
 
-
 
1331
; __int64 __stdcall tell(HANDLE hFile);
-
 
1332
tell:
-
 
1333
        mov     eax, [esp+4]
-
 
1334
        mov     edx, dword [eax+_FILE.pos+4]
-
 
1335
        mov     eax, dword [eax+_FILE.pos]
-
 
1336
        ret     4
1250
 
1337
 
1251
; __int64 __stdcall filesize(HANDLE hFile);
1338
; __int64 __stdcall filesize(HANDLE hFile);
1252
filesize:
1339
filesize:
1253
        mov     eax, [esp+4]
1340
        mov     eax, [esp+4]
1254
        mov     edx, dword [eax+_FILE.attr+36]
1341
        mov     edx, dword [eax+_FILE.attr+36]