diff --git "a/win32ss/user/user32/windows/cursoricon.c" "b/win32ss/user/user32/windows/cursoricon.c" index 53c98456e81..79b56c46f33 100644 --- "a/win32ss/user/user32/windows/cursoricon.c" +++ "b/win32ss/user/user32/windows/cursoricon.c" @@ -2032,6 +2032,24 @@ HANDLE WINAPI CopyImage( TRACE("hImage=%p, uType=%u, cxDesired=%d, cyDesired=%d, fuFlags=%x\n", hImage, uType, cxDesired, cyDesired, fuFlags); + if (!hImage) + { + switch(uType) + { + case IMAGE_BITMAP: + SetLastError(ERROR_INVALID_HANDLE); + break; + case IMAGE_CURSOR: + case IMAGE_ICON: + SetLastError(ERROR_INVALID_CURSOR_HANDLE); + break; + default: + SetLastError(ERROR_INVALID_PARAMETER); + break; + } + return NULL; + } + if (fuFlags & ~COPYIMAGE_VALID_FLAGS) { SetLastError(ERROR_INVALID_PARAMETER);