From e2014b65ec46a63b699da694431ad59636f8a8d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sun, 20 Nov 2011 14:25:59 -0500 Subject: [PATCH] freerdp: adopt padding strategy not based on explicit offsets --- include/freerdp/freerdp.h | 62 +++++++-------- include/freerdp/graphics.h | 110 +++++++++++++------------- include/freerdp/input.h | 18 ++--- include/freerdp/settings.h | 122 +++++++++++++++-------------- include/freerdp/update.h | 156 ++++++++++++++++++------------------- 5 files changed, 235 insertions(+), 233 deletions(-) diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index 6bc6d3ceb..88760fdcd 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -56,47 +56,47 @@ typedef int (*pReceiveChannelData)(freerdp* instance, int channelId, uint8* data struct rdp_context { - freerdp* instance; - freerdp_peer* peer; - uint32 paddingA[16 - 4]; /* offset 64 */ + freerdp* instance; /* 0 */ + freerdp_peer* peer; /* 1 */ + uint32 paddingA[16 - 2]; /* 2 */ - int argc; - char** argv; - uint32 paddingB[16 - 3]; /* offset 128 */ + int argc; /* 16 */ + char** argv; /* 17 */ + uint32 paddingB[32 - 18]; /* 18 */ - rdpRdp* rdp; - rdpGdi* gdi; - rdpRail* rail; - rdpCache* cache; - rdpChannels* channels; - rdpGraphics* graphics; - uint32 paddingC[32 - 12]; /* offset 256 */ + rdpRdp* rdp; /* 32 */ + rdpGdi* gdi; /* 33 */ + rdpRail* rail; /* 34 */ + rdpCache* cache; /* 35 */ + rdpChannels* channels; /* 36 */ + rdpGraphics* graphics; /* 37 */ + uint32 paddingC[64 - 38]; /* 38 */ }; struct rdp_freerdp { - rdpContext* context; - uint32 paddingA[16 - 2]; /* offset 64 */ + rdpContext* context; /* 0 */ + uint32 paddingA[16 - 1]; /* 1 */ - rdpInput* input; - rdpUpdate* update; - rdpSettings* settings; - uint32 paddingB[16 - 6]; /* offset 128 */ + rdpInput* input; /* 16 */ + rdpUpdate* update; /* 17 */ + rdpSettings* settings; /* 18 */ + uint32 paddingB[32 - 19]; /* 19 */ - size_t context_size; - pContextNew ContextNew; - pContextFree ContextFree; - uint32 paddingC[16 - 6]; /* offset 192 */ + size_t context_size; /* 32 */ + pContextNew ContextNew; /* 33 */ + pContextFree ContextFree; /* 34 */ + uint32 paddingC[48 - 35]; /* 35 */ - pPreConnect PreConnect; - pPostConnect PostConnect; - pAuthenticate Authenticate; - pVerifyCertificate VerifyCertificate; - uint32 paddingD[16 - 8]; /* offset 256 */ + pPreConnect PreConnect; /* 48 */ + pPostConnect PostConnect; /* 49 */ + pAuthenticate Authenticate; /* 50 */ + pVerifyCertificate VerifyCertificate; /* 51 */ + uint32 paddingD[64 - 52]; /* 52 */ - pSendChannelData SendChannelData; - pReceiveChannelData ReceiveChannelData; - uint32 paddingE[16 - 4]; /* offset 320 */ + pSendChannelData SendChannelData; /* 64 */ + pReceiveChannelData ReceiveChannelData; /* 65 */ + uint32 paddingE[80 - 66]; /* 66 */ }; FREERDP_API void freerdp_context_new(freerdp* instance); diff --git a/include/freerdp/graphics.h b/include/freerdp/graphics.h index a63db45de..ab6c0e844 100644 --- a/include/freerdp/graphics.h +++ b/include/freerdp/graphics.h @@ -40,29 +40,29 @@ typedef void (*pBitmap_SetSurface)(rdpContext* context, rdpBitmap* bitmap, boole struct rdp_bitmap { - size_t size; - pBitmap_New New; - pBitmap_Free Free; - pBitmap_Paint Paint; - pBitmap_Decompress Decompress; - pBitmap_SetSurface SetSurface; - uint32 paddingA[16 - 12]; /* offset 64 */ + size_t size; /* 0 */ + pBitmap_New New; /* 1 */ + pBitmap_Free Free; /* 2 */ + pBitmap_Paint Paint; /* 3 */ + pBitmap_Decompress Decompress; /* 4 */ + pBitmap_SetSurface SetSurface; /* 5 */ + uint32 paddingA[16 - 6]; /* 6 */ - uint32 left; - uint32 top; - uint32 right; - uint32 bottom; - uint32 width; - uint32 height; - uint32 bpp; - uint32 flags; - uint32 length; - uint8* data; - uint32 paddingB[16 - 12]; /* offset 128 */ + uint32 left; /* 16 */ + uint32 top; /* 17 */ + uint32 right; /* 18 */ + uint32 bottom; /* 19 */ + uint32 width; /* 20 */ + uint32 height; /* 21 */ + uint32 bpp; /* 22 */ + uint32 flags; /* 23 */ + uint32 length; /* 24 */ + uint8* data; /* 25 */ + uint32 paddingB[32 - 26]; /* 26 */ - boolean compressed; - boolean ephemeral; - uint32 paddingC[16 - 2]; /* offset 192 */ + boolean compressed; /* 32 */ + boolean ephemeral; /* 33 */ + uint32 paddingC[64 - 34]; /* 34 */ }; FREERDP_API rdpBitmap* Bitmap_Alloc(rdpContext* context); @@ -84,22 +84,22 @@ typedef void (*pPointer_Set)(rdpContext* context, rdpPointer* pointer); struct rdp_pointer { - size_t size; - pPointer_New New; - pPointer_Free Free; - pPointer_Set Set; - uint32 paddingA[16 - 8]; /* offset 64 */ + size_t size; /* 0 */ + pPointer_New New; /* 1 */ + pPointer_Free Free; /* 2 */ + pPointer_Set Set; /* 3 */ + uint32 paddingA[16 - 4]; /* 4 */ - uint32 xPos; - uint32 yPos; - uint32 width; - uint32 height; - uint32 xorBpp; - uint32 lengthAndMask; - uint32 lengthXorMask; - uint8* xorMaskData; - uint8* andMaskData; - uint32 paddingB[16 - 11]; /* offset 128 */ + uint32 xPos; /* 16 */ + uint32 yPos; /* 17 */ + uint32 width; /* 18 */ + uint32 height; /* 19 */ + uint32 xorBpp; /* 20 */ + uint32 lengthAndMask; /* 21 */ + uint32 lengthXorMask; /* 22 */ + uint8* xorMaskData; /* 23 */ + uint8* andMaskData; /* 24 */ + uint32 paddingB[32 - 25]; /* 25 */ }; FREERDP_API rdpPointer* Pointer_Alloc(rdpContext* context); @@ -117,21 +117,21 @@ typedef void (*pGlyph_EndDraw)(rdpContext* context, int x, int y, int width, int struct rdp_glyph { - size_t size; - pGlyph_New New; - pGlyph_Free Free; - pGlyph_Draw Draw; - pGlyph_BeginDraw BeginDraw; - pGlyph_EndDraw EndDraw; - uint32 paddingA[16 - 12]; /* offset 64 */ + size_t size; /* 0 */ + pGlyph_New New; /* 1 */ + pGlyph_Free Free; /* 2 */ + pGlyph_Draw Draw; /* 3 */ + pGlyph_BeginDraw BeginDraw; /* 4 */ + pGlyph_EndDraw EndDraw; /* 5 */ + uint32 paddingA[16 - 6]; /* 6 */ - sint32 x; - sint32 y; - uint32 cx; - uint32 cy; - uint32 cb; - uint8* aj; - uint32 paddingB[16 - 7]; /* offset 128 */ + sint32 x; /* 16 */ + sint32 y; /* 17 */ + uint32 cx; /* 18 */ + uint32 cy; /* 19 */ + uint32 cb; /* 20 */ + uint8* aj; /* 21 */ + uint32 paddingB[32 - 22]; /* 22 */ }; FREERDP_API rdpGlyph* Glyph_Alloc(rdpContext* context); @@ -145,11 +145,11 @@ FREERDP_API void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int struct rdp_graphics { - rdpContext* context; - rdpBitmap* Bitmap_Prototype; - rdpPointer* Pointer_Prototype; - rdpGlyph* Glyph_Prototype; - uint32 paddingA[16 - 8]; /* offset 64 */ + rdpContext* context; /* 0 */ + rdpBitmap* Bitmap_Prototype; /* 1 */ + rdpPointer* Pointer_Prototype; /* 2 */ + rdpGlyph* Glyph_Prototype; /* 3 */ + uint32 paddingA[16 - 4]; /* 4 */ }; FREERDP_API void graphics_register_bitmap(rdpGraphics* graphics, rdpBitmap* bitmap); diff --git a/include/freerdp/input.h b/include/freerdp/input.h index e69993a8b..04ed6dc94 100644 --- a/include/freerdp/input.h +++ b/include/freerdp/input.h @@ -60,16 +60,16 @@ typedef void (*pExtendedMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uin struct rdp_input { - rdpContext* context; - void* param1; - uint32 paddingA[16 - 2]; /* offset 64 */ + rdpContext* context; /* 0 */ + void* param1; /* 1 */ + uint32 paddingA[16 - 2]; /* 2 */ - pSynchronizeEvent SynchronizeEvent; - pKeyboardEvent KeyboardEvent; - pUnicodeKeyboardEvent UnicodeKeyboardEvent; - pMouseEvent MouseEvent; - pExtendedMouseEvent ExtendedMouseEvent; - uint32 paddingB[16 - 5]; /* offset 128 */ + pSynchronizeEvent SynchronizeEvent; /* 16 */ + pKeyboardEvent KeyboardEvent; /* 17 */ + pUnicodeKeyboardEvent UnicodeKeyboardEvent; /* 18 */ + pMouseEvent MouseEvent; /* 19 */ + pExtendedMouseEvent ExtendedMouseEvent; /* 20 */ + uint32 paddingB[32 - 21]; /* 21 */ }; #endif /* __INPUT_API_H */ diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index ef6e31014..7dc009128 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -182,81 +182,83 @@ struct rdp_monitor struct rdp_settings { - void* instance; - uint32 paddingA[16 - 2]; /* offset 64 */ + void* instance; /* 0 */ + uint32 paddingA[16 - 1]; /* 1 */ /* Core Protocol Parameters */ - uint32 width; - uint32 height; - uint32 rdp_version; - uint32 color_depth; - uint32 kbd_layout; - uint32 kbd_type; - uint32 kbd_subtype; - uint32 kbd_fn_keys; - uint32 client_build; - uint32 requested_protocols; - uint32 selected_protocol; - uint32 encryption_method; - uint32 encryption_level; - boolean authentication; - uint32 paddingB[32 - 14]; /* offset 192 */ + uint32 width; /* 16 */ + uint32 height; /* 17 */ + uint32 rdp_version; /* 18 */ + uint32 color_depth; /* 19 */ + uint32 kbd_layout; /* 20 */ + uint32 kbd_type; /* 21 */ + uint32 kbd_subtype; /* 22 */ + uint32 kbd_fn_keys; /* 23 */ + uint32 client_build; /* 24 */ + uint32 requested_protocols; /* 25 */ + uint32 selected_protocol; /* 26 */ + uint32 encryption_method; /* 27 */ + uint32 encryption_level; /* 28 */ + boolean authentication; /* 29 */ + uint32 paddingB[48 - 30]; /* 30 */ /* Connection Settings */ - uint32 port; - boolean ipv6; - char* hostname; - char* username; - char* password; - char* domain; - char* shell; - char* directory; - char* ip_address; - char* client_dir; - boolean autologon; - boolean compression; - uint32 performance_flags; - uint32 paddingC[32 - 21]; /* offset 320 */ + uint32 port; /* 48 */ + boolean ipv6; /* 49 */ + char* hostname; /* 50 */ + char* username; /* 51 */ + char* password; /* 52 */ + char* domain; /* 53 */ + char* shell; /* 54 */ + char* directory; /* 55 */ + char* ip_address; /* 56 */ + char* client_dir; /* 57 */ + boolean autologon; /* 58 */ + boolean compression; /* 59 */ + uint32 performance_flags; /* 60 */ + uint32 paddingC[80 - 61]; /* 61 */ /* User Interface Parameters */ - boolean sw_gdi; - boolean workarea; - boolean fullscreen; - boolean grab_keyboard; - boolean decorations; - uint32 percent_screen; - boolean mouse_motion; - uint32 paddingD[32 - 7]; /* offset 448 */ + boolean sw_gdi; /* 80 */ + boolean workarea; /* 81 */ + boolean fullscreen; /* 82 */ + boolean grab_keyboard; /* 83 */ + boolean decorations; /* 84 */ + uint32 percent_screen; /* 85 */ + boolean mouse_motion; /* 86 */ + uint32 paddingD[112 - 87]; /* 87 */ /* Internal Parameters */ - char* home_path; - uint32 share_id; - uint32 pdu_source; - UNICONV* uniconv; - boolean server_mode; - uint32 paddingE[32 - 7]; /* offset 576 */ - - /* Session */ - boolean console_audio; - boolean console_session; - uint32 redirected_session_id; + char* home_path; /* 112 */ + uint32 share_id; /* 113 */ + uint32 pdu_source; /* 114 */ + UNICONV* uniconv; /* 115 */ + boolean server_mode; /* 116 */ + uint32 paddingE[144 - 117]; /* 117 */ /* Security */ - boolean encryption; - boolean tls_security; - boolean nla_security; - boolean rdp_security; + boolean encryption; /* 144 */ + boolean tls_security; /* 145 */ + boolean nla_security; /* 146 */ + boolean rdp_security; /* 147 */ + uint32 paddingF[160 - 148]; /* 148 */ + + /* Session */ + boolean console_audio; /* 160 */ + boolean console_session; /* 161 */ + uint32 redirected_session_id; /* 162 */ + uint32 paddingG[176 - 163]; /* 163 */ + + /* Output Control */ + boolean refresh_rect; /* 176 */ + boolean suppress_output; /* 177 */ + boolean desktop_resize; /* 178 */ + uint32 paddingH[192 - 179]; /* 179 */ - /* Reconnection */ boolean auto_reconnection; ARC_CS_PRIVATE_PACKET client_auto_reconnect_cookie; ARC_SC_PRIVATE_PACKET server_auto_reconnect_cookie; - /* Output Control */ - boolean refresh_rect; - boolean suppress_output; - boolean desktop_resize; - /* Time Zone */ TIME_ZONE_INFO client_time_zone; diff --git a/include/freerdp/update.h b/include/freerdp/update.h index 9a492fdf6..94faff649 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -1140,92 +1140,92 @@ typedef void (*pSurfaceCommand)(rdpUpdate* update, STREAM* s); struct rdp_update { - rdpContext* context; - uint32 paddingA[16 - 1]; /* offset 64 */ + rdpContext* context; /* 0 */ + uint32 paddingA[16 - 1]; /* 1 */ - pBeginPaint BeginPaint; - pEndPaint EndPaint; - pSetBounds SetBounds; - pSynchronize Synchronize; - pDesktopResize DesktopResize; - pBitmapUpdate BitmapUpdate; - pPalette Palette; - pPlaySound PlaySound; - uint32 paddingB[16 - 8]; /* offset 128 */ + pBeginPaint BeginPaint; /* 16 */ + pEndPaint EndPaint; /* 17 */ + pSetBounds SetBounds; /* 18 */ + pSynchronize Synchronize; /* 19 */ + pDesktopResize DesktopResize; /* 20 */ + pBitmapUpdate BitmapUpdate; /* 21 */ + pPalette Palette; /* 22 */ + pPlaySound PlaySound; /* 23 */ + uint32 paddingB[32 - 24]; /* 24 */ - pPointerPosition PointerPosition; - pPointerSystem PointerSystem; - pPointerColor PointerColor; - pPointerNew PointerNew; - pPointerCached PointerCached; - uint32 paddingC[16 - 5]; /* offset 192 */ + pPointerPosition PointerPosition; /* 32 */ + pPointerSystem PointerSystem; /* 33 */ + pPointerColor PointerColor; /* 34 */ + pPointerNew PointerNew; /* 35 */ + pPointerCached PointerCached; /* 36 */ + uint32 paddingC[48 - 37]; /* 37 */ - pDstBlt DstBlt; - pPatBlt PatBlt; - pScrBlt ScrBlt; - pOpaqueRect OpaqueRect; - pDrawNineGrid DrawNineGrid; - pMultiDstBlt MultiDstBlt; - pMultiPatBlt MultiPatBlt; - pMultiScrBlt MultiScrBlt; - pMultiOpaqueRect MultiOpaqueRect; - pMultiDrawNineGrid MultiDrawNineGrid; - pLineTo LineTo; - pPolyline Polyline; - pMemBlt MemBlt; - pMem3Blt Mem3Blt; - pSaveBitmap SaveBitmap; - pGlyphIndex GlyphIndex; - pFastIndex FastIndex; - pFastGlyph FastGlyph; - pPolygonSC PolygonSC; - pPolygonCB PolygonCB; - pEllipseSC EllipseSC; - pEllipseCB EllipseCB; - uint32 paddingD[32 - 22]; /* offset 320 */ + pDstBlt DstBlt; /* 48 */ + pPatBlt PatBlt; /* 49 */ + pScrBlt ScrBlt; /* 50 */ + pOpaqueRect OpaqueRect; /* 51 */ + pDrawNineGrid DrawNineGrid; /* 52 */ + pMultiDstBlt MultiDstBlt; /* 53 */ + pMultiPatBlt MultiPatBlt; /* 54 */ + pMultiScrBlt MultiScrBlt; /* 55 */ + pMultiOpaqueRect MultiOpaqueRect; /* 56 */ + pMultiDrawNineGrid MultiDrawNineGrid; /* 57 */ + pLineTo LineTo; /* 58 */ + pPolyline Polyline; /* 59 */ + pMemBlt MemBlt; /* 60 */ + pMem3Blt Mem3Blt; /* 61 */ + pSaveBitmap SaveBitmap; /* 62 */ + pGlyphIndex GlyphIndex; /* 63 */ + pFastIndex FastIndex; /* 64 */ + pFastGlyph FastGlyph; /* 65 */ + pPolygonSC PolygonSC; /* 66 */ + pPolygonCB PolygonCB; /* 67 */ + pEllipseSC EllipseSC; /* 68 */ + pEllipseCB EllipseCB; /* 69 */ + uint32 paddingD[80 - 70]; /* 70 */ - pCacheBitmap CacheBitmap; - pCacheBitmapV2 CacheBitmapV2; - pCacheBitmapV3 CacheBitmapV3; - pCacheColorTable CacheColorTable; - pCacheGlyph CacheGlyph; - pCacheGlyphV2 CacheGlyphV2; - pCacheBrush CacheBrush; - uint32 paddingE[32 - 7]; /* offset 448 */ + pCacheBitmap CacheBitmap; /* 80 */ + pCacheBitmapV2 CacheBitmapV2; /* 81 */ + pCacheBitmapV3 CacheBitmapV3; /* 82 */ + pCacheColorTable CacheColorTable; /* 83 */ + pCacheGlyph CacheGlyph; /* 84 */ + pCacheGlyphV2 CacheGlyphV2; /* 85 */ + pCacheBrush CacheBrush; /* 86 */ + uint32 paddingE[112 - 87]; /* 87 */ - pCreateOffscreenBitmap CreateOffscreenBitmap; - pSwitchSurface SwitchSurface; - pCreateNineGridBitmap CreateNineGridBitmap; - pFrameMarker FrameMarker; - pStreamBitmapFirst StreamBitmapFirst; - pStreamBitmapNext StreamBitmapNext; - pDrawGdiPlusFirst DrawGdiPlusFirst; - pDrawGdiPlusNext DrawGdiPlusNext; - pDrawGdiPlusEnd DrawGdiPlusEnd; - pDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst; - pDrawGdiPlusCacheNext DrawGdiPlusCacheNext; - pDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd; - uint32 paddingF[32 - 12]; /* offset 576 */ + pCreateOffscreenBitmap CreateOffscreenBitmap; /* 112 */ + pSwitchSurface SwitchSurface; /* 113 */ + pCreateNineGridBitmap CreateNineGridBitmap; /* 114 */ + pFrameMarker FrameMarker; /* 115 */ + pStreamBitmapFirst StreamBitmapFirst; /* 116 */ + pStreamBitmapNext StreamBitmapNext; /* 117 */ + pDrawGdiPlusFirst DrawGdiPlusFirst; /* 118 */ + pDrawGdiPlusNext DrawGdiPlusNext; /* 119 */ + pDrawGdiPlusEnd DrawGdiPlusEnd; /* 120 */ + pDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst; /* 121 */ + pDrawGdiPlusCacheNext DrawGdiPlusCacheNext; /* 122 */ + pDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd; /* 123 */ + uint32 paddingF[144 - 124]; /* 124 */ - pWindowCreate WindowCreate; - pWindowUpdate WindowUpdate; - pWindowIcon WindowIcon; - pWindowCachedIcon WindowCachedIcon; - pWindowDelete WindowDelete; - pNotifyIconCreate NotifyIconCreate; - pNotifyIconUpdate NotifyIconUpdate; - pNotifyIconDelete NotifyIconDelete; - pMonitoredDesktop MonitoredDesktop; - pNonMonitoredDesktop NonMonitoredDesktop; - uint32 paddingG[32 - 10]; /* offset 704 */ + pWindowCreate WindowCreate; /* 144 */ + pWindowUpdate WindowUpdate; /* 145 */ + pWindowIcon WindowIcon; /* 146 */ + pWindowCachedIcon WindowCachedIcon; /* 147 */ + pWindowDelete WindowDelete; /* 148 */ + pNotifyIconCreate NotifyIconCreate; /* 149 */ + pNotifyIconUpdate NotifyIconUpdate; /* 150 */ + pNotifyIconDelete NotifyIconDelete; /* 151 */ + pMonitoredDesktop MonitoredDesktop; /* 152 */ + pNonMonitoredDesktop NonMonitoredDesktop; /* 153 */ + uint32 paddingG[176 - 154]; /* 154 */ - pRefreshRect RefreshRect; - pSuppressOutput SuppressOutput; - uint32 paddingH[16 - 2]; /* offset 768 */ + pRefreshRect RefreshRect; /* 176 */ + pSuppressOutput SuppressOutput; /* 177 */ + uint32 paddingH[192 - 178]; /* 178 */ - pSurfaceBits SurfaceBits; - pSurfaceCommand SurfaceCommand; - uint32 paddingI[16 - 2]; /* offset 832 */ + pSurfaceBits SurfaceBits; /* 192 */ + pSurfaceCommand SurfaceCommand; /* 193 */ + uint32 paddingI[208 - 194]; /* 194 */ /* everything below is internal, and should not be directly accessed */