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.

141 lines
7.1 KiB

  1. #ifdef WIN32
  2. // Shouldn't be using these things.
  3. #define _huge
  4. #define _export
  5. #define _loadds
  6. #define SELECTOROF(x) ((UINT)(x))
  7. #define OFFSETOF(x) ((UINT)(x))
  8. #define ISLPTR(pv) ((BOOL)pv)
  9. #define MAKELP(hmem,off) ((LPVOID)((LPBYTE)hmem+off))
  10. #define MAKELRESULTFROMUINT(i) ((LRESULT)i)
  11. #define ISVALIDHINSTANCE(hinst) ((BOOL)hinst)
  12. #define DATASEG_READONLY
  13. #define DATASEG_PERINSTANCE
  14. #define DATASEG_SHARED
  15. #define GetWindowInt GetWindowLong
  16. #define SetWindowInt SetWindowLong
  17. #define SetWindowID(hwnd,id) SetWindowLong(hwnd, GWL_ID, id)
  18. #define CopyIcon(hInst, hIcon) CopyIcon(hIcon)
  19. #define LOADICONEX(hInst, hInst2, a, b, c, d) LoadIconEx(hInst2, a, b, c, d)
  20. #define SHELLEXECUTE(a, b, c, d, e, f) ShellExecuteEx(a, b, c, d, e, NULL, f)
  21. #define ISVALIDLIBRARY(hLib) (hLib != NULL)
  22. #else // WIN32
  23. #define ISLPTR(pv) (SELECTOROF(pv))
  24. #define MAKELRESULTFROMUINT(i) MAKELRESULT(i,0)
  25. #define ISVALIDHINSTANCE(hinst) ((UINT)hinst>=(UINT)HINSTANCE_ERROR)
  26. #define DATASEG_READONLY "_TEXT"
  27. #define DATASEG_PERINSTANCE
  28. #define DATASEG_SHARED
  29. #define GetWindowInt GetWindowWord
  30. #define SetWindowInt SetWindowWord
  31. #define SetWindowID(hwnd,id) SetWindowWord(hwnd, GWW_ID, id)
  32. #define MAKEPOINTS(l) (*((POINTS FAR*)&(l)))
  33. #define LOADICONEX(hInst, hInst2, a, b, c, d) LoadIconEx(hInst, hInst2, a, b, c, d)
  34. #define SHELLEXECUTE(a, b, c, d, e, f) ShellExecute(a, b, c, d, e, f)
  35. #define ISVALIDLIBRARY(hLib) (hLib >= HINSTANCE_ERROR)
  36. #endif // WIN32
  37. #ifdef WIN32
  38. /*****************************************************************************\
  39. * PWIN32.H - PORTABILITY MAPPING HEADER FILE
  40. *
  41. * This file provides macros to map portable windows code to its 32 bit form.
  42. \*****************************************************************************/
  43. /*-----------------------------------USER------------------------------------*/
  44. /* HELPER MACROS */
  45. #define MAPVALUE(v16, v32) (v32)
  46. #define MAPTYPE(v16, v32) v32
  47. #define MAKEMPOINT(l) (*((MPOINT *)&(l)))
  48. #define MPOINT2POINT(mpt,pt) ((pt).x = (mpt).x, (pt).y = (mpt).y)
  49. #define POINT2MPOINT(pt, mpt) ((mpt).x = (SHORT)(pt).x, (mpt).y = (SHORT)(pt).y)
  50. #define LONG2POINT(l, pt) ((pt).x = (SHORT)LOWORD(l), (pt).y = (SHORT)HIWORD(l))
  51. #define SETWINDOWUINT(hwnd, index, ui) (UINT)SetWindowLong(hwnd, index, (LONG)(ui))
  52. #define GETWINDOWUINT(hwnd, index) (UINT)GetWindowLong(hwnd, index)
  53. #define SETCLASSUINT(hwnd, index, ui) (UINT)SetClassLong(hwnd, index, (LONG)(ui))
  54. #define GETCLASSUINT(hwnd, index) (UINT)GetClassLong(hwnd, index)
  55. #define GETCBCLSEXTRA(hwnd) GETCLASSUINT(hwnd, GCL_CBCLSEXTRA)
  56. #define SETCBCLSEXTRA(hwnd, cb) SETCLASSUINT(hwnd, GCL_CBCLSEXTRA, cb)
  57. #define GETCBWNDEXTRA(hwnd) GETCLASSUINT(hwnd, GCL_CBWNDEXTRA)
  58. #define SETCBWNDEXTRA(hwnd, cb) SETCLASSUINT(hwnd, GCL_CBWNDEXTRA, cb)
  59. #define GETCLASSBRBACKGROUND(hwnd) (HBRUSH)GETCLASSUINT(hwnd, GCL_HBRBACKGROUND)
  60. #define SETCLASSBRBACKGROUND(hwnd, h) (HBRUSH)SETCLASSUINT(hwnd, GCL_HBRBACKGROUND, h)
  61. #define GETCLASSCURSOR(hwnd) (HCURSOR)GETCLASSUINT(hwnd, GCL_HCURSOR)
  62. #define SETCLASSCURSOR(hwnd, h) (HCURSOR)SETCLASSUINT(hwnd, GCL_HCURSOR, h)
  63. #define GETCLASSHMODULE(hwnd) (HMODULE)GETCLASSUINT(hwnd, GCL_HMODULE)
  64. #define SETCLASSHMODULE(hwnd, h) (HMODULE)SETCLASSUINT(hwnd, GCL_HMODULE, h)
  65. #define GETCLASSICON(hwnd) (HICON)GETCLASSUINT((hwnd), GCL_HICON)
  66. #define SETCLASSICON(hwnd, h) (HICON)SETCLASSUINT((hwnd), GCL_HICON, h)
  67. #define GETCLASSSTYLE(hwnd) GETCLASSUINT((hwnd), GCL_STYLE)
  68. #define SETCLASSSTYLE(hwnd, style) SETCLASSUINT((hwnd), GCL_STYLE, style)
  69. #define GETHWNDINSTANCE(hwnd) (HINSTANCE)GETWINDOWUINT((hwnd), GWL_HINSTANCE)
  70. #define SETHWNDINSTANCE(hwnd, h) (HINSTANCE)SETWINDOWUINT((hwnd), GWL_HINSTANCE, h)
  71. #define GETHWNDPARENT(hwnd) (HWND)GETWINDOWUINT((hwnd), GWL_HWNDPARENT)
  72. #define SETHWNDPARENT(hwnd, h) (HWND)SETWINDOWUINT((hwnd), GWL_HWNDPARENT, h)
  73. #define GETWINDOWID(hwnd) GETWINDOWUINT((hwnd), GWL_ID)
  74. #define SETWINDOWID(hwnd, id) SETWINDOWUINT((hwnd), GWL_ID, id)
  75. #else
  76. /*****************************************************************************\
  77. * PWIN16.H - PORTABILITY MAPPING HEADER FILE
  78. *
  79. * This file provides macros to map portable windows code to its 16 bit form.
  80. \*****************************************************************************/
  81. /*-----------------------------------USER------------------------------------*/
  82. /* HELPER MACROS */
  83. #define MAPVALUE(v16, v32) (v16)
  84. #define MAPTYPE(v16, v32) v16
  85. #define MAKEMPOINT(l) (*((MPOINT FAR *)&(l)))
  86. #define MPOINT2POINT(mpt, pt) (pt = *(POINT FAR *)&(mpt))
  87. #define POINT2MPOINT(pt, mpt) (mpt = *(MPOINT FAR *)&(pt))
  88. #define LONG2POINT(l, pt) ((pt).x = (INT)LOWORD(l), (pt).y = (INT)HIWORD(l))
  89. #define GETWINDOWUINT(hwnd, index) (UINT)GetWindowWord(hwnd, index)
  90. #define SETWINDOWUINT(hwnd, index, ui) (UINT)SetWindowWord(hwnd, index, (WORD)(ui))
  91. #define SETCLASSUINT(hwnd, index, ui) (UINT)SetClassWord(hwnd, index, (WORD)(ui))
  92. #define GETCLASSUINT(hwnd, index) (UINT)GetClassWord(hwnd, index)
  93. #define GETCBCLSEXTRA(hwnd) GETCLASSUINT(hwnd, GCW_CBCLSEXTRA)
  94. #define SETCBCLSEXTRA(hwnd, cb) SETCLASSUINT(hwnd, GCW_CBCLSEXTRA, cb)
  95. #define GETCBWNDEXTRA(hwnd) GETCLASSUINT(hwnd, GCW_CBWNDEXTRA)
  96. #define SETCBWNDEXTRA(hwnd, cb) SETCLASSUINT(hwnd, GCW_CBWNDEXTRA, cb)
  97. #define GETCLASSBRBACKGROUND(hwnd) (HBRUSH)GETCLASSUINT(hwnd, GCW_HBRBACKGROUND)
  98. #define SETCLASSBRBACKGROUND(hwnd, h) (HBRUSH)SETCLASSUINT(hwnd, GCW_HBRBACKGROUND, h)
  99. #define GETCLASSCURSOR(hwnd) (HCURSOR)GETCLASSUINT(hwnd, GCW_HCURSOR)
  100. #define SETCLASSCURSOR(hwnd, h) (HCURSOR)SETCLASSUINT(hwnd, GCW_HCURSOR, h)
  101. #define GETCLASSHMODULE(hwnd) (HMODULE)GETCLASSUINT(hwnd, GCW_HMODULE)
  102. #define SETCLASSHMODULE(hwnd, h) (HMODULE)SETCLASSUINT(hwnd, GCW_HMODULE, h)
  103. #define GETCLASSICON(hwnd) (HICON)GETCLASSUINT((hwnd), GCW_HICON)
  104. #define SETCLASSICON(hwnd, h) (HICON)SETCLASSUINT((hwnd), GCW_HICON, h)
  105. #define GETCLASSSTYLE(hwnd) GETCLASSUINT((hwnd), GCW_STYLE)
  106. #define SETCLASSSTYLE(hwnd, style) SETCLASSUINT((hwnd), GCW_STYLE, style)
  107. #define GETHWNDINSTANCE(hwnd) (HMODULE)GETWINDOWUINT((hwnd), GWW_HINSTANCE)
  108. #define SETHWNDINSTANCE(hwnd, h) (HMODULE)SETWINDOWUINT((hwnd), GWW_HINSTANCE, h)
  109. #define GETHWNDPARENT(hwnd) (HWND)GETWINDOWUINT((hwnd), GWW_HWNDPARENT)
  110. #define SETHWNDPARENT(hwnd, h) (HWND)SETWINDOWUINT((hwnd), GWW_HWNDPARENT, h)
  111. #define GETWINDOWID(hwnd) GETWINDOWUINT((hwnd), GWW_ID)
  112. #define SETWINDOWID(hwnd, id) SETWINDOWUINT((hwnd), GWW_ID, id)
  113. #endif // WIN32