Add stub WM_OPEN_FILE handler to hello.asm
This commit is contained in:
parent
cb77e27fb2
commit
8bea9d6120
4 changed files with 63 additions and 8 deletions
37
hello.asm
37
hello.asm
|
@ -51,9 +51,14 @@ process_event:
|
||||||
push es
|
push es
|
||||||
|
|
||||||
; On entry, ds and es will not be set correctly for us
|
; On entry, ds and es will not be set correctly for us
|
||||||
mov bp, cs
|
; WM_OPEN_FILE needs ds to be left-as is
|
||||||
mov ds, bp
|
cmp al, WM_OPEN_FILE
|
||||||
mov es, bp
|
je .no_set_ds
|
||||||
|
push cs
|
||||||
|
pop ds
|
||||||
|
.no_set_ds:
|
||||||
|
push cs
|
||||||
|
pop es
|
||||||
|
|
||||||
cmp al, WM_PAINT
|
cmp al, WM_PAINT
|
||||||
jne .not_paint
|
jne .not_paint
|
||||||
|
@ -79,6 +84,12 @@ process_event:
|
||||||
jmp .end
|
jmp .end
|
||||||
.not_unhook:
|
.not_unhook:
|
||||||
|
|
||||||
|
cmp al, WM_OPEN_FILE
|
||||||
|
jne .not_open_file
|
||||||
|
call event_open_file
|
||||||
|
jmp .end
|
||||||
|
.not_opend_file:
|
||||||
|
|
||||||
.end:
|
.end:
|
||||||
pop es
|
pop es
|
||||||
pop ds
|
pop ds
|
||||||
|
@ -316,7 +327,7 @@ event_click:
|
||||||
; out:
|
; out:
|
||||||
; clobbers everything
|
; clobbers everything
|
||||||
event_keyboard:
|
event_keyboard:
|
||||||
; Unlike other events, keyboard events are not forwarded
|
; Unlike most other events, keyboard events are not forwarded
|
||||||
; Since we do not care about the keyboard for this app, we just
|
; Since we do not care about the keyboard for this app, we just
|
||||||
; swallow the event
|
; swallow the event
|
||||||
ret
|
ret
|
||||||
|
@ -353,6 +364,24 @@ event_unhook:
|
||||||
mov ax, [window_next]
|
mov ax, [window_next]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; in:
|
||||||
|
; al = WM_OPEN_FILE
|
||||||
|
; ds:cx = filename
|
||||||
|
; ds ≠ cs
|
||||||
|
; out:
|
||||||
|
; ds = cs
|
||||||
|
; clobbers everything
|
||||||
|
event_open_file:
|
||||||
|
; File open events are sent specifically to a process, so we don't
|
||||||
|
; need to forward it
|
||||||
|
; Unlike other event handlers, event_open_file is called with ds
|
||||||
|
; still set to calling process's segment, so that it can read the
|
||||||
|
; passed-in filename. For simplicity of code running after the,
|
||||||
|
; event handlers, we set ds to point to our own segment on return
|
||||||
|
push cs
|
||||||
|
pop ds
|
||||||
|
ret
|
||||||
|
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
; Event handler subroutines
|
; Event handler subroutines
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
|
|
26
memory.asm
26
memory.asm
|
@ -72,6 +72,12 @@ process_event:
|
||||||
jmp .end
|
jmp .end
|
||||||
.not_unhook:
|
.not_unhook:
|
||||||
|
|
||||||
|
cmp al, WM_OPEN_FILE
|
||||||
|
jne .not_open_file
|
||||||
|
call event_open_file
|
||||||
|
jmp .end
|
||||||
|
.not_opend_file:
|
||||||
|
|
||||||
.end:
|
.end:
|
||||||
pop es
|
pop es
|
||||||
pop ds
|
pop ds
|
||||||
|
@ -297,7 +303,7 @@ event_click:
|
||||||
; out:
|
; out:
|
||||||
; clobbers everything
|
; clobbers everything
|
||||||
event_keyboard:
|
event_keyboard:
|
||||||
; Unlike other events, keyboard events are not forwarded
|
; Unlike most other events, keyboard events are not forwarded
|
||||||
; Since we do not care about the keyboard for this app, we just
|
; Since we do not care about the keyboard for this app, we just
|
||||||
; swallow the event
|
; swallow the event
|
||||||
ret
|
ret
|
||||||
|
@ -334,6 +340,24 @@ event_unhook:
|
||||||
mov ax, [window_next]
|
mov ax, [window_next]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; in:
|
||||||
|
; al = WM_OPEN_FILE
|
||||||
|
; ds:cx = filename
|
||||||
|
; ds ≠ cs
|
||||||
|
; out:
|
||||||
|
; ds = cs
|
||||||
|
; clobbers everything
|
||||||
|
event_open_file:
|
||||||
|
; File open events are sent specifically to a process, so we don't
|
||||||
|
; need to forward it
|
||||||
|
; Unlike other event handlers, event_open_file is called with ds
|
||||||
|
; still set to calling process's segment, so that it can read the
|
||||||
|
; passed-in filename. For simplicity of code running after the,
|
||||||
|
; event handlers, we set ds to point to our own segment on return
|
||||||
|
push cs
|
||||||
|
pop ds
|
||||||
|
ret
|
||||||
|
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
; Event handler subroutines
|
; Event handler subroutines
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
|
|
|
@ -150,8 +150,11 @@ process_event:
|
||||||
cmp al, WM_UNHOOK
|
cmp al, WM_UNHOOK
|
||||||
jne .not_remove
|
jne .not_remove
|
||||||
call unhook
|
call unhook
|
||||||
|
jmp .end
|
||||||
.not_remove:
|
.not_remove:
|
||||||
|
|
||||||
|
; We ignore WM_OPEN_FILE
|
||||||
|
|
||||||
.end:
|
.end:
|
||||||
cmp byte [open_windows], 0
|
cmp byte [open_windows], 0
|
||||||
jne .windows_open
|
jne .windows_open
|
||||||
|
|
|
@ -87,9 +87,6 @@ process_event:
|
||||||
cmp al, WM_OPEN_FILE
|
cmp al, WM_OPEN_FILE
|
||||||
jne .not_open_file
|
jne .not_open_file
|
||||||
call event_open_file
|
call event_open_file
|
||||||
; Set ds in case event_open_file didn't
|
|
||||||
push cs
|
|
||||||
pop ds
|
|
||||||
jmp .end
|
jmp .end
|
||||||
.not_open_file:
|
.not_open_file:
|
||||||
|
|
||||||
|
@ -757,7 +754,9 @@ event_unhook:
|
||||||
; in:
|
; in:
|
||||||
; al = WM_OPEN_FILE
|
; al = WM_OPEN_FILE
|
||||||
; ds:cx = filename
|
; ds:cx = filename
|
||||||
|
; ds ≠ cs
|
||||||
; out:
|
; out:
|
||||||
|
; ds = cs
|
||||||
; clobbers everything
|
; clobbers everything
|
||||||
event_open_file:
|
event_open_file:
|
||||||
; Copy the file name over
|
; Copy the file name over
|
||||||
|
|
Loading…
Reference in a new issue