[WIN32KNT_APITEST] Improve NtGdiSetBitmapBits 6 (#1320)

Add some PAGE_READONLY tests. Add two bit pattern tests. CORE-15657 and CORE-15695
This commit is contained in:
Katayama Hirofumi MZ 2019-01-29 22:48:14 +09:00 committed by GitHub
parent 5417742f48
commit 6360a53b12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,7 +78,7 @@ START_TEST(NtGdiSetBitmapBits)
ok_long(NtGdiSetBitmapBits(hBitmap, 100, Bits), 12);
ok_long(GetLastError(), 0xDEADFACE);
/* Test large byte counts */
/* Test large byte counts (with PAGE_NOACCESS) */
LargeBits = VirtualAlloc(NULL, 0x100000 + PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
VirtualAlloc(LargeBits, 0x100000, MEM_COMMIT, PAGE_READWRITE);
CopyMemory(LargeBits, Bits, sizeof(Bits));
@ -88,7 +88,26 @@ START_TEST(NtGdiSetBitmapBits)
ok_long(GetLastError(), 0xDEADFACE);
SetLastError(0xDEADFACE);
ok_long(NtGdiSetBitmapBits(hBitmap, 0x1000, LargeBits), 0xC);
ok_long(NtGdiSetBitmapBits(hBitmap, 0x10000, LargeBits), 0xC);
ok_long(GetLastError(), 0xDEADFACE);
SetLastError(0xDEADFACE);
ok_long(NtGdiSetBitmapBits(hBitmap, 0x100000, LargeBits), 0xC);
ok_long(GetLastError(), 0xDEADFACE);
SetLastError(0xDEADFACE);
ok_long(NtGdiSetBitmapBits(hBitmap, 0x100001, LargeBits), 0x0);
ok_long(GetLastError(), 0xDEADFACE);
VirtualFree(LargeBits, 0, MEM_RELEASE);
/* Test large byte counts (with PAGE_READONLY) */
LargeBits = VirtualAlloc(NULL, 0x100000 + PAGE_SIZE, MEM_RESERVE, PAGE_READONLY);
VirtualAlloc(LargeBits, 0x100000, MEM_COMMIT, PAGE_READWRITE);
CopyMemory(LargeBits, Bits, sizeof(Bits));
SetLastError(0xDEADFACE);
ok_long(NtGdiSetBitmapBits(hBitmap, 0x100, LargeBits), 0xC);
ok_long(GetLastError(), 0xDEADFACE);
SetLastError(0xDEADFACE);
@ -295,6 +314,7 @@ START_TEST(NtGdiSetBitmapBits)
ok_int(Bits[4], 0x55);
ok_long(*(LPDWORD)pvBits, 0);
ok_long(((LPDWORD)pvBits)[1], 0);
DeleteObject(hBitmap);
DeleteDC(hDC);
@ -396,6 +416,7 @@ START_TEST(NtGdiSetBitmapBits)
ok_int(Bits[4], 0x55);
ok_long(*(LPDWORD)pvBits, 0x33AAAAAA);
ok_long(((LPDWORD)pvBits)[1], 0x33333333);
DeleteObject(hBitmap);
DeleteDC(hDC);