https://git.reactos.org/?p=reactos.git;a=commitdiff;h=62f6e3b397f54b95df1496...
commit 62f6e3b397f54b95df1496d742732bca8ee07b04 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Wed Jan 30 22:55:10 2019 +0900 Commit: GitHub noreply@github.com CommitDate: Wed Jan 30 22:55:10 2019 +0900
[WIN32KNT_APITEST] Tabs To Spaces (#1326)
Converts Tabs to Spaces. --- .../win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c | 18 +- .../win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c | 20 +- .../apitests/win32nt/ntgdi/NtGdiArcInternal.c | 42 +- .../rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c | 204 +-- .../apitests/win32nt/ntgdi/NtGdiCombineRgn.c | 72 +- .../apitests/win32nt/ntgdi/NtGdiCreateBitmap.c | 372 +++--- .../win32nt/ntgdi/NtGdiCreateCompatibleDC.c | 32 +- .../apitests/win32nt/ntgdi/NtGdiDoPalette.c | 338 ++--- .../apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c | 22 +- .../apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c | 68 +- .../apitests/win32nt/ntgdi/NtGdiExtTextOutW.c | 10 +- .../apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c | 42 +- .../apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c | 78 +- .../apitests/win32nt/ntgdi/NtGdiGetDIBits.c | 206 +-- .../ntgdi/NtGdiGetFontResourceInfoInternalW.c | 58 +- .../apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c | 148 +-- .../rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c | 8 +- .../apitests/win32nt/ntgdi/NtGdiSelectBitmap.c | 132 +- .../apitests/win32nt/ntgdi/NtGdiSelectBrush.c | 120 +- .../apitests/win32nt/ntgdi/NtGdiSelectFont.c | 80 +- .../apitests/win32nt/ntgdi/NtGdiSelectPen.c | 108 +- .../win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c | 158 +-- .../apitests/win32nt/ntuser/NtUserCallHwnd.c | 54 +- .../apitests/win32nt/ntuser/NtUserCallHwndLock.c | 96 +- .../apitests/win32nt/ntuser/NtUserCallHwndOpt.c | 8 +- .../apitests/win32nt/ntuser/NtUserCallHwndParam.c | 32 +- .../apitests/win32nt/ntuser/NtUserCallNoParam.c | 30 +- .../apitests/win32nt/ntuser/NtUserCallOneParam.c | 86 +- .../win32nt/ntuser/NtUserCountClipboardFormats.c | 2 +- .../win32nt/ntuser/NtUserEnumDisplayMonitors.c | 2 +- .../win32nt/ntuser/NtUserEnumDisplaySettings.c | 176 +-- .../apitests/win32nt/ntuser/NtUserGetClassInfo.c | 52 +- .../apitests/win32nt/ntuser/NtUserGetIconInfo.c | 262 ++-- .../apitests/win32nt/ntuser/NtUserRedrawWindow.c | 40 +- .../apitests/win32nt/ntuser/NtUserScrollDC.c | 204 +-- .../apitests/win32nt/ntuser/NtUserSelectPalette.c | 250 ++-- .../apitests/win32nt/ntuser/NtUserSetTimer.c | 6 +- .../win32nt/ntuser/NtUserSystemParametersInfo.c | 1370 ++++++++++---------- .../apitests/win32nt/ntuser/NtUserToUnicodeEx.c | 850 ++++++------ modules/rostests/apitests/win32nt/osver.c | 62 +- modules/rostests/apitests/win32nt/w32knapi.c | 136 +- modules/rostests/apitests/win32nt/w32knapi.h | 6 +- 42 files changed, 3030 insertions(+), 3030 deletions(-)
diff --git a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c index 7ab06faf16..ffc9eaa46a 100644 --- a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c +++ b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c @@ -9,15 +9,15 @@
START_TEST(NtGdiDdCreateDirectDrawObject) { - HANDLE hDirectDraw; - HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); - ok(hdc != NULL, "\n"); + HANDLE hDirectDraw; + HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); + ok(hdc != NULL, "\n");
- /* Test ReactX */ - ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n"); - ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); + /* Test ReactX */ + ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n"); + ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n");
- /* Cleanup ReactX setup */ - DeleteDC(hdc); - NtGdiDdDeleteDirectDrawObject(hDirectDraw); + /* Cleanup ReactX setup */ + DeleteDC(hdc); + NtGdiDdDeleteDirectDrawObject(hDirectDraw); } diff --git a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c index 35569f7eb2..7c71988866 100644 --- a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c +++ b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c @@ -9,16 +9,16 @@
START_TEST(NtGdiDdDeleteDirectDrawObject) { - HANDLE hDirectDraw; - HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); - ok(hdc != NULL, "\n"); + HANDLE hDirectDraw; + HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); + ok(hdc != NULL, "\n");
- /* Test ReactX */ - ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE, "\n"); - ok((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); - ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE, "\n"); + /* Test ReactX */ + ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE, "\n"); + ok((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); + ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE, "\n");
- /* Cleanup ReactX setup */ - DeleteDC(hdc); - NtGdiDdDeleteDirectDrawObject(hDirectDraw); + /* Cleanup ReactX setup */ + DeleteDC(hdc); + NtGdiDdDeleteDirectDrawObject(hDirectDraw); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiArcInternal.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiArcInternal.c index 7720145f23..8ff437e81f 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiArcInternal.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiArcInternal.c @@ -9,33 +9,33 @@
START_TEST(NtGdiArcInternal) { - HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL); + HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL);
- SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); + ok_long(GetLastError(), ERROR_INVALID_HANDLE);
- SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); + ok_long(GetLastError(), ERROR_SUCCESS);
- SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
- SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); + ok_long(GetLastError(), ERROR_INVALID_HANDLE);
- SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0), TRUE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0), TRUE);
// was passiert, wenn left > right ? einfach tauschen?
- DeleteDC(hDC); + DeleteDC(hDC); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c index b54c96ac08..95f838f315 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c @@ -9,106 +9,106 @@
START_TEST(NtGdiBitBlt) { - BOOL bRet; - HDC hdc1, hdc2; - HBITMAP hbmp1, hOldBmp1, hbmp2, hOldBmp2; - DWORD bytes1[4] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff}; - DWORD bytes2[4] = {0x00000000, 0x0000000, 0x0000000, 0x00000000}; - - /* Test NULL dc */ - SetLastError(ERROR_SUCCESS); - bRet = NtGdiBitBlt((HDC)0, 0, 0, 10, 10, (HDC)0, 10, 10, SRCCOPY, 0, 0); - ok_int(bRet, FALSE); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test invalid dc */ - SetLastError(ERROR_SUCCESS); - bRet = NtGdiBitBlt((HDC)0x123456, 0, 0, 10, 10, (HDC)0x123456, 10, 10, SRCCOPY, 0, 0); - ok_int(bRet, FALSE); - ok_long(GetLastError(), ERROR_SUCCESS); - - hdc1 = NtGdiCreateCompatibleDC(0); - ok(hdc1 != NULL, "hdc1 was NULL.\n"); - - hdc2 = NtGdiCreateCompatibleDC(0); - ok(hdc2 != NULL, "hdc2 was NULL.\n"); - - hbmp1 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes1 ); - ok(hbmp1 != NULL, "hbmp1 was NULL.\n"); - hOldBmp1 = SelectObject(hdc1, hbmp1); - - ok(NtGdiGetPixel(hdc1, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc1, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc1, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc1, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - hbmp2 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes2 ); - ok(hbmp2 != NULL, "hbmp2 was NULL.\n"); - hOldBmp2 = SelectObject(hdc2, hbmp2); - - bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 1, 1, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - NtGdiSetPixel(hdc2, 0, 0, 0x00000000); - - bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00ffffff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - NtGdiSetPixel(hdc2, 0, 0, 0x00000000); - - bRet = NtGdiBitBlt(hdc2, 2, 2, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - NtGdiSetPixel(hdc2, 0, 0, 0x00000000); - NtGdiSetPixel(hdc2, 1, 0, 0x00000000); - NtGdiSetPixel(hdc2, 0, 1, 0x00000000); - NtGdiSetPixel(hdc2, 1, 1, 0x00000000); - - bRet = NtGdiBitBlt(hdc2, 0, 0, 2, 2, hdc1, 0, 0, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - SelectObject(hdc2, hOldBmp2); - SelectObject(hdc1, hOldBmp1); - - DeleteObject(hbmp2); - DeleteObject(hbmp1); - - DeleteDC(hdc1); - DeleteDC(hdc2); + BOOL bRet; + HDC hdc1, hdc2; + HBITMAP hbmp1, hOldBmp1, hbmp2, hOldBmp2; + DWORD bytes1[4] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff}; + DWORD bytes2[4] = {0x00000000, 0x0000000, 0x0000000, 0x00000000}; + + /* Test NULL dc */ + SetLastError(ERROR_SUCCESS); + bRet = NtGdiBitBlt((HDC)0, 0, 0, 10, 10, (HDC)0, 10, 10, SRCCOPY, 0, 0); + ok_int(bRet, FALSE); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test invalid dc */ + SetLastError(ERROR_SUCCESS); + bRet = NtGdiBitBlt((HDC)0x123456, 0, 0, 10, 10, (HDC)0x123456, 10, 10, SRCCOPY, 0, 0); + ok_int(bRet, FALSE); + ok_long(GetLastError(), ERROR_SUCCESS); + + hdc1 = NtGdiCreateCompatibleDC(0); + ok(hdc1 != NULL, "hdc1 was NULL.\n"); + + hdc2 = NtGdiCreateCompatibleDC(0); + ok(hdc2 != NULL, "hdc2 was NULL.\n"); + + hbmp1 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes1 ); + ok(hbmp1 != NULL, "hbmp1 was NULL.\n"); + hOldBmp1 = SelectObject(hdc1, hbmp1); + + ok(NtGdiGetPixel(hdc1, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc1, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc1, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc1, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + hbmp2 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes2 ); + ok(hbmp2 != NULL, "hbmp2 was NULL.\n"); + hOldBmp2 = SelectObject(hdc2, hbmp2); + + bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 1, 1, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + NtGdiSetPixel(hdc2, 0, 0, 0x00000000); + + bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00ffffff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + NtGdiSetPixel(hdc2, 0, 0, 0x00000000); + + bRet = NtGdiBitBlt(hdc2, 2, 2, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + NtGdiSetPixel(hdc2, 0, 0, 0x00000000); + NtGdiSetPixel(hdc2, 1, 0, 0x00000000); + NtGdiSetPixel(hdc2, 0, 1, 0x00000000); + NtGdiSetPixel(hdc2, 1, 1, 0x00000000); + + bRet = NtGdiBitBlt(hdc2, 0, 0, 2, 2, hdc1, 0, 0, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + SelectObject(hdc2, hOldBmp2); + SelectObject(hdc1, hOldBmp1); + + DeleteObject(hbmp2); + DeleteObject(hbmp1); + + DeleteDC(hdc1); + DeleteDC(hdc2); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCombineRgn.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCombineRgn.c index 1c2ede4c26..c5f27cc68e 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCombineRgn.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCombineRgn.c @@ -9,44 +9,44 @@
START_TEST(NtGdiCombineRgn) { - HRGN hRgnDest, hRgn1, hRgn2; + HRGN hRgnDest, hRgn1, hRgn2; // test what params are accepted for what operations // 0? invalid? are params maybe ignored in some cases? // LastError
- /* Preparation */ - hRgnDest = CreateRectRgn(0,0,1,1); - hRgn1 = CreateRectRgn(1,1,4,4); - hRgn2 = CreateRectRgn(2,2,6,3); - - /* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */ - - ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0), ERROR); - ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6), ERROR); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND), ERROR); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND), ERROR); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND), ERROR); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND), ERROR); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - /* Create intersection */ - ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND), SIMPLEREGION); - SetRectRgn(hRgn1, 2, 2, 4, 3); - ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); - - /* Create intersection with itself */ - SetRectRgn(hRgnDest, 2, 2, 4, 3); - ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND), SIMPLEREGION); - SetRectRgn(hRgn1, 2, 2, 4, 3); - ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); - - /* What if 2 regions are the same */ + /* Preparation */ + hRgnDest = CreateRectRgn(0,0,1,1); + hRgn1 = CreateRectRgn(1,1,4,4); + hRgn2 = CreateRectRgn(2,2,6,3); + + /* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */ + + ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0), ERROR); + ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6), ERROR); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + /* Create intersection */ + ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND), SIMPLEREGION); + SetRectRgn(hRgn1, 2, 2, 4, 3); + ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); + + /* Create intersection with itself */ + SetRectRgn(hRgnDest, 2, 2, 4, 3); + ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND), SIMPLEREGION); + SetRectRgn(hRgn1, 2, 2, 4, 3); + ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); + + /* What if 2 regions are the same */ } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateBitmap.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateBitmap.c index 828ed402be..b6f2afad9e 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateBitmap.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateBitmap.c @@ -9,198 +9,198 @@
void Test_NtGdiCreateBitmap_Params(void) { - HBITMAP hBmp; - BITMAP bitmap; - BYTE BitmapData[10] = {0x11, 0x22, 0x33}; - - /* Test simple params */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - DeleteObject(hBmp); - - /* Test all zero */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test cx == 0 */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test negative cx */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test cy == 0 */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test negative cy */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test negative cy and valid bits */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData), NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test negative cy and invalid bits */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234), NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test huge size */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_NOT_ENOUGH_MEMORY); - - /* Test huge size and valid bits */ - SetLastError(ERROR_SUCCESS); - TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test huge size and invalid bits */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234), NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test cPlanes == 0 */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmType, 0); - ok_int(bitmap.bmWidth, 1); - ok_int(bitmap.bmHeight, 1); - ok_int(bitmap.bmWidthBytes, 2); - ok_int(bitmap.bmPlanes, 1); - ok_int(bitmap.bmBitsPixel, 1); - DeleteObject(hBmp); - - /* Test big cPlanes */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - DeleteObject(hBmp); - - ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test cBPP == 0 */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmType, 0); - ok_int(bitmap.bmWidth, 1); - ok_int(bitmap.bmHeight, 1); - ok_int(bitmap.bmWidthBytes, 2); - ok_int(bitmap.bmPlanes, 1); - ok_int(bitmap.bmBitsPixel, 1); - DeleteObject(hBmp); - - /* Test negative cBPP */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test bad cBPP */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 4); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 8); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 16); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 24); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 24); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 32); - DeleteObject(hBmp); - - ok_long(GetLastError(), ERROR_SUCCESS); - - ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test bad pointer */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234), NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test pointer alignment */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - DeleteObject(hBmp); - - /* Test normal params */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmType, 0); - ok_int(bitmap.bmWidth, 5); - ok_int(bitmap.bmHeight, 7); - ok_int(bitmap.bmWidthBytes, 6); - ok_int(bitmap.bmPlanes, 1); - ok_int(bitmap.bmBitsPixel, 8); - DeleteObject(hBmp); - - - /* Test height 0 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test height -1 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test witdth 0 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test witdth -1 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(-1, 0, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + HBITMAP hBmp; + BITMAP bitmap; + BYTE BitmapData[10] = {0x11, 0x22, 0x33}; + + /* Test simple params */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + DeleteObject(hBmp); + + /* Test all zero */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test cx == 0 */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test negative cx */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test cy == 0 */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test negative cy */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test negative cy and valid bits */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData), NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test negative cy and invalid bits */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234), NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test huge size */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_NOT_ENOUGH_MEMORY); + + /* Test huge size and valid bits */ + SetLastError(ERROR_SUCCESS); + TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test huge size and invalid bits */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234), NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test cPlanes == 0 */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmType, 0); + ok_int(bitmap.bmWidth, 1); + ok_int(bitmap.bmHeight, 1); + ok_int(bitmap.bmWidthBytes, 2); + ok_int(bitmap.bmPlanes, 1); + ok_int(bitmap.bmBitsPixel, 1); + DeleteObject(hBmp); + + /* Test big cPlanes */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + DeleteObject(hBmp); + + ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test cBPP == 0 */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmType, 0); + ok_int(bitmap.bmWidth, 1); + ok_int(bitmap.bmHeight, 1); + ok_int(bitmap.bmWidthBytes, 2); + ok_int(bitmap.bmPlanes, 1); + ok_int(bitmap.bmBitsPixel, 1); + DeleteObject(hBmp); + + /* Test negative cBPP */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test bad cBPP */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 4); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 8); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 16); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 24); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 24); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 32); + DeleteObject(hBmp); + + ok_long(GetLastError(), ERROR_SUCCESS); + + ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test bad pointer */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234), NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test pointer alignment */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + DeleteObject(hBmp); + + /* Test normal params */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmType, 0); + ok_int(bitmap.bmWidth, 5); + ok_int(bitmap.bmHeight, 7); + ok_int(bitmap.bmWidthBytes, 6); + ok_int(bitmap.bmPlanes, 1); + ok_int(bitmap.bmBitsPixel, 8); + DeleteObject(hBmp); + + + /* Test height 0 params */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test height -1 params */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test witdth 0 params */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test witdth -1 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(0, 0, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(-1, 0, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test witdth -1 params */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(0, 0, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); }
START_TEST(NtGdiCreateBitmap) {
- Test_NtGdiCreateBitmap_Params(); -// Test_NtGdiCreateBitmap_Pixel(); + Test_NtGdiCreateBitmap_Params(); +// Test_NtGdiCreateBitmap_Pixel();
} diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateCompatibleDC.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateCompatibleDC.c index 2d662053ec..9edb8e9620 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateCompatibleDC.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateCompatibleDC.c @@ -9,25 +9,25 @@
START_TEST(NtGdiCreateCompatibleDC) { - HDC hDC; - HGDIOBJ hObj; + HDC hDC; + HGDIOBJ hObj;
- /* Test if aa NULL DC is accepted */ - hDC = NtGdiCreateCompatibleDC(NULL); - ok(hDC != NULL, "hDC was NULL.\n"); + /* Test if aa NULL DC is accepted */ + hDC = NtGdiCreateCompatibleDC(NULL); + ok(hDC != NULL, "hDC was NULL.\n");
- /* We select a nwe palette. Note: SelectObject doesn't work with palettes! */ - hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0); - /* The old palette should be GetStockObject(DEFAULT_PALETTE) */ - ok_ptr(hObj, GetStockObject(DEFAULT_PALETTE)); + /* We select a nwe palette. Note: SelectObject doesn't work with palettes! */ + hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0); + /* The old palette should be GetStockObject(DEFAULT_PALETTE) */ + ok_ptr(hObj, GetStockObject(DEFAULT_PALETTE));
- /* The default bitmap should be GetStockObject(21) */ - hObj = SelectObject(hDC, GetStockObject(21)); - ok_ptr(hObj, GetStockObject(21)); + /* The default bitmap should be GetStockObject(21) */ + hObj = SelectObject(hDC, GetStockObject(21)); + ok_ptr(hObj, GetStockObject(21));
- /* The default pen should be GetStockObject(BLACK_PEN) */ - hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); - ok_ptr(hObj, GetStockObject(BLACK_PEN)); + /* The default pen should be GetStockObject(BLACK_PEN) */ + hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); + ok_ptr(hObj, GetStockObject(BLACK_PEN));
- ok(NtGdiDeleteObjectApp(hDC) != 0, "NtGdiDeleteObjectApp(hDC) was zero.\n"); + ok(NtGdiDeleteObjectApp(hDC) != 0, "NtGdiDeleteObjectApp(hDC) was zero.\n"); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiDoPalette.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiDoPalette.c index c8887ffd17..9893cbe487 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiDoPalette.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiDoPalette.c @@ -10,186 +10,186 @@ HPALETTE CreateTestPalette() { - struct - { - LOGPALETTE logpal; - PALETTEENTRY entry[5]; - } palstruct = - { {0x300,5, - { {1,2,3,0} }}, - { {22,33,44,PC_RESERVED}, - {11,55,77,PC_EXPLICIT}, - {00,77,66,PC_RESERVED | PC_NOCOLLAPSE}, - {12,34,56,78}} }; - - return CreatePalette((LOGPALETTE*)&palstruct); + struct + { + LOGPALETTE logpal; + PALETTEENTRY entry[5]; + } palstruct = + { {0x300,5, + { {1,2,3,0} }}, + { {22,33,44,PC_RESERVED}, + {11,55,77,PC_EXPLICIT}, + {00,77,66,PC_RESERVED | PC_NOCOLLAPSE}, + {12,34,56,78}} }; + + return CreatePalette((LOGPALETTE*)&palstruct); }
void Test_NtGdiDoPalette_GdiPalAnimate(void) { - HPALETTE hPal; - PALETTEENTRY palEntries[5] = { - {0,0,0,0}, - {0xff,0xff,0xff,0}, - {0x33,0x66,0x99,0}, - {0x25,0x84,0x14,0}, - {0x12,0x34,0x56,0x11}}; - PALETTEENTRY palEntries2[5]; - - /* Test stock palette */ - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - - /* Test pEntries = NULL */ - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE), 0); - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE), 0); - DeleteObject(hPal); - - /* Test PC_RESERVED */ - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE), 2); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE), 2); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE), 1); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE), 1); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE), 0); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE), 0); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE), 2); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE), 1); - DeleteObject(hPal); - - /* Test if entries are set correctly */ - hPal = CreateTestPalette(); - NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE); - NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); - ok_int(palEntries2[0].peRed, 1); - ok_int(palEntries2[0].peGreen, 2); - ok_int(palEntries2[0].peBlue, 3); - ok_int(palEntries2[0].peFlags, 0); - ok_int(palEntries2[1].peRed, palEntries[1].peRed); - ok_int(palEntries2[1].peGreen, palEntries[1].peGreen); - ok_int(palEntries2[1].peBlue, palEntries[1].peBlue); - ok_int(palEntries2[1].peFlags, palEntries[1].peFlags); - ok_int(palEntries2[2].peRed, 11); - ok_int(palEntries2[2].peGreen, 55); - ok_int(palEntries2[2].peBlue, 77); - ok_int(palEntries2[2].peFlags, PC_EXPLICIT); - ok_int(palEntries2[3].peRed, palEntries[3].peRed); - ok_int(palEntries2[3].peGreen, palEntries[3].peGreen); - ok_int(palEntries2[3].peBlue, palEntries[3].peBlue); - ok_int(palEntries2[3].peFlags, palEntries[3].peFlags); - DeleteObject(hPal); + HPALETTE hPal; + PALETTEENTRY palEntries[5] = { + {0,0,0,0}, + {0xff,0xff,0xff,0}, + {0x33,0x66,0x99,0}, + {0x25,0x84,0x14,0}, + {0x12,0x34,0x56,0x11}}; + PALETTEENTRY palEntries2[5]; + + /* Test stock palette */ + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + + /* Test pEntries = NULL */ + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE), 0); + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE), 0); + DeleteObject(hPal); + + /* Test PC_RESERVED */ + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE), 2); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE), 2); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE), 1); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE), 1); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE), 0); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE), 0); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE), 2); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE), 1); + DeleteObject(hPal); + + /* Test if entries are set correctly */ + hPal = CreateTestPalette(); + NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE); + NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); + ok_int(palEntries2[0].peRed, 1); + ok_int(palEntries2[0].peGreen, 2); + ok_int(palEntries2[0].peBlue, 3); + ok_int(palEntries2[0].peFlags, 0); + ok_int(palEntries2[1].peRed, palEntries[1].peRed); + ok_int(palEntries2[1].peGreen, palEntries[1].peGreen); + ok_int(palEntries2[1].peBlue, palEntries[1].peBlue); + ok_int(palEntries2[1].peFlags, palEntries[1].peFlags); + ok_int(palEntries2[2].peRed, 11); + ok_int(palEntries2[2].peGreen, 55); + ok_int(palEntries2[2].peBlue, 77); + ok_int(palEntries2[2].peFlags, PC_EXPLICIT); + ok_int(palEntries2[3].peRed, palEntries[3].peRed); + ok_int(palEntries2[3].peGreen, palEntries[3].peGreen); + ok_int(palEntries2[3].peBlue, palEntries[3].peBlue); + ok_int(palEntries2[3].peFlags, palEntries[3].peFlags); + DeleteObject(hPal);
}
void Test_NtGdiDoPalette_GdiPalSetEntries(void) { - HDC hDC; - HPALETTE hPal, hOldPal; - PALETTEENTRY palEntries[5] = { - {0,0,0,0}, - {0xff,0xff,0xff,0}, - {0x33,0x66,0x99,0}, - {0x25,0x84,0x14,0}, - {0x12,0x34,0x56,0x11}}; - PALETTEENTRY palEntries2[5]; - - hPal = CreateTestPalette(); - - /* Test invalid handle */ - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test system palette */ - ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - ok_long(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE), 1); - ok_long(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE), 2); - ok_long(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE), 3); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE), 5); - ok_long(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE), 5); - ok_long(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE), 2); -// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE), 0); - - /* Test bInbound, FALSE */ - NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); - ZeroMemory(palEntries2, sizeof(palEntries2)); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE), 5); - /* we should get the old values returned in our buffer! */ - ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); - - /* check what we have in our palette now */ - ZeroMemory(palEntries2, sizeof(palEntries2)); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE), 5); - ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); - - ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE), 4); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test if entries are set correctly */ - hPal = CreateTestPalette(); - NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); - NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); - ok_int(palEntries2[0].peRed, 0); - ok_int(palEntries2[0].peGreen, 0); - ok_int(palEntries2[0].peBlue, 0); - ok_int(palEntries2[0].peFlags, 0); - - /* Test that the buffer was not changed */ - - - /* Test with palette selected into dc */ - hDC = CreateCompatibleDC(NULL); - hOldPal = SelectPalette(hDC, hPal, 0); - ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE), 4); - SelectPalette(hDC, hOldPal, 0); - - /* Test pEntries = NULL */ - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); + HDC hDC; + HPALETTE hPal, hOldPal; + PALETTEENTRY palEntries[5] = { + {0,0,0,0}, + {0xff,0xff,0xff,0}, + {0x33,0x66,0x99,0}, + {0x25,0x84,0x14,0}, + {0x12,0x34,0x56,0x11}}; + PALETTEENTRY palEntries2[5]; + + hPal = CreateTestPalette(); + + /* Test invalid handle */ + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test system palette */ + ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + ok_long(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE), 1); + ok_long(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE), 2); + ok_long(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE), 3); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE), 5); + ok_long(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE), 5); + ok_long(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE), 2); +// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE), 0); + + /* Test bInbound, FALSE */ + NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); + ZeroMemory(palEntries2, sizeof(palEntries2)); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE), 5); + /* we should get the old values returned in our buffer! */ + ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); + + /* check what we have in our palette now */ + ZeroMemory(palEntries2, sizeof(palEntries2)); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE), 5); + ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); + + ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE), 4); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test if entries are set correctly */ + hPal = CreateTestPalette(); + NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); + NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); + ok_int(palEntries2[0].peRed, 0); + ok_int(palEntries2[0].peGreen, 0); + ok_int(palEntries2[0].peBlue, 0); + ok_int(palEntries2[0].peFlags, 0); + + /* Test that the buffer was not changed */ + + + /* Test with palette selected into dc */ + hDC = CreateCompatibleDC(NULL); + hOldPal = SelectPalette(hDC, hPal, 0); + ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE), 4); + SelectPalette(hDC, hOldPal, 0); + + /* Test pEntries = NULL */ + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0);
}
void Test_NtGdiDoPalette_GdiPalGetEntries(void) { - HPALETTE hPal; + HPALETTE hPal;
- hPal = CreateTestPalette(); + hPal = CreateTestPalette();
- /* Test pEntries = NULL */ - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE), 5); - ok_long(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE), 5); - ok_long(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE), 5); - ok_long(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE), 5); - ok_long(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE), 5); + /* Test pEntries = NULL */ + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE), 5); + ok_long(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE), 5); + ok_long(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE), 5); + ok_long(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE), 5); + ok_long(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE), 5);
// Test flags 0xf0 @@ -245,7 +245,7 @@ Test_NtGdiDoPalette_SetDIBColorTable(void) bmi.bmiColors[7] = 0xE0E0E0; bmi.bmiColors[8] = 0xffffff; hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmi, DIB_PAL_COLORS, (PVOID*)&pjBits, NULL, 0); - ok(hbmp != NULL, "hbmp was NULL.\n"); + ok(hbmp != NULL, "hbmp was NULL.\n"); ok(pjBits != NULL, "pjBits was NULL.\n");
SelectObject(hdc, hbmp); @@ -264,7 +264,7 @@ Test_NtGdiDoPalette_SetDIBColorTable(void) bmi.bmiColors[2] = 0xC0C0C0; bmi.bmiColors[1] = 0xE0E0E0; bmi.bmiColors[0] = 0xffffff; - ok_long(NtGdiDoPalette(hdc, 0, 9, &bmi.bmiColors, GdiPalSetColorTable, FALSE), 9); + ok_long(NtGdiDoPalette(hdc, 0, 9, &bmi.bmiColors, GdiPalSetColorTable, FALSE), 9);
SetDCPenColor(hdc, 0xE0E0E0); SetDCBrushColor(hdc, 0x202020); @@ -276,10 +276,10 @@ Test_NtGdiDoPalette_SetDIBColorTable(void)
START_TEST(NtGdiDoPalette) { - Test_NtGdiDoPalette_GdiPalAnimate(); - Test_NtGdiDoPalette_GdiPalSetEntries(); - Test_NtGdiDoPalette_GdiPalGetEntries(); - Test_NtGdiDoPalette_GetSystemPalette(); - Test_NtGdiDoPalette_GetBIBColorTable(); - Test_NtGdiDoPalette_SetDIBColorTable(); + Test_NtGdiDoPalette_GdiPalAnimate(); + Test_NtGdiDoPalette_GdiPalSetEntries(); + Test_NtGdiDoPalette_GdiPalGetEntries(); + Test_NtGdiDoPalette_GetSystemPalette(); + Test_NtGdiDoPalette_GetBIBColorTable(); + Test_NtGdiDoPalette_SetDIBColorTable(); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c index 0606311ff6..a77d0c88fa 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c @@ -9,17 +9,17 @@
START_TEST(NtGdiEngCreatePalette) { - HPALETTE hPal; - ULONG Colors[3] = {1,2,3}; - PENTRY pEntry; + HPALETTE hPal; + ULONG Colors[3] = {1,2,3}; + PENTRY pEntry;
- hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00); + hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00);
- ok(hPal != NULL, "hPal was NULL.\n"); - ok_int((int)GDI_HANDLE_GET_TYPE(hPal), (int)GDI_OBJECT_TYPE_PALETTE); - pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)]; - ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); - ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); - ok_ptr(pEntry->pUser, NULL); - //TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE)); + ok(hPal != NULL, "hPal was NULL.\n"); + ok_int((int)GDI_HANDLE_GET_TYPE(hPal), (int)GDI_OBJECT_TYPE_PALETTE); + pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)]; + ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); + ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); + ok_ptr(pEntry->pUser, NULL); + //TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE)); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c index b359bd951a..6083053235 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c @@ -9,38 +9,38 @@
START_TEST(NtGdiEnumFontOpen) { - HDC hDC; - ULONG_PTR idEnum; - ULONG ulCount; - PENTRY pEntry; - - hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL); - - // FIXME: We should load the font first - - idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount); - ok(idEnum != 0, "idEnum was 0.\n"); - if (idEnum == 0) - { - skip("idEnum == 0"); - return; - } - - /* we should have a gdi handle here */ - ok_int((int)GDI_HANDLE_GET_TYPE(idEnum), (int)GDI_OBJECT_TYPE_ENUMFONT); - pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)]; - ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); - ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); - ok_ptr(pEntry->pUser, NULL); - ok_int(pEntry->FullUnique, (idEnum >> 16)); - ok_int(pEntry->Objt, GDI_OBJECT_TYPE_ENUMFONT >> 16); - ok_int(pEntry->Flags, 0); - - /* We should not be able to use DeleteObject() on the handle */ - ok_int(DeleteObject((HGDIOBJ)idEnum), FALSE); - - NtGdiEnumFontClose(idEnum); - - // Test no logfont (NULL): should word - // Test empty lfFaceName string: should not work + HDC hDC; + ULONG_PTR idEnum; + ULONG ulCount; + PENTRY pEntry; + + hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL); + + // FIXME: We should load the font first + + idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount); + ok(idEnum != 0, "idEnum was 0.\n"); + if (idEnum == 0) + { + skip("idEnum == 0"); + return; + } + + /* we should have a gdi handle here */ + ok_int((int)GDI_HANDLE_GET_TYPE(idEnum), (int)GDI_OBJECT_TYPE_ENUMFONT); + pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)]; + ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); + ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); + ok_ptr(pEntry->pUser, NULL); + ok_int(pEntry->FullUnique, (idEnum >> 16)); + ok_int(pEntry->Objt, GDI_OBJECT_TYPE_ENUMFONT >> 16); + ok_int(pEntry->Flags, 0); + + /* We should not be able to use DeleteObject() on the handle */ + ok_int(DeleteObject((HGDIOBJ)idEnum), FALSE); + + NtGdiEnumFontClose(idEnum); + + // Test no logfont (NULL): should word + // Test empty lfFaceName string: should not work } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtTextOutW.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtTextOutW.c index ef25e81ed0..be471ea650 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtTextOutW.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtTextOutW.c @@ -33,11 +33,11 @@ START_TEST(NtGdiExtTextOutW) ULONG len; INT Dx[10] = {10, -5, 10, 5, 10, -10, 10, 5, 10, 5};
- /* Create a window */ - hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, - NULL, NULL, hinst, 0); - hDC = GetDC(hWnd); + /* Create a window */ + hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, + NULL, NULL, hinst, 0); + hDC = GetDC(hWnd);
lpstr = L"Hallo"; len = wcslen(lpstr); diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c index 842e50ba3c..729a7a49b5 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c @@ -13,36 +13,36 @@ NTSTATUS
START_TEST(NtGdiFlushUserBatch) { - PVOID pRet; - PTEB pTeb; + PVOID pRet; + PTEB pTeb;
pNtGdiFlushUserBatch = (PVOID)GetProcAddress(g_hModule, "NtGdiFlushUserBatch"); if (pNtGdiFlushUserBatch == NULL) return APISTATUS_NOT_FOUND;
- pTeb = NtCurrentTeb(); - ok(pTeb != NULL, "pTeb was NULL.\n"); + pTeb = NtCurrentTeb(); + ok(pTeb != NULL, "pTeb was NULL.\n");
- pRet = (PVOID)pNtGdiFlushUserBatch(); + pRet = (PVOID)pNtGdiFlushUserBatch();
- ok(pRet != NULL, "pRet was NULL.\n"); - ok_ptr(pRet, &pTeb->RealClientId); + ok(pRet != NULL, "pRet was NULL.\n"); + ok_ptr(pRet, &pTeb->RealClientId);
- ok_long(pTeb->GdiBatchCount, 0); - ok_long(pTeb->GdiTebBatch.Offset, 0); - ok_ptr(pTeb->GdiTebBatch.HDC, NULL); + ok_long(pTeb->GdiBatchCount, 0); + ok_long(pTeb->GdiTebBatch.Offset, 0); + ok_ptr(pTeb->GdiTebBatch.HDC, NULL);
- /* Set up some bullshit */ - pTeb->InDbgPrint = 1; - pTeb->GdiBatchCount = 12; - pTeb->GdiTebBatch.Offset = 21; - pTeb->GdiTebBatch.HDC = (HDC)123; + /* Set up some bullshit */ + pTeb->InDbgPrint = 1; + pTeb->GdiBatchCount = 12; + pTeb->GdiTebBatch.Offset = 21; + pTeb->GdiTebBatch.HDC = (HDC)123;
- pRet = (PVOID)pNtGdiFlushUserBatch(); - ok_ptr(pRet, &pTeb->RealClientId); + pRet = (PVOID)pNtGdiFlushUserBatch(); + ok_ptr(pRet, &pTeb->RealClientId);
- ok_int(pTeb->InDbgPrint, 0); - ok_long(pTeb->GdiBatchCount, 12); - ok_long(pTeb->GdiTebBatch.Offset, 0); - ok_ptr(pTeb->GdiTebBatch.HDC, NULL); + ok_int(pTeb->InDbgPrint, 0); + ok_long(pTeb->GdiBatchCount, 12); + ok_long(pTeb->GdiTebBatch.Offset, 0); + ok_ptr(pTeb->GdiTebBatch.HDC, NULL); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c index 51520b433b..e7d0f3e8ed 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c @@ -9,60 +9,60 @@
START_TEST(NtGdiGetBitmapBits) { - BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9}; - HBITMAP hBitmap; + BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9}; + HBITMAP hBitmap;
- SetLastError(ERROR_SUCCESS); - ok_long(NtGdiGetBitmapBits(0, 0, 0), 0); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiGetBitmapBits(0, 0, 0), 0); + ok_long(GetLastError(), ERROR_INVALID_HANDLE);
- /* Test NULL bitmap handle */ - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); + /* Test NULL bitmap handle */ + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0); + ok_long(GetLastError(), ERROR_INVALID_HANDLE);
- /* Test invalid bitmap handle */ - hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3)); - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - DeleteObject(hBitmap); + /* Test invalid bitmap handle */ + hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3)); + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + DeleteObject(hBitmap);
- hBitmap = CreateBitmap(3, 3, 1, 8, NULL); - SetLastError(ERROR_SUCCESS); + hBitmap = CreateBitmap(3, 3, 1, 8, NULL); + SetLastError(ERROR_SUCCESS);
- /* test NULL pointer and count buffer size != 0 */ - ok_long(NtGdiGetBitmapBits(hBitmap, 5, NULL), 12); + /* test NULL pointer and count buffer size != 0 */ + ok_long(NtGdiGetBitmapBits(hBitmap, 5, NULL), 12);
- /* test NULL pointer and buffer size == 0*/ - ok_long(NtGdiGetBitmapBits(hBitmap, 0, NULL), 12); + /* test NULL pointer and buffer size == 0*/ + ok_long(NtGdiGetBitmapBits(hBitmap, 0, NULL), 12);
- /* test bad pointer */ - ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0); + /* test bad pointer */ + ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0);
- /* Test if we can set a number of bytes between lines */ - ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5); + /* Test if we can set a number of bytes between lines */ + ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5);
- /* Test alignment */ - ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4); + /* Test alignment */ + ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4);
- /* Test 1 byte too much */ - ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10); + /* Test 1 byte too much */ + ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10);
- /* Test one row too much */ - ok_long(NtGdiGetBitmapBits(hBitmap, 12, Bits), 12); + /* Test one row too much */ + ok_long(NtGdiGetBitmapBits(hBitmap, 12, Bits), 12);
- ok_long(NtGdiGetBitmapBits(hBitmap, 13, Bits), 12); + ok_long(NtGdiGetBitmapBits(hBitmap, 13, Bits), 12);
- ok_long(NtGdiGetBitmapBits(hBitmap, 100, Bits), 12); + ok_long(NtGdiGetBitmapBits(hBitmap, 100, Bits), 12);
- /* Test huge bytes count */ - ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12); + /* Test huge bytes count */ + ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12);
- /* Test negative bytes count */ - ok_long(NtGdiGetBitmapBits(hBitmap, -5, Bits), 12); + /* Test negative bytes count */ + ok_long(NtGdiGetBitmapBits(hBitmap, -5, Bits), 12);
- ok_long(GetLastError(), ERROR_SUCCESS); + ok_long(GetLastError(), ERROR_SUCCESS);
- DeleteObject(hBitmap); + DeleteObject(hBitmap); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetDIBits.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetDIBits.c index f8c45dda4e..f8069d6017 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetDIBits.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetDIBits.c @@ -33,108 +33,108 @@ DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines )
START_TEST(NtGdiGetDIBitsInternal) { - HBITMAP hBitmap; - struct - { - BITMAPINFO bi; - RGBQUAD Colors[20]; - } bmp; -// BITMAPINFO bi; - INT ScreenBpp; - BITMAPCOREINFO bic; - DWORD data[20*16]; - - HDC hDCScreen = GetDC(NULL); - ok(hDCScreen != NULL, "hDCScreen was NULL.\n"); - - hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16); - ok(hBitmap != NULL, "hBitmap was NULL.\n"); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - ZeroMemory(&bmp, sizeof(bmp)); - bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); - - SetLastError(ERROR_SUCCESS); - ok(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, - "NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(bmp.Colors[0].rgbRed, 0x44); - - ZeroMemory(&bmp, sizeof(bmp)); - bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); - - SetLastError(ERROR_SUCCESS); - ok(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, - "The return value was <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(bmp.Colors[0].rgbRed, 0x44); - - ZeroMemory(&bmp, sizeof(bmp)); - bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); - - SetLastError(ERROR_SUCCESS); - ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS, - DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - - ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL); - - ok_long(bmp.bi.bmiHeader.biWidth, 16); - ok_long(bmp.bi.bmiHeader.biHeight, 16); - ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); - ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); - - ok_int(bmp.Colors[0].rgbRed, 0x44); - - /* Test with pointer */ -// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO)); - bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); -// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344); - - SetLastError(ERROR_SUCCESS); - ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS, - DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - - ok_long(bmp.bi.bmiHeader.biWidth, 16); - ok_long(bmp.bi.bmiHeader.biHeight, 16); - ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); - ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); - - ok(bmp.Colors[0].rgbRed != 0x44, "bmp.Colors[0].rgbRed was 0x44.\n"); - - /* Test a BITMAPCOREINFO structure */ - SetLastError(ERROR_SUCCESS); - ZeroMemory(&bic, sizeof(BITMAPCOREINFO)); - bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER); - ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS, - DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0, "The return value was <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - - - ReleaseDC(NULL, hDCScreen); - DeleteObject(hBitmap); + HBITMAP hBitmap; + struct + { + BITMAPINFO bi; + RGBQUAD Colors[20]; + } bmp; +// BITMAPINFO bi; + INT ScreenBpp; + BITMAPCOREINFO bic; + DWORD data[20*16]; + + HDC hDCScreen = GetDC(NULL); + ok(hDCScreen != NULL, "hDCScreen was NULL.\n"); + + hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16); + ok(hBitmap != NULL, "hBitmap was NULL.\n"); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + ZeroMemory(&bmp, sizeof(bmp)); + bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); + + SetLastError(ERROR_SUCCESS); + ok(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, + "NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(bmp.Colors[0].rgbRed, 0x44); + + ZeroMemory(&bmp, sizeof(bmp)); + bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); + + SetLastError(ERROR_SUCCESS); + ok(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, + "The return value was <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(bmp.Colors[0].rgbRed, 0x44); + + ZeroMemory(&bmp, sizeof(bmp)); + bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); + + SetLastError(ERROR_SUCCESS); + ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS, + DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + + ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL); + + ok_long(bmp.bi.bmiHeader.biWidth, 16); + ok_long(bmp.bi.bmiHeader.biHeight, 16); + ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); + ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); + + ok_int(bmp.Colors[0].rgbRed, 0x44); + + /* Test with pointer */ +// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO)); + bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); +// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344); + + SetLastError(ERROR_SUCCESS); + ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS, + DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + + ok_long(bmp.bi.bmiHeader.biWidth, 16); + ok_long(bmp.bi.bmiHeader.biHeight, 16); + ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); + ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); + + ok(bmp.Colors[0].rgbRed != 0x44, "bmp.Colors[0].rgbRed was 0x44.\n"); + + /* Test a BITMAPCOREINFO structure */ + SetLastError(ERROR_SUCCESS); + ZeroMemory(&bic, sizeof(BITMAPCOREINFO)); + bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER); + ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS, + DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0, "The return value was <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + + + ReleaseDC(NULL, hDCScreen); + DeleteObject(hBitmap);
} diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetFontResourceInfoInternalW.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetFontResourceInfoInternalW.c index dde7d7e2be..107a00b814 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetFontResourceInfoInternalW.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetFontResourceInfoInternalW.c @@ -9,34 +9,34 @@
START_TEST(NtGdiGetFontResourceInfoInternalW) { - BOOL bRet; - DWORD dwBufSize; - LOGFONTW logfont; - UNICODE_STRING NtFileName; - - ASSERT(RtlDosPathNameToNtPathName_U(L".\test.otf", - &NtFileName, - NULL, - NULL)); - - dwBufSize = sizeof(logfont); - memset(&logfont, 0x0, dwBufSize); - - bRet = NtGdiGetFontResourceInfoInternalW( - NtFileName.Buffer, - (NtFileName.Length / sizeof(WCHAR)) +1, - 1, - dwBufSize, - &dwBufSize, - &logfont, - 2); - - ok(bRet != FALSE, "bRet was FALSE.\n"); - - printf("lfHeight = %ld\n", logfont.lfHeight); - printf("lfWidth = %ld\n", logfont.lfWidth); - printf("lfFaceName = %ls\n", logfont.lfFaceName); - -// RemoveFontResourceW(szFullFileName); + BOOL bRet; + DWORD dwBufSize; + LOGFONTW logfont; + UNICODE_STRING NtFileName; + + ASSERT(RtlDosPathNameToNtPathName_U(L".\test.otf", + &NtFileName, + NULL, + NULL)); + + dwBufSize = sizeof(logfont); + memset(&logfont, 0x0, dwBufSize); + + bRet = NtGdiGetFontResourceInfoInternalW( + NtFileName.Buffer, + (NtFileName.Length / sizeof(WCHAR)) +1, + 1, + dwBufSize, + &dwBufSize, + &logfont, + 2); + + ok(bRet != FALSE, "bRet was FALSE.\n"); + + printf("lfHeight = %ld\n", logfont.lfHeight); + printf("lfWidth = %ld\n", logfont.lfWidth); + printf("lfFaceName = %ls\n", logfont.lfFaceName); + +// RemoveFontResourceW(szFullFileName);
} diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c index 1833fdbcd2..05c501ea75 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c @@ -10,79 +10,79 @@ START_TEST(NtGdiGetRandomRgn) { HINSTANCE hinst = GetModuleHandle(NULL); - HWND hWnd; - HDC hDC; - HRGN hrgn, hrgn2; - - /* Create a window */ - hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, - NULL, NULL, hinst, 0); -// UpdateWindow(hWnd); - hDC = GetDC(hWnd); - - ok(hDC != NULL, "hDC was NULL.\n"); - - hrgn = CreateRectRgn(0,0,0,0); - hrgn2 = CreateRectRgn(3,3,10,10); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn(0, hrgn, 0), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 1), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 10), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn((HDC)2345, 0, 1), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn(hDC, 0, 0), 0); - ok_int(NtGdiGetRandomRgn(hDC, 0, 1), 0); - ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0), 0); - ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 0), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 2), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 3), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 5), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 10), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, -10), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SelectClipRgn(hDC, hrgn2); - ok_int(NtGdiGetRandomRgn(hDC, 0, 1), -1); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); - ok_int(CombineRgn(hrgn, hrgn, hrgn, RGN_OR), SIMPLEREGION); - ok_int(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR), NULLREGION); - - SetRectRgn(hrgn2,0,0,0,0); - SelectClipRgn(hDC, hrgn2); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); - - ok_int(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR), NULLREGION); - ok_int(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR), NULLREGION); - - SelectClipRgn(hDC, NULL); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); - - - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); - - ok_long(GetLastError(), ERROR_SUCCESS); - - ReleaseDC(hWnd, hDC); - DestroyWindow(hWnd); + HWND hWnd; + HDC hDC; + HRGN hrgn, hrgn2; + + /* Create a window */ + hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, + NULL, NULL, hinst, 0); +// UpdateWindow(hWnd); + hDC = GetDC(hWnd); + + ok(hDC != NULL, "hDC was NULL.\n"); + + hrgn = CreateRectRgn(0,0,0,0); + hrgn2 = CreateRectRgn(3,3,10,10); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn(0, hrgn, 0), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 1), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 10), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn((HDC)2345, 0, 1), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn(hDC, 0, 0), 0); + ok_int(NtGdiGetRandomRgn(hDC, 0, 1), 0); + ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0), 0); + ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 0), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 2), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 3), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 5), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 10), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, -10), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SelectClipRgn(hDC, hrgn2); + ok_int(NtGdiGetRandomRgn(hDC, 0, 1), -1); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); + ok_int(CombineRgn(hrgn, hrgn, hrgn, RGN_OR), SIMPLEREGION); + ok_int(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR), NULLREGION); + + SetRectRgn(hrgn2,0,0,0,0); + SelectClipRgn(hDC, hrgn2); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); + + ok_int(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR), NULLREGION); + ok_int(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR), NULLREGION); + + SelectClipRgn(hDC, NULL); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); + + + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); + + ok_long(GetLastError(), ERROR_SUCCESS); + + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd);
} diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c index d5ea7ab81e..0e39eb4d8b 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c @@ -38,10 +38,10 @@ START_TEST(NtGdiSaveDC) TEST(NtGdiSaveDC(hdc) == 2); DeleteDC(hdc);
- /* Create a window */ - hwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - 10, 10, 100, 100, - NULL, NULL, hinst, 0); + /* Create a window */ + hwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 10, 10, 100, 100, + NULL, NULL, hinst, 0); hdc = GetDC(hwnd); TEST(hdc != NULL); TEST(NtGdiSaveDC(hdc) == 1); diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBitmap.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBitmap.c index a82c2730b6..ec5acdec3a 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBitmap.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBitmap.c @@ -45,72 +45,72 @@ Test_SelectDIBSection(void)
START_TEST(NtGdiSelectBitmap) { - HDC hDC; - HBITMAP hBmp, hOldBmp; - HPALETTE hOldPalette, hPalette; - LOGPALETTE logpal = {0x300, 1, {{12,13,14,15}}}; - - hBmp = CreateBitmap(2,2,1,1,NULL); - ASSERT(hBmp); - - /* We cannot select a bitmap into a display DC */ - hDC = GetDC(NULL); - ASSERT(hDC); - hOldBmp = NtGdiSelectBitmap(hDC, hBmp); - TEST(hOldBmp == NULL); - - hDC = CreateCompatibleDC(GetDC(NULL)); - ASSERT(hDC); - - /* Check the palette before we mess it up*/ - hPalette = CreatePalette(&logpal); - hOldPalette = SelectPalette(hDC, hPalette, 0); - TEST(hOldPalette == GetStockObject(DEFAULT_PALETTE)); - - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap(NULL, hBmp); - TEST(hOldBmp == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBmp); - TEST(hOldBmp == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test NULL bitmap */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap(hDC, NULL); - TEST(hOldBmp == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test bitmap with only index */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff)); - TEST(hOldBmp == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test valid bitmap */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap(hDC, hBmp); - TEST(hOldBmp != NULL); - /* The default bitmap should be GetStockObject(21) */ - TEST(hOldBmp == GetStockObject(21)); - - /* Check the palette */ - hOldPalette = SelectPalette(hDC, hOldPalette, 0); - TEST(hOldPalette == hPalette); - DeleteObject(hPalette); - - /* Select the old one again and check */ - hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp); - TEST(hOldBmp == hBmp); - TEST(GetLastError() == ERROR_SUCCESS); - - /* cleanup */ - DeleteObject(hBmp); - DeleteDC(hDC); + HDC hDC; + HBITMAP hBmp, hOldBmp; + HPALETTE hOldPalette, hPalette; + LOGPALETTE logpal = {0x300, 1, {{12,13,14,15}}}; + + hBmp = CreateBitmap(2,2,1,1,NULL); + ASSERT(hBmp); + + /* We cannot select a bitmap into a display DC */ + hDC = GetDC(NULL); + ASSERT(hDC); + hOldBmp = NtGdiSelectBitmap(hDC, hBmp); + TEST(hOldBmp == NULL); + + hDC = CreateCompatibleDC(GetDC(NULL)); + ASSERT(hDC); + + /* Check the palette before we mess it up*/ + hPalette = CreatePalette(&logpal); + hOldPalette = SelectPalette(hDC, hPalette, 0); + TEST(hOldPalette == GetStockObject(DEFAULT_PALETTE)); + + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap(NULL, hBmp); + TEST(hOldBmp == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBmp); + TEST(hOldBmp == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test NULL bitmap */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap(hDC, NULL); + TEST(hOldBmp == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test bitmap with only index */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff)); + TEST(hOldBmp == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test valid bitmap */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap(hDC, hBmp); + TEST(hOldBmp != NULL); + /* The default bitmap should be GetStockObject(21) */ + TEST(hOldBmp == GetStockObject(21)); + + /* Check the palette */ + hOldPalette = SelectPalette(hDC, hOldPalette, 0); + TEST(hOldPalette == hPalette); + DeleteObject(hPalette); + + /* Select the old one again and check */ + hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp); + TEST(hOldBmp == hBmp); + TEST(GetLastError() == ERROR_SUCCESS); + + /* cleanup */ + DeleteObject(hBmp); + DeleteDC(hDC);
Test_SelectDIBSection();
diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBrush.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBrush.c index f117b38b03..08451977cb 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBrush.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBrush.c @@ -9,65 +9,65 @@
START_TEST(NtGdiSelectBrush) { - HDC hDC; - HBRUSH hBrush, hOldBrush; - DC_ATTR *pdcattr; - - hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); - - hBrush = GetStockObject(GRAY_BRUSH); - - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush(NULL, hBrush); - TEST(hOldBrush == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBrush); - TEST(hOldBrush == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test NULL brush */ - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush(hDC, NULL); - TEST(hOldBrush == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid brush */ - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush(hDC, (HBRUSH)((ULONG_PTR)hBrush & 0x0000ffff)); - TEST(hOldBrush == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush(hDC, hBrush); - TEST(hOldBrush != NULL); - hOldBrush = NtGdiSelectBrush(hDC, hOldBrush); - TEST(hOldBrush == hBrush); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Begin with a white brush */ - NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); - /* Select a brush in user mode */ - SelectObject(hDC, GetStockObject(BLACK_BRUSH)); - /* See what we get returned */ - hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); - TEST(hOldBrush == GetStockObject(BLACK_BRUSH)); - - - /* Begin with a white brush */ - NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); - - pdcattr = GdiGetHandleUserData(hDC); - /* Change the brush in user mode, without setting flags */ - pdcattr->hbrush = (HBRUSH)12345; - - hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH)); - TEST(hOldBrush == (HBRUSH)12345); - - - DeleteDC(hDC); + HDC hDC; + HBRUSH hBrush, hOldBrush; + DC_ATTR *pdcattr; + + hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); + + hBrush = GetStockObject(GRAY_BRUSH); + + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush(NULL, hBrush); + TEST(hOldBrush == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBrush); + TEST(hOldBrush == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test NULL brush */ + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush(hDC, NULL); + TEST(hOldBrush == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid brush */ + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush(hDC, (HBRUSH)((ULONG_PTR)hBrush & 0x0000ffff)); + TEST(hOldBrush == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush(hDC, hBrush); + TEST(hOldBrush != NULL); + hOldBrush = NtGdiSelectBrush(hDC, hOldBrush); + TEST(hOldBrush == hBrush); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Begin with a white brush */ + NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); + /* Select a brush in user mode */ + SelectObject(hDC, GetStockObject(BLACK_BRUSH)); + /* See what we get returned */ + hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); + TEST(hOldBrush == GetStockObject(BLACK_BRUSH)); + + + /* Begin with a white brush */ + NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); + + pdcattr = GdiGetHandleUserData(hDC); + /* Change the brush in user mode, without setting flags */ + pdcattr->hbrush = (HBRUSH)12345; + + hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH)); + TEST(hOldBrush == (HBRUSH)12345); + + + DeleteDC(hDC); }
diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectFont.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectFont.c index fae4c95963..08e04b28a8 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectFont.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectFont.c @@ -9,45 +9,45 @@
START_TEST(NtGdiSelectFont) { - HDC hDC; - HFONT hFont, hOldFont; - - hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); - - hFont = GetStockObject(DEFAULT_GUI_FONT); - - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont(NULL, hFont); - TEST(hOldFont == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont); - TEST(hOldFont == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test NULL font */ - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont(hDC, NULL); - TEST(hOldFont == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid font */ - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff)); - TEST(hOldFont == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont(hDC, hFont); - TEST(hOldFont != NULL); - hOldFont = NtGdiSelectFont(hDC, hOldFont); - TEST(hOldFont == hFont); - TEST(GetLastError() == ERROR_SUCCESS); - - - DeleteDC(hDC); + HDC hDC; + HFONT hFont, hOldFont; + + hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); + + hFont = GetStockObject(DEFAULT_GUI_FONT); + + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont(NULL, hFont); + TEST(hOldFont == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont); + TEST(hOldFont == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test NULL font */ + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont(hDC, NULL); + TEST(hOldFont == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid font */ + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff)); + TEST(hOldFont == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont(hDC, hFont); + TEST(hOldFont != NULL); + hOldFont = NtGdiSelectFont(hDC, hOldFont); + TEST(hOldFont == hFont); + TEST(GetLastError() == ERROR_SUCCESS); + + + DeleteDC(hDC); }
diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectPen.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectPen.c index 35c8118455..67e6d66d7e 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectPen.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectPen.c @@ -9,69 +9,69 @@
START_TEST(NtGdiSelectPen) { - HDC hDC; - HPEN hPen, hOldPen; - LOGBRUSH logbrush; + HDC hDC; + HPEN hPen, hOldPen; + LOGBRUSH logbrush;
- hDC = GetDC(NULL); - ASSERT(hDC); + hDC = GetDC(NULL); + ASSERT(hDC);
- hPen = GetStockObject(WHITE_PEN); + hPen = GetStockObject(WHITE_PEN);
- /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(NULL, hPen); - TEST(hOldPen == NULL); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(NULL, hPen); + TEST(hOldPen == NULL); + TEST(GetLastError() == ERROR_SUCCESS);
- /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen); - TEST(hOldPen == NULL); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen); + TEST(hOldPen == NULL); + TEST(GetLastError() == ERROR_SUCCESS);
- /* Test NULL pen */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(hDC, NULL); - TEST(hOldPen == NULL); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test NULL pen */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(hDC, NULL); + TEST(hOldPen == NULL); + TEST(GetLastError() == ERROR_SUCCESS);
- /* Test invalid pen */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff)); - TEST(hOldPen == NULL); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test invalid pen */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff)); + TEST(hOldPen == NULL); + TEST(GetLastError() == ERROR_SUCCESS);
- /* Test valid pen */ - SelectObject(hDC, GetStockObject(BLACK_PEN)); - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(hDC, hPen); - TEST(hOldPen == GetStockObject(BLACK_PEN)); - hOldPen = NtGdiSelectPen(hDC, hOldPen); - TEST(hOldPen == hPen); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test valid pen */ + SelectObject(hDC, GetStockObject(BLACK_PEN)); + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(hDC, hPen); + TEST(hOldPen == GetStockObject(BLACK_PEN)); + hOldPen = NtGdiSelectPen(hDC, hOldPen); + TEST(hOldPen == hPen); + TEST(GetLastError() == ERROR_SUCCESS);
- /* Test extpen */ - SetLastError(ERROR_SUCCESS); - logbrush.lbStyle = BS_SOLID; - logbrush.lbColor = RGB(0x12,0x34,0x56); - hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL); - ASSERT(hPen); - hOldPen = NtGdiSelectPen(hDC, hPen); - TEST(hOldPen != NULL); - hOldPen = NtGdiSelectPen(hDC, hOldPen); - TEST(hOldPen == hPen); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test extpen */ + SetLastError(ERROR_SUCCESS); + logbrush.lbStyle = BS_SOLID; + logbrush.lbColor = RGB(0x12,0x34,0x56); + hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL); + ASSERT(hPen); + hOldPen = NtGdiSelectPen(hDC, hPen); + TEST(hOldPen != NULL); + hOldPen = NtGdiSelectPen(hDC, hOldPen); + TEST(hOldPen == hPen); + TEST(GetLastError() == ERROR_SUCCESS);
- /* Test deleting pen */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(hDC, hPen); - TEST(DeleteObject(hPen) == 1); - hOldPen = NtGdiSelectPen(hDC, hOldPen); - TEST(hOldPen == hPen); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test deleting pen */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(hDC, hPen); + TEST(DeleteObject(hPen) == 1); + hOldPen = NtGdiSelectPen(hDC, hOldPen); + TEST(hOldPen == hPen); + TEST(GetLastError() == ERROR_SUCCESS);
- /* Test that fallback pen is BLACK_PEN */ + /* Test that fallback pen is BLACK_PEN */
- DeleteDC(hDC); + DeleteDC(hDC); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c index 983c90e3b4..ff8e3e9dac 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c @@ -10,89 +10,89 @@ void ReadBits(HDC hDC, PDWORD OutBits) { - int x,y; - - for (y = 0; y < 8; y++) - { - DWORD Row = 0; - for (x = 0; x < 8; x++) - Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; - OutBits[y] = Row; - } + int x,y; + + for (y = 0; y < 8; y++) + { + DWORD Row = 0; + for (x = 0; x < 8; x++) + Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; + OutBits[y] = Row; + } }
START_TEST(NtGdiSetDIBitsToDeviceInternal) { - static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 }; - DWORD OutBits[8]; - XFORM xform; - - HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE, - 100, 100, 200, 200, - NULL, NULL, NULL, NULL); - /* This DC has an nonzero origin */ - HDC hDC = GetDC(hWnd); - struct - { - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[2]; - } bmi; - int x, y; - - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = 8; - bmi.bmiHeader.biHeight = -8; - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 1; - bmi.bmiHeader.biCompression = 0; - bmi.bmiHeader.biSizeImage = 0; - bmi.bmiHeader.biXPelsPerMeter = 0; - bmi.bmiHeader.biYPelsPerMeter = 0; - bmi.bmiHeader.biClrUsed = 0; - bmi.bmiHeader.biClrImportant = 0; - *(DWORD *)&bmi.bmiColors[0] = 0x000000; - *(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF; - - /* The destination coordinates are relative to the DC origin */ - TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, - (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, - sizeof(InBits), sizeof(bmi), TRUE, NULL)); - - /* Now get the data from the screen, and see if it matches */ - ReadBits(hDC, OutBits); - - TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); - - /* Change transformation */ - GetWorldTransform(hDC, &xform); - xform.eM11 = 2; - xform.eM22 = 2; - xform.eDx = 10; - SetWorldTransform(hDC, &xform); - - TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, - (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, - sizeof(InBits), sizeof(bmi), TRUE, NULL)); - - xform.eM11 = 1; - xform.eM22 = 1; - xform.eDx = 0; - SetWorldTransform(hDC, &xform); - - /* Now get the data from the screen, and see if it matches */ - for (y = 0; y < 8; y++) - { - DWORD Row = 0; - for (x = 0; x < 8; x++) - Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; - OutBits[y] = Row; - } - - TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); - - - ReleaseDC(hWnd, hDC); - DestroyWindow(hWnd); + static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 }; + DWORD OutBits[8]; + XFORM xform; + + HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE, + 100, 100, 200, 200, + NULL, NULL, NULL, NULL); + /* This DC has an nonzero origin */ + HDC hDC = GetDC(hWnd); + struct + { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[2]; + } bmi; + int x, y; + + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = 8; + bmi.bmiHeader.biHeight = -8; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 1; + bmi.bmiHeader.biCompression = 0; + bmi.bmiHeader.biSizeImage = 0; + bmi.bmiHeader.biXPelsPerMeter = 0; + bmi.bmiHeader.biYPelsPerMeter = 0; + bmi.bmiHeader.biClrUsed = 0; + bmi.bmiHeader.biClrImportant = 0; + *(DWORD *)&bmi.bmiColors[0] = 0x000000; + *(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF; + + /* The destination coordinates are relative to the DC origin */ + TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, + (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, + sizeof(InBits), sizeof(bmi), TRUE, NULL)); + + /* Now get the data from the screen, and see if it matches */ + ReadBits(hDC, OutBits); + + TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); + + /* Change transformation */ + GetWorldTransform(hDC, &xform); + xform.eM11 = 2; + xform.eM22 = 2; + xform.eDx = 10; + SetWorldTransform(hDC, &xform); + + TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, + (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, + sizeof(InBits), sizeof(bmi), TRUE, NULL)); + + xform.eM11 = 1; + xform.eM22 = 1; + xform.eDx = 0; + SetWorldTransform(hDC, &xform); + + /* Now get the data from the screen, and see if it matches */ + for (y = 0; y < 8; y++) + { + DWORD Row = 0; + for (x = 0; x < 8; x++) + Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; + OutBits[y] = Row; + } + + TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); + + + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd);
} diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwnd.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwnd.c index 4d4b7ba4d4..7fd6881361 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwnd.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwnd.c @@ -10,22 +10,22 @@ void Test_HwndRoutine_DeregisterShellHookWindow(HWND hWnd) { - TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW) == TRUE); + TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW) == TRUE);
}
void Test_HwndRoutine_GetWindowContextHelpId (HWND hWnd) { - TEST(NtUserCallHwndParam(hWnd, 0xbadb00b, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); - TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_GETWNDCONTEXTHLPID) == 0xbadb00b); + TEST(NtUserCallHwndParam(hWnd, 0xbadb00b, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); + TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_GETWNDCONTEXTHLPID) == 0xbadb00b);
}
void Test_HwndRoutine_SetMsgBox(HWND hWnd) { - TEST(NtUserCallHwnd(hWnd, 0x49) != FALSE); + TEST(NtUserCallHwnd(hWnd, 0x49) != FALSE);
}
@@ -34,27 +34,27 @@ START_TEST(NtUserCallHwnd) { HWND hWnd;
- hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - NULL, - g_hInstance, - 0); - ASSERT(hWnd); - - SetLastError(ERROR_SUCCESS); - TEST(NtUserCallHwnd(hWnd, 0x44) == FALSE); - Test_HwndRoutine_DeregisterShellHookWindow(hWnd); /* 0x45 */ - TEST(NtUserCallHwnd(hWnd, 0x46) == FALSE); // DWP_GetEnabledPopup - Test_HwndRoutine_GetWindowContextHelpId (hWnd); /* 0x47 */ - TEST(NtUserCallHwnd(hWnd, 0x48) == TRUE); - Test_HwndRoutine_SetMsgBox(hWnd); /* 0x49 */ - TEST(GetLastError() == ERROR_SUCCESS); - - DestroyWindow(hWnd); + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + NULL, + g_hInstance, + 0); + ASSERT(hWnd); + + SetLastError(ERROR_SUCCESS); + TEST(NtUserCallHwnd(hWnd, 0x44) == FALSE); + Test_HwndRoutine_DeregisterShellHookWindow(hWnd); /* 0x45 */ + TEST(NtUserCallHwnd(hWnd, 0x46) == FALSE); // DWP_GetEnabledPopup + Test_HwndRoutine_GetWindowContextHelpId (hWnd); /* 0x47 */ + TEST(NtUserCallHwnd(hWnd, 0x48) == TRUE); + Test_HwndRoutine_SetMsgBox(hWnd); /* 0x49 */ + TEST(GetLastError() == ERROR_SUCCESS); + + DestroyWindow(hWnd); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndLock.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndLock.c index 60b606c74c..c16bebe164 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndLock.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndLock.c @@ -15,7 +15,7 @@ HMENU g_hMenu; void Test_HwndLockRoutine_WindowHasShadow(HWND hWnd) /* 0x53 */ { -// TEST(NtUserCallHwndLock(hWnd, 0x53) == 0); +// TEST(NtUserCallHwndLock(hWnd, 0x53) == 0);
}
@@ -23,86 +23,86 @@ Test_HwndLockRoutine_WindowHasShadow(HWND hWnd) /* 0x53 */ void Test_HwndLockRoutine_ArrangeIconicWindows(HWND hWnd) /* 0x54 */ { -// TEST(NtUserCallHwndLock(hWnd, _HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS) == 0); +// TEST(NtUserCallHwndLock(hWnd, _HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS) == 0);
}
void Test_HwndLockRoutine_DrawMenuBar(HWND hWnd) /* 0x55 */ { - TEST(NtUserCallHwndLock(hWnd, 0x55) == 1); - return APISTATUS_NORMAL; + TEST(NtUserCallHwndLock(hWnd, 0x55) == 1); + return APISTATUS_NORMAL; }
void Test_HwndLockRoutine_CheckImeShowStatusInThread(HWND hWnd) /* 0x56 */ { - TEST(NtUserCallHwndLock(hWnd, 0x56) != 0); + TEST(NtUserCallHwndLock(hWnd, 0x56) != 0);
}
void Test_HwndLockRoutine_GetSysMenuHandle(HWND hWnd) /* 0x57 */ { - NtUserCallHwndLock(hWnd, 0x5c); -// HMENU hMenu = (HMENU)NtUserCallHwndLock(hWnd, 0x57); -// TEST(hMenu != 0); + NtUserCallHwndLock(hWnd, 0x5c); +// HMENU hMenu = (HMENU)NtUserCallHwndLock(hWnd, 0x57); +// TEST(hMenu != 0);
}
void Test_HwndLockRoutine_RedrawFrame(HWND hWnd) /* 0x58 */ { -// TEST(NtUserCallHwndLock(hWnd, 0x68) != 0); +// TEST(NtUserCallHwndLock(hWnd, 0x68) != 0);
}
void Test_HwndLockRoutine_UpdateWindow(HWND hWnd) /* 0x5e */ { - TEST(NtUserCallHwndLock(hWnd, 0x5e) == 1); + TEST(NtUserCallHwndLock(hWnd, 0x5e) == 1);
}
START_TEST(NtUserCallHwndLock) { - HWND hWnd; - g_hMenu = CreateMenu(); - - hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - g_hMenu, - g_hInstance, - 0); - ASSERT(hWnd); - - SetLastError(ERROR_SUCCESS); - TEST(NtUserCallHwndLock((HWND)-22, 999) == 0); - TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); - - SetLastError(ERROR_SUCCESS); - TEST(NtUserCallHwndLock((HWND)0, 0x55) == 0); - TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); - - SetLastError(ERROR_SUCCESS); - TEST(NtUserCallHwndLock(hWnd, 999) == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - Test_HwndLockRoutine_WindowHasShadow (hWnd); /* 0x53 */ - Test_HwndLockRoutine_ArrangeIconicWindows(hWnd); - Test_HwndLockRoutine_DrawMenuBar(hWnd); - Test_HwndLockRoutine_CheckImeShowStatusInThread(hWnd); - Test_HwndLockRoutine_GetSysMenuHandle(hWnd); - Test_HwndLockRoutine_RedrawFrame(hWnd); - - Test_HwndLockRoutine_UpdateWindow(hWnd); - - DestroyWindow(hWnd); + HWND hWnd; + g_hMenu = CreateMenu(); + + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + g_hMenu, + g_hInstance, + 0); + ASSERT(hWnd); + + SetLastError(ERROR_SUCCESS); + TEST(NtUserCallHwndLock((HWND)-22, 999) == 0); + TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); + + SetLastError(ERROR_SUCCESS); + TEST(NtUserCallHwndLock((HWND)0, 0x55) == 0); + TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); + + SetLastError(ERROR_SUCCESS); + TEST(NtUserCallHwndLock(hWnd, 999) == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + Test_HwndLockRoutine_WindowHasShadow (hWnd); /* 0x53 */ + Test_HwndLockRoutine_ArrangeIconicWindows(hWnd); + Test_HwndLockRoutine_DrawMenuBar(hWnd); + Test_HwndLockRoutine_CheckImeShowStatusInThread(hWnd); + Test_HwndLockRoutine_GetSysMenuHandle(hWnd); + Test_HwndLockRoutine_RedrawFrame(hWnd); + + Test_HwndLockRoutine_UpdateWindow(hWnd); + + DestroyWindow(hWnd);
} diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndOpt.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndOpt.c index 7777b09730..1d98af434d 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndOpt.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndOpt.c @@ -10,18 +10,18 @@ void Test_HwndOptRoutine_SetProgmanWindow(void) /* 0x4a */ { -// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETPROGMANWINDOW); +// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETPROGMANWINDOW); }
void Test_HwndOptRoutine_SetTaskmanWindow (void) /* 0x4b */ { -// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETTASKMANWINDOW); +// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETTASKMANWINDOW); }
START_TEST(NtUserCallHwndOpt) {
- Test_HwndOptRoutine_SetProgmanWindow(pti); /* 0x4a */ - Test_HwndOptRoutine_SetTaskmanWindow (pti); /* 0x4b */ + Test_HwndOptRoutine_SetProgmanWindow(pti); /* 0x4a */ + Test_HwndOptRoutine_SetTaskmanWindow (pti); /* 0x4b */ } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndParam.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndParam.c index b7c02c1451..93f321c5f7 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndParam.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndParam.c @@ -10,28 +10,28 @@ void Test_HwndParamRoutine_SetWindowContextHelpId(HWND hWnd) { - TEST(NtUserCallHwndParam(hWnd, 12345, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); - TEST(NtUserCallHwnd(hWnd, HWND_ROUTINE_GETWNDCONTEXTHLPID) == 12345); + TEST(NtUserCallHwndParam(hWnd, 12345, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); + TEST(NtUserCallHwnd(hWnd, HWND_ROUTINE_GETWNDCONTEXTHLPID) == 12345); }
START_TEST(NtUserCallHwndParam) { HWND hWnd;
- hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - NULL, - g_hInstance, - 0); - ASSERT(hWnd); + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + NULL, + g_hInstance, + 0); + ASSERT(hWnd);
- Test_HwndParamRoutine_SetWindowContextHelpId(hWnd); + Test_HwndParamRoutine_SetWindowContextHelpId(hWnd);
- DestroyWindow(hWnd); + DestroyWindow(hWnd); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallNoParam.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallNoParam.c index 3f3b0743d4..1d269080bc 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallNoParam.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallNoParam.c @@ -10,22 +10,22 @@ void Test_NoParamRoutine_CreateMenu(void) /* 0 */ { - HMENU hMenu; + HMENU hMenu;
- hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENU); - TEST(IsMenu(hMenu) == TRUE); - DestroyMenu(hMenu); + hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENU); + TEST(IsMenu(hMenu) == TRUE); + DestroyMenu(hMenu);
}
void Test_NoParamRoutine_CreatePopupMenu(void) /* 1 */ { - HMENU hMenu; + HMENU hMenu;
- hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENUPOPUP); - TEST(IsMenu(hMenu) == TRUE); - DestroyMenu(hMenu); + hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENUPOPUP); + TEST(IsMenu(hMenu) == TRUE); + DestroyMenu(hMenu);
}
@@ -56,19 +56,19 @@ Test_NoParamRoutine_DestroyCaret(void) /* 5 */ void Test_NoParamRoutine_LoadUserApiHook(void) /* 0x1d */ { - //DWORD dwRet; - /* dwRet = */NtUserCallNoParam(_NOPARAM_ROUTINE_LOADUSERAPIHOOK); + //DWORD dwRet; + /* dwRet = */NtUserCallNoParam(_NOPARAM_ROUTINE_LOADUSERAPIHOOK);
-// TEST(dwRet != 0); +// TEST(dwRet != 0);
}
START_TEST(NtUserCallNoParam) { - Test_NoParamRoutine_CreateMenu(); - Test_NoParamRoutine_CreatePopupMenu(); - Test_NoParamRoutine_LoadUserApiHook(); /* 0x1d */ + Test_NoParamRoutine_CreateMenu(); + Test_NoParamRoutine_CreatePopupMenu(); + Test_NoParamRoutine_LoadUserApiHook(); /* 0x1d */
- return APISTATUS_NORMAL; + return APISTATUS_NORMAL; } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallOneParam.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallOneParam.c index abddf87f1e..1fce205bda 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallOneParam.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallOneParam.c @@ -12,85 +12,85 @@ void Test_OneParamRoutine_BeginDeferWindowPos(void) /* 0x1e */ { - HDWP hWinPosInfo; + HDWP hWinPosInfo;
- hWinPosInfo = (HDWP)NtUserCallOneParam(5, 0x1e); - TEST(hWinPosInfo != 0); - TEST(EndDeferWindowPos(hWinPosInfo) != 0); + hWinPosInfo = (HDWP)NtUserCallOneParam(5, 0x1e); + TEST(hWinPosInfo != 0); + TEST(EndDeferWindowPos(hWinPosInfo) != 0);
}
void Test_OneParamRoutine_WindowFromDC(void) /* 0x1f */ { - HDC hDC = GetDC(NULL); - HWND hWnd; + HDC hDC = GetDC(NULL); + HWND hWnd;
- hWnd = (HWND)NtUserCallOneParam((DWORD)hDC, 0x1f); - TEST(hWnd != 0); - TEST(IsWindow(hWnd)); - TEST(hWnd == GetDesktopWindow()); + hWnd = (HWND)NtUserCallOneParam((DWORD)hDC, 0x1f); + TEST(hWnd != 0); + TEST(IsWindow(hWnd)); + TEST(hWnd == GetDesktopWindow());
}
void Test_OneParamRoutine_CreateEmptyCurObject(void) /* XP/2k3 : 0x21, vista 0x25 */ { - HICON hIcon ; + HICON hIcon ;
- /* Test 0 */ - hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); - TEST(hIcon != NULL); + /* Test 0 */ + hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); + TEST(hIcon != NULL);
- TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); + TEST(NtUserDestroyCursor(hIcon, 0) == TRUE);
- /* Test Garbage */ - hIcon = (HICON) NtUserCallOneParam(0xdeadbeef, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); - TEST(hIcon != NULL); + /* Test Garbage */ + hIcon = (HICON) NtUserCallOneParam(0xdeadbeef, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); + TEST(hIcon != NULL);
- TEST(NtUserDestroyCursor(hIcon, 0xbaadf00d) == TRUE); + TEST(NtUserDestroyCursor(hIcon, 0xbaadf00d) == TRUE);
}
void Test_OneParamRoutine_MapDesktopObject(void) /* 0x30 */ { - DWORD pObject; - HWND hWnd; - HMENU hMenu; + DWORD pObject; + HWND hWnd; + HMENU hMenu;
- hWnd = GetDesktopWindow(); - pObject = NtUserCallOneParam((DWORD)hWnd, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); - TEST(pObject > 0); - TEST(pObject < 0x80000000); + hWnd = GetDesktopWindow(); + pObject = NtUserCallOneParam((DWORD)hWnd, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); + TEST(pObject > 0); + TEST(pObject < 0x80000000);
- hMenu = CreateMenu(); - pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); - DestroyMenu(hMenu); - TEST(pObject > 0); - TEST(pObject < 0x80000000); + hMenu = CreateMenu(); + pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); + DestroyMenu(hMenu); + TEST(pObject > 0); + TEST(pObject < 0x80000000);
}
void Test_OneParamRoutine_SwapMouseButtons(void) /* 0x42 */ { - BOOL bInverse; + BOOL bInverse;
- NtUserCallOneParam(TRUE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); - bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); - TEST(bInverse == TRUE); - bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); - TEST(bInverse == FALSE); + NtUserCallOneParam(TRUE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); + bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); + TEST(bInverse == TRUE); + bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); + TEST(bInverse == FALSE);
- // TODO: test other values + // TODO: test other values }
START_TEST(NtUserCallOneParam) { - Test_OneParamRoutine_BeginDeferWindowPos(); /* 0x1e */ - Test_OneParamRoutine_WindowFromDC(); /* 0x1f */ - Test_OneParamRoutine_CreateEmptyCurObject(); /* XP/2k3 : 0x21, vista 0x25 */ - Test_OneParamRoutine_MapDesktopObject(); /* 0x30 */ - Test_OneParamRoutine_SwapMouseButtons(); /* 0x42 */ + Test_OneParamRoutine_BeginDeferWindowPos(); /* 0x1e */ + Test_OneParamRoutine_WindowFromDC(); /* 0x1f */ + Test_OneParamRoutine_CreateEmptyCurObject(); /* XP/2k3 : 0x21, vista 0x25 */ + Test_OneParamRoutine_MapDesktopObject(); /* 0x30 */ + Test_OneParamRoutine_SwapMouseButtons(); /* 0x42 */ } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCountClipboardFormats.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCountClipboardFormats.c index 465ca21181..5dccf655d6 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCountClipboardFormats.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCountClipboardFormats.c @@ -10,6 +10,6 @@
START_TEST(NtUserCountClipboardFormats) { - RTEST(NtUserCountClipboardFormats() < 1000); + RTEST(NtUserCountClipboardFormats() < 1000); }
diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplayMonitors.c b/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplayMonitors.c index 666cce4955..317234320f 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplayMonitors.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplayMonitors.c @@ -43,7 +43,7 @@ START_TEST(NtUserEnumDisplayMonitors) BOOL ret;
// WILL crash! -// TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0); +// TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0);
ret = NtUserEnumDisplayMonitors(0, NULL, MonitorEnumProc, 0); TEST(ret == TRUE); diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplaySettings.c b/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplaySettings.c index 00944f5769..0e8e0a4b7d 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplaySettings.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplaySettings.c @@ -11,97 +11,97 @@
static struct { - DEVMODEW devmode; - CHAR buffer[0xffff]; + DEVMODEW devmode; + CHAR buffer[0xffff]; } data;
START_TEST(NtUserEnumDisplaySettings) { - UNICODE_STRING usDeviceName; - WCHAR szName[] = L"DISPLAY"; - NTSTATUS Status; - INT i; - - SetLastError(ERROR_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 0, 0, 0); - TEST(Status == STATUS_ACCESS_VIOLATION); - TEST(GetLastError() == ERROR_SUCCESS); - - data.devmode.dmDriverExtra = 0; - for (i = 0; i < 2 * sizeof(DEVMODEW); i++) - { - data.devmode.dmSize = i; - Status = NtUserEnumDisplaySettings(NULL, 1000, (DEVMODEW*)&data, 0); - if (i != sizeof(DEVMODEW)) - { - TEST(Status == STATUS_BUFFER_TOO_SMALL); - } - } - TEST(GetLastError() == ERROR_SUCCESS); - - usDeviceName.Buffer = NULL; - usDeviceName.Length = 0; - usDeviceName.MaximumLength = 0; - Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_BUFFER_TOO_SMALL); - Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_BUFFER_TOO_SMALL); - - data.devmode.dmSize = sizeof(DEVMODEW); - data.devmode.dmDriverExtra = 0xffff; - Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - - data.devmode.dmSize = sizeof(DEVMODEW); - data.devmode.dmDriverExtra = 0; - Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - - usDeviceName.Buffer = NULL; - usDeviceName.Length = 0; - usDeviceName.MaximumLength = 0; - Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_1); - Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_1); - - Status = NtUserEnumDisplaySettings(NULL, 0, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 1, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 2, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 4, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 8, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - - Status = NtUserEnumDisplaySettings(NULL, 247, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 248, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_2); - - Status = NtUserEnumDisplaySettings(NULL, -1, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, -2, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, -3, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, -4, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_2); - - Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_1); - - usDeviceName.Buffer = szName; - usDeviceName.Length = (USHORT)wcslen(szName); - usDeviceName.MaximumLength = usDeviceName.Length; - Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_1); - - Status = NtUserEnumDisplaySettings(&usDeviceName, 1000, (DEVMODEW*)&data, 123456); - TEST(Status == STATUS_INVALID_PARAMETER_1); - - TEST(GetLastError() == ERROR_SUCCESS); + UNICODE_STRING usDeviceName; + WCHAR szName[] = L"DISPLAY"; + NTSTATUS Status; + INT i; + + SetLastError(ERROR_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 0, 0, 0); + TEST(Status == STATUS_ACCESS_VIOLATION); + TEST(GetLastError() == ERROR_SUCCESS); + + data.devmode.dmDriverExtra = 0; + for (i = 0; i < 2 * sizeof(DEVMODEW); i++) + { + data.devmode.dmSize = i; + Status = NtUserEnumDisplaySettings(NULL, 1000, (DEVMODEW*)&data, 0); + if (i != sizeof(DEVMODEW)) + { + TEST(Status == STATUS_BUFFER_TOO_SMALL); + } + } + TEST(GetLastError() == ERROR_SUCCESS); + + usDeviceName.Buffer = NULL; + usDeviceName.Length = 0; + usDeviceName.MaximumLength = 0; + Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_BUFFER_TOO_SMALL); + Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_BUFFER_TOO_SMALL); + + data.devmode.dmSize = sizeof(DEVMODEW); + data.devmode.dmDriverExtra = 0xffff; + Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + + data.devmode.dmSize = sizeof(DEVMODEW); + data.devmode.dmDriverExtra = 0; + Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + + usDeviceName.Buffer = NULL; + usDeviceName.Length = 0; + usDeviceName.MaximumLength = 0; + Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_1); + Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_1); + + Status = NtUserEnumDisplaySettings(NULL, 0, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 1, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 2, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 4, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 8, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + + Status = NtUserEnumDisplaySettings(NULL, 247, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 248, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_2); + + Status = NtUserEnumDisplaySettings(NULL, -1, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, -2, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, -3, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, -4, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_2); + + Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_1); + + usDeviceName.Buffer = szName; + usDeviceName.Length = (USHORT)wcslen(szName); + usDeviceName.MaximumLength = usDeviceName.Length; + Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_1); + + Status = NtUserEnumDisplaySettings(&usDeviceName, 1000, (DEVMODEW*)&data, 123456); + TEST(Status == STATUS_INVALID_PARAMETER_1); + + TEST(GetLastError() == ERROR_SUCCESS);
} diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserGetClassInfo.c b/modules/rostests/apitests/win32nt/ntuser/NtUserGetClassInfo.c index 4aa40a8232..1e2a8a7926 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserGetClassInfo.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserGetClassInfo.c @@ -10,32 +10,32 @@ START_TEST(NtUserGetClassInfo) { HINSTANCE hinst = GetModuleHandle(NULL); - WNDCLASSEXW wclex, wclex2 = {0}; - UNICODE_STRING us; - PWSTR pwstr = NULL; - - us.Length = 8; - us.MaximumLength = 8; - us.Buffer = L"test"; - - wclex.cbSize = sizeof(WNDCLASSEXW); - wclex.style = 0; - wclex.lpfnWndProc = NULL; - wclex.cbClsExtra = 2; - wclex.cbWndExtra = 4; - wclex.hInstance = hinst; - wclex.hIcon = NULL; - wclex.hCursor = NULL; - wclex.hbrBackground = CreateSolidBrush(RGB(4,7,5)); - wclex.lpszMenuName = L"MyMenu"; - wclex.lpszClassName = us.Buffer; - wclex.hIconSm = NULL; - - ASSERT(RegisterClassExW(&wclex) != 0); - - TEST(GetClassInfoExW(hinst, us.Buffer, &wclex) != 0); - wclex2.cbSize = sizeof(WNDCLASSEXW); - TEST(NtUserGetClassInfo(hinst, &us, &wclex2, &pwstr, 0) != 0); + WNDCLASSEXW wclex, wclex2 = {0}; + UNICODE_STRING us; + PWSTR pwstr = NULL; + + us.Length = 8; + us.MaximumLength = 8; + us.Buffer = L"test"; + + wclex.cbSize = sizeof(WNDCLASSEXW); + wclex.style = 0; + wclex.lpfnWndProc = NULL; + wclex.cbClsExtra = 2; + wclex.cbWndExtra = 4; + wclex.hInstance = hinst; + wclex.hIcon = NULL; + wclex.hCursor = NULL; + wclex.hbrBackground = CreateSolidBrush(RGB(4,7,5)); + wclex.lpszMenuName = L"MyMenu"; + wclex.lpszClassName = us.Buffer; + wclex.hIconSm = NULL; + + ASSERT(RegisterClassExW(&wclex) != 0); + + TEST(GetClassInfoExW(hinst, us.Buffer, &wclex) != 0); + wclex2.cbSize = sizeof(WNDCLASSEXW); + TEST(NtUserGetClassInfo(hinst, &us, &wclex2, &pwstr, 0) != 0);
TEST(pwstr == wclex.lpszMenuName); TEST(wclex2.cbSize == wclex.cbSize); diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserGetIconInfo.c b/modules/rostests/apitests/win32nt/ntuser/NtUserGetIconInfo.c index 222b5bc517..2df139a5d7 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserGetIconInfo.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserGetIconInfo.c @@ -9,151 +9,151 @@
START_TEST(NtUserGetIconInfo) { - HICON hIcon; - ICONINFO iinfo; - HBITMAP mask, color; - UNICODE_STRING hInstStr; - UNICODE_STRING ResourceStr; - DWORD bpp = 0; - - ZeroMemory(&iinfo, sizeof(ICONINFO)); - - /* BASIC TESTS */ - hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); - TEST(hIcon != NULL); - - /* Last param is unknown */ - TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE); - TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE); - - TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); - - mask = CreateBitmap(16,16,1,1,NULL); - color = CreateBitmap(16,16,1,16,NULL); - - iinfo.hbmMask = mask; - iinfo.hbmColor = color ; - iinfo.fIcon = TRUE; - iinfo.xHotspot = 8; - iinfo.yHotspot = 8; - - hIcon = CreateIconIndirect(&iinfo); - TEST(hIcon!=NULL); - - // TODO : test last parameter... - TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE); - - TEST(iinfo.hbmMask != NULL); - TEST(iinfo.hbmColor != NULL); - TEST(iinfo.fIcon == TRUE); - TEST(iinfo.yHotspot == 8); - TEST(iinfo.xHotspot == 8); - - TEST(iinfo.hbmMask != mask); - TEST(iinfo.hbmColor != color); - - /* Does it make a difference? */ - TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE); - - TEST(iinfo.hbmMask != NULL); - TEST(iinfo.hbmColor != NULL); - TEST(iinfo.fIcon == TRUE); - TEST(iinfo.yHotspot == 8); - TEST(iinfo.xHotspot == 8); - - TEST(iinfo.hbmMask != mask); - TEST(iinfo.hbmColor != color); - - DeleteObject(mask); - DeleteObject(color); - - DestroyIcon(hIcon); - - /* Test full param, with local icon */ - hIcon = LoadImageA(GetModuleHandle(NULL), - MAKEINTRESOURCE(IDI_ICON), - IMAGE_ICON, - 0, - 0, - LR_DEFAULTSIZE); - - TEST(hIcon != NULL); - - RtlInitUnicodeString(&hInstStr, NULL); - RtlInitUnicodeString(&ResourceStr, NULL); - - TEST(NtUserGetIconInfo(hIcon, - &iinfo, - &hInstStr, - &ResourceStr, - &bpp, - FALSE) == TRUE); - - TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); - TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); - TEST(bpp == 32); - - /* Last param doesn't seem to matter*/ - TEST(NtUserGetIconInfo(hIcon, - &iinfo, - &hInstStr, - &ResourceStr, - &bpp, - TRUE) == TRUE); - - TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); - TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); - TEST(bpp == 32); - - DestroyIcon(hIcon); - - /* Test full param, with foreign icon */ - hIcon = LoadImageA(GetModuleHandleA("shell32.dll"), - MAKEINTRESOURCE(293), - IMAGE_ICON, - 0, - 0, - LR_DEFAULTSIZE); + HICON hIcon; + ICONINFO iinfo; + HBITMAP mask, color; + UNICODE_STRING hInstStr; + UNICODE_STRING ResourceStr; + DWORD bpp = 0; + + ZeroMemory(&iinfo, sizeof(ICONINFO)); + + /* BASIC TESTS */ + hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); + TEST(hIcon != NULL); + + /* Last param is unknown */ + TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE); + TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE); + + TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); + + mask = CreateBitmap(16,16,1,1,NULL); + color = CreateBitmap(16,16,1,16,NULL); + + iinfo.hbmMask = mask; + iinfo.hbmColor = color ; + iinfo.fIcon = TRUE; + iinfo.xHotspot = 8; + iinfo.yHotspot = 8; + + hIcon = CreateIconIndirect(&iinfo); + TEST(hIcon!=NULL); + + // TODO : test last parameter... + TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE); + + TEST(iinfo.hbmMask != NULL); + TEST(iinfo.hbmColor != NULL); + TEST(iinfo.fIcon == TRUE); + TEST(iinfo.yHotspot == 8); + TEST(iinfo.xHotspot == 8); + + TEST(iinfo.hbmMask != mask); + TEST(iinfo.hbmColor != color); + + /* Does it make a difference? */ + TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE); + + TEST(iinfo.hbmMask != NULL); + TEST(iinfo.hbmColor != NULL); + TEST(iinfo.fIcon == TRUE); + TEST(iinfo.yHotspot == 8); + TEST(iinfo.xHotspot == 8); + + TEST(iinfo.hbmMask != mask); + TEST(iinfo.hbmColor != color); + + DeleteObject(mask); + DeleteObject(color); + + DestroyIcon(hIcon); + + /* Test full param, with local icon */ + hIcon = LoadImageA(GetModuleHandle(NULL), + MAKEINTRESOURCE(IDI_ICON), + IMAGE_ICON, + 0, + 0, + LR_DEFAULTSIZE); + + TEST(hIcon != NULL); + + RtlInitUnicodeString(&hInstStr, NULL); + RtlInitUnicodeString(&ResourceStr, NULL); + + TEST(NtUserGetIconInfo(hIcon, + &iinfo, + &hInstStr, + &ResourceStr, + &bpp, + FALSE) == TRUE); + + TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); + TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); + TEST(bpp == 32); + + /* Last param doesn't seem to matter*/ + TEST(NtUserGetIconInfo(hIcon, + &iinfo, + &hInstStr, + &ResourceStr, + &bpp, + TRUE) == TRUE); + + TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); + TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); + TEST(bpp == 32); + + DestroyIcon(hIcon); + + /* Test full param, with foreign icon */ + hIcon = LoadImageA(GetModuleHandleA("shell32.dll"), + MAKEINTRESOURCE(293), + IMAGE_ICON, + 0, + 0, + LR_DEFAULTSIZE);
- TEST(hIcon != NULL); + TEST(hIcon != NULL);
hInstStr.Buffer = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR)); hInstStr.MaximumLength = MAX_PATH; hInstStr.Length = 0; - RtlInitUnicodeString(&ResourceStr, NULL); + RtlInitUnicodeString(&ResourceStr, NULL);
- TEST(NtUserGetIconInfo(hIcon, - &iinfo, - &hInstStr, - &ResourceStr, - &bpp, - FALSE) == TRUE); + TEST(NtUserGetIconInfo(hIcon, + &iinfo, + &hInstStr, + &ResourceStr, + &bpp, + FALSE) == TRUE);
- TEST(hInstStr.Length != 0); + TEST(hInstStr.Length != 0); hInstStr.Buffer[hInstStr.Length] = 0; - printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); - TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); - TEST(ResourceStr.Length == 0); - TEST(ResourceStr.MaximumLength == 0); - TEST(bpp == 32); + printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); + TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); + TEST(ResourceStr.Length == 0); + TEST(ResourceStr.MaximumLength == 0); + TEST(bpp == 32);
- ZeroMemory(hInstStr.Buffer, MAX_PATH*sizeof(WCHAR)); + ZeroMemory(hInstStr.Buffer, MAX_PATH*sizeof(WCHAR)); hInstStr.Length = 0; - RtlInitUnicodeString(&ResourceStr, NULL); + RtlInitUnicodeString(&ResourceStr, NULL);
- TEST(NtUserGetIconInfo(hIcon, - &iinfo, - &hInstStr, - &ResourceStr, - &bpp, - TRUE) == TRUE); + TEST(NtUserGetIconInfo(hIcon, + &iinfo, + &hInstStr, + &ResourceStr, + &bpp, + TRUE) == TRUE);
TEST(hInstStr.Length != 0); hInstStr.Buffer[hInstStr.Length] = 0; - printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); - TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); - TEST(bpp == 32); + printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); + TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); + TEST(bpp == 32);
- DestroyIcon(hIcon); + DestroyIcon(hIcon);
} diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserRedrawWindow.c b/modules/rostests/apitests/win32nt/ntuser/NtUserRedrawWindow.c index bb284eb156..fda0228134 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserRedrawWindow.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserRedrawWindow.c @@ -10,29 +10,29 @@ START_TEST(NtUserRedrawWindow) { HINSTANCE hinst = GetModuleHandle(NULL); - HWND hWnd; - RECT rect; + HWND hWnd; + RECT rect;
- hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - NULL, - hinst, - 0); - ASSERT(hWnd); + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + NULL, + hinst, + 0); + ASSERT(hWnd);
- rect.left = 0; - rect.top = 0; - rect.right = 10; - rect.bottom = 10; + rect.left = 0; + rect.top = 0; + rect.right = 10; + rect.bottom = 10;
- TEST(NtUserRedrawWindow(hWnd, &rect, NULL, RDW_VALIDATE) == TRUE); + TEST(NtUserRedrawWindow(hWnd, &rect, NULL, RDW_VALIDATE) == TRUE);
- DestroyWindow(hWnd); + DestroyWindow(hWnd);
} diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserScrollDC.c b/modules/rostests/apitests/win32nt/ntuser/NtUserScrollDC.c index bbb5e08001..e002aaee0c 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserScrollDC.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserScrollDC.c @@ -10,108 +10,108 @@ START_TEST(NtUserScrollDC) { HINSTANCE hinst = GetModuleHandle(NULL); - HWND hWnd; - HDC hDC; - HRGN hRgn, hTmpRgn; - RECT rcScroll, rcClip, rcUpdate; - RECT rect = {0,0,100,100}; - INT Result; - - hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 100, - NULL, - NULL, - hinst, - 0); - ASSERT(hWnd); - RedrawWindow(hWnd, &rect, NULL, RDW_UPDATENOW); - - hDC = GetDC(hWnd); - ASSERT(hDC); - - hRgn = CreateRectRgn(0,0,10,10); - - - /* Test inverted clip rect */ - rcScroll.left = 0; - rcScroll.top = 25; - rcScroll.right = 100; - rcScroll.bottom = 40; - rcClip.left = 0; - rcClip.top = 35; - rcClip.right = -70; - rcClip.bottom = -1000; - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); - RTEST(Result == 1); - RTEST(GetLastError() == ERROR_SUCCESS); - - /* Test inverted scroll rect */ - rcScroll.left = 0; - rcScroll.top = 25; - rcScroll.right = -100; - rcScroll.bottom = -40; - rcClip.left = 0; - rcClip.top = 35; - rcClip.right = 70; - rcClip.bottom = 1000; - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); - RTEST(Result == 1); - RTEST(GetLastError() == ERROR_SUCCESS); - - rcScroll.left = 0; - rcScroll.top = 25; - rcScroll.right = 100; - rcScroll.bottom = 40; - - /* Test invalid update region */ - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate); - RTEST(Result == 0); - TEST(GetLastError() == ERROR_INVALID_HANDLE); - - /* Test invalid dc */ - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); - RTEST(Result == 0); - RTEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid update rect */ - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000); - RTEST(Result == 0); - RTEST(GetLastError() == ERROR_NOACCESS); - - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); - - RTEST(Result == TRUE); - RTEST(rcUpdate.left == 0); - RTEST(rcUpdate.top == 35); - RTEST(rcUpdate.right == 70); - RTEST(rcUpdate.bottom == 55); - - hTmpRgn = CreateRectRgn(10,45,70,55); - Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); - RTEST(Result == SIMPLEREGION); - - SetRectRgn(hTmpRgn,0,35,70,40); - Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); - RTEST(Result == NULLREGION); - - DeleteObject(hTmpRgn); - - /* TODO: Test with another window in front */ - /* TODO: Test with different viewport extension */ - - ReleaseDC(hWnd, hDC); - DestroyWindow(hWnd); - DeleteObject(hRgn); + HWND hWnd; + HDC hDC; + HRGN hRgn, hTmpRgn; + RECT rcScroll, rcClip, rcUpdate; + RECT rect = {0,0,100,100}; + INT Result; + + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 100, + NULL, + NULL, + hinst, + 0); + ASSERT(hWnd); + RedrawWindow(hWnd, &rect, NULL, RDW_UPDATENOW); + + hDC = GetDC(hWnd); + ASSERT(hDC); + + hRgn = CreateRectRgn(0,0,10,10); + + + /* Test inverted clip rect */ + rcScroll.left = 0; + rcScroll.top = 25; + rcScroll.right = 100; + rcScroll.bottom = 40; + rcClip.left = 0; + rcClip.top = 35; + rcClip.right = -70; + rcClip.bottom = -1000; + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); + RTEST(Result == 1); + RTEST(GetLastError() == ERROR_SUCCESS); + + /* Test inverted scroll rect */ + rcScroll.left = 0; + rcScroll.top = 25; + rcScroll.right = -100; + rcScroll.bottom = -40; + rcClip.left = 0; + rcClip.top = 35; + rcClip.right = 70; + rcClip.bottom = 1000; + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); + RTEST(Result == 1); + RTEST(GetLastError() == ERROR_SUCCESS); + + rcScroll.left = 0; + rcScroll.top = 25; + rcScroll.right = 100; + rcScroll.bottom = 40; + + /* Test invalid update region */ + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate); + RTEST(Result == 0); + TEST(GetLastError() == ERROR_INVALID_HANDLE); + + /* Test invalid dc */ + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); + RTEST(Result == 0); + RTEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid update rect */ + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000); + RTEST(Result == 0); + RTEST(GetLastError() == ERROR_NOACCESS); + + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); + + RTEST(Result == TRUE); + RTEST(rcUpdate.left == 0); + RTEST(rcUpdate.top == 35); + RTEST(rcUpdate.right == 70); + RTEST(rcUpdate.bottom == 55); + + hTmpRgn = CreateRectRgn(10,45,70,55); + Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); + RTEST(Result == SIMPLEREGION); + + SetRectRgn(hTmpRgn,0,35,70,40); + Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); + RTEST(Result == NULLREGION); + + DeleteObject(hTmpRgn); + + /* TODO: Test with another window in front */ + /* TODO: Test with different viewport extension */ + + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd); + DeleteObject(hRgn);
}
diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserSelectPalette.c b/modules/rostests/apitests/win32nt/ntuser/NtUserSelectPalette.c index 089fd23ba2..8c00d39f3b 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserSelectPalette.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserSelectPalette.c @@ -11,141 +11,141 @@ FORCEINLINE PALETTEENTRY PALENTRY(BYTE r, BYTE g, BYTE b) { - PALETTEENTRY ret; + PALETTEENTRY ret;
- ret.peRed = r; - ret.peGreen = g; - ret.peBlue = b; - ret.peFlags = 0; - return ret; + ret.peRed = r; + ret.peGreen = g; + ret.peBlue = b; + ret.peFlags = 0; + return ret; }
START_TEST(NtUserSelectPalette) { HINSTANCE hinst = GetModuleHandle(NULL); - HPALETTE hPal, hOldPal; - HWND hWnd; - HDC hDC, hCompDC; - struct - { - LOGPALETTE logpal; - PALETTEENTRY entry[20]; - } pal; - - ZeroMemory(&pal, sizeof(pal)); - - pal.logpal.palVersion = 0x300; - pal.logpal.palNumEntries = 6; - pal.entry[0] = PALENTRY(0,0,0); - pal.entry[1] = PALENTRY(255,255,255); - pal.entry[2] = PALENTRY(128,128,128); - pal.entry[3] = PALENTRY(128,0,0); - pal.entry[4] = PALENTRY(0,128,0); - pal.entry[5] = PALENTRY(0,0,128); - - hPal = CreatePalette(&pal.logpal); - ASSERT(hPal); - TEST(DeleteObject(hPal) == 1); - hPal = CreatePalette(&pal.logpal); - ASSERT(hPal); - - /* Create a window */ - hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, - NULL, NULL, hinst, 0); - hDC = GetDC(hWnd); - ASSERT(hDC); - hCompDC = CreateCompatibleDC(hDC); - ASSERT(hCompDC); - - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldPal = NtUserSelectPalette(NULL, hPal, 0); - TEST(hOldPal == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldPal = NtUserSelectPalette((HDC)-1, hPal, 0); - TEST(hOldPal == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test NULL palette */ - SetLastError(ERROR_SUCCESS); - hOldPal = NtUserSelectPalette(hDC, NULL, 0); - TEST(hOldPal == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid palette */ - SetLastError(ERROR_SUCCESS); - hOldPal = NtUserSelectPalette(hDC, (HPALETTE)-1, 0); - TEST(hOldPal == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test valid palette */ - hOldPal = NtUserSelectPalette(hDC, hPal, 0); - TEST(hOldPal != 0); - TEST(hOldPal == GetStockObject(DEFAULT_PALETTE)); - - /* We cannot Delete the palette */ - TEST(DeleteObject(hPal) == 0); - - /* We can still select the Palette into a compatible DC */ - hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); - TEST(hOldPal != 0); + HPALETTE hPal, hOldPal; + HWND hWnd; + HDC hDC, hCompDC; + struct + { + LOGPALETTE logpal; + PALETTEENTRY entry[20]; + } pal; + + ZeroMemory(&pal, sizeof(pal)); + + pal.logpal.palVersion = 0x300; + pal.logpal.palNumEntries = 6; + pal.entry[0] = PALENTRY(0,0,0); + pal.entry[1] = PALENTRY(255,255,255); + pal.entry[2] = PALENTRY(128,128,128); + pal.entry[3] = PALENTRY(128,0,0); + pal.entry[4] = PALENTRY(0,128,0); + pal.entry[5] = PALENTRY(0,0,128); + + hPal = CreatePalette(&pal.logpal); + ASSERT(hPal); + TEST(DeleteObject(hPal) == 1); + hPal = CreatePalette(&pal.logpal); + ASSERT(hPal); + + /* Create a window */ + hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, + NULL, NULL, hinst, 0); + hDC = GetDC(hWnd); + ASSERT(hDC); + hCompDC = CreateCompatibleDC(hDC); + ASSERT(hCompDC); + + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldPal = NtUserSelectPalette(NULL, hPal, 0); + TEST(hOldPal == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldPal = NtUserSelectPalette((HDC)-1, hPal, 0); + TEST(hOldPal == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test NULL palette */ + SetLastError(ERROR_SUCCESS); + hOldPal = NtUserSelectPalette(hDC, NULL, 0); + TEST(hOldPal == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid palette */ + SetLastError(ERROR_SUCCESS); + hOldPal = NtUserSelectPalette(hDC, (HPALETTE)-1, 0); + TEST(hOldPal == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test valid palette */ + hOldPal = NtUserSelectPalette(hDC, hPal, 0); + TEST(hOldPal != 0); + TEST(hOldPal == GetStockObject(DEFAULT_PALETTE)); + + /* We cannot Delete the palette */ + TEST(DeleteObject(hPal) == 0); + + /* We can still select the Palette into a compatible DC */ + hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); + TEST(hOldPal != 0);
#if 0 - RealizePalette(hDC); - - GetClientRect(hWnd, &rect); - FillRect(hDC, &rect, GetSysColorBrush(COLOR_BTNSHADOW)); - - TEST(GetNearestColor(hDC, RGB(0,0,0)) == RGB(0,0,0)); - TEST(GetNearestColor(hDC, RGB(0,0,1)) == RGB(0,0,1)); - - ReleaseDC(hWnd, hDC); - DestroyWindow(hWnd); - RECT rect; - HBITMAP hBmp; - - - BITMAPINFOHEADER bmih = {sizeof(BITMAPINFOHEADER), // biSize - 3, // biWidth - 3, // biHeight - 1, // biPlanes - 8, // biBitCount - BI_RGB, // biCompression - 0, // biSizeImage - 92, // biXPelsPerMeter - 92, // biYPelsPerMeter - 6, // biClrUsed - 6}; // biClrImportant - BYTE bits[3][3] = {{0,1,2},{3,4,5},{6,1,2}}; - - struct - { - BITMAPINFOHEADER bmih; - RGBQUAD colors[6]; - } bmi = {{sizeof(BITMAPINFOHEADER),3,3,1,8,BI_RGB,0,92,92,6,6}, - {{0,0,0,0},{255,255,255,0},{255,0,0,0}, - {0,255,0,0},{0,0,255,0},{128,128,128,0}}}; - - hBmp = CreateDIBitmap(hCompDC, &bmih, CBM_INIT, &bits, (BITMAPINFO*)&bmi, DIB_RGB_COLORS); - ASSERT(hBmp); - - SetLastError(0); - TEST(NtGdiSelectBitmap(hCompDC, hBmp)); - hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); - TEST(hOldPal != NULL); - RealizePalette(hCompDC); - - TEST(GetNearestColor(hCompDC, RGB(0,0,0)) == RGB(0,0,0)); - TEST(GetNearestColor(hCompDC, RGB(0,0,1)) == RGB(0,0,0)); - TEST(GetNearestColor(hCompDC, RGB(100,0,0)) == RGB(0,0,0)); - TEST(GetNearestColor(hCompDC, RGB(250,250,250)) == RGB(255,255,255)); - TEST(GetNearestColor(hCompDC, RGB(120,100,110)) == RGB(128,128,128)); + RealizePalette(hDC); + + GetClientRect(hWnd, &rect); + FillRect(hDC, &rect, GetSysColorBrush(COLOR_BTNSHADOW)); + + TEST(GetNearestColor(hDC, RGB(0,0,0)) == RGB(0,0,0)); + TEST(GetNearestColor(hDC, RGB(0,0,1)) == RGB(0,0,1)); + + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd); + RECT rect; + HBITMAP hBmp; + + + BITMAPINFOHEADER bmih = {sizeof(BITMAPINFOHEADER), // biSize + 3, // biWidth + 3, // biHeight + 1, // biPlanes + 8, // biBitCount + BI_RGB, // biCompression + 0, // biSizeImage + 92, // biXPelsPerMeter + 92, // biYPelsPerMeter + 6, // biClrUsed + 6}; // biClrImportant + BYTE bits[3][3] = {{0,1,2},{3,4,5},{6,1,2}}; + + struct + { + BITMAPINFOHEADER bmih; + RGBQUAD colors[6]; + } bmi = {{sizeof(BITMAPINFOHEADER),3,3,1,8,BI_RGB,0,92,92,6,6}, + {{0,0,0,0},{255,255,255,0},{255,0,0,0}, + {0,255,0,0},{0,0,255,0},{128,128,128,0}}}; + + hBmp = CreateDIBitmap(hCompDC, &bmih, CBM_INIT, &bits, (BITMAPINFO*)&bmi, DIB_RGB_COLORS); + ASSERT(hBmp); + + SetLastError(0); + TEST(NtGdiSelectBitmap(hCompDC, hBmp)); + hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); + TEST(hOldPal != NULL); + RealizePalette(hCompDC); + + TEST(GetNearestColor(hCompDC, RGB(0,0,0)) == RGB(0,0,0)); + TEST(GetNearestColor(hCompDC, RGB(0,0,1)) == RGB(0,0,0)); + TEST(GetNearestColor(hCompDC, RGB(100,0,0)) == RGB(0,0,0)); + TEST(GetNearestColor(hCompDC, RGB(250,250,250)) == RGB(255,255,255)); + TEST(GetNearestColor(hCompDC, RGB(120,100,110)) == RGB(128,128,128));
printf("nearest = 0x%x\n", GetNearestColor(hCompDC, RGB(120,100,110))); #endif diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserSetTimer.c b/modules/rostests/apitests/win32nt/ntuser/NtUserSetTimer.c index dae9b1e313..dd1067a515 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserSetTimer.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserSetTimer.c @@ -11,8 +11,8 @@ START_TEST(NtUserSetTimer) {
- // check valid argument - // check for replacement / new timers - // check when expiries are handled (msgs and calls) + // check valid argument + // check for replacement / new timers + // check when expiries are handled (msgs and calls)
} diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserSystemParametersInfo.c b/modules/rostests/apitests/win32nt/ntuser/NtUserSystemParametersInfo.c index feb14b30c7..33f7b26a59 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserSystemParametersInfo.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserSystemParametersInfo.c @@ -75,13 +75,13 @@ static const WCHAR* VAL_BEEP = L"Beep"; LONG QueryUserRegValueW(PCWSTR pszSubKey, PCWSTR pszValueName, PVOID pData, LPDWORD cbSize, LPDWORD pType) { - HKEY hKey; - LONG ret; + HKEY hKey; + LONG ret;
- RegOpenKeyExW(HKEY_CURRENT_USER, pszSubKey, 0, KEY_QUERY_VALUE, &hKey); - ret = RegQueryValueExW(hKey, pszValueName, NULL, pType, (LPBYTE)pData, cbSize); - RegCloseKey(hKey); - return ret; + RegOpenKeyExW(HKEY_CURRENT_USER, pszSubKey, 0, KEY_QUERY_VALUE, &hKey); + ret = RegQueryValueExW(hKey, pszValueName, NULL, pType, (LPBYTE)pData, cbSize); + RegCloseKey(hKey); + return ret; }
@@ -89,235 +89,235 @@ HWND CreateTestWindow() { HINSTANCE hinst = GetModuleHandle(NULL); - WNDCLASSA wc; - - wc.style = 0; - wc.lpfnWndProc = DefWindowProcA; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hinst; - wc.hIcon = NULL; - wc.hCursor = NULL; - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.lpszClassName = "testclass"; - - RegisterClassA(&wc); - return CreateWindowA("testclass", - "testwnd", - WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - NULL, - hinst, - 0); + WNDCLASSA wc; + + wc.style = 0; + wc.lpfnWndProc = DefWindowProcA; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hinst; + wc.hIcon = NULL; + wc.hCursor = NULL; + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; + wc.lpszClassName = "testclass"; + + RegisterClassA(&wc); + return CreateWindowA("testclass", + "testwnd", + WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + NULL, + hinst, + 0); }
void Test_NtUserSystemParametersInfo_Params(void) { -// UINT uint; - DWORD data[1000]; - UINT i, uint; - ACCESSTIMEOUT ato; - /* Test normal */ - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uint, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid SPI code */ - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(7, 0, &data, 0) == FALSE); - TEST(GetLastError() == ERROR_INVALID_PARAMETER); - - /* Test wrong cbSize member */ - ato.cbSize = 1; - SetLastError(0xdeadbeef); - TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0) == FALSE); - TEST(GetLastError() == 0xdeadbeef); +// UINT uint; + DWORD data[1000]; + UINT i, uint; + ACCESSTIMEOUT ato; + /* Test normal */ + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uint, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid SPI code */ + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(7, 0, &data, 0) == FALSE); + TEST(GetLastError() == ERROR_INVALID_PARAMETER); + + /* Test wrong cbSize member */ + ato.cbSize = 1; + SetLastError(0xdeadbeef); + TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0) == FALSE); + TEST(GetLastError() == 0xdeadbeef); #if 0 - /* Test undocumented, but valid SPI codes */ - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x1010, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] <= 1); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x1011, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - data[0] = 0; - NtUserSystemParametersInfo(0x1010, 0, &data, 0); - TEST(data[0] == 1); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x1028, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x1029, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x102A, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4139, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4140, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4141, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4142, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4143, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4144, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4145, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4146, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4147, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4148, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4149, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4150, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4151, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4152, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4153, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4154, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4155, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4156, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4157, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); + /* Test undocumented, but valid SPI codes */ + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x1010, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] <= 1); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x1011, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + data[0] = 0; + NtUserSystemParametersInfo(0x1010, 0, &data, 0); + TEST(data[0] == 1); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x1028, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x1029, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x102A, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4139, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4140, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4141, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4142, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4143, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4144, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4145, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4146, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4147, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4148, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4149, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4150, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4151, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4152, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4153, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4154, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4155, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4156, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4157, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); #endif - /* Test invalid pointer */ - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, (PVOID)0x80000000, 0) == FALSE); - TEST(GetLastError() == ERROR_NOACCESS); - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + /* Test invalid pointer */ + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, (PVOID)0x80000000, 0) == FALSE); + TEST(GetLastError() == ERROR_NOACCESS); + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
- /* test wrong bools */ + /* test wrong bools */ }
void @@ -370,89 +370,89 @@ Test_NtUserSystemParametersInfo_Winsta(void) void Test_NtUserSystemParametersInfo_fWinIni(void) { - ACCESSTIMEOUT ato; -// UINT uFocusBorderHeight; - WCHAR Buffer[6]; - DWORD cbSize; + ACCESSTIMEOUT ato; +// UINT uFocusBorderHeight; + WCHAR Buffer[6]; + DWORD cbSize;
- ato.cbSize = sizeof(ato); - NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0); - ato.iTimeOutMSec++; - NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0); - ato.iTimeOutMSec--; + ato.cbSize = sizeof(ato); + NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0); + ato.iTimeOutMSec++; + NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0); + ato.iTimeOutMSec--;
-// NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, 0); -// NtUserSystemParametersInfo(SPI_SETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, SPIF_UPDATEINIFILE); +// NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, 0); +// NtUserSystemParametersInfo(SPI_SETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, SPIF_UPDATEINIFILE);
- NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0); + NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0);
- cbSize = 6; - QueryUserRegValueW(L"Control Panel\Accessibility\TimeOut", L"TimeToWait", &Buffer, &cbSize, NULL); + cbSize = 6; + QueryUserRegValueW(L"Control Panel\Accessibility\TimeOut", L"TimeToWait", &Buffer, &cbSize, NULL);
}
void Test_MetricKey(PCWSTR pwszVal, INT iVal) { - WCHAR szReg[10]; - DWORD cbSize; + WCHAR szReg[10]; + DWORD cbSize;
- cbSize = sizeof(szReg); - TESTX(QueryUserRegValueW(KEY_METRIC, pwszVal, &szReg, &cbSize, NULL) == ERROR_SUCCESS, "Value=%S\n", pwszVal); - TESTX(_wcsicmp(szReg, L"1") == 0, "Value=%S\n", pwszVal); + cbSize = sizeof(szReg); + TESTX(QueryUserRegValueW(KEY_METRIC, pwszVal, &szReg, &cbSize, NULL) == ERROR_SUCCESS, "Value=%S\n", pwszVal); + TESTX(_wcsicmp(szReg, L"1") == 0, "Value=%S\n", pwszVal);
}
void Test_UserPref(UINT uiGet, UINT uiSet, DWORD dwPrefMask) { - BOOL bOrig, bTemp = 0; - DWORD dwUserPref, dwUserPrefOrg; - DWORD cbSize; - - /* Get original values */ - NtUserSystemParametersInfo(uiGet, 0, &bOrig, 0); - cbSize = sizeof(dwUserPrefOrg); - QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefOrg, &cbSize, NULL); - - /* Value 0 */ - NtUserSystemParametersInfo(uiSet, 0, NULL, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); - TEST(bTemp == 0); - cbSize = sizeof(dwUserPref); - TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); - TEST((dwUserPref & dwPrefMask) == 0); - TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); - - /* Value 1 without Registry */ - NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, 0); - NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); - TEST(bTemp == 1); - cbSize = sizeof(dwUserPref); - TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); - TEST((dwUserPref & dwPrefMask) == 0); - TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); - - /* Value 2 without Registry */ - NtUserSystemParametersInfo(uiSet, 0, (PVOID)2, 0); - NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); - TEST(bTemp == 1); - cbSize = sizeof(dwUserPref); - TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); - TEST((dwUserPref & dwPrefMask) == 0); - TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); - - /* Value 1 with Registry */ - NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); - TEST(bTemp == 1); - cbSize = sizeof(dwUserPref); - TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); - TEST((dwUserPref & dwPrefMask) == dwPrefMask); - TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); - - /* Restore original value */ - NtUserSystemParametersInfo(uiSet, 0, (PVOID)bOrig, SPIF_UPDATEINIFILE); + BOOL bOrig, bTemp = 0; + DWORD dwUserPref, dwUserPrefOrg; + DWORD cbSize; + + /* Get original values */ + NtUserSystemParametersInfo(uiGet, 0, &bOrig, 0); + cbSize = sizeof(dwUserPrefOrg); + QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefOrg, &cbSize, NULL); + + /* Value 0 */ + NtUserSystemParametersInfo(uiSet, 0, NULL, SPIF_UPDATEINIFILE); + NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); + TEST(bTemp == 0); + cbSize = sizeof(dwUserPref); + TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); + TEST((dwUserPref & dwPrefMask) == 0); + TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); + + /* Value 1 without Registry */ + NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, 0); + NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); + TEST(bTemp == 1); + cbSize = sizeof(dwUserPref); + TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); + TEST((dwUserPref & dwPrefMask) == 0); + TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); + + /* Value 2 without Registry */ + NtUserSystemParametersInfo(uiSet, 0, (PVOID)2, 0); + NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); + TEST(bTemp == 1); + cbSize = sizeof(dwUserPref); + TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); + TEST((dwUserPref & dwPrefMask) == 0); + TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); + + /* Value 1 with Registry */ + NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, SPIF_UPDATEINIFILE); + NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); + TEST(bTemp == 1); + cbSize = sizeof(dwUserPref); + TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); + TEST((dwUserPref & dwPrefMask) == dwPrefMask); + TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); + + /* Restore original value */ + NtUserSystemParametersInfo(uiSet, 0, (PVOID)bOrig, SPIF_UPDATEINIFILE);
} @@ -463,64 +463,64 @@ Test_UserPref(UINT uiGet, UINT uiSet, DWORD dwPrefMask) void Test_SPI_SETBEEP(void) { - BOOL bOrig, bTemp = 0; - WCHAR szReg[10]; - DWORD cbSize; - - /* Get original value */ - NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bOrig, 0); - - /* Value 0 */ - NtUserSystemParametersInfo(SPI_SETBEEP, 0, NULL, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0); - TEST(bTemp == 0); - cbSize = sizeof(szReg); - TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) == ERROR_SUCCESS); - TEST(_wcsicmp(szReg, L"No") == 0); - - /* Value 1 */ - NtUserSystemParametersInfo(SPI_SETBEEP, 1, NULL, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0); - TEST(bTemp == 1); - cbSize = sizeof(szReg); - TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) == ERROR_SUCCESS); - TEST(_wcsicmp(szReg, L"Yes") == 0); - ... 2103 lines suppressed ...