home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 20.ddi / SOURCE / STARTUP / WIN / WINDGRP.AS_ / WINDGRP.AS
Encoding:
Text File  |  1993-02-08  |  1.1 KB  |  70 lines

  1.     page    ,132
  2.     title    windgrp.asm - Gets DGROUP of current .exe or .dll
  3. ;***
  4. ;windrp.asm - Stack checking for windows
  5. ;
  6. ;    Copyright (c) 1989-1992, Microsoft Corporation. All rights reserved.
  7. ;
  8. ;Purpose:
  9. ;    Defines _GetDGROUP() - gets DGROUP of current .exe or .dll
  10. ;
  11. ;*******************************************************************************
  12.  
  13. .xlist
  14.     include version.inc
  15.     include cmacros.inc
  16. .list
  17.  
  18.  
  19. sBegin    data
  20. sEnd    data
  21.  
  22.  
  23. sBegin    code
  24. assumes cs,code
  25.  
  26. page
  27. ;***
  28. ;unsigned int _Far _Cdecl _GetDGROUP( void );
  29. ;
  30. ;Purpose:
  31. ;    Returns the current .exe or .dll DGROUP in ax.
  32. ;
  33. ;Entry:
  34. ;
  35. ;Exit:
  36. ;    ax = DGROUP
  37. ;Uses:
  38. ;
  39. ;Exceptions:
  40. ;
  41. ;*******************************************************************************
  42.  
  43. assumes ds,nothing
  44.  
  45. bMOV_AX_IMMED    equ    0b8h        ; This is the op code for "mov ax, const".
  46.  
  47.  
  48. externB  __ExportedStub
  49.  
  50.  
  51. cProc  _GetDGROUP,<PUBLIC>,<>
  52.  
  53. cBegin    nogen
  54.  
  55.     cmp    [__ExportedStub], bMOV_AX_IMMED
  56.     je    InDLL
  57.  
  58.     mov    ax, ss        ; We are in an exe, so ss = DGROUP.
  59.     ret
  60.  
  61. InDLL:
  62.     mov    ax, word ptr [__ExportedStub+1]  ; get word operand of "mov ax, DGROUP"
  63.     ret
  64.  
  65. cEnd  nogen
  66.  
  67. sEnd  code
  68.  
  69. end
  70.