fix crash opendial if corrypt filter

git-svn-id: svn://kolibrios.org@7048 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2017-10-04 13:16:04 +00:00
parent bd2c40668c
commit 478054d8c2
2 changed files with 22 additions and 14 deletions

View File

@ -95,7 +95,7 @@ od_y_start equ [ebp+54] ; Window Y position
.init:
pusha
mov ebp,dword [esp+36]
mcall 9,od_procinfo,-1
mcall SF_THREAD_INFO,od_procinfo,-1
mov ebx,[ebx+30]
mov edi,od_com_area_name
add edi,7
@ -116,7 +116,7 @@ od_y_start equ [ebp+54] ; Window Y position
jnz @r
cld
mcall 68,22,od_com_area_name,8192,0x09
mcall SF_SYS_MISC,SSF_MEM_OPEN,od_com_area_name,8192,0x09
mov od_com_area,eax
mov esi,od_openfile_pach
@ -139,7 +139,7 @@ OpenDialog_exit
mov [eax],word 2 ; folder for open
pusha
mcall 9,od_procinfo,-1
mcall SF_THREAD_INFO,od_procinfo,-1
mov eax,[ebx+42] ;main window x size
shr eax,1
@ -216,7 +216,7 @@ OpenDialog_exit
mov [ebx+8],eax
mov eax,od_start_path
mov [ebx+21],eax
mcall 70
mcall SF_FILE
shr eax,31
test eax,eax
@ -229,9 +229,9 @@ OpenDialog_exit
; is not cleared without call of func 0.
; In this case is suitable only func 5 and 11,
; or 68.1 and 11 for better response.
mcall 68,1
mcall 5,10 ; because OS uses a new scheduler for kernel(SVN r.3534)
mcall 11
mcall SF_SYS_MISC,SSF_SWITCH_TASK
mcall SF_SLEEP,10 ; because OS uses a new scheduler for kernel(SVN r.3534)
mcall SF_CHECK_EVENT
cmp eax,1
je .draw
cmp eax,2
@ -240,10 +240,10 @@ OpenDialog_exit
je .button
jmp .no_draw
.key:
mcall 2
mcall SF_GET_KEY
jmp .no_draw
.button:
mcall 17
mcall SF_GET_BUTTON
jmp .no_draw
;----------------------------------------------
.draw:
@ -256,7 +256,7 @@ OpenDialog_exit
jz @f
mov ecx,eax ; WINDOW SLOT
mcall 18,7
mcall SF_SYSTEM,SSF_GET_ACTIVE_WINDOW
cmp eax,ecx ; compare ACTIVE and WINDOW SLOT
jne @f
@ -264,7 +264,7 @@ OpenDialog_exit
mov ecx,[eax+12]
test ecx,ecx
jz @f
mcall 18,3
mcall SF_SYSTEM,SSF_FOCUS_WINDOW
@@:
popa
;----------------------------------------------
@ -315,14 +315,14 @@ OpenDialog_exit
call .prepare_PID
jz @f
mov ecx,eax ; WINDOW SLOT
mcall 18,3
mcall SF_SYSTEM,SSF_FOCUS_WINDOW
@@:
OpenDialog_exit
;----------------------------------------------
.prepare_PID:
mcall 9,od_procinfo,-1
mcall SF_THREAD_INFO,od_procinfo,-1
mov ecx,[ebx+30] ; PID
mcall 18,21
mcall SF_SYSTEM,SSF_GET_THREAD_SLOT
test eax,eax
ret
;----------------------------------------------
@ -340,6 +340,13 @@ OpenDialog_exit
mov edi,od_com_area
mov [edi+4096],dword 0
ret
@@:
cmp ecx,4091 ;max filter len = 8192-4100-1
jle @f
;todo ... error message: corrypt filter
mov edi,od_com_area
mov [edi+4096],dword 0
ret
@@:
inc ecx
cld

View File

@ -12,6 +12,7 @@ public EXPORTS
section '.flat' code readable align 16
include '../../../../macros.inc'
;include '../../../../proc32.inc'
include '../../../../KOSfuncs.inc'
include 'opendial.mac'
include 'colrdial.mac'
;include 'debug.inc'