diff --git a/reactos/dll/win32/user32/windows/window.c b/reactos/dll/win32/user32/windows/window.c index dbe79a43af5..fc338da887a 100644 --- a/reactos/dll/win32/user32/windows/window.c +++ b/reactos/dll/win32/user32/windows/window.c @@ -168,13 +168,14 @@ User32CreateWindowEx(DWORD dwExStyle, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam, - BOOL Unicode) + DWORD dwFlags) { LARGE_STRING WindowName; LARGE_STRING lstrClassName, *plstrClassName; UNICODE_STRING ClassName; WNDCLASSEXA wceA; WNDCLASSEXW wceW; + BOOL Unicode; HWND Handle = NULL; #if 0 @@ -187,6 +188,8 @@ User32CreateWindowEx(DWORD dwExStyle, RegisterSystemControls(); } + Unicode = !(dwFlags & NUCWE_ANSI); + if (IS_ATOM(lpClassName)) { plstrClassName = (PVOID)lpClassName; @@ -278,7 +281,7 @@ User32CreateWindowEx(DWORD dwExStyle, hMenu, hInstance, lpParam, - 0, + dwFlags, NULL); #if 0 @@ -417,7 +420,7 @@ CreateWindowExA(DWORD dwExStyle, hMenu, hInstance, lpParam, - FALSE); + NUCWE_ANSI); return hwnd; } @@ -540,7 +543,7 @@ CreateWindowExW(DWORD dwExStyle, hMenu, hInstance, lpParam, - TRUE); + 0); return hwnd; } @@ -955,15 +958,26 @@ GetClientRect(HWND hWnd, LPRECT lpRect) { PWND Wnd = ValidateHwnd(hWnd); - if (Wnd != NULL) + if (!Wnd) return FALSE; + if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP ) { - lpRect->left = lpRect->top = 0; +/* lpRect->left = lpRect->top = 0; lpRect->right = Wnd->rcClient.right - Wnd->rcClient.left; lpRect->bottom = Wnd->rcClient.bottom - Wnd->rcClient.top; - return TRUE; +*/ + *lpRect = Wnd->rcClient; + OffsetRect(lpRect, -Wnd->rcClient.left, -Wnd->rcClient.top); } - - return FALSE; + else + { + lpRect->left = lpRect->top = 0; + lpRect->right = Wnd->rcClient.right; + lpRect->bottom = Wnd->rcClient.bottom; +/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics. + lpRect->right = GetSystemMetrics(SM_CXSCREEN); + lpRect->bottom = GetSystemMetrics(SM_CYSCREEN); +*/ } + return TRUE; } @@ -1242,13 +1256,21 @@ GetWindowRect(HWND hWnd, { PWND Wnd = ValidateHwnd(hWnd); - if (Wnd != NULL) + if (!Wnd) return FALSE; + if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP ) { *lpRect = Wnd->rcWindow; - return TRUE; } - - return FALSE; + else + { + lpRect->left = lpRect->top = 0; + lpRect->right = Wnd->rcWindow.right; + lpRect->bottom = Wnd->rcWindow.bottom; +/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics. + lpRect->right = GetSystemMetrics(SM_CXSCREEN); + lpRect->bottom = GetSystemMetrics(SM_CYSCREEN); +*/ } + return TRUE; } @@ -1693,26 +1715,19 @@ BOOL WINAPI SetWindowTextA(HWND hWnd, LPCSTR lpString) { - DWORD ProcessId; - if(!GetWindowThreadProcessId(hWnd, &ProcessId)) - { - return FALSE; - } + PWND pwnd; - if(ProcessId != GetCurrentProcessId()) - { + pwnd = ValidateHwnd(hWnd); + if (pwnd) + { + if (!TestWindowProcess(pwnd)) + { /* do not send WM_GETTEXT messages to other processes */ - - DefSetText(hWnd, (PCWSTR)lpString, TRUE); - - if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) - { - DefWndNCPaint(hWnd, HRGN_WINDOW, -1); - } - return TRUE; - } - - return SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString); + return (DefWindowProcA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0); + } + return (SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0); + } + return FALSE; } @@ -1723,26 +1738,19 @@ BOOL WINAPI SetWindowTextW(HWND hWnd, LPCWSTR lpString) { - DWORD ProcessId; - if(!GetWindowThreadProcessId(hWnd, &ProcessId)) - { - return FALSE; - } + PWND pwnd; - if(ProcessId != GetCurrentProcessId()) - { + pwnd = ValidateHwnd(hWnd); + if (pwnd) + { + if (!TestWindowProcess(pwnd)) + { /* do not send WM_GETTEXT messages to other processes */ - - DefSetText(hWnd, lpString, FALSE); - - if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) - { - DefWndNCPaint(hWnd, HRGN_WINDOW, -1); - } - return TRUE; - } - - return SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString); + return (DefWindowProcW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0); + } + return (SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0); + } + return FALSE; } diff --git a/reactos/dll/win32/user32/windows/winpos.c b/reactos/dll/win32/user32/windows/winpos.c index 084ec260bb9..6ba6e98ed9c 100644 --- a/reactos/dll/win32/user32/windows/winpos.c +++ b/reactos/dll/win32/user32/windows/winpos.c @@ -151,7 +151,7 @@ MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints) Delta.x = Delta.y = 0; mirror_from = mirror_to = FALSE; - if (FromWnd && FromWnd->fnid != FNID_DESKTOP) + if (FromWnd && hWndFrom != GetDesktopWindow()) // FromWnd->fnid != FNID_DESKTOP) { if (FromWnd->ExStyle & WS_EX_LAYOUTRTL) { @@ -163,7 +163,7 @@ MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints) Delta.y = FromWnd->rcClient.top; } - if (ToWnd && ToWnd->fnid != FNID_DESKTOP) + if (ToWnd && hWndTo != GetDesktopWindow()) // ToWnd->fnid != FNID_DESKTOP) { if (ToWnd->ExStyle & WS_EX_LAYOUTRTL) { @@ -207,7 +207,7 @@ ScreenToClient(HWND hWnd, LPPOINT lpPoint) if (!Wnd) return FALSE; - if (Wnd->fnid != FNID_DESKTOP) + if (hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP ) { if (Wnd->ExStyle & WS_EX_LAYOUTRTL) lpPoint->x = Wnd->rcClient.right - lpPoint->x; @@ -231,7 +231,7 @@ ClientToScreen(HWND hWnd, LPPOINT lpPoint) if (!Wnd) return FALSE; - if (Wnd->fnid != FNID_DESKTOP) + if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP ) { if (Wnd->ExStyle & WS_EX_LAYOUTRTL) lpPoint->x = Wnd->rcClient.right - lpPoint->x;