From 0d9e65ea06533a0e3156cd146b149cbb55e49ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Mon, 2 Apr 2012 20:38:58 -0400 Subject: [PATCH] libfreerdp-core: align rdpSettings structure to 8 bytes --- include/freerdp/settings.h | 320 +++++++++++++++++++------------------ libfreerdp-core/settings.c | 10 ++ 2 files changed, 171 insertions(+), 159 deletions(-) diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 6b70a3dde..c992bfc2d 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -238,215 +238,217 @@ struct rdp_monitor /* Settings */ +#define ALIGN64 __attribute__((aligned(8))) + struct rdp_settings { - void* instance; /* 0 */ - uint32 paddingA[16 - 1]; /* 1 */ + ALIGN64 void* instance; /* 0 */ + ALIGN64 uint64 paddingA[16 - 1]; /* 1 */ /* Core Protocol Parameters */ - 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 negotiationFlags; /* 30 */ - uint32 paddingB[48 - 31]; /* 31 */ + ALIGN64 uint32 width; /* 16 */ + ALIGN64 uint32 height; /* 17 */ + ALIGN64 uint32 rdp_version; /* 18 */ + ALIGN64 uint32 color_depth; /* 19 */ + ALIGN64 uint32 kbd_layout; /* 20 */ + ALIGN64 uint32 kbd_type; /* 21 */ + ALIGN64 uint32 kbd_subtype; /* 22 */ + ALIGN64 uint32 kbd_fn_keys; /* 23 */ + ALIGN64 uint32 client_build; /* 24 */ + ALIGN64 uint32 requested_protocols; /* 25 */ + ALIGN64 uint32 selected_protocol; /* 26 */ + ALIGN64 uint32 encryption_method; /* 27 */ + ALIGN64 uint32 encryption_level; /* 28 */ + ALIGN64 boolean authentication; /* 29 */ + ALIGN64 uint32 negotiationFlags; /* 30 */ + ALIGN64 uint64 paddingB[48 - 31]; /* 31 */ /* Connection Settings */ - 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 */ - rdpBlob* password_cookie; /* 61 */ - char* kerberos_kdc; /* 62 */ - char* kerberos_realm; /* 63 */ - uint32 paddingC[80 - 64]; /* 64 */ + ALIGN64 uint32 port; /* 48 */ + ALIGN64 boolean ipv6; /* 49 */ + ALIGN64 char* hostname; /* 50 */ + ALIGN64 char* username; /* 51 */ + ALIGN64 char* password; /* 52 */ + ALIGN64 char* domain; /* 53 */ + ALIGN64 char* shell; /* 54 */ + ALIGN64 char* directory; /* 55 */ + ALIGN64 char* ip_address; /* 56 */ + ALIGN64 char* client_dir; /* 57 */ + ALIGN64 boolean autologon; /* 58 */ + ALIGN64 boolean compression; /* 59 */ + ALIGN64 uint32 performance_flags; /* 60 */ + ALIGN64 rdpBlob* password_cookie; /* 61 */ + ALIGN64 char* kerberos_kdc; /* 62 */ + ALIGN64 char* kerberos_realm; /* 63 */ + ALIGN64 uint64 paddingC[80 - 64]; /* 64 */ /* User Interface Parameters */ - 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 */ - char* window_title; /* 87 */ - uint64 parent_window_xid; /* 88 */ - uint32 paddingD[112 - 89]; /* 89 */ + ALIGN64 boolean sw_gdi; /* 80 */ + ALIGN64 boolean workarea; /* 81 */ + ALIGN64 boolean fullscreen; /* 82 */ + ALIGN64 boolean grab_keyboard; /* 83 */ + ALIGN64 boolean decorations; /* 84 */ + ALIGN64 uint32 percent_screen; /* 85 */ + ALIGN64 boolean mouse_motion; /* 86 */ + ALIGN64 char* window_title; /* 87 */ + ALIGN64 uint64 parent_window_xid; /* 88 */ + ALIGN64 uint64 paddingD[112 - 89]; /* 89 */ /* Internal Parameters */ - char* home_path; /* 112 */ - uint32 share_id; /* 113 */ - uint32 pdu_source; /* 114 */ - UNICONV* uniconv; /* 115 */ - boolean server_mode; /* 116 */ - char* config_path; /* 117 */ - char* current_path; /* 118 */ - char* development_path; /* 119 */ - boolean development_mode; /* 120 */ - uint32 paddingE[144 - 121]; /* 121 */ + ALIGN64 char* home_path; /* 112 */ + ALIGN64 uint32 share_id; /* 113 */ + ALIGN64 uint32 pdu_source; /* 114 */ + ALIGN64 UNICONV* uniconv; /* 115 */ + ALIGN64 boolean server_mode; /* 116 */ + ALIGN64 char* config_path; /* 117 */ + ALIGN64 char* current_path; /* 118 */ + ALIGN64 char* development_path; /* 119 */ + ALIGN64 boolean development_mode; /* 120 */ + ALIGN64 uint64 paddingE[144 - 121]; /* 121 */ /* Security */ - boolean encryption; /* 144 */ - boolean tls_security; /* 145 */ - boolean nla_security; /* 146 */ - boolean rdp_security; /* 147 */ - uint32 ntlm_version; /* 148 */ - boolean salted_checksum; /* 149 */ - uint32 paddingF[160 - 150]; /* 150 */ + ALIGN64 boolean encryption; /* 144 */ + ALIGN64 boolean tls_security; /* 145 */ + ALIGN64 boolean nla_security; /* 146 */ + ALIGN64 boolean rdp_security; /* 147 */ + ALIGN64 uint32 ntlm_version; /* 148 */ + ALIGN64 boolean salted_checksum; /* 149 */ + ALIGN64 uint64 paddingF[160 - 150]; /* 150 */ /* Session */ - boolean console_audio; /* 160 */ - boolean console_session; /* 161 */ - uint32 redirected_session_id; /* 162 */ - boolean audio_playback; /* 163 */ - boolean audio_capture; /* 164 */ - uint32 paddingG[176 - 165]; /* 165 */ + ALIGN64 boolean console_audio; /* 160 */ + ALIGN64 boolean console_session; /* 161 */ + ALIGN64 uint32 redirected_session_id; /* 162 */ + ALIGN64 boolean audio_playback; /* 163 */ + ALIGN64 boolean audio_capture; /* 164 */ + ALIGN64 uint64 paddingG[176 - 165]; /* 165 */ /* Output Control */ - boolean refresh_rect; /* 176 */ - boolean suppress_output; /* 177 */ - boolean desktop_resize; /* 178 */ - uint32 paddingH[192 - 179]; /* 179 */ + ALIGN64 boolean refresh_rect; /* 176 */ + ALIGN64 boolean suppress_output; /* 177 */ + ALIGN64 boolean desktop_resize; /* 178 */ + ALIGN64 uint64 paddingH[192 - 179]; /* 179 */ /* Reconnection */ - boolean auto_reconnection; /* 192 */ - ARC_CS_PRIVATE_PACKET* client_auto_reconnect_cookie; /* 193 */ - ARC_SC_PRIVATE_PACKET* server_auto_reconnect_cookie; /* 194 */ - uint32 paddingI[208 - 195]; /* 195 */ + ALIGN64 boolean auto_reconnection; /* 192 */ + ALIGN64 ARC_CS_PRIVATE_PACKET* client_auto_reconnect_cookie; /* 193 */ + ALIGN64 ARC_SC_PRIVATE_PACKET* server_auto_reconnect_cookie; /* 194 */ + ALIGN64 uint64 paddingI[208 - 195]; /* 195 */ /* Time Zone */ - TIME_ZONE_INFO* client_time_zone; /* 208 */ - uint32 paddingJ[216 - 209]; /* 209 */ + ALIGN64 TIME_ZONE_INFO* client_time_zone; /* 208 */ + ALIGN64 uint64 paddingJ[216 - 209]; /* 209 */ /* Capabilities */ - uint32 os_major_type; /* 216 */ - uint32 os_minor_type; /* 217 */ - uint32 vc_chunk_size; /* 218 */ - boolean sound_beeps; /* 219 */ - boolean smooth_fonts; /* 220 */ - boolean frame_marker; /* 221 */ - boolean fastpath_input; /* 222 */ - boolean fastpath_output; /* 223 */ - uint8 received_caps[32]; /* 224 (8) */ - uint8 order_support[32]; /* 232 (8) */ - boolean surface_commands; /* 240 */ - boolean disable_wallpaper; /* 241 */ - boolean disable_full_window_drag; /* 242 */ - boolean disable_menu_animations; /* 243 */ - boolean disable_theming; /* 244 */ - uint32 connection_type; /* 245 */ - uint32 multifrag_max_request_size; /* 246 */ - uint32 paddingK[248 - 247]; /* 247 */ + ALIGN64 uint32 os_major_type; /* 216 */ + ALIGN64 uint32 os_minor_type; /* 217 */ + ALIGN64 uint32 vc_chunk_size; /* 218 */ + ALIGN64 boolean sound_beeps; /* 219 */ + ALIGN64 boolean smooth_fonts; /* 220 */ + ALIGN64 boolean frame_marker; /* 221 */ + ALIGN64 boolean fastpath_input; /* 222 */ + ALIGN64 boolean fastpath_output; /* 223 */ + ALIGN64 uint8* received_caps; /* 224 */ + ALIGN64 uint8* order_support; /* 225 */ + ALIGN64 boolean surface_commands; /* 226 */ + ALIGN64 boolean disable_wallpaper; /* 227 */ + ALIGN64 boolean disable_full_window_drag; /* 228 */ + ALIGN64 boolean disable_menu_animations; /* 229 */ + ALIGN64 boolean disable_theming; /* 230 */ + ALIGN64 uint32 connection_type; /* 231 */ + ALIGN64 uint32 multifrag_max_request_size; /* 232 */ + ALIGN64 uint64 paddingK[248 - 233]; /* 233 */ /* Certificate */ - char* cert_file; /* 248 */ - char* privatekey_file; /* 249 */ - char client_hostname[32]; /* 250 (8) */ - char client_product_id[32]; /* 258 (8) */ - rdpBlob* server_random; /* 266 */ - rdpBlob* server_certificate; /* 267 */ - boolean ignore_certificate; /* 268 */ - rdpCertificate* server_cert; /* 269 */ - char* rdp_key_file; /* 270 */ - rdpKey* server_key; /* 271 */ - char* certificate_name; /* 272 */ - uint32 paddingL[280 - 273]; /* 273 */ + ALIGN64 char* cert_file; /* 248 */ + ALIGN64 char* privatekey_file; /* 249 */ + ALIGN64 char* client_hostname; /* 250 */ + ALIGN64 char* client_product_id; /* 251 */ + ALIGN64 rdpBlob* server_random; /* 252 */ + ALIGN64 rdpBlob* server_certificate; /* 253 */ + ALIGN64 boolean ignore_certificate; /* 254 */ + ALIGN64 rdpCertificate* server_cert; /* 255 */ + ALIGN64 char* rdp_key_file; /* 256 */ + ALIGN64 rdpKey* server_key; /* 257 */ + ALIGN64 char* certificate_name; /* 258 */ + ALIGN64 uint64 paddingL[280 - 259]; /* 259 */ /* Codecs */ - boolean rfx_codec; /* 280 */ - boolean ns_codec; /* 281 */ - uint32 rfx_codec_id; /* 282 */ - uint32 ns_codec_id; /* 283 */ - uint32 rfx_codec_mode; /* 284 */ - boolean frame_acknowledge; /* 285 */ - uint32 paddingM[296 - 286]; /* 286 */ + ALIGN64 boolean rfx_codec; /* 280 */ + ALIGN64 boolean ns_codec; /* 281 */ + ALIGN64 uint32 rfx_codec_id; /* 282 */ + ALIGN64 uint32 ns_codec_id; /* 283 */ + ALIGN64 uint32 rfx_codec_mode; /* 284 */ + ALIGN64 boolean frame_acknowledge; /* 285 */ + ALIGN64 uint64 paddingM[296 - 286]; /* 286 */ /* Recording */ - boolean dump_rfx; /* 296 */ - boolean play_rfx; /* 297 */ - char* dump_rfx_file; /* 298 */ - char* play_rfx_file; /* 299 */ - uint32 paddingN[312 - 300]; /* 300 */ + ALIGN64 boolean dump_rfx; /* 296 */ + ALIGN64 boolean play_rfx; /* 297 */ + ALIGN64 char* dump_rfx_file; /* 298 */ + ALIGN64 char* play_rfx_file; /* 299 */ + ALIGN64 uint64 paddingN[312 - 300]; /* 300 */ /* RemoteApp */ - boolean remote_app; /* 312 */ - uint32 num_icon_caches; /* 313 */ - uint32 num_icon_cache_entries; /* 314 */ - boolean rail_langbar_supported; /* 315 */ - uint32 paddingO[320 - 316]; /* 316 */ + ALIGN64 boolean remote_app; /* 312 */ + ALIGN64 uint32 num_icon_caches; /* 313 */ + ALIGN64 uint32 num_icon_cache_entries; /* 314 */ + ALIGN64 boolean rail_langbar_supported; /* 315 */ + ALIGN64 uint64 paddingO[320 - 316]; /* 316 */ /* Pointer */ - boolean large_pointer; /* 320 */ - boolean color_pointer; /* 321 */ - uint32 pointer_cache_size; /* 322 */ - uint32 paddingP[328 - 323]; /* 323 */ + ALIGN64 boolean large_pointer; /* 320 */ + ALIGN64 boolean color_pointer; /* 321 */ + ALIGN64 uint32 pointer_cache_size; /* 322 */ + ALIGN64 uint64 paddingP[328 - 323]; /* 323 */ /* Bitmap Cache */ - boolean bitmap_cache; /* 328 */ - boolean bitmap_cache_v3; /* 329 */ - boolean persistent_bitmap_cache; /* 330 */ - uint32 bitmapCacheV2NumCells; /* 331 */ - BITMAP_CACHE_V2_CELL_INFO* bitmapCacheV2CellInfo; /* 332 */ - uint32 paddingQ[344 - 333]; /* 333 */ + ALIGN64 boolean bitmap_cache; /* 328 */ + ALIGN64 boolean bitmap_cache_v3; /* 329 */ + ALIGN64 boolean persistent_bitmap_cache; /* 330 */ + ALIGN64 uint32 bitmapCacheV2NumCells; /* 331 */ + ALIGN64 BITMAP_CACHE_V2_CELL_INFO* bitmapCacheV2CellInfo; /* 332 */ + ALIGN64 uint64 paddingQ[344 - 333]; /* 333 */ /* Offscreen Bitmap Cache */ - boolean offscreen_bitmap_cache; /* 344 */ - uint32 offscreen_bitmap_cache_size; /* 345 */ - uint32 offscreen_bitmap_cache_entries; /* 346 */ - uint32 paddingR[352 - 347]; /* 347 */ + ALIGN64 boolean offscreen_bitmap_cache; /* 344 */ + ALIGN64 uint32 offscreen_bitmap_cache_size; /* 345 */ + ALIGN64 uint32 offscreen_bitmap_cache_entries; /* 346 */ + ALIGN64 uint64 paddingR[352 - 347]; /* 347 */ /* Glyph Cache */ - boolean glyph_cache; /* 352 */ - uint32 glyphSupportLevel; /* 353 */ - GLYPH_CACHE_DEFINITION* glyphCache; /* 354 */ - GLYPH_CACHE_DEFINITION* fragCache; /* 355 */ - uint32 paddingS[360 - 356]; /* 356 */ + ALIGN64 boolean glyph_cache; /* 352 */ + ALIGN64 uint32 glyphSupportLevel; /* 353 */ + ALIGN64 GLYPH_CACHE_DEFINITION* glyphCache; /* 354 */ + ALIGN64 GLYPH_CACHE_DEFINITION* fragCache; /* 355 */ + ALIGN64 uint64 paddingS[360 - 356]; /* 356 */ /* Draw Nine Grid */ - boolean draw_nine_grid; /* 360 */ - uint32 draw_nine_grid_cache_size; /* 361 */ - uint32 draw_nine_grid_cache_entries; /* 362 */ - uint32 paddingT[368 - 363]; /* 363 */ + ALIGN64 boolean draw_nine_grid; /* 360 */ + ALIGN64 uint32 draw_nine_grid_cache_size; /* 361 */ + ALIGN64 uint32 draw_nine_grid_cache_entries; /* 362 */ + ALIGN64 uint64 paddingT[368 - 363]; /* 363 */ /* Draw GDI+ */ - boolean draw_gdi_plus; /* 368 */ - boolean draw_gdi_plus_cache; /* 369 */ - uint32 paddingU[376 - 370]; /* 370 */ + ALIGN64 boolean draw_gdi_plus; /* 368 */ + ALIGN64 boolean draw_gdi_plus_cache; /* 369 */ + ALIGN64 uint64 paddingU[376 - 370]; /* 370 */ /* Desktop Composition */ - boolean desktop_composition; /* 376 */ - uint32 paddingV[384 - 377]; /* 377 */ + ALIGN64 boolean desktop_composition; /* 376 */ + ALIGN64 uint64 paddingV[384 - 377]; /* 377 */ /* Channels */ - int num_channels; - rdpChannel channels[16]; + ALIGN64 int num_channels; + ALIGN64 rdpChannel channels[16]; /* Monitors */ - int num_monitors; - struct rdp_monitor monitors[16]; + ALIGN64 int num_monitors; + ALIGN64 struct rdp_monitor monitors[16]; /* Extensions */ - int num_extensions; - struct rdp_ext_set extensions[16]; + ALIGN64 int num_extensions; + ALIGN64 struct rdp_ext_set extensions[16]; }; typedef struct rdp_settings rdpSettings; diff --git a/libfreerdp-core/settings.c b/libfreerdp-core/settings.c index 17c82c651..306f86d1f 100644 --- a/libfreerdp-core/settings.c +++ b/libfreerdp-core/settings.c @@ -74,6 +74,9 @@ rdpSettings* settings_new(void* instance) settings->authentication = true; + settings->received_caps = xzalloc(32); + settings->order_support = xzalloc(32); + settings->order_support[NEG_DSTBLT_INDEX] = true; settings->order_support[NEG_PATBLT_INDEX] = true; settings->order_support[NEG_SCRBLT_INDEX] = true; @@ -97,6 +100,9 @@ rdpSettings* settings_new(void* instance) settings->order_support[NEG_ELLIPSE_SC_INDEX] = true; settings->order_support[NEG_ELLIPSE_CB_INDEX] = true; + settings->client_hostname = xzalloc(32); + settings->client_product_id = xzalloc(32); + settings->color_pointer = true; settings->large_pointer = true; settings->pointer_cache_size = 20; @@ -197,6 +203,10 @@ void settings_free(rdpSettings* settings) xfree(settings->client_dir); xfree(settings->cert_file); xfree(settings->privatekey_file); + xfree(settings->received_caps); + xfree(settings->order_support); + xfree(settings->client_hostname); + xfree(settings->client_product_id); freerdp_blob_free(settings->server_random); freerdp_blob_free(settings->server_certificate); xfree(settings->server_random);