diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 8572b78a484..dd627009f7b 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -4121,7 +4121,7 @@ BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC pro /* Report physical monitor information only if window station has visible display surfaces */ winstation = NtUserGetProcessWindowStation(); - if (GetUserObjectInformationW( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL )) + if (NtUserGetObjectInformation( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL )) is_winstation_visible = flags.dwFlags & WSF_VISIBLE; if (is_winstation_visible && update_monitor_cache()) diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 0c1066bc895..97ad596e518 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -396,7 +396,7 @@ @ stdcall GetUpdateRgn(long long long) @ stdcall GetUpdatedClipboardFormats(ptr long ptr) @ stdcall GetUserObjectInformationA (long long ptr long ptr) -@ stdcall GetUserObjectInformationW (long long ptr long ptr) +@ stdcall GetUserObjectInformationW (long long ptr long ptr) NtUserGetObjectInformation @ stdcall GetUserObjectSecurity (long ptr ptr long ptr) # @ stub GetWinStationInfo @ stdcall GetWindow(long long) diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c index 1899feb6a28..1a955879f3d 100644 --- a/dlls/user32/winstation.c +++ b/dlls/user32/winstation.c @@ -437,7 +437,7 @@ BOOL WINAPI GetUserObjectInformationA( HANDLE handle, INT index, LPVOID info, DW WCHAR buffer[MAX_PATH]; DWORD lenA, lenW; - if (!GetUserObjectInformationW( handle, index, buffer, sizeof(buffer), &lenW )) return FALSE; + if (!NtUserGetObjectInformation( handle, index, buffer, sizeof(buffer), &lenW )) return FALSE; lenA = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL ); if (needed) *needed = lenA; if (lenA > len) @@ -452,98 +452,7 @@ BOOL WINAPI GetUserObjectInformationA( HANDLE handle, INT index, LPVOID info, DW if (info) WideCharToMultiByte( CP_ACP, 0, buffer, -1, info, len, NULL, NULL ); return TRUE; } - return GetUserObjectInformationW( handle, index, info, len, needed ); -} - - -/*********************************************************************** - * GetUserObjectInformationW (USER32.@) - */ -BOOL WINAPI GetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DWORD len, LPDWORD needed ) -{ - BOOL ret; - - switch(index) - { - case UOI_FLAGS: - { - USEROBJECTFLAGS *obj_flags = info; - if (needed) *needed = sizeof(*obj_flags); - if (len < sizeof(*obj_flags)) - { - SetLastError( ERROR_BUFFER_OVERFLOW ); - return FALSE; - } - SERVER_START_REQ( set_user_object_info ) - { - req->handle = wine_server_obj_handle( handle ); - req->flags = 0; - ret = !wine_server_call_err( req ); - if (ret) - { - /* FIXME: inherit flag */ - obj_flags->dwFlags = reply->old_obj_flags; - } - } - SERVER_END_REQ; - } - return ret; - - case UOI_TYPE: - SERVER_START_REQ( set_user_object_info ) - { - req->handle = wine_server_obj_handle( handle ); - req->flags = 0; - ret = !wine_server_call_err( req ); - if (ret) - { - size_t size = reply->is_desktop ? sizeof(L"Desktop") : sizeof(L"WindowStation"); - if (needed) *needed = size; - if (len < size) - { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); - ret = FALSE; - } - else memcpy( info, reply->is_desktop ? L"Desktop" : L"WindowStation", size ); - } - } - SERVER_END_REQ; - return ret; - - case UOI_NAME: - { - WCHAR buffer[MAX_PATH]; - SERVER_START_REQ( set_user_object_info ) - { - req->handle = wine_server_obj_handle( handle ); - req->flags = 0; - wine_server_set_reply( req, buffer, sizeof(buffer) - sizeof(WCHAR) ); - ret = !wine_server_call_err( req ); - if (ret) - { - size_t size = wine_server_reply_size( reply ); - buffer[size / sizeof(WCHAR)] = 0; - size += sizeof(WCHAR); - if (needed) *needed = size; - if (len < size) - { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); - ret = FALSE; - } - else memcpy( info, buffer, size ); - } - } - SERVER_END_REQ; - } - return ret; - - case UOI_USER_SID: - FIXME( "not supported index %d\n", index ); - /* fall through */ - default: - SetLastError( ERROR_INVALID_PARAMETER ); - return FALSE; - } + return NtUserGetObjectInformation( handle, index, info, len, needed ); } diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 2b54fddfb1a..06fc68f00cf 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -96,6 +96,7 @@ static void * const syscalls[] = NtGdiTransformPoints, NtUserCloseDesktop, NtUserCloseWindowStation, + NtUserGetObjectInformation, NtUserGetProcessWindowStation, NtUserGetThreadDesktop, NtUserOpenInputDesktop, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index dc380b84c34..5c477f75bfd 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -957,7 +957,7 @@ @ stub NtUserGetMenuItemRect @ stub NtUserGetMessage @ stub NtUserGetMouseMovePointsEx -@ stub NtUserGetObjectInformation +@ stdcall -syscall NtUserGetObjectInformation(long long long long ptr) @ stub NtUserGetOemBitmapSize @ stub NtUserGetOpenClipboardWindow @ stub NtUserGetOwnerTransformedMonitorRect diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index af744ce89eb..6bf2cd5e2c1 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -152,3 +152,97 @@ HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK acce return ret; } + +/*********************************************************************** + * NtUserGetObjectInformation (win32u.@) + */ +BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, + DWORD len, DWORD *needed ) +{ + BOOL ret; + + static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0}; + static const WCHAR window_stationW[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n',0}; + + switch(index) + { + case UOI_FLAGS: + { + USEROBJECTFLAGS *obj_flags = info; + if (needed) *needed = sizeof(*obj_flags); + if (len < sizeof(*obj_flags)) + { + SetLastError( ERROR_BUFFER_OVERFLOW ); + return FALSE; + } + SERVER_START_REQ( set_user_object_info ) + { + req->handle = wine_server_obj_handle( handle ); + req->flags = 0; + ret = !wine_server_call_err( req ); + if (ret) + { + /* FIXME: inherit flag */ + obj_flags->dwFlags = reply->old_obj_flags; + } + } + SERVER_END_REQ; + } + return ret; + + case UOI_TYPE: + SERVER_START_REQ( set_user_object_info ) + { + req->handle = wine_server_obj_handle( handle ); + req->flags = 0; + ret = !wine_server_call_err( req ); + if (ret) + { + size_t size = reply->is_desktop ? sizeof(desktopW) : sizeof(window_stationW); + if (needed) *needed = size; + if (len < size) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + ret = FALSE; + } + else memcpy( info, reply->is_desktop ? desktopW : window_stationW, size ); + } + } + SERVER_END_REQ; + return ret; + + case UOI_NAME: + { + WCHAR buffer[MAX_PATH]; + SERVER_START_REQ( set_user_object_info ) + { + req->handle = wine_server_obj_handle( handle ); + req->flags = 0; + wine_server_set_reply( req, buffer, sizeof(buffer) - sizeof(WCHAR) ); + ret = !wine_server_call_err( req ); + if (ret) + { + size_t size = wine_server_reply_size( reply ); + buffer[size / sizeof(WCHAR)] = 0; + size += sizeof(WCHAR); + if (needed) *needed = size; + if (len < size) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + ret = FALSE; + } + else memcpy( info, buffer, size ); + } + } + SERVER_END_REQ; + } + return ret; + + case UOI_USER_SID: + FIXME( "not supported index %d\n", index ); + /* fall through */ + default: + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } +} diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 9dca44286e3..47a7263ab46 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -75,3 +75,14 @@ NTSTATUS WINAPI wow64_NtUserOpenInputDesktop( UINT *args ) return HandleToUlong( NtUserOpenInputDesktop( flags, inherit, access )); } + +NTSTATUS WINAPI wow64_NtUserGetObjectInformation( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + INT index = get_ulong( &args ); + void *info = get_ptr( &args ); + DWORD len = get_ulong( &args ); + DWORD *needed = get_ptr( &args ); + + return NtUserGetObjectInformation( handle, index, info, len, needed ); +} diff --git a/include/ntuser.h b/include/ntuser.h index d253c127ad3..0478ab69967 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -24,6 +24,8 @@ BOOL WINAPI NtUserCloseDesktop( HDESK handle ); BOOL WINAPI NtUserCloseWindowStation( HWINSTA handle ); +BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, + DWORD len, DWORD *needed ); HWINSTA WINAPI NtUserGetProcessWindowStation(void); HDESK WINAPI NtUserGetThreadDesktop( DWORD thread ); HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access );