From 01056f99f2b7f680abb5a28008e8854ff963487b Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Tue, 5 Dec 2006 08:31:44 +0000 Subject: [PATCH] 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 --- kernel/trunk/gui/event.inc | 12 +++--------- kernel/trunk/hid/mousedrv.inc | 16 +++++++++++++++- kernel/trunk/video/cursors.inc | 17 ++++++++++++++++- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/kernel/trunk/gui/event.inc b/kernel/trunk/gui/event.inc index 6f8574cc82..be0e192d4e 100644 --- a/kernel/trunk/gui/event.inc +++ b/kernel/trunk/gui/event.inc @@ -124,14 +124,6 @@ endp align 4 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: mov ebx,[CURRENT_TASK] shl ebx,8 @@ -142,11 +134,13 @@ proc get_event_ex stdcall, p_ev:dword, timeout:dword mov edx, [esi+EVENT.next] mov [PROC_BASE+ebx+APPDATA.ev_first], edx test edx, edx + jz @F + mov [edx+EVENT.prev], 0 +@@: jnz @F mov [PROC_BASE+ebx+APPDATA.ev_last], edx and dword [PROC_BASE+ebx+APPDATA.event_mask], not EVENT_EXTENDED @@: - mov [edx+EVENT.prev], 0 dec [PROC_BASE+ebx+APPDATA.ev_count] mov eax, esi diff --git a/kernel/trunk/hid/mousedrv.inc b/kernel/trunk/hid/mousedrv.inc index eea8df5667..69a1e15a6b 100644 --- a/kernel/trunk/hid/mousedrv.inc +++ b/kernel/trunk/hid/mousedrv.inc @@ -102,10 +102,24 @@ save_draw_mouse: mul ecx movzx edx, byte [display_data+ebx+eax] 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] popad ret +.fail: + mov ecx, [def_cursor] + mov [edx+PROC_BASE+APPDATA.cursor], ecx + push ecx + call [set_hw_cursor] + popad + ret + @@: pushad ; save & draw diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index be25f36c29..24b7959bd3 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -192,6 +192,16 @@ endp align 4 proc set_cursor stdcall, hcursor:dword 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] shl ebx, 8 xchg eax, [ebx+PROC_BASE+APPDATA.cursor] @@ -255,6 +265,11 @@ proc load_cursor stdcall, src:dword, flags:dword test eax, eax 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] mov [handle], eax .fail: @@ -292,7 +307,7 @@ proc init_cursors mov [cursor_map+4], eax mov edx, cursor_map mov [cursor_start], edx - add edx, 4 + add edx, 8 mov [cursor_end], edx stdcall load_driver, drv_hw_mouse