Subversion Repositories Kolibri OS

Rev

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

Rev 926 Rev 1022
Line 1... Line 1...
1
;
1
;
2
; project name:         KFar_Arc - plugin for KFar, which supports various archives
2
; project name:         KFar_Arc - plugin for KFar, which supports various archives
3
; target platform:      KolibriOS
3
; target platform:      KolibriOS
4
; compiler:             FASM 1.67.14
4
; compiler:             FASM 1.67.14
5
; version:              0.14
5
; version:              0.15
6
; last update:          2008-11-19 (Nov 19, 2008)
6
; last update:          2009-02-01 (Feb 01, 2009)
7
; minimal KFar version: 0.43
7
; minimal KFar version: 0.43
8
; minimal kernel:       no limit
8
; minimal kernel:       no limit
9
;
9
;
10
; author:               Diamond
10
; author:               Diamond
11
; email:                diamondz@land.ru
11
; email:                diamondz@land.ru
Line 418... Line 418...
418
        jz      .addfile
418
        jz      .addfile
419
        mov     eax, [cur_stamp]
419
        mov     eax, [cur_stamp]
420
        cmp     [ebx+file_common.stamp], eax
420
        cmp     [ebx+file_common.stamp], eax
421
        jz      .cont
421
        jz      .cont
422
        mov     [ebx+file_common.stamp], eax
422
        mov     [ebx+file_common.stamp], eax
-
 
423
        push    esi
423
        mov     ecx, [ebx+file_common.name]
424
        mov     ecx, [ebx+file_common.name]
424
        add     ecx, [ebx+file_common.namelen]
425
        add     ecx, [ebx+file_common.namelen]
425
        xor     eax, eax
426
        xor     eax, eax
426
        xchg    al, [ecx]
427
        xchg    al, [ecx]
427
        push    eax ecx
428
        push    eax ecx
428
        push    esi
-
 
429
        mov     eax, ebx
429
        mov     eax, ebx
430
        mov     edi, tmp_bdfe
430
        mov     edi, tmp_bdfe
431
        push    edi
431
        push    edi
432
        push    esi
432
        push    esi
433
        mov     ecx, [ebp]
433
        mov     ecx, [ebp]
Line 1180... Line 1180...
1180
        inc     [bPasswordDefined]      ; clears ZF flag
1180
        inc     [bPasswordDefined]      ; clears ZF flag
1181
.ret:
1181
.ret:
1182
        ret
1182
        ret
Line 1183... Line 1183...
1183
 
1183
 
-
 
1184
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
1185
;;;;;;;;;;;;; API for other programs ;;;;;;;;;;;;
-
 
1186
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
1187
; void* __stdcall deflate_unpack(void* packed_data, unsigned* pLength)
-
 
1188
deflate_unpack:
-
 
1189
	push	dword [esp+8]
-
 
1190
        push    esp
-
 
1191
        push    deflate_unpack_cb
-
 
1192
        call    deflate_unpack2
-
 
1193
        ret     8
-
 
1194
 
-
 
1195
deflate_unpack_cb:
-
 
1196
        mov     edx, [esp+4]
-
 
1197
        push    edx
-
 
1198
        mov     edx, [edx+12]
-
 
1199
        mov     edx, [edx]
-
 
1200
        mov     eax, [esp+8+4]
-
 
1201
        mov     [eax], edx
-
 
1202
        pop     edx
-
 
1203
        xor     eax, eax
-
 
1204
        xchg    eax, [edx+8]
-
 
1205
        ret     8
-
 
1206
 
-
 
1207
; void* __stdcall deflate_unpack2(void* get_next_chunk, void* parameter, unsigned* pUnpackedLength)
-
 
1208
;	void* __stdcall get_next_chunk(void* parameter, unsigned* pLength)
-
 
1209
deflate_unpack2:
-
 
1210
        pusha
-
 
1211
        mov     ecx, 0x11000
-
 
1212
        call    mypgalloc
-
 
1213
        test    eax, eax
-
 
1214
        jz      .ret
-
 
1215
        or      dword [eax+streamInfo.fullSize], -1
-
 
1216
        or      dword [eax+streamInfo.fullSize+4], -1
-
 
1217
        and     dword [eax+streamInfo.bufSize], 0
-
 
1218
        mov     dword [eax+streamInfo.fillBuf], .fillBuf
-
 
1219
        mov     edx, [esp+32+4]
-
 
1220
        mov     [eax+streamInfo.size], edx
-
 
1221
        mov     edx, [esp+32+8]
-
 
1222
        mov     [eax+streamInfo.size+4], edx
-
 
1223
        mov     [eax+streamInfo.size+8+deflate_decoder.inStream], eax
-
 
1224
        add     eax, streamInfo.size+8
-
 
1225
        lea     edi, [eax+deflate_decoder.size]
-
 
1226
        mov     [eax+streamInfo.bufPtr], edi
-
 
1227
        mov     ebp, eax
-
 
1228
        call    deflate_init_decoder
-
 
1229
        xor     edx, edx
-
 
1230
        mov     ecx, 10000h
-
 
1231
.loop:
-
 
1232
        push    @f
-
 
1233
        pushad
-
 
1234
        mov     [_esp], esp
-
 
1235
        mov     [_ebp], ebp
-
 
1236
        mov     [error_proc], .error
-
 
1237
        mov     ecx, 10000h
-
 
1238
        jmp     [eax+streamInfo.fillBuf]
-
 
1239
@@:
-
 
1240
        push    68
-
 
1241
        pop     eax
-
 
1242
        push    20
-
 
1243
        pop     ebx
-
 
1244
        int     0x40
-
 
1245
        test    eax, eax
-
 
1246
        jz      .nomem
-
 
1247
        mov     edx, eax
-
 
1248
        mov     eax, ebp
-
 
1249
        mov     esi, edi
-
 
1250
        push    edi
-
 
1251
        lea     edi, [edx+ecx-0x10000]
-
 
1252
        push    ecx
-
 
1253
        mov     ecx, 0x10000/4
-
 
1254
        rep     movsd
-
 
1255
        pop     ecx
-
 
1256
        pop     edi
-
 
1257
        add     ecx, 0x10000
-
 
1258
        jmp     .loop
-
 
1259
.error:
-
 
1260
        pop     eax
-
 
1261
        push    edi
-
 
1262
        popad
-
 
1263
        pop     eax
-
 
1264
        mov     eax, ebp
-
 
1265
        lea     esi, [eax+deflate_decoder.size]
-
 
1266
        sub     ecx, 0x10000
-
 
1267
        sub     edi, esi
-
 
1268
        add     ecx, edi
-
 
1269
        mov     eax, [esp+32+12]
-
 
1270
        test    eax, eax
-
 
1271
        jz      @f
-
 
1272
        mov     [eax], ecx
-
 
1273
@@:
-
 
1274
        test    ecx, ecx
-
 
1275
        jnz     @f
-
 
1276
        inc     ecx
-
 
1277
@@:
-
 
1278
        push    68
-
 
1279
        pop     eax
-
 
1280
        push    20
-
 
1281
        pop     ebx
-
 
1282
        int     0x40
-
 
1283
        test    eax, eax
-
 
1284
        jz      .nomem
-
 
1285
        sub     ecx, edi
-
 
1286
        mov     edx, edi
-
 
1287
        lea     edi, [eax+ecx]
-
 
1288
        mov     ecx, edx
-
 
1289
        shr     ecx, 2
-
 
1290
        rep     movsd
-
 
1291
        mov     ecx, edx
-
 
1292
        and     ecx, 3
-
 
1293
        rep     movsb
-
 
1294
        push    eax
-
 
1295
        push    68
-
 
1296
        pop     eax
-
 
1297
        push    13
-
 
1298
        pop     ebx
-
 
1299
        lea     ecx, [ebp-streamInfo.size-8]
-
 
1300
        int     40h
-
 
1301
        pop     eax
-
 
1302
        jmp     .ret
-
 
1303
.nomem:
-
 
1304
        push    68
-
 
1305
        pop     eax
-
 
1306
        push    13
-
 
1307
        pop     ebx
-
 
1308
        test    edx, edx
-
 
1309
        jz      @f
-
 
1310
        mov     ecx, edx
-
 
1311
        push    eax
-
 
1312
        int     0x40
-
 
1313
        pop     eax
-
 
1314
@@:
-
 
1315
        lea     ecx, [ebp-streamInfo.size-8]
-
 
1316
        int     0x40
-
 
1317
        xor     eax, eax
-
 
1318
.ret:
-
 
1319
        mov     [esp+28], eax
-
 
1320
        popa
-
 
1321
        ret     12
-
 
1322
.fillBuf:
-
 
1323
        push    eax
-
 
1324
        push    eax
-
 
1325
        push    esp
-
 
1326
        push    dword [eax+streamInfo.size+4]
-
 
1327
        call    dword [eax+streamInfo.size]
-
 
1328
        pop     edx
-
 
1329
        pop     ebp
-
 
1330
        mov     [ebp+streamInfo.bufPtr], eax
-
 
1331
        and     [ebp+streamInfo.bufDataLen], 0
-
 
1332
        test    eax, eax
-
 
1333
        jz      @f
-
 
1334
        mov     [ebp+streamInfo.bufDataLen], edx
-
 
1335
@@:
-
 
1336
        popad
-
 
1337
        ret
-
 
1338
 
-
 
1339
mypgalloc:
-
 
1340
        push    68
-
 
1341
        pop     eax
-
 
1342
        push    12
-
 
1343
        pop     ebx
-
 
1344
        int     0x40
-
 
1345
        ret
-
 
1346
 
1184
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1347
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1185
;;;;;;;;;;;;;;;; Initialized data ;;;;;;;;;;;;;;;
1348
;;;;;;;;;;;;;;;; Initialized data ;;;;;;;;;;;;;;;
Line 1186... Line 1349...
1186
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1349
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1187
 
1350
 
Line 1199... Line 1362...
1199
        dd      aGetattr,       mygetattr
1362
        dd      aGetattr,       mygetattr
1200
        dd      aOpen,          myopen
1363
        dd      aOpen,          myopen
1201
        dd      aRead,          myread
1364
        dd      aRead,          myread
1202
        dd      aSetpos,        mysetpos
1365
        dd      aSetpos,        mysetpos
1203
        dd      aClose,         myclose
1366
        dd      aClose,         myclose
-
 
1367
        dd      aDeflateUnpack, deflate_unpack
-
 
1368
        dd      aDeflateUnpack2,deflate_unpack2
1204
        dd      0
1369
        dd      0
Line 1205... Line 1370...
1205
 
1370
 
1206
; exported names
1371
; exported names
1207
aVersion        db      'version',0
1372
aVersion        db      'version',0
Line 1215... Line 1380...
1215
aGetattr        db      'getattr',0
1380
aGetattr        db      'getattr',0
1216
aOpen           db      'open',0
1381
aOpen           db      'open',0
1217
aRead           db      'read',0
1382
aRead           db      'read',0
1218
aSetpos         db      'setpos',0
1383
aSetpos         db      'setpos',0
1219
aClose          db      'close',0
1384
aClose          db      'close',0
-
 
1385
aDeflateUnpack  db      'deflate_unpack',0
-
 
1386
aDeflateUnpack2 db      'deflate_unpack2',0
Line 1220... Line 1387...
1220
 
1387
 
1221
; common strings
1388
; common strings
1222
if lang eq ru
1389
if lang eq ru
1223
aContinue       db      'à®¤®«¦¨âì',0
1390
aContinue       db      'à®¤®«¦¨âì',0