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.

199 lines
9.6 KiB

  1. /**INC+**********************************************************************/
  2. /* Header: sclip.h */
  3. /* */
  4. /* Purpose: Clipboard Monitor internal function prototypes. */
  5. /* */
  6. /* Copyright(C) Microsoft Corporation 1998 - 2001 */
  7. /* */
  8. /**INC-**********************************************************************/
  9. #ifndef _H_ACBMINT
  10. #define _H_ACBMINT
  11. #ifdef DC_DEBUG
  12. #define CLIP_TRANSITION_RECORDING
  13. #endif // DC_DEBUG
  14. #ifdef CLIP_TRANSITION_RECORDING
  15. #define DBG_RECORD_SIZE 128
  16. extern UINT g_rguiDbgLastClipState[DBG_RECORD_SIZE];
  17. extern UINT g_rguiDbgLastClipEvent[DBG_RECORD_SIZE];
  18. extern LONG g_uiDbgPosition;
  19. #endif // CLIP_TRANSITION_RECORDING
  20. /****************************************************************************/
  21. /* Client global data macros. */
  22. /****************************************************************************/
  23. #ifndef DC_DEFINE_GLOBAL_DATA
  24. #define DC_GL_EXT extern
  25. #else
  26. #define DC_GL_EXT
  27. #endif
  28. /****************************************************************************/
  29. /* Clip structures */
  30. /****************************************************************************/
  31. /****************************************************************************/
  32. /* Format mapping structure */
  33. /****************************************************************************/
  34. typedef struct tagCB_FORMAT_MAP
  35. {
  36. DCUINT clientID;
  37. DCUINT serverID;
  38. } CB_FORMAT_MAP, FAR * PCB_FORMAT_MAP;
  39. /****************************************************************************/
  40. /* Maximum number of formats we support */
  41. /****************************************************************************/
  42. #define CB_MAX_FORMATS 100
  43. /****************************************************************************/
  44. /* CB Monitor window class */
  45. /****************************************************************************/
  46. #define CBM_VIEWER_CLASS _T("CBMonitorClass")
  47. /****************************************************************************/
  48. /* Shared event name */
  49. /****************************************************************************/
  50. #define CBM_EVENT_NAME _T("CBMonitorEvent")
  51. /****************************************************************************/
  52. /* Our user event */
  53. /****************************************************************************/
  54. #define WM_USER_DD_KICK (WM_USER + 42)
  55. /****************************************************************************/
  56. /* Number of excluded formats */
  57. /****************************************************************************/
  58. #define CBM_EXCLUDED_FORMAT_COUNT 10
  59. #define CBM_EXCLUDED_FORMAT_COUNT_NO_RD 17
  60. /****************************************************************************/
  61. /* CB Internal functions */
  62. /****************************************************************************/
  63. DCUINT DCINTERNAL CBMRemoteFormatFromLocalID(DCUINT id);
  64. DCUINT DCINTERNAL CBMCheckState(DCUINT event);
  65. DCVOID DCINTERNAL CBMOnDataReceived(PDCUINT8 pBuffer, DCUINT cbBytes);
  66. DCBOOL DCINTERNAL CBMSendToClient(PTS_CLIP_PDU pClipRsp, DCUINT size);
  67. DCBOOL DCINTERNAL CBMDrawClipboard(DCVOID);
  68. DCBOOL DCINTERNAL CBMOnReceivedTempDirectory(PTS_CLIP_PDU pClipPDU) ;
  69. DCVOID DCINTERNAL CBMOnFormatList(PTS_CLIP_PDU pClipPDU);
  70. DCVOID DCINTERNAL CBMOnFormatListResponse(PTS_CLIP_PDU pClipPDU);
  71. DCVOID DCINTERNAL CBMOnFormatDataRequest(PTS_CLIP_PDU pClipPDU);
  72. DCVOID DCINTERNAL CBMOnFormatDataResponse(PTS_CLIP_PDU pClipPDU);
  73. DCVOID DCINTERNAL CBMDisconnect(DCVOID);
  74. DCVOID DCINTERNAL CBMReconnect(DCVOID);
  75. DCVOID DCINTERNAL CBMTerm(DCVOID);
  76. DCBOOL DCINTERNAL CBMIsExcludedFormat(PDCTCHAR formatName);
  77. HANDLE DCINTERNAL CBMGetMFData(HANDLE hData, PDCUINT32 pDataLen);
  78. HANDLE DCINTERNAL CBMSetMFData(DCUINT32 dataLen, PDCVOID pData);
  79. LRESULT CALLBACK CBMWndProc(HWND hwnd,
  80. UINT message,
  81. WPARAM wParam,
  82. LPARAM lParam);
  83. DWORD WINAPI CBMDataThreadProc( LPVOID pParam );
  84. DWORD WINAPI CBMEventThreadProc( LPVOID pParam );
  85. DCINT DCAPI CBM_Main(HINSTANCE hInstance);
  86. DCINT DCAPI CBMGetData (DCUINT cfFormat) ;
  87. int APIENTRY DllMain(HANDLE hModule,
  88. DWORD reasonForCall,
  89. LPVOID lpReserved);
  90. /****************************************************************************/
  91. /* */
  92. /* CB states */
  93. /* */
  94. /****************************************************************************/
  95. #define CBM_STATE_NOT_INIT 0
  96. #define CBM_STATE_INITIALIZED 1
  97. #define CBM_STATE_CONNECTED 2
  98. #define CBM_STATE_LOCAL_CB_OWNER 3
  99. #define CBM_STATE_SHARED_CB_OWNER 4
  100. #define CBM_STATE_PENDING_FORMAT_LIST_RSP 5
  101. #define CBM_STATE_PENDING_FORMAT_DATA_RSP 6
  102. #define CBM_NUMSTATES 7
  103. /****************************************************************************/
  104. /* */
  105. /* CB events */
  106. /* */
  107. /****************************************************************************/
  108. #define CBM_EVENT_CBM_MAIN 0
  109. #define CBM_EVENT_WM_CLOSE 1
  110. #define CBM_EVENT_WM_CREATE 2
  111. #define CBM_EVENT_WM_DESTROY 3
  112. #define CBM_EVENT_WM_CHANGECBCHAIN 4
  113. #define CBM_EVENT_WM_DRAWCLIPBOARD 5
  114. #define CBM_EVENT_WM_RENDERFORMAT 6
  115. #define CBM_EVENT_CONNECT 7
  116. #define CBM_EVENT_DISCONNECT 8
  117. #define CBM_EVENT_FORMAT_LIST 9
  118. #define CBM_EVENT_FORMAT_LIST_RSP 10
  119. #define CBM_EVENT_FORMAT_DATA_RQ 11
  120. #define CBM_EVENT_FORMAT_DATA_RSP 12
  121. #define CBM_NUMEVENTS 13
  122. /****************************************************************************/
  123. /* Values in the state table */
  124. /****************************************************************************/
  125. #define CBM_TABLE_OK 0
  126. #define CBM_TABLE_WARN 1
  127. #define CBM_TABLE_ERROR 2
  128. /****************************************************************************/
  129. /* Macros */
  130. /****************************************************************************/
  131. /****************************************************************************/
  132. /* CBM_CHECK_STATE - macro version with DC_QUIT */
  133. /****************************************************************************/
  134. #define CBM_CHECK_STATE(event) \
  135. { \
  136. if (CBMCheckState(event) != CBM_TABLE_OK) \
  137. { \
  138. DC_QUIT; \
  139. } \
  140. } \
  141. /****************************************************************************/
  142. /* CBM_SET_STATE - set the CB state */
  143. /****************************************************************************/
  144. #ifndef CLIP_TRANSITION_RECORDING
  145. #define CBM_SET_STATE(newstate, event) \
  146. { \
  147. TRC_NRM((TB, _T("Set state from %s to %s"), \
  148. cbmState[CBM.state], cbmState[newstate])); \
  149. CBM.state = newstate; \
  150. }
  151. #else
  152. #define CBM_SET_STATE(newstate, event) \
  153. { \
  154. LONG lIncIndex; \
  155. \
  156. CBM.state = newstate; \
  157. \
  158. lIncIndex = InterlockedIncrement(&g_uiDbgPosition); \
  159. g_rguiDbgLastClipState[lIncIndex % DBG_RECORD_SIZE] = newstate; \
  160. g_rguiDbgLastClipEvent[lIncIndex % DBG_RECORD_SIZE] = event; \
  161. }
  162. #endif // CLIP_TRANSITION_RECORDING
  163. #endif /* _H_ACBMINT */