https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6360a53b1287cfea728e8…
commit 6360a53b1287cfea728e81c4bb88bef19c921130
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Jan 29 22:48:14 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Jan 29 22:48:14 2019 +0900
[WIN32KNT_APITEST] Improve NtGdiSetBitmapBits 6 (#1320)
Add some PAGE_READONLY tests. Add two bit pattern tests. CORE-15657 and CORE-15695
---
.../apitests/win32nt/ntgdi/NtGdiSetBitmapBits.c | 25 ++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetBitmapBits.c
b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetBitmapBits.c
index 21d1f1f01f..8b6fa26743 100644
--- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetBitmapBits.c
+++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetBitmapBits.c
@@ -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);