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.

135 lines
4.2 KiB

  1. /****************************************************************************
  2. vidthunk.h
  3. Contains definitions for msvideo thunks (16/32 bit)
  4. Copyright (c) Microsoft Corporation 1994. All rights reserved
  5. ****************************************************************************/
  6. //
  7. // NOTE - 32bit handles have 0x8000 'or'ed in - this makes a BIG ASSUMPTION
  8. // about how handles are generated on the 32-bit side. We ASSUME here
  9. // that :
  10. //
  11. // 32bit msvideo.dll always uses OpenDriver to create handles
  12. //
  13. // The OpenDriver returns indices into its table (ie small positive
  14. // numbers).
  15. //
  16. #define Is32bitHandle(h) (((h) & 0x8000) != 0)
  17. #define Make32bitHandle(h) ((h) | 0x8000)
  18. #define Map32bitHandle(h) ((h) & 0x7FFF)
  19. #ifdef WIN32
  20. #include <wownt32.h>
  21. //
  22. // Thunking support
  23. //
  24. #define GET_VDM_POINTER_NAME "WOWGetVDMPointer"
  25. #define GET_HANDLE_MAPPER16 "WOWHandle16"
  26. #define GET_HANDLE_MAPPER32 "WOWHandle32"
  27. #define GET_CALLBACK16 "WOWCallback16"
  28. #define GET_MAPPING_MODULE_NAME TEXT("wow32.dll")
  29. typedef LPVOID (APIENTRY *LPGETVDMPOINTER)( DWORD Address, DWORD dwBytes, BOOL fProtectMode );
  30. #define WOW32ResolveMemory( p ) (LPVOID)(GetVdmPointer( (DWORD)(p), 0, TRUE ))
  31. typedef HANDLE (APIENTRY *LPWOWHANDLE32)(WORD, WOW_HANDLE_TYPE);
  32. typedef WORD (APIENTRY *LPWOWHANDLE16)(HANDLE, WOW_HANDLE_TYPE);
  33. typedef DWORD (APIENTRY *LPWOWCALLBACK16)(DWORD vpfn16, DWORD dwParam);
  34. #define StartThunk(Function) \
  35. DWORD ReturnCode = 0; \
  36. DPF2(("Entering function %s", #Function));
  37. #define EndThunk() \
  38. DPF2(("Returned %4X :%4X", \
  39. HIWORD(ReturnCode), \
  40. LOWORD(ReturnCode))); \
  41. return ReturnCode;
  42. #define ThunkHWND(h16) ((HWND)lpWOWHandle32(WOW_TYPE_HWND, h16))
  43. #define ThunkHDC(h16) ((HDC) lpWOWHandle32(WOW_TYPE_HDC , h16))
  44. #define ThunkHPAL(h16) ((HPALETTE)lpWOWHandle32(WOW_TYPE_HPALETTE, h16))
  45. #endif // WIN32
  46. /*
  47. * Useful structures and mapping
  48. */
  49. typedef struct {
  50. short left, top, right, bottom;
  51. } RECT_SHORT;
  52. #define SHORT_RECT_TO_RECT(OutRect, InRect) \
  53. OutRect.left = (LONG)InRect.left; \
  54. OutRect.top = (LONG)InRect.top; \
  55. OutRect.right = (LONG)InRect.right; \
  56. OutRect.bottom = (LONG)InRect.bottom;
  57. #define RECT_TO_SHORT_RECT(OutRect, InRect) \
  58. OutRect.left = (short)InRect.left; \
  59. OutRect.top = (short)InRect.top; \
  60. OutRect.right = (short)InRect.right; \
  61. OutRect.bottom = (short)InRect.bottom;
  62. //
  63. // Function ids across the thunking layer (used by 32 and 16 bit)
  64. //
  65. enum {
  66. vidThunkvideoMessage32=1,
  67. vidThunkvideoGetNumDevs32,
  68. vidThunkvideoOpen32,
  69. vidThunkvideoClose32,
  70. compThunkICInfo32,
  71. compThunkICSendMessage32,
  72. compThunkICOpen32,
  73. compThunkICClose32
  74. };
  75. #ifndef WIN32
  76. typedef struct _VIDTHUNK
  77. {
  78. //
  79. // Thunking stuff
  80. //
  81. DWORD (FAR PASCAL *lpfnCallproc32W)(DWORD, DWORD, DWORD,
  82. DWORD, DWORD,
  83. LPVOID, DWORD, DWORD);
  84. LPVOID lpVideoThunkEntry;
  85. DWORD dwVideo32Handle;
  86. LPVOID lpICMThunkEntry;
  87. DWORD dwICM32Handle;
  88. } VIDTHUNK, *PVIDTHUNK, FAR *LPVIDTHUNK;
  89. #endif // !WIN32
  90. //
  91. // The following functions generate calls to the 32-bit side
  92. //
  93. #ifdef _INC_MSVIDEO
  94. DWORD FAR PASCAL videoMessage32(HVIDEO hVideo, UINT msg, DWORD dwP1, DWORD dwP2);
  95. DWORD FAR PASCAL videoGetNumDevs32(void);
  96. DWORD FAR PASCAL videoClose32(HVIDEO hVideo);
  97. DWORD FAR PASCAL videoOpen32(LPHVIDEO lphVideo, DWORD dwDeviceID, DWORD dwFlags);
  98. #endif // _INC_MSVIDEO
  99. #ifdef _INC_COMPMAN
  100. BOOL FAR PASCAL ICInfo32(DWORD fccType, DWORD fccHandler, ICINFO FAR * lpicInfo);
  101. LRESULT FAR PASCAL ICSendMessage32(DWORD hic, UINT msg, DWORD dwP1, DWORD dwP2);
  102. DWORD FAR PASCAL ICOpen32(DWORD fccType, DWORD fccHandler, UINT wMode);
  103. LRESULT FAR PASCAL ICClose32(DWORD hic);
  104. #endif // _INC_COMPMAN
  105.