Source code of Windows XP (NT5)
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.

225 lines
4.6 KiB

  1. //
  2. // SaveScreenbits Interceptor
  3. //
  4. #ifndef _H_SSI
  5. #define _H_SSI
  6. //
  7. // CONSTANTS
  8. //
  9. #define ST_FAILED_TO_SAVE 0
  10. #define ST_SAVED_BY_DISPLAY_DRIVER 1
  11. #define ST_SAVED_BY_BMP_SIMULATION 2
  12. //
  13. // Maximum depth of save bitmaps we can handle.
  14. //
  15. #define SSB_MAX_SAVE_LEVEL 6
  16. //
  17. // Define the values that can be passed in the flags field of
  18. // SaveScreenBits.
  19. //
  20. // These should be defined in a Windows header - but they are not. In any
  21. // case they are referred to in generic code, so need to be defined here.
  22. //
  23. //
  24. // There are the display driver's SaveBits routine command values, and we
  25. // use them also in our protocol.
  26. //
  27. #define ONBOARD_SAVE 0x0000
  28. #define ONBOARD_RESTORE 0x0001
  29. #define ONBOARD_DISCARD 0x0002
  30. //
  31. //
  32. // MACROS
  33. //
  34. //
  35. //
  36. // Macro that makes it easier (more readable) to access the current
  37. // local SSB state.
  38. //
  39. #define CURRENT_LOCAL_SSB_STATE \
  40. g_ssiLocalSSBState.saveState[g_ssiLocalSSBState.saveLevel]
  41. #define ROUNDUP(val, granularity) \
  42. ((val+(granularity-1)) / granularity * granularity)
  43. //
  44. // Specific values for OSI escape codes
  45. //
  46. #define SSI_ESC(code) (OSI_SSI_ESC_FIRST + code)
  47. #define SSI_ESC_RESET_LEVEL SSI_ESC(0)
  48. #define SSI_ESC_NEW_CAPABILITIES SSI_ESC(1)
  49. //
  50. //
  51. // TYPES
  52. //
  53. //
  54. //
  55. // Local SaveScreenBitmap state structures.
  56. //
  57. typedef struct tagSAVE_STATE
  58. {
  59. int saveType; // ST_xxxx
  60. HBITMAP hbmpSave; // SPB bitmap from USER
  61. BOOL fSavedRemotely;
  62. DWORD remoteSavedPosition;// valid if (fSavedRemotely == TRUE)
  63. DWORD remotePelsRequired; // valid if (fSavedRemotely == TRUE)
  64. RECT rect;
  65. } SAVE_STATE, FAR * LPSAVE_STATE;
  66. typedef struct tagLOCAL_SSB_STATE
  67. {
  68. WORD xGranularity;
  69. WORD yGranularity;
  70. int saveLevel;
  71. SAVE_STATE saveState[SSB_MAX_SAVE_LEVEL];
  72. } LOCAL_SSB_STATE, FAR* LPLOCAL_SSB_STATE;
  73. //
  74. // Remote SaveScreenBitmap structures.
  75. //
  76. typedef struct tagREMOTE_SSB_STATE
  77. {
  78. DWORD pelsSaved;
  79. }
  80. REMOTE_SSB_STATE, FAR* LPREMOTE_SSB_STATE;
  81. //
  82. // SSI_RESET_LEVEL
  83. //
  84. // Resets saved level
  85. //
  86. typedef struct tagSSI_RESET_LEVEL
  87. {
  88. OSI_ESCAPE_HEADER header;
  89. }
  90. SSI_RESET_LEVEL;
  91. typedef SSI_RESET_LEVEL FAR * LPSSI_RESET_LEVEL;
  92. //
  93. // Structure: SSI_NEW_CAPABILITIES
  94. //
  95. // Description:
  96. //
  97. // Structure to pass new capabilities down to the display driver from the
  98. // Share Core.
  99. //
  100. //
  101. typedef struct tagSSI_NEW_CAPABILITIES
  102. {
  103. OSI_ESCAPE_HEADER header; // Common header
  104. DWORD sendSaveBitmapSize; // Size of the save screen bitmap
  105. WORD xGranularity; // X granularity for SSB
  106. WORD yGranularity; // Y granularity for SSB
  107. }
  108. SSI_NEW_CAPABILITIES;
  109. typedef SSI_NEW_CAPABILITIES FAR * LPSSI_NEW_CAPABILITIES;
  110. //
  111. // FUNCTION: SSI_SaveScreenBitmap
  112. //
  113. //
  114. // DESCRIPTION:
  115. //
  116. // The main SaveScreenBitmap function, called by the SaveScreenBitmap
  117. // Interceptor (SSI).
  118. //
  119. // Saves, restores and discards the specified bits using the Display Driver
  120. // and/or our own SaveScreenBitmap simulation.
  121. //
  122. // Sends the SaveScreenBitmap function as an order if possible.
  123. //
  124. //
  125. // PARAMETERS:
  126. //
  127. // lpRect - pointer to the rectangle coords (EXCLUSIVE screen coords).
  128. //
  129. // wCommand - SaveScreenBitmap command (SSB_SAVEBITS, SSB_RESTOREBITS,
  130. // SSB_DISCARDBITS).
  131. //
  132. //
  133. // RETURNS:
  134. //
  135. // TRUE if operation succeeded. FALSE if operation failed.
  136. //
  137. //
  138. BOOL SSI_SaveScreenBitmap(LPRECT lpRect, UINT wCommand);
  139. #ifdef DLL_DISP
  140. //
  141. // FUNCTION: SSI_DDProcessRequest
  142. //
  143. // DESCRIPTION:
  144. //
  145. // Called by the display driver to process an SSI specific request
  146. //
  147. // PARAMETERS: pso - pointer to surface object
  148. // cjIn - (IN) size of request block
  149. // pvIn - (IN) pointer to request block
  150. // cjOut - (IN) size of response block
  151. // pvOut - (OUT) pointer to response block
  152. //
  153. // RETURNS: None
  154. //
  155. //
  156. BOOL SSI_DDProcessRequest(UINT escapeFn, LPOSI_ESCAPE_HEADER pRequest, DWORD cbResult);
  157. BOOL SSI_DDInit(void);
  158. void SSI_DDTerm(void);
  159. #ifdef IS_16
  160. void SSI_DDViewing(BOOL);
  161. void SSISaveBits(HBITMAP, LPRECT);
  162. BOOL SSIRestoreBits(HBITMAP);
  163. BOOL SSIDiscardBits(HBITMAP);
  164. BOOL SSIFindSlotAndDiscardAbove(HBITMAP);
  165. #else
  166. BOOL SSISaveBits(LPRECT lpRect);
  167. BOOL SSIRestoreBits(LPRECT lpRect);
  168. BOOL SSIDiscardBits(LPRECT lpRect);
  169. BOOL SSIFindSlotAndDiscardAbove(LPRECT lpRect);
  170. #endif // IS_16
  171. #endif // DLL_DISP
  172. void SSIResetSaveScreenBitmap(void);
  173. BOOL SSISendSaveBitmapOrder( LPRECT lpRect, UINT wCommand );
  174. void SSISetNewCapabilities(LPSSI_NEW_CAPABILITIES pssiNew);
  175. DWORD SSIRemotePelsRequired(LPRECT lpRect);
  176. #endif // _H_SSI