Leaked source code of windows server 2003
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.

61 lines
1.7 KiB

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