Subversion Repositories Kolibri OS

Rev

Rev 8346 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1688 mario79 1
;---------------------------------------------------------------------
2
; Kpack - Kolibri Packer
1671 mario79 3
; Kolibri version
4
; Written by diamond in 2006, 2007 specially for KolibriOS
5
;
7829 leency 6
; Disassemled and corrected in 2010-2011 specially for FASM
1671 mario79 7
;            by Marat Zakiyanov aka Mario79, aka Mario
8
;
9
; Uses LZMA compression library by Igor Pavlov
10
; (for more information on LZMA and 7-Zip visit http://www.7-zip.org)
11
; (plain-C packer and ASM unpacker are ported by diamond)
12
;---------------------------------------------------------------------
13
use32
14
	org	0
15
 
16
	db 'MENUET01'
17
	dd 1
1681 mario79 18
	dd START
19
	dd IM_END
1688 mario79 20
	dd I_END
1681 mario79 21
	dd stacktop
22
	dd params
1686 mario79 23
	dd cur_dir_path
1671 mario79 24
;---------------------------------------------------------------------
1702 Lrz 25
include '../../../config.inc'		;for nightbuild
8346 IgorA 26
include '../../../KOSfuncs.inc'
1688 mario79 27
include '../../../macros.inc'
7829 leency 28
include '../../../gui_patterns.inc'
1686 mario79 29
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
8346 IgorA 30
include '../../../load_lib.mac'
1686 mario79 31
  @use_library
1681 mario79 32
 
1671 mario79 33
START:
8346 IgorA 34
	mcall	SF_SYS_MISC,SSF_HEAP_INIT
35
	mcall	SF_SET_EVENTS_MASK,0x80000027
1686 mario79 36
 
7834 leency 37
	load_libraries l_libs_start,load_lib_end
1688 mario79 38
	cmp eax,-1
39
	je exit
40
 
3178 IgorA 41
	init_checkboxes2 check1,check1_end
7834 leency 42
	call	clear_messages
3177 IgorA 43
 
7834 leency 44
; pack kernel ?
45
	cmp	[params], dword '-ker'
46
	jne @f
47
 
48
	mov	esi,kernel_name
49
	mov	edi,inname
50
	call	copy_1
51
 
52
	mov	esi,kernel_name
53
	mov	edi,outname
54
	call	copy_1
55
 
56
	mov	esi,defpath
57
	mov	edi,path
58
	call	copy_1
59
 
60
	call	pack
61
	jmp exit
62
 
63
@@:
9587 vitalkrilo 64
; set default path = /SYS/
1671 mario79 65
	mov	esi,defpath
66
	mov	edi,path
67
	mov	[edi-4],dword 6
68
	movsw
69
	movsd
70
; get system window info
1688 mario79 71
	xor	eax,eax
72
	cmp	[params],al
73
	je	default
74
 
75
	mov	edi,path
1671 mario79 76
	mov	esi,params
1688 mario79 77
	call	copy_1
1681 mario79 78
 
1688 mario79 79
	sub	esi,2
80
	std
81
@@:
82
	lodsb
83
	dec	edi
84
	cmp	al,byte '/'
85
	jnz	@r
86
 
87
	mov	[edi-1],byte 0
1671 mario79 88
	mov	edi,inname
1688 mario79 89
	add	esi,2
90
	push	esi
91
	call	copy_1
92
	pop	esi
1671 mario79 93
	mov	edi,outname
1688 mario79 94
	call	copy_1
7834 leency 95
end_param:
1688 mario79 96
;---------------------------------------------------------------------
7829 leency 97
	call set_editbox_position_all
1688 mario79 98
;---------------------------------------------------------------------
1671 mario79 99
	call	draw_window
100
	call	pack
1688 mario79 101
	jmp	OD_initialization
102
;*********************************************************************
1671 mario79 103
default:
104
	mov	esi,definoutname
105
	mov	edi,esi
106
	xor	ecx,ecx
107
	xor	eax,eax
108
	dec	ecx
109
	repnz	scasb
110
	not	ecx
111
	dec	ecx
112
	mov	[innamelen],ecx
113
	push	ecx
114
	push	esi
115
	mov	edi,inname
116
	rep	movsb
117
	pop	esi
118
	pop	ecx
119
	mov	[outnamelen],ecx
120
	mov	edi,outname
121
	rep	movsb
122
;---------------------------------------------------------------------
1688 mario79 123
	call	set_editbox_position_all
124
;---------------------------------------------------------------------
125
OD_initialization:
1686 mario79 126
;OpenDialog	initialisation
127
	push    dword OpenDialog_data
128
	call    [OpenDialog_Init]
129
;---------------------------------------------------------------------
130
red:
1671 mario79 131
	call	draw_window
1681 mario79 132
;--------------------------------------
1686 mario79 133
still:
8346 IgorA 134
	mcall	SF_WAIT_EVENT
1671 mario79 135
	dec	eax
1686 mario79 136
	jz	red
1681 mario79 137
 
1671 mario79 138
	dec	eax
1686 mario79 139
	jz	key
1681 mario79 140
 
1671 mario79 141
	dec	eax
1686 mario79 142
	jz	button
143
 
144
	push	dword edit1
145
	call	[edit_box_mouse]
146
 
147
	push	dword edit2
148
	call	[edit_box_mouse]
149
 
150
	push	dword edit3
151
	call	[edit_box_mouse]
152
 
1713 mario79 153
	push	dword check1
154
	call	[check_box_mouse]
155
 
1686 mario79 156
	jmp	still
157
;*********************************************************************
1713 mario79 158
tell_compress_mess:
159
	push	compressing_len
160
	pop	ecx
161
	mov	esi,compressing_str
162
	call	write_string
163
	ret
164
;*********************************************************************
165
clear_mess_and_displogo:
166
	call	refresh_editbox_data
167
; clear messages
168
	call	clear_messages
169
; display logo
170
	mov	esi,info_str
171
	push	info_len
172
	pop	ecx
173
	call	write_string
174
	ret
175
;*********************************************************************
1688 mario79 176
clear_messages:
177
	xor	eax,eax
178
	mov	ecx,80*20/4+1
179
	mov	edi,message_mem
180
	rep	stosd
181
	ret
182
;*********************************************************************
183
exit:
184
	xor	eax,eax
185
	dec	eax
8346 IgorA 186
	mcall	;SF_TERMINATE_PROCESS
1688 mario79 187
;*********************************************************************
1686 mario79 188
button:
1671 mario79 189
; button pressed
8346 IgorA 190
	mcall	SF_GET_BUTTON
1671 mario79 191
	xchg	al,ah
192
	cmp	al,7
193
	jz	but7
1681 mario79 194
 
1671 mario79 195
	dec	eax
196
	jz	exit
1681 mario79 197
 
1671 mario79 198
	dec	eax
199
	jnz	nopack
1681 mario79 200
 
3178 IgorA 201
	bt dword[check1.flags],1
202
	jc	@f
1713 mario79 203
 
1671 mario79 204
	call	pack
1686 mario79 205
	jmp	still
1713 mario79 206
;---------------------------------------------------------------------
207
@@:
208
	call	kerpack
209
	jmp	still
1671 mario79 210
;---------------------------------------------------------------------
211
nopack:
212
	dec	eax
213
	jnz	nounpack