Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.7 KiB

  1. ;\
  2. ; obj.asm
  3. ;
  4. ; Copyright (C) 1992, MicroSoft Corporation
  5. ;
  6. ; Contains pointer validation routine
  7. ;
  8. ; History: sriniK 02/01/1991 original
  9. ; (8.20.91) v-dougk made into far proc
  10. ;/
  11. .286p
  12. .MODEL MEDIUM
  13. .CODE
  14. ;**************************** _CheckPointer ****************************
  15. ;
  16. ; WORD _CheckPointer (lp, access)
  17. ;
  18. ; Args:
  19. ; lp pointer to be verified
  20. ; access 0 test the pointer for read access
  21. ; 1 test the pointer for write access
  22. ; returns:
  23. ; FALSE invalid pointer
  24. ; TRUE valid pointer
  25. ;
  26. ;
  27. ;
  28. public _CheckPointer
  29. _CheckPointer proc
  30. push bp
  31. mov bp, sp
  32. xor ax, ax ; assume an error
  33. and word ptr [bp+0AH], -1
  34. jnz check_write_access
  35. verr word ptr [bp+8] ; check selector for read access
  36. jnz error
  37. jmp short check_offset
  38. check_write_access:
  39. verw word ptr [bp+8] ; check selector for write access
  40. jnz error
  41. check_offset:
  42. lsl bx, word ptr [bp+8] ; segment limit gets copied into BX
  43. jnz error
  44. cmp [bp+6], bx
  45. ja error
  46. or ax, -1
  47. error:
  48. pop bp
  49. ret
  50. _CheckPointer endp
  51. end
  52.