Subversion Repositories Kolibri OS

Rev

Rev 631 | Rev 8960 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 631 Rev 997
Line 681... Line 681...
681
        cmp     eax, 6
681
        cmp     eax, 6
682
        jz      .readok
682
        jz      .readok
683
; read error
683
; read error
684
        cmp     [copy_bSkipAll], 0
684
        cmp     [copy_bSkipAll], 0
685
        jnz     .skip1
685
        jnz     .skip1
686
        push    execdata
686
        mov     edx, execdata
687
        push    aCannotReadFolder
-
 
688
        call    get_error_msg
687
        call    recursive_read_folder_err
689
        push    eax
-
 
690
        mov     eax, esp
-
 
691
        push    DeleteErrorBtn
-
 
692
        push    4
-
 
693
        push    eax
-
 
694
        push    3
-
 
695
        call    SayErr
-
 
696
        add     esp, 3*4
-
 
697
        test    al, al
-
 
698
        jz      .read_retry
688
        jz      .read_retry
699
        cmp     al, 2
689
        cmp     al, 2
700
        jnz     @f
690
        jnz     @f
701
        dec     eax
691
        dec     eax
702
        mov     [copy_bSkipAll], 1
692
        mov     [copy_bSkipAll], 1
Line 882... Line 872...
882
        dec     esi
872
        dec     esi
883
@@:
873
@@:
884
        mov     byte [esi+1], 0
874
        mov     byte [esi+1], 0
885
        ret
875
        ret
Line -... Line 876...
-
 
876
 
-
 
877
recursive_read_folder_err:
-
 
878
        push    edx
-
 
879
        push    aCannotReadFolder
-
 
880
        call    get_error_msg
-
 
881
        push    eax
-
 
882
        mov     eax, esp
-
 
883
        push    DeleteErrorBtn
-
 
884
        push    4
-
 
885
        push    eax
-
 
886
        push    3
-
 
887
        call    SayErr
-
 
888
        add     esp, 3*4
-
 
889
        test    al, al
-
 
890
        ret
-
 
891
 
-
 
892
recursive_read_file_err:
-
 
893
	push	edx
-
 
894
	push	aCannotReadFile
-
 
895
	call	get_error_msg
-
 
896
	push	eax
-
 
897
	mov	eax, esp
-
 
898
	push	DeleteErrorBtn
-
 
899
	push	4
-
 
900
	push	eax
-
 
901
	push	3
-
 
902
	call	SayErr
-
 
903
	add	esp, 3*4
-
 
904
	test	al, al
-
 
905
	ret
886
 
906
 
887
copy_AddDir:
907
copy_AddDir:
888
        push    1
908
        push    1
889
        pop     eax                     ; for "return true"
909
        pop     eax                     ; for "return true"
890
        pushad
910
        pushad
Line 929... Line 949...
929
        call    copy_file_worker2
949
        call    copy_file_worker2
930
        popad
950
        popad
931
        setna   al
951
        setna   al
932
        ret     12
952
        ret     12
Line -... Line 953...
-
 
953
 
-
 
954
search_dir_query_size = 32
-
 
955
search_filebuf_size = 32768
-
 
956
 
-
 
957
virtual at 0
-
 
958
filesearch_data:
-
 
959
.prev_screen_vtable     dd      ?       ; previous in window stack
-
 
960
.prev_screen_data       dd      ?
-
 
961
.tid                    dd      ?       ; -1 for query stage, secondary thread id for search stage
-
 
962
.slot                   dd      ?       ; 0 if secondary thread is not running, it's slot otherwise
-
 
963
.result_blocks          dd      ?       ; head of heap blocks for resulting data
-
 
964
.cur_result_ptr         dd      ?       ; offset of free data in the current heap block for result
-
 
965
.stop                   db      ?       ; set to 1 when secondary thread need to be stopped
-
 
966
.skip_errors_mask       db      ?
-
 
967
.skip_read_folder = 1
-
 
968
.skip_set_folder = 2
-
 
969
.skip_open_file = 4
-
 
970
.skip_read_file = 8
-
 
971
.skip_bigname = 10h
-
 
972
.updating               db      ?
-
 
973
.datachanged            db      ?
-
 
974
.list.curitemptr        dd      ?
-
 
975
.list.numitems          dd      ?
-
 
976
.list.head              dd      ?
-
 
977
.list.curitem           dd      ?
-
 
978
.list.end               dd      ?
-
 
979
.query_dlgdata          rb      filesearch_query_template.size
-
 
980
.search_dlgdata         rb      filesearch_search_template.size
-
 
981
.mask.maxlen            dd      ?
-
 
982
.mask.pos               dd      ?
-
 
983
.mask.start             dd      ?
-
 
984
.mask                   rb      512
-
 
985
.string.maxlen          dd      ?
-
 
986
.string.pos             dd      ?
-
 
987
.string.start           dd      ?
-
 
988
.string                 rb      256
-
 
989
.caption                rb      268
-
 
990
.statusstr              rb      80
-
 
991
.stack                  rb      8192
-
 
992
.stacktop = $
-
 
993
.fs.func                dd      ?
-
 
994
.fs.pos_low             dd      ?
-
 
995
.fs.pos_high            dd      ?
-
 
996
.fs.size                dd      ?
-
 
997
.fs.ptr                 dd      ?
-
 
998
.curfile                rb      1024
-
 
999
.curdir                 rb      1024
-
 
1000
.lowername              rb      264
-
 
1001
.dir_area               rb      32 + 304*search_dir_query_size
-
 
1002
.filebuf                rb      search_filebuf_size
-
 
1003
.size = $
-
 
1004
end virtual
-
 
1005
 
-
 
1006
panels_OnKey.alt_f7:
-
 
1007
        mov     ecx, filesearch_data.size
-
 
1008
        mov     edx, filesearch_vtable
-
 
1009
        call    new_screen
-
 
1010
        test    eax, eax
-
 
1011
        jnz     @f
-
 
1012
        ret
-
 
1013
@@:
-
 
1014
        mov     [ebp+filesearch_data.prev_screen_vtable], panels_vtable
-
 
1015
        mov     ecx, (filesearch_query_template.size + filesearch_search_template.size) / 4
-
 
1016
        mov     esi, filesearch_query_template
-
 
1017
        lea     edi, [ebp+filesearch_data.query_dlgdata]
-
 
1018
        rep     movsd
-
 
1019
        lea     eax, [ebp+filesearch_data.string.maxlen]
-
 
1020
        xor     ebx, ebx
-
 
1021
        mov     dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.editptr2-filesearch_query_template], eax
-
 
1022
        mov     dword [eax], 253
-
 
1023
        mov     [eax+4], ebx
-
 
1024
        mov     [eax+8], ebx
-
 
1025
        mov     [eax+12], bl
-
 
1026
        sub     eax, filesearch_data.string - filesearch_data.mask
-
 
1027
        mov     dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.editptr1-filesearch_query_template], eax
-
 
1028
        mov     dword [eax], 511
-
 
1029
        mov     [eax+8], ebx
-
 
1030
        inc     ebx
-
 
1031
        mov     word [eax+12], '*'
-
 
1032
        mov     [eax+4], ebx
-
 
1033
        mov     eax, [find_in_file_dlgdata.flags_case]
-
 
1034
        and     al, 10h
-
 
1035
        or      al, 8
-
 
1036
        mov     dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_case-filesearch_query_template], eax
-
 
1037
        mov     eax, [find_in_file_dlgdata.flags_whole]
-
 
1038
        and     al, 10h
-
 
1039
        or      al, 8
-
 
1040
        mov     dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template], eax
-
 
1041
        lea     edi, [ebp+filesearch_data.caption]
-
 
1042
        mov     dword [ebp+dlgtemplate.title+filesearch_data.search_dlgdata], edi
-
 
1043
        lea     eax, [ebp+filesearch_data.list.curitemptr]
-
 
1044
        mov     dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data1-filesearch_search_template], eax
-
 
1045
.reinit:
-
 
1046
        xor     ebx, ebx
-
 
1047
        or      [ebp+filesearch_data.tid], -1
-
 
1048
        mov     [ebp+filesearch_data.slot], ebx
-
 
1049
        mov     [ebp+filesearch_data.result_blocks], ebx
-
 
1050
        mov     [ebp+filesearch_data.cur_result_ptr], 0x4000
-
 
1051
        mov     [ebp+filesearch_data.list.curitemptr], ebx
-
 
1052
        mov     [ebp+filesearch_data.list.numitems], ebx
-
 
1053
        mov     [ebp+filesearch_data.list.head], ebx
-
 
1054
        mov     [ebp+filesearch_data.list.curitem], ebx
-
 
1055
        mov     [ebp+filesearch_data.list.end], ebx
-
 
1056
        mov     [ebp+filesearch_data.stop], bl
-
 
1057
        mov     al, [dialog_main_color]
-
 
1058
        mov     [ebp+filesearch_data.query_dlgdata+dlgtemplate.main_color], al
-
 
1059
        mov     [ebp+filesearch_data.search_dlgdata+dlgtemplate.main_color], al
-
 
1060
        mov     al, [dialog_border_color]
-
 
1061
        mov     [ebp+filesearch_data.query_dlgdata+dlgtemplate.border_color], al
-
 
1062
        mov     [ebp+filesearch_data.search_dlgdata+dlgtemplate.border_color], al
-
 
1063
        mov     al, [dialog_header_color]
-
 
1064
        mov     [ebp+filesearch_data.query_dlgdata+dlgtemplate.header_color], al
-
 
1065
        mov     [ebp+filesearch_data.search_dlgdata+dlgtemplate.header_color], al
-
 
1066
filesearch_OnRedraw:
-
 
1067
        push    ebp
-
 
1068
        mov     byte [draw_image], 0xC3
-
 
1069
        mov     eax, [ebp+filesearch_data.prev_screen_vtable]
-
 
1070
        mov     ebp, [ebp+filesearch_data.prev_screen_data]
-
 
1071
        call    dword [eax+screen_vtable.OnRedraw]
-
 
1072
        mov     byte [draw_image], 0xC6
-
 
1073
        pop     ebp
-
 
1074
        cmp     [ebp+filesearch_data.tid], -1
-
 
1075
        jnz     .prepare_search_dlg
-
 
1076
        lea     ebx, [ebp+filesearch_data.query_dlgdata]
-
 
1077
        mov     eax, [cur_width]
-
 
1078
        mov     [ebx + dlgtemplate.x], 6
-
 
1079
        sub     eax, 12
-
 
1080
        mov     [ebx + dlgtemplate.width], eax
-
 
1081
        dec     eax
-
 
1082
        dec     eax
-
 
1083
        mov     [ebx - filesearch_query_template + filesearch_query_template.width2], eax
-
 
1084
        mov     [ebx - filesearch_query_template + filesearch_query_template.width3], eax
-
 
1085
        shr     eax, 1
-
 
1086
        dec     eax
-
 
1087
        dec     eax
-
 
1088
        mov     [ebx - filesearch_query_template + filesearch_query_template.search_x2], eax
-
 
1089
        sub     eax, aSearchBLength-1
-
 
1090
        mov     [ebx - filesearch_query_template + filesearch_query_template.search_x1], eax
-
 
1091
        add     eax, aSearchBLength+3
-
 
1092
        mov     [ebx - filesearch_query_template + filesearch_query_template.cnl_x1], eax
-
 
1093
        add     eax, aCancelBLength-1
-
 
1094
        mov     [ebx - filesearch_query_template + filesearch_query_template.cnl_x2], eax
-
 
1095
        mov     eax, [cur_height]
-
 
1096
        sub     eax, [ebx + dlgtemplate.height]
-
 
1097
        shr     eax, 1
-
 
1098
        mov     [ebx + dlgtemplate.y], eax
-
 
1099
        jmp     .dlg_prepared
-
 
1100
.prepare_search_dlg:
-
 
1101
        lea     ebx, [ebp+filesearch_data.search_dlgdata]
-
 
1102
; width: for big screens use all screen except for one column on each side,
-
 
1103
;       that is, [cur_width] - 10 (standard frame width is 4);
-
 
1104
; if [cur_width]-10 does not contain enough place for all buttons with two spaces between them,
-
 
1105
;       but [cur_width]-2 does, use fixed size = place for all buttons with two spaces between them
-
 
1106
; for small screens use [cur_width]-2 as maximum possible
-
 
1107
.btnsize = 2 + aNewSearchLen + 2 + aGotoLen + 2 + aViewLen + 2 + aCancelB2Length + 2
-
 
1108
        mov     eax, [cur_width]
-
 
1109
        mov     edx, eax
-
 
1110
        sub     eax, 10
-
 
1111
        cmp     eax, .btnsize
-
 
1112
        jae     @f
-
 
1113
        add     eax, 8
-
 
1114
        cmp     eax, .btnsize
-
 
1115
        jb      @f
-
 
1116
        mov     al, .btnsize
-
 
1117
@@:
-
 
1118
        mov     [ebx + dlgtemplate.width], eax
-
 
1119
        sub     edx, eax
-
 
1120
        shr     edx, 1
-
 
1121
        mov     [ebx + dlgtemplate.x], edx
-
 
1122
        dec     eax
-
 
1123
        mov     [ebx + filesearch_search_template.width1 - filesearch_search_template], eax
-
 
1124
        mov     [ebx + filesearch_search_template.width4 - filesearch_search_template], eax
-
 
1125
        cmp     [ebp + filesearch_data.slot], 0
-
 
1126
        jnz     @f
-
 
1127
        mov     [ebx + filesearch_search_template.width3 - filesearch_search_template], eax
-
 
1128
@@:
-
 
1129
        sub     eax, aNewSearchLen + aGotoLen + aViewLen + aCancelB2Length - 1
-
 
1130
        cdq
-
 
1131
        push    5
-
 
1132
        pop     ecx
-
 
1133
        idiv    ecx
-
 
1134
        sar     edx, 1
-
 
1135
        add     edx, eax
-
 
1136
        inc     eax
-
 
1137
        mov     [ebx + filesearch_search_template.btn1x1 - filesearch_search_template], edx
-
 
1138
        add     edx, aNewSearchLen-1
-
 
1139
        mov     [ebx + filesearch_search_template.btn1x2 - filesearch_search_template], edx
-
 
1140
        add     edx, eax
-
 
1141
        mov     [ebx + filesearch_search_template.btn2x1 - filesearch_search_template], edx
-
 
1142
        add     edx, aGotoLen-1
-
 
1143
        mov     [ebx + filesearch_search_template.btn2x2 - filesearch_search_template], edx
-
 
1144
        add     edx, eax
-
 
1145
        mov     [ebx + filesearch_search_template.btn3x1 - filesearch_search_template], edx
-
 
1146
        add     edx, aViewLen-1
-
 
1147
        mov     [ebx + filesearch_search_template.btn3x2 - filesearch_search_template], edx
-
 
1148
        add     edx, eax
-
 
1149
        mov     [ebx + filesearch_search_template.btn4x1 - filesearch_search_template], edx
-
 
1150
        add     edx, aCancelB2Length-1
-
 
1151
        mov     [ebx + filesearch_search_template.btn4x2 - filesearch_search_template], edx
-
 
1152
        mov     eax, [cur_height]
-
 
1153
        mov     edx, eax
-
 
1154
        sub     eax, 8
-
 
1155
        cmp     eax, 6
-
 
1156
        jae     @f
-
 
1157
        mov     eax, 6
-
 
1158
@@:
-
 
1159
        mov     [ebx + dlgtemplate.height], eax
-
 
1160
        sub     edx, eax
-
 
1161
        shr     edx, 1
-
 
1162
        mov     [ebx + dlgtemplate.y], edx
-
 
1163
        dec     eax
-
 
1164
        mov     [ebx + filesearch_search_template.btn1y - filesearch_search_template], eax
-
 
1165
        mov     [ebx + filesearch_search_template.btn2y - filesearch_search_template], eax
-
 
1166
        mov     [ebx + filesearch_search_template.btn3y - filesearch_search_template], eax
-
 
1167
        mov     [ebx + filesearch_search_template.btn4y - filesearch_search_template], eax
-
 
1168
        dec     eax
-
 
1169
        mov     [ebx + filesearch_search_template.y5 - filesearch_search_template], eax
-
 
1170
        dec     eax
-
 
1171
        mov     [ebx + filesearch_search_template.y3 - filesearch_search_template], eax
-
 
1172
        mov     [ebx + filesearch_search_template.y4 - filesearch_search_template], eax
-
 
1173
        dec     eax
-
 
1174
        mov     [ebx + filesearch_search_template.y2 - filesearch_search_template], eax
-
 
1175
        dec     eax
-
 
1176
        mov     [ebx + filesearch_search_template.height1 - filesearch_search_template], eax
-
 
1177
.dlg_prepared:
-
 
1178
        call    draw_dialog_shadow
-
 
1179
        push    ebx
-
 
1180
        call    DrawDialogBox
-
 
1181
        ret
-
 
1182
 
-
 
1183
filesearch_OnActivate:
-
 
1184
        mov     eax, [active_screen_data]
-
 
1185
        cmp     eax, ebp
-
 
1186
        jz      @f
-
 
1187
        mov     [ebp+filesearch_data.prev_screen_data], eax
-
 
1188
        mov     eax, [active_screen_vtable]
-
 
1189
        mov     [ebp+filesearch_data.prev_screen_vtable], eax
-
 
1190
@@:
-
 
1191
        mov     eax, [ebp+filesearch_data.prev_screen_data]
-
 
1192
        mov     ecx, [num_screens]
-
 
1193
        mov     edx, [screens]
-
 
1194
        push    edx
-
 
1195
@@:
-
 
1196
        cmp     [edx+4], eax
-
 
1197
        jz      @f
-
 
1198
        add     edx, 8
-
 
1199
        loop    @b
-
 
1200
@@:
-
 
1201
        pop     edx
-
 
1202
        jz      @f
-
 
1203
        mov     eax, [active_screen]
-
 
1204
        dec     eax
-
 
1205
        mov     ecx, [edx+eax*8+4]
-
 
1206
        mov     [ebp+filesearch_data.prev_screen_data], ecx
-
 
1207
        mov     ecx, [edx+eax*8]
-
 
1208
        mov     [ebp+filesearch_data.prev_screen_vtable], ecx
-
 
1209
@@:
-
 
1210
        cmp     [ebp+filesearch_data.slot], 0
-
 
1211
        jz      @f
-
 
1212
        mov     [idle_interval], 10
-
 
1213
@@:
-
 
1214
;        ret    ; continue to filesearch_OnIdle
-
 
1215
 
-
 
1216
filesearch_OnIdle:
-
 
1217
        xor     eax, eax
-
 
1218
        xchg    al, [ebp+filesearch_data.datachanged]
-
 
1219
        cmp     al, 1
-
 
1220
        ja      .done
-
 
1221
        jz      .new
-
 
1222
.ret:
-
 
1223
        ret
-
 
1224
.done:
-
 
1225
        call    filesearch_wait_thread
-
 
1226
        call    filesearch_done
-
 
1227
.new:
-
 
1228
        jmp     filesearch_OnRedraw
-
 
1229
 
-
 
1230
filesearch_OnKey:
-
 
1231
        cmp     al, 0x58
-
 
1232
        jz      F12
-
 
1233
        cmp     [ebp+filesearch_data.tid], -1
-
 
1234
        jz      .handle_generic
-
 
1235
        cmp     al, 0x47
-
 
1236
        jb      .notforlist
-
 
1237
        cmp     al, 0x49
-
 
1238
        jbe     @f
-
 
1239
        cmp     al, 0x4F
-
 
1240
        jb      .notforlist
-
 
1241
        cmp     al, 0x51
-
 
1242
        ja      .notforlist
-
 
1243
@@:
-
 
1244
        push    ebp
-
 
1245
        add     ebp, filesearch_data.search_dlgdata
-
 
1246
        lea     ebx, [ebp+dlgtemplate.size+12]
-
 
1247
        call    listbox_key
-
 
1248
        call    draw_listbox
-
 
1249
        call    draw_image
-
 
1250
        pop     ebp
-
 
1251
        ret
-
 
1252
.notforlist:
-
 
1253
        cmp     al, 0x3D
-
 
1254
        jz      .view
-
 
1255
.handle_generic:
-
 
1256
        push    ebp
-
 
1257
        call    filesearch_getcurdlg
-
 
1258
        push    0
-
 
1259
        push    eax
-
 
1260
        push    2
-
 
1261
        push    ebx
-
 
1262
        call    ManagerDlgProc
-
 
1263
        pop     ebp
-
 
1264
        test    eax, eax
-
 
1265
        jz      filesearch_OnIdle.ret
-
 
1266
        cmp     eax, -1
-
 
1267
        jz      .esc
-
 
1268
        sub     eax, ebp
-
 
1269
        cmp     eax, filesearch_data.query_dlgdata+filesearch_query_template.search_btn-filesearch_query_template
-
 
1270
        jz      .query
-
 
1271
        cmp     eax, filesearch_data.search_dlgdata+filesearch_search_template.btn1-filesearch_search_template
-
 
1272
        jz      .newsearch
-
 
1273
        cmp     eax, filesearch_data.search_dlgdata+filesearch_search_template.btn2-filesearch_search_template
-
 
1274
        jz      .goto
-
 
1275
        cmp     eax, filesearch_data.search_dlgdata+filesearch_search_template.btn3-filesearch_search_template
-
 
1276
        jz      .view
-
 
1277
.esc:
-
 
1278
        cmp     dword [ebp+filesearch_data.slot], 0
-
 
1279
        jz      .exit
-
 
1280
        mov     [ebp+filesearch_data.stop], 2
-
 
1281
        call    ConfirmCancel
-
 
1282
        setz    [ebp+filesearch_data.stop]
-
 
1283
.ret:
-
 
1284
        ret
-
 
1285
.exit:
-
 
1286
        call    filesearch_OnExit
-
 
1287
        jmp     delete_active_screen
-
 
1288
.view:
-
 
1289
        mov     esi, [ebp+filesearch_data.list.curitemptr]
-
 
1290
        test    esi, esi
-
 
1291
        jz      .ret
-
 
1292
        add     esi, 8
-
 
1293
        mov     eax, esi
-
 
1294
        jmp     view_file
-
 
1295
.goto:
-
 
1296
        mov     esi, [ebp+filesearch_data.list.curitemptr]
-
 
1297
        test    esi, esi
-
 
1298
        jz      .ret
-
 
1299
        add     esi, 8
-
 
1300
        cmp     byte [esi], '/'
-
 
1301
        jnz     .ret
-
 
1302
        cmp     byte [esi+1], 0
-
 
1303
        jz      .ret
-
 
1304
        push    ebp
-
 
1305
        mov     ebp, [active_panel]
-
 
1306
        push    esi
-
 
1307
        call    close_plugin_panels
-
 
1308
        pop     esi
-
 
1309
        mov     ecx, esi
-
 
1310
@@:
-
 
1311
        lodsb
-
 
1312
        test    al, al
-
 
1313
        jnz     @b
-
 
1314
@@:
-
 
1315
        dec     esi
-
 
1316
        cmp     byte [esi], '/'
-
 
1317
        jnz     @b
-
 
1318
        mov     byte [esi], 0
-
 
1319
        inc     esi
-
 
1320
        mov     edi, saved_file_name
-
 
1321
@@:
-
 
1322
        lodsb
-
 
1323
        stosb
-
 
1324
        test    al, al
-
 
1325
        jnz     @b
-
 
1326
        mov     esi, ecx
-
 
1327
        lea     edi, [ebp + panel1_dir - panel1_data]
-
 
1328
        push    esi edi
-
 
1329
        call    strcmpi
-
 
1330
        pop     edi esi
-
 
1331
        jz      .goto.samedir
-
 
1332
@@:
-
 
1333
        lodsb
-
 
1334
        stosb
-
 
1335
        test    al, al
-
 
1336
        jnz     @b
-
 
1337
        and     [ebp + panel1_start - panel1_data], 0
-
 
1338
        and     [ebp + panel1_index - panel1_data], 0
-
 
1339
.goto.samedir:
-
 
1340
        push    @f
-
 
1341
        push    [ebp + panel1_index - panel1_data]
-
 
1342
        jmp     panels_OnKey.ctrl_r.doread
-
 
1343
@@:
-
 
1344
        pop     ebp
-
 
1345
        jmp     .exit
-
 
1346
.newsearch:
-
 
1347
        cmp     [ebp+filesearch_data.slot], 0
-
 
1348
        jz      .do.newsearch
-
 
1349
        call    filesearch_stop_thread
-
 
1350
.do.newsearch:
-
 
1351
        call    filesearch_free_result
-
 
1352
        jmp     panels_OnKey.alt_f7.reinit
-
 
1353
.query:
-
 
1354
        mov     esi, [active_panel]
-
 
1355
        cmp     [esi + panel1_hPlugin - panel1_data], 0
-
 
1356
        jz      @f
-
 
1357
        push    aCannotSearchOnPlugin
-
 
1358
        mov     eax, esp
-
 
1359
        push    ContinueBtn
-
 
1360
        push    1
-
 
1361
        push    eax
-
 
1362
        push    1
-
 
1363
        call    SayErr
-
 
1364
        pop     eax
-
 
1365
        jmp     .exit
-
 
1366
@@:
-
 
1367
        add     esi, panel1_dir - panel1_data
-
 
1368
        lea     edi, [ebp+filesearch_data.curdir]
-
 
1369
@@:
-
 
1370
        lodsb
-
 
1371
        stosb
-
 
1372
        test    al, al
-
 
1373
        jnz     @b
-
 
1374
        push    51
-
 
1375
        pop     eax
-
 
1376
        push    1
-
 
1377
        pop     ebx
-
 
1378
        mov     ecx, filesearch_thread
-
 
1379
        lea     edx, [ebp+filesearch_data.stacktop-4]
-
 
1380
        mov     [edx], ebp
-
 
1381
        int     40h
-
 
1382
        cmp     eax, -1
-
 
1383
        jnz     @f
-
 
1384
        push    ContinueBtn
-
 
1385
        push    1
-
 
1386
        push    aCannotCreateThread_ptr
-
 
1387
        push    1
-
 
1388
        call    SayErr
-
 
1389
        ret
-
 
1390
@@:
-
 
1391
        mov     [ebp+filesearch_data.tid], eax
-
 
1392
        mov     [ebp+filesearch_data.updating], 0
-
 
1393
        mov     [ebp+filesearch_data.datachanged], 0
-
 
1394
        xchg    eax, ecx
-
 
1395
        push    18
-
 
1396
        pop     eax
-
 
1397
        push    21
-
 
1398
        pop     ebx
-
 
1399
        int     40h
-
 
1400
        mov     [ebp+filesearch_data.slot], eax
-
 
1401
        mov     [idle_interval], 10
-
 
1402
        mov     esi, aFileSearch
-
 
1403
        mov     edi, dword [ebp+filesearch_data.search_dlgdata+dlgtemplate.title]
-
 
1404
@@:
-
 
1405
        lodsb
-
 
1406
        stosb
-
 
1407
        test    al, al
-
 
1408
        jnz     @b
-
 
1409
        mov     byte [edi-1], ':'
-
 
1410
        mov     al, ' '
-
 
1411
        stosb
-
 
1412
        lea     esi, [ebp+filesearch_data.mask]
-
 
1413
@@:
-
 
1414
        lodsb
-
 
1415
        stosb
-
 
1416
        test    al, al
-
 
1417
        jnz     @b
-
 
1418
        lea     edi, [ebp+filesearch_data.statusstr]
-
 
1419
        mov     dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data3-filesearch_search_template], edi
-
 
1420
        mov     esi, aSearchingIn
-
 
1421
@@:
-
 
1422
        lodsb
-
 
1423
        stosb
-
 
1424
        cmp     al, '"'
-
 
1425
        jnz     @b
-
 
1426
        push    esi
-
 
1427
        push    10
-
 
1428
        pop     ecx
-
 
1429
        lea     esi, [ebp+filesearch_data.string]
-
 
1430
@@:
-
 
1431
        lodsb
-
 
1432
        test    al, al
-
 
1433
        jz      @f
-
 
1434
        stosb
-
 
1435
        loop    @b
-
 
1436
@@:
-
 
1437
        pop     esi
-
 
1438
        movsb
-
 
1439
        jz      @f
-
 
1440
        mov     byte [edi-1], '.'
-
 
1441
        mov     byte [edi-2], '.'
-
 
1442
        mov     byte [edi-3], '.'
-
 
1443
        mov     byte [edi-4], '"'
-
 
1444
@@:
-
 
1445
        cmp     byte [edi-2], '"'
-
 
1446
        jnz     @f
-
 
1447
        sub     edi, 3
-
 
1448
@@:
-
 
1449
        lodsb
-
 
1450
        stosb
-
 
1451
        test    al, al
-
 
1452
        jnz     @b
-
 
1453
        sub     edi, dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data3-filesearch_search_template]
-
 
1454
        mov     dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.width3-filesearch_search_template], edi
-
 
1455
        inc     edi
-
 
1456
        mov     dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.x4-filesearch_search_template], edi
-
 
1457
        lea     eax, [ebp+filesearch_data.curdir]
-
 
1458
        mov     dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data4-filesearch_search_template], eax
-
 
1459
        call    filesearch_set_dlgflags         ; use it? I think, yes
-
 
1460
        cmp     [ebp+filesearch_data.slot], 0
-
 
1461
        jnz     @f
-
 
1462
        call    filesearch_done
-
 
1463
@@:
-
 
1464
        jmp     filesearch_OnRedraw
-
 
1465
 
-
 
1466
filesearch_done:
-
 
1467
        cmp     [active_screen_data], ebp
-
 
1468
        jnz     @f
-
 
1469
        or      [idle_interval], -1
-
 
1470
@@:
-
 
1471
        and     dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data4-filesearch_search_template], 0
-
 
1472
        mov     edi, dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data3-filesearch_search_template]
-
 
1473
        mov     esi, aSearchDone
-
 
1474
@@:
-
 
1475
        lodsb
-
 
1476
        stosb
-
 
1477
        cmp     al, '?'
-
 
1478
        jnz     @b
-
 
1479
        dec     edi
-
 
1480
        mov     eax, [ebp+filesearch_data.list.numitems]
-
 
1481
        push    -'0'
-
 
1482
        push    10
-
 
1483
        pop     ecx
-
 
1484
@@:
-
 
1485
        xor     edx, edx
-
 
1486
        div     ecx
-
 
1487
        push    edx
-
 
1488
        test    eax, eax
-
 
1489
        jnz     @b
-
 
1490
@@:
-
 
1491
        pop     eax
-
 
1492
        add     al, '0'
-
 
1493
        jz      @f
-
 
1494
        stosb
-
 
1495
        jmp     @b
-
 
1496
@@:
-
 
1497
        lodsb
-
 
1498
        stosb
-
 
1499
        test    al, al
-
 
1500
        jnz     @b
-
 
1501
        ret
-
 
1502
 
-
 
1503
filesearch_getname:
-
 
1504
if lang eq ru
-
 
1505
        mov     eax, '„¨ «'
-
 
1506
        stosd
-
 
1507
        mov     eax, '®£ ¯'
-
 
1508
        stosd
-
 
1509
        mov     eax, '®¨áª'
-
 
1510
        stosd
-
 
1511
        mov     al, ' '
-
 
1512
        stosb
-
 
1513
else
-
 
1514
        mov     eax, 'Find'
-
 
1515
        stosd
-
 
1516
        mov     eax, ' dia'
-
 
1517
        stosd
-
 
1518
        mov     eax, 'log '
-
 
1519
        stosd
-
 
1520
        mov     al, ' '
-
 
1521
        stosb
-
 
1522
end if
-
 
1523
        ret
-
 
1524
 
-
 
1525
filesearch_stop_thread:
-
 
1526
        mov     [ebp+filesearch_data.stop], 1
-
 
1527
 
-
 
1528
filesearch_wait_thread:
-
 
1529
        mov     ecx, [ebp+filesearch_data.slot]
-
 
1530
        mov     edx, [ebp+filesearch_data.tid]
-
 
1531
        jecxz   .secondary_thread_exited
-
 
1532
@@:
-
 
1533
        mov     ebx, procinfo
-
 
1534
        push    9
-
 
1535
        pop     eax
-
 
1536
        int     40h
-
 
1537
        cmp     word [ebx+50], 9
-
 
1538
        jz      .secondary_thread_exited
-
 
1539
        cmp     dword [ebx+30], edx
-
 
1540
        jnz     .secondary_thread_exited
-
 
1541
        push    5
-
 
1542
        pop     eax
-
 
1543
        push    1
-
 
1544
        pop     ebx
-
 
1545
        int     40h
-
 
1546
        jmp     @b
-
 
1547
.secondary_thread_exited:
-
 
1548
        and     [ebp+filesearch_data.slot], 0
-
 
1549
        ret
-
 
1550
 
-
 
1551
filesearch_OnExit:
-
 
1552
        call    filesearch_stop_thread
-
 
1553
        call    filesearch_free_result
-
 
1554
;       call    filesearch_set_dlgflags         ; use it? I think, no
-
 
1555
        ret
-
 
1556
 
-
 
1557
filesearch_IsHandleUsed:
-
 
1558
        test    ebp, ebp
-
 
1559
        ret
-
 
1560
 
-
 
1561
filesearch_set_dlgflags:
-
 
1562
        mov     eax, dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_case-filesearch_query_template]
-
 
1563
        and     al, 10h
-
 
1564
        or      al, 8
-
 
1565
        mov     [find_in_file_dlgdata.flags_case], eax
-
 
1566
        mov     eax, dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template]
-
 
1567
        and     al, 10h
-
 
1568
        or      al, 8
-
 
1569
        mov     [find_in_file_dlgdata.flags_whole], eax
-
 
1570
        lea     esi, [ebp+filesearch_data.string]
-
 
1571
        mov     edi, SearchString
-
 
1572
        and     dword [edi-4], 0
-
 
1573
        and     dword [edi-8], 0
-
 
1574
@@:
-
 
1575
        lodsb
-
 
1576
        stosb
-
 
1577
        test    al, al
-
 
1578
        jnz     @b
-
 
1579
        ret
-
 
1580
 
-
 
1581
filesearch_getcurdlg:
-
 
1582
        lea     ebx, [ebp+filesearch_data.query_dlgdata]
-
 
1583
        cmp     [ebp+filesearch_data.tid], -1
-
 
1584
        jz      @f
-
 
1585
        add     ebx, filesearch_data.search_dlgdata - filesearch_data.query_dlgdata
-
 
1586
@@:
-
 
1587
        ret
-
 
1588
 
-
 
1589
filesearch_free_result:
-
 
1590
        mov     ecx, [ebp+filesearch_data.result_blocks]
-
 
1591
@@:
-
 
1592
        jecxz   .ret
-
 
1593
        push    dword [ecx]
-
 
1594
        call    pgfree
-
 
1595
        pop     ecx
-
 
1596
        jmp     @b
-
 
1597
.ret:
-
 
1598
        ret
-
 
1599
 
-
 
1600
filesearch_thread:
-
 
1601
        pop     ebp
-
 
1602
; initialize search for string
-
 
1603
        xor     ecx, ecx
-
 
1604
        xor     edx, edx
-
 
1605
        mov     [ebp+filesearch_data.skip_errors_mask], cl
-
 
1606
        lea     ebx, [ebp+filesearch_data.string]
-
 
1607
        cmp     byte [ebx], dl
-
 
1608
        jz      .noprepare
-
 
1609
        mov     esi, tolower_table
-
 
1610
        test    byte [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_case-filesearch_query_template], 10h
-
 
1611
        jz      @f
-
 
1612
        mov     esi, identical_table
-
 
1613
@@:
-
 
1614
        test    byte [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template], 10h
-
 
1615
        setnz   al
-
 
1616
        push    eax
-
 
1617
        push    ecx     ; force cp866
-
 
1618
        call    search_string_pre
-
 
1619
.noprepare:
-
 
1620
        push    -1
-
 
1621
.enter_recursion:
-
 
1622
        xor     esi, esi        ; start position: zero
-
 
1623
.read_folder_loop:
-
 
1624
        push    esi
-
 
1625
        lea     esi, [ebp+filesearch_data.curdir]
-
 
1626
        lea     edi, [ebp+filesearch_data.curfile]
-
 
1627
@@:
-
 
1628
        lodsb
-
 
1629
        stosb
-
 
1630
        test    al, al
-
 
1631
        jnz     @b
-
 
1632
        pop     esi
-
 
1633
.read_retry:
-
 
1634
        lea     ebx, [ebp+filesearch_data.fs.func]
-
 
1635
        mov     dword [ebx], 1
-
 
1636
        mov     dword [ebx+4], esi
-
 
1637
        and     dword [ebx+8], 0
-
 
1638
        mov     dword [ebx+12], search_dir_query_size
-
 
1639
        lea     eax, [ebp+filesearch_data.dir_area]
-
 
1640
        mov     [ebx+16], eax
-
 
1641
        push    70
-
 
1642
        pop     eax
-
 
1643
        int     40h
-
 
1644
        test    eax, eax
-
 
1645
        jz      .read_folder_ok
-
 
1646
        cmp     eax, 6
-
 
1647
        jz      .read_folder_ok
-
 
1648
        xor     ebx, ebx
-
 
1649
        xchg    ebx, dword [ebp+filesearch_data.dir_area+4]
-
 
1650
        test    [ebp+filesearch_data.skip_errors_mask], filesearch_data.skip_read_folder
-
 
1651
        jnz     .skip1
-
 
1652
        push    edx
-
 
1653
        lea     edx, [ebp+filesearch_data.curdir]
-
 
1654
        call    recursive_read_folder_err
-
 
1655
        pop     edx
-
 
1656
        jz      .read_retry
-
 
1657
        cmp     al, 2
-
 
1658
        jnz     @f
-
 
1659
        dec     eax
-
 
1660
        or      [ebp+filesearch_data.skip_errors_mask], filesearch_data.skip_read_folder
-
 
1661
@@:
-
 
1662
        cmp     al, 1
-
 
1663
        jnz     .cancel
-
 
1664
.skip1:
-
 
1665
.read_folder_ok:
-
 
1666
        imul    ebx, 304
-
 
1667
        lea     eax, [ebp+filesearch_data.dir_area+32]
-
 
1668
        add     ebx, eax
-
 
1669
.scan_folder_loop:
-
 
1670
        cmp     eax, ebx
-
 
1671
        jae     .scan_folder_done
-
 
1672
; ignore special entries "." and ".."
-
 
1673
        cmp     word [eax+40], '.'
-
 
1674
        jz      .scan_folder_next
-
 
1675
        cmp     word [eax+40], '..'
-
 
1676
        jnz     @f
-
 
1677
        cmp     byte [eax+42], 0
-
 
1678
        jz      .scan_folder_next
-
 
1679
@@:
-
 
1680
        call    .check_stop
-
 
1681
; construct name
-
 
1682
        push    esi edi ebx eax
-
 
1683
        lea     ebx, [ebp+filesearch_data.curfile+1023]
-
 
1684
        lea     esi, [eax+40]
-
 
1685
        mov     byte [edi-1], '/'
-
 
1686
@@:
-
 
1687
        cmp     edi, ebx
-
 
1688
        jae     .namebig
-
 
1689
        lodsb
-
 
1690
        stosb
-
 
1691
        test    al, al
-
 
1692
        jnz     @b
-
 
1693
        pop     eax
-
 
1694
        test    byte [eax], 10h
-
 
1695
        jz      .scan_file
-
 
1696
; it is nested folder, enter recursion
-
 
1697
; to maintain ASCIIZ string coherency, copy backward
-
 
1698
        lea     esi, [edi+filesearch_data.curdir-filesearch_data.curfile]
-
 
1699
@@:
-
 
1700
        dec     edi
-
 
1701
        dec     esi
-
 
1702
        mov     al, [edi]
-
 
1703
        mov     [esi], al
-
 
1704
        cmp     al, '/'
-
 
1705
        jnz     @b
-
 
1706
        mov     [ebp+filesearch_data.datachanged], 1
-
 
1707
        pop     ebx edi
-
 
1708
        jmp     .enter_recursion
-
 
1709
.namebig:
-
 
1710
        pop     eax
-
 
1711
        mov     byte [edi], 0
-
 
1712
        test    [ebp+filesearch_data.skip_errors_mask], filesearch_data.skip_bigname
-
 
1713
        jnz     .namebig.skip
-
 
1714
        push    eax
-
 
1715
        push    edi
-
 
1716
        test    byte [eax], 10h
-
 
1717
        mov     eax, aFileNameTooBig
-
 
1718
        jz      @f
-
 
1719
        add     eax, aFolderNameTooBig - aFileNameTooBig
-
 
1720
@@:
-
 
1721
        push    eax
-
 
1722
        mov     eax, esp
-
 
1723
        push    SkipOrCancelBtn
-
 
1724
        push    3
-
 
1725
        push    eax
-
 
1726
        push    2
-
 
1727
        call    SayErr
-
 
1728
        cmp     al, 1
-
 
1729
        jnz     @f
-
 
1730
        dec     eax
-
 
1731
        or      [ebp+filesearch_data.skip_errors_mask], filesearch_data.skip_bigname
-
 
1732
@@:
-
 
1733
        test    al, al
-
 
1734
        pop     eax eax eax
-
 
1735
        jnz     .cancel
-
 
1736
.namebig.skip:
-
 
1737
        jmp     .scan_folder_next_pop
-
 
1738
.scan_file:
-
 
1739
; it is a file
-
 
1740
; first check: does file name match the mask?
-
 
1741
        push    eax edx
-
 
1742
; ®¡àî­¥â¨âì
-
 
1743
        lea     esi, [eax+40]
-
 
1744
        lea     edi, [ebp+filesearch_data.lowername]
-
 
1745
        push    edi
-
 
1746
        xor     eax, eax
-
 
1747
@@:
-
 
1748
        lodsb
-
 
1749
        mov     al, [tolower_table+eax]
-
 
1750
        stosb
-
 
1751
        test    al, al
-
 
1752
        jnz     @b
-
 
1753
; ¯®¥å «¨
-
 
1754
        lea     edx, [edi-1]
-
 
1755
        pop     esi
-
 
1756
        lea     edi, [ebp+filesearch_data.mask]
-
 
1757
        call    match_mask_rev_lowercase
-
 
1758
        pop     edx eax
-
 
1759
        jc      .scan_folder_next_pop
-
 
1760
; ok, second check: is the string present in this file?
-
 
1761
        jecxz   .file_found
-
 
1762
        push    eax
-
 
1763
        call    filesearch_test_file
-
 
1764
        pop     eax
-
 
1765
        jc      .scan_folder_next_pop
-
 
1766
.file_found:
-
 
1767
        push    eax
-
 
1768
; allocate memory for new result
-
 
1769
        lea     esi, [ebp+filesearch_data.curfile]
-
 
1770
        mov     ebx, esi
-
 
1771
@@:
-
 
1772
        lodsb
-
 
1773
        test    al, al
-
 
1774
        jnz     @b
-
 
1775
        sub     esi, ebx
-
 
1776
        mov     eax, [ebp+filesearch_data.cur_result_ptr]
-
 
1777
        add     esi, 8
-
 
1778
        push    ecx
-
 
1779
        mov     ecx, 0x4000
-
 
1780
        sub     ecx, eax
-
 
1781
        cmp     ecx, esi
-
 
1782
        jae     .nonewblock
-
 
1783
        mov     ecx, 0x4000
-
 
1784
        call    xpgalloc
-
 
1785
        test    eax, eax
-
 
1786
        jz      .cancel
-
 
1787
        pushd   [ebp+filesearch_data.result_blocks]
-
 
1788
        popd    [eax]
-
 
1789
        mov     [ebp+filesearch_data.result_blocks], eax
-
 
1790
        push    4
-
 
1791
        pop     eax
-
 
1792
        mov     [ebp+filesearch_data.cur_result_ptr], eax
-
 
1793
.nonewblock:
-
 
1794
        add     eax, [ebp+filesearch_data.result_blocks]
-
 
1795
        add     [ebp+filesearch_data.cur_result_ptr], esi
-
 
1796
        pop     ecx
-
 
1797
; eax -> allocated memory, fill it
-
 
1798
        push    eax
-
 
1799
        lea     edi, [eax+8]
-
 
1800
        mov     esi, ebx
-
 
1801
@@:
-
 
1802
        lodsb
-
 
1803
        stosb
-
 
1804
        test    al, al
-
 
1805
        jnz     @b
-
 
1806
        pop     eax
-
 
1807
        mov     ebx, [ebp+filesearch_data.list.end]
-
 
1808
        mov     [eax+4], ebx
-
 
1809
        and     dword [eax], 0
-
 
1810
        mov     [ebp+filesearch_data.list.end], eax
-
 
1811
        test    ebx, ebx
-
 
1812
        jz      @f
-
 
1813
        mov     [ebx], eax
-
 
1814
@@:
-
 
1815
        inc     [ebp+filesearch_data.list.numitems]
-
 
1816
        cmp     [ebp+filesearch_data.list.curitemptr], 0
-
 
1817
        jnz     @f
-
 
1818
        mov     [ebp+filesearch_data.list.curitemptr], eax
-
 
1819
@@:
-
 
1820
        cmp     [ebp+filesearch_data.list.head], 0
-
 
1821
        jnz     @f
-
 
1822
        mov     [ebp+filesearch_data.list.head], eax
-
 
1823
@@:
-
 
1824
        mov     [ebp+filesearch_data.datachanged], 1
-
 
1825
        pop     eax
-
 
1826
.scan_folder_next_pop:
-
 
1827
        pop     ebx edi esi
-
 
1828
        mov     byte [edi-1], 0
-
 
1829
.scan_folder_next:
-
 
1830
        inc     esi
-
 
1831
        add     eax, 304
-
 
1832
        jmp     .scan_folder_loop
-
 
1833
.scan_folder_done:
-
 
1834
        cmp     dword [ebp+filesearch_data.dir_area+4], search_dir_query_size
-
 
1835
        jz      .read_folder_loop
-
 
1836
        pop     esi
-
 
1837
        inc     esi
-
 
1838
        jz      .done
-
 
1839
        lea     eax, [ebp+filesearch_data.curdir]
-
 
1840
@@:
-
 
1841
        inc     eax
-
 
1842
        cmp     byte [eax], 0
-
 
1843
        jnz     @b
-
 
1844
@@:
-
 
1845
        dec     eax
-
 
1846
        cmp     byte [eax], '/'
-
 
1847
        jnz     @b
-
 
1848
        mov     byte [eax], 0
-
 
1849
        mov     [ebp+filesearch_data.datachanged], 1
-
 
1850
        jmp     .read_folder_loop
-
 
1851
.cancel:
-
 
1852
.done:
-
 
1853
        mov     [ebp+filesearch_data.datachanged], 2
-
 
1854
        or      eax, -1
-
 
1855
        int     40h
-
 
1856
 
-
 
1857
.check_stop:
-
 
1858
        cmp     [ebp+filesearch_data.stop], 1
-
 
1859
        jz      .cancel
-
 
1860
        ja      @f
-
 
1861
        ret
-
 
1862
@@:
-
 
1863
        push    eax ebx
-
 
1864
        push    5
-
 
1865
        pop     eax
-
 
1866
        push    1
-
 
1867
        pop     ebx
-
 
1868
        int     40h
-
 
1869
        pop     ebx eax
-
 
1870
        jmp     .check_stop
-
 
1871
 
-
 
1872
filesearch_test_file:
-
 
1873
        lea     ebx, [ebp+filesearch_data.fs.func]
-
 
1874
        lea     eax, [ebp+filesearch_data.filebuf]
-
 
1875
        mov     [ebx+16], eax
-
 
1876
        xor     eax, eax
-
 
1877
        mov     [ebx], eax
-
 
1878
        mov     [ebx+4], eax
-
 
1879
        mov     [ebx+8], eax
-
 
1880
        mov     dword [ebx+12], search_filebuf_size
-
 
1881
        mov     edi, edx
-
 
1882
        test    byte [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template], 10h
-
 
1883
        jz      .loop
-
 
1884
        add     edi, 256
-
 
1885
.loop:
-
 
1886
.read_retry:
-
 
1887
	call	filesearch_thread.check_stop
-
 
1888
        push    70
-
 
1889
        pop     eax
-
 
1890
        lea     ebx, [ebp+filesearch_data.fs.func]
-
 
1891
        int     40h
-
 
1892
        test    eax, eax
-
 
1893
        jz      .readok
-
 
1894
        cmp     eax, 6
-
 
1895
        jz      .readok
-
 
1896
        test    [ebp+filesearch_data.skip_errors_mask], filesearch_data.skip_read_file
-
 
1897
        jnz     .ret_failed
-
 
1898
	push	edx
-
 
1899
	lea	edx, [ebp+filesearch_data.curfile]
-
 
1900
	call	recursive_read_file_err
-
 
1901
	pop	edx
-
 
1902
	jz	.read_retry
-
 
1903
	cmp	al, 2
-
 
1904
	jnz	@f
-
 
1905
	dec	eax
-
 
1906
	or	[ebp+filesearch_data.skip_errors_mask], filesearch_data.skip_read_file
-
 
1907
@@:
-
 
1908
	cmp	al, 1
-
 
1909
	jnz	filesearch_thread.cancel
-
 
1910
.ret_failed:
-
 
1911
	stc
-
 
1912
	ret
-
 
1913
.readok:
-
 
1914
	test	ebx, ebx
-
 
1915
	jz	.eof
-
 
1916
	push	ebx
-
 
1917
	lea	esi, [ebp+filesearch_data.filebuf]
-
 
1918
	add	ebx, esi
-
 
1919
; edi = current state, edx -> FSM, ecx = last state,
-
 
1920
; esi -> current data, ebx -> end of buffer
-
 
1921
.scanloop:	 ; loop unrolled
-
 
1922
; get current symbol
-
 
1923
	movzx	eax, byte [esi]
-
 
1924
; calculate next state
-
 
1925
	movzx	edi, byte [edi+eax]
-
 
1926
; done?
-
 
1927
	cmp	edi, ecx
-
 
1928
	jz	.ret_ok_pop
-
 
1929
; no; proceed to next symbol
-
 
1930
	shl	edi, 8
-
 
1931
	add	edi, edx
-
 
1932
	cmp	esi, ebx
-
 
1933
	jae	.scandone
-
 
1934
	movzx	eax, byte [esi+1]
-
 
1935
	add	esi, 2
-
 
1936
	movzx	edi, byte [edi+eax]
-
 
1937
	cmp	edi, ecx
-
 
1938
	jz	.ret_ok_pop
-
 
1939
	shl	edi, 8
-
 
1940
	add	edi, edx
-
 
1941
	cmp	esi, ebx
-
 
1942
	jb	.scanloop
-
 
1943
.scandone:
-
 
1944
	pop	ebx
-
 
1945
.eof:
-
 
1946
	add	[ebp+filesearch_data.fs.pos_low], ebx
-
 
1947
	adc	[ebp+filesearch_data.fs.pos_high], 0
-
 
1948
	cmp	ebx, search_filebuf_size
-
 
1949
	jz	.loop
-
 
1950
; EOF, last chance for whole-words-only search
-
 
1951
	test	byte [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template], 10h
-
 
1952
	jz	.ret_failed
-
 
1953
	movzx	edi, byte [edi+' ']
-
 
1954
	cmp	edi, ecx
-
 
1955
	jnz	.ret_failed
-
 
1956
	clc
-
 
1957
	ret
-
 
1958
.ret_ok_pop:
-
 
1959
	pop	ebx
-
 
1960
	clc
-
 
1961
	ret
933
 
1962
 
934
virtual at 0
1963
virtual at 0
935
_FILE:
1964
_FILE:
936
.pos            dq      ?
1965
.pos            dq      ?
937
.bufpos         dq      ?
1966
.bufpos         dq      ?