Source code of Windows XP (NT5)
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.

76 lines
2.4 KiB

  1. ;------------------------------------------------------------------------------
  2. ; LIBRARY INITIALIZATION/STARUP
  3. ;
  4. ;
  5. ; Copyright (C) 1990-1994 Microsoft Corp.
  6. ;
  7. ; segment: _TEXT (WINV16)
  8. ; created: 28-Mar-91 <chriswil>
  9. ; history: 28-Mar-91 <chriswil> created.
  10. ;
  11. ;------------------------------------------------------------------------------
  12. .xlist
  13. include cmacros.inc
  14. ?PLM=1
  15. ?WIN=1
  16. memS EQU 1
  17. assumes cs,CODE
  18. .list
  19. externFP <LocalInit>
  20. externFP <UnlockSegment>
  21. externFP <LibMain>
  22. externCP <__acrtused>
  23. sBegin CODE
  24. ;------------------------------------------------------------------------------
  25. ; LIBRARY ENTRY-POINT - <DOS ONLY>
  26. ; This routine is called to setup a dll upon entry. It does the nifty
  27. ; task of initializing a dll's heap and calls a standard entry routine.
  28. ; When initializing a heap, windows locks the dataseg, so we must unlock
  29. ; it ourselves.
  30. ;
  31. ; Upon entry, Windows sets up the registers with particular values for
  32. ; us to use in setting up a heap, and identifying a process.
  33. ;
  34. ; DI - Instance handle of the module
  35. ; DS - Segement address for the library data-seg
  36. ; CX - Size of heap to initialize.
  37. ; ES - Segment of command line arguments.
  38. ; SI - Offset of command line arguments.
  39. ;
  40. ;
  41. ;
  42. ; created: 28-Mar-91 <chriswil>
  43. ; history: 28-Mar-91 <chriswil> created.
  44. ;
  45. ;------------------------------------------------------------------------------
  46. cProc LoadLib,<FAR,PUBLIC>,<si,di>
  47. cBegin
  48. jcxz NoHeap ; If Heap == 0, then we don't want one.
  49. xor ax,ax ; Clear return register
  50. push ds ; Setup stack for the call to the
  51. push ax ; LocalInit() function.
  52. push cx ;
  53. call LocalInit ; Call LocalInit()
  54. or ax,ax ; If LocalInit failed (0), then we
  55. jz LoadLibDone; ; return FALSE.
  56. push ds ; else we unlock the dataseg
  57. call UnlockSegment ;
  58. NoHeap:
  59. push di ; Setup stack for the call to the
  60. push ds ; LibMain() function.
  61. push es ;
  62. push si ;
  63. call LibMain ; Call LibMain()
  64. LoadLibDone: ; Return AX to Windows
  65. cEnd
  66. sEnd CODE
  67. end LoadLib