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.

142 lines
3.6 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1994-1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ddkcomp.h
  6. * Content: Compilation environment for Win9x code in NT kernel.
  7. * History:
  8. * Date By Reason
  9. * ==== == ======
  10. * 03-Feb-98 DrewB Keep common code for DDraw heap.
  11. *
  12. ***************************************************************************/
  13. #ifndef __NTDDKCOMP__
  14. #define __NTDDKCOMP__
  15. #if DBG
  16. #define DEBUG
  17. #else
  18. #undef DEBUG
  19. #endif
  20. #ifndef INVALID_HANDLE_VALUE
  21. #define INVALID_HANDLE_VALUE NULL
  22. #endif
  23. typedef DD_DIRECTDRAW_LOCAL *LPDDRAWI_DIRECTDRAW_LCL;
  24. typedef DD_DIRECTDRAW_GLOBAL *LPDDRAWI_DIRECTDRAW_GBL;
  25. typedef DD_SURFACE_LOCAL *LPDDRAWI_DDRAWSURFACE_LCL;
  26. typedef DD_SURFACE_GLOBAL *LPDDRAWI_DDRAWSURFACE_GBL;
  27. typedef VIDEOMEMORYINFO VIDMEMINFO;
  28. typedef VIDMEMINFO *LPVIDMEMINFO;
  29. typedef VIDEOMEMORY VIDMEM;
  30. typedef VIDMEM *LPVIDMEM;
  31. #ifndef ZeroMemory
  32. #define ZeroMemory(pv, cBytes) RtlZeroMemory(pv, cBytes)
  33. #endif
  34. #define ZwCloseKey ZwClose
  35. #define ABS(A) ((A) < 0 ? -(A) : (A))
  36. //
  37. // Sundown: in GDI, there are lots of places SIZE_T are used as interchangeable
  38. // as ULONG or UINT or LONG or INT. On 64bit system, SIZE_T is int64 indeed.
  39. // Since we are not making any GDI objects large objects right now, I just
  40. // change all SIZE_T to ULONGSIZE_T here.
  41. //
  42. // The new type used is to easily identify the change later.
  43. //
  44. #define ULONGSIZE_T ULONG
  45. #if defined(_X86_)
  46. //
  47. // Keep our own copy of this to avoid double indirections on probing
  48. //
  49. extern ULONG_PTR DxgUserProbeAddress;
  50. #undef MM_USER_PROBE_ADDRESS
  51. #define MM_USER_PROBE_ADDRESS DxgUserProbeAddress
  52. #endif // defined(_X86_)
  53. //
  54. // Macro to check memory allocation overflow.
  55. //
  56. #define MAXIMUM_POOL_ALLOC (PAGE_SIZE * 10000)
  57. #define BALLOC_OVERFLOW1(c,st) (c > (MAXIMUM_POOL_ALLOC/sizeof(st)))
  58. #define BALLOC_OVERFLOW2(c,st1,st2) (c > (MAXIMUM_POOL_ALLOC/(sizeof(st1)+sizeof(st2))))
  59. //
  60. // Debugger output macros
  61. //
  62. #define DDASSERT(Expr) ASSERTGDI(Expr, "DDASSERT")
  63. #define VDPF(Args)
  64. #ifdef DEBUG
  65. VOID WINAPI DoRip(PSZ);
  66. VOID WINAPI DoWarning(PSZ,LONG);
  67. #define RIP(x) DoRip((PSZ) x)
  68. #define ASSERTGDI(x,y) if(!(x)) DoRip((PSZ) y)
  69. #define WARNING(x) DoWarning(x,0)
  70. #define WARNING1(x) DoWarning(x,1)
  71. #define RECORD_DRIVER_EXCEPTION() DbgPrint("Driver caused exception - %s line %u\n",__FILE__,__LINE__);
  72. #else
  73. #define RIP(x)
  74. #define ASSERTGDI(x,y)
  75. #define WARNING(x)
  76. #define WARNING1(x)
  77. #define RECORD_DRIVER_EXCEPTION()
  78. #endif
  79. //
  80. // Allocated memory is zero-filled.
  81. //
  82. #define MemAlloc(cBytes) PALLOCMEM(cBytes, 'pddD')
  83. #define MemFree(pv) VFREEMEM(pv)
  84. #define PALLOCMEM(cBytes,tag) EngAllocMem(FL_ZERO_MEMORY,cBytes,tag)
  85. #define PALLOCNOZ(cBytes,tag) EngAllocMem(0,cBytes,tag)
  86. #define PALLOCNONPAGED(cBytes,tag) EngAllocMem(FL_ZERO_MEMORY|FL_NONPAGED_MEMORY,cBytes,tag)
  87. #define VFREEMEM(pv) EngFreeMem(pv)
  88. //
  89. // From ntos\inc\pool.h
  90. //
  91. #define SESSION_POOL_MASK 32
  92. //
  93. // Error messages
  94. //
  95. #define SAVE_ERROR_CODE(x) EngSetLastError((x))
  96. //
  97. // Macro to see if terminal server or not
  98. //
  99. #define ISTS() DxEngIsTermSrv()
  100. //
  101. // Macro to increment display uniqueness
  102. //
  103. #define INC_DISPLAY_UNIQUENESS() DxEngIncDispUniq()
  104. //
  105. // Macro
  106. //
  107. #define VISRGN_UNIQUENESS() DxEngVisRgnUniq()
  108. //
  109. // Macro
  110. //
  111. #define SURFOBJ_HOOK(pso) ((FLONG)DxEngGetSurfaceData(pso,SURF_HOOKFLAGS))
  112. #endif // __NTDDKCOMP__