diff --git "a/modules/rostests/apitests/user32/CopyImage.c" "b/modules/rostests/apitests/user32/CopyImage.c" index bad7c472f4f..5d823906505 100644 --- "a/modules/rostests/apitests/user32/CopyImage.c" +++ "b/modules/rostests/apitests/user32/CopyImage.c" @@ -78,7 +78,47 @@ Test_CopyImage_Flags(UINT uType) START_TEST(CopyImage) { + HANDLE hImg; + DWORD LastError; + Test_CopyImage_Flags(IMAGE_BITMAP); Test_CopyImage_Flags(IMAGE_CURSOR); Test_CopyImage_Flags(IMAGE_ICON); + + /* Test NULL HANDLE return GetLastError return */ + SetLastError(0xdeadbeef); + hImg = CopyImage(NULL, IMAGE_ICON, 16, 16, 0x4000); + LastError = GetLastError(); + ok(LastError == ERROR_INVALID_CURSOR_HANDLE, "Wrong error 0x%08lx returned\n", LastError); + ok(!hImg, "Image returned should have been NULL\n"); + + SetLastError(0xdeadbeef); + hImg = CopyImage(NULL, IMAGE_BITMAP, 16, 16, 0x4000); + LastError = GetLastError(); + ok(LastError == ERROR_INVALID_HANDLE, "Wrong error 0x%08lx returned\n", LastError); + ok(!hImg, "Image returned should have been NULL\n"); + + + SetLastError(0xdeadbeef); + hImg = CopyImage(NULL, IMAGE_CURSOR, 16, 16, 0x4000); + LastError = GetLastError(); + ok(LastError == ERROR_INVALID_CURSOR_HANDLE, "Wrong error 0x%08lx returned\n", LastError); + ok(!hImg, "Image returned should have been NULL\n"); + + /* Test bad Type (5) GetLastError return value. Not Icon, Cursor, or Bitmap. */ + SetLastError(0xdeadbeef); + hImg = CopyImage(NULL, 5, 16, 16, 0x4000); + LastError = GetLastError(); + ok(LastError == ERROR_INVALID_PARAMETER, "Wrong error 0x%08lx returned\n", LastError); + ok(!hImg, "Image returned should have been NULL\n"); + + /* Test bad type (5) GetLastError return value with good HANDLE */ + hImg = CreateTestImage(IMAGE_ICON); + SetLastError(0xdeadbeef); + hImg = CopyImage(hImg, 5, 16, 16, 0x4000); + LastError = GetLastError(); + ok(LastError == ERROR_INVALID_PARAMETER, "Wrong error 0x%08lx returned\n", LastError); + ok(!hImg, "Image returned should have been NULL\n"); + DeleteObject(hImg); + }