-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[USER32] Implement IsServerSideWindow (undocumented) #7577
base: master
Are you sure you want to change the base?
Conversation
Since the function is not offfically documented. Required by the further implementation and an appropriate apitest. CORE-19946
Note: with current state of this PR, results of executing an apitest are identical both in ReactOS and Windows. |
…ted) Add a test for IsServerSideWindow() function is user32. It tests whether the window procedure of the window resides in the kernel mode or not. It is not documented by Microsoft, but fortunately has unofficial (3rd party) documentation at http://undoc.airesoft.co.uk/user32.dll/IsServerSideWindow.php. Required and used internally by uxtheme.dll from XP/2003/Vista/7/etc. TODO: Fix/add correct test condition, to properly test the behavoiur of the function! Currently, the function returns FALSE in both cases, which means the condition for input window is not tested properly.
Implement IsServerSideWindow function in user32. It checks whether a window has a window procedure that resides in kernel mode and returns a boolean condition based on the appropriate internal window state flag (WNDS_SERVERSIDEWINDOWPROC). This function is not officially documented by Microsoft, but fortunately it has unofficial documentation at http://undoc.airesoft.co.uk/user32.dll/IsServerSideWindow.php. Required and used internally by uxtheme.dll from Windows XP/2003/Vista/7/etc. The log spams with it a lot, when using uxtheme.dll from Windows in ReactOS. CORE-19946
37d1194
to
7909f7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider converting the serverside test into a true apitest (to be added in user32_apitest, see modules/rostests/apitests/user32/
).
|
||
/* This testapp tests behaviour of IsServerSideWindow() function in user32. */ | ||
|
||
#define _WINE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a wine test, so please remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's not. But this define is required to properly include undocuser.h (which contains IsServerSideWindow
declaration) from winuser.h. See https://git.reactos.org/?p=reactos.git;a=blob;f=sdk/include/psdk/winuser.h;hb=d7f1a784a86570863804daaf6479ffba2863422f#l5891. But I think it can be included directly in apitest instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is a hack for Wine code only.
For ReactOS code, you explicitly include the undocuser.h header when you need it, see for example:
https://git.reactos.org/?p=reactos.git&a=search&h=HEAD&st=grep&s=undocuser.h
LPWSTR lpCmdLine, | ||
int nCmdShow) | ||
{ | ||
HWND hWnd1a, hWnd1b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just use one single window handle hWnd
, and you use this one consecutively for each CreateWindowExW + the test.
UINT result; | ||
BOOL ret; | ||
|
||
memset(&wcx, 0, sizeof(wcx)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memset(&wcx, 0, sizeof(wcx)); | |
ZeroMemory(&wcx, sizeof(wcx)); |
DPRINT("OK: the window %p has a valid kernel mode wndproc\n", hWnd1a); | ||
else | ||
DPRINT("FAIL: the window %p is not valid or has no valid kernel mode wndproc\n", hWnd1a); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing: DestroyWindow(hWnd1a);
DPRINT("FAIL: the window %p has a valid kernel mode wndproc when it shouldn't\n", hWnd1b); | ||
else | ||
DPRINT("OK: the window %p has no valid kernel mode wndproc\n", hWnd1b); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing: DestroyWindow(hWnd1b);
if (Wnd != NULL) | ||
return (Wnd->state & WNDS_SERVERSIDEWINDOWPROC) != 0; | ||
|
||
return FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (Wnd != NULL) | |
return (Wnd->state & WNDS_SERVERSIDEWINDOWPROC) != 0; | |
return FALSE; | |
if (!Wnd) | |
return FALSE; | |
return (Wnd->state & WNDS_SERVERSIDEWINDOWPROC) != 0; |
or a one-line:
return (Wnd ? !!(Wnd->state & WNDS_SERVERSIDEWINDOWPROC) : FALSE);
IsServerSideWindow( | ||
_In_ HWND hWnd) | ||
{ | ||
PWND Wnd = ValidateHwnd(hWnd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this function (and thus, your IsServerSideWindow implementation as it is currently written) will set the last-error in case the window handle is invalid. You should probably add a test for this.
If the last-error remains untouched, then please use ValidateHwndNoErr
instead.
WNDCLASSEXW wcx; | ||
UINT result; | ||
BOOL ret; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing: testing IsServerSideWindow
with invalid window handles (e.g. NULL
and 0xdeadbeef
), and check the last-error.
ShowWindow(hWnd1a, SW_SHOW); | ||
UpdateWindow(hWnd1a); | ||
|
||
ret = IsServerSideWindow(hWnd1a); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be of interest to check whether the last-error has been set to something, or is left unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not much to say. The background brush issue is the only thing that jumped out at me, and @HBelusca’s review is far more thorough than mine could ever be.
Purpose
Implement
IsServerSideWindow
function in user32. It checks whether a window has a window procedure that resides in kernel mode and returns a boolean condition based on the appropriate internal window state flag (WNDS_SERVERSIDEWINDOWPROC
).This function is not officially documented by Microsoft, but fortunately it has unofficial documentation at http://undoc.airesoft.co.uk/user32.dll/IsServerSideWindow.php. According to that doc,
bServerSideWindowProc
bit seems actually correspond toWNDS_SERVERSIDEWINDOWPROC
.Required and used internally by uxtheme.dll from Windows XP/2003/Vista/7/etc. The log spams with it a lot, when using uxtheme.dll from Windows in ReactOS.
JIRA issue: CORE-19946
Proposed changes
TODO
Analysis
As it's visible on the following screenshot, uxtheme.dll actually needs that function in Windows XP SP3 at least: