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.

1345 lines
61 KiB

  1. //
  2. // App Sharing Header
  3. //
  4. // <DCS.H> is included BEFORE the other component headers, it has common
  5. // constants and typedefs.
  6. // <AS.H> is included AFTER the other component headers, it has structure
  7. // definitions that depend on the structures in the component headers.
  8. //
  9. #ifndef _H_AS
  10. #define _H_AS
  11. class ASHost;
  12. class ASPerson;
  13. class ASView;
  14. class ASShare;
  15. //
  16. // This is the data we keep for when we HOST application. When not
  17. // hosting, we don't have this data at all. It's a fair amount of variables,
  18. // hence it's worth allocating/freeing. And when we support multiple
  19. // simultaneous conferences, won't we be glad we don't have globals to
  20. // remove?
  21. //
  22. class ASHost
  23. {
  24. public:
  25. STRUCTURE_STAMP
  26. //
  27. // Pointer back to share
  28. //
  29. ASShare * m_pShare;
  30. //
  31. // Bounds rects
  32. //
  33. UINT m_baNumRects;
  34. RECT m_abaRects[BA_NUM_RECTS];
  35. //
  36. // Active Window Coordinator
  37. //
  38. HWND m_awcLastActiveWindow;
  39. UINT m_awcLastActiveMsg;
  40. //
  41. // Control
  42. //
  43. BOOL m_caRetrySendState;
  44. BOOL m_caAutoAcceptRequests:1;
  45. BOOL m_caTempRejectRequests:1;
  46. //
  47. // Cursor Manager
  48. //
  49. BOOL m_cmfUseColorCursorProtocol:1;
  50. BOOL m_cmfCursorHidden:1;
  51. BOOL m_cmfSyncPos:1;
  52. BOOL m_cmfCursorTransformApplied:1;
  53. POINT m_cmLastCursorPos;
  54. CURSORDESCRIPTION m_cmLastCursorShape;
  55. UINT m_cmNumTxCacheEntries; // CAN GO AWAY IN 4.0
  56. PCHCACHE m_cmTxCacheHandle;
  57. //
  58. // Host Tracker
  59. //
  60. GUIEFFECTS m_hetEffects;
  61. //
  62. // Order Accumulator
  63. //
  64. UINT m_oaFlow;
  65. //
  66. // OE2 OUTGOING encoding
  67. //
  68. PARTYORDERDATA m_oe2Tx;
  69. //
  70. // PM OUTGOING cache, current colors
  71. //
  72. BOOL m_pmMustSendPalette:1;
  73. BOOL m_pmBuggedDriver:1;
  74. PALETTEENTRY m_apmCurrentSystemPaletteEntries[PM_NUM_8BPP_PAL_ENTRIES];
  75. TSHR_RGBQUAD m_apmTxPaletteColors[PM_NUM_8BPP_PAL_ENTRIES];
  76. HPALETTE m_pmTxPalette;
  77. UINT m_pmNumTxCacheEntries; // CAN GO AWAY IN 4.0
  78. PCHCACHE m_pmTxCacheHandle;
  79. PCOLORTABLECACHE m_pmNextTxCacheEntry;
  80. COLORTABLECACHE m_apmTxCache[TSHR_PM_CACHE_ENTRIES];
  81. TSHR_RGBQUAD m_apmDDGreyRGB[PM_GREY_COUNT];
  82. //
  83. // Send bitmap cache
  84. //
  85. SBC_ORDER_INFO m_sbcOrderInfo;
  86. SBC_TILE_WORK_INFO m_asbcWorkInfo[SBC_NUM_TILE_SIZES];
  87. BMC_DIB_CACHE m_asbcBmpCaches[NUM_BMP_CACHES];
  88. SBC_SHM_CACHE_INFO m_asbcCacheInfo[NUM_BMP_CACHES];
  89. LPSBC_FASTPATH m_sbcFastPath;
  90. //
  91. // Screen data
  92. //
  93. RECT m_sdgPendingRect;
  94. BOOL m_sdgRectIsPending:1;
  95. UINT m_sdgcLossy;
  96. RECT m_asdgLossyRect[BA_NUM_RECTS];
  97. //
  98. // Save bits
  99. //
  100. DWORD m_ssiSaveBitmapSize; // Can go away in 4.0
  101. //
  102. // Shared window list
  103. //
  104. BOOL m_swlfForceSend:1;
  105. BOOL m_swlfSyncing:1;
  106. BOOL m_swlfRegionalChanges:1;
  107. ATOM m_swlPropAtom;
  108. UINT m_swlCurrentDesktop;
  109. char m_aswlOurDesktopName[SWL_DESKTOPNAME_MAX];
  110. UINT m_swlCurIndex;
  111. SWLWINATTRIBUTES m_aswlFullWinStructs[2*SWL_MAX_WINDOWS];
  112. SWLWINATTRIBUTES m_aswlCompactWinStructs[2*SWL_MAX_WINDOWS];
  113. LPSTR m_aswlWinNames[2];
  114. UINT m_aswlWinNamesSize[2];
  115. UINT m_aswlNumFullWins[2];
  116. UINT m_aswlNumCompactWins[2];
  117. UINT m_aswlNRSize[2];
  118. LPTSHR_UINT16 m_aswlNRInfo[2];
  119. //
  120. // Updates
  121. //
  122. BOOL m_upBackPressure;
  123. BOOL m_upfUseSmallPackets:1;
  124. BOOL m_upfSyncTokenRequired:1;
  125. DWORD m_upLastSDTime;
  126. DWORD m_upLastOrdersTime;
  127. DWORD m_upLastTrialTime;
  128. DWORD m_upDeltaSD;
  129. DWORD m_upSDAccum;
  130. DWORD m_upDeltaOrders;
  131. DWORD m_upOrdersAccum;
  132. UINT m_usrSendingBPP;
  133. HDC m_usrWorkDC;
  134. public:
  135. //
  136. // Local host starting
  137. //
  138. BOOL HET_HostStarting(ASShare *);
  139. BOOL CM_HostStarting(void);
  140. BOOL OE2_HostStarting(void);
  141. BOOL PM_HostStarting(void);
  142. BOOL SBC_HostStarting(void);
  143. BOOL SSI_HostStarting(void);
  144. BOOL SWL_HostStarting(void);
  145. BOOL VIEW_HostStarting(void);
  146. BOOL USR_HostStarting(void);
  147. //
  148. // Local host ended
  149. //
  150. void HET_HostEnded(void);
  151. void CA_HostEnded(void);
  152. void CM_HostEnded(void);
  153. void OE2_HostEnded(void);
  154. void PM_HostEnded(void);
  155. void SBC_HostEnded(void);
  156. void SWL_HostEnded(void);
  157. void USR_HostEnded(void);
  158. //
  159. // Syncing, when already hosting and somebody else joins
  160. //
  161. void HET_SyncCommon(void);
  162. void HET_SyncAlreadyHosting(void);
  163. void CA_SyncAlreadyHosting(void);
  164. void AWC_SyncOutgoing(void);
  165. void BA_SyncOutgoing(void);
  166. void CM_SyncOutgoing(void);
  167. void OA_SyncOutgoing(void);
  168. void OE2_SyncOutgoing(void);
  169. void PM_SyncOutgoing(void);
  170. void SBC_SyncOutgoing(void);
  171. void SSI_SyncOutgoing(void);
  172. void SWL_SyncOutgoing(void);
  173. //
  174. // Periodic
  175. //
  176. void AWC_Periodic(void);
  177. void CA_Periodic(void);
  178. void CM_Periodic(void);
  179. UINT SWL_Periodic(void);
  180. void UP_Periodic(UINT currentTime);
  181. //
  182. // Component routines - public
  183. //
  184. void AWC_ActivateWindow(HWND hwnd);
  185. void BA_AddRect(LPRECT pRect);
  186. void BA_CopyBounds(LPRECT pRects, LPUINT pNumRects, BOOL fReset);
  187. void BA_FetchBounds(void);
  188. UINT BA_QueryAccumulation(void);
  189. void BA_ReturnBounds(void);
  190. UINT CH_CacheData(PCHCACHE pCache, LPBYTE pData,
  191. UINT cbSize, UINT evictionCategory);
  192. void CH_ClearCache(PCHCACHE pCache );
  193. BOOL CH_CreateCache(PCHCACHE * ppCache, UINT cEntries,
  194. UINT cEvictionCategories, UINT cbNotHashed,
  195. PFNCACHEDEL pfnCacheDel);
  196. void CH_DestroyCache(PCHCACHE hCache);
  197. void CH_RemoveCacheEntry(PCHCACHE pCache, UINT iCacheEntry);
  198. BOOL CH_SearchAndCacheData(PCHCACHE pCache, LPBYTE pData,
  199. UINT cbData, UINT evictionCategory, UINT* piEntry);
  200. BOOL CH_SearchCache(PCHCACHE pCache, LPBYTE pData,
  201. UINT cbData, UINT evictionCategory, UINT* piEntry);
  202. void CH_TouchCacheEntry(PCHCACHE pCache, UINT iCacheEntry);
  203. void CM_ApplicationMovedCursor(void);
  204. void CM_Controlled(ASPerson * pasControlledBy);
  205. void CM_MaybeSendCursorMovedPacket(void);
  206. void HET_RepaintAll(void);
  207. void OA_FlowControl(UINT newBufferSize);
  208. LPINT_ORDER OA_GetFirstListOrder(void);
  209. UINT OA_GetTotalOrderListBytes(void);
  210. void OA_LocalHostReset(void);
  211. UINT OA_QueryOrderAccum(void);
  212. LPINT_ORDER OA_RemoveListOrder(LPINT_ORDER pCondemnedOrder);
  213. void OA_ResetOrderList(void);
  214. BOOL OE_RectIntersectsSDA(LPRECT lpRect);
  215. TSHR_UINT16 OE2_EncodeOrder(LPINT_ORDER pIntOrder,
  216. LPVOID pBuffer, TSHR_UINT16 cbBufferSize);
  217. BOOL OE2_UseFont(LPSTR pName, TSHR_UINT16 facelength,
  218. TSHR_UINT16 CodePage, TSHR_UINT16 MaxHeight,
  219. TSHR_UINT16 Height, TSHR_UINT16 Width,
  220. TSHR_UINT16 Weight, TSHR_UINT16 flags);
  221. void PM_AdjustColorsForBuggedDisplayDrivers(LPTSHR_RGBQUAD pColors,
  222. UINT cColors);
  223. BOOL PM_CacheTxColorTable(LPUINT pIndex, LPBOOL pNewEntry,
  224. UINT cColors, LPTSHR_RGBQUAD pColors);
  225. HPALETTE PM_GetLocalPalette(void);
  226. void PM_GetSystemPaletteEntries(LPTSHR_RGBQUAD pColors);
  227. BOOL PM_MaybeSendPalettePacket(void);
  228. void SBC_CacheCleared(void);
  229. void SBC_CacheEntryRemoved(UINT cache, UINT cacheIndex);
  230. UINT SBC_CopyPrivateOrderData(LPBYTE pDst,
  231. LPCOM_ORDER pOrder, UINT cbFree);
  232. void SBC_OrderSentNotification(LPINT_ORDER pOrder);
  233. void SBC_PMCacheEntryRemoved(UINT cacheIndex);
  234. void SBC_ProcessInternalOrder(LPINT_ORDER pOrder);
  235. BOOL SBC_ProcessMemBltOrder(LPINT_ORDER pOrder,
  236. LPINT_ORDER * ppNextOrder);
  237. void SBC_RecreateSendCache(UINT cache, UINT newEntries,
  238. UINT newCellSize);
  239. void SDG_SendScreenDataArea(LPBOOL pBackPressure, UINT * pcPackets);
  240. HWND SWL_GetSharedIDFromLocalID(HWND hwnd);
  241. UINT_PTR SWL_GetWindowProperty(HWND hwnd);
  242. void SWL_InitFullWindowListEntry(HWND hwnd, UINT prop,
  243. LPSTR * ppNames, PSWLWINATTRIBUTES pFullWinEntry);
  244. BOOL SWL_IsOurDesktopActive(void);
  245. void SWL_UpdateCurrentDesktop(void);
  246. void UP_FlowControl(UINT newSize);
  247. BOOL UP_MaybeSendSyncToken(void);
  248. protected:
  249. void CHAvlBalanceTree(PCHCACHE, PCHENTRY);
  250. void CHAvlDelete(PCHCACHE, PCHENTRY, UINT);
  251. PCHENTRY CHAvlFind(PCHCACHE, UINT, UINT);
  252. PCHENTRY CHAvlFindEqual(PCHCACHE, PCHENTRY);
  253. void CHAvlInsert(PCHCACHE, PCHENTRY);
  254. LPBYTE CHAvlNext(PCHENTRY);
  255. LPBYTE CHAvlPrev(PCHENTRY);
  256. void CHAvlRebalance(PCHENTRY *);
  257. void CHAvlRotateLeft(PCHENTRY *);
  258. void CHAvlRotateRight(PCHENTRY *);
  259. void CHAvlSwapLeftmost(PCHCACHE, PCHENTRY, PCHENTRY);
  260. void CHAvlSwapRightmost(PCHCACHE, PCHENTRY, PCHENTRY);
  261. UINT CHCheckSum(LPBYTE pData, UINT cbDataSize);
  262. int CHCompare(UINT key, UINT cbSize, PCHENTRY pEntry);
  263. UINT CHEvictCacheEntry(PCHCACHE pCache, UINT iEntry, UINT evictionCategory);
  264. UINT CHEvictLRUCacheEntry(PCHCACHE pCache, UINT evictionCategory, UINT evictionCount);
  265. BOOL CHFindFreeCacheEntry(PCHCACHE pCache, UINT* piEntry, UINT* pEvictionCount);
  266. void CHInitEntry(PCHENTRY);
  267. void CHRemoveEntry(PCHCACHE pCache, UINT iCacheEntry);
  268. UINT CHTreeSearch(PCHCACHE pCache, UINT checksum, UINT cbDataSize, LPBYTE pData);
  269. void CHUpdateMRUList(PCHCACHE pCache, UINT iEntry, UINT evictionCategory);
  270. BOOL CMGetColorCursorDetails( LPCM_SHAPE pCursor,
  271. LPTSHR_UINT16 pcxWidth, LPTSHR_UINT16 pcyHeight,
  272. LPTSHR_UINT16 pxHotSpot, LPTSHR_UINT16 pyHotSpot,
  273. LPBYTE pANDMask, LPTSHR_UINT16 pcbANDMask,
  274. LPBYTE pXORBitmap, LPTSHR_UINT16 pcbXORBitmap );
  275. BOOL CMGetCursorTagInfo(LPCSTR szTagName);
  276. void CMRemoveCursorTransform(void);
  277. BOOL CMSetCursorTransform(LPBYTE pANDMask, LPBITMAPINFO pXORDIB);
  278. BOOL CMSendBitmapCursor(void);
  279. BOOL CMSendCachedCursor(UINT iCacheEntry);
  280. BOOL CMSendColorBitmapCursor(LPCM_SHAPE pCursor,
  281. UINT iCacheEntry);
  282. BOOL CMSendCursorShape(LPCM_SHAPE lpCursorShape,
  283. UINT cbCursorDataSize);
  284. BOOL CMSendMonoBitmapCursor(LPCM_SHAPE pCursor);
  285. BOOL CMSendSystemCursor(UINT cursorIDC);
  286. void OAFreeAllOrders(LPOA_SHARED_DATA);
  287. void OE2EncodeBounds(LPBYTE * ppNextFreeSpace,
  288. LPTSHR_RECT16 pRect);
  289. void PMGetGrays(void);
  290. BOOL PMSendPalettePacket(LPTSHR_RGBQUAD pColorTable,
  291. UINT numColors);
  292. BOOL PMUpdateSystemPaletteColors(void);
  293. BOOL PMUpdateTxPaletteColors(void);
  294. void SBCAddToFastPath(UINT_PTR majorInfo, UINT minorInfo,
  295. UINT_PTR majorPalette, UINT minorPalette, int srcX,
  296. int srcY, UINT width, UINT height, UINT cache,
  297. UINT cacheIndex, UINT colorCacheIndex);
  298. BOOL SBCCacheBits(LPINT_ORDER pOrder, UINT cbDst,
  299. LPBYTE pDIBits, UINT bitmapWidth,
  300. UINT fixedBitmapWidth, UINT bitmapHeight,
  301. UINT numBytes, UINT * pCache, UINT * pCacheIndex,
  302. LPBOOL pIsNewEntry);
  303. BOOL SBCCacheColorTable(LPINT_ORDER pColorTableOrder,
  304. LPTSHR_RGBQUAD pColorTable, UINT numColors,
  305. UINT * pCacheIndex, LPBOOL pIsNewEntry);
  306. BOOL SBCFindInFastPath(UINT_PTR majorInfo, UINT minorInfo,
  307. UINT_PTR majorPalette, UINT minorPalette, int srcX,
  308. int srcY, UINT width, UINT height, UINT * pCache,
  309. UINT * pCacheIndex, UINT * pColorCacheIndex);
  310. void SBCFreeInternalOrders(void);
  311. BOOL SBCGetTileData(UINT tileId, LPSBC_TILE_DATA * ppTileData,
  312. UINT * pTileType);
  313. void SBCInitCacheStructures(void);
  314. BOOL SBCInitFastPath(void);
  315. BOOL SBCInitInternalOrders(void);
  316. BOOL SBCSelectCache(UINT bitsSize, UINT * pCacheIndex);
  317. BOOL SDGSmallBltToNetwork(LPRECT pRect);
  318. BOOL SDGSplitBltToNetwork(LPRECT pRect, UINT * pcPacket);
  319. void SWLAddHostWindowTitle(HWND, UINT, HWND, LPSTR *);
  320. void SWLAdjustZOrderForTransparency(PSWLWINATTRIBUTES pTrans,
  321. PSWLWINATTRIBUTES pLast, UINT pos, LPSTR pWinNames,
  322. UINT sizeWinNames);
  323. UINT SWLCompactWindowList(UINT, PSWLWINATTRIBUTES, PSWLWINATTRIBUTES);
  324. void SWLInitHostFullWinListEntry(HWND hwnd, UINT prop,
  325. HWND hwndOwner, PSWLWINATTRIBUTES pFullWinEntry);
  326. BOOL SWLSendPacket(PSWLWINATTRIBUTES pWindows,
  327. UINT numWindows, LPSTR pTitles, UINT lenTitles,
  328. UINT NRInfoSize, LPTSHR_UINT16 pNRInfo);
  329. BOOL SWLWindowIsOnTaskBar(HWND hwnd);
  330. BOOL SWLWindowIsTaggable(HWND hwnd);
  331. UINT UPFetchOrdersIntoBuffer(LPBYTE pBuffer,
  332. LPTSHR_UINT16 pcOrders, LPUINT pcbBufferSize);
  333. BOOL UPSendOrders(UINT *);
  334. UINT UPSendUpdates(void);
  335. };
  336. void PMCacheCallback(ASHost* pHost, PCHCACHE pCache, UINT iEntry, LPBYTE pData);
  337. void SBCCacheCallback(ASHost* pHost, PCHCACHE pCache, UINT iEntry, LPBYTE pData);
  338. //
  339. // This is the per-person data we keep to VIEW a host. When this person
  340. // starts to host, we allocate this structure, and then subblocks as
  341. // necessary like caches. When this person stops hosting, we free it
  342. // after freeing the objects contained within.
  343. //
  344. // NOTE that for some whacky 2.x compatibility, some things that should
  345. // be in the ASView structure are actually kept in ASPerson because
  346. // the information contained within has to stay around when that person
  347. // isn't hosting. With 3.0 hosts that's not the case. So when 2.x
  348. // compatibility goes away, move OD2 PM RBC fields here also.
  349. //
  350. class ASView
  351. {
  352. public:
  353. STRUCTURE_STAMP
  354. // DS vars
  355. // For NM 2.x machines only, the offset if their desktop is scrolled over
  356. POINT m_dsScreenOrigin;
  357. // OD vars, for playback of orders from this remote host
  358. HRGN m_odInvalRgnOrder;
  359. HRGN m_odInvalRgnTotal;
  360. UINT m_odInvalTotal;
  361. COLORREF m_odLastBkColor;
  362. COLORREF m_odLastTextColor;
  363. int m_odLastBkMode;
  364. int m_odLastROP2;
  365. UINT m_odLastFillMode;
  366. UINT m_odLastArcDirection;
  367. UINT m_odLastPenStyle;
  368. UINT m_odLastPenWidth;
  369. COLORREF m_odLastPenColor;
  370. COLORREF m_odLastForeColor;
  371. int m_odLastBrushOrgX;
  372. int m_odLastBrushOrgY;
  373. COLORREF m_odLastBrushBkColor;
  374. COLORREF m_odLastBrushTextColor;
  375. HBITMAP m_odLastBrushPattern;
  376. UINT m_odLastLogBrushStyle;
  377. UINT m_odLastLogBrushHatch;
  378. TSHR_COLOR m_odLastLogBrushColor;
  379. BYTE m_odLastLogBrushExtra[7];
  380. int m_odLastCharExtra;
  381. int m_odLastJustExtra;
  382. int m_odLastJustCount;
  383. HFONT m_odLastFontID;
  384. UINT m_odLastFontCodePage;
  385. UINT m_odLastFontWidth;
  386. UINT m_odLastFontHeight;
  387. UINT m_odLastFontWeight;
  388. UINT m_odLastFontFlags;
  389. UINT m_odLastFontFaceLen;
  390. BYTE m_odLastFaceName[FH_FACESIZE];
  391. UINT m_odLastBaselineOffset;
  392. COLORREF m_odLastVGAColor[OD_NUM_COLORS];
  393. TSHR_COLOR m_odLastVGAResult[OD_NUM_COLORS];
  394. BOOL m_odRectReset;
  395. int m_odLastLeft;
  396. int m_odLastTop;
  397. int m_odLastRight;
  398. int m_odLastBottom;
  399. // SSI vars
  400. HDC m_ssiDC;
  401. HBITMAP m_ssiBitmap; // Bitmap handle
  402. HBITMAP m_ssiOldBitmap;
  403. int m_ssiBitmapHeight;
  404. // SWL vars
  405. int m_swlCount;
  406. SWLWINATTRIBUTES m_aswlLast[SWL_MAX_WINDOWS];
  407. // USR vars
  408. HDC m_usrDC;
  409. HDC m_usrWorkDC;
  410. HBITMAP m_usrBitmap;
  411. HBITMAP m_usrOldBitmap;
  412. // VIEW vars
  413. HWND m_viewFrame; // Frame
  414. HWND m_viewClient; // Host view
  415. HWND m_viewStatusBar; // Status bar
  416. UINT m_viewStatus; // Current status
  417. HMENU m_viewMenuBar; // Menu bar
  418. RECT m_viewSavedWindowRect; // When full screen, old pos
  419. HWND m_viewInformDlg; // Notification message up
  420. UINT m_viewInformMsg; // Informational message
  421. BOOL m_viewFocus:1; // Key strokes are going to this
  422. BOOL m_viewInMenuMode:1; // In menu mode
  423. BOOL m_viewFullScreen:1; // Full screen UI
  424. BOOL m_viewWindowBarOn:1;
  425. BOOL m_viewStatusBarOn:1;
  426. BOOL m_viewSavedWindowBarOn:1;
  427. BOOL m_viewSavedStatusBarOn:1;
  428. BOOL m_viewFullScreenExitTrack:1;
  429. BOOL m_viewFullScreenExitMove:1;
  430. POINT m_viewSavedPos;
  431. POINT m_viewFullScreenExitStart;
  432. HWND m_viewWindowBar; // App window bar
  433. BASEDLIST m_viewWindowBarItems; // Items in window bar
  434. PWNDBAR_ITEM m_viewWindowBarActiveItem; // Current item
  435. int m_viewWindowBarItemFirst; // Index of 1st visible item
  436. int m_viewWindowBarItemFitCount; // # of items that fit
  437. int m_viewWindowBarItemCount; // # of items total
  438. UINT m_viewMouseFlags; // For capture
  439. POINT m_viewMouse; // Mouse pos
  440. BOOL m_viewMouseOutside; // Mouse is down, outside client
  441. int m_viewMouseWheelDelta; // Intellimouse wheel insanity
  442. //
  443. // These are kept always in the view's client coords. When the view
  444. // scrolls over, the shared and obscured regions are adjusted too.
  445. // When a new SWL packet for the host comes in, these regions are
  446. // saved accounting for scrolling too.
  447. //
  448. HRGN m_viewSharedRgn; // Shared area, not obscured
  449. HRGN m_viewObscuredRgn; // Shared area, obscured
  450. HRGN m_viewExtentRgn;
  451. HRGN m_viewScreenRgn;
  452. HRGN m_viewPaintRgn;
  453. HRGN m_viewScratchRgn;
  454. POINT m_viewPos; // View scroll pos
  455. POINT m_viewPage; // View page size
  456. POINT m_viewPgSize; // Page scroll inc
  457. POINT m_viewLnSize; // Line scroll inc
  458. };
  459. //
  460. // This is the per-person data we keep for each person in a conference.
  461. // We dynamically allocate everybody but ourself (the local dude).
  462. //
  463. class ASPerson
  464. {
  465. public:
  466. STRUCTURE_STAMP
  467. ASPerson * pasNext;
  468. // VIEW vars (allocated when this person is hosting that we use to VIEW them)
  469. ASView * m_pView;
  470. // SC vars
  471. UINT_PTR mcsID; // MCS user_id
  472. char scName[TSHR_MAX_PERSON_NAME_LEN]; // Name
  473. BYTE scSyncSendStatus[SC_STREAM_COUNT];
  474. BYTE scSyncRecStatus[SC_STREAM_COUNT];
  475. //
  476. // AWC vars
  477. // When 2.x compat goes away, move these to AS_VIEW
  478. //
  479. UINT_PTR awcActiveWinID;
  480. // CA vars
  481. BOOL m_caAllowControl;
  482. BOOL m_caControlPaused; // ONLY HOST CONTROLLED BY US or US PAUSED
  483. UINT m_caControlID; // ONLY NODE WE ARE CONTROLLING/CONTROLLED BY
  484. ASPerson * m_caControlledBy;
  485. ASPerson * m_caInControlOf;
  486. BOOL m_ca2xCooperating;
  487. //
  488. // CM vars
  489. // When 2.x compat goes away, move most of these to AS_VIEW
  490. //
  491. POINT cmPos; // Position of the remote cursor, in his screen coords
  492. POINT cmHotSpot; // The remote cursor hotspot
  493. BOOL cmShadowOff;
  494. HCURSOR cmhRemoteCursor;
  495. UINT ccmRxCache; // # of entries in cache
  496. PCACHEDCURSOR acmRxCache; // Cached cursor array
  497. // CPC vars
  498. CPCALLCAPS cpcCaps;
  499. // DCS vars
  500. PGDC_DICTIONARY adcsDict; // POINTER
  501. // HET vars
  502. int hetCount;
  503. // OE vars
  504. UINT oecFonts;
  505. POEREMOTEFONT poeFontInfo;
  506. //
  507. // NOTE:
  508. // These are here and not in the HOST data for 2.x compat. 2.x systems
  509. // don't reset outgoing info if they stay in a share while stopping/
  510. // restarting hosting. 3.0 systems do (look in HET_HostStarting()).
  511. // So we must keep the old gunky cache/decode data around for backlevel
  512. // systems. Therefore we allocate it dynamically still.
  513. //
  514. // OD2 vars
  515. PPARTYORDERDATA od2Party;
  516. // PM vars
  517. HPALETTE pmPalette;
  518. UINT pmcColorTable;
  519. PCOLORTABLECACHE apmColorTable;
  520. // RBC vars
  521. PRBC_HOST_INFO prbcHost;
  522. // VIEW vars
  523. // NOTE: because of bugs in 2.x VD calcs, this is kept around while
  524. // the person is in the share, whether they are hosting or not.
  525. POINT viewExtent; // View extent (may be > usrScreenSize for 2.x dudes)
  526. };
  527. //
  528. // Allocated when in a share
  529. //
  530. class ASShare
  531. {
  532. public:
  533. STRUCTURE_STAMP
  534. ASHost * m_pHost;
  535. ASPerson * m_pasLocal; // People list, starting with local person
  536. //
  537. // Bitmap Compressor/Decompressor
  538. //
  539. MATCH * m_amatch;
  540. LPBYTE m_abNormal;
  541. LPBYTE m_abXor;
  542. //
  543. // Control Arbitrator
  544. //
  545. char m_caToggle;
  546. char m_caPad1;
  547. short m_caPad2;
  548. BASEDLIST m_caQueuedMsgs;
  549. ASPerson * m_caWaitingForReplyFrom;
  550. UINT m_caWaitingForReplyMsg;
  551. HWND m_caQueryDlg;
  552. CA30PENDING m_caQuery;
  553. ASPerson * m_ca2xControlTokenOwner; // Person owning control token
  554. UINT_PTR m_ca2xControlGeneration;
  555. //
  556. // Cursor
  557. //
  558. UINT m_cmCursorWidth;
  559. UINT m_cmCursorHeight;
  560. HCURSOR m_cmArrowCursor;
  561. POINT m_cmArrowCursorHotSpot;
  562. HBRUSH m_cmHatchBrush;
  563. HFONT m_cmCursorTagFont;
  564. DWORD m_dcsLastScheduleTime;
  565. DWORD m_dcsLastFastMiscTime;
  566. DWORD m_dcsLastIMTime;
  567. UINT m_dcsCompressionLevel;
  568. UINT m_dcsCompressionSupport;
  569. BOOL m_dcsLargePacketCompressionOnly;
  570. //
  571. // PKZIP
  572. //
  573. BYTE m_agdcWorkBuf[GDC_WORKBUF_SIZE];
  574. //
  575. // Fonts
  576. //
  577. BOOL m_fhLocalInfoSent;
  578. //
  579. // Hosting
  580. //
  581. UINT m_hetHostCount;
  582. BOOL m_hetRetrySendState;
  583. BOOL m_hetViewers;
  584. //
  585. // Input Manager
  586. //
  587. // GLOBAL (or costly to calc/load and undo repeatedly)
  588. WORD m_imScanVKLShift;
  589. WORD m_imScanVKRShift;
  590. HINSTANCE m_imImmLib;
  591. IMMGVK m_imImmGVK;
  592. // IN CONTROL
  593. BOOL m_imfInControlEventIsPending:1;
  594. BOOL m_imfInControlCtrlDown:1;
  595. BOOL m_imfInControlShiftDown:1;
  596. BOOL m_imfInControlMenuDown:1;
  597. BOOL m_imfInControlCapsLock:1;
  598. BOOL m_imfInControlNumLock:1;
  599. BOOL m_imfInControlScrollLock:1;
  600. BOOL m_imfInControlConsumeMenuUp:1;
  601. BOOL m_imfInControlConsumeEscapeUp:1;
  602. BOOL m_imfInControlNewEvent:1;
  603. IMEVENT m_imInControlPendingEvent;
  604. IMEVENTQ m_imInControlEventQ;
  605. BYTE m_aimInControlKeyStates[256];
  606. int m_imInControlMouseDownCount;
  607. DWORD m_imInControlMouseDownTime;
  608. UINT m_imInControlMouseWithhold;
  609. DWORD m_imInControlMouseSpoilRate;
  610. UINT m_imInControlNumEventsPending;
  611. UINT m_imInControlNumEventsReturned;
  612. UINT m_aimInControlEventsToReturn[15];
  613. UINT m_imInControlNextHotKeyEntry;
  614. BYTE m_aimInControlHotKeyArray[4];
  615. UINT m_imInControlNumDeadKeysDown;
  616. UINT m_imInControlNumDeadKeys;
  617. BYTE m_aimInControlDeadKeys[IM_MAX_DEAD_KEYS];
  618. // CONTROLLED (only when hosting!)
  619. BOOL m_imfControlledMouseButtonsReversed:1;
  620. BOOL m_imfControlledMouseClipped:1;
  621. BOOL m_imfControlledPaceInjection:1;
  622. BOOL m_imfControlledNewEvent:1;
  623. UINT m_imControlledNumEventsPending;
  624. UINT m_imControlledNumEventsReturned;
  625. UINT m_aimControlledEventsToReturn[15];
  626. UINT m_imControlledVKToReplay;
  627. IMEVENTQ m_imControlledEventQ;
  628. IMOSQ m_imControlledOSQ;
  629. BYTE m_aimControlledControllerKeyStates[256];
  630. BYTE m_aimControlledKeyStates[256];
  631. BYTE m_aimControlledSavedKeyStates[256];
  632. DWORD m_imControlledLastLowLevelMouseEventTime;
  633. DWORD m_imControlledLastMouseRemoteTime;
  634. DWORD m_imControlledLastMouseLocalTime;
  635. DWORD m_imControlledLastIncompleteConversion;
  636. DWORD m_imControlledMouseBacklog;
  637. POINT m_imControlledLastMousePos;
  638. //
  639. // Order Encoder
  640. //
  641. BOOL m_oefSendOrders:1;
  642. BOOL m_oefTextEnabled:1;
  643. BOOL m_oefOE2EncodingOn:1;
  644. BOOL m_oefOE2Negotiable:1;
  645. BOOL m_oefBaseOE:1;
  646. BOOL m_oefAlignedOE:1;
  647. BYTE m_aoeOrderSupported[ORD_NUM_INTERNAL_ORDERS];
  648. PROTCAPS_ORDERS m_oeCombinedOrderCaps;
  649. UINT m_oeOE2Flag;
  650. //
  651. // Share Controller
  652. //
  653. BOOL m_scfViewSelf:1;
  654. #ifdef _DEBUG
  655. BOOL m_scfInSync:1;
  656. #endif // _DEBUG
  657. UINT m_scShareVersion;
  658. int m_ascSynced[SC_STREAM_COUNT];
  659. LPBYTE m_ascTmpBuffer;
  660. TSHR_UINT16 m_swlLastTokenSeen;
  661. WORD m_swlPad;
  662. POINT m_viewVDSize;
  663. int m_viewEdgeCX;
  664. int m_viewEdgeCY;
  665. HBRUSH m_viewObscuredBrush;
  666. HICON m_viewFullScreenExitIcon;
  667. int m_viewFullScreenCX;
  668. int m_viewFullScreenCY;
  669. int m_viewItemCX;
  670. int m_viewItemCY;
  671. int m_viewItemScrollCX;
  672. int m_viewItemScrollCY;
  673. int m_viewStatusBarCY;
  674. int m_viewWindowBarCY;
  675. HCURSOR m_viewNotInControl;
  676. UINT m_viewMouseWheelScrollLines;
  677. HBITMAP m_usrBmp16;
  678. HBITMAP m_usrBmp32;
  679. HBITMAP m_usrBmp48;
  680. HBITMAP m_usrBmp64;
  681. HBITMAP m_usrBmp80;
  682. HBITMAP m_usrBmp96;
  683. HBITMAP m_usrBmp112;
  684. HBITMAP m_usrBmp128;
  685. HBITMAP m_usrBmp256;
  686. HBITMAP m_usrBmp1024;
  687. LPBYTE m_usrPBitmapBuffer;
  688. BOOL m_usrHatchBitmaps;
  689. BOOL m_usrHatchScreenData;
  690. int m_usrHatchColor;
  691. public:
  692. #ifdef _DEBUG
  693. void ValidatePerson(ASPerson * pasPerson);
  694. void ValidateView(ASPerson * pasPerson);
  695. #else
  696. __inline void ValidatePerson(ASPerson * pasPerson) {}
  697. __inline void ValidateView(ASPerson * pasPerson) {}
  698. #endif // _DEBUG
  699. //
  700. // Share init
  701. //
  702. BOOL SC_ShareStarting(void);
  703. BOOL BCD_ShareStarting(void);
  704. BOOL CM_ShareStarting(void);
  705. BOOL IM_ShareStarting(void);
  706. BOOL VIEW_ShareStarting(void);
  707. BOOL USR_ShareStarting(void);
  708. //
  709. // Share term
  710. //
  711. void SC_ShareEnded(void);
  712. void BCD_ShareEnded(void);
  713. void CM_ShareEnded(void);
  714. void IM_ShareEnded(void);
  715. void VIEW_ShareEnded(void);
  716. void USR_ShareEnded(void);
  717. //
  718. // Member joining share
  719. //
  720. BOOL SC_PartyAdded(UINT mcsID, LPSTR szName, UINT cbCaps, LPVOID pCaps);
  721. ASPerson * SC_PartyJoiningShare(UINT mcsID, LPSTR szName, UINT cbCaps, LPVOID pCaps);
  722. BOOL CM_PartyJoiningShare(ASPerson * pasPerson);
  723. BOOL CPC_PartyJoiningShare(ASPerson * pasPerson, UINT cbCaps, void* pCapsData);
  724. BOOL DCS_PartyJoiningShare(ASPerson * pasPerson);
  725. BOOL HET_PartyJoiningShare(ASPerson * pasPerson);
  726. //
  727. // Member leaving share
  728. //
  729. void SC_PartyDeleted(UINT_PTR mcsID);
  730. void SC_PartyLeftShare(UINT_PTR mcsID);
  731. void CA_PartyLeftShare(ASPerson * pasPerson);
  732. void CM_PartyLeftShare(ASPerson * pasPerson);
  733. void DCS_PartyLeftShare(ASPerson * pasPerson);
  734. void HET_PartyLeftShare(ASPerson * pasPerson);
  735. void OD2_PartyLeftShare(ASPerson * pasPerson);
  736. void OE_PartyLeftShare(ASPerson * pasPerson);
  737. void PM_PartyLeftShare(ASPerson * pasPerson);
  738. void RBC_PartyLeftShare(ASPerson * pasPerson);
  739. void SWL_PartyLeftShare(ASPerson * pasPerson);
  740. void VIEW_PartyLeftShare(ASPerson * pasPerson);
  741. //
  742. // Recalc caps after somebody joined or left
  743. //
  744. void SC_RecalcCaps(BOOL fJoiner);
  745. void CM_RecalcCaps(BOOL fJoiner);
  746. void DCS_RecalcCaps(BOOL fJoiner);
  747. void OE_RecalcCaps(BOOL fJoiner);
  748. void PM_RecalcCaps(BOOL fJoiner);
  749. void SBC_RecalcCaps(BOOL fJoiner);
  750. void SSI_RecalcCaps(BOOL fJoiner);
  751. void USR_RecalcCaps(BOOL fJoiner);
  752. //
  753. // Syncing due to new member joined or reset
  754. //
  755. void DCS_SyncOutgoing(void);
  756. void IM_SyncOutgoing(void);
  757. void OD2_SyncIncoming(ASPerson * pasPerson);
  758. void OE_SyncOutgoing(void);
  759. //
  760. // Starting host view
  761. //
  762. BOOL HET_ViewStarting(ASPerson * pasPerson);
  763. BOOL CA_ViewStarting(ASPerson * pasPerson);
  764. BOOL CM_ViewStarting(ASPerson * pasPerson);
  765. BOOL OD_ViewStarting(ASPerson * pasPerson);
  766. BOOL OD2_ViewStarting(ASPerson * pasPerson);
  767. BOOL PM_ViewStarting(ASPerson * pasPErson);
  768. BOOL RBC_ViewStarting(ASPerson * pasPerson);
  769. BOOL SSI_ViewStarting(ASPerson * pasPerson);
  770. BOOL VIEW_ViewStarting(ASPerson * pasPerson);
  771. BOOL USR_ViewStarting(ASPerson * pasPerson);
  772. //
  773. // Stopped host view
  774. //
  775. void HET_ViewEnded(ASPerson * pasPerson);
  776. void CA_ViewEnded(ASPerson * pasPerson);
  777. void CM_ViewEnded(ASPerson * pasPerson);
  778. void OD_ViewEnded(ASPerson * pasPerson);
  779. void OD2_ViewEnded(ASPerson * pasPerson);
  780. void PM_ViewEnded(ASPerson * pasPerson);
  781. void RBC_ViewEnded(ASPerson * pasPerson);
  782. void SSI_ViewEnded(ASPerson * pasPerson);
  783. void VIEW_ViewEnded(ASPerson * pasPerson);
  784. void USR_ViewEnded(ASPerson * pasPerson);
  785. //
  786. // Periodic processing when in share, mostly for when hosting
  787. //
  788. void SC_Periodic(void);
  789. void CA_Periodic(void);
  790. void HET_Periodic(void);
  791. void IM_Periodic(void);
  792. void OE_Periodic(void);
  793. //
  794. // Incoming packet handling
  795. //
  796. void SC_ReceivedPacket(PS20DATAPACKET pPacket);
  797. void AWC_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  798. void CA_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  799. void CA30_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  800. void CM_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  801. void CPC_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  802. void FH_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  803. void HET_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  804. void PM_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  805. void OD_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  806. void SDP_ReceivedPacket(ASPerson * pasPerson, PS20DATAPACKET pPacket);
  807. void SWL_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  808. void UP_ReceivedPacket(ASPerson * pasFrom, PS20DATAPACKET pPacket);
  809. //
  810. // Random component routines
  811. //
  812. BOOL AWC_SendMsg(UINT_PTR userTo, UINT msg, UINT_PTR data1, UINT_PTR data2);
  813. BOOL BC_CompressBitmap( LPBYTE pSrcBitmap,
  814. LPBYTE pDstBuffer,
  815. LPUINT pDstBufferSize,
  816. UINT bitmapWidth,
  817. UINT bitmapHeight,
  818. UINT bitmapBitsPerPel,
  819. LPBOOL pLossy);
  820. BOOL BD_DecompressBitmap( LPBYTE pCompressedData,
  821. LPBYTE pDstBitmap,
  822. UINT srcDataSize,
  823. UINT bitmapWidth,
  824. UINT bitmapHeight,
  825. UINT bitmapBitsPerPel );
  826. void CA_TakeControl(ASPerson * pasHost);
  827. void CA_CancelTakeControl(ASPerson * pasHost, BOOL fPacket);
  828. void CA_ReleaseControl(ASPerson * pasFrom, BOOL fPacket);
  829. void CA_PassControl(ASPerson * pasHost, ASPerson * pasViewer);
  830. void CA_AllowControl(BOOL fAllow);
  831. void CA_GiveControl(ASPerson * pasInvite);
  832. void CA_CancelGiveControl(ASPerson * pasViewer, BOOL fPacket);
  833. void CA_RevokeControl(ASPerson * pasController, BOOL fPacket);
  834. void CA_PauseControl(ASPerson * pasController, BOOL fPause, BOOL fPacket);
  835. void CA_ClearLocalState(UINT clearFlags, ASPerson * pasRemote, BOOL fPacket);
  836. BOOL CA_QueryDlgProc(HWND, UINT, WPARAM, LPARAM);
  837. void CM_DrawShadowCursor(ASPerson * pasPerson, HDC hdc );
  838. void CM_UpdateShadowCursor(ASPerson * pasPerson, BOOL fOff,
  839. int xPosNew, int yPosNew, int xHotNew, int yHotNew);
  840. void CPC_UpdatedCaps(PPROTCAPS pCaps);
  841. #ifdef _DEBUG
  842. UINT DCS_CompressAndSendPacket(UINT streamID, UINT_PTR nodeID, PS20DATAPACKET pPacket, UINT packetLength);
  843. #else
  844. void DCS_CompressAndSendPacket(UINT streamID, UINT_PTR nodeID, PS20DATAPACKET pPacket, UINT packetLength);
  845. #endif // _DEBUG
  846. void DCS_FlowControl(UINT newBufferSize);
  847. void DCS_TakeControl(UINT gccOf);
  848. void DCS_CancelTakeControl(UINT gccOf);
  849. void DCS_ReleaseControl(UINT gccOf);
  850. void DCS_PassControl(UINT gccOf, UINT gccTo);
  851. void DCS_GiveControl(UINT gccTo);
  852. void DCS_CancelGiveControl(UINT gccTo);
  853. void DCS_RevokeControl(UINT gccTo);
  854. void DCS_PauseControl(UINT gccTo, BOOL fPause);
  855. void FH_ConvertAnyFontIDToLocal(LPCOM_ORDER pOrder, ASPerson * pasPerson);
  856. void FH_DetermineFontSupport(void);
  857. void FH_SendLocalFontInfo(void);
  858. void HET_CalcViewers(ASPerson * pasLeaving);
  859. void HET_HandleNewTopLevel(BOOL fShowing);
  860. void HET_HandleRecountTopLevel(UINT newCount);
  861. void HET_ShareApp(WPARAM, LPARAM);
  862. void HET_ShareDesktop(void);
  863. void HET_UnshareAll(void);
  864. void HET_UnshareApp(WPARAM, LPARAM);
  865. BOOL HET_WindowIsHosted(HWND winid);
  866. BOOL IM_Controlled(ASPerson * pasControlledBy);
  867. void IM_InControl(ASPerson * pasInControlOf);
  868. void IM_OutgoingKeyboardInput(ASPerson * pasHost,
  869. UINT vkCode, UINT keyData);
  870. void IM_OutgoingMouseInput(ASPerson * pasHost,
  871. LPPOINT pMousePos, UINT message, UINT extra);
  872. void IM_ReceivedPacket(ASPerson * pasPerson, PS20DATAPACKET pPacket);
  873. void IM_SyncOutgoingKeyboard(void);
  874. void OD_ReplayOrder(ASPerson * pasFrom, LPCOM_ORDER pOrder, BOOL fPalRGB);
  875. void OD_ResetRectRegion(ASPerson * pasPerson);
  876. void OD_UpdateView(ASPerson * pasHost);
  877. void OD2_CalculateBounds(LPCOM_ORDER pOrder, LPRECT pRect,
  878. BOOL fDecoding, ASPerson * pasPerson);
  879. void OD2_CalculateTextOutBounds(LPTEXTOUT_ORDER pTextOut,
  880. LPRECT pRect, BOOL fDecoding, ASPerson * pasPerson);
  881. LPCOM_ORDER OD2_DecodeOrder(void * pEOrder, LPUINT LengthDecoded,
  882. ASPerson * pasPerson);
  883. void OE_EnableText(BOOL enable);
  884. BOOL OE_SendAsOrder(DWORD order);
  885. BOOL PM_CacheRxColorTable(ASPerson * pasPerson,
  886. UINT index, UINT cColors, LPTSHR_RGBQUAD pColors);
  887. BOOL PM_CreatePalette(UINT cEntries, LPTSHR_COLOR pNewEntries,
  888. HPALETTE* phPal );
  889. void PM_DeletePalette(HPALETTE palette);
  890. void PM_GetColorTable(ASPerson * pasPerson, UINT index,
  891. UINT * pcColors, LPTSHR_RGBQUAD pColors);
  892. HBITMAP RBC_MapCacheIDToBitmapHandle(ASPerson * pasPerson,
  893. UINT cacheIndex, UINT entry, UINT colorTable);
  894. void RBC_ProcessCacheOrder(ASPerson * pasPerson, LPCOM_ORDER_UA pOrder);
  895. PS20DATAPACKET SC_AllocPkt(UINT streamID, UINT_PTR nodeID, UINT_PTR len);
  896. ASPerson * SC_PersonAllocate(UINT mcsID, LPSTR szName);
  897. ASPerson * SC_PersonFromNetID(UINT_PTR mcsID);
  898. ASPerson * SC_PersonFromGccID(UINT gccID);
  899. void SC_PersonFree(ASPerson * pasFree);
  900. BOOL SC_ValidateNetID(UINT_PTR mcsID, ASPerson** pLocal);
  901. void SDP_DrawHatchedRect( HDC surface, int x, int y, int width, int height, UINT color);
  902. void SSI_SaveBitmap(ASPerson * pasPerson, LPSAVEBITMAP_ORDER pSaveBitmap);
  903. TSHR_UINT16 SWL_CalculateNextToken(TSHR_UINT16 curToken);
  904. BOOL VIEW_DlgProc(HWND, UINT, WPARAM, LPARAM);
  905. LRESULT VIEW_FrameWindowProc(HWND, UINT, WPARAM, LPARAM);
  906. LRESULT VIEW_FullScreenExitProc(HWND, UINT, WPARAM, LPARAM);
  907. void VIEW_HostStateChange(ASPerson * pasHost);
  908. void VIEW_InControl(ASPerson * pasRemote, BOOL fStart);
  909. void VIEW_InvalidateRect(ASPerson * pasHost, LPRECT lprc);
  910. void VIEW_InvalidateRgn(ASPerson * pasHost, HRGN rgnUpdated);
  911. BOOL VIEW_IsPointShared(ASPerson * pasHost, POINT pt);
  912. void VIEW_Message(ASPerson * pasHost, UINT ids);
  913. void VIEW_PausedInControl(ASPerson * pasRemote, BOOL fPaused);
  914. void VIEW_RecalcExtent(ASPerson * pasHost);
  915. void VIEW_RecalcVD(void);
  916. void VIEW_ScreenChanged(ASPerson * pasPerson);
  917. void VIEW_SetHostRegions(ASPerson * pasHost, HRGN rgnShared, HRGN rgnObscured);
  918. void VIEW_SyncCursorPos(ASPerson * pasHost, int x, int y);
  919. void VIEW_UpdateStatus(ASPerson * pasHost, UINT idsStatus);
  920. LRESULT VIEW_ViewWindowProc(HWND, UINT, WPARAM, LPARAM);
  921. void VIEW_WindowBarChangedActiveWindow(ASPerson * pasHost);
  922. void VIEW_WindowBarEndUpdateItems(ASPerson * pasHost, BOOL fAnyChanges);
  923. LRESULT VIEW_WindowBarItemsProc(HWND, UINT, WPARAM, LPARAM);
  924. BOOL VIEW_WindowBarUpdateItem(ASPerson * pasHost, PSWLWINATTRIBUTES pWinNew, LPSTR pText);
  925. LRESULT VIEW_WindowBarProc(HWND, UINT, WPARAM, LPARAM);
  926. void USR_InitDIBitmapHeader(BITMAPINFOHEADER * pbh, UINT bpp);
  927. void USR_ScreenChanged(ASPerson * pasPerson);
  928. void USR_ScrollDesktop(ASPerson * pasPerson, int xNew, int yNew);
  929. BOOL USR_UseFont(HDC hdc, HFONT* pHFONT,
  930. LPTEXTMETRIC pMetrics, LPSTR pName, UINT charSet,
  931. UINT maxHeight, UINT height, UINT width,
  932. UINT weight, UINT flags);
  933. protected:
  934. void CAClearRemoteState(ASPerson * pasClear);
  935. BOOL CAClearHostState(ASPerson * pasHost, ASPerson * pasController);
  936. void CAStartWaiting(ASPerson * pasWait, UINT msgWait);
  937. BOOL CAStartQuery(ASPerson * pasFrom, UINT msg, PCA30P pReq);
  938. void CAFinishQuery(UINT result);
  939. void CACancelQuery(ASPerson * pasFrom, BOOL fPacket);
  940. void CAHandleRequestTakeControl(ASPerson * pasViewer, PCA_RTC_PACKET pPacket);
  941. void CACompleteRequestTakeControl(ASPerson * pasFrom, PCA_RTC_PACKET pPacket, UINT result);
  942. void CAHandleReplyRequestTakeControl(ASPerson * pasHost, PCA_REPLY_RTC_PACKET pPacket);
  943. void CAHandleRequestGiveControl(ASPerson * pasHost, PCA_RGC_PACKET pPacket);
  944. void CACompleteRequestGiveControl(ASPerson * pasFrom, PCA_RGC_PACKET pPacket, UINT result);
  945. void CAHandleReplyRequestGiveControl(ASPerson * pasViewer, PCA_REPLY_RGC_PACKET pPacket);
  946. void CAHandlePreferPassControl(ASPerson * pasController, PCA_PPC_PACKET pPacket);
  947. void CACompletePreferPassControl(ASPerson * pasViewer, UINT_PTR mcsOrg, PCA_PPC_PACKET pPacket, UINT result);
  948. void CAHandleInformReleasedControl(ASPerson * pasController, PCA_INFORM_PACKET pPacket);
  949. void CAHandleInformRevokedControl(ASPerson * pasHost, PCA_INFORM_PACKET pPacket);
  950. void CAHandleInformPausedControl(ASPerson * pasHost, PCA_INFORM_PACKET pPacket);
  951. void CAHandleInformUnpausedControl(ASPerson * pasHost, PCA_INFORM_PACKET pPacket);
  952. void CAHandleNewState(ASPerson * pasHost, PCANOTPACKET pPacket);
  953. void CAStartControlled(ASPerson * pasInControl, UINT controlID);
  954. void CAStopControlled(void);
  955. void CAStartInControl(ASPerson * pasControlled, UINT controlID);
  956. void CAStopInControl(void);
  957. // 2.x stuff
  958. void CA2xCooperateChange(ASPerson * pasFrom, BOOL fCooperating);
  959. void CA2xGrantedControl(ASPerson * pasFrom, PCAPACKET pPacket);
  960. BOOL CA2xQueueSendMsg(UINT_PTR destID, UINT msg, UINT_PTR data1,
  961. UINT_PTR data2);
  962. void CA2xRequestControl(ASPerson * pasFrom, PCAPACKET pPacket);
  963. BOOL CA2xSendMsg(UINT_PTR destID, UINT msg, UINT_PTR data1, UINT_PTR data2);
  964. void CA2xTakeControl(ASPerson * pas2xHost);
  965. BOOL CAFlushOutgoingPackets();
  966. void CALangToggle(BOOL);
  967. UINT CANewRequestID(void);
  968. BOOL CAQueueSendPacket(UINT_PTR destID, UINT msg, PCA30P pPacket);
  969. BOOL CASendPacket(UINT_PTR destID, UINT msg, PCA30P pPacket);
  970. BOOL CMCreateAbbreviatedName(LPCSTR szTagName, LPSTR szBuf, UINT cbBuf);
  971. HCURSOR CMCreateColorCursor(UINT xHotSpot, UINT yHotSpot,
  972. UINT cxWidth, UINT cyHeight, LPBYTE pANDMask,
  973. LPBYTE pXORBitmap, UINT cbANDMask, UINT cbXORBitmap);
  974. BOOL CMCreateIncoming(ASPerson * pasPerson);
  975. HCURSOR CMCreateMonoCursor(UINT xHotSpot, UINT yHotSpot,
  976. UINT cxWidth, UINT cyHeight, LPBYTE pANDMask,
  977. LPBYTE pXORBitmap);
  978. void CMDrawCursorTag(ASPerson * pasPerson, HDC hdc);
  979. void CMFreeIncoming(ASPerson * pasPerson);
  980. UINT CMProcessColorCursorPacket( PCMPACKETCOLORBITMAP pCMPacket,
  981. HCURSOR * phNewCursor, LPPOINT pNewHotSpot );
  982. void CMProcessCursorIDPacket(PCMPACKETID pCMPacket,
  983. HCURSOR * phNewCursor, LPPOINT pNewHotSpot);
  984. UINT CMProcessMonoCursorPacket(PCMPACKETMONOBITMAP pCMPacket,
  985. HCURSOR * phNewCursor, LPPOINT pNewHotSpot );
  986. void CMReceivedCursorMovedPacket(ASPerson * pasPerson, PCMPACKETHEADER pCMPacket );
  987. void CMReceivedCursorShapePacket(ASPerson * pasPerson, PCMPACKETHEADER pCMPacket );
  988. BOOL CPCCapabilitiesChange(ASPerson * pasPerson, PPROTCAPS pCaps);
  989. ASPerson * DCSGetPerson(UINT gccID, BOOL fNull);
  990. UINT FHConsiderRemoteFonts(UINT cCommonFonts, ASPerson * pasPerson);
  991. UINT FHGetLocalFontHandle(UINT remoteFont, ASPerson * pasPerson);
  992. void FHMaybeEnableText(void);
  993. void HETCheckSharing(BOOL fStartHost);
  994. BOOL HETStartHosting(BOOL fDesktop);
  995. void HETStopHosting(BOOL fDesktop);
  996. void HETSendLocalCount(void);
  997. void HETUpdateLocalCount(UINT newCount);
  998. void HETUpdateRemoteCount(ASPerson * pasPerson, UINT newCount);
  999. BOOL IMConvertAndSendEvent(ASPerson * pasFor, LPIMEVENT pIMEvent);
  1000. UINT IMConvertIMEventToOSEvent(LPIMEVENT pEvent, LPIMOSEVENT pOSEvent);
  1001. void IMDiscardUnreplayableOSEvents(void);
  1002. void IMGenerateFakeKeyPress(TSHR_UINT16 type,
  1003. TSHR_UINT16 key, TSHR_UINT16 flags);
  1004. BYTE IMGetHighLevelKeyState(UINT vk);
  1005. void IMSendKeyboardState(void);
  1006. BOOL IMTranslateIncoming(LPIMEVENT pIMIn, LPIMEVENT pIMOut);
  1007. BOOL IMTranslateOutgoing(LPIMEVENT pIMIn, LPIMEVENT pIMOut);
  1008. void IMAppendNetEvent(LPIMEVENT pIMEvent);
  1009. void IMFlushOutgoingEvents(void);
  1010. void IMInject(BOOL fStart);
  1011. BOOL IMInjectEvent(LPIMOSEVENT pEvent);
  1012. BOOL IMInjectingEvents(void);
  1013. UINT IMInsertModifierKeystrokes(BYTE curKBState, BYTE targetKBState,
  1014. LPUINT pEventQueue);
  1015. void IMMaybeAddDeadKey(BYTE vk);
  1016. void IMMaybeInjectEvents(void);
  1017. void IMSpoilEvents(void);
  1018. void IMUpdateAsyncArray(LPBYTE pimKeyStates, LPIMOSEVENT pEvent);
  1019. void ODAdjustColor(ASPerson * pasPerson, const TSHR_COLOR * pColorIn, LPTSHR_COLOR pColorOut, int type);
  1020. void ODDrawTextOrder(ASPerson * pasPerson, BOOL fExtText, BOOL fPalRGB,
  1021. LPCOMMON_TEXTORDER pCommon, LPSTR pText, UINT cchText,
  1022. LPRECT pExtRect, UINT extOptions, LPINT pExtDx);
  1023. void ODReplayARC(ASPerson * pasFrom, LPARC_ORDER pArc, BOOL fPalRGB);
  1024. void ODReplayCHORD(ASPerson * pasFrom, LPCHORD_ORDER pChord, BOOL fPalRGB);
  1025. void ODReplayDSTBLT(ASPerson * pasFrom, LPDSTBLT_ORDER pDstBlt, BOOL fPalRGB);
  1026. void ODReplayELLIPSE(ASPerson * pasFrom, LPELLIPSE_ORDER pEllipse, BOOL fPalRGB);
  1027. void ODReplayEXTTEXTOUT(ASPerson * pasFrom, LPEXTTEXTOUT_ORDER pExtTextOut, BOOL fPalRGB);
  1028. void ODReplayLINETO(ASPerson * pasFrom, LPLINETO_ORDER pLineTo, BOOL fPalRGB);
  1029. void ODReplayMEM3BLT(ASPerson * pasFrom, LPMEM3BLT_ORDER pMem3Blt, BOOL fPalRGB);
  1030. void ODReplayMEMBLT(ASPerson * pasFrom, LPMEMBLT_ORDER pMemBlt, BOOL fPalRGB);
  1031. void ODReplayOPAQUERECT(ASPerson * pasFrom, LPOPAQUERECT_ORDER pOpaqeRect, BOOL fPalRGB);
  1032. void ODReplayPATBLT(ASPerson * pasFrom, LPPATBLT_ORDER pPatBlt, BOOL fPalRGB);
  1033. void ODReplayPIE(ASPerson * pasFrom, LPPIE_ORDER pPie, BOOL fPalRGB);
  1034. void ODReplayPOLYBEZIER(ASPerson * pasFrom, LPPOLYBEZIER_ORDER pPolyBezier, BOOL fPalRGB);
  1035. void ODReplayPOLYGON(ASPerson * pasFrom, LPPOLYGON_ORDER pPolygon, BOOL fPalRGB);
  1036. void ODReplayRECTANGLE(ASPerson * pasFrom, LPRECTANGLE_ORDER pRectangle, BOOL fPalRGB);
  1037. void ODReplayROUNDRECT(ASPerson * pasFrom, LPROUNDRECT_ORDER pRoundRect, BOOL fPalRGB);
  1038. void ODReplaySCRBLT(ASPerson * pasFrom, LPSCRBLT_ORDER pScrBlt, BOOL fPalRGB);
  1039. void ODReplayTEXTOUT(ASPerson * pasFrom, LPTEXTOUT_ORDER pTextOut, BOOL fPalRGB);
  1040. void ODUseArcDirection(ASPerson * pasPerson, UINT dir);
  1041. void ODUseBkColor(ASPerson * pasPerson, BOOL fPalRGB, TSHR_COLOR color);
  1042. void ODUseBkMode(ASPerson * pasPerson, int mode);
  1043. void ODUseBrush(ASPerson * pasPerson, BOOL fPalRGB,
  1044. int x, int y, UINT Style, UINT Hatch,
  1045. TSHR_COLOR Color, BYTE Extra[7]);
  1046. void ODUseFillMode(ASPerson * pasPerson, UINT mode);
  1047. void ODUseFont(ASPerson * pasPerson, LPSTR pName, UINT cchName,
  1048. UINT codePage, UINT maxHeight, UINT Height,
  1049. UINT Width, UINT Weight, UINT flags);
  1050. void ODUsePen(ASPerson * pasPerson, BOOL fPalRGB,
  1051. UINT style, UINT width, TSHR_COLOR color);
  1052. void ODUseRectRegion(ASPerson * pasPerson, int left,
  1053. int top, int right, int bottom);
  1054. void ODUseROP2(ASPerson * pasPerson, int rop);
  1055. void ODUseTextBkColor(ASPerson * pasPerson, BOOL fPalRGB, TSHR_COLOR color);
  1056. void ODUseTextCharacterExtra(ASPerson * pasPerson, int extra);
  1057. void ODUseTextColor(ASPerson * pasPerson, BOOL fPalRGB, TSHR_COLOR color);
  1058. void ODUseTextJustification(ASPerson * pasPerson, int extra, int count);
  1059. void OD2CopyFromDeltaCoords(LPTSHR_INT8* ppSrc, LPVOID pDst,
  1060. UINT cbDstField, BOOL fSigned, UINT numElements);
  1061. void OD2DecodeBounds(LPBYTE *ppNextDataToCopy,
  1062. LPTSHR_RECT16 pRect, ASPerson * pasPerson);
  1063. void OD2DecodeField(LPBYTE* ppSrc, LPVOID pDest,
  1064. UINT cbSrcField, UINT cbDstField, BOOL fSigned,
  1065. UINT numElements);
  1066. void OD2FreeIncoming(ASPerson * pasPerson);
  1067. BOOL OD2UseFont(ASPerson * pasPerson, LPSTR pName,
  1068. UINT facelength, UINT codePage, UINT MaxHeight,
  1069. UINT Height, UINT Width, UINT Weight, UINT flags);
  1070. void OECapabilitiesChanged(void);
  1071. void PMFreeIncoming(ASPerson * pasPerson);
  1072. void RBCFreeIncoming(ASPerson * pasPerson);
  1073. void RBCStoreBitsInCacheBitmap(ASPerson * pasPerson,
  1074. UINT cacheID, UINT iCacheEntry, UINT cxSubWidth,
  1075. UINT cxFixedWidth, UINT cySubHeight, UINT bpp,
  1076. LPBYTE pBitmapBits, UINT cbBitmapBits, BOOL fCompressed);
  1077. BOOL SCSyncStream(UINT streamID);
  1078. void SDPDrawHatchedRegion(HDC hdc, HRGN region, UINT hatchColor);
  1079. void SDPPlayScreenDataToRDB(ASPerson * pasPerson,
  1080. PSDPACKET pUpdates, LPBYTE pBits, LPRECT pPosition);
  1081. void VIEWClientAutoScroll(ASPerson *);
  1082. void VIEWClientCaptureStolen(ASPerson *);
  1083. void VIEWClientExtentChange(ASPerson * pasHost, BOOL fRedraw);
  1084. void VIEWClientGetSize(ASPerson * pasHost, LPRECT lprc);
  1085. void VIEWClientMouseDown(ASPerson *, UINT, WPARAM, LPARAM);
  1086. void VIEWClientMouseMove(ASPerson *, UINT, WPARAM, LPARAM);
  1087. void VIEWClientMouseMsg(ASPerson *, UINT, WPARAM, LPARAM);
  1088. void VIEWClientMouseUp(ASPerson *, UINT, WPARAM, LPARAM, BOOL);
  1089. void VIEWClientMouseWheel(ASPerson *, WPARAM, LPARAM);
  1090. void VIEWClientPaint(ASPerson * pasHost);
  1091. BOOL VIEWClientScroll(ASPerson * pasHost, int xNew, int yNew);
  1092. void VIEWFrameAbout(ASPerson * pasHost);
  1093. void VIEWFrameCommand(ASPerson * pasHost, WPARAM wParam, LPARAM lParam);
  1094. BOOL VIEWFrameCreate(ASPerson * pasHost);
  1095. void VIEWFrameFullScreen(ASPerson * pasHost, BOOL fFull);
  1096. void VIEWFrameGetSize(ASPerson * pasHost, LPRECT lprc);
  1097. void VIEWFrameHelp(ASPerson * pasHost);
  1098. void VIEWFrameInitMenuBar(ASPerson * pasHost);
  1099. void VIEWFrameOnMenuSelect(ASPerson * pasHost, WPARAM wParam, LPARAM lParam);
  1100. void VIEWFrameResize(ASPerson * pasHost);
  1101. void VIEWFrameResizeChanged(ASPerson * pasHost);
  1102. void VIEWFrameSetStatus(ASPerson * pasHost, UINT idsStatus);
  1103. void VIEWFullScreenExitPaint(ASPerson * pasHost, HWND hwnd);
  1104. void VIEWStartControlled(BOOL fControlled);
  1105. void VIEWWindowBarDoActivate(ASPerson * pasHost, PWNDBAR_ITEM pItem);
  1106. void VIEWWindowBarChangeActiveItem(ASPerson * pasHost, PWNDBAR_ITEM pItem);
  1107. BOOL VIEWWindowBarCreate(ASPerson * pasHost, HWND hwndBar);
  1108. PWNDBAR_ITEM VIEWWindowBarFirstVisibleItem(ASPerson * pasHost);
  1109. void VIEWWindowBarItemsClick(ASPerson * pasHost, HWND hwndItems, int x, int y);
  1110. void VIEWWindowBarItemsInvalidate(ASPerson * pasHost, PWNDBAR_ITEM pItem);
  1111. void VIEWWindowBarItemsPaint(ASPerson * pasHost, HWND hwndItems);
  1112. void VIEWWindowBarItemsScroll(ASPerson * pasHost, WPARAM wParam, LPARAM lParam);
  1113. void VIEWWindowBarResize(ASPerson * pasHost, HWND hwndBar);
  1114. BOOL USRCreateRemoteDesktop(ASPerson * pasPerson);
  1115. void USRDeleteRemoteDesktop(ASPerson * pasPerson);
  1116. };
  1117. typedef struct tagASSession
  1118. {
  1119. // pasNext someday!
  1120. UINT scState;
  1121. UINT_PTR callID; // ID of call
  1122. MCSID gccID; // GCC node_id
  1123. BOOL fShareCreator;
  1124. NM30_MTG_PERMISSIONS attendeePermissions;
  1125. UINT cchLocalName;
  1126. char achLocalName[TSHR_MAX_PERSON_NAME_LEN];
  1127. ASShare * pShare;
  1128. #ifdef _DEBUG
  1129. DWORD scShareTime;
  1130. #endif
  1131. HWND hwndHostUI;
  1132. BOOL fHostUI:1;
  1133. BOOL fHostUIFrozen:1;
  1134. }
  1135. ASSession;
  1136. #endif // _H_AS
  1137.