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.

75 lines
1.8 KiB

  1. TITLE HANDLE - Handle Table Manager
  2. .xlist
  3. include kernel.inc
  4. .list
  5. sBegin CODE
  6. assumes CS,CODE
  7. ;-----------------------------------------------------------------------;
  8. ; hthread ;
  9. ; ;
  10. ; Threads together a list of free handles. ;
  11. ; ;
  12. ; Arguments: ;
  13. ; DI = start of chain ;
  14. ; CX = #handle entries in chain ;
  15. ; ;
  16. ; Returns: ;
  17. ; AX = address of first handle entry on free list ;
  18. ; CX = 0 ;
  19. ; DI = address of first word after handle block ;
  20. ; ;
  21. ; Error Returns: ;
  22. ; ;
  23. ; Registers Preserved: ;
  24. ; ;
  25. ; Registers Destroyed: ;
  26. ; ;
  27. ; Calls: ;
  28. ; ;
  29. ; History: ;
  30. ; ;
  31. ; Mon Oct 27, 1986 10:09:23a -by- David N. Weise [davidw] ;
  32. ; Restructured as a result of separating handle.asm and lhandle.asm. ;
  33. ; ;
  34. ; Tue Oct 14, 1986 04:11:46p -by- David N. Weise [davidw] ;
  35. ; Added this nifty comment block. ;
  36. ; ;
  37. ; Wed Jul 8, 1987 14:36 -by- Rick N. Zucker [rickz] ;
  38. ; changed to hthread from ghthead to be used by local handle entries ;
  39. ; ;
  40. ;-----------------------------------------------------------------------;
  41. assumes ds, nothing
  42. assumes es, nothing
  43. cProc hthread,<PUBLIC,NEAR>
  44. cBegin nogen
  45. push di ; Save first free handle entry
  46. smov es,ds
  47. cld
  48. ht1: ; Chain entries together via he_link
  49. errnz <he_link>
  50. errnz <he_link - lhe_link>
  51. lea ax,[di].SIZE HandleEntry
  52. stosw
  53. mov ax,HE_FREEHANDLE
  54. errnz <2 - he_flags>
  55. errnz <he_flags - lhe_flags>
  56. stosw
  57. errnz <4 - SIZE HandleEntry>
  58. errnz <SIZE HandleEntry - SIZE LocalHandleEntry>
  59. loop ht1
  60. ; Null terminate free list
  61. mov [di-SIZE HandleEntry].he_link,cx
  62. pop ax ; Return free handle address
  63. ret
  64. cEnd nogen
  65. sEnd CODE
  66. end