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.

292 lines
14 KiB

  1. /*****************************************************************************\
  2. * PWIN16.H - PORTABILITY MAPPING HEADER FILE
  3. *
  4. * This file provides macros to map portable windows code to its 16 bit form.
  5. *
  6. * Copyright (c) 1992-1994, Microsoft Corp. All rights reserved.
  7. *
  8. \*****************************************************************************/
  9. /*-----------------------------------USER------------------------------------*/
  10. DWORD FAR PASCAL MGetLastError(VOID);
  11. DWORD FAR PASCAL MSendMsgEM_GETSEL(HWND hDlg, INT FAR *piStart, INT FAR *piEnd);
  12. /* HELPER MACROS */
  13. #define MAPVALUE(v16, v32) (v16)
  14. #define MAPTYPE(v16, v32) v16
  15. #define MAKEMPOINT(l) (*((MPOINT FAR *)&(l)))
  16. #define MPOINT2POINT(mpt, pt) (pt = *(POINT FAR *)&(mpt))
  17. #define POINT2MPOINT(pt, mpt) (mpt = *(MPOINT FAR *)&(pt))
  18. #define LONG2POINT(l, pt) ((pt).x = (INT)LOWORD(l), (pt).y = (INT)HIWORD(l))
  19. #define GETWINDOWUINT(hwnd, index) (UINT)GetWindowWord(hwnd, index)
  20. #define SETWINDOWUINT(hwnd, index, ui) (UINT)SetWindowWord(hwnd, index, (WORD)(ui))
  21. #define SETCLASSUINT(hwnd, index, ui) (UINT)SetClassWord(hwnd, index, (WORD)(ui))
  22. #define GETCLASSUINT(hwnd, index) (UINT)GetClassWord(hwnd, index)
  23. #define GETCBCLSEXTRA(hwnd) GETCLASSUINT(hwnd, GCW_CBCLSEXTRA)
  24. #define SETCBCLSEXTRA(hwnd, cb) SETCLASSUINT(hwnd, GCW_CBCLSEXTRA, cb)
  25. #define GETCBWNDEXTRA(hwnd) GETCLASSUINT(hwnd, GCW_CBWNDEXTRA)
  26. #define SETCBWNDEXTRA(hwnd, cb) SETCLASSUINT(hwnd, GCW_CBWNDEXTRA, cb)
  27. #define GETCLASSBRBACKGROUND(hwnd) (HBRUSH)GETCLASSUINT(hwnd, GCW_HBRBACKGROUND)
  28. #define SETCLASSBRBACKGROUND(hwnd, h) (HBRUSH)SETCLASSUINT(hwnd, GCW_HBRBACKGROUND, h)
  29. #define GETCLASSCURSOR(hwnd) (HCURSOR)GETCLASSUINT(hwnd, GCW_HCURSOR)
  30. #define SETCLASSCURSOR(hwnd, h) (HCURSOR)SETCLASSUINT(hwnd, GCW_HCURSOR, h)
  31. #define GETCLASSHMODULE(hwnd) (HMODULE)GETCLASSUINT(hwnd, GCW_HMODULE)
  32. #define SETCLASSHMODULE(hwnd, h) (HMODULE)SETCLASSUINT(hwnd, GCW_HMODULE, h)
  33. #define GETCLASSICON(hwnd) (HICON)GETCLASSUINT((hwnd), GCW_HICON)
  34. #define SETCLASSICON(hwnd, h) (HICON)SETCLASSUINT((hwnd), GCW_HICON, h)
  35. #define GETCLASSSTYLE(hwnd) GETCLASSUINT((hwnd), GCW_STYLE)
  36. #define SETCLASSSTYLE(hwnd, style) SETCLASSUINT((hwnd), GCW_STYLE, style)
  37. #define GETHWNDINSTANCE(hwnd) (HMODULE)GETWINDOWUINT((hwnd), GWW_HINSTANCE)
  38. #define SETHWNDINSTANCE(hwnd, h) (HMODULE)SETWINDOWUINT((hwnd), GWW_HINSTANCE, h)
  39. #define GETHWNDPARENT(hwnd) (HWND)GETWINDOWUINT((hwnd), GWW_HWNDPARENT)
  40. #define SETHWNDPARENT(hwnd, h) (HWND)SETWINDOWUINT((hwnd), GWW_HWNDPARENT, h)
  41. #define GETWINDOWID(hwnd) GETWINDOWUINT((hwnd), GWW_ID)
  42. #define SETWINDOWID(hwnd, id) SETWINDOWUINT((hwnd), GWW_ID, id)
  43. /* USER API */
  44. #define MDlgDirSelect(hDlg, lpstr, nLength, nIDListBox) \
  45. DlgDirSelect(hDlg, lpstr, nIDListBox)
  46. #define MDlgDirSelectCOMBOBOX(hDlg, lpstr, nLength, nIDComboBox) \
  47. DlgDirSelectComboBox(hDlg, lpstr, nIDComboBox)
  48. #define MMain(hInst, hPrevInst, lpCmdLine, nCmdShow) \
  49. INT PASCAL WinMain(HANDLE hInst, HANDLE hPrevInst, LPSTR lpCmdLine, \
  50. INT nCmdShow) { \
  51. INT _argc; \
  52. CHAR **_argv;
  53. /* USER MESSAGES: */
  54. #define GET_WPARAM(wp, lp) (wp)
  55. #define GET_LPARAM(wp, lp) (lp)
  56. #define WM_CTLCOLORMSGBOX 0x0132
  57. #define WM_CTLCOLOREDIT 0x0133
  58. #define WM_CTLCOLORLISTBOX 0x0134
  59. #define WM_CTLCOLORBTN 0x0135
  60. #define WM_CTLCOLORDLG 0x0136
  61. #define WM_CTLCOLORSCROLLBAR 0x0137
  62. #define WM_CTLCOLORSTATIC 0x0138
  63. #define GET_WM_ACTIVATE_STATE(wp, lp) (wp)
  64. #define GET_WM_ACTIVATE_FMINIMIZED(wp, lp) (BOOL)HIWORD(lp)
  65. #define GET_WM_ACTIVATE_HWND(wp, lp) (HWND)LOWORD(lp)
  66. #define GET_WM_ACTIVATE_MPS(s, fmin, hwnd) \
  67. (WPARAM)(s), MAKELONG(hwnd, fmin)
  68. #define GET_WM_CHARTOITEM_CHAR(wp, lp) (CHAR)(wp)
  69. #define GET_WM_CHARTOITEM_POS(wp, lp) HIWORD(lp)
  70. #define GET_WM_CHARTOITEM_HWND(wp, lp) (HWND)LOWORD(lp)
  71. #define GET_WM_CHARTOITEM_MPS(ch, pos, hwnd) \
  72. (WPARAM)(ch), MAKELONG(hwnd, pos)
  73. #define GET_WM_COMMAND_ID(wp, lp) (wp)
  74. #define GET_WM_COMMAND_HWND(wp, lp) (HWND)LOWORD(lp)
  75. #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(lp)
  76. #define GET_WM_COMMAND_MPS(id, hwnd, cmd) \
  77. (WPARAM)(id), MAKELONG(hwnd, cmd)
  78. #define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
  79. #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)LOWORD(lp)
  80. #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) HIWORD(lp)
  81. #define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) \
  82. (WPARAM)(hdc), MAKELONG(hwnd, type)
  83. #define GET_WM_MENUSELECT_CMD(wp, lp) (wp)
  84. #define GET_WM_MENUSELECT_FLAGS(wp, lp) LOWORD(lp)
  85. #define GET_WM_MENUSELECT_HMENU(wp, lp) (HMENU)HIWORD(lp)
  86. #define GET_WM_MENUSELECT_MPS(cmd, f, hmenu) \
  87. (WPARAM)(cmd), MAKELONG(f, hmenu)
  88. // Note: the following are for interpreting MDIclient to MDI child messages.
  89. #define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp) (BOOL)(wp)
  90. #define GET_WM_MDIACTIVATE_HWNDDEACT(wp, lp) (HWND)HIWORD(lp)
  91. #define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp) (HWND)LOWORD(lp)
  92. // Note: the following is for sending to the MDI client window.
  93. #define GET_WM_MDIACTIVATE_MPS(f, hwndD, hwndA)\
  94. (WPARAM)(hwndA), 0
  95. #define GET_WM_MDISETMENU_MPS(hmenuF, hmenuW) 0, MAKELONG(hmenuF, hmenuW)
  96. #define GET_WM_MENUCHAR_CHAR(wp, lp) (CHAR)(wp)
  97. #define GET_WM_MENUCHAR_HMENU(wp, lp) (HMENU)LOWORD(lp)
  98. #define GET_WM_MENUCHAR_FMENU(wp, lp) (BOOL)HIWORD(lp)
  99. #define GET_WM_MENUCHAR_MPS(ch, hmenu, f) \
  100. (WPARAM)(ch), MAKELONG(hmenu, f)
  101. #define GET_WM_PARENTNOTIFY_MSG(wp, lp) (wp)
  102. #define GET_WM_PARENTNOTIFY_ID(wp, lp) HIWORD(lp)
  103. #define GET_WM_PARENTNOTIFY_HWNDCHILD(wp, lp) (HWND)LOWORD(lp)
  104. #define GET_WM_PARENTNOTIFY_X(wp, lp) (INT)LOWORD(lp)
  105. #define GET_WM_PARENTNOTIFY_Y(wp, lp) (INT)HIWORD(lp)
  106. #define GET_WM_PARENTNOTIFY_MPS(msg, id, hwnd) \
  107. (WPARAM)(msg), MAKELONG(hwnd, id)
  108. #define GET_WM_PARENTNOTIFY2_MPS(msg, x, y) \
  109. (WPARAM)(msg), MAKELONG(x, y)
  110. #define GET_WM_VKEYTOITEM_CODE(wp, lp) (wp)
  111. #define GET_WM_VKEYTOITEM_ITEM(wp, lp) (INT)HIWORD(lp)
  112. #define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)LOWORD(lp)
  113. #define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) \
  114. (WPARAM)(code), MAKELONG(hwnd, item)
  115. #define GET_EM_SETSEL_START(wp, lp) LOWORD(lp)
  116. #define GET_EM_SETSEL_END(wp, lp) HIWORD(lp)
  117. #define GET_EM_SETSEL_MPS(iStart, iEnd) \
  118. 0, MAKELONG(iStart, iEnd)
  119. #define GET_EM_LINESCROLL_MPS(vert, horz) \
  120. 0, MAKELONG(vert, horz)
  121. #define GET_WM_HSCROLL_CODE(wp, lp) (wp)
  122. #define GET_WM_HSCROLL_POS(wp, lp) LOWORD(lp)
  123. #define GET_WM_HSCROLL_HWND(wp, lp) (HWND)HIWORD(lp)
  124. #define GET_WM_HSCROLL_MPS(code, pos, hwnd) \
  125. (WPARAM)(code), MAKELONG(pos, hwnd)
  126. #define GET_WM_VSCROLL_CODE(wp, lp) (wp)
  127. #define GET_WM_VSCROLL_POS(wp, lp) LOWORD(lp)
  128. #define GET_WM_VSCROLL_HWND(wp, lp) (HWND)HIWORD(lp)
  129. #define GET_WM_VSCROLL_MPS(code, pos, hwnd) \
  130. (WPARAM)(code), MAKELONG(pos, hwnd)
  131. #define GET_WM_CHANGECBCHAIN_HWNDNEXT(wp, lp) (HWND)LOWORD(lp)
  132. #define DDEFREE(msg, lp)
  133. #define GET_WM_DDE_ACK_STATUS(wp, lp) LOWORD(lp)
  134. #define GET_WM_DDE_ACK_ITEM(wp, lp) (ATOM)HIWORD(lp)
  135. #define MPostWM_DDE_ACK(hTo, hFrom, wStatus, aItem) \
  136. PostMessage(hTo, WM_DDE_ACK, (WPARAM)hFrom, MAKELONG(wStatus, aItem))
  137. #define GET_WM_DDE_ADVISE_HOPTIONS(wp, lp) (HANDLE)LOWORD(lp)
  138. #define GET_WM_DDE_ADVISE_ITEM(wp, lp) (ATOM)HIWORD(lp)
  139. #define MPostWM_DDE_ADVISE(hTo, hFrom, hOptions, aItem) \
  140. PostMessage(hTo, WM_DDE_ADVISE, (WPARAM)hFrom, MAKELONG(hOptions, aItem))
  141. #define GET_WM_DDE_DATA_HDATA(wp, lp) (HANDLE)LOWORD(lp)
  142. #define GET_WM_DDE_DATA_ITEM(wp, lp) (ATOM)HIWORD(lp)
  143. #define MPostWM_DDE_DATA(hTo, hFrom, hData, aItem) \
  144. PostMessage(hTo, WM_DDE_DATA, (WPARAM)hFrom, MAKELONG(hData, aItem))
  145. #define GET_WM_DDE_EXECUTE_HDATA(wp, lp) (HANDLE)HIWORD(lp)
  146. #define MPostWM_DDE_EXECUTE(hTo, hFrom, hDataExec) \
  147. PostMessage(hTo, WM_DDE_EXECUTE, (WPARAM)hFrom, MAKELONG(0, hDataExec))
  148. #define GET_WM_DDE_POKE_HDATA(wp, lp) (HANDLE)LOWORD(lp)
  149. #define GET_WM_DDE_POKE_ITEM(wp, lp) (ATOM)HIWORD(lp)
  150. #define MPostWM_DDE_POKE(hTo, hFrom, hData, aItem) \
  151. PostMessage(hTo, WM_DDE_POKE, (WPARAM)hFrom, MAKELONG(hData, aItem))
  152. #define GET_WM_DDE_EXECACK_STATUS(wp, lp) (WORD)LOWORD(lp)
  153. #define GET_WM_DDE_EXECACK_HDATA(wp, lp) (HANDLE)HIWORD(lp)
  154. #define MPostWM_DDE_EXECACK(hTo, hFrom, hCommands, wStatus) \
  155. PostMessage(hTo, WM_DDE_ACK, (WPARAM)hFrom, MAKELONG(wStatus, hCommands))
  156. #define GET_WM_DDE_REQUEST_FORMAT(wp, lp) (ATOM)LOWORD(lp)
  157. #define GET_WM_DDE_REQUEST_ITEM(wp, lp) (ATOM)HIWORD(lp)
  158. #define MPostWM_DDE_REQUEST(hTo, hFrom, fmt, aItem) \
  159. PostMessage(hTo, WM_DDE_REQUEST, (WPARAM)hFrom, MAKELONG(fmt, aItem))
  160. #define GET_WM_DDE_UNADVISE_FORMAT(wp, lp) (ATOM)LOWORD(lp)
  161. #define GET_WM_DDE_UNADVISE_ITEM(wp, lp) (ATOM)HIWORD(lp)
  162. #define MPostWM_DDE_UNADVISE(hTo, hFrom, fmt, aItem) \
  163. PostMessage(hTo, WM_DDE_UNADVISE, (WPARAM)hFrom, MAKELONG(fmt, aItem))
  164. #define MPostWM_DDE_TERMINATE(hTo, hFrom) \
  165. PostMessage(hTo, WM_DDE_TERMINATE, (WPARAM)hFrom, 0)
  166. /*-----------------------------------GDI-------------------------------------*/
  167. BOOL FAR PASCAL MGetAspectRatioFilter(HDC hdc, INT FAR * pcx, INT FAR * pcy);
  168. BOOL FAR PASCAL MGetBitmapDimension(HANDLE hBitmap, INT FAR * pcx, INT FAR * pcy);
  169. BOOL FAR PASCAL MGetBrushOrg(HDC hdc, INT FAR * px, INT FAR * py);
  170. BOOL FAR PASCAL MGetCurrentPosition(HDC hdc, INT FAR * px, INT FAR * py);
  171. BOOL FAR PASCAL MGetTextExtent(HDC hdc, LPSTR lpstr, INT cnt, INT FAR * pcx, INT FAR * pcy);
  172. BOOL FAR PASCAL MGetViewportExt(HDC hdc, INT FAR * pcx, INT FAR * pcy);
  173. BOOL FAR PASCAL MGetViewportOrg(HDC hdc, INT FAR * px, INT FAR * py);
  174. BOOL FAR PASCAL MGetWindowExt(HDC hdc, INT FAR * pcx, INT FAR * pcy);
  175. BOOL FAR PASCAL MGetWindowOrg(HDC hdc, INT FAR * px, INT FAR * py);
  176. #define MCreateDiscardableBitmap CreateDiscardableBitmap
  177. #define MMoveTo (VOID)MoveTo
  178. #define MOffsetViewportOrg (VOID)OffsetViewportOrg
  179. #define MOffsetWindowOrg (VOID)OffsetWindowOrg
  180. #define MScaleViewportExt (VOID)ScaleViewportExt
  181. #define MScaleWindowExt (VOID)ScaleWindowExt
  182. #define MSetBitmapDimension (VOID)SetBitmapDimension
  183. #define MSetBrushOrg (VOID)SetBrushOrg
  184. #define MSetViewportExt (VOID)SetViewportExt
  185. #define MSetViewportOrg (VOID)SetViewportOrg
  186. #define MSetWindowExt (VOID)SetWindowExt
  187. #define MSetWindowOrg (VOID)SetWindowOrg
  188. #define MUnrealizeObject UnrealizeObject
  189. /*-------------------------------------DEV-----------------------------------*/
  190. DWORD FAR PASCAL MDeviceCapabilities(LPSTR lpDriverName,
  191. LPSTR lpDeviceName, LPSTR lpPort, WORD2DWORD nIndex, LPSTR lpOutput,
  192. LPDEVMODE lpDevMode);
  193. BOOL FAR PASCAL MDeviceMode(HWND hWnd, LPSTR lpDriverName,
  194. LPSTR lpDeviceName, LPSTR lpOutput);
  195. WORD2DWORD FAR PASCAL MExtDeviceMode(HWND hWnd,LPSTR lpDriverName,
  196. LPDEVMODE lpDevModeOutput, LPSTR lpDeviceName, LPSTR lpPort,
  197. LPDEVMODE lpDevModeInput, LPSTR lpProfile, WORD2DWORD flMode);
  198. /*-----------------------------------KERNEL----------------------------------*/
  199. HANDLE FAR PASCAL MLoadLibrary(LPSTR lpszFilename);
  200. BOOL FAR PASCAL MDeleteFile(LPSTR lpPathName);
  201. #define DLLMEM_MOVEABLE LMEM_MOVEABLE
  202. #define DLLMEM_ZEROINIT LMEM_ZEROINIT
  203. #define GETMAJORVERSION(x) LOBYTE(x)
  204. #define GETMINORVERSION(x) HIBYTE(x)
  205. #define MCATCHBUF CATCHBUF
  206. #define LPMCATCHBUF LPCATCHBUF
  207. /* FUNCTION MAPPINGS */
  208. #define MLocalInit LocalInit
  209. #define MLockData(dummy) LockData(dummy)
  210. #define MUnlockData(dummy) UnlockData(dummy)
  211. #define MDllSharedAlloc LocalAlloc
  212. #define MDllSharedFlags LocalFlags
  213. #define MDllSharedFree LocalFree
  214. #define MDllSharedHandle LocalHandle
  215. #define MDllSharedLock LocalLock
  216. #define MDllSharedRealloc LocalReAlloc
  217. #define MDllSharedSize LocalSize
  218. #define MDllSharedUnlock LocalUnlock
  219. #define MFreeDOSEnvironment(p) TRUE
  220. #define MGetCurrentTask GetCurrentTask
  221. #define MGetDOSEnvironment GetDOSEnvironment
  222. #define MGetDriveType GetDriveType
  223. #define MGetModuleUsage GetModuleUsage
  224. #define MGetTempDrive GetTempDrive
  225. #define MGetTempFileName GetTempFileName
  226. #define MGetWinFlags GetWinFlags
  227. #define MOpenComm (HFILE)OpenComm
  228. #define MSetCommState(fh, lpDCB) SetCommState(lpDCB)
  229. #define MReadComm ReadComm
  230. #define MWriteComm WriteComm
  231. #define MCloseComm CloseComm
  232. #define MOpenFile (HFILE)OpenFile
  233. #define MThrow Throw
  234. #define MCatch Catch
  235. #define M_lclose _lclose
  236. #define M_lcreat (HFILE)_lcreat
  237. #define M_llseek _llseek
  238. #define M_lopen (HFILE)_lopen
  239. #define M_lread _lread
  240. #define M_lwrite _lwrite
  241. #define MGetMetaFileBits GetMetaFileBits
  242. #define MSetMetaFileBits SetMetaFileBits