add validate cursor in 37.5

fix maximal cursors count in init_cursors

git-svn-id: svn://kolibrios.org@230 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2006-12-05 08:31:44 +00:00
parent 1c9a42e362
commit 01056f99f2
3 changed files with 34 additions and 11 deletions

View File

@ -124,14 +124,6 @@ endp
align 4 align 4
proc get_event_ex stdcall, p_ev:dword, timeout:dword proc get_event_ex stdcall, p_ev:dword, timeout:dword
; push eax
; push edx
; mov edx, 0x400 ;bocsh
; mov al,0xff ;bocsh
; out dx, al ;bocsh
; pop edx
; pop eax
.wait: .wait:
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
shl ebx,8 shl ebx,8
@ -142,11 +134,13 @@ proc get_event_ex stdcall, p_ev:dword, timeout:dword
mov edx, [esi+EVENT.next] mov edx, [esi+EVENT.next]
mov [PROC_BASE+ebx+APPDATA.ev_first], edx mov [PROC_BASE+ebx+APPDATA.ev_first], edx
test edx, edx test edx, edx
jz @F
mov [edx+EVENT.prev], 0
@@:
jnz @F jnz @F
mov [PROC_BASE+ebx+APPDATA.ev_last], edx mov [PROC_BASE+ebx+APPDATA.ev_last], edx
and dword [PROC_BASE+ebx+APPDATA.event_mask], not EVENT_EXTENDED and dword [PROC_BASE+ebx+APPDATA.event_mask], not EVENT_EXTENDED
@@: @@:
mov [edx+EVENT.prev], 0
dec [PROC_BASE+ebx+APPDATA.ev_count] dec [PROC_BASE+ebx+APPDATA.ev_count]
mov eax, esi mov eax, esi

View File

@ -102,10 +102,24 @@ save_draw_mouse:
mul ecx mul ecx
movzx edx, byte [display_data+ebx+eax] movzx edx, byte [display_data+ebx+eax]
shl edx, 8 shl edx, 8
push [edx+PROC_BASE+APPDATA.cursor] mov ecx, [edx+PROC_BASE+APPDATA.cursor]
cmp [ecx+CURSOR.magic], 'CURS'
jne .fail
cmp [ecx+CURSOR.size], CURSOR_SIZE
jne .fail
push ecx
call [set_hw_cursor] call [set_hw_cursor]
popad popad
ret ret
.fail:
mov ecx, [def_cursor]
mov [edx+PROC_BASE+APPDATA.cursor], ecx
push ecx
call [set_hw_cursor]
popad
ret
@@: @@:
pushad pushad
; save & draw ; save & draw

View File

@ -192,6 +192,16 @@ endp
align 4 align 4
proc set_cursor stdcall, hcursor:dword proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor] mov eax, [hcursor]
cmp [eax+CURSOR.magic], 'CURS'
jne .fail
cmp [eax+CURSOR.size], CURSOR_SIZE
jne .fail
mov ebx, [CURRENT_TASK]
shl ebx, 8
xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
ret
.fail:
mov eax, [def_cursor]
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
shl ebx, 8 shl ebx, 8
xchg eax, [ebx+PROC_BASE+APPDATA.cursor] xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
@ -255,6 +265,11 @@ proc load_cursor stdcall, src:dword, flags:dword
test eax, eax test eax, eax
jz .fail jz .fail
mov ebx, [CURRENT_TASK]
shl ebx, 5
mov ebx, [0x3000+ebx+4]
mov [eax+CURSOR.pid], ebx
stdcall [create_cursor], eax, [src], [flags] stdcall [create_cursor], eax, [src], [flags]
mov [handle], eax mov [handle], eax
.fail: .fail:
@ -292,7 +307,7 @@ proc init_cursors
mov [cursor_map+4], eax mov [cursor_map+4], eax
mov edx, cursor_map mov edx, cursor_map
mov [cursor_start], edx mov [cursor_start], edx
add edx, 4 add edx, 8
mov [cursor_end], edx mov [cursor_end], edx
stdcall load_driver, drv_hw_mouse stdcall load_driver, drv_hw_mouse