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.

132 lines
3.3 KiB

  1. title "LPC Move Message Support"
  2. ;++
  3. ;
  4. ; Copyright (c) 1989 Microsoft Corporation
  5. ;
  6. ; Module Name:
  7. ;
  8. ; lpcmove.asm
  9. ;
  10. ; Abstract:
  11. ;
  12. ; This module implements functions to support the efficient movement of
  13. ; LPC Message blocks
  14. ;
  15. ; Author:
  16. ;
  17. ; Steven R. Wood (stevewo) 30-Jun-1989
  18. ;
  19. ; Environment:
  20. ;
  21. ; Kernel mode only.
  22. ;
  23. ; Revision History:
  24. ;
  25. ; 6-Mar-90 bryanwi
  26. ; Ported to the 386.
  27. ;
  28. ;--
  29. .386p
  30. include callconv.inc ; calling convention macros
  31. page ,132
  32. subttl "Update System Time"
  33. _PAGE SEGMENT DWORD PUBLIC 'CODE'
  34. ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
  35. ;++
  36. ;
  37. ; VOID
  38. ; LpcpMoveMessage (
  39. ; OUT PPORT_MESSAGE DstMsg
  40. ; IN PPORT_MESSAGE SrcMsg
  41. ; IN ULONG MsgType OPTIONAL,
  42. ; IN PCLIENT_ID ClientId OPTIONAL
  43. ; )
  44. ;
  45. ; Routine Description:
  46. ;
  47. ; This function moves an LPC message block.
  48. ;
  49. ; Arguments:
  50. ;
  51. ; DstMsg (TOS) - Supplies pointer to where to move the message block to.
  52. ;
  53. ; SrcMsg (TOS+4) - Supplies a pointer to the message to move.
  54. ;
  55. ; MsgType (TOS+8) - If non-zero, then store in Type field of DstMsg
  56. ;
  57. ; ClientId (TOS+12) - If non-NULL, then points to a ClientId to copy to dst
  58. ;
  59. ; Return Value:
  60. ;
  61. ; None
  62. ;
  63. ;--
  64. DstMsg equ [esp + 12]
  65. SrcMsg equ [esp + 16]
  66. SrcMsgData equ [esp + 20]
  67. MsgType equ [esp + 24]
  68. ClientId equ [esp + 28]
  69. cPublicProc _LpcpMoveMessage ,5
  70. push esi ; Save non-volatile registers
  71. push edi
  72. mov edi,DstMsg ; (edi)->Destination
  73. cld
  74. mov esi,SrcMsg ; (esi)->Source
  75. lodsd ; (eax)=length
  76. stosd
  77. lea ecx,3[eax]
  78. and ecx,0FFFCH ; (ecx)=length rounded up to 4
  79. shr ecx,2 ; (ecx)=length in dwords
  80. lodsd ; (eax)=DataInfoOffset U Type
  81. mov edx,MsgType ; (edx)=MsgType
  82. or edx,edx
  83. jz lmm10 ; No MsgType, go do straight copy
  84. mov ax,dx ; (eax low 16)=MsgType
  85. lmm10: stosd
  86. mov edx,ClientId ; (edx)=ClientId
  87. or edx,edx
  88. jz lmm20 ; No Clientid to set, go do copy
  89. mov eax,[edx] ; Get new ClientId
  90. stosd ; and store in DstMsg->ClientId
  91. mov eax,[edx+4]
  92. stosd
  93. add esi,8 ; and skip over SrcMsg->ClientId
  94. jmp short lmm30
  95. lmm20: movsd ; Copy ClientId
  96. movsd
  97. ;
  98. ; At this point, all of the control structures are copied, all we
  99. ; need to copy is the data.
  100. ;
  101. lmm30:
  102. movsd ; Copy MessageId
  103. movsd ; Copy ClientViewSize
  104. mov esi,SrcMsgData ; Copy data directly from user buffer
  105. rep movsd ; Copy the data portion of message
  106. pop edi
  107. pop esi ; Restore non-volatile registers
  108. stdRET _LpcpMoveMessage
  109. stdENDP _LpcpMoveMessage
  110. _PAGE ends
  111. end
  112.