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.

115 lines
2.3 KiB

  1. title nmsghdr - near message header and finder
  2. ;--------------------------------------------------------------------------
  3. ;
  4. ; Microsoft C Compiler Runtime for MS-DOS
  5. ;
  6. ; (C)Copyright Microsoft Corporation, 1986
  7. ;
  8. ;--------------------------------------------------------------------------
  9. ;
  10. ; Revision History
  11. ;
  12. ; 04/03/86 Greg Whitten
  13. ;
  14. ; 05/28/86 Randy Nevin
  15. ; some pointers removed from the nhdr segment to
  16. ; save space. they were there in anticipation of
  17. ; being used as a method of changing messages, but
  18. ; it turns out they are not needed
  19. ;
  20. ;--------------------------------------------------------------------------
  21. ?DF= 1 ; this is special for c startup
  22. include version.inc
  23. ?PLM= 1 ; pascal calling conventions
  24. .xlist
  25. include cmacros.inc
  26. include msdos.inc
  27. .list
  28. createSeg _TEXT, code, byte, public, CODE, <>
  29. createSeg _DATA, data, word, public, DATA, DGROUP
  30. createSeg HDR, nhdr, byte, public, CONST, DGROUP
  31. createSeg MSG, nmsg, byte, public, CONST, DGROUP
  32. createSeg PAD, npad, byte, common, CONST, DGROUP
  33. createSeg EPAD, nepad, byte, common, CONST, DGROUP
  34. defGrp DGROUP ; define DGROUP
  35. codeOFFSET equ offset _TEXT:
  36. dataOFFSET equ offset DGROUP:
  37. sBegin nhdr
  38. assumes ds,DGROUP
  39. db '<<NMSG>>'
  40. stnmsg label byte
  41. sEnd
  42. sBegin npad
  43. assumes ds,DGROUP
  44. dw -1 ; message padding marker
  45. sEnd
  46. sBegin nepad
  47. assumes ds,DGROUP
  48. db -1
  49. sEnd
  50. sBegin code
  51. assumes cs,code
  52. assumes ds,DGROUP
  53. ;------------------------------------------------------------------------
  54. ;
  55. ; char * pascal __NMSG_TEXT ( messagenumber)
  56. ;
  57. ; This routine returns a near pointer to the message associated with
  58. ; messagenumber. If the message does not exist, then a 0 is returned.
  59. ;
  60. ; This routine reestablishes DS = ES = DGROUP
  61. cProc __NMSG_TEXT,<PUBLIC>,<si,di> ; pascal calling
  62. parmW msgt
  63. cBegin
  64. mov ax,DGROUP
  65. mov ds,ax ; ds = DGROUP (force it always)
  66. push ds
  67. pop es
  68. mov dx,msgt ; dx = message number
  69. mov si,dataOFFSET stnmsg ; start of near messages
  70. tloop:
  71. lodsw ; ax = current message number
  72. cmp ax,dx
  73. je found ; found it - return address
  74. inc ax
  75. xchg ax,si
  76. jz found ; at end and not found - return 0
  77. xchg di,ax
  78. xor ax,ax
  79. mov cx,-1
  80. repne scasb ; skip until 00
  81. mov si,di
  82. jmp tloop ; try next entry
  83. found:
  84. xchg ax,si
  85. cEnd
  86. sEnd
  87. end