Handle hwnd and tbi when passing NULL
András Kovács
andras at csevego.net
Sun Jun 28 12:23:40 CDT 2009
---
dlls/user32/nonclient.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index 708ed80..c127456 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -1628,13 +1628,25 @@ BOOL WINAPI GetTitleBarInfo(HWND hwnd, PTITLEBARINFO tbi) {
TRACE("(%p %p)\n", hwnd, tbi);
+ dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
+ dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
+
+ if (dwStyle == 0) {
+ TRACE("Invalid hwnd.\n");
+ return FALSE;
+ }
+
+ if (!tbi) {
+ TRACE("tbi is NULL.\n");
+ SetLastError(ERROR_NOACCESS);
+ return FALSE;
+ }
+
if(tbi->cbSize != sizeof(TITLEBARINFO)) {
TRACE("Invalid TITLEBARINFO size: %d\n", tbi->cbSize);
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
- dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
- dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
NC_GetInsideRect(hwnd, &tbi->rcTitleBar);
GetWindowRect(hwnd, &wndRect);
--
1.6.0.4
--=-639lhw0GN4dt8etao3EY--
More information about the wine-patches
mailing list