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.

200 lines
5.4 KiB

  1. title Special Export call locations for DS == SS conversion.
  2. ; Windows Write, Copyright 1985-1992 Microsoft Corporation
  3. ?DF = 1 ; Dont generate default segment definitions
  4. ?PLM = 1
  5. .XLIST
  6. include cmacros.inc
  7. .LIST
  8. subttl Define Windows Groups
  9. page
  10. MGROUP group HEADER,EXPORTS,IMPORTS,IMPORTEND,ENDHEADER
  11. IGROUP group _TEXT,_INITTEXT,_ENDTEXT
  12. DGROUP group _DATA,DATA,CDATA,CONST,_BSS,c_common,_INITDATA,_ENDDATA,STACK
  13. HEADER segment para 'MODULE'
  14. HEADER ENDS
  15. EXPORTS segment byte 'MODULE'
  16. EXPORTS ENDS
  17. IMPORTS segment byte public 'MODULE'
  18. IMPORTS ENDS
  19. IMPORTEND segment byte 'MODULE'
  20. IMPORTEND ENDS
  21. ENDHEADER segment para 'MODULE'
  22. ENDHEADER ENDS
  23. _TEXT segment byte public 'CODE'
  24. _TEXT ENDS
  25. _INITTEXT segment para public 'CODE'
  26. _INITTEXT ends
  27. _ENDTEXT segment para 'CODE'
  28. _ENDTEXT ends
  29. _DATA segment para public 'DATA'
  30. STACKSIZE = 2048
  31. $$STACK dw STACKSIZE dup (?)
  32. $$STACKTOP label word
  33. dw 0
  34. _DATA ends
  35. DATA segment para public 'DATA'
  36. DATA ends
  37. CDATA segment word common 'DATA' ; C globals end up here
  38. CDATA ends
  39. CONST segment word public 'CONST'
  40. CONST ends
  41. _BSS segment para public 'BSS'
  42. _BSS ends
  43. c_common segment para common 'BSS' ; C globals end up here
  44. c_common ends
  45. _INITDATA segment para public 'BSS'
  46. _INITDATA ends
  47. _ENDDATA segment para 'BSS'
  48. _ENDDATA ends
  49. STACK segment para stack 'STACK'
  50. DB 0 ; Force link to write entire DGROUP
  51. STACK ends
  52. subttl ENTRYPOINT definition
  53. page
  54. ENTRYPOINT MACRO name, cwArgs
  55. extrn x&name:far
  56. public name
  57. name proc far
  58. mov ax,ds ; we have to include all this code
  59. nop ; or exe2mod chokes
  60. inc bp
  61. push bp
  62. mov bp,sp
  63. push ds
  64. mov ds,ax
  65. mov cx,cwArgs * 2
  66. mov dx,offset igroup:x&name
  67. jmp SetLocStack
  68. name endp
  69. ENDM
  70. subttl external->local stack switcher
  71. page
  72. _TEXT segment byte public 'CODE'
  73. assume cs:igroup, ds:dgroup, es:dgroup, ss:nothing
  74. ;
  75. ; SetLocStack
  76. ;
  77. ; Purpose: To switch to a seperate stack located in the
  78. ; Modules Data Segment.
  79. ;
  80. ; Inputs: AX = module's DS
  81. ; SS, SP, BP = caller's stack stuff
  82. ; DS = "true" entry point addr
  83. ; cx = no. of bytes of parameters on caller's stack
  84. ;
  85. SetLocStack proc near
  86. mov bx,ss ; get copy of current segment
  87. cmp ax,bx ; see if we're already in local stack
  88. je inlocal ; we are - fall into existing code
  89. mov cs:SESPat,cx ; save arg byte count for return
  90. mov ss,ax
  91. mov sp,offset dgroup:$$STACKTOP
  92. push bx ; save old ss
  93. sub bp,2 ; point at the pushed ds
  94. push bp ; and old sp
  95. push si ; save si
  96. jcxz argdone
  97. mov ds,bx
  98. lea si,[bp + 8 - 2] ; point past ds, bp, far addr to args
  99. add si,cx ; point at top of args for backward move
  100. std
  101. shr cx,1 ; divide byte count by two
  102. jcxz argdone
  103. argloop:
  104. lodsw
  105. push ax
  106. loop argloop
  107. cld
  108. argdone:
  109. push cs
  110. mov ax,offset igroup:SetExtStack ; push setextstack return addr
  111. push ax
  112. mov ax,ss ; get new ds into ds and ax
  113. mov ds,ax
  114. push dx ; jump to true entry point via RET
  115. ret
  116. inlocal:
  117. add dx,10 ; point past prolog code
  118. push dx ; jump into middle of prolog code
  119. ret
  120. SetLocStack endp
  121. SetExtStack proc near
  122. pop si ; get back saved si
  123. pop bp ; get old sp
  124. pop bx ; and old ss
  125. mov ss,bx
  126. mov sp,bp ; now set them up
  127. pop ds ; standard epilog stuff
  128. pop bp
  129. dec bp
  130. db 0cah ;RETF n instruction
  131. SESPat dw 0
  132. SetExtStack endp
  133. subttl Entry point definitions
  134. page
  135. ;
  136. ; mp module entry points
  137. ;
  138. ENTRYPOINT MMpNew, 3
  139. ENTRYPOINT MMpLoad, 2
  140. ENTRYPOINT MMpFree, 2
  141. ;
  142. ; routines called by interface module
  143. ;
  144. ENTRYPOINT MRgchVal, 6
  145. ENTRYPOINT Mdecode, 2
  146. ENTRYPOINT MEnter, 1
  147. ENTRYPOINT Fill, 1
  148. ENTRYPOINT Clear, 0
  149. ENTRYPOINT Format, 1
  150. ENTRYPOINT MCellsContract, 0
  151. ENTRYPOINT MInsertBents, 8
  152. ENTRYPOINT MSheetCut, 0
  153. ENTRYPOINT MSheetCopy, 0
  154. ENTRYPOINT MSheetPaste, 1
  155. ENTRYPOINT MExeCut, 0
  156. ENTRYPOINT MExePaste, 0
  157. ENTRYPOINT CheckRecalc, 0
  158. ENTRYPOINT recalc, 1
  159. ENTRYPOINT MLoadSheet, 2
  160. ENTRYPOINT MSaveSheet, 3
  161. ENTRYPOINT MSortDialog, 4
  162. _TEXT ENDS
  163. end
  164.