Subversion Repositories Kolibri OS

Rev

Rev 1688 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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