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.

151 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. createSeg %SEGNAME, CodeSeg, word, public, CODE
  35. ;-----------------------------------------------------------------------;
  36. ; external functions
  37. ;
  38. externFP LocalInit ; in KERNEL
  39. externP LibMain ; C code to do DLL init
  40. ;-----------------------------------------------------------------------;
  41. ;
  42. ; Stuff needed to avoid the C runtime coming in, and init the windows
  43. ; reserved parameter block at the base of DGROUP
  44. ;
  45. %out link me first!!
  46. sBegin Data
  47. assumes DS,Data
  48. org 0 ; base of DATA segment!
  49. DD 0 ; So null pointers get 0
  50. maxRsrvPtrs = 5
  51. DW maxRsrvPtrs
  52. usedRsrvPtrs = 0
  53. labelDP <PUBLIC,rsrvptrs>
  54. DefRsrvPtr MACRO name
  55. globalW name,0
  56. usedRsrvPtrs = usedRsrvPtrs + 1
  57. ENDM
  58. DefRsrvPtr pLocalHeap ; Local heap pointer
  59. DefRsrvPtr pAtomTable ; Atom table pointer
  60. DefRsrvPtr pStackTop ; top of stack
  61. DefRsrvPtr pStackMin ; minimum value of SP
  62. DefRsrvPtr pStackBot ; bottom of stack
  63. if maxRsrvPtrs-usedRsrvPtrs
  64. DW maxRsrvPtrs-usedRsrvPtrs DUP (0)
  65. endif
  66. public __acrtused
  67. __acrtused = 1
  68. sEnd Data
  69. ;-----------------------------------------------------------------------;
  70. sBegin CodeSeg
  71. assumes cs,CodeSeg
  72. ;--------------------------Private-Routine-----------------------------;
  73. ;
  74. ; LibEntry - called when DLL is loaded
  75. ;
  76. ; Entry:
  77. ; CX = size of heap
  78. ; DI = module handle
  79. ; DS = automatic data segment
  80. ; ES:SI = address of command line (not used)
  81. ;
  82. ; Returns:
  83. ; AX = TRUE if success
  84. ; Error Returns:
  85. ; AX = FALSE if error (ie fail load process)
  86. ; Registers Preserved:
  87. ; SI,DI,DS,BP
  88. ; Registers Destroyed:
  89. ; AX,BX,CX,DX,ES,FLAGS
  90. ; Calls:
  91. ; None
  92. ; History:
  93. ;
  94. ; 06-27-89 -by- Todd Laney [ToddLa]
  95. ; Created.
  96. ;-----------------------------------------------------------------------;
  97. cProc LibEntry,<FAR,PUBLIC,NODATA>,<>
  98. cBegin
  99. ;
  100. ; Init the local heap (if one is declared in the .def file)
  101. ;
  102. jcxz no_heap
  103. cCall LocalInit,<0,0,cx>
  104. no_heap:
  105. cCall LibMain, <di>
  106. cEnd
  107. if 0
  108. ;--------------------------Exported-Routine-----------------------------;
  109. ;
  110. ; WEP()
  111. ;
  112. ; called when the DLL is unloaded, it is passed 1 WORD parameter that
  113. ; is TRUE if the system is going down, or zero if the app is
  114. ;
  115. ; WARNING:
  116. ;
  117. ; This function is basicly useless, you cant can any kernel function
  118. ; that may cause the LoadModule() code to be reentered..
  119. ;
  120. ;-----------------------------------------------------------------------;
  121. cProc WEP,<FAR,PUBLIC,NODATA>,<>
  122. ; ParmW fSystemExit
  123. cBegin nogen
  124. mov ax,1
  125. retf 2
  126. cEnd nogen
  127. endif
  128. sEnd CodeSeg
  129. end LibEntry