-- v2: win32u: Read window dpi_context from the shared memory. win32u: Pass id and offset separately to find_shared_session_object. server: Move window dpi_context to the shared memory. server: Allocate shared memory objects for windows. server: Fix shared object offset when additional blocks are allocated.
From: Rémi Bernon rbernon@codeweavers.com
The shared object offset is an absolute offset from the start of the session shared memory file, as it is used to identify the corresponding mmapped block on the client side. --- server/mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/mapping.c b/server/mapping.c index 83538831ea2..f681704bec9 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -1394,7 +1394,7 @@ volatile void *alloc_shared_object(void)
if (!(block = find_free_session_block( size ))) return NULL; object = (struct session_object *)(block->data + block->used_size); - object->offset = (char *)&object->obj - block->data; + object->offset = block->offset + (char *)&object->obj - block->data; block->used_size += size; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 2 +- include/ntuser.h | 2 +- server/hook.c | 2 +- server/protocol.def | 6 ++++++ server/user.c | 14 ++++++++------ server/user.h | 2 +- server/window.c | 14 +++++++++++++- 7 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 3b3a3ba5eac..6937809f3d0 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -97,7 +97,7 @@ static BOOL read_acquire_user_entry( HANDLE handle, unsigned short type, const v dst->offset = src->offset; dst->tid = src->tid; dst->pid = src->pid; - dst->padding = src->padding; + dst->id = src->id; __SHARED_READ_FENCE; dst->uniq = ReadNoFence64( &src->uniq ); return dst->uniq == uniq; diff --git a/include/ntuser.h b/include/ntuser.h index 0647efe7082..d2b655a63a6 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -51,7 +51,7 @@ struct user_entry ULONG64 offset; /* shared user object offset */ ULONG tid; /* owner thread id */ ULONG pid; /* owner process id */ - ULONG64 padding; + ULONG64 id; /* shared user object id */ union { struct diff --git a/server/hook.c b/server/hook.c index bf2ad266e76..4c55c565968 100644 --- a/server/hook.c +++ b/server/hook.c @@ -153,7 +153,7 @@ static struct hook *add_hook( struct desktop *desktop, struct process *process, } if (!(hook = mem_alloc( sizeof(*hook) ))) return NULL;
- if (!(hook->handle = alloc_user_handle( hook, NTUSER_OBJ_HOOK ))) + if (!(hook->handle = alloc_user_handle( hook, NULL, NTUSER_OBJ_HOOK ))) { free( hook ); return NULL; diff --git a/server/protocol.def b/server/protocol.def index 26c411d0c62..bdd3c526890 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1009,11 +1009,17 @@ typedef volatile struct int keystate_lock; /* keystate is locked */ } input_shm_t;
+typedef volatile struct +{ + int placeholder; +} window_shm_t; + typedef volatile union { desktop_shm_t desktop; queue_shm_t queue; input_shm_t input; + window_shm_t window; } object_shm_t;
typedef volatile struct diff --git a/server/user.c b/server/user.c index d4ce8194cee..a4a06455275 100644 --- a/server/user.c +++ b/server/user.c @@ -73,7 +73,7 @@ static user_handle_t entry_to_handle( const user_entry_t *entry ) return (index << 1) + FIRST_USER_HANDLE + (entry->generation << 16); }
-static const user_entry_t *alloc_user_entry( unsigned short type ) +static const user_entry_t *alloc_user_entry( struct obj_locator locator, unsigned short type ) { user_entry_t *entry, *handles = shared_session->user_entries; unsigned short generation; @@ -93,10 +93,10 @@ static const user_entry_t *alloc_user_entry( unsigned short type )
if (generation == 0 || generation == 0xffff) generation = 1;
- entry->offset = -1; + entry->offset = locator.offset; entry->tid = get_thread_id( current ); entry->pid = get_process_id( current->process ); - entry->padding = -1; + entry->id = locator.id; WriteRelease64( &entry->uniq, MAKELONG(type, generation) ); return entry; } @@ -112,11 +112,13 @@ static void free_user_entry( user_entry_t *entry ) }
/* allocate a user handle for a given object */ -user_handle_t alloc_user_handle( void *ptr, unsigned short type ) +user_handle_t alloc_user_handle( void *ptr, volatile void *shared, unsigned short type ) { + struct obj_locator locator = {0}; const user_entry_t *entry;
- if (!(entry = alloc_user_entry( type ))) return 0; + if (shared) locator = get_shared_object_locator( shared ); + if (!(entry = alloc_user_entry( locator, type ))) return 0; set_server_object( entry, ptr ); return entry_to_handle( entry ); } @@ -220,7 +222,7 @@ void free_process_user_handles( struct process *process ) /* allocate an arbitrary user handle */ DECL_HANDLER(alloc_user_handle) { - reply->handle = alloc_user_handle( (void *)-1 /* never used */, req->type ); + reply->handle = alloc_user_handle( (void *)-1 /* never used */, NULL, req->type ); }
diff --git a/server/user.h b/server/user.h index 50b275e4eb2..ee0042b8755 100644 --- a/server/user.h +++ b/server/user.h @@ -90,7 +90,7 @@ struct desktop
/* user handles functions */
-extern user_handle_t alloc_user_handle( void *ptr, unsigned short type ); +extern user_handle_t alloc_user_handle( void *ptr, volatile void *shared, unsigned short type ); extern void *get_user_object( user_handle_t handle, unsigned short type ); extern void *get_user_object_handle( user_handle_t *handle, unsigned short type ); extern user_handle_t get_user_full_handle( user_handle_t handle ); diff --git a/server/window.c b/server/window.c index 914d376a44a..8975714ecbc 100644 --- a/server/window.c +++ b/server/window.c @@ -30,6 +30,7 @@ #include "ntuser.h"
#include "object.h" +#include "file.h" #include "request.h" #include "thread.h" #include "process.h" @@ -94,6 +95,7 @@ struct window struct property *properties; /* window properties array */ int nb_extra_bytes; /* number of extra bytes */ char *extra_bytes; /* extra bytes storage */ + window_shm_t *shared; /* window in session shared memory */ };
static void window_dump( struct object *obj, int verbose ); @@ -180,6 +182,8 @@ static void window_destroy( struct object *obj ) memset( win->extra_bytes, 0x55, win->nb_extra_bytes ); free( win->extra_bytes ); } + + if (win->shared) free_shared_object( win->shared ); }
/* retrieve a pointer to a window from its handle */ @@ -662,17 +666,25 @@ static struct window *create_window( struct window *parent, struct window *owner win->properties = NULL; win->nb_extra_bytes = 0; win->extra_bytes = NULL; + win->shared = NULL; win->window_rect = win->visible_rect = win->surface_rect = win->client_rect = empty_rect; list_init( &win->children ); list_init( &win->unlinked );
+ if (!(win->shared = alloc_shared_object())) goto failed; + SHARED_WRITE_BEGIN( win->shared, window_shm_t ) + { + shared->placeholder = 0; + } + SHARED_WRITE_END; + if (extra_bytes) { if (!(win->extra_bytes = mem_alloc( extra_bytes ))) goto failed; memset( win->extra_bytes, 0, extra_bytes ); win->nb_extra_bytes = extra_bytes; } - if (!(win->handle = alloc_user_handle( win, NTUSER_OBJ_WINDOW ))) goto failed; + if (!(win->handle = alloc_user_handle( win, win->shared, NTUSER_OBJ_WINDOW ))) goto failed; win->last_active = win->handle;
/* if parent belongs to a different thread and the window isn't */
From: Rémi Bernon rbernon@codeweavers.com
--- server/protocol.def | 2 +- server/window.c | 36 +++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/server/protocol.def b/server/protocol.def index bdd3c526890..7ed53f618d3 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1011,7 +1011,7 @@ typedef volatile struct
typedef volatile struct { - int placeholder; + unsigned int dpi_context; /* DPI awareness context */ } window_shm_t;
typedef volatile union diff --git a/server/window.c b/server/window.c index 8975714ecbc..78245b93707 100644 --- a/server/window.c +++ b/server/window.c @@ -84,7 +84,6 @@ struct window unsigned int color_key; /* color key for a layered window */ unsigned int alpha; /* alpha value for a layered window */ unsigned int layered_flags; /* flags for a layered window */ - unsigned int dpi_context; /* DPI awareness context */ unsigned int monitor_dpi; /* DPI of the window monitor */ lparam_t user_data; /* user-specific data */ WCHAR *text; /* window caption text */ @@ -337,8 +336,8 @@ static unsigned int get_monitor_dpi( struct window *win )
static unsigned int get_window_dpi( struct window *win ) { - if (NTUSER_DPI_CONTEXT_IS_MONITOR_AWARE( win->dpi_context )) return get_monitor_dpi( win ); - return NTUSER_DPI_CONTEXT_GET_DPI( win->dpi_context ); + if (NTUSER_DPI_CONTEXT_IS_MONITOR_AWARE( win->shared->dpi_context )) return get_monitor_dpi( win ); + return NTUSER_DPI_CONTEXT_GET_DPI( win->shared->dpi_context ); }
/* link a window at the right place in the siblings list */ @@ -421,7 +420,14 @@ static int set_parent_window( struct window *win, struct window *parent ) win->parent = (struct window *)grab_object( parent ); link_window( win, WINPTR_TOP );
- if (!is_desktop_window( parent )) win->dpi_context = parent->dpi_context; + if (!is_desktop_window( parent )) + { + SHARED_WRITE_BEGIN( win->shared, window_shm_t ) + { + shared->dpi_context = parent->shared->dpi_context; + } + SHARED_WRITE_END; + }
/* if parent belongs to a different thread and the window isn't */ /* top-level, attach the two threads */ @@ -655,7 +661,6 @@ static struct window *create_window( struct window *parent, struct window *owner win->is_linked = 0; win->is_layered = 0; win->is_orphan = 0; - win->dpi_context = NTUSER_DPI_PER_MONITOR_AWARE; win->monitor_dpi = USER_DEFAULT_SCREEN_DPI; win->user_data = 0; win->text = NULL; @@ -674,7 +679,7 @@ static struct window *create_window( struct window *parent, struct window *owner if (!(win->shared = alloc_shared_object())) goto failed; SHARED_WRITE_BEGIN( win->shared, window_shm_t ) { - shared->placeholder = 0; + shared->dpi_context = NTUSER_DPI_PER_MONITOR_AWARE; } SHARED_WRITE_END;
@@ -2176,6 +2181,7 @@ DECL_HANDLER(create_window) { struct window *win, *parent = NULL, *owner = NULL; struct unicode_str cls_name = get_req_unicode_str(); + unsigned int dpi_context; atom_t atom;
reply->handle = 0; @@ -2209,9 +2215,17 @@ DECL_HANDLER(create_window) if (!(win = create_window( parent, owner, atom, req->instance ))) return;
if (parent && !is_desktop_window( parent )) - win->dpi_context = parent->dpi_context; + dpi_context = parent->shared->dpi_context; else if (!parent || !NTUSER_DPI_CONTEXT_IS_MONITOR_AWARE( req->dpi_context )) - win->dpi_context = req->dpi_context; + dpi_context = req->dpi_context; + else + dpi_context = win->shared->dpi_context; + + SHARED_WRITE_BEGIN( win->shared, window_shm_t ) + { + shared->dpi_context = dpi_context; + } + SHARED_WRITE_END;
win->style = req->style; win->ex_style = req->ex_style; @@ -2220,7 +2234,7 @@ DECL_HANDLER(create_window) reply->parent = win->parent ? win->parent->handle : 0; reply->owner = win->owner; reply->extra = win->nb_extra_bytes; - reply->dpi_context = win->dpi_context; + reply->dpi_context = win->shared->dpi_context; reply->class_ptr = get_class_client_ptr( win->class ); }
@@ -2241,7 +2255,7 @@ DECL_HANDLER(set_parent) reply->old_parent = win->parent->handle; reply->full_parent = parent ? parent->handle : 0; set_parent_window( win, parent ); - reply->dpi_context = win->dpi_context; + reply->dpi_context = win->shared->dpi_context; }
@@ -2335,7 +2349,7 @@ DECL_HANDLER(get_window_info)
reply->last_active = win->handle; reply->is_unicode = win->is_unicode; - reply->dpi_context = win->dpi_context; + reply->dpi_context = win->shared->dpi_context;
if (get_user_object( win->last_active, NTUSER_OBJ_WINDOW )) reply->last_active = win->last_active; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/winstation.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 766043ce282..2b04536d38f 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -173,17 +173,17 @@ static NTSTATUS find_shared_session_block( SIZE_T offset, SIZE_T size, struct se return status; }
-static const shared_object_t *find_shared_session_object( struct obj_locator locator ) +static const shared_object_t *find_shared_session_object( object_id_t id, mem_size_t offset ) { struct session_block *block = NULL; const shared_object_t *object; NTSTATUS status;
- if (locator.id && !(status = find_shared_session_block( locator.offset, sizeof(*object), &block ))) + if (id && !(status = find_shared_session_block( offset, sizeof(*object), &block ))) { - object = (const shared_object_t *)(block->data + locator.offset - block->offset); - if (locator.id == shared_object_get_id( object )) return object; - WARN( "Session object id doesn't match expected id %s\n", wine_dbgstr_longlong(locator.id) ); + object = (const shared_object_t *)(block->data + offset - block->offset); + if (id == shared_object_get_id( object )) return object; + WARN( "Session object id doesn't match expected id %s\n", wine_dbgstr_longlong(id) ); }
return NULL; @@ -219,7 +219,7 @@ NTSTATUS get_shared_desktop( struct object_lock *lock, const desktop_shm_t **des } SERVER_END_REQ;
- data->shared_desktop = find_shared_session_object( locator ); + data->shared_desktop = find_shared_session_object( locator.id, locator.offset ); if (!(object = data->shared_desktop)) return STATUS_INVALID_HANDLE; memset( lock, 0, sizeof(*lock) ); } @@ -253,7 +253,7 @@ NTSTATUS get_shared_queue( struct object_lock *lock, const queue_shm_t **queue_s } SERVER_END_REQ;
- data->shared_queue = find_shared_session_object( locator ); + data->shared_queue = find_shared_session_object( locator.id, locator.offset ); if (!(object = data->shared_queue)) return STATUS_INVALID_HANDLE; memset( lock, 0, sizeof(*lock) ); } @@ -288,7 +288,7 @@ static NTSTATUS try_get_shared_input( UINT tid, struct object_lock *lock, const SERVER_END_REQ;
cache->id = locator.id; - cache->object = find_shared_session_object( locator ); + cache->object = find_shared_session_object( locator.id, locator.offset ); if (!(object = cache->object)) return STATUS_INVALID_HANDLE; memset( lock, 0, sizeof(*lock) ); } @@ -566,7 +566,7 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle ) { struct user_thread_info *thread_info = get_user_thread_info(); struct session_thread_data *data = get_session_thread_data(); - data->shared_desktop = find_shared_session_object( locator ); + data->shared_desktop = find_shared_session_object( locator.id, locator.offset ); memset( &data->shared_foreground, 0, sizeof(data->shared_foreground) ); thread_info->client_info.top_window = 0; thread_info->client_info.msg_window = 0;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/ntuser_private.h | 1 - dlls/win32u/win32u_private.h | 4 ++ dlls/win32u/window.c | 110 +++++++++++++++++++---------------- dlls/win32u/winstation.c | 6 +- server/protocol.def | 3 - server/window.c | 3 - 6 files changed, 66 insertions(+), 61 deletions(-)
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 1e989771934..33b5cdc3b27 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -65,7 +65,6 @@ typedef struct tagWND HICON hIconSmall; /* window's small icon */ HICON hIconSmall2; /* window's secondary small icon, derived from hIcon */ HIMC imc; /* window's input context */ - UINT dpi_context; /* window DPI awareness context */ struct window_surface *surface; /* Window surface if any */ struct list vulkan_surfaces; /* list of vulkan surfaces created for this window */ struct tagDIALOGINFO *dlgInfo; /* Dialog additional info (dialogs only) */ diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index a7bee5bd93a..22a6ff1145c 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -219,6 +219,10 @@ struct object_lock #define __SHARED_READ_FENCE __atomic_thread_fence( __ATOMIC_ACQUIRE ) #endif
+extern const shared_object_t *find_shared_session_object( object_id_t id, mem_size_t offset ); +extern void shared_object_acquire_seqlock( const shared_object_t *object, UINT64 *seq ); +extern BOOL shared_object_release_seqlock( const shared_object_t *object, UINT64 seq ); + /* Get shared session object's data pointer, must be called in a loop while STATUS_PENDING * is returned, lock must be initialized with OBJECT_LOCK_INIT. * diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 6937809f3d0..ca1d8e864a0 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -123,6 +123,55 @@ static BOOL get_user_entry_at( WORD index, unsigned short type, struct user_entr return TRUE; }
+static NTSTATUS try_get_user_object_shm( HANDLE handle, unsigned int type, struct object_lock *lock, + const object_shm_t **object_shm ) +{ + const shared_object_t *object; + UINT status = STATUS_SUCCESS; + BOOL valid = TRUE; + + if (lock->id) + { + assert( *object_shm != NULL ); + object = CONTAINING_RECORD( *object_shm, shared_object_t, shm ); + /* check object validity by comparing ids, within the object seqlock */ + valid = lock->id == object->id; + } + else + { + struct user_entry entry; + + if (!get_user_entry( handle, type, &entry, &handle )) object = NULL; + else object = find_shared_session_object( entry.id, entry.offset ); + + if (!object) status = STATUS_INVALID_HANDLE; + } + + if (!status && (!lock->id || !shared_object_release_seqlock( object, lock->seq ))) + { + shared_object_acquire_seqlock( object, &lock->seq ); + if (!(lock->id = object->id)) lock->id = -1; + *object_shm = &object->shm; + return STATUS_PENDING; + } + + if (!valid) memset( lock, 0, sizeof(*lock) ); /* object has been invalidated, clear the lock and start over */ + return status; +} + +static NTSTATUS get_shared_window( HWND hwnd, struct object_lock *lock, const window_shm_t **window_shm ) +{ + const object_shm_t **object_shm = (const object_shm_t **)window_shm; + UINT status = STATUS_SUCCESS; + + TRACE( "hwnd %p, lock %p, window_shm %p\n", hwnd, lock, window_shm ); + + do { status = try_get_user_object_shm( hwnd, NTUSER_OBJ_WINDOW, lock, object_shm ); } + while (!status && !lock->id); + + return status; +} + /*********************************************************************** * get_user_handle_ptr */ @@ -441,7 +490,6 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent ) { old_parent = wine_server_ptr_handle( reply->old_parent ); win->parent = parent = wine_server_ptr_handle( reply->full_parent ); - win->dpi_context = reply->dpi_context; }
} @@ -851,63 +899,25 @@ BOOL is_window_enabled( HWND hwnd ) /* see GetWindowDpiAwarenessContext */ UINT get_window_dpi_awareness_context( HWND hwnd ) { - UINT ret = 0; - WND *win; + struct object_lock lock = OBJECT_LOCK_INIT; + const window_shm_t *window_shm; + UINT status, ctx = 0;
- if (!(win = get_win_ptr( hwnd ))) + while ((status = get_shared_window( hwnd, &lock, &window_shm )) == STATUS_PENDING) + ctx = window_shm->dpi_context; + if (status) { RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; } - if (win == WND_DESKTOP) return NTUSER_DPI_PER_MONITOR_AWARE; - if (win != WND_OTHER_PROCESS) - { - ret = win->dpi_context; - release_win_ptr( win ); - } - else - { - SERVER_START_REQ( get_window_info ) - { - req->handle = wine_server_user_handle( hwnd ); - if (!wine_server_call_err( req )) ret = reply->dpi_context; - } - SERVER_END_REQ; - } - return ret; + + return ctx; }
/* see GetDpiForWindow */ UINT get_dpi_for_window( HWND hwnd ) { - WND *win; - UINT raw_dpi, context = 0; - - if (!(win = get_win_ptr( hwnd ))) - { - RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); - return 0; - } - if (win == WND_DESKTOP) - { - RECT rect = {0}; - return monitor_dpi_from_rect( rect, get_thread_dpi(), &raw_dpi ); - } - if (win != WND_OTHER_PROCESS) - { - context = win->dpi_context; - release_win_ptr( win ); - } - else - { - SERVER_START_REQ( get_window_info ) - { - req->handle = wine_server_user_handle( hwnd ); - if (!wine_server_call_err( req )) context = reply->dpi_context; - } - SERVER_END_REQ; - } - + UINT raw_dpi, context = get_window_dpi_awareness_context( hwnd ); if (NTUSER_DPI_CONTEXT_IS_MONITOR_AWARE( context )) return get_win_monitor_dpi( hwnd, &raw_dpi ); return NTUSER_DPI_CONTEXT_GET_DPI( context ); } @@ -5279,7 +5289,6 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, full_parent = wine_server_ptr_handle( reply->parent ); full_owner = wine_server_ptr_handle( reply->owner ); extra_bytes = reply->extra; - dpi_context = reply->dpi_context; class = wine_server_get_ptr( reply->class_ptr ); } } @@ -5330,7 +5339,6 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, win->class = class; win->winproc = get_class_winproc( class ); win->cbWndExtra = extra_bytes; - win->dpi_context = dpi_context; list_init( &win->vulkan_surfaces ); set_user_handle_ptr( handle, win ); if (is_winproc_unicode( win->winproc, !ansi )) win->flags |= WIN_ISUNICODE; @@ -5583,9 +5591,9 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, } else NtUserSetWindowLongPtr( hwnd, GWLP_ID, (ULONG_PTR)cs.hMenu, FALSE );
- win_dpi = NTUSER_DPI_CONTEXT_GET_DPI( win->dpi_context ); release_win_ptr( win );
+ win_dpi = get_dpi_for_window( hwnd ); if (parent) map_dpi_create_struct( &cs, win_dpi );
context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 2b04536d38f..eac7ed3602d 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -80,13 +80,13 @@ static struct session_thread_data *get_session_thread_data(void) return thread_info->session_data; }
-static void shared_object_acquire_seqlock( const shared_object_t *object, UINT64 *seq ) +void shared_object_acquire_seqlock( const shared_object_t *object, UINT64 *seq ) { while ((*seq = ReadNoFence64( &object->seq )) & 1) YieldProcessor(); __SHARED_READ_FENCE; }
-static BOOL shared_object_release_seqlock( const shared_object_t *object, UINT64 seq ) +BOOL shared_object_release_seqlock( const shared_object_t *object, UINT64 seq ) { __SHARED_READ_FENCE; return ReadNoFence64( &object->seq ) == seq; @@ -173,7 +173,7 @@ static NTSTATUS find_shared_session_block( SIZE_T offset, SIZE_T size, struct se return status; }
-static const shared_object_t *find_shared_session_object( object_id_t id, mem_size_t offset ) +const shared_object_t *find_shared_session_object( object_id_t id, mem_size_t offset ) { struct session_block *block = NULL; const shared_object_t *object; diff --git a/server/protocol.def b/server/protocol.def index 7ed53f618d3..58c88d34666 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2555,7 +2555,6 @@ enum message_type user_handle_t owner; /* full handle of owner */ int extra; /* number of extra bytes */ client_ptr_t class_ptr; /* pointer to class in client address space */ - unsigned int dpi_context; /* window DPI context */ @END
@@ -2590,7 +2589,6 @@ enum message_type @REPLY user_handle_t last_active; /* last active popup */ int is_unicode; /* ANSI or unicode */ - unsigned int dpi_context; /* window DPI context */ @END
@@ -2630,7 +2628,6 @@ enum message_type @REPLY user_handle_t old_parent; /* old parent window */ user_handle_t full_parent; /* full handle of new parent */ - unsigned int dpi_context; /* new DPI context */ @END
diff --git a/server/window.c b/server/window.c index 78245b93707..1b0786835c0 100644 --- a/server/window.c +++ b/server/window.c @@ -2234,7 +2234,6 @@ DECL_HANDLER(create_window) reply->parent = win->parent ? win->parent->handle : 0; reply->owner = win->owner; reply->extra = win->nb_extra_bytes; - reply->dpi_context = win->shared->dpi_context; reply->class_ptr = get_class_client_ptr( win->class ); }
@@ -2255,7 +2254,6 @@ DECL_HANDLER(set_parent) reply->old_parent = win->parent->handle; reply->full_parent = parent ? parent->handle : 0; set_parent_window( win, parent ); - reply->dpi_context = win->shared->dpi_context; }
@@ -2349,7 +2347,6 @@ DECL_HANDLER(get_window_info)
reply->last_active = win->handle; reply->is_unicode = win->is_unicode; - reply->dpi_context = win->shared->dpi_context;
if (get_user_object( win->last_active, NTUSER_OBJ_WINDOW )) reply->last_active = win->last_active; }
v2: Fix a bug found with shared object offset when additional SHM blocks are needed, causing the uxtheme test timeout.
Jacek Caban (@jacek) commented about dlls/win32u/window.c:
What’s the idea behind this, do you expect the window object ID to mutate?
If not, we could simplify the code by grabbing the id on the first lock. In fact, we might not need the id at all, we could use the window handle for validation and the handle entry for the offset.
(Later on, we might even consider storing a shared pointer in the `WND` struct. Several of its fields can only be modified by the current process while holding the user lock, so once we have a `WND` pointer, we should be able to read those fields directly from shared memory without additional locking, instead of duplicating them on client side. It’s not a deal breaker if that doesn’t work out, but I’d be curious to know why not.)