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.

129 lines
4.0 KiB

  1. /****************************************************************************
  2. vidthunk.h
  3. Contains definitions for video thunks (16/32 bit) (for avicap32.dll)
  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)(DWORD_PTR)(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. LRESULT ReturnCode = 0; \
  36. DPF2(("Entering function %s", #Function));
  37. #define EndThunk() \
  38. DPF2((" Returned %4X :%4X\n", \
  39. HIWORD(ReturnCode), \
  40. LOWORD(ReturnCode))); \
  41. return ReturnCode;
  42. #define ThunkHWND(h16) ((HWND)lpWOWHandle32((WORD)h16, WOW_TYPE_HWND))
  43. #define ThunkHDC(h16) ((HDC) lpWOWHandle32((WORD)h16, WOW_TYPE_HDC))
  44. #define ThunkHPAL(h16) ((HPALETTE)lpWOWHandle32((WORD)h16, WOW_TYPE_HPALETTE))
  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. vidThunkvideoGetDriverDesc32
  75. };
  76. #ifndef WIN32
  77. typedef struct _VIDTHUNK
  78. {
  79. //
  80. // Thunking stuff
  81. //
  82. DWORD (FAR PASCAL *lpfnCallproc32W)(DWORD, DWORD, DWORD,
  83. DWORD, DWORD,
  84. LPVOID, DWORD, DWORD);
  85. LPVOID lpvThunkEntry;
  86. DWORD dwVideo32Handle;
  87. } VIDTHUNK, *PVIDTHUNK, FAR *LPVIDTHUNK;
  88. #endif // !WIN32
  89. //
  90. // The following functions generate calls to the 32-bit side
  91. //
  92. #ifdef _INC_MSVIDEO
  93. LRESULT FAR PASCAL videoMessage32(HVIDEO hVideo, UINT msg, DWORD dwP1, DWORD dwP2);
  94. LRESULT FAR PASCAL videoGetNumDevs32(void);
  95. LRESULT FAR PASCAL videoClose32(HVIDEO hVideo);
  96. LRESULT FAR PASCAL videoOpen32(LPHVIDEO lphVideo, DWORD dwDeviceID, DWORD dwFlags);
  97. DWORD FAR PASCAL videoGetDriverDesc32(DWORD wDriverIndex,
  98. LPSTR lpszName, short cbName,
  99. LPSTR lpszVer, short cbVer);
  100. #endif // _INC_MSVIDEO