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.

165 lines
3.7 KiB

  1. page ,132
  2. ;-----------------------------Module-Header-----------------------------;
  3. ; Module Name: LIBINIT.ASM
  4. ;
  5. ; library stub to do local init for a Dynamic linked library
  6. ;
  7. ; Created: 06-27-89
  8. ; Author: Todd Laney [ToddLa]
  9. ;
  10. ; Exported Functions: none
  11. ;
  12. ; Public Functions: none
  13. ;
  14. ; Public Data: none
  15. ;
  16. ; General Description:
  17. ;
  18. ; Restrictions:
  19. ;
  20. ; This must be the first object file in the LINK line, this assures
  21. ; that the reserved parameter block is at the *base* of DGROUP
  22. ;
  23. ;-----------------------------------------------------------------------;
  24. ?PLM=1 ; PASCAL Calling convention is DEFAULT
  25. ?WIN=1 ; Windows calling convention
  26. .286p
  27. .xlist
  28. include cmacros.inc
  29. ; include windows.inc
  30. .list
  31. ifndef SEGNAME
  32. SEGNAME equ <_TEXT>
  33. endif
  34. ifndef WEPSEG
  35. WEPSEG equ <_TEXT>
  36. endif
  37. createSeg %SEGNAME, CodeSeg, word, public, CODE
  38. createSeg %WEPSEG, WepCodeSeg, word, public, CODE
  39. ;-----------------------------------------------------------------------;
  40. ; external functions
  41. ;
  42. externFP LocalInit ; in KERNEL
  43. externFP LibMain ; C code to do DLL init
  44. ;-----------------------------------------------------------------------;
  45. ;
  46. ;
  47. %out link me first!!
  48. sBegin Data
  49. assumes DS,Data
  50. org 0 ;Base of DATA segment.
  51. DD 0 ;So null pointers get 0.
  52. maxRsrvPtrs = 5
  53. DW maxRsrvPtrs
  54. usedRsrvPtrs = 0
  55. labelDP <PUBLIC, rsrvptrs>
  56. DefRsrvPtr MACRO name
  57. globalW name, 0
  58. usedRsrvPtrs = usedRsrvPtrs + 1
  59. ENDM
  60. DefRsrvPtr pLocalHeap ;Local heap pointer.
  61. DefRsrvPtr pAtomTable ;Atom table pointer.
  62. DefRsrvPtr pStackTop ;Top of stack.
  63. DefRsrvPtr pStackMin ;Minimum value of SP.
  64. DefRsrvPtr pStackBot ;Bottom of stack.
  65. if maxRsrvPtrs - usedRsrvPtrs
  66. DW maxRsrvPtrs - usedRsrvPtrs DUP (0)
  67. endif
  68. public __acrtused
  69. __acrtused = 1
  70. sEnd Data
  71. ;-----------------------------------------------------------------------;
  72. sBegin CodeSeg
  73. assumes cs,CodeSeg
  74. ;--------------------------Private-Routine-----------------------------;
  75. ;
  76. ; LibEntry - called when DLL is loaded
  77. ;
  78. ; Entry:
  79. ; CX = size of heap
  80. ; DI = module handle
  81. ; DS = automatic data segment
  82. ; ES:SI = address of command line (not used)
  83. ;
  84. ; Returns:
  85. ; AX = TRUE if success
  86. ; Error Returns:
  87. ; AX = FALSE if error (ie fail load process)
  88. ; Registers Preserved:
  89. ; SI,DI,DS,BP
  90. ; Registers Destroyed:
  91. ; AX,BX,CX,DX,ES,FLAGS
  92. ; Calls:
  93. ; None
  94. ; History:
  95. ;
  96. ; 06-27-89 -by- Todd Laney [ToddLa]
  97. ; Created.
  98. ;-----------------------------------------------------------------------;
  99. cProc LibEntry,<FAR,PUBLIC,NODATA>,<>
  100. cBegin
  101. ;
  102. ; Push frame for LibMain (hModule,cbHeap,lpszCmdLine)
  103. ;
  104. push di
  105. push cx
  106. push es
  107. push si
  108. ;
  109. ; Init the local heap (if one is declared in the .def file)
  110. ;
  111. jcxz no_heap
  112. cCall LocalInit,<0,0,cx>
  113. no_heap:
  114. cCall LibMain
  115. cEnd
  116. sEnd CodeSeg
  117. ;--------------------------Exported-Routine-----------------------------;
  118. ;
  119. ; WEP()
  120. ;
  121. ; called when the DLL is unloaded, it is passed 1 WORD parameter that
  122. ; is TRUE if the system is going down, or zero if the app is
  123. ;
  124. ; WARNING:
  125. ;
  126. ; This function is basicly useless, you cant can any kernel function
  127. ; that may cause the LoadModule() code to be reentered..
  128. ;
  129. ;-----------------------------------------------------------------------;
  130. sBegin WepCodeSeg
  131. assumes cs,WepCodeSeg
  132. assumes ds,nothing
  133. assumes es,nothing
  134. cProc WEP,<FAR,PUBLIC,NODATA>,<>
  135. ParmW WhyIsThisParamBogusDave?
  136. cBegin
  137. cEnd
  138. sEnd WepCodeSeg
  139. end LibEntry