10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
idCCList = 763
proc CreateCCList, .parent
begin
push ebx
invoke CreateWindowExA, 0, cFormClassName, 0, WS_POPUP or WS_CLIPSIBLINGS or WS_CLIPCHILDREN, \
0, 0, 300, 120, 0, 0, [hInstance], 0
mov [hCCList], eax
invoke SetWindowLongA, [hCCList], GWL_HWNDPARENT, [.parent]
stdcall SubclassWindow, [hCCList], CCParentProc
invoke CreateWindowExA, 0, cListboxClassName, 0, \
WS_CHILD or WS_BORDER or WS_VSCROLL or WS_VISIBLE or LBS_NOINTEGRALHEIGHT or LBS_OWNERDRAWFIXED or LBS_NODATA, \
0, 0, 300, 120, [hCCList], idCCList, [hInstance], 0
mov ebx, eax
stdcall SubclassWindow, ebx, CCListProc
stdcall SetAlign, ebx, waClient
invoke GetStockObject, DEFAULT_GUI_FONT
invoke SendMessageA, ebx, WM_SETFONT, eax, TRUE
|
|
|
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
idCCList = 763
proc CreateCCList, .parent
begin
push ebx
invoke CreateWindowExA, WS_EX_CLIENTEDGE, cFormClassName, 0, WS_POPUP or WS_CLIPSIBLINGS or WS_CLIPCHILDREN, \
0, 0, 300, 120, 0, 0, [hInstance], 0
mov [hCCList], eax
invoke SetWindowLongA, [hCCList], GWL_HWNDPARENT, [.parent]
stdcall SubclassWindow, [hCCList], CCParentProc
invoke CreateWindowExA, 0, cListboxClassName, 0, \
WS_CHILD or WS_VSCROLL or WS_VISIBLE or LBS_NOINTEGRALHEIGHT or LBS_OWNERDRAWFIXED or LBS_NODATA, \
0, 0, 300, 120, [hCCList], idCCList, [hInstance], 0
mov ebx, eax
stdcall SubclassWindow, ebx, CCListProc
stdcall SetAlign, ebx, waClient
invoke GetStockObject, DEFAULT_GUI_FONT
invoke SendMessageA, ebx, WM_SETFONT, eax, TRUE
|
474
475
476
477
478
479
480
481
482
483
484
485
486
487
|
loop .copy_prefix
; here ebx contains a pointer to the whole name including the parent label.
.localok:
stdcall ClearCCList
stdcall SearchTree, ebx, ptrLabels
test eax, eax
jz .destroycc
mov esi, [eax]
test esi, esi
jz .destroycc
|
>
|
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
|
loop .copy_prefix
; here ebx contains a pointer to the whole name including the parent label.
.localok:
stdcall ClearCCList
stdcall SearchTree, ebx, ptrLabels
test eax, eax
jz .destroycc
mov esi, [eax]
test esi, esi
jz .destroycc
|
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
invoke GetWindowLongA, [hCCList], GWL_USERDATA
mov edx, eax
test edx, edx
jz .destroycc
xor ecx, ecx
.fill_loop:
mov eax, [esi+TLabel.iName]
test eax, eax
jz .next
add eax, [ptrNames]
stdcall StringMatch, eax, edi
jnc .next
|
>
>
>
>
>
>
>
|
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
|
invoke GetWindowLongA, [hCCList], GWL_USERDATA
mov edx, eax
test edx, edx
jz .destroycc
xor ecx, ecx
; benchmark code.
; mov [.count], ecx
; stdcall GetTimestamp
; mov [.time], eax
.fill_loop:
; inc [.count] ; benchmark
mov eax, [esi+TLabel.iName]
test eax, eax
jz .next
add eax, [ptrNames]
stdcall StringMatch, eax, edi
jnc .next
|
518
519
520
521
522
523
524
525
526
527
528
529
530
531
|
.next:
add esi, sizeof.TLabel
dec ebx
jnz .fill_loop
.end_fill_loop:
push ecx
invoke SetWindowLongA, [hCCList], GWL_USERDATA, edx
pop ecx
test ecx, ecx
jz .destroycc
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
|
.next:
add esi, sizeof.TLabel
dec ebx
jnz .fill_loop
.end_fill_loop:
; benchmark code...
; pushad
; stdcall GetTimestamp
; sub eax, [.time]
; stdcall Output, 'Fill loop time:'
; stdcall OutputNumber, eax, 10, 8
; stdcall Output, <' ms ', 13, 10>
;
; stdcall Output, 'Total processed:'
; stdcall OutputNumber, [.count], 10, 8
; stdcall Output, <' records ', 13, 10>
;
; popad
push ecx
invoke SetWindowLongA, [hCCList], GWL_USERDATA, edx
pop ecx
test ecx, ecx
jz .destroycc
|
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
|
return
.destroycc:
invoke PostMessageA, [hCCList], WM_CLOSE, 0, 0
return
endp
proc StringMatch, .str1, .str2
begin
push esi edi eax
stdcall StrPtr, [.str1]
mov esi, eax
stdcall StrPtr, [.str2]
mov edi, eax
.loop:
mov al, [esi]
inc esi
mov ah, [edi]
inc edi
test ah,ah
jz .match
test al,al
jz .notmatch
or eax, $2020
cmp al,ah
je .loop
.notmatch:
|
>
>
>
>
<
<
|
|
>
|
<
<
|
|
>
>
>
|
|
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
|
return
.destroycc:
invoke PostMessageA, [hCCList], WM_CLOSE, 0, 0
return
endp
; If str1 begins with str2 then returns CF=1
; else CF=0
; preserves all registers.
proc StringMatch, .str1, .str2
begin
push esi edi eax
mov esi, [.str1]
mov edi, [.str2]
.loop:
mov al, [edi]
lea edi, [edi+1]
test al,al
jz .match
mov ah, [esi]
lea esi, [esi+1]
test ah,ah
jz .notmatch
or eax, $2020
cmp al,ah
je .loop
.notmatch:
|