Subversion Repositories Kolibri OS

Rev

Rev 1686 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;*********************************************************************
  2. unpack:
  3.         call    refresh_editbox_data
  4. ; clear messages
  5.         call    clear_messages
  6. ; display logo
  7.         mov     esi,info_str
  8.         push    info_len
  9.         pop     ecx
  10.         call    write_string
  11.  
  12. ; load input file
  13.         mov     esi,inname
  14.         call    get_full_name
  15.         mov     ebx,fn70block
  16.         mov     [ebx],dword 5
  17.         and     [ebx+4],dword 0
  18.         and     [ebx+8],dword 0
  19.         and     [ebx+12],dword 0
  20.         mov     [ebx+16],dword file_attr
  21.         mcall   70
  22.         test    eax,eax
  23.         jnz     infileerr
  24.  
  25.         mov     ecx,[insize]
  26.         test    ecx,ecx
  27.         jz      infileerr
  28.  
  29.         mcall   68,12
  30.  
  31.         mov     [infile],eax
  32.  
  33.         mov     ebx,fn70block
  34.         mov     [ebx],byte 0
  35.         mov     [ebx+16],eax
  36.         mov     eax,[insize]
  37.         mov     [ebx+12],eax
  38.  
  39.         mcall   70
  40.         test    eax,eax
  41.         jnz     infileerr
  42.  
  43.         mov     eax,[infile]
  44.         cmp     [eax],dword 'KPCK'
  45.         jz      @f
  46. ;--------------------------------------
  47. unpack_err:
  48.         call    return_memory
  49.         mov     esi,notpacked_str
  50.         push    notpacked_len
  51.         pop     ecx
  52.         jmp     write_string
  53. ;---------------------------------------------------------------------
  54. @@:
  55.         mov     ecx,[eax+4]
  56.         add     ecx,[insize]
  57.  
  58.         mcall   68,20,,[infile]
  59.  
  60.         mov     [infile],eax
  61.         add     eax,[insize]
  62.         mov     [outfile],eax
  63.         mov     [outfilebest],eax
  64.  
  65.  
  66.         mov     esi,[infile]
  67.         mov     eax,[esi+8]
  68.         push    eax
  69.         and     al,0C0h
  70.         cmp     al,0C0h
  71.         pop     eax
  72.         jz      unpack_err
  73.  
  74.         and     al,not 0C0h
  75.         dec     eax
  76.         jnz     unpack_err
  77.  
  78.         mov     eax,[esi+4]
  79.         mov     [outsize],eax
  80.         push    eax
  81.         push    [outfile]
  82.         add     esi,11
  83.         push    esi
  84.         mov     eax,[esi+1]
  85.         xchg    al,ah
  86.         ror     eax,16
  87.         xchg    al,ah
  88.         mov     [esi+1],eax
  89.         call    lzma_decompress
  90.         mov     esi,[infile]
  91.         test    [esi+8],byte 80h
  92.         jnz     uctr1
  93.  
  94.         test    [esi+8],byte 40h
  95.         jz      udone
  96.  
  97.         add     esi,[insize]
  98.         sub     esi,5
  99.         lodsd
  100.         mov     ecx,eax
  101.         jecxz   udone
  102.  
  103.         mov     dl,[esi]
  104.         mov     esi,[outfile]
  105. ;--------------------------------------
  106. uc1:
  107.         lodsb
  108.         sub     al,0E8h
  109.         cmp     al,1
  110.         ja      uc1
  111.  
  112.         cmp     [esi],dl
  113.         jnz     uc1
  114.  
  115.         lodsd
  116.         shr     ax,8
  117.         ror     eax,16
  118.         xchg    al,ah
  119.         sub     eax,esi
  120.         add     eax,[outfile]
  121.         mov     [esi-4],eax
  122.         loop    uc1
  123.         jmp     udone
  124. ;---------------------------------------------------------------------
  125. uctr1:
  126.         add     esi,[insize]
  127.         sub     esi,5
  128.         lodsd
  129.         mov     ecx,eax
  130.         jecxz   udone
  131.  
  132.         mov     dl,[esi]
  133.         mov     esi,[outfile]
  134. ;--------------------------------------
  135. uc2:
  136.         lodsb
  137. ;--------------------------------------
  138. @@:
  139.         cmp     al,15
  140.         jnz     uf
  141.  
  142.         lodsb
  143.         cmp     al,80h
  144.         jb      @b
  145.  
  146.         cmp     al,90h
  147.         jb      @f
  148. ;--------------------------------------
  149. uf:
  150.         sub     al,0E8h
  151.         cmp     al,1
  152.         ja      uc2
  153. ;--------------------------------------
  154. @@:
  155.         cmp     [esi],dl
  156.         jnz     uc2
  157.  
  158.         lodsd
  159.         shr     ax,8
  160.         ror     eax,16
  161.         xchg    al,ah
  162.         sub     eax,esi
  163.         add     eax,[outfile]
  164.         mov     [esi-4],eax
  165.         loop    uc2
  166. ;--------------------------------------
  167. udone:
  168.         mov     esi,unpacked_ok
  169.         push    unpacked_len
  170.         pop     ecx
  171.         call    write_string
  172.         jmp     saveout
  173. ;*********************************************************************
  174. return_memory:
  175.         mov     ecx,[infile]
  176.         test    ecx,ecx
  177.         jz      @f
  178.         mcall   68,13,
  179.         xor     eax,eax
  180.         mov     [infile],eax
  181. @@:
  182.         ret
  183. ;*********************************************************************