windows-nt/Source/XPSP1/NT/base/mvdm/wow16/write/objmini.asm
2020-09-26 16:20:57 +08:00

64 lines
1.7 KiB
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;\
; obj.asm
;
; Copyright (C) 1992, MicroSoft Corporation
;
; Contains pointer validation routine
;
; History: sriniK 02/01/1991 original
; (8.20.91) v-dougk made into far proc
;/
.286p
.MODEL MEDIUM
.CODE
;**************************** _CheckPointer ****************************
;
; WORD _CheckPointer (lp, access)
;
; Args:
; lp pointer to be verified
; access 0 test the pointer for read access
; 1 test the pointer for write access
; returns:
; FALSE invalid pointer
; TRUE valid pointer
;
;
;
public _CheckPointer
_CheckPointer proc
push bp
mov bp, sp
xor ax, ax ; assume an error
and word ptr [bp+0AH], -1
jnz check_write_access
verr word ptr [bp+8] ; check selector for read access
jnz error
jmp short check_offset
check_write_access:
verw word ptr [bp+8] ; check selector for write access
jnz error
check_offset:
lsl bx, word ptr [bp+8] ; segment limit gets copied into BX
jnz error
cmp [bp+6], bx
ja error
or ax, -1
error:
pop bp
ret
_CheckPointer endp
end