Subversion Repositories Kolibri OS

Rev

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

Rev 517 Rev 589
Line 27... Line 27...
27
        mov     eax, esp
27
        mov     eax, esp
28
        push    DeleteErrorBtn
28
        push    DeleteErrorBtn
29
        push    4
29
        push    4
30
        push    eax
30
        push    eax
31
        push    3
31
        push    3
32
        push    -1
-
 
33
        push    -1
-
 
34
        push    aError
-
 
35
        call    SayErr
32
        call    SayErr
36
        add     esp, 3*4
33
        add     esp, 3*4
37
        cmp     al, -1
34
        cmp     al, -1
38
        jz      @f
35
        jz      @f
39
        inc     eax
36
        inc     eax
Line 64... Line 61...
64
        jmp     @b
61
        jmp     @b
65
@@:
62
@@:
66
        mov     esi, [esp+28]
63
        mov     esi, [esp+28]
67
        mov     ecx, esi
64
        mov     ecx, esi
68
        add     esi, 40
65
        add     esi, 40
-
 
66
        cmp     byte [edi-1], '/'
-
 
67
        jz      .l1
69
        mov     al, '/'
68
        mov     al, '/'
70
        stosb
69
        stosb
71
.l1:
70
.l1:
72
        lodsb
71
        lodsb
73
        cmp     edi, execdataend
72
        cmp     edi, execdataend
Line 237... Line 236...
237
        mov     eax, esp
236
        mov     eax, esp
238
        push    dword [eax+20]
237
        push    dword [eax+20]
239
        push    dword [eax+16]
238
        push    dword [eax+16]
240
        push    eax
239
        push    eax
241
        push    3
240
        push    3
242
        push    -1
-
 
243
        push    -1
-
 
244
        push    dword aError
-
 
245
        call    SayErr
241
        call    SayErr
246
        add     esp, 3*4
242
        add     esp, 3*4
247
        test    eax, eax
243
        test    eax, eax
248
        jz      makedir
244
        jz      makedir
249
.ret:
245
.ret:
Line 251... Line 247...
251
 
247
 
252
copy_file_worker:
248
copy_file_worker:
253
; in: execdata = source name, CopyDestEditBuf+12 = destination name, edx = BDFE block for source
249
; in: execdata = source name, CopyDestEditBuf+12 = destination name, edx = BDFE block for source
254
; out: CF and ZF not set <=> cancel job ("ja cancel_label")
250
; out: CF and ZF not set <=> cancel job ("ja cancel_label")
-
 
251
; destroys eax,esi,edi
-
 
252
        lea     edi, [edx+40]
-
 
253
        and     [source_hFile], 0
255
; destroys eax,esi,edi
254
copy_file_worker2:
256
        push    CopyDestEditBuf+12+513
255
        push    CopyDestEditBuf+12+513
257
        cmp     [bDestIsFolder], 0
256
        cmp     [bDestIsFolder], 0
258
        jz      .noaddtoname
257
        jz      .noaddtoname
259
        mov     esi, CopyDestEditBuf+12
258
        mov     esi, CopyDestEditBuf+12
260
@@:
259
@@:
261
        lodsb
260
        lodsb
262
        test    al, al
261
        test    al, al
263
        jnz     @b
262
        jnz     @b
264
        mov     byte [esi-1], '/'
263
        pop     eax
265
        pop     edi
264
        dec     esi
-
 
265
        push    esi
-
 
266
        cmp     byte [esi-1], '/'
-
 
267
        jz      @f
266
        push    esi
268
        mov     byte [esi], '/'
-
 
269
        inc     esi
267
        mov     edi, esi
270
@@:
268
        lea     esi, [edx+40]
271
        xchg    esi, edi
269
@@:
272
@@:
270
        cmp     edi, CopyDestEditBuf+12+513
273
        cmp     edi, CopyDestEditBuf+12+513
271
        jae     .overflow
274
        jae     .overflow
272
        lodsb
275
        lodsb
Line 275... Line 278...
275
        jnz     @b
278
        jnz     @b
276
        jmp     .noaddtoname
279
        jmp     .noaddtoname
277
.overflow:
280
.overflow:
278
.ret_zf:
281
.ret_zf:
279
        pop     esi
282
        pop     esi
280
        and     byte [esi-1], 0         ; ZF=1
283
        and     byte [esi], 0           ; ZF=1
281
        ret
284
        ret
282
.noaddtoname:
285
.noaddtoname:
283
; Íåëüçÿ ñêîïèðîâàòü ôàéë ïîâåðõ ñàìîãî ñåáÿ!
286
; ¥«ì§ï ᪮¯¨à®¢ âì ä ©« ¯®¢¥àå á ¬®£® ᥡï!
284
        mov     esi, execdata
287
        mov     esi, execdata
285
        mov     edi, CopyDestEditBuf+12
288
        mov     edi, CopyDestEditBuf+12
-
 
289
        cmp     [source_hModule], 0
-
 
290
        jnz     @f
286
        push    esi edi
291
        push    esi edi
287
        call    strcmpi
292
        call    strcmpi
288
        pop     edi esi
293
        pop     edi esi
289
        jnz     @f
294
        jnz     @f
290
        push    esi
295
        push    esi
Line 292... Line 297...
292
        mov     eax, esp
297
        mov     eax, esp
293
        push    ContinueBtn
298
        push    ContinueBtn
294
        push    1
299
        push    1
295
        push    eax
300
        push    eax
296
        push    2
301
        push    2
297
        push    -1
-
 
298
        push    -1
-
 
299
        push    aError
-
 
300
        call    SayErr
302
        call    SayErr
301
        pop     eax
303
        pop     eax
302
        pop     eax
304
        pop     eax
303
        jmp     .ret_zf
305
        jmp     .ret_zf
304
@@:
306
@@:
305
; Ñîáñòâåííî, êîïèðóåì
307
; ‘®¡á⢥­­®, ª®¯¨à㥬
306
; esi->source name, edi->destination name
308
; esi->source name, edi->destination name
307
        push    ebx
309
        push    ebx
308
        mov     [writeinfo.code], 2
310
        mov     [writeinfo.code], 2
309
        mov     [writeinfo.name], edi
311
        mov     [writeinfo.name], edi
310
        and     dword [writeinfo.first], 0
312
        and     dword [writeinfo.first], 0
Line 314... Line 316...
314
        and     dword [ebx+readinfo.first-readinfo], 0
316
        and     dword [ebx+readinfo.first-readinfo], 0
315
        and     dword [ebx+readinfo.first+4-readinfo], 0
317
        and     dword [ebx+readinfo.first+4-readinfo], 0
316
        mov     [ebx+readinfo.size-readinfo], copy_buffer_size
318
        mov     [ebx+readinfo.size-readinfo], copy_buffer_size
317
        mov     [ebx+readinfo.data-readinfo], copy_buffer
319
        mov     [ebx+readinfo.data-readinfo], copy_buffer
318
        mov     [ebx+readinfo.name-readinfo], esi
320
        mov     [ebx+readinfo.name-readinfo], esi
-
 
321
        mov     eax, [source_hFile]
-
 
322
        push    eax
-
 
323
        test    eax, eax
-
 
324
        jnz     .copyloop
-
 
325
.source_reopen:
-
 
326
        mov     eax, [source_hModule]
-
 
327
        test    eax, eax
-
 
328
        jz      .copyloop
-
 
329
        pushad
-
 
330
        push    O_READ+O_SEQUENTIAL_ONLY
-
 
331
        push    esi
-
 
332
        push    [source_hPlugin]
-
 
333
        call    [eax+PluginInfo.open]
-
 
334
        mov     [source_hFile], eax
-
 
335
        popad
319
.copyloop:
336
.copyloop:
320
        mov     ebx, readinfo
337
        mov     ebx, readinfo
-
 
338
        mov     eax, [source_hModule]
-
 
339
        test    eax, eax
-
 
340
        jz      .native
-
 
341
        mov     ecx, [source_hFile]
-
 
342
        jecxz   .readerr
-
 
343
        pushad
-
 
344
        push    [ebx+readinfo.size-readinfo]
-
 
345
        push    [ebx+readinfo.data-readinfo]
-
 
346
        push    ecx
-
 
347
        call    [eax+PluginInfo.read]
-
 
348
        mov     [esp+28], eax
-
 
349
        popad
-
 
350
        cmp     eax, -1
-
 
351
        jz      .readerr
-
 
352
        mov     ebx, eax
-
 
353
        jmp     .copyreadok
-
 
354
.native:
321
        push    70
355
        push    70
322
        pop     eax
356
        pop     eax
323
        int     0x40
357
        int     0x40
324
        test    eax, eax
358
        test    eax, eax
325
        jz      .copyreadok
359
        jz      .copyreadok
326
        cmp     eax, 6
360
        cmp     eax, 6
327
        jz      .copyreadok
361
        jz      .copyreadok
-
 
362
.readerr:
328
        cmp     [copy_bSkipAll2], 0
363
        cmp     [copy_bSkipAll2], 0
329
        jnz     .copyfailed_del2
364
        jnz     .copyfailed_del2
330
        push    esi
365
        push    esi
331
        push    dword aCannotReadFile
366
        push    dword aCannotReadFile
332
        call    get_error_msg
367
        call    get_error_msg
Line 334... Line 369...
334
        mov     eax, esp
369
        mov     eax, esp
335
        push    dword DeleteErrorBtn
370
        push    dword DeleteErrorBtn
336
        push    4
371
        push    4
337
        push    eax
372
        push    eax
338
        push    3
373
        push    3
339
        push    -1
-
 
340
        push    -1
-
 
341
        push    dword aError
-
 
342
        call    SayErr
374
        call    SayErr
343
        add     esp, 3*4
375
        add     esp, 3*4
344
        test    eax, eax
376
        test    eax, eax
-
 
377
        jnz     .copyfailed_parseuser
-
 
378
        cmp     [source_hModule], 0
345
        jz      .copyloop
379
        jz      .copyloop
-
 
380
        cmp     [source_hFile], 0
-
 
381
        jz      .source_reopen
346
        jmp     .copyfailed_parseuser
382
        jmp     .copyloop
347
.copyreadok:
383
.copyreadok:
348
        add     dword [readinfo.first], ebx
384
        add     dword [readinfo.first], ebx
349
        adc     dword [readinfo.first+4], 0
385
        adc     dword [readinfo.first+4], 0
350
        mov     [writeinfo.size], ebx
386
        mov     [writeinfo.size], ebx
351
        test    ebx, ebx
387
        test    ebx, ebx
Line 368... Line 404...
368
        mov     eax, esp
404
        mov     eax, esp
369
        push    dword DeleteErrorBtn
405
        push    dword DeleteErrorBtn
370
        push    4
406
        push    4
371
        push    eax
407
        push    eax
372
        push    3
408
        push    3
373
        push    -1
-
 
374
        push    -1
-
 
375
        push    dword aError
-
 
376
        call    SayErr
409
        call    SayErr
377
        add     esp, 3*4
410
        add     esp, 3*4
378
        test    eax, eax
411
        test    eax, eax
379
        jz      .copywrite
412
        jz      .copywrite
380
.copyfailed_parseuser:
413
.copyfailed_parseuser:
Line 392... Line 425...
392
        adc     dword [writeinfo.first+4], 0
425
        adc     dword [writeinfo.first+4], 0
393
        mov     [writeinfo.code], 3
426
        mov     [writeinfo.code], 3
394
        cmp     ecx, copy_buffer_size
427
        cmp     ecx, copy_buffer_size
395
        jz      .copyloop
428
        jz      .copyloop
396
.copydone:
429
.copydone:
-
 
430
        pop     ecx
-
 
431
        test    ecx, ecx
-
 
432
        jnz     @f
-
 
433
        mov     eax, [source_hModule]
-
 
434
        test    eax, eax
-
 
435
        jz      @f
-
 
436
        mov     ecx, [source_hFile]
-
 
437
        jecxz   @f
-
 
438
        push    edx
-
 
439
        push    ecx
-
 
440
        call    [eax+PluginInfo.close]
-
 
441
        pop     edx
-
 
442
@@:
397
; now try to set attributes from source, ignore errors
443
; now try to set attributes from source, ignore errors
398
        mov     edi, attrinfo.attr
444
        mov     edi, attrinfo.attr
399
        mov     esi, edx
445
        mov     esi, edx
400
        push    8
446
        push    8
401
        pop     ecx
447
        pop     ecx
402
        rep     movsd
448
        rep     movsd
-
 
449
; replace zero dates with default values
-
 
450
        mov     eax, [default_attr]
-
 
451
        cmp     dword [edi-32+8], 0
-
 
452
        jnz     @f
-
 
453
        mov     ecx, [eax+8]
-
 
454
        mov     [edi-32+8], ecx
-
 
455
        mov     ecx, [eax+12]
-
 
456
        mov     [edi-32+12], ecx
-
 
457
@@:
-
 
458
        cmp     dword [edi-32+16], 0
-
 
459
        jnz     @f
-
 
460
        mov     ecx, [eax+16]
-
 
461
        mov     [edi-32+16], ecx
-
 
462
        mov     ecx, [eax+20]
-
 
463
        mov     [edi-32+20], ecx
-
 
464
@@:
-
 
465
        cmp     dword [edi-32+24], 0
-
 
466
        jnz     @f
-
 
467
        mov     ecx, [eax+24]
-
 
468
        mov     [edi-32+24], ecx
-
 
469
        mov     ecx, [eax+28]
-
 
470
        mov     [edi-32+28], ecx
-
 
471
@@:
403
        mov     ebx, attrinfo
472
        mov     ebx, attrinfo
404
        mov     [ebx+attrinfo.name-attrinfo], CopyDestEditBuf+12
473
        mov     [ebx+attrinfo.name-attrinfo], CopyDestEditBuf+12
405
        inc     dword [ebx]
474
        inc     dword [ebx]
406
        push    70
475
        push    70
407
        pop     eax
476
        pop     eax
Line 411... Line 480...
411
        dec     dword [ebx]
480
        dec     dword [ebx]
412
        xor     eax, eax        ; ZF=1
481
        xor     eax, eax        ; ZF=1
413
.ret:
482
.ret:
414
        pop     ebx
483
        pop     ebx
415
        pop     esi
484
        pop     esi
416
        mov     byte [esi-1], 0
485
        mov     byte [esi], 0
417
        ret
486
        ret
418
.copydone2:
487
.copydone2:
419
        popf
488
        popf
420
        jmp     .ret
489
        jmp     .ret
421
.copyfailed:
490
.copyfailed:
-
 
491
        pop     ecx
-
 
492
        test    ecx, ecx
-
 
493
        jnz     @f
-
 
494
        mov     eax, [source_hModule]
-
 
495
        test    eax, eax
-
 
496
        jz      @f
-
 
497
        mov     ecx, [source_hFile]
-
 
498
        jecxz   @f
-
 
499
        push    ecx
-
 
500
        call    [eax+PluginInfo.close]
-
 
501
@@:
422
        cmp     [bConfirmDeleteIncomplete], 0
502
        cmp     [bConfirmDeleteIncomplete], 0
423
        jz      .copyfailed_del
503
        jz      .copyfailed_del
424
        cmp     [writeinfo.code], 2
504
        cmp     [writeinfo.code], 2
425
        jz      .copydone2
505
        jz      .copydone2
426
        push    dword aIncompleteFile
506
        push    dword aIncompleteFile
427
        mov     eax, esp
507
        mov     eax, esp
428
        push    dword DeleteOrKeepBtn
508
        push    dword DeleteOrKeepBtn
429
        push    2
509
        push    2
430
        push    eax
510
        push    eax
431
        push    1
511
        push    1
432
        push    -1
-
 
433
        push    -1
-
 
434
        push    dword aCopyCaption
512
        push    dword aCopyCaption
435
        call    SayErr
513
        call    Message
436
        add     esp, 4
514
        add     esp, 4
437
        test    eax, eax
515
        test    eax, eax
438
        jnz     .copydone2
516
        jnz     .copydone2
439
.copyfailed_del:
517
.copyfailed_del:
440
        mov     ebx, delinfo
518
        mov     ebx, delinfo
Line 466... Line 544...
466
        stosb
544
        stosb
467
        jmp     @b
545
        jmp     @b
468
@@:
546
@@:
469
        mov     esi, [esp+28]
547
        mov     esi, [esp+28]
470
        add     esi, 40
548
        add     esi, 40
-
 
549
        cmp     byte [edi-1], '/'
-
 
550
        jz      .l1
471
        mov     al, '/'
551
        mov     al, '/'
472
        stosb
552
        stosb
473
.l1:
553
.l1:
474
        lodsb
554
        lodsb
475
        cmp     edi, execdataend
555
        cmp     edi, execdataend
476
        jb      @f
556
        jb      @f
477
        call    panels_OnKey.bigfilename
557
        call    panels_OnKey.bigfilename
-
 
558
        stc
478
        popad
559
        popad
479
        ret
560
        ret
480
@@:
561
@@:
481
        stosb
562
        stosb
482
        test    al, al
563
        test    al, al
Line 502... Line 583...
502
        mov     esi, CopyDestEditBuf+12
583
        mov     esi, CopyDestEditBuf+12
503
@@:
584
@@:
504
        lodsb
585
        lodsb
505
        test    al, al
586
        test    al, al
506
        jnz     @b
587
        jnz     @b
-
 
588
        dec     esi
-
 
589
        cmp     byte [esi-1], '/'
-
 
590
        jz      @f
507
        mov     byte [esi-1], '/'
591
        mov     byte [esi], '/'
-
 
592
        inc     esi
-
 
593
@@:
508
        mov     edi, esi
594
        mov     edi, esi
509
        lea     esi, [edx+40]
595
        lea     esi, [edx+40]
510
@@:
596
@@:
511
        cmp     edi, CopyDestEditBuf+12+513
597
        cmp     edi, CopyDestEditBuf+12+513
512
        jae     .biiig
598
        jae     .biiig
Line 525... Line 611...
525
        dec     eax
611
        dec     eax
526
        mov     [copy_bSkipAll], 1
612
        mov     [copy_bSkipAll], 1
527
@@:
613
@@:
528
        cmp     al, 1
614
        cmp     al, 1
529
        jz      .copy_dir_entry_done
615
        jz      .copy_dir_entry_done
530
        jmp     .cancel
616
        jmp     .cancel2
531
.target_created:
617
.target_created:
-
 
618
        mov     edx, [source_hModule]
-
 
619
        test    edx, edx
-
 
620
        jz      .nosetdir
-
 
621
        mov     esi, execdata
-
 
622
        push    esi     ; absolute_path
-
 
623
@@:
-
 
624
        lodsb
-
 
625
        test    al, al
-
 
626
        jnz     @b
-
 
627
@@:
-
 
628
        dec     esi
-
 
629
        cmp     byte [esi-1], '/'
-
 
630
        jnz     @b
-
 
631
        push    esi     ; relative_path
-
 
632
        push    [source_hPlugin]        ; hPlugin
-
 
633
        call    [edx+PluginInfo.SetFolder]
-
 
634
        test    al, al
-
 
635
        jnz     .nosetdir
-
 
636
        cmp     [copy_bSkipAll3], 0
-
 
637
        jz      .skip2
-
 
638
        push    execdata
-
 
639
        push    aCannotSetFolder
-
 
640
        mov     eax, esp
-
 
641
        push    DeleteErrorBtn
-
 
642
        push    4
-
 
643
        push    eax
-
 
644
        push    2
-
 
645
        call    SayErr
-
 
646
        pop     ecx ecx
-
 
647
        test    al, al
-
 
648
        jz      .target_created
-
 
649
        cmp     al, 2
-
 
650
        setz    [copy_bSkipAll3]
-
 
651
        ja      .cancel2
-
 
652
        jmp     .skip2
-
 
653
.nosetdir:
532
        xor     ebp, ebp        ; ebp will contain number of copied items
654
        xor     ebp, ebp        ; ebp will contain number of copied items
533
.return_from_recursion:
655
.return_from_recursion:
534
.read_retry:
656
.read_retry:
535
        mov     ebx, dirinfo
657
        mov     ebx, dirinfo
536
        mov     [ebx+dirinfo.first-dirinfo], ebp
658
        mov     [ebx+dirinfo.first-dirinfo], ebp
537
        mov     [ebx+dirinfo.size-dirinfo], copy_dir_query_size
659
        mov     [ebx+dirinfo.size-dirinfo], copy_dir_query_size
538
        mov     [ebx+dirinfo.dirdata-dirinfo], copy_dir_query_area
660
        mov     [ebx+dirinfo.dirdata-dirinfo], copy_dir_query_area
539
        mov     [ebx+dirinfo.name-dirinfo], execdata
661
        mov     [ebx+dirinfo.name-dirinfo], execdata
-
 
662
        mov     eax, [source_hModule]
-
 
663
        test    eax, eax
-
 
664
        jz      .readfolder_native
-
 
665
        push    ebp
-
 
666
        push    [ebx+dirinfo.dirdata-dirinfo]
-
 
667
        push    [ebx+dirinfo.size-dirinfo]
-
 
668
        push    [ebx+dirinfo.first-dirinfo]
-
 
669
        push    [source_hPlugin]
-
 
670
        call    [eax+PluginInfo.ReadFolder]
-
 
671
        pop     ebp
-
 
672
        mov     ebx, dword [copy_dir_query_area+4]
-
 
673
        jmp     @f
-
 
674
.readfolder_native:
540
        push    70
675
        push    70
541
        pop     eax
676
        pop     eax
542
        int     0x40
677
        int     0x40
-
 
678
@@:
543
        test    eax, eax
679
        test    eax, eax
544
        jz      .readok
680
        jz      .readok
545
        cmp     eax, 6
681
        cmp     eax, 6
546
        jz      .readok
682
        jz      .readok
547
; read error
683
; read error
548
        cmp     [copy_bSkipAll], 0
684
        cmp     [copy_bSkipAll], 0
549
        jz      .skip1
685
        jnz     .skip1
550
        push    execdata
686
        push    execdata
551
        push    aCannotReadFolder
687
        push    aCannotReadFolder
552
        call    get_error_msg
688
        call    get_error_msg
553
        push    eax
689
        push    eax
554
        mov     eax, esp
690
        mov     eax, esp
555
        push    DeleteErrorBtn
691
        push    DeleteErrorBtn
556
        push    4
692
        push    4
557
        push    eax
693
        push    eax
558
        push    3
694
        push    3
559
        push    -1
-
 
560
        push    -1
-
 
561
        push    aError
-
 
562
        call    SayErr
695
        call    SayErr
563
        add     esp, 3*4
696
        add     esp, 3*4
564
        test    al, al
697
        test    al, al
565
        jz      .read_retry
698
        jz      .read_retry
566
        cmp     al, 2
699
        cmp     al, 2
Line 595... Line 728...
595
        mov     esi, execdata
728
        mov     esi, execdata
596
@@:
729
@@:
597
        lodsb
730
        lodsb
598
        test    al, al
731
        test    al, al
599
        jnz     @b
732
        jnz     @b
-
 
733
        dec     esi
-
 
734
        cmp     byte [esi-1], '/'
-
 
735
        jz      @f
600
        mov     byte [esi-1], '/'
736
        mov     byte [esi], '/'
-
 
737
        inc     esi
-
 
738
@@:
601
        mov     edi, esi
739
        mov     edi, esi
602
        lea     esi, [edx+40]
740
        lea     esi, [edx+40]
603
@@:
741
@@:
604
        cmp     edi, execdataend
742
        cmp     edi, execdataend
605
        jae     .fullname_big
743
        jae     .fullname_big
Line 610... Line 748...
610
        mov     esi, CopyDestEditBuf+12
748
        mov     esi, CopyDestEditBuf+12
611
@@:
749
@@:
612
        lodsb
750
        lodsb
613
        test    al, al
751
        test    al, al
614
        jnz     @b
752
        jnz     @b
-
 
753
        dec     esi
-
 
754
        cmp     byte [esi-1], '/'
-
 
755
        jz      @f
615
        mov     byte [esi-1], '/'
756
        mov     byte [esi], '/'
-
 
757
        inc     esi
-
 
758
@@:
616
        mov     edi, esi
759
        mov     edi, esi
617
        lea     esi, [edx+40]
760
        lea     esi, [edx+40]
618
@@:
761
@@:
619
        cmp     edi, CopyDestEditBuf+513
762
        cmp     edi, CopyDestEditBuf+513
620
        jae     .fullname2_big
763
        jae     .fullname2_big
Line 623... Line 766...
623
        test    al, al
766
        test    al, al
624
        jnz     @b
767
        jnz     @b
625
        test    byte [edx], 10h
768
        test    byte [edx], 10h
626
        jnz     .entry_is_folder
769
        jnz     .entry_is_folder
627
        call    copy_file_worker
770
        call    copy_file_worker
628
        ja      .cancel
771
        ja      .cancel3
629
        jmp     .restore_name
772
        jmp     .restore_name
630
.entry_is_folder:
773
.entry_is_folder:
631
; allocate new item in directory stack
774
; allocate new item in directory stack
632
        mov     eax, [copy_dir_stack_ptr]
775
        mov     eax, [copy_dir_stack_ptr]
633
        mov     [eax], ebp
776
        mov     [eax], ebp
Line 640... Line 783...
640
        mov     esi, execdataend-1
783
        mov     esi, execdataend-1
641
        jmp     .do_restore_name2
784
        jmp     .do_restore_name2
642
.fullname2_big:
785
.fullname2_big:
643
        mov     esi, CopyDestEditBuf+12+512
786
        mov     esi, CopyDestEditBuf+12+512
644
        jmp     .restore_name2
787
        jmp     .restore_name2
645
.skip1:
-
 
646
.restore_name:
788
.restore_name:
647
        mov     esi, CopyDestEditBuf+12
789
        mov     esi, CopyDestEditBuf+12
648
@@:
790
@@:
649
        lodsb
791
        lodsb
650
        test    al, al
792
        test    al, al
Line 663... Line 805...
663
.do_restore_name2:
805
.do_restore_name2:
664
        call    delete_last_name
806
        call    delete_last_name
665
.copy_dir_entry_continue:
807
.copy_dir_entry_continue:
666
        add     edx, 304
808
        add     edx, 304
667
        jmp     .copy_dir_entry_loop
809
        jmp     .copy_dir_entry_loop
-
 
810
.skip1:
668
.copy_dir_entry_done:
811
.copy_dir_entry_done:
669
; return to previous directory
812
; return to previous directory
-
 
813
        mov     esi, execdata
-
 
814
        call    delete_last_name_from_end
-
 
815
        mov     eax, [source_hModule]
-
 
816
        test    eax, eax
-
 
817
        jz      @f
-
 
818
        push    execdata
-
 
819
        push    aDotDot
-
 
820
        push    [source_hPlugin]
-
 
821
        call    [eax+PluginInfo.SetFolder]
-
 
822
        jmp     @f
-
 
823
.skip2:
-
 
824
        mov     esi, execdata
-
 
825
        call    delete_last_name_from_end
-
 
826
@@:
670
; pop item from directory stack
827
; pop item from directory stack
671
        mov     ecx, [copy_dir_stack_ptr]
828
        mov     ecx, [copy_dir_stack_ptr]
672
        cmp     ecx, copy_dir_stack
829
        cmp     ecx, copy_dir_stack
673
        jbe     .done
830
        jbe     .done
674
        sub     ecx, 4
831
        sub     ecx, 4
675
        mov     [copy_dir_stack_ptr], ecx
832
        mov     [copy_dir_stack_ptr], ecx
676
        mov     ebp, [ecx]
833
        mov     ebp, [ecx]
677
; restore prev directory name
834
; restore prev directory name
678
        mov     esi, execdata
-
 
679
        call    delete_last_name_from_end
-
 
680
        mov     esi, CopyDestEditBuf+12
835
        mov     esi, CopyDestEditBuf+12
681
        call    delete_last_name_from_end
836
        call    delete_last_name_from_end
682
        jmp     .return_from_recursion
837
        jmp     .return_from_recursion
683
.done:
838
.done:
684
.cancel:
-
 
685
        mov     [dirinfo.first], 0      ; do not destroys flags
839
        mov     [dirinfo.first], 0      ; do not destroys flags
686
        popad
840
        popad
687
        ret
841
        ret
-
 
842
.cancel2:
-
 
843
        sub     [copy_dir_stack_ptr], 4
-
 
844
.cancel3:
-
 
845
        mov     esi, execdata
-
 
846
        call    delete_last_name_from_end
-
 
847
.cancel:
-
 
848
        mov     eax, [source_hModule]
-
 
849
        test    eax, eax
-
 
850
        jz      .cancel.ret
-
 
851
        cmp     [copy_dir_stack_ptr], copy_dir_stack
-
 
852
        jb      .cancel.ret
-
 
853
        push    execdata
-
 
854
        push    aDotDot
-
 
855
        push    [source_hPlugin]
-
 
856
        call    [eax+PluginInfo.SetFolder]
-
 
857
        jmp     .cancel2
-
 
858
.cancel.ret:
-
 
859
        xor     eax, eax
-
 
860
        inc     eax
-
 
861
        popad
-
 
862
        ret
Line 688... Line 863...
688
 
863
 
689
delete_last_name_from_end:
864
delete_last_name_from_end:
690
        lodsb
865
        lodsb
691
        test    al, al
866
        test    al, al
Line 697... Line 872...
697
@@:
872
@@:
698
        lodsb
873
        lodsb
699
        cmp     al, '/'
874
        cmp     al, '/'
700
        jnz     @b
875
        jnz     @b
701
        cld
876
        cld
-
 
877
        inc     esi
-
 
878
        cmp     esi, execdata
-
 
879
        jz      @f
-
 
880
        cmp     esi, CopyDestEditBuf+12
-
 
881
        jz      @f
-
 
882
        dec     esi
-
 
883
@@:
702
        mov     byte [esi+1], 0
884
        mov     byte [esi+1], 0
703
        ret
885
        ret
-
 
886
 
-
 
887
copy_AddDir:
-
 
888
        push    1
-
 
889
        pop     eax                     ; for "return true"
-
 
890
        pushad
-
 
891
        mov     esi, CopyDestEditBuf+12
-
 
892
@@:
-
 
893
        lodsb
-
 
894
        test    al, al
-
 
895
        jnz     @b
-
 
896
        cmp     byte [esi-2], '/'
-
 
897
        jnz     @f
-
 
898
        dec     esi
-
 
899
@@:
-
 
900
        push    dword [esi-1]
-
 
901
        push    esi
-
 
902
        mov     byte [esi-1], '/'
-
 
903
        mov     edi, esi
-
 
904
        mov     esi, [esp+28h+4]
-
 
905
.0:
-
 
906
        lodsb
-
 
907
        stosb
-
 
908
        cmp     edi, CopyDestEditBuf+12+512
-
 
909
        jae     .done
-
 
910
        test    al, al
-
 
911
        jnz     .0
-
 
912
        push    RetryOrCancelBtn
-
 
913
        push    2
-
 
914
        call    makedir
-
 
915
        jz      .done
-
 
916
        and     dword [esp+8+1Ch], 0
-
 
917
.done:
-
 
918
        pop     esi
-
 
919
        pop     dword [esi-1]
-
 
920
        popad
-
 
921
        ret     8
-
 
922
 
-
 
923
copy_AddFile:
-
 
924
        pushad
-
 
925
        mov     eax, [esp+20h+12]
-
 
926
        mov     [source_hFile], eax
-
 
927
        mov     edx, [esp+20h+8]
-
 
928
        mov     edi, [esp+20h+4]
-
 
929
        call    copy_file_worker2
-
 
930
        popad
-
 
931
        setna   al
-
 
932
        ret     12
-
 
933
 
-
 
934
virtual at 0
-
 
935
_FILE:
-
 
936
.pos            dq      ?
-
 
937
.bufpos         dq      ?
-
 
938
.bufsize        dd      ?
-
 
939
.mode           dd      ?
-
 
940
.hPlugin        dd      ?
-
 
941
.hFile          dd      ?
-
 
942
.fileinfo:
-
 
943
.fimode         dd      ?
-
 
944
.fioffset       dq      ?
-
 
945
.fisize         dd      ?
-
 
946
.fibuf          dd      ?
-
 
947
.finame         rb      1024
-
 
948
.attr           rb      40
-
 
949
align 512
-
 
950
.buf            rb      2048
-
 
951
.size = $
-
 
952
end virtual
-
 
953
 
-
 
954
O_READ = 1      ; allows read from file
-
 
955
O_WRITE = 2     ; allows write to file
-
 
956
O_CREATE = 4    ; if file does not exist and this flag is set, create file;
-
 
957
                ; if file does not exist and this flag is not set, fail
-
 
958
O_TRUNCATE = 8  ; truncate file if it exists
-
 
959
O_SEQUENTIAL_ONLY = 10h ; there will be no 'seek'/'setpos' calls
-
 
960
 
-
 
961
; HANDLE __stdcall open(const char* name, int mode);
-
 
962
; Opens physical file
-
 
963
open:
-
 
964
        pushad
-
 
965
        mov     ecx, _FILE.size
-
 
966
        call    xpgalloc
-
 
967
        test    eax, eax
-
 
968
        jz      .ret0z
-
 
969
        mov     [esp+28], eax
-
 
970
        mov     ecx, eax
-
 
971
        mov     esi, [esp+36]
-
 
972
        lea     edi, [eax+_FILE.finame]
-
 
973
        lea     edx, [eax+_FILE.finame+1024]
-
 
974
@@:
-
 
975
        lodsb
-
 
976
        stosb
-
 
977
        test    al, al
-
 
978
        jz      @f
-
 
979
        cmp     edi, edx
-
 
980
        jb      @b
-
 
981
.ret0:
-
 
982
        call    pgfree
-
 
983
.ret0z:
-
 
984
        popad
-
 
985
        xor     eax, eax
-
 
986
        ret     8
-
 
987
@@:
-
 
988
        mov     eax, [esp+40]
-
 
989
        mov     [ecx+_FILE.mode], eax
-
 
990
.getattr:
-
 
991
        lea     edi, [ecx+_FILE.fileinfo]
-
 
992
        mov     ebx, edi
-
 
993
        push    5
-
 
994
        pop     eax
-
 
995
        stosd
-
 
996
        xor     eax, eax
-
 
997
        stosd
-
 
998
        stosd
-
 
999
        stosd
-
 
1000
        lea     eax, [ecx+_FILE.attr]
-
 
1001
        stosd
-
 
1002
        push    70
-
 
1003
        pop     eax
-
 
1004
        int     0x40
-
 
1005
        test    eax, eax
-
 
1006
        jz      .found
-
 
1007
        cmp     eax, 5
-
 
1008
        jnz     .ret0
-
 
1009
; file does not exist
-
 
1010
        test    [ecx+_FILE.mode], O_CREATE
-
 
1011
        jz      .ret0z
-
 
1012
.truncate:
-
 
1013
        lea     ebx, [ecx+_FILE.fileinfo]
-
 
1014
        mov     byte [ebx], 2
-
 
1015
        push    70
-
 
1016
        pop     eax
-
 
1017
        int     0x40
-
 
1018
        test    eax, eax
-
 
1019
        jz      .getattr
-
 
1020
        jmp     .ret0
-
 
1021
.found:
-
 
1022
        test    [ecx+_FILE.mode], O_TRUNCATE
-
 
1023
        jz      @f
-
 
1024
        cmp     dword [ecx+_FILE.attr+36], eax
-
 
1025
        jnz     .truncate
-
 
1026
        cmp     dword [ecx+_FILE.attr+32], eax
-
 
1027
        jnz     .truncate
-
 
1028
@@:
-
 
1029
        mov     dword [ecx+_FILE.pos], eax
-
 
1030
        mov     dword [ecx+_FILE.pos+4], eax
-
 
1031
        mov     dword [ecx+_FILE.bufpos], eax
-
 
1032
        mov     dword [ecx+_FILE.bufpos+4], eax
-
 
1033
        mov     [ecx+_FILE.bufsize], eax
-
 
1034
        mov     [ecx+_FILE.hPlugin], eax
-
 
1035
        mov     [ecx+_FILE.hFile], eax
-
 
1036
        mov     dword [ecx+_FILE.fioffset], eax
-
 
1037
        mov     dword [ecx+_FILE.fioffset+4], eax
-
 
1038
        mov     [esp+28], ecx
-
 
1039
        popad
-
 
1040
        ret     8
-
 
1041
 
-
 
1042
; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
-
 
1043
read:
-
 
1044
        xor     eax, eax
-
 
1045
        pushad
-
 
1046
        mov     ecx, [esp+36]
-
 
1047
        test    [ecx+_FILE.mode], O_READ
-
 
1048
        jnz     @f
-
 
1049
.ret:
-
 
1050
        popad
-
 
1051
        ret     12
-
 
1052
@@:
-
 
1053
        cmp     dword [esp+44], eax
-
 
1054
        jz      .ret
-
 
1055
        mov     [ecx+_FILE.fimode], eax
-
 
1056
        mov     ebx, [ecx+_FILE.bufsize]
-
 
1057
        mov     eax, dword [ecx+_FILE.pos]
-
 
1058
        and     eax, 2047
-
 
1059
        sub     ebx, eax
-
 
1060
        jbe     .nobuf0
-
 
1061
        cmp     ebx, [esp+44]
-
 
1062
        jbe     @f
-
 
1063
        mov     ebx, [esp+44]
-
 
1064
@@:
-
 
1065
        push    ecx
-
 
1066
        lea     esi, [ecx+eax+_FILE.buf]
-
 
1067
        mov     ecx, ebx
-
 
1068
        mov     edi, [esp+44]
-
 
1069
        rep     movsb
-
 
1070
        pop     ecx
-
 
1071
        mov     [esp+40], edi
-
 
1072
        add     [esp+28], ebx
-
 
1073
        add     dword [ecx+_FILE.pos], ebx
-
 
1074
        adc     dword [ecx+_FILE.pos+4], 0
-
 
1075
        sub     [esp+44], ebx
-
 
1076
        jz      .ret
-
 
1077
.nobuf0:
-
 
1078
        test    dword [ecx+_FILE.pos], 2047
-
 
1079
        jz      .aligned
-
 
1080
        cmp     dword [ecx+_FILE.bufsize], 0
-
 
1081
        jnz     .ret
-
 
1082
        lea     ebx, [ecx+_FILE.fileinfo]
-
 
1083
        mov     dword [ebx+12], 2048
-
 
1084
        lea     eax, [ecx+_FILE.buf]
-
 
1085
        mov     dword [ebx+16], eax
-
 
1086
        mov     eax, dword [ecx+_FILE.fioffset]
-
 
1087
        mov     dword [ecx+_FILE.bufpos], eax
-
 
1088
        mov     eax, dword [ecx+_FILE.fioffset+4]
-
 
1089
        mov     dword [ecx+_FILE.bufpos+4], eax
-
 
1090
        call    .doread
-
 
1091
        test    eax, eax
-
 
1092
        jnz     .ret
-
 
1093
        mov     [ecx+_FILE.bufsize], ebx
-
 
1094
        mov     eax, dword [ecx+_FILE.pos]
-
 
1095
        and     eax, 2047
-
 
1096
        sub     ebx, eax
-
 
1097
        jbe     .ret
-
 
1098
        cmp     ebx, [esp+44]
-
 
1099
        jbe     @f
-
 
1100
        mov     ebx, [esp+44]
-
 
1101
@@:
-
 
1102
        push    ecx
-
 
1103
        lea     esi, [ecx+eax+_FILE.buf]
-
 
1104
        mov     ecx, ebx
-
 
1105
        mov     edi, [esp+44]
-
 
1106
        rep     movsb
-
 
1107
        pop     ecx
-
 
1108
        add     dword [ecx+_FILE.pos], ebx
-
 
1109
        adc     dword [ecx+_FILE.pos+4], 0
-
 
1110
        mov     [esp+40], edi
-
 
1111
        add     [esp+28], ebx
-
 
1112
        sub     [esp+44], ebx
-
 
1113
        jz      .ret
-
 
1114
        test    dword [ecx+_FILE.pos], 2047
-
 
1115
        jnz     .ret
-
 
1116
.aligned:
-
 
1117
        lea     ebx, [ecx+_FILE.fileinfo]
-
 
1118
        mov     eax, [esp+44]
-
 
1119
        and     eax, not 2047
-
 
1120
        jz      .finish
-
 
1121
        and     [ecx+_FILE.bufsize], 0
-
 
1122
        mov     [ebx+12], eax
-
 
1123
        mov     eax, [esp+40]
-
 
1124
        mov     [ebx+16], eax
-
 
1125
        call    .doread
-
 
1126
        test    eax, eax
-
 
1127
        jnz     .ret
-
 
1128
        add     dword [ecx+_FILE.pos], ebx
-
 
1129
        adc     dword [ecx+_FILE.pos+4], 0
-
 
1130
        add     [esp+28], ebx
-
 
1131
        add     [esp+40], ebx
-
 
1132
        sub     [esp+44], ebx
-
 
1133
        jz      .ret
-
 
1134
        cmp     ebx, [ecx+_FILE.fisize]
-
 
1135
        jb      .ret
-
 
1136
.finish:
-
 
1137
        lea     ebx, [ecx+_FILE.fileinfo]
-
 
1138
        mov     dword [ebx+12], 2048
-
 
1139
        lea     eax, [ecx+_FILE.buf]
-
 
1140
        mov     [ebx+16], eax
-
 
1141
        and     [ecx+_FILE.bufsize], 0
-
 
1142
        mov     eax, dword [ecx+_FILE.fioffset]
-
 
1143
        mov     dword [ecx+_FILE.bufpos], eax
-
 
1144
        mov     eax, dword [ecx+_FILE.fioffset+4]
-
 
1145
        mov     dword [ecx+_FILE.bufpos+4], eax
-
 
1146
        call    .doread
-
 
1147
        test    eax, eax
-
 
1148
        jnz     .ret
-
 
1149
        mov     [ecx+_FILE.bufsize], ebx
-
 
1150
        cmp     ebx, [esp+44]
-
 
1151
        jb      @f
-
 
1152
        mov     ebx, [esp+44]
-
 
1153
@@:
-
 
1154
        add     [esp+28], ebx
-
 
1155
        add     dword [ecx+_FILE.pos], ebx
-
 
1156
        adc     dword [ecx+_FILE.pos+4], 0
-
 
1157
        lea     esi, [ecx+_FILE.buf]
-
 
1158
        mov     edi, [esp+40]
-
 
1159
        mov     ecx, ebx
-
 
1160
        rep     movsb
-
 
1161
        popad
-
 
1162
        ret     12
-
 
1163
.doread:
-
 
1164
        mov     eax, [ecx+_FILE.hPlugin]
-
 
1165
        test    eax, eax
-
 
1166
        jz      .native
-
 
1167
        push    ecx
-
 
1168
        push    [ecx+_FILE.fisize]
-
 
1169
        push    [ecx+_FILE.fibuf]
-
 
1170
        push    [ecx+_FILE.hFile]
-
 
1171
        call    [eax+PluginInfo.read]
-
 
1172
        pop     ecx
-
 
1173
        cmp     eax, -1
-
 
1174
        jz      @f
-
 
1175
        mov     ebx, eax
-
 
1176
        xor     eax, eax
-
 
1177
        jmp     .addpos
-
 
1178
@@:
-
 
1179
        ret
-
 
1180
.native:
-
 
1181
        push    70
-
 
1182
        pop     eax
-
 
1183
        int     0x40
-
 
1184
        test    eax, eax
-
 
1185
        jz      .addpos
-
 
1186
        cmp     eax, 6
-
 
1187
        jnz     @b
-
 
1188
        xor     eax, eax
-
 
1189
.addpos:
-
 
1190
        add     dword [ecx+_FILE.fioffset], ebx
-
 
1191
        adc     dword [ecx+_FILE.fioffset+4], 0
-
 
1192
        ret
-
 
1193
 
-
 
1194
; void __stdcall seek(HANDLE hFile, int method, __int64 newpos);
-
 
1195
seek:
-
 
1196
        pushad
-
 
1197
        mov     ecx, [esp+36]
-
 
1198
        mov     eax, [esp+44]
-
 
1199
        mov     edx, [esp+48]
-
 
1200
        cmp     dword [esp+40], 1
-
 
1201
        jb      .set
-
 
1202
        ja      .end
-
 
1203
        add     eax, dword [ecx+_FILE.pos]
-
 
1204
        adc     edx, dword [ecx+_FILE.pos+4]
-
 
1205
        jmp     .set
-
 
1206
.end:
-
 
1207
        add     eax, dword [ecx+_FILE.attr+32]
-
 
1208
        adc     edx, dword [ecx+_FILE.attr+36]
-
 
1209
.set:
-
 
1210
        mov     dword [ecx+_FILE.pos], eax
-
 
1211
        mov     dword [ecx+_FILE.pos+4], edx
-
 
1212
        and     eax, not 2047
-
 
1213
        cmp     eax, dword [ecx+_FILE.bufpos]
-
 
1214
        jnz     @f
-
 
1215
        cmp     edx, dword [ecx+_FILE.bufpos+4]
-
 
1216
        jz      .bufposok
-
 
1217
@@:
-
 
1218
        and     [ecx+_FILE.bufsize], 0
-
 
1219
        mov     dword [ecx+_FILE.bufpos], eax
-
 
1220
        mov     dword [ecx+_FILE.bufpos+4], edx
-
 
1221
.bufposok:
-
 
1222
        cmp     [ecx+_FILE.bufsize], 0
-
 
1223
        jnz     .ret
-
 
1224
        cmp     eax, dword [ecx+_FILE.fioffset]
-
 
1225
        jnz     @f
-
 
1226
        cmp     edx, dword [ecx+_FILE.fioffset+4]
-
 
1227
        jz      .ret
-
 
1228
@@:
-
 
1229
        mov     dword [ecx+_FILE.fioffset], eax
-
 
1230
        mov     dword [ecx+_FILE.fioffset+4], edx
-
 
1231
        mov     eax, [ecx+_FILE.hPlugin]
-
 
1232
        test    eax, eax
-
 
1233
        jz      @f
-
 
1234
        push    dword [ecx+_FILE.fioffset+4]
-
 
1235
        push    dword [ecx+_FILE.fioffset]
-
 
1236
        push    [ecx+_FILE.hFile]
-
 
1237
        call    [eax+PluginInfo.setpos]
-
 
1238
@@:
-
 
1239
.ret:
-
 
1240
        popad
-
 
1241
        ret     16
-
 
1242
 
-
 
1243
setpos_default:
-
 
1244
        push    dword [esp+12]
-
 
1245
        push    dword [esp+12]
-
 
1246
        push    0
-
 
1247
        push    dword [esp+16]
-
 
1248
        call    seek
-
 
1249
        ret     12
-
 
1250
 
-
 
1251
; __int64 __stdcall filesize(HANDLE hFile);
-
 
1252
filesize:
-
 
1253
        mov     eax, [esp+4]
-
 
1254
        mov     edx, dword [eax+_FILE.attr+36]
-
 
1255
        mov     eax, dword [eax+_FILE.attr+32]
-
 
1256
        ret     4
-
 
1257
 
-
 
1258
; void __stdcall close(HANDLE hFile);
-
 
1259
close:
-
 
1260
        pushad
-
 
1261
        mov     ecx, [esp+24h]
-
 
1262
        mov     eax, [ecx+_FILE.hPlugin]
-
 
1263
        test    eax, eax
-
 
1264
        jz      @f
-
 
1265
        push    ecx
-
 
1266
        push    [ecx+_FILE.hFile]
-
 
1267
        call    [eax+PluginInfo.close]
-
 
1268
        pop     ecx
-
 
1269
@@:
-
 
1270
        call    pgfree
-
 
1271
        popad
-
 
1272
        ret     4
-
 
1273
 
-
 
1274
getattr_default:
-
 
1275
        mov     eax, 2
-
 
1276
        ret     12