Add stub WM_OPEN_FILE handler to hello.asm
This commit is contained in:
parent
cb77e27fb2
commit
8bea9d6120
37
hello.asm
37
hello.asm
|
@ -51,9 +51,14 @@ process_event:
|
|||
push es
|
||||
|
||||
; On entry, ds and es will not be set correctly for us
|
||||
mov bp, cs
|
||||
mov ds, bp
|
||||
mov es, bp
|
||||
; WM_OPEN_FILE needs ds to be left-as is
|
||||
cmp al, WM_OPEN_FILE
|
||||
je .no_set_ds
|
||||
push cs
|
||||
pop ds
|
||||
.no_set_ds:
|
||||
push cs
|
||||
pop es
|
||||
|
||||
cmp al, WM_PAINT
|
||||
jne .not_paint
|
||||
|
@ -79,6 +84,12 @@ process_event:
|
|||
jmp .end
|
||||
.not_unhook:
|
||||
|
||||
cmp al, WM_OPEN_FILE
|
||||
jne .not_open_file
|
||||
call event_open_file
|
||||
jmp .end
|
||||
.not_opend_file:
|
||||
|
||||
.end:
|
||||
pop es
|
||||
pop ds
|
||||
|
@ -316,7 +327,7 @@ event_click:
|
|||
; out:
|
||||
; clobbers everything
|
||||
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
|
||||
; swallow the event
|
||||
ret
|
||||
|
@ -353,6 +364,24 @@ event_unhook:
|
|||
mov ax, [window_next]
|
||||
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
|
||||
; ------------------------------------------------------------------
|
||||
|
|
26
memory.asm
26
memory.asm
|
@ -72,6 +72,12 @@ process_event:
|
|||
jmp .end
|
||||
.not_unhook:
|
||||
|
||||
cmp al, WM_OPEN_FILE
|
||||
jne .not_open_file
|
||||
call event_open_file
|
||||
jmp .end
|
||||
.not_opend_file:
|
||||
|
||||
.end:
|
||||
pop es
|
||||
pop ds
|
||||
|
@ -297,7 +303,7 @@ event_click:
|
|||
; out:
|
||||
; clobbers everything
|
||||
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
|
||||
; swallow the event
|
||||
ret
|
||||
|
@ -334,6 +340,24 @@ event_unhook:
|
|||
mov ax, [window_next]
|
||||
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
|
||||
; ------------------------------------------------------------------
|
||||
|
|
|
@ -150,8 +150,11 @@ process_event:
|
|||
cmp al, WM_UNHOOK
|
||||
jne .not_remove
|
||||
call unhook
|
||||
jmp .end
|
||||
.not_remove:
|
||||
|
||||
; We ignore WM_OPEN_FILE
|
||||
|
||||
.end:
|
||||
cmp byte [open_windows], 0
|
||||
jne .windows_open
|
||||
|
|
|
@ -87,9 +87,6 @@ process_event:
|
|||
cmp al, WM_OPEN_FILE
|
||||
jne .not_open_file
|
||||
call event_open_file
|
||||
; Set ds in case event_open_file didn't
|
||||
push cs
|
||||
pop ds
|
||||
jmp .end
|
||||
.not_open_file:
|
||||
|
||||
|
@ -757,7 +754,9 @@ event_unhook:
|
|||
; in:
|
||||
; al = WM_OPEN_FILE
|
||||
; ds:cx = filename
|
||||
; ds ≠ cs
|
||||
; out:
|
||||
; ds = cs
|
||||
; clobbers everything
|
||||
event_open_file:
|
||||
; Copy the file name over
|
||||
|
|
Loading…
Reference in New Issue