Windows NT 4.0 source code leak
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
4.2 KiB

4 years ago
  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. 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 lpVideoThunkEntry;
  86. DWORD dwVideo32Handle;
  87. LPVOID lpICMThunkEntry;
  88. DWORD dwICM32Handle;
  89. } VIDTHUNK, *PVIDTHUNK, FAR *LPVIDTHUNK;
  90. #endif // !WIN32
  91. //
  92. // The following functions generate calls to the 32-bit side
  93. //
  94. #ifdef _INC_MSVIDEO
  95. DWORD FAR PASCAL videoMessage32(HVIDEO hVideo, UINT msg, DWORD dwP1, DWORD dwP2);
  96. DWORD FAR PASCAL videoGetNumDevs32(void);
  97. DWORD FAR PASCAL videoClose32(HVIDEO hVideo);
  98. DWORD FAR PASCAL videoOpen32(LPHVIDEO lphVideo, DWORD dwDeviceID, DWORD dwFlags);
  99. DWORD FAR PASCAL videoGetDriverDesc32(DWORD wDriverIndex,
  100. LPSTR lpszName, short cbName,
  101. LPSTR lpszVer, short cbVer);
  102. #endif // _INC_MSVIDEO
  103. #ifdef _INC_COMPMAN
  104. BOOL FAR PASCAL ICInfo32(DWORD fccType, DWORD fccHandler, ICINFO FAR * lpicInfo);
  105. LRESULT FAR PASCAL ICSendMessage32(DWORD hic, UINT msg, DWORD dwP1, DWORD dwP2);
  106. DWORD FAR PASCAL ICOpen32(DWORD fccType, DWORD fccHandler, UINT wMode);
  107. LRESULT FAR PASCAL ICClose32(DWORD hic);
  108. #endif // _INC_COMPMAN