Windows NT 4.0 source code leak
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.

122 lines
3.0 KiB

4 years ago
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;
  3. ; DLLENTRY.ASM
  4. ;
  5. ; simulates the NT DllEntryPoint call for a Win16 DLL
  6. ;
  7. ; Copyright (c) Microsoft Corporation 1989, 1990. All rights reserved.
  8. ;
  9. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  10. PMODE = 1
  11. ?PLM=1 ; pascal call convention
  12. ?WIN=0 ; NO! Windows prolog/epilog code
  13. .286
  14. .xlist
  15. include cmacros.inc
  16. .list
  17. DLL_PROCESS_DETACH = 0
  18. DLL_PROCESS_ATTACH = 1
  19. externFP DllEntryPoint
  20. externFP LocalInit
  21. ifndef SEGNAME
  22. SEGNAME equ <_TEXT>
  23. endif
  24. createSeg %SEGNAME, CodeSeg, word, public, CODE
  25. ;-----------------------------------------------------------------------;
  26. ;
  27. ; Stuff needed to avoid the C runtime coming in, and init the windows
  28. ; reserved parameter block at the base of DGROUP
  29. ;
  30. ; NOTE if you need the 'C' startup dont use this file.
  31. ;
  32. ;-----------------------------------------------------------------------;
  33. if 1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  34. sBegin Data
  35. assumes ds,Data
  36. DD 0 ; So null pointers get 0
  37. DW 5 ; number of reserved ptrs
  38. globalW pLocalHeap,0 ; Local heap pointer
  39. globalW pAtomTable,0 ; Atom table pointer
  40. globalW pStackTop,0 ; top of stack
  41. globalW pStackMin,0 ; minimum value of SP
  42. globalW pStackBot,0 ; bottom of stack
  43. public __acrtused
  44. __acrtused = 1
  45. sEnd Data
  46. endif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  47. sBegin CodeSeg
  48. assumes cs,CodeSeg
  49. assumes ds,Data
  50. assumes es,nothing
  51. ;--------------------------Private-Routine-----------------------------;
  52. ;
  53. ; LibEntry - called when DLL is loaded
  54. ;
  55. ; Entry:
  56. ; CX = size of heap
  57. ; DI = module handle
  58. ; DS = automatic data segment
  59. ; ES:SI = address of command line (not used)
  60. ; Returns:
  61. ; AX = TRUE if success
  62. ; History:
  63. ; 06-27-89 -by- Todd Laney [ToddLa]
  64. ; Created.
  65. ;-----------------------------------------------------------------------;
  66. assumes ds,nothing
  67. assumes es,nothing
  68. cProc LibEntry,<FAR,PUBLIC,NODATA>,<>
  69. cBegin
  70. jcxz @f
  71. cCall LocalInit,<0,0,cx>
  72. @@: cCall DllEntryPoint, <di, 0,DLL_PROCESS_ATTACH, 0, 0>
  73. cEnd
  74. ;--------------------------Private-Routine-----------------------------;
  75. ;
  76. ; WEP - called when DLL is unloaded
  77. ;
  78. ; History:
  79. ; 06-27-89 -by- Todd Laney [ToddLa]
  80. ; Created.
  81. ;-----------------------------------------------------------------------;
  82. assumes ds,nothing
  83. assumes es,nothing
  84. cProc WEP, <FAR, PUBLIC, PASCAL>, <ds>
  85. ParmW fSystemExit
  86. cBegin
  87. ;
  88. ; HEY dont cleanup if windows is going down.
  89. ;
  90. mov ax,fSystemExit
  91. or ax,ax
  92. ;;; jnz just_exit
  93. mov ax,DataBASE
  94. mov ds,ax
  95. assumes ds,Data
  96. cCall DllEntryPoint, <ax, 0,DLL_PROCESS_DETACH, 0, 0>
  97. just_exit:
  98. cEnd
  99. sEnd CodeSeg
  100. end LibEntry