Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2.  virtual at 0
  3. _FILE:
  4. .pos            dq      ?
  5. .bufpos         dq      ?
  6. .bufsize        dd      ?
  7. .mode           dd      ?
  8. .hPlugin        dd      ?
  9. .hFile          dd      ?
  10. .fileinfo:
  11. .fimode         dd      ?
  12. .fioffset       dq      ?
  13. .fisize         dd      ?
  14. .fibuf          dd      ?
  15. .finame         rb      1024
  16. .attr           rb      40
  17. align 512
  18. .buf            rb      2048
  19. .size = $
  20. end virtual
  21.  
  22. O_READ = 1      ; allows read from file
  23. O_WRITE = 2     ; allows write to file
  24. O_CREATE = 4    ; if file does not exist and this flag is set, create file;
  25.                 ; if file does not exist and this flag is not set, fail
  26. O_TRUNCATE = 8  ; truncate file if it exists
  27. O_SEQUENTIAL_ONLY = 10h ; there will be no 'seek'/'setpos' calls
  28.  
  29.  
  30. ; void __stdcall close(HANDLE hFile);
  31. close:
  32.         pushad
  33.         mov     ecx, [esp+24h]
  34.         mov     eax, [ecx+_FILE.hPlugin]
  35.         test    eax, eax
  36.         jz      @f
  37.         push    ecx
  38.         push    [ecx+_FILE.hFile]
  39.         call    [aClose]
  40.         pop     ecx
  41. @@:
  42.         call    pgfree
  43.         popad
  44.         ret     4
  45.  
  46. ; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
  47. read:
  48.         xor     eax, eax
  49.         pushad
  50.         mov     ecx, [esp+36]
  51.         test    [ecx+_FILE.mode], O_READ
  52.         jnz     @f
  53. .ret:
  54.         popad
  55.         ret     12
  56. @@:
  57.         cmp     dword [esp+44], eax
  58.         jz      .ret
  59.         mov     [ecx+_FILE.fimode], eax
  60.         mov     ebx, [ecx+_FILE.bufsize]
  61.         mov     eax, dword [ecx+_FILE.pos]
  62.         and     eax, 2047
  63.         sub     ebx, eax
  64.         jbe     .nobuf0
  65.         cmp     ebx, [esp+44]
  66.         jbe     @f
  67.         mov     ebx, [esp+44]
  68. @@:
  69.         push    ecx
  70.         lea     esi, [ecx+eax+_FILE.buf]
  71.         mov     ecx, ebx
  72.         mov     edi, [esp+44]
  73.         rep     movsb
  74.         pop     ecx
  75.         mov     [esp+40], edi
  76.         add     [esp+28], ebx
  77.         add     dword [ecx+_FILE.pos], ebx
  78.         adc     dword [ecx+_FILE.pos+4], 0
  79.         test    dword [ecx+_FILE.pos], 2047
  80.         jnz     @f
  81.         and     [ecx+_FILE.bufsize], 0
  82. @@:
  83.         sub     [esp+44], ebx
  84.         jz      .ret
  85. .nobuf0:
  86.         test    dword [ecx+_FILE.pos], 2047
  87.         jz      .aligned
  88.         cmp     dword [ecx+_FILE.bufsize], 0
  89.         jnz     .ret
  90.         lea     ebx, [ecx+_FILE.fileinfo]
  91.         mov     dword [ebx+12], 2048
  92.         lea     eax, [ecx+_FILE.buf]
  93.         mov     dword [ebx+16], eax
  94.         mov     eax, dword [ecx+_FILE.fioffset]
  95.         mov     dword [ecx+_FILE.bufpos], eax
  96.         mov     eax, dword [ecx+_FILE.fioffset+4]
  97.         mov     dword [ecx+_FILE.bufpos+4], eax
  98.         call    .doread
  99.         test    eax, eax
  100.         jnz     .ret
  101.         mov     [ecx+_FILE.bufsize], ebx
  102.         mov     eax, dword [ecx+_FILE.pos]
  103.         and     eax, 2047
  104.         sub     ebx, eax
  105.         jbe     .ret
  106.         cmp     ebx, [esp+44]
  107.         jbe     @f
  108.         mov     ebx, [esp+44]
  109. @@:
  110.         push    ecx
  111.         lea     esi, [ecx+eax+_FILE.buf]
  112.         mov     ecx, ebx
  113.         mov     edi, [esp+44]
  114.         rep     movsb
  115.         pop     ecx
  116.         add     dword [ecx+_FILE.pos], ebx
  117.         adc     dword [ecx+_FILE.pos+4], 0
  118.         mov     [esp+40], edi
  119.         add     [esp+28], ebx
  120.         sub     [esp+44], ebx
  121.         jz      .ret
  122.         test    dword [ecx+_FILE.pos], 2047
  123.         jnz     .ret
  124. .aligned:
  125.         lea     ebx, [ecx+_FILE.fileinfo]
  126.         mov     eax, [esp+44]
  127.         and     eax, not 2047
  128.         jz      .finish
  129.         and     [ecx+_FILE.bufsize], 0
  130.         mov     [ebx+12], eax
  131.         mov     eax, [esp+40]
  132.         mov     [ebx+16], eax
  133.         call    .doread
  134.         test    eax, eax
  135.         jnz     .ret
  136.         add     dword [ecx+_FILE.pos], ebx
  137.         adc     dword [ecx+_FILE.pos+4], 0
  138.         add     [esp+28], ebx
  139.         add     [esp+40], ebx
  140.         sub     [esp+44], ebx
  141.         jz      .ret
  142.         cmp     ebx, [ecx+_FILE.fisize]
  143.         jb      .ret
  144. .finish:
  145.         lea     ebx, [ecx+_FILE.fileinfo]
  146.         mov     dword [ebx+12], 2048
  147.         lea     eax, [ecx+_FILE.buf]
  148.         mov     [ebx+16], eax
  149.         and     [ecx+_FILE.bufsize], 0
  150.         mov     eax, dword [ecx+_FILE.fioffset]
  151.         mov     dword [ecx+_FILE.bufpos], eax
  152.         mov     eax, dword [ecx+_FILE.fioffset+4]
  153.         mov     dword [ecx+_FILE.bufpos+4], eax
  154.         call    .doread
  155.         test    eax, eax
  156.         jnz     .ret
  157.         mov     [ecx+_FILE.bufsize], ebx
  158.         cmp     ebx, [esp+44]
  159.         jb      @f
  160.         mov     ebx, [esp+44]
  161. @@:
  162.         add     [esp+28], ebx
  163.         add     dword [ecx+_FILE.pos], ebx
  164.         adc     dword [ecx+_FILE.pos+4], 0
  165.         lea     esi, [ecx+_FILE.buf]
  166.         mov     edi, [esp+40]
  167.         mov     ecx, ebx
  168.         rep     movsb
  169.         popad
  170.         ret     12
  171. .doread:
  172.         mov     eax, [ecx+_FILE.hPlugin]
  173.         test    eax, eax
  174.         jz      .native
  175.         push    ecx
  176.         push    [ecx+_FILE.fisize]
  177.         push    [ecx+_FILE.fibuf]
  178.         push    [ecx+_FILE.hFile]
  179.         call    [eax+aRead]
  180.         pop     ecx
  181.         cmp     eax, -1
  182.         jz      @f
  183.         mov     ebx, eax
  184.         xor     eax, eax
  185.         jmp     .addpos
  186. @@:
  187.         ret
  188. .native:
  189.         push    70
  190.         pop     eax
  191.         int     0x40
  192.         test    eax, eax
  193.         jz      .addpos
  194.         cmp     eax, 6
  195.         jnz     @b
  196.         xor     eax, eax
  197. .addpos:
  198.         add     dword [ecx+_FILE.fioffset], ebx
  199.         adc     dword [ecx+_FILE.fioffset+4], 0
  200.         ret
  201.  
  202. ; void __stdcall seek(HANDLE hFile, int method, __int64 newpos);
  203. seek:
  204.         pushad
  205.         mov     ecx, [esp+36]
  206.         mov     eax, [esp+44]
  207.         mov     edx, [esp+48]
  208.         cmp     dword [esp+40], 1
  209.         jb      .set
  210.         ja      .end
  211.         add     eax, dword [ecx+_FILE.pos]
  212.         adc     edx, dword [ecx+_FILE.pos+4]
  213.         jmp     .set
  214. .end:
  215.         add     eax, dword [ecx+_FILE.attr+32]
  216.         adc     edx, dword [ecx+_FILE.attr+36]
  217. .set:
  218.         mov     dword [ecx+_FILE.pos], eax
  219.         mov     dword [ecx+_FILE.pos+4], edx
  220.         and     eax, not 2047
  221.         cmp     eax, dword [ecx+_FILE.bufpos]
  222.         jnz     @f
  223.         cmp     edx, dword [ecx+_FILE.bufpos+4]
  224.         jz      .bufposok
  225. @@:
  226.         and     [ecx+_FILE.bufsize], 0
  227.         mov     dword [ecx+_FILE.bufpos], eax
  228.         mov     dword [ecx+_FILE.bufpos+4], edx
  229. .bufposok:
  230.         cmp     [ecx+_FILE.bufsize], 0
  231.         jnz     .ret
  232.         cmp     eax, dword [ecx+_FILE.fioffset]
  233.         jnz     @f
  234.         cmp     edx, dword [ecx+_FILE.fioffset+4]
  235.         jz      .ret
  236. @@:
  237.         mov     dword [ecx+_FILE.fioffset], eax
  238.         mov     dword [ecx+_FILE.fioffset+4], edx
  239.         mov     eax, [ecx+_FILE.hPlugin]
  240.         test    eax, eax
  241.         jz      @f
  242.         push    dword [ecx+_FILE.fioffset+4]
  243.         push    dword [ecx+_FILE.fioffset]
  244.         push    [ecx+_FILE.hFile]
  245.         call    [eax+aSetpos]
  246. @@:
  247. .ret:
  248.         popad
  249.         ret     16
  250.  
  251.  
  252. ; __int64 __stdcall tell(HANDLE hFile);
  253. tell:
  254.         mov     eax, [esp+4]
  255.         mov     edx, dword [eax+_FILE.pos+4]
  256.         mov     eax, dword [eax+_FILE.pos]
  257.         ret     4
  258.  
  259. ; HANDLE __stdcall open(const char* name, int mode);
  260. ; Opens physical file
  261. open:
  262.         pushad
  263.         mov     ecx, _FILE.size
  264.         call    xpgalloc
  265.         test    eax, eax
  266.         jz      .ret0z
  267.         mov     [esp+28], eax
  268.         mov     ecx, eax
  269.         mov     esi, [esp+36]
  270.         lea     edi, [eax+_FILE.finame]
  271.         lea     edx, [eax+_FILE.finame+1024]
  272. @@:
  273.         lodsb
  274.         stosb
  275.         test    al, al
  276.         jz      @f
  277.         cmp     edi, edx
  278.         jb      @b
  279. .ret0:
  280.         call    pgfree
  281. .ret0z:
  282.         popad
  283.         xor     eax, eax
  284.         ret     8
  285. @@:
  286.         mov     eax, [esp+40]
  287.         mov     [ecx+_FILE.mode], eax
  288. .getattr:
  289.         lea     edi, [ecx+_FILE.fileinfo]
  290.         mov     ebx, edi
  291.         push    5
  292.         pop     eax
  293.         stosd
  294.         xor     eax, eax
  295.         stosd
  296.         stosd
  297.         stosd
  298.         lea     eax, [ecx+_FILE.attr]
  299.         stosd
  300.         push    70
  301.         pop     eax
  302.         int     0x40
  303.         test    eax, eax
  304.         jz      .found
  305.         cmp     eax, 5
  306.         jnz     .ret0
  307. ; file does not exist
  308.         test    [ecx+_FILE.mode], O_CREATE
  309.         jz      .ret0
  310. .truncate:
  311.         lea     ebx, [ecx+_FILE.fileinfo]
  312.         mov     byte [ebx], 2
  313.         push    70
  314.         pop     eax
  315.         int     0x40
  316.         test    eax, eax
  317.         jz      .getattr
  318.         jmp     .ret0
  319. .found:
  320.         test    [ecx+_FILE.mode], O_TRUNCATE
  321.         jz      @f
  322.         cmp     dword [ecx+_FILE.attr+36], eax
  323.         jnz     .truncate
  324.         cmp     dword [ecx+_FILE.attr+32], eax
  325.         jnz     .truncate
  326. @@:
  327.         mov     dword [ecx+_FILE.pos], eax
  328.         mov     dword [ecx+_FILE.pos+4], eax
  329.         mov     dword [ecx+_FILE.bufpos], eax
  330.         mov     dword [ecx+_FILE.bufpos+4], eax
  331.         mov     [ecx+_FILE.bufsize], eax
  332.         mov     [ecx+_FILE.hPlugin], eax
  333.         mov     [ecx+_FILE.hFile], eax
  334.         mov     dword [ecx+_FILE.fioffset], eax
  335.         mov     dword [ecx+_FILE.fioffset+4], eax
  336.         mov     [esp+28], ecx
  337.         popad
  338.         ret     8
  339.  
  340. ; HANDLE __stdcall open2(int plugin_id, HANDLE plugin_instance, const char* name, int mode);
  341. ; Opens file on plugin panel
  342. open2:
  343.         cmp     dword [esp+4], 0
  344.         jnz     .plugin
  345.         pop     eax
  346.         add     esp, 8
  347.         push    eax
  348.         jmp     open
  349. .plugin:
  350.         pushad
  351.         mov     ecx, _FILE.size
  352.         call    xpgalloc
  353.         test    eax, eax
  354.         jz      .ret0z
  355.         mov     [esp+28], eax
  356.         mov     ecx, eax
  357.         mov     esi, [esp+44]
  358.         lea     edi, [eax+_FILE.finame]
  359.         lea     edx, [eax+_FILE.finame+1024]
  360. @@:
  361.         lodsb
  362.         stosb
  363.         test    al, al
  364.         jz      @f
  365.         cmp     edi, edx
  366.         jb      @b
  367. .ret0:
  368.         call    pgfree
  369. .ret0z:
  370.         popad
  371.         xor     eax, eax
  372.         ret     8
  373. @@:
  374.         mov     edx, [esp+36]
  375.         mov     [ecx+_FILE.hPlugin], edx
  376.         mov     ebx, [esp+40]
  377.         mov     eax, [esp+48]
  378.         mov     [ecx+_FILE.mode], eax
  379.         push    ebx ecx
  380.         push    eax
  381.         lea     eax, [ecx+_FILE.finame]
  382.         push    eax
  383.         push    ebx
  384.         call    [edx+aOpen]
  385.         pop     ecx ebx
  386.         test    eax, eax
  387.         jz      .ret0
  388.         mov     [ecx+_FILE.hFile], eax
  389.         mov     edx, [esp+36]
  390.         push    ecx
  391.         lea     edi, [ecx+_FILE.fileinfo]
  392.         push    edi
  393.         xor     eax, eax
  394.         push    ecx
  395.         push    10
  396.         pop     ecx
  397.         rep     stosd
  398.         pop     ecx
  399.         lea     eax, [ecx+_FILE.finame]
  400.         push    eax
  401.         push    ebx
  402.         call    [edx+aGetattr]
  403.         pop     ecx
  404.         xor     eax, eax
  405.         mov     dword [ecx+_FILE.pos], eax
  406.         mov     dword [ecx+_FILE.pos+4], eax
  407.         mov     dword [ecx+_FILE.bufpos], eax
  408.         mov     dword [ecx+_FILE.bufpos+4], eax
  409.         mov     [ecx+_FILE.bufsize], eax
  410.         mov     dword [ecx+_FILE.fioffset], eax
  411.         mov     dword [ecx+_FILE.fioffset+4], eax
  412.         mov     [esp+28], ecx
  413.         popad
  414.         ret     16
  415.  
  416. ; __int64 __stdcall filesize(HANDLE hFile);
  417. filesize:
  418.         mov     eax, [esp+4]
  419.         mov     edx, dword [eax+_FILE.attr+36]
  420.         mov     eax, dword [eax+_FILE.attr+32]
  421.         ret     4
  422.  
  423.  
  424. ;
  425. ;makedir:
  426. ;; create directory with name from CopyDestEditBuf+12
  427. ;; destroys eax
  428. ;        push    ebx
  429. ;        push    70
  430. ;        pop     eax
  431. ;        mov     ebx, mkdirinfo
  432. ;        int     0x40
  433. ;        pop     ebx
  434. ;        test    eax, eax
  435. ;        jz      .ret
  436. ;        cmp     dword [esp+8], DeleteErrorBtn
  437. ;        jnz     @f
  438. ;        cmp     [copy_bSkipAll], 0
  439. ;        jz      @f
  440. ;        push    1
  441. ;        pop     eax
  442. ;        jmp     .ret
  443. ;@@:
  444. ;        push    dword CopyDestEditBuf+12
  445. ;        push    dword aCannotMakeFolder
  446. ;        call    get_error_msg
  447. ;        push    eax
  448. ;        mov     eax, esp
  449. ;        push    dword [eax+20]
  450. ;        push    dword [eax+16]
  451. ;        push    eax
  452. ;        push    3
  453. ;        call    SayErr
  454. ;        add     esp, 3*4
  455. ;        test    eax, eax
  456. ;        jz      makedir
  457. ;.ret:
  458. ;        ret     8
  459. ;
  460.  
  461.  
  462.  
  463. ;######################################################################################################
  464. ;######################################################################################################
  465. ;######################################################################################################
  466. ;######################################################################################################
  467.  
  468.  
  469. CHECK_FOR_LEAKS = 0
  470. if CHECK_FOR_LEAKS
  471. uglobal
  472. allocatedregions rd 1024
  473. endg
  474. iglobal
  475. numallocatedregions dd 0
  476. endg
  477. end if
  478. pgalloc:
  479. ; in: ecx=size
  480. ; out: eax=pointer or NULL
  481.         push    ebx
  482.         push    68
  483.         pop     eax
  484.         push    12
  485.         pop     ebx
  486.         int     0x40
  487. if CHECK_FOR_LEAKS
  488.         test    eax, eax
  489.         jz      .no
  490. .b:
  491.         mov     ebx, [numallocatedregions]
  492.         cmp     ebx, 1024
  493.         jb      @f
  494.         int3
  495.         jmp     $
  496. @@:
  497.         mov     [allocatedregions+ebx*4], eax
  498.         inc     [numallocatedregions]
  499. .no:
  500. end if
  501.         pop     ebx
  502.         ret
  503.  
  504. pgfree:
  505. ; in: ecx=pointer
  506. ; destroys eax
  507. if CHECK_FOR_LEAKS
  508.         jecxz   .no
  509.         mov     eax, [numallocatedregions]
  510. @@:
  511.         dec     eax
  512.         js      .a
  513.         cmp     [allocatedregions+eax*4], ecx
  514.         jnz     @b
  515.         jmp     @f
  516. .a:
  517.         int3
  518.         jmp     $
  519. @@:
  520.         dec     [numallocatedregions]
  521. @@:
  522.         cmp     eax, [numallocatedregions]
  523.         jae     @f
  524.         push    [allocatedregions+eax*4+4]
  525.         pop     [allocatedregions+eax*4]
  526.         inc     eax
  527.         jmp     @b
  528. @@:
  529. .no:
  530. end if
  531.         push    ebx
  532.         push    68
  533.         pop     eax
  534.         push    13
  535.         pop     ebx
  536.         int     0x40
  537.         pop     ebx
  538.         ret
  539.  
  540.  
  541.  
  542.  
  543. pgrealloc:
  544. ; in: ecx=size, edx=pointer
  545. ; out: eax=pointer
  546.         push    ebx
  547.         push    68
  548.         pop     eax
  549.         push    20
  550.         pop     ebx
  551.         int     0x40
  552. if CHECK_FOR_LEAKS
  553.         test    edx, edx
  554.         jz      pgalloc.b
  555.         test    eax, eax
  556.         jz      .no
  557.         cmp     eax, edx
  558.         jz      .no
  559.         xor     ebx, ebx
  560. @@:
  561.         cmp     ebx, [numallocatedregions]
  562.         jae     .a
  563.         cmp     [allocatedregions+ebx*4], edx
  564.         jz      @f
  565.         inc     ebx
  566.         jmp     @b
  567. @@:
  568.         mov     [allocatedregions+ebx*4], eax
  569.         jmp     .no
  570. .a:
  571.         int3
  572.         jmp     $
  573. .no:
  574. end if
  575.         pop     ebx
  576.         ret
  577.  
  578. xpgalloc:
  579. ; in: ecx=size
  580. ; out: eax=pointer or NULL
  581.         call    pgalloc
  582. .common:
  583.         test    eax, eax
  584.         jnz     @f
  585.         ;call    SayNoMem
  586.  
  587. @@:
  588.         ret
  589.  
  590. xpgrealloc:
  591. ; in: edx=pointer, ecx=new size
  592. ; out: eax=pointer or NULL
  593.         call    pgrealloc
  594.         jmp     xpgalloc.common
  595.  
  596. getfreemem:
  597. ; out: eax=size of free RAM in Kb
  598.         push    ebx
  599.         mcall   18,16
  600.         pop     ebx
  601.         ret
  602.  
  603.  
  604.  
  605. proc myAddFile name:dword, bdfe_info:dword, hFile:dword
  606. locals
  607.    beginFile dd 0
  608.    pos  dd 0
  609. endl
  610.  
  611. ;dps 'file unpack '
  612. ;dpsP [name]
  613. ;dnl
  614.         pusha
  615.         mov     [pos],0
  616.  
  617.         push    ebp
  618.         stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF
  619.         pop     ebp
  620.  
  621.         mov     [fsWrite.cmd],2
  622.         mov     [fsWrite.pos],0
  623.         mov     [fsWrite.size],eax
  624.         mov     eax,[name]
  625.         mov     [fsWrite.path],eax
  626.         mcall   70,fsWrite
  627.  
  628.  .loop:
  629.         mov     eax, [fsWrite.size]
  630.         add     [pos], eax
  631.  
  632.  
  633.         push    ebp
  634.         stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF
  635.         pop     ebp
  636.  
  637.         cmp     eax,0
  638.         jz      .end
  639.  
  640.         mov     [fsWrite.cmd],3
  641.         mov     [fsWrite.size],eax
  642.         mov     eax,[pos]
  643.         mov     [fsWrite.pos],eax
  644.         mcall   70,fsWrite
  645.         jmp     .loop
  646.    .end:
  647.  
  648.  
  649.         popa
  650.         mov     eax,1
  651.         ret
  652. endp
  653.  
  654.  
  655. proc myAddDir name:dword, bdfe_info:dword
  656.         dps 'log adddir'
  657.         mov     eax,[name]
  658.         dpsP eax
  659.         dnl
  660.  
  661.         pusha
  662.         mov     eax,[name]
  663.         mov     [fsNewDir.path],eax
  664.         mcall   70,fsNewDir
  665.    ;
  666.    ;     mov     edi,[name]
  667.    ;     xor     al,al
  668.    ;     mov     ecx,256
  669.    ;     repne scasb
  670.    ;     mov     edx,256
  671.    ;     sub     edx,ecx
  672.    ;     mov     eax,[name]
  673.    ;     mcall   30,1,eax
  674.         popa
  675.         mov     eax,1
  676.         ret
  677. endp
  678.  
  679.  
  680. ;ª®¯¨àã¥â ¯®á«¥¤­¥¥ ¨¬ï ¢ ¯®«­®¬ ¨«¨ ®â­®á¨â¥«ì­®¬ ¯ã⨠¡¥§ à áè¨à¥­¨ï
  681. proc cpLastName inp:dword, outp:dword
  682.         push    edi esi
  683.         mov     edi,[inp]
  684.         xor     al,al
  685.         mov     ecx,256         ;                V
  686.         repne scasb             ;/fol1/file1.zip
  687.  
  688.         mov     al,'/'
  689.         mov     ecx,256
  690.         std                     ;   V
  691.         repne scasb             ;/fol1/file1.zip
  692.         cld
  693.  
  694.         mov     esi,edi
  695.         add     esi,2
  696.         mov     ecx,256         ;/fol1/file1.zip
  697.         mov     edi,[outp]      ;file1.zip
  698.     @@: lodsb
  699.         stosb
  700.         test    al,al
  701.         jz      @f
  702.         loop    @b
  703.     @@:
  704.  
  705.         mov     al,'.'
  706.         mov     ecx,256
  707.         std                     ;    V
  708.         repne scasb             ;file1.zip
  709.         cld
  710.         mov     [edi+1], byte 0
  711.  
  712.         pop     esi edi
  713.         ret
  714. endp
  715.  
  716.  
  717. proc cpAllExcludeLastName inp:dword, outp:dword
  718.         push    edi esi
  719.         mov     edi,[inp]
  720.         xor     al,al
  721.         mov     ecx,256         ;                V
  722.         repne scasb             ;/fol1/file1.zip
  723.  
  724.         mov     al,'/'
  725.         mov     ecx,256
  726.         std                     ;   V
  727.         repne scasb             ;/fol1/file1.zip
  728.         cld
  729.         mov     edx,edi
  730.         add     edx, 2
  731.  
  732.         mov     esi,[inp]
  733.         mov     ecx,256         ;/fol1/file1.zip
  734.         mov     edi,[outp]      ;file1.zip
  735.     @@: lodsb
  736.         stosb
  737.         test    al,al
  738.         jz      @f
  739.         cmp     esi,edx
  740.         jae     @f
  741.         loop    @b
  742.     @@:
  743.         xor     al, al
  744.         stosb
  745.  
  746.         pop     esi edi
  747.         ret
  748. endp
  749.