summaryrefslogtreecommitdiff
path: root/other/burneye/tmp/PE-Crypt-1.02/k-commctrl.inc
blob: f6649d14b6dbfc48e25e4fcbf079286d688017c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221

LVCF_FMT                EQU	0001
LVCF_WIDTH              EQU	0002
LVCF_TEXT               EQU	0004
LVCF_SUBITEM            EQU	0008

LVIF_TEXT               EQU	0001
LVIF_IMAGE              EQU	0002
LVIF_PARAM              EQU	0004
LVIF_STATE              EQU	0008

TTS_ALWAYSTIP           EQU	01

LVCFMT_RIGHT            EQU	0001
.data
;List Box Variables:

hList		dd	0

;List View Variables:

lv_item:
lvmask		dd	LVIF_TEXT
lvitem		dd	0
lvsubitem	dd	0
lvstate		dd	0
lvstatemask	dd	0
lvtext		dd	0
lvtextmax	dd	12
lvimage		dd	0
lvparam		dd	0

lv_col:
clmask		dd	LVCF_SUBITEM+LVCF_TEXT+LVCF_WIDTH+LVCF_FMT
clfmt		dd	LVCFMT_RIGHT
clcx		dd	0
cltext		dd	0
cltextmax	dd	20
clsubitem	dd	0

hLV	dd	0
itcnt	dd	0
colcnt	dd	0

;Text Box Variables:

hBox		dd	0
TmpHex		db	11 dup (0)
TmpDec		db	20 dup (0)
HexFmt		db	'%#08lx',0
DecFmt		db	'%0lu',0
CR_BLA		db	0dh, 0ah, 0

TOOLTIPS_CLASSA db	"tooltips_class32"

.code


KcommctrlInc_Start:

;================================================================================
;================ ListBox Functions =============================================

ListBoxIni	proc uses eax ebx ecx edx edi esi, handle:DWORD, identifier:DWORD

	pushf
	call	GetDlgItem, handle, identifier
	mov	hList, eax
	popf
	ret

ListBoxIni	endp

ListBoxGetSel	proc uses eax ebx ecx edx edi esi, buffer:DWORD

	ret
ListBoxGetSel	endp


ListBoxAdd	proc uses eax ebx ecx edx edi esi, string:DWORD

	pushf
	call	SendMessageA, hList, LB_ADDSTRING, 0, string
	popf
	ret

ListBoxAdd	endp

;================================================================================
;================ ListView Functions ============================================

ListViewIni	proc uses eax ebx ecx edx edi esi ebp, handle:DWORD, idListView:DWORD

	call	GetDlgItem, handle, idListView
	mov	hLV, eax
	ret
ListViewIni	endp

ListViewReset	proc uses eax ebx ecx edx edi esi ebp

	call	SendMessageA, hLV, LVM_DELETEALLITEMS, 0, 0
	mov	itcnt, 0
	ret

ListViewReset	endp

ListViewAddCol	proc uses eax ebx ecx edx edi esi ebp, width:DWORD, pstr:DWORD

	mov	eax, colcnt
	mov	clsubitem, eax
	mov	eax, width
	mov	clcx, eax
	mov	eax, pstr
	mov	dword ptr cltext, eax
	call	SendMessageA, hLV, LVM_INSERTCOLUMN, colcnt, offset lv_col
	inc	colcnt
	ret
ListViewAddCol	endp

ListViewAdd	proc uses eax ebx ecx edx edi esi ebp, pstr:DWORD

	mov	eax, itcnt
	mov	lvitem, eax
	mov	eax, pstr
	mov	dword ptr lvtext, eax
	call	SendMessageA, hLV, LVM_INSERTITEM, 0, offset lv_item
	mov	lvitem, 0
	inc	itcnt
	ret
ListViewAdd	endp

ListViewSubAdd	proc uses eax ebx ecx edx edi esi ebp, item:DWORD, place:DWORD, pstr:DWORD

	mov	eax, item
	mov	lvitem, eax
	mov	eax, place
	mov	lvsubitem, eax
	mov	eax, pstr
	mov	dword ptr lvtext, eax
	call	SendMessageA, hLV, LVM_SETITEM, 0, offset lv_item
	mov	lvitem, 0
	mov	lvsubitem, 0
	ret
ListViewSubAdd	endp

;================================================================================
;================ TextBox Functions =============================================

TextBoxIni	proc uses eax ebx ecx edx edi esi, hwnd:DWORD, ID:DWORD

	pushf
	call	GetDlgItem, [hwnd], ID
	mov	hBox, eax
	popf
	ret

TextBoxIni	endp


TextBoxHexWrite	proc uses eax ebx ecx edx edi esi, Hex:DWORD, Newline:DWORD
	
	pushf
	call	_wsprintfA, offset TmpHex, offset HexFmt, Hex
	add	esp, 12
	call	TextBoxWrite, offset TmpHex, Newline
	popf
	ret

TextBoxHexWrite	endp


TextBoxDecWrite	proc uses eax ebx ecx edx edi esi, Dec:DWORD, Newline:DWORD

	pushf
	call	_wsprintfA, offset TmpDec, offset DecFmt, Dec
	add	esp, 12
	call	TextBoxWrite, offset TmpDec, Newline
	popf
	ret

TextBoxDecWrite	endp


TextBoxWrite	proc uses eax ebx ecx edx edi esi, Str:DWORD, Newline:DWORD

	pushf
	call	GetWindowTextLengthA, hBox	; Get edit text length

	push	eax
	push    eax
	push    EM_SETSEL
	push    hBox           
	call    SendMessageA		; Set Caret to last char

	push    Str
	push    FALSE
	push    EM_REPLACESEL
	push    hBox
	call    SendMessageA		; Append new text

	call	SetFocus, hBox		; Set Focus to Edit Child

	cmp	Newline, 1		; Add Return chars ?
	jnz	WRITE
	call	TextBoxWrite, offset CR_BLA, 0

WRITE:
	popf
	ret

TextBoxWrite	endp

;================================================================================
;================ ToolTip Functions =============================================

ToolTipIni	proc uses eax ebx ecx edx edi esi

	Call	CreateWindowEx, NULL, offset TOOLTIPS_CLASSA, NULL, TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL
	ret
ToolTipIni	endp
KcommctrlInc_End: